/* ═══════════════════════════════════════════════════════════
   Belajar! v3 — Tropical Dark, Mobile First
═══════════════════════════════════════════════════════════ */

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

: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;
  --gold:      #FFD166;
  --jade:      #06D6A0;
  --sky:       #4ECDC4;
  --red:       #FF4757;

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

  --font-d: 'Fredoka', sans-serif;
  --font-b: 'Nunito', sans-serif;
  --nav-h:  68px;
}

*, *::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-b);
  font-size: 16px;
  line-height: 1.5;
  min-height: 100%;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: '';
  position: fixed; inset: 0;
  background:
    radial-gradient(circle at 15% 15%, rgba(6,214,160,.06) 0%, transparent 50%),
    radial-gradient(circle at 85% 85%, rgba(255,111,97,.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; }

/* ─── Nav ─────────────────────────────────────────────────── */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  height: var(--nav-h);
  background: rgba(12,27,24,.97);
  backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  display: flex; z-index: 100;
  max-width: 600px; margin: 0 auto;
  transition: transform .35s cubic-bezier(.4,0,.2,1), opacity .3s;
}
.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 .2s; padding: 8px 0;
  border: none; background: none; font-family: var(--font-b);
  -webkit-tap-highlight-color: transparent;
}
.nav-item.active { color: var(--coral); }
.nav-item:active  { transform: scale(.88); transition: transform .1s; }

/* hover only on real pointer devices */
@media (hover: hover) and (pointer: fine) {
  .nav-item:hover:not(.active) { color: var(--text-muted); }
}

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

/* ─── Screen animation ─────────────────────────────────────── */
.screen { animation: sIn .26s cubic-bezier(.34,1.56,.64,1); }
@keyframes sIn { from { opacity:0; transform:translateY(14px); } to { opacity:1; transform:none; } }

/* ─── Back btn ─────────────────────────────────────────────── */
.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 .15s;
  -webkit-tap-highlight-color: transparent;
}
.btn-back:active { transform: scale(.88); background: var(--surface-3); }
@media (hover:hover) and (pointer:fine) { .btn-back:hover { background: var(--surface-3); } }

/* ─── HOME ─────────────────────────────────────────────────── */
.home-header { padding: 24px 20px 12px; display: flex; align-items: center; justify-content: space-between; }
.app-logo { font-family: var(--font-d); font-size: 1.8rem; font-weight: 700; color: var(--coral); letter-spacing: -.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: .9rem; color: var(--gold);
}

.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-d); font-size:2rem; font-weight:700; color:var(--coral); line-height:1; }
.streak-label { font-size:.65rem; font-weight:700; text-transform:uppercase; letter-spacing:.06em; color:var(--text-muted); }
.divider-v    { width:1px; height:40px; background:var(--border); }
.daily-goal-section { flex:1; }
.daily-goal-label   { font-size:.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 .6s cubic-bezier(.34,1.56,.64,1); min-width:4px; }
.xp-bar-text { font-size:.75rem; font-weight:700; color:var(--text-muted); }

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

/* ─── Category Cards — COLORFUL, READABLE ─────────────────── */
.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;
  position: relative; overflow: hidden;
  transition: transform .18s cubic-bezier(.34,1.56,.64,1), box-shadow .18s, filter .15s;
  -webkit-tap-highlight-color: transparent;
}

/* Dark scrim so text is always readable */
.category-card::before {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(0,0,0,.28) 0%, rgba(0,0,0,.10) 100%);
  pointer-events: none; z-index: 0;
}

/* Ghost icon decoration */
.category-card::after {
  content: attr(data-icon);
  position: absolute; bottom: -8px; right: -2px;
  font-size: 3.4rem; opacity: .15; line-height: 1;
  pointer-events: none; z-index: 0;
}

.category-card:active { transform: scale(.96); }

@media (hover:hover) and (pointer:fine) {
  .category-card:hover { transform:scale(1.04) translateY(-2px); box-shadow:0 10px 32px rgba(0,0,0,.45); filter:brightness(1.08); }
}

.cat-icon   { font-size:1.6rem; margin-bottom:8px; line-height:1; position:relative; z-index:1; }
.cat-name   { font-family:var(--font-d); font-size:1.3rem; font-weight:700; color:#fff; margin-bottom:3px; position:relative; z-index:1; text-shadow:0 1px 4px rgba(0,0,0,.3); }
.cat-biname { font-size:.9rem; color:rgba(255,255,255,.78); 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,.25); }
.mastery-dot.filled { background:rgba(255,255,255,.92); }
.mastery-dot.half   { background:rgba(255,255,255,.5); }

/* ─── Category detail ──────────────────────────────────────── */
.cat-detail-hero {
  background:var(--surface); border:1px solid var(--border);
  border-radius:var(--radius-lg); 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:.09; line-height:1;
}
.cat-detail-name { font-family:var(--font-d); font-size:1.6rem; font-weight:700; margin-bottom:4px; }
.cat-detail-desc { font-size:.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 .6s; }
.cat-progress-label { font-size:.78rem; 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:border-color .15s, background .15s;
  -webkit-tap-highlight-color: transparent;
}
.exercise-btn:active { transform:scale(.95); }
@media (hover:hover) and (pointer:fine) {
  .exercise-btn:hover { border-color:var(--border-2); background:var(--surface-2); transform:translateY(-2px); }
}
.ex-icon { font-size:1.5rem; margin-bottom:6px; }
.ex-name { font-family:var(--font-d); font-size:.95rem; font-weight:600; color:var(--text); margin-bottom:2px; }
.ex-desc { font-size:.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-d); font-size:1.1rem; font-weight:600;
  cursor:pointer; display:flex; align-items:center; justify-content:center; gap:8px;
  box-shadow:0 4px 18px rgba(255,111,97,.4);
  transition:filter .15s, box-shadow .15s;
  -webkit-tap-highlight-color: transparent;
}
.btn-mix:active { transform:scale(.97); box-shadow:0 2px 8px rgba(255,111,97,.25); }
@media (hover:hover) and (pointer:fine) {
  .btn-mix:hover { filter:brightness(1.08); box-shadow:0 6px 24px rgba(255,111,97,.5); }
}

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

.vocab-list { padding:12px 20px calc(var(--nav-h) + 80px); display:flex; flex-direction:column; gap:10px; }

.vocab-item {
  background:var(--surface); border:1px solid var(--border);
  border-radius:var(--radius-md); padding:14px 16px;
}
.vocab-item-top {
  display:flex; align-items:flex-start; justify-content:space-between;
  gap:8px; margin-bottom:3px;
}
.vocab-word { font-family:var(--font-d); font-size:1.3rem; font-weight:700; }
.vocab-badges { display:flex; align-items:center; gap:6px; flex-shrink:0; }
.vocab-pos {
  font-size:.62rem; font-weight:700; text-transform:uppercase; letter-spacing:.06em;
  color:var(--text-dim); background:var(--surface-3); border-radius:4px; padding:2px 6px;
}
.vocab-check { color:var(--jade); font-weight:800; font-size:.9rem; }
.vocab-en    { font-size:.95rem; color:var(--text-muted); margin-bottom:8px; }

.vocab-example { border-top:1px solid var(--border); padding-top:8px; }
.vocab-ex-bi   { font-size:.9rem; color:var(--text); line-height:1.45; margin-bottom:2px; }
.vocab-ex-bi strong.ex-hl { color:var(--gold); font-weight:800; }
.vocab-ex-en   { font-size:.78rem; color:var(--text-dim); font-style:italic; }

.vocab-practice-bar {
  position:fixed; bottom:var(--nav-h); left:0; right:0;
  padding:12px 20px 14px;
  background:linear-gradient(to top, var(--bg) 65%, transparent);
  max-width:600px; margin:0 auto;
  pointer-events:none;
}
.vocab-practice-bar .btn-mix { pointer-events:all; }

/* ─── EXERCISE ───────────────────────────────────────────────── */
.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,.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:.85rem; flex-shrink:0;
  transition:background .15s;
  -webkit-tap-highlight-color: transparent;
}
.btn-ex-close:active { transform:scale(.88); }
@media (hover:hover) and (pointer:fine) { .btn-ex-close:hover { background:var(--surface-3); color:var(--text); } }

.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 .4s; }

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

.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:.8rem; font-weight:800; text-transform:uppercase; letter-spacing:.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-d); font-size:2.2rem; font-weight:700; color:var(--text); line-height:1.2; word-break:break-word; }
.q-pos  { font-size:.72rem; font-weight:700; text-transform:uppercase; letter-spacing:.08em; margin-top:6px; opacity:.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:.85rem;
  transition:color .15s, background .15s;
  -webkit-tap-highlight-color: transparent;
}
.tts-btn:active { transform:scale(.88); }
@media (hover:hover) and (pointer:fine) { .tts-btn:hover { color:var(--sky); background:var(--surface-2); } }

/* ─── MC Options — BIG, NO HOVER JANK ─────────────────────── */
.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-b); font-size:1.05rem; font-weight:700; color:var(--text);
  /* NO transform on hover — was causing jank on mobile */
  transition:border-color .12s, background .12s;
  -webkit-tap-highlight-color: transparent;
  display:flex; align-items:center; gap:14px;
  width:100%; min-height:64px;
}

/* Hover only on desktop pointer devices */
@media (hover:hover) and (pointer:fine) {
  .mc-option:hover:not([disabled]):not(.selected):not(.correct):not(.wrong) {
    background:var(--surface-2); border-color:var(--sky);
  }
}

.mc-option:active:not([disabled]) { filter:brightness(.9); }
.mc-option[disabled] { cursor:default; }

.mc-option.selected       { border-color:var(--sky);  background:rgba(78,205,196,.1); }
.mc-option.correct        { border-color:var(--jade) !important; background:rgba(6,214,160,.13) !important; animation:pulse .35s ease; }
.mc-option.wrong          { border-color:var(--red) !important;  background:rgba(255,71,87,.1) !important; animation:shake .4s ease; }
.mc-option.reveal-correct { border-color:var(--jade); background:rgba(6,214,160,.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:.82rem; font-weight:800; flex-shrink:0;
  transition:background .12s, border-color .12s;
}
.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:#fff; }
.mc-option.reveal-correct .option-letter { background:var(--jade); border-color:var(--jade); color:var(--bg); }

/* ─── Fill blank ───────────────────────────────────────────── */
.fib-sentence { font-family:var(--font-d); 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 .2s, color .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:.82rem; color:var(--text-muted); font-style:italic; margin-bottom:16px; text-align:center; padding:0 20px; }

/* ─── Flashcard ────────────────────────────────────────────── */
.flashcard-container { width:100%; padding:0 20px; display:flex; flex-direction:column; flex:1; min-height:0; }
.flashcard-wrap      { width:100%; perspective:1000px; cursor:pointer; flex:1; display:flex; flex-direction:column; min-height:260px; -webkit-tap-highlight-color:transparent; }
.flashcard { width:100%; flex:1; position:relative; transform-style:preserve-3d; transition:transform .5s cubic-bezier(.34,1.56,.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:.72rem; font-weight:700; text-transform:uppercase; letter-spacing:.1em; color:var(--text-dim); }
.card-front-word { font-family:var(--font-d); font-size:2.6rem; font-weight:700; color:var(--text); line-height:1.2; }
.card-back-word  { font-family:var(--font-d); font-size:2.2rem; font-weight:700; color:var(--jade); margin-bottom:14px; }
.card-back-example { font-size:.9rem; color:var(--text-muted); font-style:italic; line-height:1.55; }
.card-back-example strong.ex-hl { color:var(--gold); font-weight:800; font-style:normal; }

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

.btn-know-it {
  background:rgba(6,214,160,.12); border:2px solid var(--jade); color:var(--jade);
  border-radius:var(--radius-md); padding:16px;
  font-family:var(--font-d); font-size:1.05rem; font-weight:600;
  cursor:pointer; transition:background .15s;
  -webkit-tap-highlight-color:transparent;
}
.btn-know-it:active { transform:scale(.95); }
@media (hover:hover) and (pointer:fine) { .btn-know-it:hover { background:rgba(6,214,160,.22); } }

.btn-again {
  background:rgba(255,71,87,.08); border:2px solid var(--red); color:var(--red);
  border-radius:var(--radius-md); padding:16px;
  font-family:var(--font-d); font-size:1.05rem; font-weight:600;
  cursor:pointer; transition:background .15s;
  -webkit-tap-highlight-color:transparent;
}
.btn-again:active { transform:scale(.95); }
@media (hover:hover) and (pointer:fine) { .btn-again:hover { background:rgba(255,71,87,.16); } }

/* ─── Feedback ─────────────────────────────────────────────── */
.feedback-banner { margin:0 20px 8px; padding:14px 16px; border-radius:var(--radius-md); display:none; align-items:flex-start; gap:10px; animation:banIn .22s ease; flex-shrink:0; }
.feedback-banner.visible { display:flex; }
@keyframes banIn { from{opacity:0;transform:translateY(8px)} to{opacity:1;transform:none} }
.feedback-banner.correct-fb { background:rgba(6,214,160,.12); border:1.5px solid rgba(6,214,160,.3); }
.feedback-banner.wrong-fb   { background:rgba(255,71,87,.1);  border:1.5px solid rgba(255,71,87,.3); }
.fb-icon  { font-size:1.3rem; flex-shrink:0; margin-top:1px; }
.fb-title { font-family:var(--font-d); 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:.82rem; color:var(--text-muted); }

/* ─── Check btn ────────────────────────────────────────────── */
.btn-check {
  margin:0 20px 16px; width:calc(100% - 40px); padding:17px;
  border-radius:var(--radius-md); border:none;
  font-family:var(--font-d); font-size:1.05rem; font-weight:700;
  cursor:pointer; letter-spacing:.04em; flex-shrink:0;
  transition:filter .12s, box-shadow .12s;
  -webkit-tap-highlight-color:transparent;
}
.btn-check:disabled { background:var(--surface-3); color:var(--text-dim); cursor:default; }
.btn-check.ready             { background:var(--coral); color:#fff; box-shadow:0 4px 18px rgba(255,111,97,.4); }
.btn-check.ready:active      { transform:scale(.97); }
.btn-check.continue-correct  { background:var(--jade); color:var(--bg); box-shadow:0 4px 16px rgba(6,214,160,.35); }
.btn-check.continue-correct:active { transform:scale(.97); }
.btn-check.continue-wrong    { background:var(--red); color:#fff; box-shadow:0 4px 16px rgba(255,71,87,.3); }
.btn-check.continue-wrong:active { transform:scale(.97); }
@media (hover:hover) and (pointer:fine) {
  .btn-check.ready:hover            { filter:brightness(1.08); }
  .btn-check.continue-correct:hover { filter:brightness(1.06); }
  .btn-check.continue-wrong:hover   { filter:brightness(1.08); }
}

/* ─── 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:resIn .5s cubic-bezier(.34,1.56,.64,1); }
@keyframes resIn { from{transform:scale(.4) rotate(-15deg);opacity:0} to{transform:none;opacity:1} }
.results-title    { font-family:var(--font-d); font-size:2rem; font-weight:700; margin-bottom:4px; }
.results-subtitle { color:var(--text-muted); margin-bottom:28px; font-size:.9rem; }

.stars-row { display:flex; gap:8px; margin-bottom:28px; }
.star { font-size:2.5rem; filter:grayscale(1) opacity(.2); }
.star.earned { filter:none; animation:starPop .4s cubic-bezier(.34,1.56,.64,1) both; }
@keyframes starPop { from{transform:scale(0) rotate(-20deg)} to{transform:none} }

.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-d); font-size:1.8rem; font-weight:700; line-height:1; margin-bottom:4px; }
.results-stat-label { font-size:.72rem; font-weight:700; text-transform:uppercase; letter-spacing:.06em; color:var(--text-muted); }

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

/* ─── STATS ────────────────────────────────────────────────── */
.stats-screen  { padding:0 0 24px; }
.stats-header  { padding:24px 20px 16px; font-family:var(--font-d); 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-d); font-size:2rem; font-weight:700; line-height:1; margin-bottom:4px; }
.stat-lbl  { font-size:.7rem; font-weight:700; text-transform:uppercase; letter-spacing:.06em; color:var(--text-muted); }

/* ─── Calendar ─────────────────────────────────────────────── */
.cal-wrap { padding:0 20px 4px; }

.cal-grid {
  display:grid; grid-template-columns:repeat(7,1fr); gap:4px;
}

.cal-label { text-align:center; font-size:.6rem; font-weight:800; color:var(--text-dim); text-transform:uppercase; padding-bottom:4px; }

.cal-cell { aspect-ratio:1; border-radius:3px; background:var(--surface-2); }
.cal-cell.studied  { background:var(--coral); }
.cal-cell.cal-today { outline:2px solid var(--text-muted); outline-offset:1px; border-radius:4px; }

.cal-legend { display:flex; align-items:center; gap:4px; margin-top:6px; justify-content:flex-end; }
.cal-legend-text { font-size:.65rem; color:var(--text-dim); }

/* ─── Progress category list ───────────────────────────────── */
.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:background .15s;
  -webkit-tap-highlight-color:transparent;
}
.progress-cat-item:active { transform:scale(.98); }
@media (hover:hover) and (pointer:fine) { .progress-cat-item:hover { background:var(--surface-2); border-color:var(--border-2); } }

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

.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-b); font-size:.85rem;
  cursor:pointer; transition:color .15s, border-color .15s, background .15s;
}
.btn-reset:active { background:var(--surface-2); }
@media (hover:hover) and (pointer:fine) { .btn-reset:hover { color:var(--red); border-color:var(--red); } }

/* ─── Custom Modal ─────────────────────────────────────────── */
.modal-overlay {
  position:fixed; inset:0; background:rgba(0,0,0,.7);
  backdrop-filter:blur(8px); z-index:500;
  display:flex; align-items:flex-end; justify-content:center;
  animation:fadeIn .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:24px 24px 36px;
  width:100%; max-width:600px;
  animation:sheetUp .28s cubic-bezier(.34,1.56,.64,1);
}
@keyframes sheetUp { from{transform:translateY(100%)} to{transform:none} }

.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-d); font-size:1.4rem; font-weight:700; text-align:center; margin-bottom:6px; }
.modal-text   { font-size:.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-d); font-size:1rem; font-weight:600; cursor:pointer; transition:filter .15s; -webkit-tap-highlight-color:transparent; }
.modal-btn:active { transform:scale(.95); }
.modal-btn-cancel  { background:var(--surface-3); color:var(--text); }
.modal-btn-confirm { background:var(--red); color:#fff; box-shadow:0 4px 14px rgba(255,71,87,.3); }
@media (hover:hover) and (pointer:fine) {
  .modal-btn-cancel:hover  { filter:brightness(1.2); }
  .modal-btn-confirm:hover { filter:brightness(1.1); }
}

/* ─── Toast ────────────────────────────────────────────────── */
.toast {
  position:fixed; bottom:calc(var(--nav-h) + 12px); left:16px; right:16px;
  max-width:568px; margin:0 auto;
  background:var(--surface-2); border:1px solid var(--border-2);
  border-radius:var(--radius-md); padding:12px 16px;
  font-size:.82rem; color:var(--text-muted); line-height:1.4;
  z-index:400;
  transform:translateY(20px); opacity:0;
  transition:transform .3s cubic-bezier(.34,1.56,.64,1), opacity .3s;
  pointer-events:none;
}
.toast.toast-show { transform:none; opacity:1; }

/* ─── XP Float ─────────────────────────────────────────────── */
.xp-float { position:fixed; font-family:var(--font-d); 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,.4); animation:xpUp 1.2s ease-out forwards; }
@keyframes xpUp { 0%{opacity:1;transform:translateY(0) scale(1)} 70%{opacity:1;transform:translateY(-52px) scale(1.2)} 100%{opacity:0;transform:translateY(-80px) scale(.9)} }

/* ─── Confetti ─────────────────────────────────────────────── */
.confetti-piece { position:fixed; width:8px; height:12px; border-radius:2px; pointer-events:none; z-index:300; animation:confFall 1.4s ease-in forwards; }
@keyframes confFall { 0%{transform:translateY(0) rotate(0deg) scaleX(1);opacity:1} 100%{transform:translateY(60vh) rotate(720deg) scaleX(.4);opacity:0} }

/* ─── Shared keyframes ─────────────────────────────────────── */
@keyframes pulse { 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)} }

/* ─── Scrollbar ────────────────────────────────────────────── */
::-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%); }
  #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; }
}
