/* Terminal Simulator Styles */
:root {
  --term-bg: #1e1e1e;
  --term-text: #d4d4d4;
  --term-green: #4ec9b0;
  --term-blue: #569cd6;
  --term-yellow: #dcdcaa;
  --term-red: #f44747;
  --term-purple: #c586c0;
  --term-cyan: #4fc3f7;
  --term-dim: #6a6a6a;
  --term-prompt: #4ec9b0;
  --term-cursor: #d4d4d4;
  --titlebar-bg: #323233;
  --titlebar-text: #9e9e9e;
  --button-red: #ff5f57;
  --button-yellow: #febc2e;
  --button-green: #28c840;
  --accent: #4fc3f7;
  --accent-glow: rgba(79, 195, 247, 0.3);
  --gold: #ffd700;
}

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

body {
  background: #0a0a0f;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-family: -apple-system, BlinkMacSystemFont, sans-serif;
  padding: 2rem;
  position: relative;
  overflow-x: hidden;
  animation: page-fade-in 0.5s ease-out;
}

@keyframes page-fade-in {
  0% { opacity: 0; }
  100% { opacity: 1; }
}

/* Star field background (matching landing page) */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image:
    radial-gradient(1px 1px at 20% 30%, white, transparent),
    radial-gradient(1px 1px at 60% 70%, white, transparent),
    radial-gradient(1px 1px at 50% 50%, white, transparent),
    radial-gradient(1px 1px at 80% 10%, white, transparent),
    radial-gradient(1px 1px at 90% 60%, white, transparent);
  background-size: 200% 200%;
  background-position: 0% 0%;
  animation: stars-drift 60s ease-in-out infinite;
  opacity: 0.15;
  pointer-events: none;
  z-index: 0;
}

@keyframes stars-drift {
  0%, 100% { background-position: 0% 0%; }
  50% { background-position: 100% 100%; }
}

body > * {
  position: relative;
  z-index: 1;
}

/* ===== HIDDEN EXTERNAL UI ===== */
.terminal-header,
.instruction-banner,
.quest-progress {
  display: none;
}

/* ===== INSTRUCTION BANNER ===== */
.instruction-banner {
  position: relative;
  background: linear-gradient(135deg, rgba(79, 195, 247, 0.08) 0%, rgba(187, 134, 252, 0.08) 100%);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(79, 195, 247, 0.2);
  border-radius: 12px;
  padding: 1.5rem 2rem;
  margin-bottom: 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  z-index: 10;
  transition: all 0.3s ease;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  max-width: 1200px;
  width: 100%;
}

.instruction-content {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.instruction-icon {
  font-size: 1.5rem;
  animation: bounce-subtle 2s infinite;
}

@keyframes bounce-subtle {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

.instruction-text {
  color: #e0e0e0;
  font-size: 1.1rem;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-weight: 500;
  flex: 1;
  line-height: 1.6;
}

.instruction-text code {
  background: rgba(79, 195, 247, 0.15);
  padding: 0.35rem 0.75rem;
  border-radius: 8px;
  font-weight: 600;
  border: 1px solid rgba(79, 195, 247, 0.4);
  font-size: 1.15rem;
  color: var(--accent-bright);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.instruction-text .your-turn {
  color: var(--gold);
  font-weight: 700;
  text-transform: uppercase;
}

.instruction-text .enter-key {
  color: var(--term-green);
  font-weight: 600;
}

.instruction-actions {
  display: flex;
  gap: 0.5rem;
}

.hint-btn, .skip-btn {
  background: rgba(79, 195, 247, 0.1);
  border: 1px solid var(--accent);
  color: var(--accent);
  padding: 0.4rem 0.9rem;
  border-radius: 6px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.hint-btn:hover, .skip-btn:hover {
  background: rgba(79, 195, 247, 0.2);
  transform: translateY(-1px);
}

.hint-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.skip-btn {
  border-color: var(--text-muted);
  color: var(--text-muted);
}

.skip-btn:hover {
  border-color: var(--text-secondary);
  color: var(--text-secondary);
}

/* ===== QUEST PROGRESS ===== */
.quest-progress {
  position: fixed;
  top: 5rem;
  right: 2rem;
  background: linear-gradient(135deg, rgba(26, 26, 46, 0.95) 0%, rgba(42, 42, 62, 0.95) 100%);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(79, 195, 247, 0.3);
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  z-index: 50;
  min-width: 220px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.quest-title {
  color: var(--gold);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 0.25rem;
}

.quest-name {
  color: var(--term-text);
  font-size: 0.85rem;
  margin-bottom: 0.25rem;
}

.quest-step-info {
  color: var(--text-secondary);
  font-size: 0.7rem;
  margin-bottom: 0.5rem;
}

.quest-bar-container {
  background: rgba(255,255,255,0.1);
  border-radius: 4px;
  height: 6px;
  overflow: hidden;
}

.quest-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #0288d1);
  border-radius: 4px;
  transition: width 0.5s ease;
}

.quest-xp {
  color: var(--accent);
  font-size: 0.75rem;
  margin-top: 0.4rem;
  text-align: right;
}

/* ===== TERMINAL WINDOW ===== */
.terminal-container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  animation: terminal-zoom-in 0.6s ease-out;
}

@keyframes terminal-zoom-in {
  0% {
    opacity: 0;
    transform: scale(0.8);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

.terminal-window {
  background: var(--term-bg);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 40px rgba(79, 195, 247, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

/* Title Bar */
.terminal-titlebar {
  background: var(--titlebar-bg);
  padding: 0.6rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  user-select: none;
}

.titlebar-buttons {
  display: flex;
  gap: 8px;
}

.titlebar-btn {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.titlebar-btn.red { background: var(--button-red); }
.titlebar-btn.yellow { background: var(--button-yellow); }
.titlebar-btn.green { background: var(--button-green); }

.titlebar-text {
  flex: 1;
  text-align: center;
  color: var(--titlebar-text);
  font-size: 0.8rem;
}

/* Terminal Body */
.terminal-body {
  padding: 1.5rem 2rem;
  min-height: 500px;
  max-height: 70vh;
  overflow-y: auto;
  font-family: 'JetBrains Mono', 'Fira Code', 'SF Mono', monospace;
  font-size: 1rem;
  line-height: 1.6;
}

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

/* Terminal Lines */
.terminal-line {
  display: flex;
  align-items: flex-start;
  margin-bottom: 0.25rem;
  white-space: pre-wrap;
  word-break: break-all;
}

.terminal-line.output {
  color: var(--term-text);
  padding-left: 0;
}

.terminal-line.explanation {
  color: var(--term-dim);
  font-style: italic;
  padding: 0.25rem 0;
  border-left: 2px solid var(--accent);
  padding-left: 0.75rem;
  margin: 0.5rem 0;
}

.terminal-line.success {
  color: var(--term-green);
}

.terminal-line.user-input {
  color: var(--term-text);
  opacity: 0.9;
}

.terminal-line.correct {
  color: var(--term-green);
  font-weight: 600;
}

.terminal-line.error {
  color: var(--term-red);
}

.terminal-line.command-example {
  color: var(--gold);
  font-weight: 700;
  font-size: 1.3rem;
  padding-left: 2rem;
  background: rgba(255, 215, 0, 0.1);
  border-left: 4px solid var(--gold);
  padding: 0.75rem 1rem 0.75rem 2rem;
  margin: 0.5rem 0;
  animation: pulse-glow-gold 2s infinite;
}

@keyframes pulse-glow-gold {
  0%, 100% {
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.3);
    background: rgba(255, 215, 0, 0.1);
  }
  50% {
    box-shadow: 0 0 25px rgba(255, 215, 0, 0.6);
    background: rgba(255, 215, 0, 0.15);
  }
}

.terminal-line.dim {
  color: var(--term-dim);
  font-size: 0.9rem;
}

/* ===== IN-TERMINAL GAME UI ===== */
/* Quest/Task Frames */
.terminal-line.quest-frame,
.terminal-line.task-frame {
  color: var(--accent);
  font-weight: 600;
  white-space: pre;
  font-family: monospace;
  line-height: 1.3;
  margin: 0.75rem 0;
}

/* XP Notifications */
.terminal-line.xp-gain {
  color: var(--gold);
  font-weight: 700;
  background: rgba(255, 215, 0, 0.08);
  border-left: 3px solid var(--gold);
  padding: 0.5rem 1rem;
  margin: 0.5rem 0;
  animation: xp-pulse 0.6s ease-out;
}

@keyframes xp-pulse {
  0% {
    transform: scale(1);
    background: rgba(255, 215, 0, 0.2);
  }
  50% {
    transform: scale(1.02);
  }
  100% {
    transform: scale(1);
    background: rgba(255, 215, 0, 0.08);
  }
}

/* Stats Display */
.terminal-line.stats-display {
  color: var(--term-text);
  background: rgba(79, 195, 247, 0.05);
  border: 1px solid rgba(79, 195, 247, 0.2);
  border-radius: 6px;
  padding: 0.75rem 1rem;
  margin: 0.75rem 0;
  white-space: pre-wrap;
  line-height: 1.6;
  font-size: 0.95rem;
}

/* Class Badge (inline in stats) */
.stats-display .class-badge {
  display: inline-block;
  background: linear-gradient(135deg, var(--accent), #0288d1);
  color: white;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  font-weight: 700;
  font-size: 0.9rem;
  margin-left: 0.25rem;
}

/* Accent divider line */
.terminal-line.accent {
  color: var(--accent);
  opacity: 0.5;
  margin: 0.25rem 0;
  user-select: none;
}

/* Level Up Banner */
.terminal-line.level-up {
  color: var(--purple);
  font-weight: 700;
  font-size: 1.1rem;
  text-align: center;
  background: linear-gradient(135deg, rgba(187, 134, 252, 0.15) 0%, rgba(79, 195, 247, 0.15) 100%);
  border: 2px solid var(--purple);
  border-radius: 8px;
  padding: 1rem;
  margin: 1rem 0;
  animation: level-up-flash 1s ease-out;
}

@keyframes level-up-flash {
  0%, 100% {
    box-shadow: 0 0 20px rgba(187, 134, 252, 0.3);
  }
  50% {
    box-shadow: 0 0 40px rgba(187, 134, 252, 0.6);
  }
}

/* Progress Bars (ASCII) */
.terminal-line.progress-bar {
  color: var(--accent);
  font-family: monospace;
  font-weight: 600;
  white-space: pre;
  margin: 0.25rem 0;
}

/* Celebration Frames */
.terminal-line.celebration {
  color: var(--term-green);
  font-weight: 700;
  white-space: pre;
  line-height: 1.3;
  margin: 1rem 0;
  animation: celebrate-glow 1.5s ease-out;
}

@keyframes celebrate-glow {
  0% {
    opacity: 0;
    transform: translateY(10px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Prompt */
.prompt-text {
  color: var(--term-prompt);
  white-space: pre;
  flex-shrink: 0;
}

/* Input Line */
.input-line {
  display: flex;
  align-items: center;
  animation: pulse-input 2s infinite;
}

@keyframes pulse-input {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.input-line.typing {
  animation: none;
  opacity: 1;
}

.input-field {
  background: transparent;
  border: none;
  color: var(--term-text);
  font-family: inherit;
  font-size: inherit;
  outline: none;
  flex: 1;
  caret-color: var(--term-cursor);
}

.cursor-blink {
  display: inline-block;
  width: 8px;
  height: 1.2em;
  background: var(--term-cursor);
  animation: blink 1s step-end infinite;
  vertical-align: middle;
  margin-left: 1px;
}

.input-field:focus ~ .cursor-blink {
  display: none;
}

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

/* ===== CELEBRATIONS ===== */
.celebration-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.celebration-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.celebration-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
}

.celebration-content {
  position: relative;
  background: #1a1a2e;
  border: 2px solid var(--accent);
  border-radius: 16px;
  padding: 2.5rem;
  text-align: center;
  max-width: 450px;
  width: 90%;
  box-shadow: 0 0 40px var(--accent-glow);
  animation: celebration-in 0.5s ease;
}

@keyframes celebration-in {
  0% { transform: scale(0.8); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.celebration-emoji {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.celebration-title {
  color: var(--gold);
  font-family: 'Press Start 2P', monospace;
  font-size: 1rem;
  margin-bottom: 0.5rem;
}

.celebration-message {
  color: var(--term-text);
  margin-bottom: 0.5rem;
}

.celebration-xp {
  color: var(--accent);
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
}

.celebration-btn {
  background: linear-gradient(135deg, var(--accent), #0288d1);
  color: white;
  border: none;
  padding: 0.7rem 2rem;
  border-radius: 6px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.celebration-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px var(--accent-glow);
}

.celebration-auto-continue {
  color: var(--text-muted);
  font-size: 0.75rem;
  margin-top: 0.75rem;
}

/* ===== COMPLETION SCREEN ===== */
.completion-screen {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg-dark);
  z-index: 300;
  overflow-y: auto;
  padding: 4rem 2rem;
}

.completion-screen.active {
  display: block;
}

.completion-box {
  max-width: 1000px;
  margin: 2rem auto;
  text-align: center;
}

/* Celebration Header Card */
.completion-celebration-header {
  background: linear-gradient(135deg, rgba(79, 195, 247, 0.1) 0%, rgba(187, 134, 252, 0.1) 100%);
  border: 2px solid var(--accent);
  border-radius: 20px;
  padding: 3rem 2rem;
  margin-bottom: 4rem;
  box-shadow: 0 8px 32px rgba(79, 195, 247, 0.2);
  position: relative;
  overflow: hidden;
}

.completion-celebration-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(circle at 50% 0%, rgba(79, 195, 247, 0.15) 0%, transparent 70%);
  pointer-events: none;
}

.completion-title {
  font-family: 'Press Start 2P', monospace;
  color: var(--accent-bright);
  font-size: 1.4rem;
  margin-bottom: 0;
  text-shadow: 0 0 30px rgba(79, 195, 247, 0.6);
  animation: pulse-glow-accent 2s infinite;
  position: relative;
}

@keyframes pulse-glow-accent {
  0%, 100% {
    text-shadow: 0 0 30px rgba(79, 195, 247, 0.6);
  }
  50% {
    text-shadow: 0 0 40px rgba(79, 195, 247, 0.9), 0 0 60px rgba(79, 195, 247, 0.5);
  }
}

.completion-stats {
  display: flex;
  justify-content: center;
  gap: 2rem;
  margin-top: 2rem;
  position: relative;
}

.completion-stat {
  background: rgba(26, 26, 46, 0.6);
  border: 1px solid rgba(79, 195, 247, 0.3);
  border-radius: 12px;
  padding: 1.5rem 2.5rem;
  min-width: 150px;
  transition: all 0.3s ease;
}

.completion-stat:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(79, 195, 247, 0.2);
}

.completion-stat-label {
  color: var(--text-secondary);
  font-size: 0.75rem;
  margin-bottom: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 600;
}

.completion-stat-value {
  color: var(--accent-bright);
  font-size: 2rem;
  font-weight: 700;
  font-family: 'Press Start 2P', monospace;
}

.completion-skills {
  text-align: left;
  margin: 0 0 4rem 0;
  padding: 2.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.completion-skills h3 {
  color: #ffffff;
  margin-bottom: 1.5rem;
  font-size: 1.3rem;
  font-weight: 700;
  text-align: center;
}

.completion-skills ul {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 0.75rem;
  margin: 0;
  padding: 0;
}

.completion-skills li {
  color: #ffffff;
  margin-bottom: 0;
  list-style: none;
  padding: 1rem 1.25rem 1rem 2.75rem;
  position: relative;
  background: rgba(42, 42, 62, 0.4);
  border-radius: 12px;
  border: 1px solid rgba(79, 195, 247, 0.2);
  transition: all 0.3s ease;
  font-size: 0.95rem;
}

.completion-skills li:hover {
  background: rgba(79, 195, 247, 0.05);
  border-color: var(--accent);
  transform: translateX(8px);
  box-shadow: 0 4px 16px rgba(79, 195, 247, 0.15);
}

.completion-skills li::before {
  content: '✓';
  position: absolute;
  left: 1rem;
  color: var(--success);
  font-weight: 700;
  font-size: 1.3rem;
}

.completion-skills li strong {
  color: var(--accent-bright);
  font-weight: 700;
}

.completion-next {
  margin-top: 3rem;
  text-align: left;
}

.completion-next h3 {
  color: #ffffff;
  margin-bottom: 2.5rem;
  font-size: 2rem;
  font-weight: 700;
  text-align: center;
}

.celebration-emoji {
  filter: drop-shadow(0 0 20px rgba(79, 195, 247, 0.5));
}

.setup-steps {
  text-align: left;
  margin-bottom: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.setup-step {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 2.5rem;
  transition: all 0.3s ease;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.setup-step:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(79, 195, 247, 0.15);
  border-color: var(--accent);
  background: var(--bg-card-hover);
}

.setup-step-num {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-bright) 100%);
  color: #0a0a0f;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.2rem;
  flex-shrink: 0;
  margin-bottom: 1rem;
  box-shadow: 0 4px 12px rgba(79, 195, 247, 0.3);
}

.setup-step-content {
  flex: 1;
}

.setup-step-content p {
  color: #b0b0b0;
  font-size: 0.95rem;
  margin-bottom: 0.75rem;
  line-height: 1.6;
}

.setup-step-content p[style*="font-weight: bold"],
.setup-step-content p strong {
  color: #ffffff;
}

.setup-step-content .code-block {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background: rgba(10, 10, 20, 0.8);
  border: 1px solid rgba(79, 195, 247, 0.3);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.9rem;
  color: var(--accent-bright);
  margin: 0.75rem 0;
  transition: all 0.2s ease;
}

.setup-step-content .code-block:hover {
  border-color: rgba(79, 195, 247, 0.5);
  background: rgba(10, 10, 20, 0.95);
}

.copy-btn {
  background: rgba(79, 195, 247, 0.1);
  border: 1px solid rgba(79, 195, 247, 0.3);
  color: var(--accent);
  padding: 0.4rem 0.9rem;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.copy-btn:hover {
  background: rgba(79, 195, 247, 0.2);
  border-color: var(--accent);
  transform: translateY(-1px);
}

.copy-btn.copied {
  background: rgba(102, 187, 106, 0.2);
  border-color: var(--term-green);
  color: var(--term-green);
}

.download-options {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 2rem;
}

.download-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.8rem 1.5rem;
  background: linear-gradient(135deg, var(--accent), #0288d1);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.3s ease;
}

.download-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px var(--accent-glow);
}

.download-btn.secondary {
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
}

/* ===== XP FLOAT ANIMATION ===== */
.xp-float {
  position: fixed;
  pointer-events: none;
  color: var(--gold);
  font-weight: 700;
  font-size: 1.2rem;
  z-index: 500;
  animation: xp-rise 1.5s ease-out forwards;
}

@keyframes xp-rise {
  0% { opacity: 1; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(-60px) scale(1.3); }
}

.mini-xp-float {
  position: fixed;
  pointer-events: none;
  color: var(--accent);
  font-weight: 700;
  font-size: 0.9rem;
  z-index: 500;
  animation: mini-xp-rise 1s ease-out forwards;
}

@keyframes mini-xp-rise {
  0% { opacity: 1; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(-30px) scale(1.2); }
}

/* ===== SUCCESS EXPLOSION ===== */
.success-particle {
  position: fixed;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 500;
  animation: particle-burst 0.6s ease-out forwards;
}

@keyframes particle-burst {
  0% {
    opacity: 1;
    transform: translate(0, 0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(var(--tx), var(--ty)) scale(0);
  }
}

.success-flash {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.15);
  pointer-events: none;
  z-index: 499;
  animation: flash-fade 0.2s ease-out forwards;
}

@keyframes flash-fade {
  0% { opacity: 1; }
  100% { opacity: 0; }
}

/* ===== WELCOME OVERLAY ===== */
.welcome-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 300;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.welcome-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.welcome-box {
  background: #1a1a2e;
  border: 2px solid var(--accent);
  border-radius: 16px;
  padding: 2.5rem;
  max-width: 500px;
  width: 90%;
  text-align: center;
  box-shadow: 0 0 40px var(--accent-glow);
}

.welcome-box h2 {
  color: var(--accent);
  font-family: 'Press Start 2P', monospace;
  font-size: 1.1rem;
  margin-bottom: 1.5rem;
}

.welcome-box p {
  color: var(--term-text);
  line-height: 1.6;
  margin-bottom: 1rem;
  font-size: 0.95rem;
}

.welcome-tips {
  text-align: left;
  margin: 1.5rem 0;
  padding: 1rem;
  background: rgba(79, 195, 247, 0.05);
  border-radius: 8px;
}

.welcome-tips li {
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
}

.welcome-start-btn {
  background: linear-gradient(135deg, var(--accent), #0288d1);
  color: white;
  border: none;
  padding: 0.9rem 2.5rem;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: 1rem;
  transition: all 0.3s ease;
}

.welcome-start-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 20px var(--accent-glow);
}

/* ===== PARTICLE SYSTEM (matching landing page) ===== */
.hero-particles {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}

.particle {
  position: absolute;
  width: 6px;
  height: 6px;
  background: var(--accent);
  border-radius: 50%;
  opacity: 0;
  animation: float-up 6s infinite;
  box-shadow: 0 0 10px var(--accent), 0 0 20px var(--accent-glow);
}

.particle:nth-child(3n) {
  background: var(--gold);
  box-shadow: 0 0 10px var(--gold), 0 0 20px rgba(255, 215, 0, 0.4);
}

.particle:nth-child(5n) {
  background: var(--purple);
  box-shadow: 0 0 10px #bb86fc, 0 0 20px rgba(187, 134, 252, 0.4);
}

@keyframes float-up {
  0% { opacity: 0; transform: translateY(100vh) scale(0) rotate(0deg); }
  10% { opacity: 0.9; }
  90% { opacity: 0.3; }
  100% { opacity: 0; transform: translateY(-10vh) scale(1.5) rotate(360deg); }
}

/* ===== CHARACTER CREATION MODAL ===== */
.character-creation-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 400;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.character-creation-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.character-creation-box {
  background: #1a1a2e;
  border: 2px solid var(--accent);
  border-radius: 16px;
  padding: 3rem 2.5rem;
  max-width: 500px;
  width: 90%;
  text-align: center;
  box-shadow: 0 0 40px var(--accent-glow);
  animation: modal-zoom-in 0.5s ease;
}

@keyframes modal-zoom-in {
  0% { transform: scale(0.8); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.character-creation-box h2 {
  color: var(--accent);
  font-family: 'Press Start 2P', monospace;
  font-size: 1.1rem;
  margin-bottom: 1rem;
}

.character-creation-box p {
  color: var(--term-text);
  margin-bottom: 2rem;
  font-size: 0.95rem;
}

.color-choices {
  display: flex;
  gap: 1.5rem;
  justify-content: center;
  flex-wrap: wrap;
}

.color-choice {
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 1.5rem 1rem;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  min-width: 120px;
}

.color-choice:hover {
  border-color: var(--accent);
  background: rgba(79, 195, 247, 0.1);
  transform: translateY(-5px);
  box-shadow: 0 10px 30px var(--accent-glow);
}

.color-preview {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: 3px solid white;
  box-shadow: 0 0 20px currentColor;
}

.color-preview.cyan {
  background: var(--accent);
  box-shadow: 0 0 20px var(--accent), 0 0 40px var(--accent-glow);
}

.color-preview.gold {
  background: var(--gold);
  box-shadow: 0 0 20px var(--gold), 0 0 40px var(--gold-glow);
}

.color-preview.purple {
  background: #bb86fc;
  box-shadow: 0 0 20px #bb86fc, 0 0 40px rgba(187, 134, 252, 0.4);
}

.color-choice span {
  color: white;
  font-size: 0.9rem;
  font-weight: 600;
}

/* ===== AVATAR SYSTEM ===== */
.avatar-container {
  position: fixed;
  top: 15%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  pointer-events: none;
}

.avatar-sprite {
  display: flex;
  align-items: center;
  justify-content: center;
  animation: idle-bob 2s ease-in-out infinite;
}

/* Avatar Animations */
@keyframes idle-bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.avatar-sprite.avatar-happy {
  animation: success-jump 0.6s ease-out;
}

@keyframes success-jump {
  0% { transform: translateY(0) scale(1); }
  40% { transform: translateY(-40px) scale(1.15); }
  60% { transform: translateY(-35px) scale(1.1); }
  100% { transform: translateY(0) scale(1); }
}

.avatar-sprite.avatar-confused {
  animation: head-shake 0.5s ease-in-out;
}

@keyframes head-shake {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-10deg); }
  75% { transform: rotate(10deg); }
}

.avatar-sprite.avatar-victory {
  animation: victory-spin 1s ease-out;
}

@keyframes victory-spin {
  0% { transform: scale(1) rotate(0deg); }
  50% { transform: scale(1.3) rotate(180deg); }
  100% { transform: scale(1) rotate(360deg); }
}

/* Evolution animations */
.avatar-sprite.avatar-evolving {
  animation: evolution-fade 1s ease-in-out;
}

@keyframes evolution-fade {
  0% { opacity: 1; transform: scale(1) rotate(0deg); }
  50% { opacity: 0; transform: scale(0.3) rotate(180deg); }
  100% { opacity: 1; transform: scale(1) rotate(360deg); }
}

.avatar-sprite.avatar-evolved {
  animation: evolution-burst 0.5s ease-out;
}

@keyframes evolution-burst {
  0% { transform: scale(1.5); opacity: 0.5; }
  100% { transform: scale(1); opacity: 1; }
}

/* Speech Bubble */
.avatar-speech-bubble {
  position: absolute;
  top: -20px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(26, 26, 46, 0.95);
  border: 2px solid var(--accent);
  border-radius: 12px;
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
  color: white;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
  box-shadow: 0 0 20px var(--accent-glow);
}

.avatar-speech-bubble::after {
  content: '';
  position: absolute;
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-top: 10px solid var(--accent);
}

.avatar-speech-bubble.active {
  opacity: 1;
  transform: translateX(-50%) translateY(-10px);
}

/* Enhanced input pulse (make it obvious) */
.input-line {
  display: flex;
  align-items: center;
  animation: pulse-input-ready 2s infinite;
}

@keyframes pulse-input-ready {
  0%, 100% { box-shadow: 0 0 0 transparent; }
  50% { box-shadow: 0 0 20px var(--accent-glow), inset 0 0 10px var(--accent-glow); }
}

.input-line.typing {
  animation: none;
}

/* ===== MUSIC PANEL ===== */
.music-panel {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(26, 26, 46, 0.95);
  backdrop-filter: blur(10px);
  border-top: 1px solid rgba(79, 195, 247, 0.2);
  z-index: 80;
  max-height: 60vh;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.music-panel-toggle {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.5rem;
  cursor: pointer;
  user-select: none;
  transition: background 0.2s ease;
}

.music-panel-toggle:hover {
  background: rgba(79, 195, 247, 0.05);
}

.music-icon {
  font-size: 1.2rem;
}

.music-now-playing {
  flex: 1;
  color: var(--term-text);
  font-size: 0.9rem;
  font-weight: 500;
}

.music-expand-icon {
  color: var(--term-dim);
  font-size: 0.8rem;
  transition: transform 0.3s ease;
}

.music-panel-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
  padding: 0 1.5rem;
}

.music-panel-body.expanded {
  max-height: 50vh;
  padding: 1rem 1.5rem 1.5rem;
  overflow-y: auto;
}

/* Volume Control */
.music-volume-control {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 8px;
  margin-bottom: 1rem;
}

.music-label {
  color: var(--term-dim);
  font-size: 0.85rem;
  min-width: 60px;
}

.music-slider {
  flex: 1;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  outline: none;
}

.music-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  background: var(--accent);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 0 8px var(--accent-glow);
  transition: all 0.2s ease;
}

.music-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 0 12px var(--accent-glow);
}

.music-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  background: var(--accent);
  border-radius: 50%;
  cursor: pointer;
  border: none;
  box-shadow: 0 0 8px var(--accent-glow);
  transition: all 0.2s ease;
}

.music-slider::-moz-range-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 0 12px var(--accent-glow);
}

.music-volume-value {
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 600;
  min-width: 40px;
  text-align: center;
}

.music-toggle-btn {
  background: var(--term-green);
  color: #0a0a0f;
  border: none;
  padding: 0.4rem 1rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 50px;
}

.music-toggle-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(78, 201, 176, 0.4);
}

.music-toggle-btn.off {
  background: rgba(255, 255, 255, 0.1);
  color: var(--term-dim);
}

/* Track List */
.music-track-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.music-track-card {
  flex: 1 1 calc(50% - 0.5rem);
  min-width: 150px;
  background: rgba(255, 255, 255, 0.03);
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 0.75rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

.music-track-card:hover {
  background: rgba(79, 195, 247, 0.1);
  border-color: var(--accent);
  transform: translateY(-2px);
}

.music-track-card.active {
  background: rgba(79, 195, 247, 0.15);
  border-color: var(--accent);
  box-shadow: 0 0 15px var(--accent-glow);
}

.music-track-card.active::before {
  content: '▶';
  color: var(--accent);
  margin-right: 0.5rem;
  font-size: 0.7rem;
}

.music-track-title {
  color: var(--term-text);
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.music-track-mood {
  color: var(--term-dim);
  font-size: 0.75rem;
  text-transform: capitalize;
}

/* Custom Upload */
.music-upload-section {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 1rem;
  margin-top: 0.5rem;
}

.music-upload-btn {
  display: block;
  background: transparent;
  border: 2px dashed rgba(79, 195, 247, 0.3);
  border-radius: 8px;
  padding: 1rem;
  text-align: center;
  color: var(--accent);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.music-upload-btn:hover {
  border-color: var(--accent);
  background: rgba(79, 195, 247, 0.05);
}

.music-upload-status {
  margin-top: 0.5rem;
  font-size: 0.8rem;
  text-align: center;
  min-height: 1.2rem;
}

.music-upload-status.success {
  color: var(--term-green);
}

.music-upload-status.error {
  color: var(--term-red);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  body {
    padding: 4rem 1rem 2rem;
  }

  .terminal-header {
    padding: 0.75rem 1rem;
  }

  .header-title {
    font-size: 0.9rem;
  }

  .header-spacer {
    display: none;
  }

  .terminal-body {
    font-size: 0.8rem;
    min-height: 300px;
  }

  .quest-progress {
    position: static;
    margin: 1rem auto;
    max-width: 400px;
  }

  .music-track-card {
    flex: 1 1 100%;
  }

  .music-panel-toggle {
    padding: 0.6rem 1rem;
  }

  .music-volume-control {
    flex-wrap: wrap;
  }

  .music-slider {
    flex: 1 1 100%;
    order: 3;
  }

  .instruction-banner {
    padding: 0.75rem 1rem;
    flex-wrap: wrap;
  }

  .instruction-content {
    flex: 1 1 100%;
    margin-bottom: 0.5rem;
  }

  .instruction-text {
    font-size: 0.8rem;
  }

  .instruction-actions {
    flex: 1 1 100%;
    justify-content: center;
  }

  .completion-stats {
    grid-template-columns: 1fr;
  }

  .completion-box {
    padding: 2rem 1.5rem;
  }

  .welcome-box {
    padding: 2rem 1.5rem;
  }

  .welcome-box h2 {
    font-size: 0.9rem;
  }
}

@media (max-width: 480px) {
  .terminal-body {
    font-size: 0.75rem;
    padding: 0.75rem;
  }

  .celebration-content {
    padding: 1.5rem;
  }
}
