/* Mars Online — Immersive Code Learning */

:root {
  --bg: #0a0a12;
  --surface: #12121e;
  --surface-2: #1a1a2e;
  --accent: #818cf8;
  --accent-bright: #a5b4fc;
  --green: #34d399;
  --green-dim: #065f46;
  --orange: #fb923c;
  --gold: #fbbf24;
  --red: #f87171;
  --text: #e2e8f0;
  --text-dim: #64748b;
  --text-muted: #334155;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, sans-serif;
  overflow: hidden;
  height: 100%;
  height: 100dvh;
  overscroll-behavior: none;
}

#app {
  height: 100%;
  height: 100dvh;
  position: relative;
  overflow: hidden;
}

/* ─── Step Container ─────────────────────────── */
.step {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 24px;
  text-align: center;
  opacity: 0;
  transform: translateY(30px);
  transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}

.step.active {
  opacity: 1;
  transform: translateY(0);
  pointer-events: all;
}

.step.exit-up {
  opacity: 0;
  transform: translateY(-50px);
  pointer-events: none;
}

/* ─── Progress Bar (top) ─────────────────────── */
.progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  gap: 3px;
  padding: 12px 16px 0;
  background: linear-gradient(to bottom, rgba(10,10,18,0.9), transparent);
}

.progress-dot {
  flex: 1;
  height: 3px;
  border-radius: 2px;
  background: var(--text-muted);
  transition: background 0.4s;
}

.progress-dot.done {
  background: var(--accent);
}

.progress-dot.current {
  background: var(--accent-bright);
  box-shadow: 0 0 8px rgba(129, 140, 248, 0.5);
}

/* ─── Typography ─────────────────────────────── */
.headline {
  font-size: clamp(28px, 8vw, 42px);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin-bottom: 16px;
}

.subtext {
  font-size: 16px;
  color: var(--text-dim);
  line-height: 1.5;
  max-width: 320px;
}

/* ─── Code Display ───────────────────────────── */
.code-display {
  background: var(--surface);
  border: 1px solid var(--surface-2);
  border-radius: 16px;
  padding: 20px;
  width: 100%;
  max-width: 360px;
  text-align: left;
  font-family: 'JetBrains Mono', monospace;
  font-size: 15px;
  line-height: 1.7;
  margin: 24px 0;
  position: relative;
  overflow: hidden;
}

.code-display::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0.5;
}

.code-line {
  opacity: 0;
  transform: translateX(-10px);
  animation: codeLine 0.4s ease-out forwards;
}

@keyframes codeLine {
  to { opacity: 1; transform: translateX(0); }
}

.code-keyword { color: #c084fc; }
.code-string { color: #34d399; }
.code-builtin { color: #fbbf24; }
.code-comment { color: #475569; font-style: italic; }
.code-number { color: #fb923c; }
.code-output {
  color: var(--text-dim);
  border-top: 1px solid var(--surface-2);
  margin-top: 12px;
  padding-top: 12px;
}

/* Cursor blink in code */
.cursor-blink::after {
  content: '▋';
  color: var(--accent);
  animation: blink 1s step-end infinite;
}

@keyframes blink {
  50% { opacity: 0; }
}

/* ─── Terminal Output ────────────────────────── */
.terminal-output {
  background: #000;
  border-radius: 12px;
  padding: 16px;
  width: 100%;
  max-width: 360px;
  text-align: left;
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
  margin-top: 12px;
  border: 1px solid #1a1a2e;
}

.terminal-output .prompt {
  color: var(--green);
}

.terminal-output .output-text {
  color: #fff;
  opacity: 0;
  animation: fadeUp 0.3s ease-out forwards;
  animation-delay: 0.5s;
}

/* ─── Input Fields ───────────────────────────── */
.input-fancy {
  background: var(--surface);
  border: 2px solid var(--surface-2);
  border-radius: 14px;
  padding: 16px 20px;
  width: 100%;
  max-width: 320px;
  color: var(--text);
  font-family: 'JetBrains Mono', monospace;
  font-size: 18px;
  text-align: center;
  outline: none;
  transition: border-color 0.3s, box-shadow 0.3s;
}

.input-fancy:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(129, 140, 248, 0.15);
}

.input-fancy::placeholder {
  color: var(--text-muted);
  font-size: 15px;
}

.input-name {
  font-family: 'Inter', sans-serif;
  font-size: 20px;
  font-weight: 600;
}

.input-phone {
  font-size: 20px;
  letter-spacing: 1px;
}

/* ─── Buttons ────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px 32px;
  border-radius: 14px;
  font-weight: 600;
  font-size: 16px;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  width: 100%;
  max-width: 320px;
  position: relative;
  overflow: hidden;
}

.btn:active {
  transform: scale(0.97);
}

.btn-glow {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: white;
  box-shadow: 0 4px 24px rgba(99, 102, 241, 0.4);
}

.btn-glow::before {
  content: '';
  position: absolute;
  inset: -1px;
  background: linear-gradient(135deg, #818cf8, #a78bfa, #818cf8);
  border-radius: 15px;
  z-index: -1;
  opacity: 0;
  transition: opacity 0.3s;
}

.btn-glow:active::before { opacity: 1; }

.btn-run {
  background: linear-gradient(135deg, #059669, #10b981);
  color: white;
  box-shadow: 0 4px 24px rgba(16, 185, 129, 0.3);
  font-family: 'JetBrains Mono', monospace;
}

.btn-ghost {
  background: transparent;
  color: var(--text-dim);
  font-size: 14px;
  padding: 12px;
}

.btn-ghost:hover { color: var(--text); }

/* ─── Run button pulse ───────────────────────── */
.pulse-ring {
  animation: pulseRing 2s ease-out infinite;
}

@keyframes pulseRing {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4); }
  70% { box-shadow: 0 0 0 16px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* ─── Quiz Options ───────────────────────────── */
.quiz-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  width: 100%;
  max-width: 360px;
}

.quiz-opt {
  background: var(--surface);
  border: 2px solid var(--surface-2);
  border-radius: 14px;
  padding: 16px 12px;
  font-size: 14px;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}

.quiz-opt:active { transform: scale(0.96); }

.quiz-opt.correct {
  border-color: var(--green);
  background: rgba(52, 211, 153, 0.1);
  color: var(--green);
}

.quiz-opt.wrong {
  border-color: var(--red);
  background: rgba(248, 113, 113, 0.1);
  color: var(--red);
  animation: shake 0.4s;
}

@keyframes shake {
  25% { transform: translateX(-4px); }
  50% { transform: translateX(4px); }
  75% { transform: translateX(-4px); }
}

/* ─── XP Badge ───────────────────────────────── */
.xp-earned {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(129, 140, 248, 0.15);
  color: var(--accent-bright);
  padding: 8px 16px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 14px;
  animation: xpPop 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes xpPop {
  0% { transform: scale(0); opacity: 0; }
  60% { transform: scale(1.2); }
  100% { transform: scale(1); opacity: 1; }
}

/* ─── Celebration ────────────────────────────── */
.confetti-container {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 200;
}

.confetti {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  top: -10px;
  animation: confettiFall 2.5s ease-out forwards;
}

@keyframes confettiFall {
  0% { transform: translateY(0) rotate(0deg); opacity: 1; }
  100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

/* ─── Typing effect ──────────────────────────── */
.typewriter {
  overflow: hidden;
  white-space: nowrap;
  border-right: 2px solid var(--accent);
  animation: typing 1.5s steps(30) forwards, blinkCaret 0.7s step-end infinite;
  width: 0;
  display: inline-block;
}

@keyframes typing {
  to { width: 100%; }
}

@keyframes blinkCaret {
  50% { border-color: transparent; }
}

/* ─── Fade helpers ───────────────────────────── */
.fade-in {
  animation: fadeUp 0.5s ease-out forwards;
}

.fade-in-delay {
  opacity: 0;
  animation: fadeUp 0.5s ease-out forwards;
  animation-delay: 0.3s;
}

.fade-in-delay-2 {
  opacity: 0;
  animation: fadeUp 0.5s ease-out forwards;
  animation-delay: 0.6s;
}

.fade-in-delay-3 {
  opacity: 0;
  animation: fadeUp 0.5s ease-out forwards;
  animation-delay: 0.9s;
}

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

/* ─── Gradient text ──────────────────────────── */
.gradient-text {
  background: linear-gradient(135deg, #818cf8, #c084fc);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.gradient-text-green {
  background: linear-gradient(135deg, #34d399, #6ee7b7);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ─── Ambient glow ───────────────────────────── */
.glow-purple {
  position: absolute;
  width: 300px;
  height: 300px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(99,102,241,0.12), transparent 70%);
  pointer-events: none;
  top: 20%;
  left: 50%;
  transform: translateX(-50%);
}

.glow-green {
  position: absolute;
  width: 250px;
  height: 250px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(52,211,153,0.1), transparent 70%);
  pointer-events: none;
  top: 30%;
  left: 50%;
  transform: translateX(-50%);
}

/* ─── Streak badge ───────────────────────────── */
.streak-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(251, 146, 60, 0.15);
  color: var(--orange);
  padding: 6px 14px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 13px;
}

/* ─── Lesson card ────────────────────────────── */
.lesson-card {
  background: var(--surface);
  border: 1px solid var(--surface-2);
  border-radius: 16px;
  padding: 20px;
  width: 100%;
  max-width: 360px;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s;
}

.lesson-card:active {
  transform: scale(0.98);
  border-color: var(--accent);
}

/* ─── Scrollable content (for longer steps) ─── */
.scroll-content {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  max-height: 100%;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-bottom: 40px;
}

/* ─── Step label ─────────────────────────────── */
.step-label {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

/* ─── Course Picker (funnel step 10) ─────────── */
.course-pick-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  max-width: 360px;
  padding: 0 24px;
}

.course-pick {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 2px solid var(--surface-2);
  border-radius: 14px;
  padding: 14px 16px;
  cursor: pointer;
  transition: all 0.2s;
}

.course-pick:active { transform: scale(0.98); }

.course-pick.picked {
  border-color: var(--accent);
  background: rgba(99, 102, 241, 0.08);
}

.course-pick-icon { font-size: 24px; }

.course-pick-title {
  flex: 1;
  font-weight: 600;
  font-size: 15px;
  color: var(--text);
}

.course-pick-check {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--surface-2);
  transition: all 0.2s;
  flex-shrink: 0;
}

.course-pick.picked .course-pick-check {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: inset 0 0 0 3px var(--surface);
}

/* LMS styles moved to lms.css (light theme) */
