:root {
  --bg: #0f0f14;
  --surface: #1a1a24;
  --surface2: #22222e;
  --border: #2e2e3e;
  --text: #f0f0f5;
  --muted: #8888aa;
  --accent: #00d4aa;
  --green: #4ade80;
  --red: #f87171;
  --yellow: #fbbf24;
  --radius: 16px;
  --nav-h: 68px;
}

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

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { text-decoration: none; color: inherit; }

.app-shell {
  min-height: 100vh;
  padding-bottom: var(--nav-h);
  max-width: 480px;
  margin: 0 auto;
}

/* ── Bottom Nav ── */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--nav-h);
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 100;
  max-width: 480px;
  margin: 0 auto;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 20px;
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.15s;
  color: var(--muted);
}

.nav-item:active { background: var(--surface2); }
.nav-item.active { color: var(--accent); }

.nav-icon { font-size: 22px; }
.nav-label { font-size: 10px; font-weight: 600; letter-spacing: .04em; }

/* ── Buttons ── */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 16px;
  border-radius: var(--radius);
  border: none;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
  text-align: center;
}

.btn:active { opacity: 0.85; transform: scale(0.98); }

.btn-primary {
  background: var(--accent);
  color: #000;
}

.btn-secondary {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-outline {
  background: transparent;
  color: var(--accent);
  border: 2px solid var(--accent);
}

/* ── HOME PAGE ── */
.home-page { padding: 16px; }

.home-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0 20px;
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo-icon { font-size: 28px; }
.logo-text {
  font-size: 1.4rem;
  font-weight: 900;
  background: linear-gradient(135deg, var(--accent), #7c3aed);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.stats-bar { display: flex; gap: 8px; }

.stat-chip {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 6px 12px;
  font-size: 0.9rem;
  font-weight: 700;
}

/* Progress Overview */
.progress-overview {
  margin-bottom: 20px;
}

.progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 6px;
}

.progress-bar-wrap {
  height: 6px;
  background: var(--surface);
  border-radius: 3px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #7c3aed);
  border-radius: 3px;
  transition: width 0.5s ease;
}

/* Today Card */
.today-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 24px;
  margin-bottom: 24px;
  text-align: center;
  border-top: 3px solid var(--accent);
}

.today-badge {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: .12em;
  color: var(--accent);
  text-transform: uppercase;
  margin-bottom: 12px;
}

.today-icon { font-size: 48px; margin-bottom: 12px; }

.today-title {
  font-size: 1.4rem;
  font-weight: 800;
  margin-bottom: 16px;
  line-height: 1.3;
}

.today-meta {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.xp-badge {
  background: rgba(0, 212, 170, 0.15);
  color: var(--accent);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 700;
}

.slide-count { color: var(--muted); font-size: 0.85rem; }

.completed-banner {
  background: rgba(74, 222, 128, 0.1);
  color: var(--green);
  padding: 8px 16px;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 12px;
}

/* Section Title */
.section-title {
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: .1em;
  color: var(--muted);
  text-transform: uppercase;
  margin: 20px 0 10px;
}

/* Terms Scroll */
.terms-scroll {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 8px;
  margin-bottom: 8px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.terms-scroll::-webkit-scrollbar { display: none; }

.term-chip {
  flex-shrink: 0;
  width: 180px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
}

.term-name {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 6px;
}

.term-def { font-size: 0.78rem; color: var(--muted); line-height: 1.4; }

/* Days List */
.days-list { display: flex; flex-direction: column; gap: 8px; }

.day-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  transition: background 0.15s;
}

.day-row:active { background: var(--surface2); }

.day-row.done { border-color: rgba(74, 222, 128, 0.3); }
.day-row.active { border-color: var(--accent); }
.day-row.locked { opacity: 0.5; }

.day-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.day-info { flex: 1; min-width: 0; }
.day-title { font-size: 0.88rem; font-weight: 700; margin-bottom: 3px; }
.day-meta { font-size: 0.75rem; color: var(--muted); }
.day-xp { font-size: 0.78rem; font-weight: 700; color: var(--accent); flex-shrink: 0; }

/* ── LESSON PAGE ── */
.lesson-page {
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-width: 480px;
  margin: 0 auto;
}

.lesson-topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  flex-shrink: 0;
}

.back-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  border-radius: 50%;
  font-size: 16px;
  cursor: pointer;
  flex-shrink: 0;
  color: var(--muted);
}

.lesson-progress-bar {
  flex: 1;
  height: 8px;
  background: var(--surface);
  border-radius: 4px;
  overflow: hidden;
}

.lesson-progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 4px;
  transition: width 0.3s ease;
}

.lesson-xp {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent);
  flex-shrink: 0;
}

/* Slides */
.slides-container {
  flex: 1;
  overflow: hidden;
  position: relative;
}

.slide {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  padding: 20px 20px 0;
  overflow-y: auto;
  opacity: 0;
  transform: translateX(40px);
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
}

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

.slide.exit {
  opacity: 0;
  transform: translateX(-40px);
}

.slide-badge {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
  margin-bottom: 16px;
}

.slide-icon { font-size: 52px; margin-bottom: 16px; display: block; }

.slide-title {
  font-size: 1.4rem;
  font-weight: 800;
  margin-bottom: 20px;
  line-height: 1.3;
}

.slide-content {
  font-size: 0.92rem;
  line-height: 1.7;
  color: #d0d0e0;
}

.slide-content strong { color: var(--text); font-weight: 700; }

.slide-content code {
  background: var(--surface2);
  padding: 2px 6px;
  border-radius: 6px;
  font-family: 'SF Mono', monospace;
  font-size: 0.82em;
  color: var(--accent);
}

.slide-highlight {
  margin-top: 20px;
  padding: 14px 16px;
  background: var(--surface2);
  border-left: 3px solid var(--accent);
  border-radius: 0 12px 12px 0;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.5;
}

/* Terms Grid */
.terms-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.term-card {
  background: var(--surface2);
  border-radius: 12px;
  padding: 14px;
}

.tc-term {
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--accent);
  margin-bottom: 5px;
}

.tc-def { font-size: 0.82rem; color: var(--muted); line-height: 1.5; }

/* Quiz Intro */
.quiz-intro-text {
  font-size: 1rem;
  color: var(--muted);
  margin-bottom: 24px;
}

.quiz-rules {
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 0.88rem;
  color: var(--muted);
}

/* Lesson Footer */
.lesson-footer {
  padding: 16px;
  flex-shrink: 0;
}

/* ── QUIZ PAGE ── */
.quiz-page {
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-width: 480px;
  margin: 0 auto;
}

.quiz-score-badge {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent);
  flex-shrink: 0;
}

.quiz-area {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
}

.q-number {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: .06em;
  text-transform: uppercase;
  margin-bottom: 12px;
}

.q-text {
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.5;
  margin-bottom: 24px;
  color: var(--text);
}

.options-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.option-btn {
  width: 100%;
  padding: 16px;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  line-height: 1.4;
}

.option-btn:not(:disabled):active {
  border-color: var(--accent);
  background: var(--surface2);
}

.option-btn.correct {
  border-color: var(--green);
  background: rgba(74, 222, 128, 0.1);
  color: var(--green);
}

.option-btn.wrong {
  border-color: var(--red);
  background: rgba(248, 113, 113, 0.1);
  color: var(--red);
}

/* Explanation */
#explain-panel {
  flex-direction: column;
  gap: 16px;
}

.explain-header {
  font-size: 1.2rem;
  font-weight: 800;
  padding: 12px;
  border-radius: 12px;
  text-align: center;
}

.explain-header.correct {
  background: rgba(74, 222, 128, 0.1);
  color: var(--green);
}

.explain-header.wrong {
  background: rgba(248, 113, 113, 0.1);
  color: var(--red);
}

.explain-text {
  font-size: 0.9rem;
  line-height: 1.6;
  color: #d0d0e0;
  background: var(--surface2);
  padding: 16px;
  border-radius: 12px;
}

/* Results */
#results-panel {
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
  padding-top: 20px;
}

.results-icon { font-size: 64px; }
.results-title { font-size: 1.6rem; font-weight: 900; }
.results-score { font-size: 1rem; color: var(--muted); }
.results-xp {
  font-size: 1rem;
  font-weight: 700;
  color: var(--accent);
  background: rgba(0, 212, 170, 0.1);
  padding: 10px 20px;
  border-radius: 20px;
}

/* ── SCENARIO PAGE ── */
.scenario-page {
  min-height: 100vh;
  max-width: 480px;
  margin: 0 auto;
}

.scenario-topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
}

.scenario-title-bar {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--muted);
}

.scenario-content { padding: 0 20px 80px; }

.scenario-badge {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
  margin-bottom: 20px;
}

.scenario-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 24px;
  margin-bottom: 20px;
  text-align: center;
}

.scenario-icon { font-size: 40px; margin-bottom: 16px; }

.scenario-question {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.6;
  color: var(--text);
}

.answer-prompt {
  font-size: 0.88rem;
  color: var(--muted);
  margin-bottom: 20px;
  line-height: 1.5;
}

.ideal-answer {
  background: var(--surface);
  border: 1px solid rgba(0, 212, 170, 0.3);
  border-radius: 16px;
  padding: 20px;
  margin-top: 20px;
}

.ideal-header {
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--green);
  margin-bottom: 12px;
}

.ideal-text {
  font-size: 0.88rem;
  line-height: 1.7;
  color: #d0d0e0;
}

.scenario-footer { margin-top: 20px; }

.mvk-note {
  background: rgba(251, 191, 36, 0.1);
  border-left: 3px solid var(--yellow);
  padding: 14px;
  border-radius: 0 12px 12px 0;
  font-size: 0.85rem;
  line-height: 1.5;
}

/* ── MODALS ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 200;
  display: flex;
  align-items: flex-end;
  padding: 16px;
  backdrop-filter: blur(4px);
}

.modal-card {
  background: var(--surface);
  border-radius: 20px 20px 16px 16px;
  width: 100%;
  max-height: 70vh;
  overflow-y: auto;
  max-width: 480px;
  margin: 0 auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--surface);
}

.modal-header h2 { font-size: 1.1rem; font-weight: 800; }

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--surface2);
  border: none;
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-body { padding: 20px; }

.info-text { color: var(--muted); font-size: 0.88rem; margin-bottom: 20px; }

.info-section { margin-bottom: 20px; }
.info-section h3 { font-size: 0.88rem; font-weight: 700; color: var(--accent); margin-bottom: 8px; }
.info-section p { font-size: 0.85rem; color: var(--muted); line-height: 1.5; }

.day-list { display: flex; flex-direction: column; gap: 6px; }
.day-item { font-size: 0.82rem; color: var(--muted); padding: 4px 0; }

/* Scrollbar */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
