/* =====================================================================
   Languru — web frontend
   A proper responsive website (not a phone mockup).
   ===================================================================== */

:root {
  --bg: #fbf6ee;
  --surface: #ffffff;
  --surface-2: #fdf9f2;
  --ink: #2c2115;
  --sub: #7a6c59;
  --line: #ece0d0;
  --font: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --brand-font: 'Gaegu', 'Comic Sans MS', cursive;

  --accent: #2fb060;
  --accent-2: #26934f;
  --accent-ink: #ffffff;
  --accent-soft: color-mix(in srgb, var(--accent) 12%, var(--surface));

  --r: 16px;
  --r-lg: 24px;
  --r-sm: 10px;
  --sh-sm: 0 1px 2px rgba(44,33,21,.06), 0 1px 3px rgba(44,33,21,.05);
  --sh: 0 4px 14px rgba(44,33,21,.08);
  --sh-lg: 0 18px 50px rgba(44,33,21,.16);
  --maxw: 1120px;
}
.acc-okker   { --accent: #c26a20; --accent-2: #a5571a; }
.acc-korall  { --accent: #ef5a38; --accent-2: #d8452a; }
.acc-indigo  { --accent: #5b4be0; --accent-2: #4a3bc7; }
.acc-zold    { --accent: #2fb060; --accent-2: #26934f; }
.acc-magenta { --accent: #e5157e; --accent-2: #c50f6a; }

/* ---- Dark mode ------------------------------------------------------ */
/* Warm dark palette. Applied automatically for system-dark users (unless they
   picked light), and whenever the user toggles data-theme="dark". Only the
   surface/ink/line tokens + shadows change; the accent colours carry over. */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #17130f;
  --surface: #221d17;
  --surface-2: #1b1712;
  --ink: #efe8dd;
  --sub: #a89d8c;
  --line: #35302a;
  --accent-soft: color-mix(in srgb, var(--accent) 24%, var(--surface));
  --sh-sm: 0 1px 2px rgba(0,0,0,.4), 0 1px 3px rgba(0,0,0,.3);
  --sh: 0 4px 14px rgba(0,0,0,.5);
  --sh-lg: 0 18px 50px rgba(0,0,0,.6);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #17130f;
    --surface: #221d17;
    --surface-2: #1b1712;
    --ink: #efe8dd;
    --sub: #a89d8c;
    --line: #35302a;
    --accent-soft: color-mix(in srgb, var(--accent) 24%, var(--surface));
    --sh-sm: 0 1px 2px rgba(0,0,0,.4), 0 1px 3px rgba(0,0,0,.3);
    --sh: 0 4px 14px rgba(0,0,0,.5);
    --sh-lg: 0 18px 50px rgba(0,0,0,.6);
  }
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.55;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: inherit; text-decoration: none; cursor: pointer; }
h1, h2, h3, h4 { line-height: 1.2; font-weight: 800; letter-spacing: -.01em; }

/* ---- Utilities ------------------------------------------------------ */
.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }
.muted { color: var(--sub); }
.center-text { text-align: center; }
.row { display: flex; gap: 12px; align-items: center; }
.spacer { flex: 1; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-2); font-weight: 600; font-size: 13px; }

/* ---- Buttons -------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--font); font-weight: 700; font-size: 16px;
  padding: 12px 22px; border-radius: 999px; border: none; cursor: pointer;
  background: var(--accent); color: var(--accent-ink);
  box-shadow: var(--sh-sm); transition: transform .08s, box-shadow .15s, background .15s;
}
.btn:hover { background: var(--accent-2); box-shadow: var(--sh); }
.btn:active { transform: translateY(1px); }
.btn.ghost { background: transparent; color: var(--ink); box-shadow: none; border: 1.5px solid var(--line); }
.btn.ghost:hover { background: var(--surface-2); border-color: var(--accent); color: var(--accent-2); }
.btn.lg { font-size: 18px; padding: 15px 30px; }
.btn.sm { font-size: 14px; padding: 9px 16px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .55; cursor: default; }

/* ---- Navbar --------------------------------------------------------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.nav-inner { position: relative; max-width: var(--maxw); margin: 0 auto; padding: 12px 24px; display: flex; align-items: center; gap: 20px; }
.logo { font-family: var(--brand-font); font-size: 30px; font-weight: 700; color: var(--ink); display: flex; align-items: center; gap: 6px; }
.logo .k { font-size: 26px; }
.nav-collapse { flex: 1; display: flex; align-items: center; gap: 20px; }
/* Center the group menus in the middle of the bar (logo left, user cluster right). */
.nav-links { display: flex; gap: 8px; position: absolute; left: 50%; transform: translateX(-50%); }
.nav-links a { padding: 8px 14px; border-radius: 999px; font-weight: 600; color: var(--sub); font-size: 15px; }
.nav-links a:hover { background: var(--surface-2); color: var(--ink); }
.nav-links a.active { color: var(--accent-2); background: var(--accent-soft); }
.nav-user { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.nav-user .email { font-size: 14px; color: var(--sub); max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-toggle { display: none; }
.nav-mobile { display: none; } /* desktop: hidden; mobile shows this flat list */

/* Grouped nav: top buttons + a full-width row that slides down under the header */
.nav-top { position: relative; z-index: 1; display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border: none; background: transparent; border-radius: 999px; font-weight: 700; font-size: 15px; color: var(--sub); cursor: pointer; font-family: var(--font); transition: color .18s; }
.nav-top:hover, .nav-top.open { color: var(--ink); }
.nav-top.active { color: var(--accent-2); }
.nav-top .chev { font-size: 11px; transition: transform .18s; opacity: .8; }
.nav-top.open .chev { transform: rotate(180deg); }
/* Sliding, frosted highlight box that glides between the top menu buttons. */
.nav-hl { position: absolute; z-index: 0; left: 0; top: 0; width: 0; height: 0; border-radius: 999px; background: color-mix(in srgb, var(--accent) 22%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 34%, transparent); opacity: 0; pointer-events: none; transition: left .24s cubic-bezier(.4,.15,.2,1), top .24s, width .24s, height .24s, opacity .18s; }
/* Overlay row: sits UNDER the header without pushing the page; slides in smoothly. */
.nav-sub {
  position: absolute; top: calc(100% + 6px); left: 50%; transform: translateX(-50%) translateY(-10px);
  width: min(680px, calc(100% - 32px)); z-index: 40;
  background: color-mix(in srgb, var(--surface) 78%, transparent);
  backdrop-filter: saturate(1.6) blur(18px); -webkit-backdrop-filter: saturate(1.6) blur(18px);
  border: 1px solid color-mix(in srgb, var(--line) 60%, transparent);
  border-radius: 16px; box-shadow: 0 20px 44px rgba(0,0,0,.28); overflow: hidden;
  visibility: hidden; opacity: 0;
  transition: opacity .22s ease, transform .22s ease, visibility 0s linear .22s;
}
.nav-sub.open { visibility: visible; opacity: 1; transform: translateX(-50%) translateY(0); transition: opacity .22s ease, transform .22s ease, visibility 0s; }
.nav-sub-inner { position: relative; height: 58px; max-width: var(--maxw); margin: 0 auto; }
/* Panels overlap (absolute) so the old can slide out while the new slides in. */
.nav-sub-panel { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; flex-wrap: nowrap; gap: 28px; opacity: 0; pointer-events: none; }
.nav-sub-panel.show { opacity: 1; pointer-events: auto; }
/* the sliding highlight box behind the items */
.nav-sub-hl { position: absolute; z-index: 0; left: 0; top: 0; width: 0; height: 0; border-radius: 12px; background: color-mix(in srgb, var(--accent) 22%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 30%, transparent); opacity: 0; pointer-events: none; transition: left .24s cubic-bezier(.4,.15,.2,1), top .24s, width .24s, height .24s, opacity .18s; }
.sub-item { position: relative; z-index: 1; display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px; background: none; border: none; font-weight: 700; font-size: 15px; color: var(--sub); cursor: pointer; transition: color .18s; }
.sub-item:hover, .sub-item.active { color: var(--accent-2); }
.sub-item.danger, .sub-item.danger:hover { color: #cf3a34; }
.si-ic { font-size: 18px; }
@media (prefers-reduced-motion: reduce) { .nav-sub { transition: none; transform: none; } }
/* On mobile the overlay would clash with the hamburger panel — use plain show/hide. */
@media (max-width: 900px) {
  .nav-sub { position: static; visibility: visible; opacity: 1; transform: none; box-shadow: none; display: none; transition: none; }
  .nav-sub.open { display: block; }
  .nav-sub-inner { height: auto; padding: 8px 20px; }
  .nav-sub-panel { position: static; inset: auto; display: none; opacity: 1; pointer-events: auto; flex-direction: column; align-items: flex-start; gap: 12px; }
  .nav-sub-panel.show { display: flex; }
}

/* ---- Main / sections ------------------------------------------------ */
main { flex: 1; }
.section { padding: 56px 0; }
.section.tight { padding: 36px 0; }

/* ---- Hero (landing) ------------------------------------------------- */
.hero { padding: 72px 0 56px; }
.hero-grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: 48px; align-items: center; }
.hero h1 { font-size: 52px; margin: 16px 0 18px; }
.hero h1 .hl { color: var(--accent-2); }
.hero p.lead { font-size: 20px; color: var(--sub); margin-bottom: 28px; max-width: 34ch; }
.hero-cta { display: flex; gap: 14px; flex-wrap: wrap; }
.hero-art {
  background: radial-gradient(120% 120% at 70% 20%, var(--accent-soft), var(--surface));
  border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--sh);
  padding: 32px; min-height: 340px; display: flex; flex-direction: column; justify-content: center;
}
.hero-art .kanga { font-size: 96px; text-align: center; }
.chat-demo { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.bubble { max-width: 86%; padding: 11px 15px; border-radius: 16px; font-size: 15px; box-shadow: var(--sh-sm); }
.bubble.t { align-self: flex-start; background: var(--surface); border: 1px solid var(--line); }
.bubble.m { align-self: flex-end; background: var(--accent); color: var(--accent-ink); }

/* ---- Feature cards -------------------------------------------------- */
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  box-shadow: var(--sh-sm); padding: 24px;
}
.card.pad-lg { padding: 32px; }
.feature .ic { font-size: 34px; margin-bottom: 10px; }
.feature h3 { font-size: 19px; margin-bottom: 6px; }
.feature p { color: var(--sub); font-size: 15px; }
.section h2.title { font-size: 34px; text-align: center; margin-bottom: 8px; }
.section p.subtitle { text-align: center; color: var(--sub); font-size: 17px; margin-bottom: 36px; }

/* ---- Auth ----------------------------------------------------------- */
.auth-wrap { display: flex; justify-content: center; align-items: flex-start; padding: 56px 24px; }
.auth-card { width: 100%; max-width: 400px; padding: 34px 32px 30px; }
.auth-card h2 { font-size: 28px; margin-bottom: 4px; }
/* circular illustrated avatar (Léo) at the top of the login card */
.auth-avatar {
  position: relative; width: 148px; height: 148px; margin: 6px auto 26px; border-radius: 50%;
  background: radial-gradient(circle at 50% 42%, color-mix(in srgb, var(--accent) 16%, var(--surface)), var(--accent-soft));
  box-shadow: inset 0 0 0 7px color-mix(in srgb, var(--accent) 14%, var(--surface));
  overflow: hidden;
}
/* Interactive login mascot (Léo) */
.leo { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.leo .head { fill: url(#leoFur); }
.leo .fur2, .leo .arm { fill: #c0854f; }
.leo .paw { fill: url(#leoPaw); }
.leo .ear-in { fill: #e9a7a0; }
.leo .cheek { fill: #e2957c; opacity: .45; }
.leo .muzzle { fill: #f7e6cd; }
.leo .sclera { fill: #fff; }
.leo .pupil { fill: #2f1f13; }
.leo .glint { fill: #fff; }
.leo .glint.sm { opacity: .8; }
.leo .brow { fill: none; stroke: #96602f; stroke-width: 6; stroke-linecap: round; }
.leo .nose { fill: #43291b; }
.leo .mouth { fill: none; stroke: #5c3c24; stroke-width: 5; stroke-linecap: round; }
.leo .fingers path { fill: none; stroke: #90592c; stroke-width: 3.4; stroke-linecap: round; opacity: .55; }
.leo .lid { fill: #ca8d57; transform-box: fill-box; transform-origin: top; transform: scaleY(0); animation: leoBlink 5.5s infinite; }
@keyframes leoBlink { 0%, 93%, 100% { transform: scaleY(0); } 96% { transform: scaleY(1); } }
/* email: pupils track the caret and look slightly down toward the field */
.leo .pupil, .leo .glint { transition: transform .16s ease; }
.leo.is-email .pupil, .leo.is-email .glint { transform: translate(var(--px, 0px), 5px); }
/* password: paws rise from below to cover the eyes; blinking pauses */
.leo .leo-arm { transform: translateY(150px); transition: transform .32s cubic-bezier(.34, 1.4, .5, 1); }
.leo.is-pw .leo-arm { transform: translateY(0); }
.leo.is-pw .lid { animation: none; transform: scaleY(0); }
.auth-card .field { margin-bottom: 18px; }
.auth-card .field label { font-size: 14px; font-weight: 700; color: var(--ink); letter-spacing: .01em; }
.auth-card .field input { padding: 13px 15px; }
.auth-card .btn.block { margin-top: 6px; padding: 14px; font-size: 17px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--sub); font-weight: 600; margin-bottom: 6px; }
.field input {
  width: 100%; font-family: var(--font); font-size: 16px; color: var(--ink);
  padding: 12px 14px; border: 1.5px solid var(--line); border-radius: var(--r-sm); background: var(--surface-2);
}
.field input:focus { outline: none; border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 3px var(--accent-soft); }
.err { color: #cf3a34; font-size: 14px; min-height: 20px; margin-bottom: 8px; }
select.sel-input, .field select {
  width: 100%; font-family: var(--font); font-size: 16px; color: var(--ink);
  padding: 11px 14px; border: 1.5px solid var(--line); border-radius: var(--r-sm); background: var(--surface-2); cursor: pointer;
}
select.sel-input:focus, .field select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.dev-kv { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.dev-kv:last-child { border-bottom: none; }
.link { color: var(--accent-2); font-weight: 600; cursor: pointer; }
.link:hover { text-decoration: underline; }

/* ---- Dashboard ------------------------------------------------------ */
.dash { display: grid; grid-template-columns: 1fr 300px; gap: 28px; align-items: start; }
.page-head { margin-bottom: 24px; }
.page-head h1 { font-size: 32px; }
.page-head p { color: var(--sub); }

.lesson-list { display: flex; flex-direction: column; gap: 14px; }

/* ---- Modules overview (big CEFR-level cards, stacked) ---- */
.mod-list { display: flex; flex-direction: column; gap: 14px; }
.modcard { display: flex; align-items: center; justify-content: space-between; gap: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 20px 22px; cursor: pointer; transition: transform .12s, box-shadow .15s, border-color .15s; }
.modcard:hover { transform: translateY(-2px); box-shadow: var(--sh); border-color: var(--accent); }
.modcard.current { border-color: var(--accent); box-shadow: 0 8px 26px rgba(0,0,0,.12); }
.modcard.done { background: var(--accent-soft); }
.modcard.locked { opacity: .62; }
.modcard-title { font-size: 24px; font-weight: 900; display: flex; align-items: baseline; gap: 10px; }
.modcard-name { font-size: 14px; font-weight: 600; color: var(--muted); }
.mod-done { color: var(--accent-2); font-weight: 800; margin-top: 8px; display: flex; align-items: center; gap: 6px; }
.mod-prog { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.mod-prog .mini-bar.big { height: 12px; width: 220px; max-width: 46vw; }
.mod-pct { font-weight: 800; font-size: 13px; color: var(--muted); }
.mod-locked { color: var(--muted); margin-top: 8px; }
.modcard-side { flex: none; }

/* ---- Lesson pathway (Duolingo-style winding path) ---- */
.path-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.path-title { display: flex; align-items: center; gap: 10px; font-size: 18px; }
.path { position: relative; max-width: 460px; margin: 0 auto; padding: 8px 0 50px; }
.path-row { display: flex; flex-direction: column; align-items: center; margin: 14px 0; transition: transform .2s; }
.path-node { position: relative; width: 74px; height: 74px; border-radius: 50%; border: none; font-size: 26px; font-weight: 900; cursor: pointer; display: grid; place-items: center; color: #fff; box-shadow: 0 6px 0 rgba(0,0,0,.18); transition: transform .1s, filter .15s; }
.path-node:hover { filter: brightness(1.06); }
.path-node:active { transform: translateY(3px); box-shadow: 0 3px 0 rgba(0,0,0,.18); }
.path-node.done { background: var(--accent); }
.path-node.open { background: var(--accent-2); box-shadow: 0 6px 0 color-mix(in srgb, var(--accent-2) 60%, #000), 0 0 0 6px var(--accent-soft); }
.path-node.soon { background: var(--surface-2); color: var(--muted); box-shadow: 0 6px 0 rgba(0,0,0,.08); cursor: not-allowed; }
.path-label { font-size: 12px; color: var(--sub); margin-top: 7px; max-width: 150px; text-align: center; line-height: 1.25; }
/* "START / CONTINUE" cue above the current lesson node (shown even w/ reduced motion). */
.path-cue { position: relative; border: none; cursor: pointer; background: var(--accent-2); color: #fff; font-weight: 900; font-size: 12px; letter-spacing: .04em; text-transform: uppercase; padding: 9px 18px; border-radius: 12px; margin-bottom: 12px; box-shadow: 0 4px 0 color-mix(in srgb, var(--accent-2) 55%, #000); transition: filter .15s, transform .08s, box-shadow .08s; }
.path-cue::after { content: ''; position: absolute; left: 50%; bottom: -6px; transform: translateX(-50%); border: 6px solid transparent; border-top-color: var(--accent-2); }
.path-cue:hover { filter: brightness(1.07); }
.path-cue:active { transform: translateY(3px); box-shadow: 0 1px 0 color-mix(in srgb, var(--accent-2) 55%, #000); }
/* Locked node: a bit darker, faint warm/orange tint that fits the theme. */
.path-node.soon { cursor: not-allowed; background: color-mix(in srgb, #e0872b 22%, var(--surface-2)); color: color-mix(in srgb, #9c5a15 65%, var(--muted)); box-shadow: 0 6px 0 color-mix(in srgb, #b06a20 22%, rgba(0,0,0,.12)); }
/* Topic separator: a title flanked by lines across the path (clear section break). */
.path-sep { display: flex; align-items: center; gap: 16px; margin: 40px 2px 18px; }
.path-sep-line { flex: 1; height: 2px; border-radius: 2px; background: var(--line); }
.path-sep-title { font-weight: 800; color: var(--muted); font-size: 15px; letter-spacing: .01em; text-align: center; }

/* Level / unit grouping */
.level { margin-bottom: 10px; }
.level-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 22px 0 12px; }
.level-badge { display: inline-flex; align-items: center; font-weight: 800; font-size: 15px; letter-spacing: .04em; color: var(--accent-ink); background: var(--accent); padding: 5px 14px; border-radius: 999px; }
.level:first-child .level-head { margin-top: 0; }
.unit { margin-bottom: 16px; }
.unit-title { font-weight: 700; font-size: 15px; color: var(--sub); text-transform: uppercase; letter-spacing: .04em; margin: 0 0 8px 4px; }
.unit .lesson { margin-bottom: 10px; }
.mini-bar { height: 5px; background: var(--line); border-radius: 999px; overflow: hidden; margin-top: 8px; max-width: 220px; }
.mini-bar > i { display: block; height: 100%; background: var(--accent); border-radius: 999px; transition: width .3s; }
.lesson {
  display: flex; align-items: center; gap: 18px; padding: 18px 20px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--sh-sm);
  transition: transform .08s, box-shadow .15s, border-color .15s;
}
.lesson.clickable { cursor: pointer; }
.lesson.clickable:hover { transform: translateY(-2px); box-shadow: var(--sh); border-color: var(--accent); }
.lesson.soon { opacity: .6; }
.lesson.open { border-color: var(--accent); }
.lesson .num {
  width: 48px; height: 48px; flex: none; border-radius: 14px; display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 20px; background: var(--accent-soft); color: var(--accent-2);
}
.lesson.done .num { background: var(--accent); color: var(--accent-ink); }
.lesson .meta { flex: 1; }
.lesson .meta b { font-size: 18px; }
.lesson .meta span { display: block; color: var(--sub); font-size: 14px; }
.lesson .cta { font-weight: 700; color: var(--accent-2); white-space: nowrap; }

.side .card + .card { margin-top: 16px; }
.stat { display: flex; align-items: center; gap: 14px; }
.stat .big { font-size: 34px; font-weight: 800; color: var(--accent-2); }
.progress-bar { height: 10px; background: var(--line); border-radius: 999px; overflow: hidden; margin-top: 10px; }
.progress-bar > i { display: block; height: 100%; background: var(--accent); border-radius: 999px; transition: width .4s; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.tag { font-size: 13px; padding: 5px 11px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); font-weight: 600; }

/* ---- Lesson (chat) page -------------------------------------------- */
.lesson-page { max-width: 760px; margin: 0 auto; }
.lesson-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.thread { display: flex; flex-direction: column; gap: 12px; padding: 8px 0 4px; min-height: 300px; }
.msg { max-width: 78%; padding: 13px 17px; border-radius: 18px; font-size: 16px; box-shadow: var(--sh-sm); }
.msg.tutor { align-self: flex-start; background: var(--surface); border: 1px solid var(--line); border-bottom-left-radius: 6px; }
.msg.me { align-self: flex-end; background: var(--accent); color: var(--accent-ink); border-bottom-right-radius: 6px; }
.msg.block { align-self: center; text-align: center; background: var(--accent-soft); border: 1px dashed var(--accent); }
.msg.block b { display: block; font-size: 22px; color: var(--accent-2); }
.msg.block span { font-size: 14px; color: var(--sub); }
.awaiting { align-self: flex-start; color: var(--sub); font-style: italic; font-size: 14px; }
.composer { position: sticky; bottom: 0; background: var(--bg); padding: 14px 0 20px; margin-top: 8px; }
.composer .inrow { display: flex; gap: 10px; }
.composer input { flex: 1; font-size: 16px; padding: 14px 16px; border: 1.5px solid var(--line); border-radius: 999px; background: var(--surface); }
.composer input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.composer .chips { margin-bottom: 10px; }
.composer .chip { cursor: pointer; }
.composer .chip:hover { border-color: var(--accent); color: var(--accent-2); }

/* ---- Blocks --------------------------------------------------------- */
/* Vocab study */
.flash-progress { display: flex; align-items: center; justify-content: space-between; color: var(--sub); font-size: 14px; margin-bottom: 12px; }
.kh-wrap { display: flex; flex-direction: column; align-items: center; gap: 8px; margin: -4px 0 12px; }
.kh-toggle { border: 1px solid var(--line); background: var(--surface); color: var(--sub); font-size: 12px; font-weight: 600; padding: 4px 12px; border-radius: 999px; cursor: pointer; transition: border-color .15s, color .15s; }
.kh-toggle:hover, .kh-toggle.on { border-color: var(--accent); color: var(--accent-2); }
.kh-legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 16px; padding: 10px 14px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--sh-sm); }
.kh-row { display: inline-flex; align-items: center; gap: 7px; color: var(--sub); font-size: 13px; }
.kh-row kbd { font-family: inherit; font-size: 11px; font-weight: 700; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 6px; padding: 2px 7px; min-width: 16px; text-align: center; }
.stage-chip { background: var(--accent-soft); color: var(--accent-2); font-weight: 700; font-size: 12px; padding: 3px 10px; border-radius: 999px; }
.stage-dots { display: inline-flex; gap: 5px; }
.stage-dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--line); }
.stage-dots i.on { background: var(--accent); }

.vimg { width: 100%; border-radius: var(--r); overflow: hidden; background: var(--surface-2); border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; }
.vimg img { width: 100%; height: 100%; object-fit: cover; }
.vimg.placeholder { font-size: 44px; color: var(--sub); }
.vtip { margin-top: 8px; background: var(--surface-2); border: 1px dashed var(--accent); border-radius: var(--r-sm); padding: 10px 12px; font-size: 14px; color: var(--ink); }

.flashcard {
  background: var(--surface); border: 2px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--sh);
  min-height: 260px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; padding: 24px; cursor: pointer; text-align: center;
  animation: flipIn .28s ease;
}
@keyframes flipIn { from { transform: perspective(700px) rotateY(-90deg); opacity: 0; } to { transform: none; opacity: 1; } }
.flashcard:hover { border-color: var(--accent); }
.flashcard.flipped { background: var(--accent-soft); border-color: var(--accent); }
.flash-word { font-size: 38px; font-weight: 800; color: var(--ink); }
.flash-hu { font-size: 24px; color: var(--accent-2); font-weight: 700; }
.flash-ex { font-size: 16px; color: var(--sub); font-style: italic; }
.flash-ex-hu { font-size: 14px; color: var(--sub); font-style: normal; opacity: .85; margin-top: 2px; }

.ex-card { background: var(--surface); border: 2px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--sh); padding: 22px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; animation: flipIn .28s ease; }
.ex-card.ok { border-color: var(--accent); background: var(--accent-soft); }
.ex-card.bad { border-color: #e0a; background: color-mix(in srgb, #cf3a34 8%, var(--surface)); }
.ex-q { font-size: 14px; color: var(--sub); font-weight: 600; margin-top: 6px; }
.ex-prompt { font-size: 24px; font-weight: 800; color: var(--ink); }
.ex-card input, .composer input#v-in { }
#v-in { flex: 1; font-size: 18px; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: var(--r-sm); background: var(--surface-2); text-align: center; }
#v-in:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.hint-mask { font-family: ui-monospace, monospace; font-size: 24px; letter-spacing: 3px; color: var(--accent-2); margin-top: 6px; }
.opt-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%; margin-top: 8px; }
.opt-btn { font-family: var(--font); font-size: 16px; font-weight: 600; padding: 14px; border: 1.5px solid var(--line); border-radius: var(--r-sm); background: var(--surface-2); cursor: pointer; color: var(--ink); }
.opt-btn:hover { border-color: var(--accent); background: var(--accent-soft); }

.block-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.block-card { display: flex; align-items: center; gap: 12px; padding: 16px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--sh-sm); }
.block-card b { font-size: 19px; }
.block-card span { display: block; color: var(--sub); font-size: 14px; }
.speak { margin-left: auto; border: none; background: var(--surface-2); border-radius: 10px; padding: 8px; font-size: 18px; cursor: pointer; }
.speak:hover { background: var(--accent-soft); }

/* ---- Settings ------------------------------------------------------- */
.opt { display: flex; align-items: center; gap: 16px; padding: 16px; border: 1.5px solid var(--line); border-radius: var(--r); background: var(--surface); cursor: pointer; margin-bottom: 12px; }
.opt.sel { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.opt .swatch { width: 46px; height: 46px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 22px; background: var(--surface-2); border: 1px solid var(--line); }
.accent-row { display: flex; gap: 16px; }
.accent-dot { width: 46px; height: 46px; border-radius: 50%; cursor: pointer; border: 3px solid transparent; box-shadow: var(--sh-sm); }
.accent-dot.sel { border-color: var(--ink); }

/* Language selection chips (profile: UI / known / target languages) */
.lang-row { display: flex; flex-wrap: wrap; gap: 10px; }
.lang-chip { font-size: 15px; font-weight: 600; padding: 9px 15px; border-radius: 999px; background: var(--surface-2); border: 2px solid var(--line); color: var(--ink); cursor: pointer; transition: border-color .12s, background .12s; }
.lang-chip:hover:not(.disabled) { border-color: var(--accent); }
.lang-chip.sel { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-2); font-weight: 700; }
.lang-chip.disabled { opacity: .5; cursor: default; }

/* Vocab sub-tabs (Learn / Words) */
.subtabs { display: flex; gap: 6px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; padding: 4px; margin: 0 auto 18px; max-width: 560px; }
.subtab { flex: 1; padding: 9px 12px; border-radius: 999px; font-weight: 700; font-size: 15px; color: var(--sub); background: transparent; border: none; cursor: pointer; transition: background .12s, color .12s; }
.subtab.sel { background: var(--accent); color: var(--accent-ink); }

/* Words browser: level chips + word list */
.lvl-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-bottom: 16px; }
.lvl-chip { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 84px; padding: 8px 12px; border-radius: 14px; background: var(--surface-2); border: 2px solid var(--line); cursor: pointer; transition: border-color .12s; }
.lvl-chip:hover { border-color: var(--accent); }
.lvl-chip.sel { border-color: var(--accent); background: var(--accent-soft); }
.lvl-chip b { font-size: 16px; }
.lvl-chip span { font-size: 11px; color: var(--sub); }
/* Word search box */
.search-box { display: flex; align-items: center; gap: 8px; background: var(--surface-2); border: 1.5px solid var(--line); border-radius: 999px; padding: 4px 8px 4px 16px; margin: 0 auto 16px; max-width: 560px; transition: border-color .12s; }
.search-box:focus-within { border-color: var(--accent); }
.search-box .search-ic { opacity: .55; font-size: 15px; }
.search-box input { flex: 1; border: none; background: transparent; outline: none; padding: 10px 4px; font-size: 16px; color: var(--ink); }
.search-clear { border: none; background: var(--surface); color: var(--sub); width: 30px; height: 30px; border-radius: 50%; cursor: pointer; font-size: 14px; line-height: 1; flex: 0 0 auto; }
.search-clear:hover { color: var(--ink); }

/* Level divider between grouped search results (line with the level centered) */
.lvl-divider { display: flex; align-items: center; gap: 12px; margin: 20px 0 12px; }
.lvl-divider::before, .lvl-divider::after { content: ''; flex: 1; height: 2px; background: var(--line); border-radius: 2px; }
.lvl-divider span { font-weight: 800; font-size: 15px; letter-spacing: .06em; color: var(--sub); }

/* Status legend + colored word tiles (green=learned, blue=learning, purple=new) */
.wt-legend { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-bottom: 12px; font-size: 12px; color: var(--sub); }
.wt-legend span { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.wt-legend i { flex: none; }
.wt-legend i { width: 12px; height: 12px; border-radius: 4px; display: inline-block; }
.wt-legend i.known { background: linear-gradient(135deg, #2f9e5f, #46b23f); }
.wt-legend i.learning { background: linear-gradient(135deg, #2b6fe0, #24a3d4); }
.wt-legend i.new { background: linear-gradient(135deg, #8e2fd0, #c21f8a); }

.word-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
/* Keyboard shortcuts are desktop-only — hide the helper on touch phones. */
@media (max-width: 700px) { .kh-wrap { display: none; } }
/* Phones: smaller tiles, 3-4 per row as they fit. */
@media (max-width: 700px) {
  .word-grid { grid-template-columns: repeat(auto-fill, minmax(102px, 1fr)); gap: 8px; }
  .word-tile { min-height: 72px; padding: 10px 6px; border-radius: 12px; }
  .word-tile .wt-es { font-size: 14px; }
  .word-tile .wt-hu { font-size: 10px; }
}
.word-tile {
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  min-height: 96px; padding: 16px 10px; border-radius: 14px; border: none; cursor: pointer;
  color: #fff; text-align: center; box-shadow: var(--sh-sm); transition: transform .1s, filter .12s;
}
.word-tile:hover { transform: translateY(-2px); filter: brightness(1.06); }
.word-tile:active { transform: translateY(0); }
/* image behind the tile, revealed through a translucent status tint */
.word-tile .wt-bg { position: absolute; inset: 0; z-index: 0; background-size: cover; background-position: center 30%; transition: filter .2s; }
/* Only NOT-STARTED words (never touched) and higher-level locked words show a
   hazier picture. Words in progress (new/learning) and learned words stay sharp,
   as before. The slight scale hides the soft blurred edges. */
.word-tile.untouched .wt-bg,
.word-tile.locked .wt-bg { filter: blur(2.5px); transform: scale(1.08); }
.word-tile .wt-text { position: relative; z-index: 2; display: flex; flex-direction: column; align-items: center; gap: 3px; }
.word-tile.has-img .wt-text { text-shadow: 0 1px 8px rgba(0,0,0,.8), 0 0 3px rgba(0,0,0,.65); }
.word-tile .wt-es { font-weight: 800; font-size: 17px; letter-spacing: .01em; }
.word-tile .wt-hu { font-size: 12px; font-weight: 600; opacity: .9; }
.word-tile.new { background: linear-gradient(135deg, #8e2fd0, #c21f8a); }
.word-tile.learning { background: linear-gradient(135deg, #2b6fe0, #24a3d4); }
.word-tile.known { background: linear-gradient(135deg, #2f9e5f, #46b23f); }
.word-tile.untouched { background: linear-gradient(135deg, #767f8b, #9aa2ad); }
.word-tile.locked { background: linear-gradient(135deg, #2a2e35, #3b414a); color: #aeb6c0; }
/* when a tile has an image, the colored gradient becomes a translucent overlay */
.word-tile.has-img::after { content: ''; position: absolute; inset: 0; z-index: 1; opacity: .58; }
.word-tile.has-img.new::after { background: linear-gradient(135deg, #8e2fd0, #c21f8a); }
.word-tile.has-img.learning::after { background: linear-gradient(135deg, #2b6fe0, #24a3d4); }
.word-tile.has-img.known::after { background: linear-gradient(135deg, #2f9e5f, #46b23f); }
.word-tile.has-img.untouched::after { background: linear-gradient(135deg, #767f8b, #9aa2ad); }
.word-tile.has-img.locked::after { background: linear-gradient(135deg, #2a2e35, #3b414a); opacity: .72; }
.wt-legend i.untouched { background: linear-gradient(135deg, #767f8b, #9aa2ad); }
.wt-legend i.locked { background: linear-gradient(135deg, #2a2e35, #3b414a); }
.wt-legend i.in-learn { background: linear-gradient(135deg, #e6a417, #f2c744); }

/* In-learn: yellow, not clickable, meaning blurred (anti-cheat). */
.word-tile.in-learn { background: linear-gradient(135deg, #e6a417, #f2c744); color: #3a2c00; cursor: default; }
.word-tile.has-img.in-learn::after { background: linear-gradient(135deg, #e6a417, #f2c744); }
.word-tile.in-learn:hover { transform: none; filter: none; box-shadow: none; }
.word-tile.in-learn .wt-hu.blur { filter: blur(5px); opacity: .85; user-select: none; }
.lvl-chip.locked { opacity: .55; }

/* Phase counters (x/4) on the study card */
.stage-chip.phase-new { color: #b5179e; }
.stage-chip.phase-learning { color: #2b6fe0; }
.stage-chip.phase-known { color: #2f9e5f; }
.phase-pill { display: inline-block; margin-top: 8px; padding: 4px 14px; border-radius: 999px; font-weight: 800; font-size: 14px; color: #fff; }
.phase-pill.phase-new { background: linear-gradient(135deg, #8e2fd0, #c21f8a); }
.phase-pill.phase-learning { background: linear-gradient(135deg, #2b6fe0, #24a3d4); }
.phase-pill.phase-known { background: linear-gradient(135deg, #2f9e5f, #46b23f); }

/* Word preview overlay */
.peek-overlay { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; padding: 20px; background: rgba(0, 0, 0, .5); }
.peek-card { width: 100%; max-width: 480px; max-height: 96vh; display: flex; flex-direction: column; overflow: hidden; overscroll-behavior: contain; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 20px; text-align: center; box-shadow: var(--sh-lg, 0 20px 60px rgba(0,0,0,.35)); }
/* The image takes the leftover height and scales down to fit — full picture, no crop, no page scroll */
.peek-img { flex: 1 1 auto; min-height: 0; width: 100%; border-radius: 16px; overflow: hidden; margin-bottom: 14px; background: var(--surface-2); border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; }
.peek-img img { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; display: block; }
.peek-img.placeholder { min-height: 160px; font-size: 54px; color: var(--sub); }

/* Immersive study card (full-bleed image hero + panel) */
.vcard { border-radius: 22px; overflow: hidden; box-shadow: 0 10px 30px rgba(0,0,0,.16); background: var(--surface); border: 1px solid var(--line); }
.vcard[data-action="vocab-flip"] { cursor: pointer; }
.vhero { position: relative; min-height: 300px; display: flex; align-items: center; justify-content: center; overflow: hidden; background: #1c2230; }
.vhero.noimg { background: linear-gradient(135deg, #2b3346, #3a445c); }
.vhero-bg { position: absolute; inset: 0; background-size: cover; background-position: center; }
.vhero-ov { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(10,14,22,.30) 0%, rgba(10,14,22,.5) 55%, rgba(10,14,22,.82) 100%); }
.vhero-top { position: absolute; top: 14px; right: 14px; z-index: 2; }
.vhero-center { position: relative; z-index: 2; text-align: center; color: #fff; padding: 24px; width: 100%; }
.vhero-word { font-size: 38px; font-weight: 900; letter-spacing: .01em; text-shadow: 0 2px 14px rgba(0,0,0,.55); word-break: break-word; }
.vhero-pron { margin-top: 8px; font-size: 16px; font-weight: 700; opacity: .95; letter-spacing: .03em; }
.vhero-pos { margin-top: 6px; font-size: 14px; font-style: italic; opacity: .85; }
.vhero-prompt { font-size: 24px; font-weight: 800; line-height: 1.35; text-shadow: 0 2px 12px rgba(0,0,0,.55); }
/* Phones: shrink the image hero so the whole exercise card (image + question +
   options) fits on screen without scrolling — no scroll means nothing to "jump". */
@media (max-width: 700px) {
  .vhero { min-height: 168px; }
  .vhero-word { font-size: 30px; }
  .vhero-pron { font-size: 14px; margin-top: 6px; }
  .vhero-pos { margin-top: 4px; }
  .vhero-prompt { font-size: 20px; }
  .vpanel { padding: 14px; }
  .opt-grid { gap: 8px; }
}
.vhero-prompt.sm { font-size: 19px; font-weight: 700; }
.vspeak { background: rgba(255,255,255,.2); border: none; color: #fff; width: 34px; height: 34px; border-radius: 50%; cursor: pointer; font-size: 15px; vertical-align: middle; }
.vspeak.solo { margin-top: 12px; }
.vbadge { display: inline-block; padding: 6px 14px; border-radius: 999px; font-size: 12px; font-weight: 800; letter-spacing: .08em; color: #fff; background: rgba(0,0,0,.4); }
.vbadge.phase-new { background: linear-gradient(135deg, #8e2fd0, #c21f8a); }
.vbadge.phase-learning { background: linear-gradient(135deg, #2b6fe0, #24a3d4); }
.vbadge.phase-known { background: linear-gradient(135deg, #2f9e5f, #46b23f); }
.vpanel { padding: 20px; }
.flip-hint { font-style: italic; }
.vdef { font-size: 22px; font-weight: 800; color: var(--accent); text-align: center; margin-bottom: 12px; }
.vactions { display: flex; gap: 10px; }
.vactions .btn { flex: 1; }

/* Tell Me More sheet */
.details-sheet { width: 100%; max-width: 460px; max-height: 88vh; overflow-y: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 0 20px 20px; box-shadow: var(--sh-lg, 0 20px 60px rgba(0,0,0,.35)); }
.details-head { position: sticky; top: 0; background: var(--surface); display: flex; align-items: center; justify-content: space-between; padding: 16px 0 12px; border-bottom: 1px solid var(--line); margin-bottom: 4px; z-index: 1; }
.details-head b { font-size: 22px; }
.dsec { margin-top: 18px; }
.dsec-h { font-weight: 800; font-size: 12px; letter-spacing: .07em; text-transform: uppercase; color: var(--sub); margin-bottom: 8px; }
.dtext { line-height: 1.55; color: var(--ink); margin: 0; }
.dlist { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.dlist li { font-style: italic; color: var(--ink); }
.rarity-label { font-weight: 800; margin-bottom: 8px; }
.rarity-bar { display: flex; gap: 6px; }
.rarity-bar i { flex: 1; height: 26px; border-radius: 7px; background: var(--surface-2); border: 1px solid var(--line); }
.rarity-bar i.on { background: linear-gradient(135deg, #2f9e5f, #46b23f); border-color: transparent; }

.empty { text-align: center; padding: 60px 20px; color: var(--sub); }
.empty .big { font-size: 56px; margin-bottom: 10px; }

/* ---- Footer --------------------------------------------------------- */
.footer { border-top: 1px solid var(--line); background: var(--surface-2); margin-top: 40px; }
.footer-inner { max-width: var(--maxw); margin: 0 auto; padding: 26px 24px; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.foot-brand { font-family: var(--brand-font); font-size: 24px; }
.foot-links { display: flex; align-items: center; gap: 18px; font-size: 14px; }
.foot-links a { color: var(--sub); font-weight: 600; }
.foot-links a:hover { color: var(--accent-2); }

/* ---- Dev panel (toggleable drawer) --------------------------------- */
.dev-toggle {
  position: fixed; right: 18px; bottom: 18px; z-index: 90;
  width: 46px; height: 46px; border-radius: 50%; border: none; cursor: pointer;
  background: #201812; color: #fff; font-size: 20px; box-shadow: var(--sh-lg);
}
.devpanel {
  position: fixed; right: 18px; bottom: 76px; z-index: 91;
  width: 380px; max-width: calc(100vw - 36px); max-height: 70vh;
  background: #14100b; color: #e7dccb; border-radius: 14px; border: 1px solid #3a2c1c;
  padding: 14px; font-family: ui-monospace, monospace; box-shadow: var(--sh-lg);
  display: flex; flex-direction: column;
}
.devpanel[hidden] { display: none; }
.dev-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.dev-clear { background: #2a2016; color: #e7dccb; border: 1px solid #4a3826; border-radius: 6px; padding: 3px 8px; cursor: pointer; font: inherit; font-size: 12px; margin-left: 6px; }
.dev-row { font-size: 12px; margin: 4px 0; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.dev-row code { background: #241a12; padding: 1px 6px; border-radius: 4px; word-break: break-all; }
.dev-dot { color: #d1373a; } .dev-dot.ok { color: #46c46a; }
.dev-actions button { background: #2a2016; color: #e7dccb; border: 1px solid #4a3826; border-radius: 6px; padding: 4px 8px; cursor: pointer; font: inherit; font-size: 12px; }
.dev-log { margin-top: 10px; overflow-y: auto; flex: 1; font-size: 11.5px; line-height: 1.5; }
.dev-entry { border-top: 1px solid #2a2016; padding: 6px 0; }
.dev-entry .m { color: #f0b34f; font-weight: 700; } .dev-entry .u { color: #8fd0ff; }
.dev-entry .s-ok { color: #46c46a; } .dev-entry .s-err { color: #ff8a80; }
.dev-entry pre { white-space: pre-wrap; word-break: break-all; color: #b7ab97; margin-top: 3px; max-height: 130px; overflow: auto; }

/* ---- Responsive ----------------------------------------------------- */
@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; gap: 28px; }
  .hero h1 { font-size: 40px; }
  .hero-art { min-height: 260px; }
  .dash { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
  .nav-collapse { display: none; }
  .nav-collapse.open {
    display: flex; flex-direction: column; align-items: stretch; gap: 12px;
    position: absolute; top: 100%; left: 0; right: 0;
    background: var(--bg); border-bottom: 1px solid var(--line); padding: 12px 20px;
    box-shadow: var(--sh);
    /* The menu can be taller than the screen — let it scroll so the last item
       (Log out) is always reachable. */
    max-height: calc(100dvh - 64px); overflow-y: auto; overscroll-behavior: contain;
  }
  .nav-collapse.open .nav-links { display: flex; flex-direction: column; margin-left: 0; gap: 4px; position: static; transform: none; }
  .nav-collapse.open .nav-user { flex-direction: column; align-items: stretch; margin-left: 0; gap: 8px; }
  .nav-toggle { display: inline-flex; margin-left: auto; }
  /* Mobile menu: hide the desktop group buttons + slide-down dropdown, and show
     a single simple flat list that is easy to tap. */
  .nav-collapse.open .nav-links:has(.nav-top) { display: none; }   /* authed group row (unauthed link stays) */
  .nav-sub { display: none !important; }
  .nav-collapse.open .nav-mobile { display: flex; flex-direction: column; gap: 2px; }
  .nav-mobile .m-group { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 12px 8px 4px; }
  .nav-mobile .m-item { display: flex; align-items: center; gap: 12px; padding: 13px 10px; border-radius: 12px; color: var(--ink); font-weight: 600; font-size: 16px; }
  .nav-mobile .m-item .si-ic { font-size: 20px; width: 26px; text-align: center; flex: none; }
  .nav-mobile .m-item.active { background: var(--accent-soft); color: var(--accent-2); }
  .nav-mobile .m-item:active { background: var(--surface-2); }
  .nav-mobile .m-item.danger { color: #cf3a34; }
  .nav-mobile .m-item .nav-badge { margin-left: auto; }
}
@media (max-width: 600px) {
  .grid-3 { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .hero h1 { font-size: 32px; }
  .section h2.title { font-size: 26px; }
  .nav-user .email { display: none; }
  .container { padding: 0 16px; }
}

/* =====================================================================
   Motion & micro-interactions  (additive; fully respects reduced-motion)
   Nothing here changes layout/colors — only smooth transitions & reveals.
   ===================================================================== */
@media (prefers-reduced-motion: no-preference) {

  /* ---- Route / page enter (only on real screen changes) ------------- */
  .page-enter { animation: pageEnter .42s cubic-bezier(.22, .61, .36, 1) both; }
  @keyframes pageEnter {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: none; }
  }

  /* ---- Scroll reveal ------------------------------------------------- */
  .reveal-init { opacity: 0; transform: translateY(18px); will-change: opacity, transform; }
  .reveal-in {
    opacity: 1; transform: none;
    transition: opacity .6s ease, transform .6s cubic-bezier(.22, .61, .36, 1);
    transition-delay: var(--rd, 0ms);
  }
  .chat-demo .bubble.reveal-init { transform: translateY(12px) scale(.98); }

  /* ---- Buttons ------------------------------------------------------- */
  .btn { transition: transform .14s cubic-bezier(.22, .61, .36, 1), box-shadow .2s, background .2s, filter .2s, border-color .2s; }
  .btn:hover  { transform: translateY(-1px); }
  .btn.lg:hover { transform: translateY(-2px); }
  .btn:active { transform: translateY(1px) scale(.985); }

  /* ---- Cards (previously no hover) ---------------------------------- */
  .card { transition: transform .24s cubic-bezier(.22, .61, .36, 1), box-shadow .24s, border-color .24s; }
  .card:hover { transform: translateY(-3px); box-shadow: var(--sh); border-color: color-mix(in srgb, var(--accent) 30%, var(--line)); }

  /* ---- Lesson cards & word tiles: smoother curve ------------------- */
  .lesson { transition: transform .2s cubic-bezier(.22, .61, .36, 1), box-shadow .2s, border-color .2s; }
  .word-tile { transition: transform .2s cubic-bezier(.22, .61, .36, 1), box-shadow .22s, filter .2s; }
  .word-tile:hover { transform: translateY(-3px) scale(1.015); box-shadow: var(--sh); z-index: 2; }

  /* ---- Nav ---------------------------------------------------------- */
  .nav-links a { transition: color .18s, background .18s, transform .12s; }
  .nav-links a:active { transform: translateY(1px); }
  .logo { transition: transform .2s cubic-bezier(.22, .61, .36, 1); }
  .logo:hover { transform: scale(1.04) rotate(-1deg); }

  /* ---- Pills / tags ------------------------------------------------- */
  .pill, .tag { transition: transform .15s ease, background .2s; }
  .pill:hover { transform: translateY(-1px); }

  /* ---- Hero mascot idle float -------------------------------------- */
  .hero-art .kanga { animation: floaty 4.6s ease-in-out infinite; }
  @keyframes floaty {
    0%, 100% { transform: translateY(0) rotate(-1.5deg); }
    50%      { transform: translateY(-10px) rotate(1.5deg); }
  }

  /* ---- Progress bars animate their fill ---------------------------- */
  .progress-bar > i { transition: width .85s cubic-bezier(.22, .61, .36, 1); }
  .mini-bar > i     { transition: width .7s cubic-bezier(.22, .61, .36, 1); }

  /* ---- Inputs: soft focus ring ------------------------------------- */
  input, textarea, select { transition: border-color .18s, box-shadow .18s, background .18s; }
}

/* =====================================================================
   Accessibility — visible keyboard focus (does not affect mouse users)
   ===================================================================== */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
[tabindex]:focus-visible,
[role="button"]:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: 8px;
}
/* Don't double-ring the search field (its box already reacts on focus-within). */
.search-box input:focus-visible { outline: none; }

/* =====================================================================
   Skeleton loading placeholders (shimmer)
   ===================================================================== */
.word-tile.skel {
  pointer-events: none; box-shadow: none; border: 1px solid var(--line);
  background: var(--surface-2);
}
@media (prefers-reduced-motion: no-preference) {
  .word-tile.skel {
    background: linear-gradient(100deg,
      var(--surface-2) 30%,
      color-mix(in srgb, var(--line) 55%, var(--surface-2)) 50%,
      var(--surface-2) 70%);
    background-size: 200% 100%;
    animation: skelShimmer 1.25s ease-in-out infinite;
  }
}
@keyframes skelShimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* =====================================================================
   Gamification — XP badge (nav), stats card (dashboard), XP toasts
   ===================================================================== */
.game-badge { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: 13px; }
.game-badge span { display: inline-flex; align-items: center; padding: 4px 9px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); white-space: nowrap; }
.game-badge .gb-streak { color: #d8452a; }
.game-badge .gb-xp { color: var(--accent-2); }
.game-badge .gb-lvl { background: var(--accent-soft); border-color: transparent; color: var(--accent-2); }

.game-card { background: linear-gradient(135deg, var(--accent-soft), var(--surface)); }
.game-top { display: flex; align-items: center; gap: 16px; }
.game-lvl { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 62px; height: 62px; border-radius: 16px; background: var(--accent); color: var(--accent-ink); flex: none; box-shadow: var(--sh-sm); }
.game-lvl-num { font-size: 26px; font-weight: 800; line-height: 1; }
.game-lvl-lbl { font-size: 10px; font-weight: 700; letter-spacing: .1em; opacity: .9; }
.game-main { flex: 1; min-width: 0; }
.game-xp { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.game-xp b { font-size: 18px; }
.game-xp .muted { font-size: 12px; }
.game-row { display: flex; align-items: center; gap: 16px; margin-top: 16px; flex-wrap: wrap; }
.game-stat { text-align: center; }
.game-stat.grow { flex: 1; min-width: 140px; text-align: left; }
.game-stat .gs-big { font-size: 20px; font-weight: 800; }
.game-stat .muted { font-size: 12px; }
.game-stat .gs-daily { margin-bottom: 6px; }

/* Floating XP feedback */
.xp-toasts { position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); z-index: 80; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.xp-toast { padding: 8px 16px; border-radius: 999px; font-weight: 800; font-size: 16px; box-shadow: var(--sh-lg); color: #fff; }
.xp-toast.pos { background: linear-gradient(135deg, #2f9e5f, #46b23f); }
.xp-toast.neg { background: linear-gradient(135deg, #b4553a, #d8452a); }
.xp-toast.bonus { background: linear-gradient(135deg, #c9911f, #e0a41f); }
.xp-toast.level { background: linear-gradient(135deg, #5b4be0, #8e2fd0); font-size: 18px; }
@media (prefers-reduced-motion: no-preference) {
  .xp-toast { animation: xpPop .38s cubic-bezier(.22,.61,.36,1) both; }
  .xp-toasts.out { transition: opacity .4s, transform .4s; opacity: 0; transform: translate(-50%, -12px); }
  @keyframes xpPop { from { opacity: 0; transform: translateY(14px) scale(.9); } to { opacity: 1; transform: none; } }
}

/* =====================================================================
   Hangman-style letter hint (typing exercises)
   ===================================================================== */
.hangman { display: flex; flex-wrap: wrap; justify-content: center; gap: 7px; margin: 4px 0 2px; }
.hm-tile {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 30px; height: 40px; padding: 0 4px;
  font-size: 22px; font-weight: 800; color: var(--ink);
  border-bottom: 3px solid var(--line); border-radius: 6px 6px 3px 3px;
  background: var(--surface-2); text-transform: lowercase;
}
.hm-tile.filled { color: var(--accent-2); border-bottom-color: var(--accent); background: var(--accent-soft); }
.hm-gap { width: 16px; }
.link.disabled { color: var(--sub); opacity: .55; cursor: default; text-decoration: line-through; }

/* =====================================================================
   Debug: "Feladatok" — every exercise stage of one word, side by side
   ===================================================================== */
.debug-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; align-items: start; }
.debug-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--sh-sm); overflow: hidden; }
.debug-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.debug-n { flex: none; width: 28px; height: 28px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-weight: 800; display: inline-flex; align-items: center; justify-content: center; }
.debug-card .vcard { border: none; box-shadow: none; border-radius: 0; }
.debug-card .vhero { height: 150px; min-height: 0; }
.debug-card .vhero-word { font-size: 26px; }
.debug-card .vpanel { padding: 12px 14px; }
.debug-card .opt-grid { grid-template-columns: 1fr 1fr; }
.debug-card .opt-btn { cursor: default; font-size: 14px; padding: 8px 10px; }
.debug-card .opt-btn.ok { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-2); font-weight: 700; }
.dbg-ans { margin-top: 10px; padding: 8px 12px; border-radius: 10px; background: color-mix(in srgb, #2f9e5f 12%, var(--surface)); color: #24713f; font-size: 15px; }

/* ---- Quests (daily / weekly / monthly) ---- */
.quest-group { margin-top: 26px; }
.qg-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 12px; }
.qg-head h2 { font-size: 20px; }
.qg-count { color: var(--muted); font-size: 14px; font-weight: 700; }
.quest-list { display: grid; gap: 10px; }
.quest { display: flex; align-items: center; gap: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; transition: transform .12s, box-shadow .12s, border-color .12s; }
.quest:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(0,0,0,.06); }
.quest .q-ic { font-size: 26px; width: 44px; height: 44px; display: grid; place-items: center; background: var(--accent-soft); border-radius: 12px; flex: none; }
.quest .q-main { flex: 1; min-width: 0; }
.quest .q-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.quest .q-top b { font-size: 15px; }
.quest .q-reward { color: var(--accent-2); font-weight: 800; font-size: 14px; flex: none; }
.quest .q-sub { margin-top: 6px; color: var(--muted); font-size: 13px; }
.quest .q-check { flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 800; }
.quest.done { border-color: var(--accent); background: var(--accent-soft); }
.quest.done .q-ic { background: color-mix(in srgb, var(--accent) 22%, var(--surface)); }
.quest.done .mini-bar i { background: var(--accent); }

/* ---- Flashcard 3D flip (front = word/image, back = meaning) ---- */
.flip3d { perspective: 1600px; }
/* The BACK face is in normal flow (it is the taller side, so it sets the card
   height); the FRONT face is layered on top with absolute positioning. This is
   the reliable 3D-flip technique (grid stacking flattens the 3D in some engines). */
.flip3d-inner { position: relative; transform-style: preserve-3d; -webkit-transform-style: preserve-3d; transition: transform .55s cubic-bezier(.4, .15, .2, 1); }
.flip3d.is-flipped .flip3d-inner { transform: rotateY(180deg); }
.flip3d-face { backface-visibility: hidden; -webkit-backface-visibility: hidden; }
/* Reliability fallback (iOS Safari flattens the 3D and shows BOTH faces mirrored):
   hard-hide the face pointing away, swapping visibility at the flip midpoint so
   only one face is ever visible — regardless of backface-visibility support. */
.flip3d-back { visibility: hidden; transition: visibility 0s linear .28s; }
.flip3d.is-flipped .flip3d-back { visibility: visible; transition: visibility 0s; }
.flip3d.is-flipped .flip3d-front { visibility: hidden; transition: visibility 0s linear .28s; }
.flip3d-front { position: absolute; inset: 0; cursor: pointer; display: flex; flex-direction: column; transform: rotateY(0deg); }
/* Front face: let the image grow to fill the whole card (the back face sets the
   height), so there is no dead space — the small hint panel sits at the bottom. */
.flip3d-front .vhero { flex: 1 1 auto; }
.flip3d-back { transform: rotateY(180deg); pointer-events: none; }
.flip3d.is-flipped .flip3d-front { pointer-events: none; }
.flip3d.is-flipped .flip3d-back { pointer-events: auto; }

/* ---- Special-letters bar (for typing answers) ---- */
.char-toggle { flex: none; display: inline-flex; align-items: center; gap: 3px; padding: 0 11px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--muted); font-weight: 800; font-size: 15px; cursor: pointer; transition: background .15s, color .15s, border-color .15s; }
.char-toggle:hover { border-color: var(--accent); color: var(--accent-2); }
.char-toggle.open { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-2); }
.char-toggle .ct-chev { font-size: 11px; display: inline-block; transition: transform .2s; }
.char-toggle:not(.open) .ct-chev { transform: rotate(180deg); }
.char-bar { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; padding: 8px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; animation: charBarIn .2s ease; }
@keyframes charBarIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.char-key { min-width: 38px; height: 38px; padding: 0 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); font-size: 18px; font-weight: 700; cursor: pointer; transition: transform .1s, background .15s, border-color .15s; }
.char-key:hover { border-color: var(--accent); background: var(--accent-soft); }
.char-key:active { transform: scale(.92); }

/* Answered-card front: result mark on the image + the correct answer in the panel. */
.vhero-result { position: absolute; top: 14px; left: 14px; z-index: 2; font-size: 34px; filter: drop-shadow(0 2px 6px rgba(0,0,0,.55)); }
.vhero-answer { font-size: 15px; margin-bottom: 8px; }
.vhero-answer b { color: var(--accent-2); }
.flip3d-face.res-ok { box-shadow: inset 0 0 0 2px #2f9e5f; }
.flip3d-face.res-bad { box-shadow: inset 0 0 0 2px #d1544e; }

/* Back arrow → previous word. */
.back-arrow { width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--muted); font-size: 20px; line-height: 1; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; transition: transform .12s, border-color .15s, color .15s; }
.back-arrow:hover { border-color: var(--accent); color: var(--accent-2); transform: translateX(-2px); }

/* Swipe: allow vertical scroll but capture horizontal drag on the card. */
/* The card owns the whole gesture (horizontal swipe to decide). `none` stops the
   browser from scrolling/rubber-banding on it — which was toggling the mobile
   address bar mid-drag and making the picture jump smaller/bigger. Tap still works. */
.flip3d { touch-action: none; user-select: none; -webkit-user-select: none; }
/* Swipe-to-decide: full-page dimmer + a grey→colour overlay on the card. Both
   are created/removed by the drag handler; opacity/colour are set inline. */
.swipe-backdrop { position: fixed; inset: 0; background: #000; opacity: 0; z-index: 9990; pointer-events: none; }
.swipe-ind {
  position: absolute; inset: 0; z-index: 4; border-radius: 22px; opacity: 0; pointer-events: none;
  display: flex; flex-direction: column; gap: 6px; align-items: center; justify-content: center; overflow: hidden;
}
.swipe-ico { font-size: 88px; font-weight: 900; color: #fff; line-height: 1; transform: scale(.7); filter: drop-shadow(0 3px 10px rgba(0,0,0,.4)); }
.swipe-cap { font-size: 20px; font-weight: 800; color: #fff; letter-spacing: .3px; text-shadow: 0 2px 8px rgba(0,0,0,.45); }
/* Intro flashcard: hint that you can swipe to decide learn / already-known. */
.decide-hint { display: flex; justify-content: space-between; gap: 10px; margin-top: 12px; font-size: 15px; font-weight: 800; color: var(--muted); }
.decide-hint .dh-know::before { content: '⟵ '; }
.decide-hint .dh-learn::after { content: ' ⟶'; }
.decide-hint .dh-learn { color: var(--accent); }
/* Completed-exercise recap on the answered card's result side. */
.ex-recap { display: flex; flex-direction: column; gap: 6px; align-items: center; margin-bottom: 8px; }
.recap-q { font-weight: 700; font-size: 14px; color: var(--muted); }
.recap-prompt { font-size: 18px; font-weight: 700; }
.recap-prompt.sm { font-size: 15px; font-weight: 600; }
.recap-your { font-size: 16px; }
.recap-your.ok b { color: #2f9e5f; }
.recap-your.bad b { color: #d1544e; }
.recap-correct { font-size: 14px; color: var(--muted); }
.recap-correct b { color: var(--accent-2); }
.recap-syn { font-size: 13px; color: var(--accent-2); background: var(--accent-soft); border-radius: 10px; padding: 6px 10px; margin-top: 2px; }

/* ---- Leaderboard ---- */
.lb-head-row, .lb-row { display: grid; grid-template-columns: 56px 1fr auto; align-items: center; gap: 12px; }
.lb-head-row { padding: 8px 16px; color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.lb-list { display: grid; gap: 8px; }
.lb-row { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px 16px; transition: transform .12s, box-shadow .12s; }
.lb-row:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(0,0,0,.05); }
.lb-rank { font-weight: 800; font-size: 16px; color: var(--muted); text-align: center; }
.lb-row.top .lb-rank { font-size: 20px; }
.lb-name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-val { font-weight: 800; color: var(--accent-2); }
.lb-you { font-size: 11px; font-weight: 800; color: #fff; background: var(--accent); border-radius: 999px; padding: 1px 8px; margin-left: 6px; vertical-align: middle; }
.lb-row.you { border-color: var(--accent); background: var(--accent-soft); }
.lb-sep { text-align: center; color: var(--muted); font-weight: 800; letter-spacing: 3px; padding: 2px 0; }

/* ---- Achievements (overall / all-time) ---- */
.ach-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.ach { display: flex; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; opacity: .72; transition: opacity .15s, border-color .15s; }
.ach.unlocked { opacity: 1; border-color: var(--accent); background: var(--accent-soft); }
.ach-ic { font-size: 24px; width: 42px; height: 42px; display: grid; place-items: center; background: var(--surface-2); border-radius: 11px; flex: none; filter: grayscale(1); }
.ach.unlocked .ach-ic { filter: none; background: color-mix(in srgb, var(--accent) 20%, var(--surface)); }
.ach-main { flex: 1; min-width: 0; }
.ach-title { font-weight: 700; font-size: 14px; }
.ach-sub { color: var(--muted); font-size: 12px; margin-top: 4px; }
.ach-done { color: var(--accent-2); font-weight: 800; font-size: 13px; margin-top: 2px; }
.ach .mini-bar { margin-top: 6px; }

/* Achievement categories */
.ach-cat { margin-top: 16px; }
.ach-cat-head { display: flex; align-items: baseline; justify-content: space-between; margin: 0 2px 8px; }
.ach-cat-head h3 { font-size: 15px; font-weight: 800; color: var(--ink); }

/* Rarity tint of the icon tile on UNLOCKED tiers (higher tier = shinier). */
.ach.unlocked.rarity-0 .ach-ic { background: color-mix(in srgb, #cd7f32 30%, var(--surface)); }
.ach.unlocked.rarity-1 .ach-ic { background: color-mix(in srgb, #9aa3ad 34%, var(--surface)); }
.ach.unlocked.rarity-2 .ach-ic { background: color-mix(in srgb, #e2b12e 34%, var(--surface)); }
.ach.unlocked.rarity-3 .ach-ic { background: color-mix(in srgb, #35c0d6 34%, var(--surface)); }
.ach.unlocked.rarity-4 .ach-ic { background: color-mix(in srgb, #b56be6 36%, var(--surface)); box-shadow: 0 0 0 1px color-mix(in srgb, #b56be6 40%, transparent); }

/* Achievement-unlocked celebration popup (bigger than a quest toast). */
.ach-pop-wrap { position: fixed; left: 50%; top: 78px; transform: translateX(-50%); z-index: 95; display: flex; flex-direction: column; gap: 10px; align-items: center; pointer-events: none; }
.ach-pop { display: flex; align-items: center; gap: 14px; padding: 12px 20px 12px 14px; border-radius: 16px; background: linear-gradient(135deg, #2b2350, #4a3bc7); color: #fff; box-shadow: 0 14px 40px rgba(0,0,0,.3); min-width: 260px; }
.ach-pop.rarity-2 { background: linear-gradient(135deg, #8a5a12, #e0a41f); }
.ach-pop.rarity-3 { background: linear-gradient(135deg, #0f6f80, #35c0d6); }
.ach-pop.rarity-4 { background: linear-gradient(135deg, #6a1fb0, #b56be6); }
.ach-pop-ic { font-size: 34px; width: 56px; height: 56px; display: grid; place-items: center; background: rgba(255,255,255,.16); border-radius: 14px; flex: none; }
.ach-pop-kicker { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; opacity: .9; font-weight: 800; }
.ach-pop-title { font-size: 16px; font-weight: 800; margin: 1px 0; }
.ach-pop-xp { font-size: 13px; font-weight: 800; opacity: .95; }
@media (prefers-reduced-motion: no-preference) {
  .ach-pop { animation: achPop .5s cubic-bezier(.22,.61,.36,1) both; }
  .ach-pop-wrap.out { transition: opacity .5s, transform .5s; opacity: 0; transform: translate(-50%, -14px); }
}
@keyframes achPop { from { opacity: 0; transform: translateY(-16px) scale(.9); } to { opacity: 1; transform: none; } }

/* Inventory chips on the game card + coins in the nav badge. */
.game-inv { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.inv-chip { display: inline-flex; align-items: center; gap: 5px; padding: 5px 11px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); font-weight: 800; font-size: 13px; }
.gb-coins { color: #c9911f; font-weight: 800; }

/* Shop */
.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.shop-item { display: flex; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; }
.shop-ic { font-size: 26px; width: 46px; height: 46px; display: grid; place-items: center; background: var(--surface-2); border-radius: 12px; flex: none; }
.shop-main { flex: 1; min-width: 0; }
.shop-name { font-weight: 800; font-size: 14px; }
.shop-desc { color: var(--muted); font-size: 12px; margin-top: 2px; }
.shop-note { color: var(--muted); font-size: 11px; margin-top: 4px; }
.shop-buy { flex: none; font-weight: 800; }
.shop-buy:disabled { opacity: .5; cursor: not-allowed; }

/* Economy-flavoured toasts */
.xp-toast.coin { background: linear-gradient(135deg, #c9911f, #e0a41f); }
.xp-toast.shield { background: linear-gradient(135deg, #2f7ea0, #3fa0c8); }
.xp-toast.freeze { background: linear-gradient(135deg, #3f7fd8, #6aa8f0); }

/* Languru Plus subscription card */
.plus-card { border: 1.5px solid #e6c15a; background: linear-gradient(160deg, color-mix(in srgb, #f2c94c 16%, var(--surface)), var(--surface)); border-radius: 18px; padding: 18px; box-shadow: 0 10px 30px rgba(200,150,20,.14); }
.plus-card.active { border-color: #d9a326; background: linear-gradient(160deg, color-mix(in srgb, #f2c94c 24%, var(--surface)), var(--surface)); }
.plus-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.plus-badge { font-size: 19px; font-weight: 900; background: linear-gradient(90deg, #b8860b, #e0a41f); -webkit-background-clip: text; background-clip: text; color: transparent; }
.plus-tier-name { font-weight: 800; color: #a5771a; font-size: 14px; }
.plus-status { color: var(--accent-2); font-weight: 700; font-size: 13px; margin-top: 4px; }
.plus-pitch { color: var(--ink); font-size: 14px; margin: 8px 0 10px; }
.plus-perks { list-style: none; margin: 10px 0; padding: 0; display: grid; gap: 7px; }
.plus-perks li { font-size: 13.5px; font-weight: 600; display: flex; gap: 8px; align-items: center; }
.plus-tiers { display: flex; gap: 6px; flex-wrap: wrap; margin: 12px 0; }
.plus-tier-chip { display: flex; flex-direction: column; align-items: center; gap: 1px; min-width: 44px; padding: 6px 4px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); opacity: .5; }
.plus-tier-chip.on { opacity: 1; border-color: #e0a41f; }
.plus-tier-chip.cur { background: color-mix(in srgb, #f2c94c 26%, var(--surface)); box-shadow: 0 0 0 2px #e0a41f inset; }
.ptc-b { font-size: 20px; line-height: 1; }
.ptc-m { font-size: 10px; color: var(--muted); font-weight: 700; }
.plus-buy { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.plus-buy .btn { flex: 1; min-width: 130px; }
.plus-note { font-size: 11px; margin-top: 8px; }
.gb-plus { font-weight: 900; color: #b8860b; }

/* ---- Word-card groups (topics / grammar / falsos amigos) ---- */
.group-sec { margin-top: 22px; }
.group-sec .qg-head h2 { font-size: 18px; }
.group-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; margin-top: 10px; }
.group-card { display: flex; align-items: center; gap: 12px; text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; cursor: pointer; transition: transform .12s, box-shadow .12s, border-color .12s; }
.group-card:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(0,0,0,.07); border-color: var(--accent); }
.group-card.trap { border-color: #e0a83a; background: color-mix(in srgb, #e0a83a 8%, var(--surface)); }
.gc-ic { font-size: 28px; width: 50px; height: 50px; display: grid; place-items: center; background: var(--accent-soft); border-radius: 13px; flex: none; }
.group-card.trap .gc-ic { background: color-mix(in srgb, #e0a83a 22%, var(--surface)); }
.gc-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.gc-title { font-weight: 800; font-size: 16px; }
.gc-sub { color: var(--muted); font-size: 12px; }
.gc-main .mini-bar { margin-top: 2px; }
.trap-note { background: color-mix(in srgb, #e0a83a 14%, var(--surface)); border: 1px solid color-mix(in srgb, #e0a83a 45%, var(--surface)); color: #8a5a10; border-radius: 12px; padding: 10px 14px; margin-bottom: 14px; font-size: 14px; }
.vhero-word .w-art { opacity: .68; font-weight: 700; }
.group-detail-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }

/* ---- Profile: hero + stats + tabs (self and other users) ---- */
.prof-hero { display: flex; align-items: center; gap: 18px; margin: 8px 0 18px; }
.prof-av { position: relative; width: 84px; height: 84px; border-radius: 50%; flex: none; display: grid; place-items: center; font-size: 38px; font-weight: 900; color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent-2)); box-shadow: var(--sh); overflow: hidden; }
.prof-av.img { background-size: cover; background-position: center; color: transparent; }
.prof-av.me { cursor: pointer; }
.av-cam { position: absolute; inset: 0; display: grid; place-items: center; font-size: 22px; background: rgba(0,0,0,.35); opacity: 0; transition: opacity .15s; }
.prof-av.me:hover .av-cam { opacity: 1; }
.prof-name { font-size: 26px; font-weight: 900; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.hero-plus { font-size: 13px; font-weight: 800; color: #b8860b; }
.prof-meta { font-size: 13px; margin-top: 2px; }
.prof-counts { font-size: 14px; margin-top: 6px; }
.prof-av-remove { display: inline-flex; align-items: center; gap: 6px; margin-top: 10px; width: fit-content;
  font-family: var(--font); font-size: 12.5px; font-weight: 700; color: var(--muted);
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px;
  cursor: pointer; transition: color .15s, border-color .15s, background .15s; }
.prof-av-remove:hover { color: #cf3a34; border-color: #cf3a34; background: color-mix(in srgb, #cf3a34 12%, transparent); }
.pstats { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: 10px; margin-bottom: 20px; }
.pstat { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px 8px; text-align: center; }
.pstat-n { font-size: 18px; font-weight: 900; }
.pstat-l { font-size: 11px; margin-top: 2px; }
.prof-tabs { margin-bottom: 16px; }
.prof-tab-body .field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.prof-tab-body .field input, .prof-tab-body input#p-name { width: 100%; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 10px; background: var(--surface-2); color: var(--ink); font-size: 15px; }
.prof-tab-body input#p-name { max-width: 320px; }

/* ---- Avatar cropper modal ---- */
.crop-overlay { position: fixed; inset: 0; z-index: 9995; background: rgba(0,0,0,.55); display: flex; align-items: center; justify-content: center; padding: 20px; }
.crop-box { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 18px; box-shadow: 0 20px 60px rgba(0,0,0,.4); }
.crop-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.crop-head b { font-size: 18px; }
.crop-x { border: none; background: transparent; color: var(--muted); font-size: 20px; cursor: pointer; line-height: 1; }
.crop-view { position: relative; width: 300px; max-width: 100%; aspect-ratio: 1/1; margin: 0 auto; overflow: hidden; border-radius: 12px; background: #111; cursor: grab; touch-action: none; user-select: none; }
.crop-view:active { cursor: grabbing; }
.crop-img { position: absolute; top: 50%; left: 50%; max-width: none; will-change: transform; pointer-events: none; }
.crop-ring { position: absolute; inset: 0; pointer-events: none; }
.crop-ring::before { content: ''; position: absolute; inset: 0; border-radius: 50%; box-shadow: 0 0 0 9999px rgba(0,0,0,.5); border: 3px solid rgba(255,255,255,.9); }
.crop-tools { display: flex; align-items: center; gap: 10px; margin: 16px 2px 6px; }
.crop-tools .big-ic { font-size: 20px; }
.crop-zoom { flex: 1; accent-color: var(--accent); }
.crop-rot { border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); width: 34px; height: 34px; border-radius: 9px; cursor: pointer; font-size: 16px; }
.crop-actions { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.crop-actions .spacer { flex: 1; }

/* ---- "Jump here?" skip cue (magenta) at a locked section's start ---- */
.test-cue { background: #d81f7a; box-shadow: 0 4px 0 #a5155c; }
.test-cue::after { border-top-color: #d81f7a; }
.test-cue:active { box-shadow: 0 1px 0 #a5155c; }

/* ---- Unit-test screen ---- */
.test-head { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.test-progress { flex: 1; display: flex; align-items: center; gap: 10px; }
.test-progress .mini-bar.big { flex: 1; height: 12px; }
.test-card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 24px; box-shadow: var(--sh); }
.test-qtype { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 800; margin-bottom: 8px; }
.test-q { font-size: 22px; font-weight: 800; margin-bottom: 18px; line-height: 1.3; }
.test-input { width: 100%; padding: 14px 16px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--surface-2); font-size: 18px; color: var(--ink); }
.test-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.opt-btn.sel { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-2); font-weight: 800; }
.test-result { text-align: center; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 34px 24px; }
.test-result.pass { border-color: var(--accent); background: var(--accent-soft); }
.tr-emoji { font-size: 60px; line-height: 1; }
.tr-score { font-size: 40px; font-weight: 900; color: var(--accent-2); margin: 6px 0; }
.tr-wrong { text-align: left; margin-top: 18px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 14px; display: flex; flex-direction: column; gap: 6px; }
.tr-w { color: var(--accent-2); font-weight: 700; }

/* ============================================================================
   Motion pass — entrances, hovers, and accents across the app.
   All wrapped in prefers-reduced-motion so it never fights accessibility.
   ============================================================================ */
@keyframes riseIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes popIn { from { opacity: 0; transform: scale(.72); } to { opacity: 1; transform: scale(1); } }
@keyframes nodeRing { 0% { opacity: .55; transform: scale(1); } 70% { opacity: 0; transform: scale(1.45); } 100% { opacity: 0; transform: scale(1.45); } }
@keyframes barShine { from { background-position: 0 0; } to { background-position: 110px 0; } }
@keyframes badgePop { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }

@media (prefers-reduced-motion: no-preference) {
  /* Staggered entrances — JS sets --enter-delay on modcards + path nodes. */
  .modcard { animation: riseIn .5s cubic-bezier(.22,.61,.36,1) both; animation-delay: var(--enter-delay, 0ms); }
  .path-node { animation: popIn .45s cubic-bezier(.34,1.56,.64,1) both; animation-delay: var(--enter-delay, 0ms); }

  /* Current lesson node: a soft pulsing ring to pull the eye. */
  .path-node.open::after { content: ''; position: absolute; inset: -5px; border-radius: 50%; border: 3px solid var(--accent-2); animation: nodeRing 1.9s ease-out infinite; pointer-events: none; }

  /* Card lists fade+rise in, lightly staggered by position. */
  .quest, .ach, .shop-item { animation: riseIn .45s ease both; }
  .quest:nth-child(2), .ach:nth-child(2), .shop-item:nth-child(2) { animation-delay: .05s; }
  .quest:nth-child(3), .ach:nth-child(3) { animation-delay: .1s; }
  .quest:nth-child(4), .ach:nth-child(4) { animation-delay: .15s; }
  .quest:nth-child(n+5), .ach:nth-child(n+5) { animation-delay: .2s; }
  .plus-card, .game-card { animation: riseIn .5s ease both; }

  /* Buttons: gentle lift on hover (press stays as-is). */
  .btn:hover { transform: translateY(-1px); }
  .btn:active { transform: translateY(1px) scale(.98); }

  /* Progress fills get a continuously flowing sheen. The tile is a fixed pixel
     width and the animation shifts by exactly that same width at a constant
     (linear) speed, so the pattern lands identically every cycle — a perfectly
     seamless, smooth loop with no visible jump. Tile edges are transparent so
     neighbouring tiles blend. */
  .progress-bar > i, .mini-bar.big > i {
    background-image: linear-gradient(115deg,
      rgba(255,255,255,0) 35%, rgba(255,255,255,.24) 50%, rgba(255,255,255,0) 65%);
    background-size: 110px 100%;
    background-repeat: repeat;
    animation: barShine 1.8s linear infinite;
  }

  /* Nav game badge chips pop in. */
  .game-badge > span { animation: badgePop .3s cubic-bezier(.34,1.56,.64,1) both; }

  /* The current lesson's cue gently bobs to invite the next step. */
  @keyframes cueBob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
  .path-row.current .path-cue { animation: cueBob 1.4s ease-in-out infinite; }
}

/* ---- Idea board ---------------------------------------------------------- */
.idea-compose { margin-bottom: 18px; }
.idea-compose textarea {
  width: 100%; box-sizing: border-box; resize: vertical; min-height: 64px;
  border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px;
  font: inherit; background: var(--bg); color: var(--ink);
}
.idea-compose textarea:focus { outline: none; border-color: var(--accent); }
.idea-list { display: flex; flex-direction: column; gap: 10px; }
.idea-item { border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; background: var(--card); }
.idea-item.by-admin { border-color: var(--accent); background: var(--accent-soft); }
.idea-meta { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.idea-meta b { color: var(--ink); }
.idea-badge { font-size: 11px; font-weight: 800; color: #fff; background: var(--accent); border-radius: 999px; padding: 1px 8px; }
/* Light/dark theme toggle in the nav. */
.theme-toggle { border: 1px solid var(--line); background: var(--surface); color: var(--ink); width: 34px; height: 34px;
  border-radius: 10px; cursor: pointer; font-size: 16px; line-height: 1; display: inline-grid; place-items: center; flex: none; }
.theme-toggle:hover { border-color: var(--accent); }
.theme-row { display: flex; gap: 10px; flex-wrap: wrap; }
.theme-opt { border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-family: var(--font);
  font-weight: 700; font-size: 15px; padding: 10px 16px; border-radius: 12px; cursor: pointer; }
.theme-opt:hover { border-color: var(--accent); }
.theme-opt.sel { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-2); }
.idea-when { margin-left: auto; font-size: 12px; }
.idea-body { white-space: pre-wrap; word-break: break-word; }

/* Vote column beside each idea box. */
.soon-card .soon-emoji { font-size: 60px; line-height: 1; }
.soon-card h1 { font-size: 30px; }

.idea-row { display: flex; align-items: stretch; gap: 10px; }
.idea-votes { flex: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; width: 46px; }
.idea-vote { border: 1px solid var(--line); background: var(--card); color: var(--muted); width: 34px; height: 30px; border-radius: 10px; cursor: pointer; font-size: 14px; line-height: 1; display: flex; align-items: center; justify-content: center; transition: transform .1s, color .15s, border-color .15s, background .15s; }
.idea-vote:hover { transform: translateY(-1px); border-color: var(--accent); color: var(--ink); }
.idea-vote:active { transform: translateY(1px) scale(.96); }
.idea-vote.up.on { color: #fff; background: #2fa96b; border-color: #2fa96b; }
.idea-vote.down.on { color: #fff; background: #cf3a34; border-color: #cf3a34; }
.idea-score { font-weight: 800; font-size: 15px; color: var(--ink); min-width: 20px; text-align: center; }
.idea-score.pos { color: #2fa96b; }
.idea-score.neg { color: #cf3a34; }
/* Accepted/rejected status label + tint. */
.idea-status { font-size: 11px; font-weight: 800; border-radius: 999px; padding: 1px 8px; }
.idea-status.accepted { color: #1c7a4d; background: color-mix(in srgb, #2fa96b 20%, transparent); }
.idea-status.rejected { color: #9c2b26; background: color-mix(in srgb, #cf3a34 18%, transparent); }
.idea-item.st-accepted { border-color: #2fa96b; }
.idea-item.st-rejected { opacity: .72; }
/* Admin moderation row. */
.idea-admin { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.btn.xs { padding: 3px 10px; font-size: 12px; border-radius: 8px; }
.idea-admin .ok:hover { border-color: #2fa96b; color: #2fa96b; }
.idea-admin .no:hover { border-color: #cf3a34; color: #cf3a34; }
.idea-admin .del:hover { border-color: #cf3a34; color: #cf3a34; }
/* "New ideas" badge on the Ideas nav link. */
.nav-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 17px; height: 17px; padding: 0 5px; margin-left: 5px; vertical-align: middle;
  border-radius: 999px; background: #e5393e; color: #fff;
  font-size: 11px; font-weight: 800; line-height: 1;
}
