/* ═══════════════════════════════════════════════════════════
   Belajar! — Bahasa Indonesia Learning App
   Tropical Dark Theme — Mobile First — v2
═══════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@400;500;600;700&family=Nunito:wght@400;500;600;700;800&display=swap');

/* ─── CSS Variables ─────────────────────────────────────────── */
:root {
  --bg:          #0C1B18;
  --surface:     #132520;
  --surface-2:   #1A3028;
  --surface-3:   #203A32;
  --border:      rgba(255,255,255,0.08);
  --border-2:    rgba(255,255,255,0.15);

  --text:        #F0EAD6;
  --text-muted:  #8FAF9A;
  --text-dim:    #506860;

  --coral:       #FF6F61;
  --coral-dark:  #E55A4D;
  --gold:        #FFD166;
  --jade:        #06D6A0;
  --jade-dark:   #04B585;
  --sky:         #4ECDC4;
  --red:         #FF4757;

  --shadow-sm:   0 2px 8px rgba(0,0,0,0.3);
  --shadow-md:   0 4px 20px rgba(0,0,0,0.4);

  --radius-sm:   10px;
  --radius-md:   16px;
  --radius-lg:   24px;
  --radius-xl:   32px;

  --font-display: 'Fredoka', sans-serif;
  --font-body:    'Nunito', sans-serif;

  --nav-h: 68px;
}

/* ─── Reset & Base ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; overflow-x: hidden; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  min-height: 100%;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    radial-gradient(circle at 20% 20%, rgba(6,214,160,0.06) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(255,111,97,0.06) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

#app-root {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  padding-bottom: var(--nav-h);
  max-width: 600px;
  margin: 0 auto;
}

#app-root.exercise-mode { padding-bottom: 0; }

/* ─── Typography ────────────────────────────────────────────── */
h1, h2, h3, .display { font-family: var(--font-display); }

/* ─── Bottom Navigation ─────────────────────────────────────── */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--nav-h);
  background: rgba(12, 27, 24, 0.97);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  display: flex;
  z-index: 100;
  max-width: 600px;
  margin: 0 auto;
  transition: transform 0.35s cubic-bezier(0.4,0,0.2,1), opacity 0.3s ease;
}

.bottom-nav.hidden-nav {
  transform: translateY(110%);
  opacity: 0;
  pointer-events: none;
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
  color: var(--text-dim);
  transition: color 0.2s, transform 0.1s;
  padding: 8px 0;
  border: none;
  background: none;
  font-family: var(--font-body);
  -webkit-tap-highlight-color: transparent;
}

.nav-item.active { color: var(--coral); }
.nav-item:hover:not(.active) { color: var(--text-muted); }
.nav-item:active { transform: scale(0.88); }

.nav-icon { font-size: 1.4rem; line-height: 1; transition: transform 0.2s; }
.nav-item.active .nav-icon { transform: scale(1.15); }
.nav-label { font-size: 0.68rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }

/* ─── Screen animation ──────────────────────────────────────── */
.screen { animation: screenIn 0.26s cubic-bezier(0.34,1.56,0.64,1); }

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

/* ─── Back button ───────────────────────────────────────────── */
.screen-header {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 20px 0;
}

.btn-back {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 1.1rem; flex-shrink: 0;
  transition: background 0.15s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
}
.btn-back:hover  { background: var(--surface-3); }
.btn-back:active { transform: scale(0.88); }

/* ─── HOME ──────────────────────────────────────────────────── */
.home-header {
  padding: 24px 20px 12px;
  display: flex; align-items: center; justify-content: space-between;
}

.app-logo { font-family: var(--font-display); font-size: 1.8rem; font-weight: 700; color: var(--coral); letter-spacing: -0.02em; }
.app-logo span { color: var(--text); }

.xp-badge {
  display: flex; align-items: center; gap: 6px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 20px; padding: 6px 14px;
  font-weight: 800; font-size: 0.9rem; color: var(--gold);
  transition: transform 0.15s;
}
.xp-badge:hover { transform: scale(1.04); }

/* Daily card */
.daily-card {
  margin: 8px 20px 20px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 16px 18px;
  display: flex; align-items: center; gap: 16px;
}

.streak-badge { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 52px; }
.streak-num   { font-family: var(--font-display); font-size: 2rem; font-weight: 700; color: var(--coral); line-height: 1; }
.streak-label { font-size: 0.65rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); }
.divider-v    { width: 1px; height: 40px; background: var(--border); }
.daily-goal-section { flex: 1; }
.daily-goal-label   { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 6px; }

.xp-bar      { height: 8px; background: var(--surface-3); border-radius: 4px; overflow: hidden; margin-bottom: 4px; }
.xp-bar-fill { height: 100%; background: linear-gradient(90deg, var(--jade), var(--sky)); border-radius: 4px; transition: width 0.6s cubic-bezier(0.34,1.56,0.64,1); min-width: 4px; }
.xp-bar-text { font-size: 0.75rem; font-weight: 700; color: var(--text-muted); }

.section-title { font-family: var(--font-display); font-size: 1.05rem; font-weight: 600; color: var(--text-muted); padding: 0 20px; margin-bottom: 12px; letter-spacing: 0.02em; }

/* ─── Category Grid — COLORFUL SOLID ────────────────────────── */
.category-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 0 20px 24px;
}

.category-card {
  background: var(--card-color, #4ECDC4);
  border-radius: var(--radius-lg);
  padding: 18px 16px;
  cursor: pointer;
  transition: transform 0.18s cubic-bezier(0.34,1.56,0.64,1), box-shadow 0.18s, filter 0.15s;
  -webkit-tap-highlight-color: transparent;
  position: relative;
  overflow: hidden;
}

/* Shine streak */
.category-card::before {
  content: '';
  position: absolute;
  top: -50%; left: -20%;
  width: 50%; height: 180%;
  background: rgba(255,255,255,0.05);
  transform: skewX(-20deg);
  pointer-events: none;
}

/* Big ghost icon */
.category-card::after {
  content: attr(data-icon);
  position: absolute;
  bottom: -10px; right: -2px;
  font-size: 3.4rem;
  opacity: 0.16;
  line-height: 1;
  pointer-events: none;
}

.category-card:hover  { transform: scale(1.04) translateY(-2px); box-shadow: 0 10px 32px rgba(0,0,0,0.45); filter: brightness(1.09); }
.category-card:active { transform: scale(0.96); filter: brightness(0.94); }

.cat-icon   { font-size: 1.6rem; margin-bottom: 8px; line-height: 1; position: relative; z-index: 1; }
.cat-name   { font-family: var(--font-display); font-size: 1.3rem; font-weight: 700; color: rgba(255,255,255,0.96); margin-bottom: 2px; position: relative; z-index: 1; }
.cat-biname { font-size: 0.9rem; color: rgba(255,255,255,0.62); margin-bottom: 10px; position: relative; z-index: 1; }

.mastery-dots { display: flex; gap: 4px; flex-wrap: wrap; position: relative; z-index: 1; }
.mastery-dot       { width: 7px; height: 7px; border-radius: 50%; background: rgba(255,255,255,0.25); transition: background 0.3s; }
.mastery-dot.filled { background: rgba(255,255,255,0.92); }
.mastery-dot.half   { background: rgba(255,255,255,0.5); }

/* ─── Category detail ───────────────────────────────────────── */
.cat-detail-hero {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); margin: 16px 20px; padding: 20px;
  position: relative; overflow: hidden;
}
.cat-detail-hero::after {
  content: attr(data-icon);
  position: absolute; right: 16px; top: 50%;
  transform: translateY(-50%);
  font-size: 4rem; opacity: 0.1; line-height: 1;
}

.cat-detail-name  { font-family: var(--font-display); font-size: 1.6rem; font-weight: 700; margin-bottom: 2px; }
.cat-detail-desc  { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 14px; }
.cat-progress-bar { height: 6px; background: var(--surface-3); border-radius: 3px; margin-bottom: 8px; overflow: hidden; }
.cat-progress-fill { height: 100%; border-radius: 3px; transition: width 0.6s ease; }
.cat-progress-label { font-size: 0.8rem; font-weight: 700; color: var(--text-muted); }

.exercise-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 0 20px 16px; }

.exercise-btn {
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: var(--radius-md); padding: 14px 12px;
  cursor: pointer; text-align: left;
  transition: transform 0.15s, border-color 0.15s, background 0.15s, box-shadow 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.exercise-btn:hover  { border-color: var(--border-2); background: var(--surface-2); box-shadow: var(--shadow-sm); transform: translateY(-2px); }
.exercise-btn:active { transform: scale(0.95); }

.ex-icon { font-size: 1.5rem; margin-bottom: 6px; }
.ex-name { font-family: var(--font-display); font-size: 0.95rem; font-weight: 600; color: var(--text); margin-bottom: 2px; }
.ex-desc { font-size: 0.72rem; color: var(--text-muted); }

.btn-mix {
  margin: 0 20px 12px;
  width: calc(100% - 40px);
  background: var(--coral); color: white;
  border: none; border-radius: var(--radius-md); padding: 17px;
  font-family: var(--font-display); font-size: 1.1rem; font-weight: 600;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: transform 0.15s, box-shadow 0.15s, filter 0.15s;
  box-shadow: 0 4px 18px rgba(255,111,97,0.4);
  -webkit-tap-highlight-color: transparent;
}
.btn-mix:hover  { filter: brightness(1.08); box-shadow: 0 6px 24px rgba(255,111,97,0.5); transform: translateY(-1px); }
.btn-mix:active { transform: scale(0.97); box-shadow: 0 2px 8px rgba(255,111,97,0.25); }

/* ─── EXERCISE SCREEN ───────────────────────────────────────── */
.ex-screen {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

.ex-topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 20px;
  background: rgba(12,27,24,0.92);
  backdrop-filter: blur(12px);
  flex-shrink: 0;
}

.btn-ex-close {
  width: 34px; height: 34px;
  border-radius: 50%; background: var(--surface-2);
  border: 1px solid var(--border); color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 0.85rem; flex-shrink: 0;
  transition: background 0.15s, transform 0.1s, color 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.btn-ex-close:hover  { background: var(--surface-3); color: var(--text); }
.btn-ex-close:active { transform: scale(0.88); }

.progress-bar-wrap { flex: 1; height: 8px; background: var(--surface-3); border-radius: 4px; overflow: hidden; }
.progress-bar-fill { height: 100%; background: linear-gradient(90deg, var(--coral), var(--gold)); border-radius: 4px; transition: width 0.4s ease; }

.hearts { display: flex; gap: 5px; flex-shrink: 0; }
.heart  { font-size: 1.15rem; transition: transform 0.2s; }
.heart.lost { filter: grayscale(1); opacity: 0.28; transform: scale(0.82); }

/* Scrollable exercise body */
.ex-inner {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  -webkit-overflow-scrolling: touch;
}

.question-area {
  flex: 1;
  padding: 20px 20px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.q-prompt {
  font-size: 0.8rem; font-weight: 800;
  text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--text-muted); margin-bottom: 16px;
}

.q-word-card {
  background: var(--surface); border: 2px solid var(--border-2);
  border-radius: var(--radius-xl); padding: 24px 32px;
  margin-bottom: 12px; width: 100%; position: relative;
}

.q-word { font-family: var(--font-display); font-size: 2.2rem; font-weight: 700; color: var(--text); line-height: 1.2; word-break: break-word; }
.q-pos  { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; margin-top: 6px; opacity: 0.5; }

.tts-btn {
  position: absolute; top: 10px; right: 10px;
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--surface-3); border: 1px solid var(--border);
  color: var(--text-muted); display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 0.85rem;
  transition: color 0.15s, background 0.15s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
}
.tts-btn:hover  { color: var(--sky); background: var(--surface-2); }
.tts-btn:active { transform: scale(0.88); }
.tts-btn.speaking { color: var(--sky); }

/* ─── Multiple Choice — BIG FULL-WIDTH ──────────────────────── */
.mc-options {
  display: flex; flex-direction: column;
  gap: 10px; width: 100%;
  padding: 0 20px; margin-bottom: 12px;
}

.mc-option {
  background: var(--surface); border: 2px solid var(--border-2);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  cursor: pointer; text-align: left;
  font-family: var(--font-body); font-size: 1.05rem; font-weight: 700;
  color: var(--text);
  transition: transform 0.1s, border-color 0.15s, background 0.15s;
  -webkit-tap-highlight-color: transparent;
  display: flex; align-items: center; gap: 14px;
  width: 100%; min-height: 64px;
}

.mc-option:hover:not([disabled])  { background: var(--surface-2); border-color: var(--sky); transform: translateX(3px); }
.mc-option:active:not([disabled]) { transform: scale(0.98); }
.mc-option[disabled] { cursor: default; }

.mc-option.selected       { border-color: var(--sky); background: rgba(78,205,196,0.1); }
.mc-option.correct        { border-color: var(--jade) !important; background: rgba(6,214,160,0.13) !important; animation: correctPulse 0.35s ease; }
.mc-option.wrong          { border-color: var(--red) !important; background: rgba(255,71,87,0.1) !important; animation: shake 0.4s ease; }
.mc-option.reveal-correct { border-color: var(--jade); background: rgba(6,214,160,0.07); }

.option-letter {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--surface-3); border: 1.5px solid var(--border-2);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.82rem; font-weight: 800; flex-shrink: 0;
  transition: background 0.15s, border-color 0.15s;
}

.mc-option.selected .option-letter { background: var(--sky);  border-color: var(--sky);  color: var(--bg); }
.mc-option.correct  .option-letter { background: var(--jade); border-color: var(--jade); color: var(--bg); }
.mc-option.wrong    .option-letter { background: var(--red);  border-color: var(--red);  color: white; }
.mc-option.reveal-correct .option-letter { background: var(--jade); border-color: var(--jade); color: var(--bg); }

/* ─── Fill in the blank ─────────────────────────────────────── */
.fib-sentence {
  font-family: var(--font-display); font-size: 1.3rem; font-weight: 600;
  line-height: 1.7; color: var(--text);
  margin-bottom: 6px; padding: 0 20px; text-align: center;
}

.fib-blank {
  display: inline-block; border-bottom: 3px solid var(--coral);
  min-width: 90px; padding: 0 6px; color: transparent;
  vertical-align: bottom; transition: border-color 0.2s, color 0.2s;
}
.fib-blank.filled  { color: var(--coral); border-color: var(--jade); }
.fib-blank.correct { color: var(--jade); border-color: var(--jade); }
.fib-blank.wrong   { color: var(--red);  border-color: var(--red); }

.fib-translation { font-size: 0.82rem; color: var(--text-muted); font-style: italic; margin-bottom: 20px; text-align: center; padding: 0 20px; }

/* ─── Flashcard — BIG AND CENTERED ─────────────────────────── */
.flashcard-container {
  width: 100%; padding: 0 20px;
  display: flex; flex-direction: column;
  align-items: center; flex: 1; min-height: 0;
}

.flashcard-wrap {
  width: 100%; perspective: 1000px;
  cursor: pointer; -webkit-tap-highlight-color: transparent;
  flex: 1; display: flex; flex-direction: column;
  min-height: 260px;
}

.flashcard {
  width: 100%; flex: 1;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.5s cubic-bezier(0.34,1.56,0.64,1);
}

.flashcard.flipped { transform: rotateY(180deg); }

.card-face {
  position: absolute; inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  background: var(--surface); border: 2px solid var(--border-2);
  border-radius: var(--radius-xl);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 32px; text-align: center;
}

.card-face.back { transform: rotateY(180deg); }

.card-tap-hint {
  position: absolute; bottom: 18px;
  font-size: 0.72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-dim);
}

.card-front-word { font-family: var(--font-display); font-size: 2.6rem; font-weight: 700; color: var(--text); line-height: 1.2; }
.card-back-word  { font-family: var(--font-display); font-size: 2.2rem; font-weight: 700; color: var(--jade); margin-bottom: 14px; }
.card-back-example { font-size: 0.9rem; color: var(--text-muted); font-style: italic; line-height: 1.55; }

.flashcard-actions {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 12px; padding: 14px 0 0;
  opacity: 0; pointer-events: none;
  transition: opacity 0.25s;
  width: 100%; flex-shrink: 0;
}
.flashcard-actions.visible { opacity: 1; pointer-events: all; }

.btn-know-it {
  background: rgba(6,214,160,0.12); border: 2px solid var(--jade); color: var(--jade);
  border-radius: var(--radius-md); padding: 16px;
  font-family: var(--font-display); font-size: 1.05rem; font-weight: 600;
  cursor: pointer; transition: transform 0.1s, background 0.15s, box-shadow 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.btn-know-it:hover  { background: rgba(6,214,160,0.22); box-shadow: 0 4px 16px rgba(6,214,160,0.2); }
.btn-know-it:active { transform: scale(0.95); }

.btn-again {
  background: rgba(255,71,87,0.08); border: 2px solid var(--red); color: var(--red);
  border-radius: var(--radius-md); padding: 16px;
  font-family: var(--font-display); font-size: 1.05rem; font-weight: 600;
  cursor: pointer; transition: transform 0.1s, background 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.btn-again:hover  { background: rgba(255,71,87,0.16); }
.btn-again:active { transform: scale(0.95); }

/* ─── Feedback Banner ───────────────────────────────────────── */
.feedback-banner {
  margin: 0 20px 8px; padding: 14px 16px;
  border-radius: var(--radius-md);
  display: none; align-items: flex-start; gap: 10px;
  animation: bannerIn 0.22s ease; flex-shrink: 0;
}
.feedback-banner.visible { display: flex; }

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

.feedback-banner.correct-fb { background: rgba(6,214,160,0.12); border: 1.5px solid rgba(6,214,160,0.3); }
.feedback-banner.wrong-fb   { background: rgba(255,71,87,0.1);  border: 1.5px solid rgba(255,71,87,0.3); }

.fb-icon  { font-size: 1.3rem; flex-shrink: 0; margin-top: 1px; }
.fb-title { font-family: var(--font-display); font-size: 1rem; font-weight: 700; margin-bottom: 2px; }
.correct-fb .fb-title { color: var(--jade); }
.wrong-fb   .fb-title { color: var(--red); }
.fb-text { font-size: 0.82rem; color: var(--text-muted); }

/* ─── Check / Continue Button ───────────────────────────────── */
.btn-check {
  margin: 0 20px 16px;
  width: calc(100% - 40px); padding: 17px;
  border-radius: var(--radius-md); border: none;
  font-family: var(--font-display); font-size: 1.05rem; font-weight: 700;
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.12s, filter 0.12s;
  -webkit-tap-highlight-color: transparent;
  letter-spacing: 0.04em; flex-shrink: 0;
}

.btn-check:disabled { background: var(--surface-3); color: var(--text-dim); cursor: default; }

.btn-check.ready             { background: var(--coral); color: white; box-shadow: 0 4px 18px rgba(255,111,97,0.4); }
.btn-check.ready:hover       { filter: brightness(1.08); box-shadow: 0 6px 24px rgba(255,111,97,0.5); }
.btn-check.ready:active      { transform: scale(0.97); }

.btn-check.continue-correct  { background: var(--jade); color: var(--bg); box-shadow: 0 4px 16px rgba(6,214,160,0.35); }
.btn-check.continue-correct:hover  { filter: brightness(1.06); }
.btn-check.continue-correct:active { transform: scale(0.97); }

.btn-check.continue-wrong    { background: var(--red); color: white; box-shadow: 0 4px 16px rgba(255,71,87,0.3); }
.btn-check.continue-wrong:hover  { filter: brightness(1.08); }
.btn-check.continue-wrong:active { transform: scale(0.97); }

/* ─── RESULTS ───────────────────────────────────────────────── */
.results-screen {
  padding: 32px 20px 24px;
  display: flex; flex-direction: column; align-items: center; text-align: center;
}

.results-emoji { font-size: 4.5rem; margin-bottom: 12px; animation: resultsIn 0.5s cubic-bezier(0.34,1.56,0.64,1); }

@keyframes resultsIn {
  from { transform: scale(0.4) rotate(-15deg); opacity: 0; }
  to   { transform: scale(1) rotate(0deg); opacity: 1; }
}

.results-title    { font-family: var(--font-display); font-size: 2rem; font-weight: 700; margin-bottom: 4px; }
.results-subtitle { color: var(--text-muted); margin-bottom: 28px; font-size: 0.9rem; }

.stars-row { display: flex; gap: 8px; margin-bottom: 28px; }
.star { font-size: 2.5rem; filter: grayscale(1) opacity(0.2); }
.star.earned { filter: none; animation: starPop 0.4s cubic-bezier(0.34,1.56,0.64,1) both; }

@keyframes starPop {
  from { transform: scale(0) rotate(-20deg); }
  to   { transform: scale(1) rotate(0); }
}

.results-stats { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; width: 100%; margin-bottom: 28px; }

.results-stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 14px 10px; }
.results-stat-num   { font-family: var(--font-display); font-size: 1.8rem; font-weight: 700; line-height: 1; margin-bottom: 4px; }
.results-stat-label { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); }

.btn-home-results {
  width: 100%; 
  width: calc(100% - 40px);
  padding: 16px; border-radius: var(--radius-md);
  border: 2px solid var(--border-2); background: transparent; color: var(--text);
  font-family: var(--font-display); font-size: 1rem; font-weight: 600;
  cursor: pointer; transition: background 0.15s, border-color 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.btn-home-results:hover  { background: var(--surface-2); }
.btn-home-results:active { background: var(--surface-3); }

/* ─── STATS ──────────────────────────────────────────────────── */
.stats-screen { padding: 0 0 24px; }
.stats-header { padding: 24px 20px 16px; font-family: var(--font-display); font-size: 1.6rem; font-weight: 700; }
.stats-summary { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; padding: 0 20px 20px; }

.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 16px 10px; text-align: center; }
.stat-num  { font-family: var(--font-display); font-size: 2rem; font-weight: 700; line-height: 1; margin-bottom: 4px; }
.stat-lbl  { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); }

.progress-category-list { padding: 0 20px; display: flex; flex-direction: column; gap: 10px; }

.progress-cat-item {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 14px 16px;
  display: flex; align-items: center; gap: 12px;
  cursor: pointer; transition: border-color 0.15s, background 0.15s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
}
.progress-cat-item:hover  { background: var(--surface-2); border-color: var(--border-2); }
.progress-cat-item:active { transform: scale(0.98); }

.pci-icon  { font-size: 1.5rem; flex-shrink: 0; }
.pci-info  { flex: 1; }
.pci-name  { font-family: var(--font-display); font-size: 0.95rem; font-weight: 600; margin-bottom: 5px; }
.pci-bar   { height: 5px; background: var(--surface-3); border-radius: 3px; overflow: hidden; }
.pci-bar-fill { height: 100%; border-radius: 3px; transition: width 0.5s ease; }
.pci-count { font-size: 0.75rem; color: var(--text-muted); flex-shrink: 0; font-weight: 700; }

/* ─── CUSTOM MODAL ──────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(8px);
  z-index: 500;
  display: flex; align-items: flex-end; justify-content: center;
  animation: fadeIn 0.18s ease;
}

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

.modal-sheet {
  background: var(--surface-2); border: 1px solid var(--border-2);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  padding: 28px 24px 36px;
  width: 100%; max-width: 600px;
  animation: sheetUp 0.28s cubic-bezier(0.34,1.56,0.64,1);
}

@keyframes sheetUp {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

.modal-handle {
  width: 36px; height: 4px; border-radius: 2px;
  background: var(--border-2); margin: 0 auto 20px;
}

.modal-icon  { font-size: 2.5rem; text-align: center; margin-bottom: 12px; }
.modal-title { font-family: var(--font-display); font-size: 1.4rem; font-weight: 700; text-align: center; margin-bottom: 6px; }
.modal-text  { font-size: 0.9rem; color: var(--text-muted); text-align: center; margin-bottom: 24px; line-height: 1.5; }

.modal-btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.modal-btn {
  padding: 15px; border-radius: var(--radius-md); border: none;
  font-family: var(--font-display); font-size: 1rem; font-weight: 600;
  cursor: pointer; transition: transform 0.1s, filter 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.modal-btn:active { transform: scale(0.95); }

.modal-btn-cancel { background: var(--surface-3); color: var(--text); }
.modal-btn-cancel:hover { filter: brightness(1.2); }

.modal-btn-quit { background: var(--red); color: white; box-shadow: 0 4px 14px rgba(255,71,87,0.3); }
.modal-btn-quit:hover { filter: brightness(1.1); }

/* ─── Learn screen ──────────────────────────────────────────── */
.learn-header   { padding: 24px 20px 16px; }
.learn-title    { font-family: var(--font-display); font-size: 1.6rem; font-weight: 700; margin-bottom: 4px; }
.learn-subtitle { font-size: 0.85rem; color: var(--text-muted); }

/* ─── XP Float ──────────────────────────────────────────────── */
.xp-float {
  position: fixed;
  font-family: var(--font-display); font-size: 1.15rem; font-weight: 800;
  color: var(--gold); pointer-events: none; z-index: 200;
  text-shadow: 0 2px 8px rgba(0,0,0,0.4);
  animation: xpFloatAnim 1.2s ease-out forwards;
}

@keyframes xpFloatAnim {
  0%   { opacity: 1; transform: translateY(0) scale(1); }
  70%  { opacity: 1; transform: translateY(-52px) scale(1.2); }
  100% { opacity: 0; transform: translateY(-80px) scale(0.9); }
}

/* ─── Confetti ──────────────────────────────────────────────── */
.confetti-piece {
  position: fixed; width: 8px; height: 12px; border-radius: 2px;
  pointer-events: none; z-index: 300;
  animation: confettiFall 1.4s ease-in forwards;
}

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

/* ─── Keyframes ─────────────────────────────────────────────── */
@keyframes correctPulse {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.025); }
  100% { transform: scale(1); }
}

@keyframes shake {
  0%,100% { transform: translateX(0); }
  20%      { transform: translateX(-7px); }
  40%      { transform: translateX(7px); }
  60%      { transform: translateX(-4px); }
  80%      { transform: translateX(4px); }
}

/* ─── Misc ──────────────────────────────────────────────────── */
.btn-reset {
  flex: 1; padding: 12px; border-radius: var(--radius-md);
  border: 1px solid var(--border); background: transparent;
  color: var(--text-muted); font-family: var(--font-body); font-size: 0.85rem;
  cursor: pointer; transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.btn-reset:hover  { background: var(--surface-2); color: var(--red); border-color: var(--red); }
.btn-reset:active { background: var(--surface-3); }

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

/* ─── Desktop ───────────────────────────────────────────────── */
@media (min-width: 600px) {
  .bottom-nav { left: 50%; right: auto; transform: translateX(-50%); width: 600px; border-left: 1px solid var(--border); border-right: 1px solid var(--border); }
  .bottom-nav.hidden-nav { transform: translateX(-50%) translateY(110%); }
  body::before { display: none; }
  #app-root { border-left: 1px solid var(--border-2); border-right: 1px solid var(--border-2); }
  .q-word { font-size: 2.5rem; }
  .card-front-word { font-size: 3rem; }
}
