/* ============================================================
   Hear It — styles
   Friendly, gamified language-learning. Coral + sky + sunshine.
   Fonts: Quicksand (display) + Nunito (body).
   ============================================================ */

:root {
  --coral: #B9382E;
  --coral-d: #8F241D;
  --sky: #2859B8;
  --sun: #FFC24B;
  --mint: #146B4E;
  --pink: #FF8FB1;

  --accent: var(--coral);          /* swapped per active language */

  --ink: #2A2438;
  --ink-soft: #6A6378;
  --ink-faint: #665F73;
  --paper: #FFF7F2;                /* warm off-white */
  --card: #FFFFFF;
  --line: #F0E6DE;
  --line-2: #EADFD6;
  --shadow: 0 12px 30px -12px rgba(74, 53, 80, 0.22);
  --shadow-lg: 0 28px 60px -20px rgba(74, 53, 80, 0.30);

  --r-lg: 28px;
  --r-md: 20px;
  --r-sm: 14px;

  --side-w: 252px;
  --ease: cubic-bezier(.22, 1, .36, 1);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Nunito", system-ui, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 110% -10%, #FFE9DF 0%, transparent 55%),
    radial-gradient(900px 500px at -10% 110%, #E4EEFF 0%, transparent 55%),
    var(--paper);
  background-attachment: fixed;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  font-weight: 600;
}
h1, h2, h3, h4, .brand-name { font-family: "Quicksand", sans-serif; font-weight: 700; letter-spacing: -.01em; }
button { font-family: inherit; cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .62; }
button, a, input, textarea, select, [role="button"] { touch-action: manipulation; }
:focus-visible { outline: 3px solid #2859B8; outline-offset: 3px; }
input::placeholder, textarea::placeholder { color: var(--ink-faint); opacity: 1; }
.sr-only {
  position: absolute !important; width: 1px !important; height: 1px !important;
  padding: 0 !important; margin: -1px !important; overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important;
}
.skip-link {
  position: fixed; inset-block-start: 10px; inset-inline-start: 10px; z-index: 1000;
  transform: translateY(-150%); background: var(--ink); color: #fff;
  padding: 10px 14px; border-radius: 10px; font-weight: 800; text-decoration: none;
}
.skip-link:focus { transform: none; }

/* decorative background blobs */
.bg-decor { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.blob { position: absolute; border-radius: 50%; filter: blur(60px); opacity: .35; }
.blob-1 { width: 360px; height: 360px; background: var(--coral); top: -120px; right: 8%; animation: float1 14s ease-in-out infinite; }
.blob-2 { width: 300px; height: 300px; background: var(--sky); bottom: -100px; left: 20%; animation: float2 18s ease-in-out infinite; }
.blob-3 { width: 240px; height: 240px; background: var(--sun); top: 40%; left: -80px; opacity: .25; animation: float1 20s ease-in-out infinite; }
@keyframes float1 { 0%,100%{transform:translateY(0)} 50%{transform:translateY(34px)} }
@keyframes float2 { 0%,100%{transform:translate(0,0)} 50%{transform:translate(20px,-26px)} }

/* ============================================================
   LAYOUT
   ============================================================ */
.sidebar {
  position: fixed; left: 0; top: 0; bottom: 0; width: var(--side-w);
  background: rgba(255,255,255,.78); backdrop-filter: blur(16px);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 8px; padding: 24px 18px;
  z-index: 30;
}
.brand { display: flex; align-items: center; gap: 11px; text-decoration: none; padding: 4px 6px 18px; }
.brand-mark { display: grid; place-items: center; filter: drop-shadow(0 6px 12px rgba(255,107,92,.35)); transition: transform .4s var(--ease); }
.brand:hover .brand-mark { transform: rotate(-8deg) scale(1.06); }
.brand-name { font-size: 24px; color: var(--ink); }
.brand-name span { color: var(--accent); }

.nav { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  border: 0; background: transparent; color: var(--ink-soft);
  font-size: 16px; font-weight: 700; padding: 13px 14px; border-radius: var(--r-sm);
  text-align: left; transition: .18s; position: relative;
}
.nav-item .ni-ic { font-size: 19px; filter: grayscale(.3); transition: .2s; }
.nav-item:hover { background: #FFF1EA; color: var(--ink); }
.nav-item.is-active { background: var(--accent); color: #fff; box-shadow: 0 10px 22px -10px var(--accent); }
.nav-item.is-active .ni-ic { filter: none; transform: scale(1.1); }

.nav--secondary { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); gap: 4px; }
.nav-item--mini { font-size: 14px; padding: 10px 14px; text-decoration: none; }
.nav-item--mini .ni-ic { font-size: 17px; }

.side-streak {
  margin-top: auto; display: flex; align-items: center; gap: 12px;
  background: linear-gradient(135deg, #FFF3D6, #FFE6D0);
  border: 1px solid #FFE0B8; border-radius: var(--r-md); padding: 14px 16px;
}
.streak-flame { font-size: 28px; animation: flame 2.4s ease-in-out infinite; }
@keyframes flame { 0%,100%{transform:scale(1) rotate(-3deg)} 50%{transform:scale(1.12) rotate(4deg)} }
.streak-num { font-family: "Quicksand"; font-weight: 700; font-size: 24px; line-height: 1; color: var(--coral-d); }
.streak-lbl { font-size: 12px; color: var(--ink-soft); }

.topbar { display: none; }
.mobnav { display: none; }

.main {
  margin-left: var(--side-w);
  padding: 36px clamp(20px, 4vw, 56px) 80px;
  position: relative; z-index: 1; max-width: 1180px;
}

/* ============================================================
   COMMON
   ============================================================ */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 24px; box-shadow: var(--shadow);
}
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.card-head h3 { margin: 0; font-size: 18px; }
.muted { color: var(--ink-faint); font-size: 13px; font-weight: 700; }
.center { text-align: center; }
.page-title { font-size: clamp(26px, 4vw, 34px); margin: 0 0 4px; }
.page-sub { color: var(--ink-soft); margin: 0 0 24px; font-size: 15px; }
.grid-two { display: grid; grid-template-columns: 1.1fr .9fr; gap: 20px; margin-bottom: 22px; }
.empty { padding: 40px; text-align: center; color: var(--ink-faint); background: var(--card); border: 2px dashed var(--line-2); border-radius: var(--r-md); }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: #FFF1EA; color: var(--ink-soft); font-weight: 800; font-size: 13px;
  padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line-2);
}
.chip-streak { background: linear-gradient(135deg,#FFE7C9,#FFD9C4); color: var(--coral-d); border-color:#FFD2B0; }
.chip-xp { background: #FFF6D9; color: #765500; border-color:#FCE9A8; }

/* buttons */
.btn-3d {
  background: var(--accent); color: #fff; border: 0; font-weight: 800; font-size: 16px;
  padding: 14px 26px; border-radius: 16px; letter-spacing: .01em;
  box-shadow: 0 6px 0 0 var(--coral-d), 0 14px 22px -10px var(--accent);
  transition: transform .08s, box-shadow .08s; position: relative;
}
.btn-3d:hover { filter: brightness(1.03); }
.btn-3d:active { transform: translateY(4px); box-shadow: 0 2px 0 0 var(--coral-d); }
.btn-3d.big { font-size: 18px; padding: 16px 36px; }
.btn-3d.is-next { background: var(--mint); box-shadow: 0 6px 0 0 #2a9d72, 0 14px 22px -10px var(--mint); }

.btn-soft {
  background: #fff; color: var(--ink); border: 2px solid var(--line-2); font-weight: 800; font-size: 15px;
  padding: 12px 22px; border-radius: 16px; transition: .15s;
}
.btn-soft:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-1px); }
.btn-soft.success { border-color: #B7E8D2; color: #126B4B; background:#F1FBF6; }
.btn-soft.success:hover { background: var(--mint); color:#fff; border-color: var(--mint); }
.btn-soft.danger { border-color: #FFD2C9; color: var(--coral-d); background:#FFF4F1; }
.btn-soft.danger:hover { background: var(--coral); color:#fff; border-color: var(--coral); }
.ghost { background: transparent; border: 0; color: var(--ink-soft); font-weight: 800; font-size: 14px; padding: 10px 14px; border-radius: 12px; transition:.15s; }
.ghost:hover { background:#FFF1EA; color: var(--ink); }
.link-btn { background: none; border: 0; color: var(--ink-faint); font-weight: 700; text-decoration: underline; font-size: 13px; }
.link-btn:hover { color: var(--coral-d); }
.icon-btn { background:#FFF1EA; border:0; width:44px; height:44px; border-radius:12px; font-size:16px; color:var(--ink-soft); transition:.15s; }
.icon-btn:hover { background: var(--accent); color:#fff; }

/* ============================================================
   HERO + MASCOT
   ============================================================ */
.hero { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 24px; margin-bottom: 26px; }
.hero-kicker { color: var(--accent); font-weight: 800; text-transform: uppercase; letter-spacing: .12em; font-size: 12px; margin-bottom: 8px; }
.hero-title { font-size: clamp(30px, 5vw, 48px); margin: 0 0 10px; line-height: 1.04; }
.hero-title span { color: var(--accent); position: relative; }
.hero-title span::after { content:""; position:absolute; left:0; right:0; bottom:4px; height:8px; background: var(--sun); opacity:.5; border-radius:4px; z-index:-1; }
.hero-sub { color: var(--ink-soft); font-size: 16px; max-width: 460px; margin: 0; }

.hero-mascot { display: grid; place-items: center; }
.mascot { position: relative; width: 130px; height: 130px; animation: bob 4s ease-in-out infinite; }
@keyframes bob { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-10px)} }
.mascot-face {
  position: absolute; inset: 14px; border-radius: 42% 42% 46% 46%;
  background: linear-gradient(160deg, #FF8A7C, var(--coral));
  box-shadow: inset 0 -10px 18px rgba(0,0,0,.08), var(--shadow-lg);
}
.mascot-ear { position: absolute; top: -6px; width: 46px; height: 46px; background: var(--coral); border-radius: 50% 50% 30% 30%; box-shadow: var(--shadow); }
.mascot-ear--l { left: 6px; transform: rotate(-18deg); }
.mascot-ear--r { right: 6px; transform: rotate(18deg); }
.mascot-ear::after { content:""; position:absolute; inset:9px 9px 14px; background:#FFD9CF; border-radius:50%; }
.m-eye { position: absolute; top: 46px; width: 16px; height: 16px; background:#2A2438; border-radius:50%; animation: blink 5s infinite; }
.m-eye::after { content:""; position:absolute; top:2px; left:3px; width:6px; height:6px; background:#fff; border-radius:50%; }
.m-eye--l { left: 36px; } .m-eye--r { right: 36px; }
@keyframes blink { 0%,92%,100%{transform:scaleY(1)} 96%{transform:scaleY(.1)} }
.m-mouth { position:absolute; bottom:34px; left:50%; transform:translateX(-50%); width:30px; height:16px; border:4px solid #2A2438; border-top:0; border-radius:0 0 30px 30px; }
.sound-wave { position:absolute; right:-30px; top:40px; display:flex; gap:4px; align-items:flex-end; height:34px; }
.sound-wave span { width:5px; background: var(--sun); border-radius:3px; animation: wave 1s ease-in-out infinite; }
.sound-wave span:nth-child(1){height:12px;animation-delay:0s}
.sound-wave span:nth-child(2){height:26px;animation-delay:.15s}
.sound-wave span:nth-child(3){height:18px;animation-delay:.3s}
.sound-wave span:nth-child(4){height:10px;animation-delay:.45s}
@keyframes wave { 0%,100%{transform:scaleY(.5)} 50%{transform:scaleY(1)} }

/* ============================================================
   GOAL CARD + RING + LEADERBOARD
   ============================================================ */
.goal-card { display: flex; align-items: center; gap: 22px; }
.goal-ring { position: relative; width: 110px; height: 110px; flex: none; }
.goal-ring.big { width: 150px; height: 150px; margin: 8px auto 12px; }
.ring { transform: rotate(-90deg); width: 100%; height: 100%; }
.ring-bg { fill: none; stroke: var(--line); stroke-width: 9; }
.ring-fg { fill: none; stroke: var(--accent); stroke-width: 9; stroke-linecap: round; transition: stroke-dashoffset .9s var(--ease); }
.goal-ring-center { position:absolute; inset:0; display:grid; place-content:center; text-align:center; }
.goal-ring-center b { font-family:"Quicksand"; font-size: 26px; color: var(--ink); display:block; }
.goal-ring.big .goal-ring-center b { font-size: 34px; }
.goal-ring-center small { color: var(--ink-faint); font-size: 11px; font-weight:800; }
.goal-info h3 { margin: 0 0 4px; font-size: 19px; }
.goal-line { margin: 0 0 10px; color: var(--ink-soft); }
.goal-line b { color: var(--ink); font-size: 18px; }
.goal-flags { margin-bottom: 14px; }
.goal-set { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-soft); font-weight:800; }
.goalbtn { min-width: 44px; min-height: 44px; border-radius: 10px; border: 2px solid var(--line-2); background:#fff; font-weight:800; color: var(--ink-soft); transition:.15s; }
.goalbtn:hover { border-color: var(--accent); }
.goalbtn.is-on { background: var(--accent); color:#fff; border-color: var(--accent); }

.lb-list { display: flex; flex-direction: column; gap: 4px; }
.lb-row { display: grid; grid-template-columns: 26px 26px 1fr auto; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 12px; transition:.15s; }
.lb-row:hover { background:#FFF7F2; }
.lb-rank { font-family:"Quicksand"; font-weight:700; color: var(--ink-faint); text-align:center; }
.lb-row:nth-child(1) .lb-rank { color: #765500; } .lb-row:nth-child(2) .lb-rank{color:#625B6D} .lb-row:nth-child(3) .lb-rank{color:#815134}
.lb-flag { font-size: 18px; }
.lb-name { font-weight: 700; color: var(--ink); }
.lb-xp { font-weight: 800; color: var(--ink-soft); font-size: 13px; }
.lb-row.is-you { background: linear-gradient(135deg,#FFF1EA,#FFE7DC); border:1px solid #FFD9C9; }
.lb-row.is-you .lb-name { color: var(--coral-d); }

/* ============================================================
   PICKERS
   ============================================================ */
.picker { margin-bottom: 18px; }
.picker-lbl { font-weight: 800; color: var(--ink-soft); font-size: 13px; text-transform: uppercase; letter-spacing: .1em; margin-bottom: 10px; }
.lang-row { display: flex; gap: 12px; flex-wrap: wrap; }
.lang-pill {
  display: flex; align-items: center; gap: 11px; background: var(--card);
  border: 2px solid var(--line-2); border-radius: 18px; padding: 11px 18px 11px 13px; transition: .18s var(--ease);
}
.lang-pill:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.lang-pill.is-on { border-color: var(--accent); background: #fff; box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 16%, transparent); }
.lp-flag { font-size: 26px; line-height: 1; }
.lp-text { display: flex; flex-direction: column; line-height: 1.1; }
.lp-text b { font-size: 15px; }
.lp-text small { color: var(--ink-faint); font-weight: 700; font-size: 12px; }

.level-row { display: flex; gap: 8px; flex-wrap: wrap; }
.level-pill { background:#fff; border: 2px solid var(--line-2); border-radius: 999px; padding: 8px 16px; font-weight: 800; font-size: 13px; color: var(--ink-soft); transition:.15s; }
.level-pill:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.level-pill.is-on { background: var(--accent); color:#fff; border-color: var(--accent); }
.level-pill.is-empty { opacity: .4; cursor: not-allowed; }

/* ============================================================
   LESSON GRID
   ============================================================ */
.lesson-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 18px; }
.lesson-card {
  text-align: left; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 20px; box-shadow: var(--shadow); transition: transform .2s var(--ease), box-shadow .2s;
  display: flex; flex-direction: column; gap: 6px; animation: pop-in .4s var(--ease) backwards;
  animation-delay: calc(var(--i) * 60ms);
}
@keyframes pop-in { from { opacity:0; transform: translateY(14px) scale(.96); } to { opacity:1; transform:none; } }
.lesson-card:hover { transform: translateY(-5px) rotate(-.5deg); box-shadow: var(--shadow-lg); }
.lesson-card.is-done { background: linear-gradient(160deg,#F2FBF7,#fff); border-color:#CDEEDE; }
.lc-top { display: flex; align-items: center; justify-content: space-between; }
.lc-emoji { font-size: 34px; filter: drop-shadow(0 4px 6px rgba(0,0,0,.1)); }
.lc-level { background:#FFF1EA; color: var(--accent); font-weight: 800; font-size: 12px; padding: 4px 10px; border-radius: 999px; }
.lc-badge { background: var(--mint); color:#fff; font-weight:800; font-size:12px; padding:5px 10px; border-radius:999px; }
.lc-title { margin: 6px 0 0; font-size: 19px; }
.lc-meta { margin: 0; color: var(--ink-faint); font-size: 13px; font-weight: 700; }
.lc-bar { height: 9px; background: var(--line); border-radius: 999px; overflow: hidden; margin: 10px 0 4px; }
.lc-bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), color-mix(in srgb,var(--accent) 60%, var(--sun))); border-radius: 999px; }
.lc-foot { display: flex; justify-content: space-between; align-items: center; font-size: 13px; font-weight: 800; color: var(--ink-soft); }
.lc-go { color: var(--accent); }

/* ============================================================
   DICTATION PLAYER OVERLAY
   ============================================================ */
.player-overlay {
  position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 18px;
  background: rgba(42,36,56,.46); backdrop-filter: blur(6px);
  opacity: 0; transition: opacity .26s;
}
.player-overlay.show { opacity: 1; }
.player {
  width: min(640px, 100%); max-height: 92vh; overflow-y: auto;
  background: var(--paper); border-radius: var(--r-lg); box-shadow: var(--shadow-lg);
  transform: translateY(24px) scale(.97); transition: transform .3s var(--ease);
}
.player-overlay.show .player { transform: none; }
.player-head { display: flex; align-items: center; gap: 14px; padding: 18px 20px 12px; }
.player-title { font-family:"Quicksand"; font-weight: 700; font-size: 17px; flex: 1; }
.player-title em { color: var(--ink-faint); font-style: normal; font-weight: 700; font-size: 13px; }
.player-prog { font-weight: 800; color: var(--ink-soft); }
.player-progbar { height: 8px; background: var(--line); margin: 0 20px; border-radius: 999px; overflow: hidden; }
.player-progbar span { display:block; height:100%; background: var(--accent); border-radius:999px; }
.player-body { padding: 22px 26px 30px; }

.dictation { display: flex; flex-direction: column; gap: 16px; }
.speaker-wrap { display: grid; place-items: center; padding: 8px 0 4px; }
.speaker-btn {
  position: relative; width: 96px; height: 96px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #FF8A7C, var(--coral));
  border: 0; color: #fff; box-shadow: 0 14px 30px -10px var(--coral); transition: transform .15s;
}
.speaker-btn:hover { transform: scale(1.05); }
.speaker-btn:active { transform: scale(.96); }
.sp-ic { font-size: 30px; margin-left: 5px; display: inline-block; }
.sp-rings i { position: absolute; inset: 0; border-radius: 50%; border: 3px solid var(--coral); opacity: 0; }
.speaker-btn.speaking .sp-rings i { animation: ring 1.4s ease-out infinite; }
.speaker-btn.speaking .sp-rings i:nth-child(2){animation-delay:.45s} .speaker-btn.speaking .sp-rings i:nth-child(3){animation-delay:.9s}
@keyframes ring { 0%{transform:scale(1);opacity:.6} 100%{transform:scale(1.7);opacity:0} }
.speaker-btn.speaking { animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 0%,100%{box-shadow:0 14px 30px -10px var(--coral)} 50%{box-shadow:0 14px 44px -6px var(--coral)} }

.play-controls { display: flex; gap: 10px; justify-content: center; }
.ctl { min-height: 44px; background:#fff; border: 2px solid var(--line-2); border-radius: 14px; padding: 9px 16px; font-weight: 800; font-size: 14px; color: var(--ink-soft); transition:.15s; }
.ctl:hover { border-color: var(--accent); color: var(--accent); }
.ctl.is-on { background: var(--sky); color:#fff; border-color: var(--sky); }

.novoice { background:#FFF6D9; border:1px solid #FCE9A8; border-radius: var(--r-md); padding: 14px 16px; color:#8a6d12; font-size: 14px; }
.novoice b { color:#6e560c; }
.novoice-text { margin-top: 8px; font-family:"Quicksand"; font-size: 18px; color: var(--ink); }

.dict-label { font-weight: 800; color: var(--ink-soft); font-size: 14px; }
.dict-input {
  width: 100%; resize: vertical; min-height: 64px; font-family:"Quicksand"; font-size: 19px; font-weight: 600;
  padding: 14px 16px; border: 2px solid var(--line-2); border-radius: 16px; background:#fff; color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}
.dict-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb,var(--accent) 16%, transparent); }
.dict-input.shake { animation: shake .42s; border-color: var(--coral); }
@keyframes shake { 0%,100%{transform:translateX(0)} 20%{transform:translateX(-8px)} 40%{transform:translateX(7px)} 60%{transform:translateX(-5px)} 80%{transform:translateX(4px)} }
.dict-actions { display: flex; gap: 12px; justify-content: flex-end; align-items: center; }

.dict-result { border-radius: var(--r-md); padding: 18px; border: 2px solid var(--line); background:#fff; animation: pop-in .3s var(--ease); }
.dict-result.is-great { border-color:#BBEAD4; background: linear-gradient(160deg,#F1FBF6,#fff); }
.dict-result.is-good { border-color:#FCE9A8; background: linear-gradient(160deg,#FFFAEC,#fff); }
.dict-result.is-bad { border-color:#FFD2C9; background: linear-gradient(160deg,#FFF4F1,#fff); }
.dict-result.is-reveal { border-color: var(--line-2); }
.res-head { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.res-face { font-size: 38px; animation: settle-in .35s var(--ease); }
@keyframes settle-in { from { opacity:.4; transform:scale(.92) } to { opacity:1; transform:scale(1) } }
.res-score b { font-family:"Quicksand"; font-size: 28px; }
.res-score small { display:block; color: var(--ink-soft); font-weight: 800; font-size: 13px; }
.res-words { line-height: 2.1; font-size: 18px; font-family:"Quicksand"; font-weight: 600; }
.wtok { padding: 2px 8px; border-radius: 8px; display: inline-block; }
.wtok.ok { background:#E1F7EC; color:#126B4B; }
.wtok.wrong { background:#FFE3DD; color: var(--coral-d); text-decoration: line-through wavy; }
.wtok.missing { background: #FFF1CF; color:#725300; border:1px dashed #B58300; }
.wtok.extra { background:#EEE; color:#625B6D; font-size: 14px; text-decoration: line-through; }
.res-mean { margin-top: 12px; color: var(--ink-soft); font-style: italic; font-weight: 600; }
.res-mean span { color: var(--accent); font-weight: 800; }

/* AI "explain my mistake" */
.res-explain { margin-top: 14px; }
.explain-btn { width: 100%; }
.explain-out {
  margin-top: 12px; padding: 14px 16px; border-radius: 14px;
  background: #FFF; border: 1.5px dashed var(--accent);
  color: var(--ink); font-weight: 600; line-height: 1.5; font-size: 15px;
  animation: explainIn .3s ease;
}
@keyframes explainIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* AI practice generator (home) */
.ai-practice-row {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  flex-wrap: wrap;
  background: #FFF; border: 1.5px solid var(--line, #ECE6E0);
  border-radius: 18px; padding: 16px 18px;
}
.ai-practice-sub { margin: 0; color: var(--ink-soft); font-weight: 600; flex: 1 1 240px; }
.ai-practice-sub b { color: var(--accent); }
.ai-gen-btn { flex: none; }
.ai-notice { width: 100%; color: var(--ink-soft); line-height: 1.45; font-weight: 700; }

/* loading state for buttons */
.is-loading { opacity: .75; cursor: progress; pointer-events: none; }

.reveal-row { display: flex; gap: 12px; padding: 6px 0; align-items: baseline; }
.rv-lbl { font-size: 12px; font-weight: 800; color: var(--ink-faint); text-transform: uppercase; width: 64px; flex:none; }
.rv-text { font-family:"Quicksand"; font-size: 19px; }
.rv-en { color: var(--ink-soft); font-style: italic; }

/* lesson complete */
.player--done { text-align: center; padding: 48px 30px 40px; }
.done-burst { font-size: 70px; animation: settle-in .4s var(--ease); }
.player--done h2 { font-size: 30px; margin: 12px 0 4px; }
.done-sub { color: var(--ink-soft); margin: 0 0 24px; }
.done-stats { display: flex; gap: 16px; justify-content: center; margin-bottom: 28px; }
.done-stats > div { background:#fff; border:1px solid var(--line); border-radius: var(--r-md); padding: 16px 20px; box-shadow: var(--shadow); }
.done-stats b { font-family:"Quicksand"; font-size: 24px; display:block; color: var(--ink); }
.done-stats small { color: var(--ink-faint); font-weight:800; font-size:12px; }

/* ============================================================
   FLASHCARDS
   ============================================================ */
.cards-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 8px; }
.lang-mini { display: flex; gap: 8px; }
.lm-btn { width: 46px; height: 46px; font-size: 22px; border-radius: 14px; border: 2px solid var(--line-2); background:#fff; transition:.15s; }
.lm-btn:hover { transform: translateY(-2px); }
.lm-btn.is-on { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb,var(--accent) 16%, transparent); }

.deck-wrap { max-width: 480px; margin: 24px auto 0; text-align: center; }
.deck-count { color: var(--ink-soft); font-weight: 800; font-size: 14px; margin-bottom: 14px; }
.deck-count b { color: var(--ink); }
.card-stage { perspective: 1400px; margin-bottom: 22px; }
.flashcard { position: relative; height: 300px; cursor: pointer; }
.flashcard:focus-visible { border-radius: var(--r-lg); }
.fc-inner { position: absolute; inset: 0; transform-style: preserve-3d; transition: transform .55s var(--ease); }
.flashcard.is-flipped .fc-inner { transform: rotateY(180deg); }
.fc-face {
  position: absolute; inset: 0; backface-visibility: hidden; border-radius: var(--r-lg);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  padding: 28px; box-shadow: var(--shadow-lg); border: 1px solid var(--line);
}
.fc-front { background: linear-gradient(160deg, #fff, #FFF6F2); }
.flashcard.known .fc-front { background: linear-gradient(160deg,#F2FBF7,#fff); border-color:#CDEEDE; }
.fc-back { background: linear-gradient(160deg, var(--accent), color-mix(in srgb,var(--accent) 82%, var(--ink))); color:#fff; transform: rotateY(180deg); }
.fc-flag { position:absolute; top:18px; left:20px; font-size:26px; }
.fc-tap, .fc-known { position:absolute; top:20px; right:20px; font-size: 11px; font-weight:800; color: var(--ink-faint); text-transform: uppercase; letter-spacing:.1em; }
.fc-known { color:#126B4B; background:#E1F7EC; padding:4px 10px; border-radius:999px; }
.fc-word { font-family:"Quicksand"; font-size: 40px; font-weight: 700; }
.fc-ipa { color: var(--ink-faint); font-size: 16px; }
.fc-speak { margin-top: 8px; width: 52px; height: 52px; border-radius: 50%; border:0; background: var(--sky); color:#fff; font-size: 22px; box-shadow: 0 8px 18px -6px var(--sky); transition: transform .15s; }
.fc-back .fc-speak { background: rgba(255,255,255,.25); }
.fc-speak:hover { transform: scale(1.08); }
.fc-en { font-family:"Quicksand"; font-size: 30px; font-weight:700; }
.fc-ex { font-size: 19px; font-weight: 700; font-family:"Quicksand"; }
.fc-exen { font-size: 14px; opacity: .82; font-style: italic; }
.deck-controls { display: flex; gap: 12px; justify-content: center; margin-bottom: 14px; }
.deck-nav { display: flex; gap: 8px; justify-content: center; }

/* ============================================================
   PROGRESS
   ============================================================ */
.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.stat-card { background: var(--card); border:1px solid var(--line); border-radius: var(--r-md); padding: 18px 20px; display: flex; align-items: center; gap: 14px; box-shadow: var(--shadow); }
.stat-ic { width: 50px; height: 50px; border-radius: 14px; display: grid; place-items: center; font-size: 24px; flex:none; }
.s-xp .stat-ic { background:#FFF6D9; } .s-streak .stat-ic{background:#FFE7D6} .s-words .stat-ic{background:#E4EEFF} .s-acc .stat-ic{background:#E1F7EC}
.stat-card b { font-family:"Quicksand"; font-size: 28px; display:block; line-height:1; }
.stat-card small { color: var(--ink-faint); font-weight: 800; font-size: 12px; }

.chart { width: 100%; }
.chart-svg { width: 100%; height: auto; }
.g-grid { stroke: var(--line); stroke-width: 1; }
.g-axis { fill: var(--ink-faint); font-size: 10px; font-weight: 800; text-anchor: end; }
.g-xaxis { fill: var(--ink-faint); font-size: 10px; font-weight: 800; text-anchor: middle; }
.g-line { fill: none; stroke: var(--accent); stroke-width: 3.4; stroke-linecap: round; stroke-linejoin: round; }
.g-dot { fill: #fff; stroke: var(--accent); stroke-width: 3; }
.g-empty { fill: var(--ink-faint); font-size: 13px; font-weight: 700; text-anchor: middle; }

.goal-mini-card { display: flex; flex-direction: column; }
.mastery { display: flex; flex-direction: column; gap: 16px; }
.mastery-row { display: grid; grid-template-columns: 24px 1fr 3fr auto; align-items: center; gap: 12px; }
.m-flag { font-size: 20px; }
.m-name { font-weight: 800; font-size: 14px; }
.m-bar { height: 12px; background: var(--line); border-radius: 999px; overflow: hidden; }
.m-bar span { display:block; height:100%; border-radius:999px; }
.m-val { font-weight: 800; color: var(--ink-soft); font-size: 13px; min-width: 36px; text-align: right; }
.reset-row { text-align: center; margin-top: 30px; }

/* ============================================================
   TOASTS + CONFETTI
   ============================================================ */
.toast-host { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.toast { background: var(--ink); color:#fff; font-weight: 800; font-size: 14px; padding: 12px 22px; border-radius: 999px; box-shadow: var(--shadow-lg); opacity:0; transform: translateY(16px); transition:.3s var(--ease); }
.toast.show { opacity:1; transform:none; }
.toast--ok { background: var(--mint); }
.toast--warn { background: var(--coral-d); }
.confetti { position: fixed; z-index: 250; border-radius: 2px; pointer-events: none; animation: confettiFall 1.2s ease-out forwards; }
@keyframes confettiFall { 0%{transform:translate(0,0) rotate(0);opacity:1} 100%{transform:translate(var(--dx),var(--dy)) rotate(var(--r));opacity:0} }

/* ============================================================
   TOPBAR MENU + HERO CTA
   ============================================================ */
.topbar-menu { display: none; }
.topbar-pop {
  position: absolute; right: 14px; top: 60px; z-index: 50;
  background: #fff; border: 1px solid var(--line); border-radius: var(--r-md);
  box-shadow: var(--shadow-lg); padding: 6px; min-width: 180px;
}
.pop-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  background: transparent; border: 0; text-align: left; text-decoration: none;
  color: var(--ink); font-weight: 700; font-size: 14px; padding: 11px 12px; border-radius: 12px;
}
.pop-item:hover { background: #FFF1EA; }
.hero-cta { margin-top: 18px; }

/* ============================================================
   ONBOARDING
   ============================================================ */
.ob-locked { overflow: hidden; }
.ob-overlay {
  position: fixed; inset: 0; z-index: 300; display: grid; place-items: center; padding: 18px;
  background: radial-gradient(1100px 700px at 110% -10%, #FFE0D2 0%, transparent 55%),
              radial-gradient(900px 600px at -10% 110%, #DCE8FF 0%, transparent 55%),
              rgba(42,36,56,.32);
  backdrop-filter: blur(10px);
  opacity: 0; transition: opacity .3s;
}
.ob-overlay.show { opacity: 1; }
.ob-card {
  width: min(540px, 100%); background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--shadow-lg); padding: 22px 26px 24px;
  transform: translateY(22px) scale(.97); transition: transform .34s var(--ease);
  display: flex; flex-direction: column; max-height: 94vh;
}
.ob-overlay.show .ob-card { transform: none; }
.ob-top { display: flex; align-items: center; justify-content: space-between; min-height: 36px; }
.ob-brand { font-family: "Quicksand"; font-weight: 700; font-size: 20px; color: var(--ink); }
.ob-brand span { color: var(--accent); }
.ob-back, .ob-skip {
  background: transparent; border: 0; font-weight: 800; font-size: 14px; color: var(--ink-faint);
  min-height: 44px; padding: 8px 10px; border-radius: 10px; transition: .15s;
}
.ob-back:hover, .ob-skip:hover { background: #FFF1EA; color: var(--ink); }
.ob-body { text-align: center; padding: 10px 4px 18px; overflow-y: auto; }
.ob-mascot { display: grid; place-items: center; margin: 6px 0 10px; }
.ob-step-ic { font-size: 52px; margin: 6px 0 6px; }
.ob-pop { animation: settle-in .4s var(--ease); }
.ob-title { font-size: clamp(22px, 4vw, 30px); margin: 6px 0 8px; line-height: 1.1; }
.ob-title span { color: var(--accent); }
.ob-sub { color: var(--ink-soft); font-size: 15px; margin: 0 auto 18px; max-width: 400px; line-height: 1.5; }
.ob-input {
  width: 100%; max-width: 320px; font-family: "Quicksand"; font-size: 20px; font-weight: 600;
  text-align: center; padding: 14px 18px; border: 2px solid var(--line-2); border-radius: 16px;
  background: #fff; color: var(--ink); margin-bottom: 6px;
}
.ob-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb,var(--accent) 16%, transparent); }

.ob-lang-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; max-width: 420px; margin: 0 auto; }
.ob-lang {
  display: flex; align-items: center; gap: 12px; background: #fff; border: 2px solid var(--line-2);
  border-radius: 18px; padding: 14px 16px; transition: .18s var(--ease); text-align: left;
}
.ob-lang:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.ob-lang.is-on { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb,var(--accent) 16%, transparent); }
.ob-lang-flag { font-size: 28px; }
.ob-lang-text { display: flex; flex-direction: column; line-height: 1.15; }
.ob-lang-text b { font-size: 15px; }
.ob-lang-text small { color: var(--ink-faint); font-weight: 700; font-size: 12px; }

.ob-level-grid { display: flex; flex-direction: column; gap: 10px; max-width: 340px; margin: 0 auto; }
.ob-level {
  background: #fff; border: 2px solid var(--line-2); border-radius: 16px; padding: 14px 18px;
  font-weight: 800; font-size: 15px; color: var(--ink); transition: .15s;
}
.ob-level:hover { border-color: var(--accent); }
.ob-level.is-on { background: var(--accent); color: #fff; border-color: var(--accent); }

.ob-goal-grid { display: flex; flex-direction: column; gap: 10px; max-width: 360px; margin: 0 auto; }
.ob-goal {
  display: flex; flex-direction: column; align-items: flex-start; gap: 3px; background: #fff;
  border: 2px solid var(--line-2); border-radius: 16px; padding: 14px 18px; transition: .15s; text-align: left;
}
.ob-goal b { font-family: "Quicksand"; font-size: 17px; }
.ob-goal span { color: var(--ink-soft); font-size: 13px; font-weight: 700; }
.ob-goal:hover { border-color: var(--accent); }
.ob-goal.is-on { border-color: var(--accent); background: linear-gradient(160deg, #FFF6F2, #fff); box-shadow: 0 0 0 4px color-mix(in srgb,var(--accent) 14%, transparent); }

.ob-summary { max-width: 340px; margin: 0 auto 4px; background: #FFF7F2; border: 1px solid var(--line); border-radius: var(--r-md); padding: 6px 18px; }
.ob-sum-row { display: flex; justify-content: space-between; align-items: center; padding: 11px 0; border-bottom: 1px solid var(--line); font-weight: 700; }
.ob-sum-row:last-child { border-bottom: 0; }
.ob-sum-row span { color: var(--ink-soft); font-size: 14px; }
.ob-sum-row b { font-family: "Quicksand"; font-size: 16px; }

.ob-actions { margin-top: 22px; display: flex; justify-content: center; }
.ob-dots { display: flex; gap: 7px; justify-content: center; padding-top: 6px; }
.ob-dot { width: 22px; height: 8px; border-radius: 999px; background: var(--line-2); transform: scaleX(.36); transition: transform .2s ease-out, background-color .2s ease-out; }
.ob-dot.is-done { background: color-mix(in srgb, var(--accent) 55%, #fff); }
.ob-dot.is-on { background: var(--accent); transform: scaleX(1); }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 920px) {
  .sidebar { display: none; }
  .main { margin-left: 0; padding: 18px 18px 96px; max-width: 100%; }
  .topbar {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 14px 18px; position: sticky; top: 0; z-index: 40;
    background: rgba(255,247,242,.9); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line);
  }
  .brand--mobile .brand-name { font-size: 20px; }
  .brand--mobile { padding: 0; }
  .topbar-stats { display: flex; gap: 8px; align-items: center; }
  .topbar-menu { display: inline-grid; place-items: center; }
  .ob-lang-grid { grid-template-columns: 1fr; }
  .mobnav {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 40;
    background: rgba(255,255,255,.94); backdrop-filter: blur(14px); border-top: 1px solid var(--line);
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  }
  .mobnav-item { flex: 1; min-height: 52px; background: transparent; border: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--ink-faint); font-weight: 800; padding: 6px; border-radius: 14px; }
  .mobnav-item span { font-size: 22px; filter: grayscale(.4); }
  .mobnav-item small { font-size: 11px; }
  .mobnav-item.is-active { color: var(--accent); background:#FFF1EA; }
  .mobnav-item.is-active span { filter:none; }
  .grid-two { grid-template-columns: 1fr; }
  .hero { grid-template-columns: 1fr; }
  .hero-mascot { display: none; }
  .stat-row { grid-template-columns: repeat(2, 1fr); }
  .goal-card { flex-direction: column; text-align: center; }
}
@media (max-width: 460px) {
  .lesson-grid { grid-template-columns: 1fr; }
  .done-stats { flex-wrap: wrap; }
  .player-body { padding: 18px; }
  .fc-word { font-size: 32px; }
  .deck-controls, .deck-nav { flex-wrap: wrap; }
  .deck-controls > button, .deck-nav > button { min-height: 44px; flex: 1 1 130px; }
  .dict-actions { flex-wrap: wrap; }
  .dict-actions > button { min-height: 44px; flex: 1 1 130px; }
  .cards-head { flex-direction: column; }
  .lang-mini { width: 100%; flex-wrap: wrap; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto !important; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .confetti { display: none !important; }
}

/* ===== Real-app additions (empty states, boot, milestones, AI topic) ===== */
.empty-ic { font-size: 44px; line-height: 1; margin-bottom: 10px; }
.empty h3 { margin: 4px 0 6px; color: var(--ink); font-family: var(--font-head); }
.empty p { max-width: 460px; margin: 0 auto; line-height: 1.5; }
.empty .btn-3d { margin-top: 16px; }
.cards-empty { margin-top: 22px; }
.lb-empty { padding: 18px 10px; color: var(--ink-faint); font-size: 14px; text-align: center; }

.boot-loading, .boot-error { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; min-height: 50vh; gap: 6px; color: var(--ink-faint); }
.boot-error h3 { color: var(--ink); font-family: var(--font-head); margin: 6px 0; }
.boot-error p { max-width: 440px; line-height: 1.5; }
.boot-error .btn-3d { margin-top: 16px; }

.ai-topic-input { width: 100%; max-width: 340px; padding: 10px 14px; border: 2px solid var(--line-2); border-radius: 14px; font: inherit; font-size: 14px; margin: 8px 0; background: #fff; color: var(--ink); }
.ai-topic-input:focus { outline: none; border-color: var(--accent); }

.toast--err { background: #C0392B; color: #fff; }

.explain-out.is-error { color: #B23A2E; background: #FDECEA; border: 1px solid #F5C6BE; border-radius: 12px; padding: 10px 12px; }
