:root {
  --bg-primary: #0a0e1a;
  --bg-secondary: #141829;
  --bg-panel: rgba(10, 14, 26, 0.92);
  --blaze: #ff4444;
  --blaze-glow: #ff6b35;
  --alex: #ffd700;
  --alex-glow: #f0c040;
  --ghost-c: #b0c4de;
  --ghost-glow: #8eafc5;
  --iris: #7fb069;
  --iris-glow: #a8d5a2;
  --yosuke: #ff9f43;
  --spectre: #7c5cbf;
  --text-primary: #e8e6f0;
  --text-secondary: #9a97b0;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: 'Crimson Pro', serif;
  overflow: hidden;
  height: 100vh;
  height: 100dvh;
  width: 100vw;
}

#root { height: 100%; width: 100%; }

@keyframes glitch {
  0% { text-shadow: 2px 0 #ff4444, -2px 0 #4444ff; }
  20% { text-shadow: -2px 2px #ff4444, 2px -2px #4444ff; }
  40% { text-shadow: 2px -2px #ff4444, -2px 2px #4444ff; transform: translate(1px, 0); }
  60% { text-shadow: -1px 0 #ff4444, 1px 0 #4444ff; transform: translate(-1px, 0); }
  80% { text-shadow: 2px 2px #ff4444, -2px -2px #4444ff; }
  100% { text-shadow: 2px 0 #ff4444, -2px 0 #4444ff; transform: translate(0, 0); }
}

@keyframes kenburns {
  0% { transform: scale(1.0) translate(0, 0); }
  50% { transform: scale(1.08) translate(-1%, -1%); }
  100% { transform: scale(1.0) translate(0, 0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(40px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes typewriterBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 5px rgba(255, 255, 255, 0.1); }
  50% { box-shadow: 0 0 20px rgba(255, 255, 255, 0.3); }
}

@keyframes bobFloat {
  0%, 100% { transform: translateX(-50%) translateY(0px); }
  50% { transform: translateX(-50%) translateY(-6px); }
}

@keyframes scanline {
  0% { background-position: 0 0; }
  100% { background-position: 0 100vh; }
}

@keyframes shimmer {
  0% { background-position: -200% center; }
  100% { background-position: 200% center; }
}

@keyframes particleDrift {
  0% { transform: translateY(100vh) translateX(0) rotate(0deg); opacity: 0; }
  10% { opacity: 0.6; }
  90% { opacity: 0.6; }
  100% { transform: translateY(-10vh) translateX(50px) rotate(360deg); opacity: 0; }
}

@keyframes pulseArrow {
  0%, 100% { opacity: 0.4; transform: translateY(0); }
  50% { opacity: 1; transform: translateY(3px); }
}

.font-display { font-family: 'Bricolage Grotesque', sans-serif; }
.font-mono { font-family: 'JetBrains Mono', monospace; }
.font-narrative { font-family: 'Crimson Pro', serif; }

.glitch-text {
  animation: glitch 3s infinite;
  letter-spacing: 4px;
}

.kenburns-bg {
  animation: kenburns 25s ease-in-out infinite;
}

.scene-fade { animation: fadeIn 500ms ease-out; }
.slide-up { animation: slideUp 400ms ease-out; }
.slide-right { animation: slideInRight 300ms ease-out; }

.bob-float {
  animation: bobFloat 3s ease-in-out infinite;
}

.scanline-overlay {
  pointer-events: none;
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.03) 2px,
    rgba(0, 0, 0, 0.03) 4px
  );
  animation: scanline 8s linear infinite;
  z-index: 5;
}

.typewriter-cursor {
  display: inline;
}
.typewriter-cursor::after {
  content: '▊';
  animation: typewriterBlink 0.8s infinite;
  color: var(--text-secondary);
  margin-left: 2px;
}

.continue-arrow {
  animation: pulseArrow 1.2s ease-in-out infinite;
}

.choice-btn {
  transition: all 0.3s ease;
  background: linear-gradient(135deg, rgba(20, 24, 41, 0.95), rgba(30, 35, 55, 0.95));
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.choice-btn:hover {
  border-color: rgba(255, 255, 255, 0.4);
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
}
.choice-btn:active {
  transform: translateY(0);
}

.shimmer-btn {
  background-size: 200% auto;
  background-image: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.05) 50%, transparent 100%);
  animation: shimmer 3s linear infinite;
}

.dialogue-box {
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  background: var(--bg-panel);
  border-top: 2px solid rgba(255, 255, 255, 0.05);
}

.chat-bubble {
  max-width: 75%;
  padding: 8px 14px;
  border-radius: 16px;
  font-size: 0.9rem;
  line-height: 1.4;
  word-break: break-word;
}

.chat-bubble-left {
  border-bottom-left-radius: 4px;
}

.chat-bubble-right {
  border-bottom-right-radius: 4px;
}

.particle {
  position: absolute;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  animation: particleDrift linear infinite;
}

.affinity-bar {
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.affinity-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.5s ease;
}

.menu-panel {
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  background: rgba(10, 14, 26, 0.96);
}

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 3px; }

/* Mobile adjustments */
@media (max-width: 640px) {
  .chat-bubble { max-width: 85%; font-size: 0.82rem; }
  .dialogue-box { min-height: 120px !important; }
}

@media (max-height: 500px) {
  .dialogue-box { min-height: 100px !important; }
}