/* ============================================================
   Lingo design system — a faithful Duolingo-style interface.
   ============================================================ */
:root {
  --feather:   #58cc02;  --feather-dark: #58a700;  --feather-light:#89e219;
  --macaw:     #1cb0f6;  --macaw-dark:   #1899d6;
  --cardinal:  #ff4b4b;  --cardinal-dark:#ea2b2b;
  --bee:       #ffc800;  --bee-dark:     #e6b000;
  --fox:       #ff9600;  --fox-dark:     #e08600;
  --beetle:    #ce82ff;  --beetle-dark:  #a568cc;
  --humpback:  #2b70c9;
  --sea:       #00cd9c;

  --eel:   #4b4b4b;   /* primary text  */
  --wolf:  #777777;   /* secondary     */
  --hare:  #afafaf;   /* tertiary      */
  --swan:  #e5e5e5;   /* borders       */
  --polar: #f7f7f7;   /* raised surface*/
  --snow:  #ffffff;

  --correct-bg: #d7ffb8; --correct-fg: #58a700; --correct-br:#a5ed6e;
  --wrong-bg:   #ffdfe0; --wrong-fg:   #ea2b2b; --wrong-br:  #ffb3b5;

  --radius: 16px;
  --sidebar-w: 256px;
  --rail-w: 368px;
  --font: 'DIN Round Pro', 'Feather Bold', ui-rounded, 'SF Pro Rounded', 'Nunito',
          -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

html[data-theme="dark"] {
  --eel: #f1f7fb; --wolf: #afafaf; --hare: #777; --swan: #37464f;
  --polar: #202f36;        /* raised surface: hovers, chips, calendar cells */
  --snow: #131f24;
  --feather: #58cc02; --feather-dark: #4aa302;
  --correct-bg: #202f36; --correct-fg: #78c800; --correct-br:#4a6b16;
  --wrong-bg: #291315; --wrong-fg: #ff5b5b; --wrong-br: #6b2226;
}
html[data-theme="dark"] body { background: #131f24; }
html[data-theme="dark"] .card, html[data-theme="dark"] .sidebar,
html[data-theme="dark"] .bottomnav, html[data-theme="dark"] .topbar { background: #131f24; }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  margin: 0; font-family: var(--font); color: var(--eel); background: var(--snow); overflow-x: clip;
  font-size: 16px; -webkit-font-smoothing: antialiased; overscroll-behavior: none;
}
button, input { font-family: inherit; color: inherit; }
h1, h2, h3, h4, p { margin: 0; }
a { color: inherit; text-decoration: none; }
ul { margin: 0; padding: 0; list-style: none; }
[hidden] { display: none !important; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--swan); border-radius: 8px; }

/* ---------- boot ---------- */
.boot { position: fixed; inset: 0; display: grid; place-items: center; gap: 28px;
  grid-auto-flow: row; background: var(--snow); z-index: 999; }
.boot-owl { width: 96px; height: 96px; border-radius: 50%; background: var(--feather);
  animation: bob .9s ease-in-out infinite alternate; }
.boot-bar { width: 220px; height: 16px; border-radius: 99px; background: var(--swan); overflow: hidden; }
.boot-bar i { display: block; height: 100%; width: 40%; border-radius: 99px; background: var(--feather);
  animation: slide 1.1s ease-in-out infinite; }
@keyframes bob { to { transform: translateY(-12px); } }
@keyframes slide { 0% { margin-left: -40%; } 100% { margin-left: 100%; } }

/* ---------- app frame ---------- */
#app { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr) var(--rail-w);
  min-height: 100%; }
.page { min-width: 0; display: flex; flex-direction: column; }
.main { flex: 1; padding: 0 20px 120px; max-width: 700px; width: 100%; margin: 0 auto; }

/* ---------- sidebar ---------- */
.sidebar { position: sticky; top: 0; height: 100vh; border-right: 2px solid var(--swan);
  padding: 8px 12px; display: flex; flex-direction: column; gap: 4px; background: var(--snow); }
.logo { font-size: 30px; font-weight: 800; color: var(--feather); letter-spacing: -.5px;
  padding: 20px 12px 24px; display: flex; align-items: center; gap: 8px; }
.logo svg { width: 34px; height: 34px; }
.navitem { display: flex; align-items: center; gap: 14px; padding: 12px; border-radius: 12px;
  font-weight: 700; font-size: 15px; letter-spacing: .8px; color: var(--wolf); cursor: pointer;
  border: 2px solid transparent; background: none; width: 100%; text-align: left; text-transform: uppercase; }
.navitem:hover { background: var(--polar); }
.navitem.active { background: #ddf4ff; border-color: #84d8ff; color: #1899d6; }
html[data-theme="dark"] .navitem.active { background: #202f36; border-color: #3f85a7; color: #49c0f8; }
.navitem .ico { width: 32px; height: 32px; display: grid; place-items: center; font-size: 30px; flex: none; }
.navitem .ico svg { width: 30px; height: 30px; }

/* ---------- top bar (mobile) ---------- */
.topbar { display: none; }

/* ---------- right rail ---------- */
.rail { padding: 20px 20px 40px; display: flex; flex-direction: column; gap: 16px;
  position: sticky; top: 0; align-self: start; max-height: 100vh; overflow-y: auto; }
.statrow { display: flex; justify-content: flex-end; gap: 22px; padding: 12px 4px 4px; }
.stat { display: flex; align-items: center; gap: 7px; font-weight: 800; font-size: 17px; }
.stat .ico { font-size: 26px; line-height: 1; }
.stat.streak { color: var(--fox); }
.stat.streak.alive .ico { animation: flame 1.6s ease-in-out infinite alternate; transform-origin: 50% 80%; }
@keyframes flame { from { transform: scale(1) rotate(-2deg); } to { transform: scale(1.12) rotate(2deg); } } .stat.gems { color: var(--macaw); }
.stat.hearts { color: var(--cardinal); } .stat.flag { color: var(--eel); }
.stat.dim { color: var(--hare); filter: grayscale(1); }
.stat button { all: unset; cursor: pointer; display: flex; align-items: center; gap: 7px; }

.card { border: 2px solid var(--swan); border-radius: var(--radius); padding: 16px;
  background: var(--snow); transition: transform .14s, box-shadow .14s; }
.practice-card, .vocab-card { transition: transform .14s, box-shadow .14s, background .14s; }
.practice-card:hover, .vocab-card:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(0,0,0,.07); }
.main > * { animation: screenin .26s ease-out; }
@keyframes screenin { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.card h3 { font-size: 19px; font-weight: 800; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.card-head a, .card-head button { color: var(--macaw); font-weight: 800; font-size: 14px;
  letter-spacing: .8px; text-transform: uppercase; cursor: pointer; background: none; border: 0; }
.muted { color: var(--wolf); font-size: 15px; font-weight: 500; }

/* ---------- buttons ---------- */
.btn {
  --bg: var(--feather); --sh: var(--feather-dark); --fg: #fff;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  background: var(--bg); color: var(--fg); border: 0; border-radius: var(--radius);
  box-shadow: 0 4px 0 var(--sh); padding: 13px 20px; min-height: 50px;
  font-weight: 800; font-size: 15px; letter-spacing: .8px; text-transform: uppercase;
  cursor: pointer; transition: filter .1s, transform .06s; user-select: none;
}
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: translateY(4px); box-shadow: 0 0 0 var(--sh); }
.btn:disabled, .btn.disabled { background: var(--swan); color: var(--hare); box-shadow: none;
  cursor: default; transform: none; filter: none; }
.btn.blue  { --bg: var(--macaw); --sh: var(--macaw-dark); }
.btn.red   { --bg: var(--cardinal); --sh: var(--cardinal-dark); }
.btn.gold  { --bg: var(--bee); --sh: var(--bee-dark); --fg: #7d5f00; }
.btn.purple{ --bg: var(--beetle); --sh: var(--beetle-dark); }
.btn.ghost { background: var(--snow); color: var(--macaw); border: 2px solid var(--swan);
  box-shadow: 0 4px 0 var(--swan); }
.btn.ghost:active { box-shadow: 0 0 0 var(--swan); }
.btn.flat  { box-shadow: none; background: none; color: var(--wolf); }
.btn.wide  { width: 100%; }
.btn.lg    { min-height: 58px; font-size: 17px; }

/* ---------- learn path ---------- */
.section-banner { position: sticky; top: 0; z-index: 20; margin: 0 -4px 24px;
  border-radius: var(--radius); padding: 14px 18px; color: #fff; display: flex;
  align-items: center; justify-content: space-between; gap: 12px; box-shadow: 0 4px 0 rgba(0,0,0,.18);
  overflow: hidden; isolation: isolate; }
.section-banner::before { content: ''; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(180deg, rgba(255,255,255,.16), rgba(0,0,0,.06)); }
.bannericon { position: absolute; right: 96px; top: 50%; transform: translateY(-50%) rotate(-12deg);
  font-size: 76px; opacity: .18; pointer-events: none; z-index: -1; }
@media (max-width: 700px) { .bannericon { right: 84px; font-size: 60px; } }
.section-banner .eyebrow { font-size: 13px; font-weight: 800; letter-spacing: .6px; }
.section-banner .t { font-size: 20px; font-weight: 800; }
.section-banner .gb { all: unset; cursor: pointer; padding: 8px; border-radius: 12px;
  min-width: 44px; min-height: 44px; display: inline-grid; place-items: center; }
.section-banner .gb:hover { background: rgba(255,255,255,.18); }
.section-head { display: flex; align-items: center; gap: 16px; margin: 36px 0 8px; }
.section-head hr { flex: 1; border: 0; border-top: 2px solid var(--swan); }
.section-head span { color: var(--wolf); font-weight: 800; font-size: 14px; letter-spacing: 1px; text-transform: uppercase; }

.path { position: relative; padding: 8px 0 40px; }
.trail { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 0; }
.trail path { fill: none; stroke: var(--swan); stroke-width: 12; stroke-linecap: round;
  stroke-dasharray: 0.1 20; }
html[data-theme="dark"] .trail path { stroke: #2b3a41; }
.node-wrap { z-index: 1; }
.scenery { position: absolute; pointer-events: none; user-select: none; opacity: .9;
  filter: drop-shadow(0 3px 0 rgba(0,0,0,.06)); animation: sway 6s ease-in-out infinite alternate; }
@keyframes sway { from { transform: rotate(-1.5deg); } to { transform: rotate(1.5deg); } }
@media (max-width: 800px) { .scenery { display: none; } }
.node-wrap.pop { z-index: 60; }
.node-wrap.has-bubble { margin-top: 66px; }
.node-wrap { scroll-margin-top: 150px; scroll-margin-bottom: 120px; position: relative;
  width: max-content; margin: 12px auto 22px;
  /* the trail's side-to-side swing, tightened on narrow screens */
  transform: translateX(calc(var(--off, 0) * var(--swing, 1px))); }
.node {
  position: relative; width: 70px; height: 58px; border: 0; padding: 0; cursor: pointer;
  background: var(--c, var(--feather)); border-radius: 50%/58%;
  box-shadow: 0 8px 0 var(--cd, var(--feather-dark)); color: #fff;
  display: grid; place-items: center; transition: transform .08s;
}
.node:active { transform: translateY(8px); box-shadow: 0 0 0 var(--cd); }
.node.justdone { animation: nodepop .55s cubic-bezier(.2,1.4,.4,1); }
@keyframes nodepop {
  0% { transform: scale(.8); } 45% { transform: scale(1.18); } 100% { transform: scale(1); }
}
.node .glyph { font-size: 32px; line-height: 0; line-height: 1; filter: drop-shadow(0 1px 0 rgba(0,0,0,.15)); }
.node.locked { --c: var(--swan); --cd: #d0d0d0; color: var(--hare); cursor: pointer; }
html[data-theme="dark"] .node.locked { --c: #37464f; --cd: #2b3a41; color: #92a4ae; }
.node.done  { --c: var(--bee); --cd: var(--bee-dark); }
.node.legend{ --c: #ffd900; --cd: #e3a600;
  background: linear-gradient(180deg,#fff3a0,#ffc800); }
.node.chest { background: none; box-shadow: none; height: 62px; }
.node.chest .glyph { font-size: 58px; }
.node.chest:active { transform: translateY(3px); }

.ring { position: absolute; inset: -11px -10px -14px; pointer-events: none; }
.ring circle { fill: none; stroke-width: 8; stroke-linecap: round; }
.ring .bg { stroke: var(--swan); }
html[data-theme="dark"] .ring .bg { stroke: #37464f; }
.ring .fg { stroke: var(--bee); transition: stroke-dashoffset .5s; }

.startbubble { pointer-events: none; position: absolute; left: 50%; transform: translate(-50%, -100%); top: -14px;
  background: var(--snow); border: 2px solid var(--swan); color: var(--feather);
  font-weight: 800; font-size: 14px; letter-spacing: .8px; padding: 9px 16px; border-radius: 14px;
  white-space: nowrap; animation: pop .35s ease-out; }
.startbubble::after { content: ''; position: absolute; left: 50%; bottom: -9px; width: 14px; height: 14px;
  background: var(--snow); border-right: 2px solid var(--swan); border-bottom: 2px solid var(--swan);
  transform: translateX(-50%) rotate(45deg); }
@keyframes pop { from { transform: translate(-50%,-90%) scale(.7); opacity: 0; } }

.mascot-side { position: absolute; width: 110px; pointer-events: none; opacity: .95; }

/* ---------- unit guidebook / popovers ---------- */
.popover { position: absolute; z-index: 40; left: 50%; transform: translateX(-50%);
  width: min(300px, calc(100vw - 32px)); background: var(--c, #58cc02); color: #fff;
  border-radius: var(--radius); padding: 18px; box-shadow: 0 8px 0 rgba(0,0,0,.2); animation: pop .18s; }
.popover::before { content: ''; position: absolute; top: -8px; left: calc(50% + var(--caret, 0px));
  width: 16px; height: 16px; background: var(--c, #58cc02); transform: translateX(-50%) rotate(45deg); }
.popover .t { font-size: 20px; font-weight: 800; margin-bottom: 4px; }
.popover .d { font-size: 15px; font-weight: 600; opacity: .92; margin-bottom: 14px; }
.popover .btn { background: #fff; color: var(--c,#58cc02); box-shadow: 0 4px 0 rgba(0,0,0,.18); width: 100%; }

/* ---------- generic lists ---------- */
.grow { flex: 1 1 auto; min-width: 0; }
.rowlist { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; gap: 14px; padding: 12px 8px; border-radius: 12px; }
.row + .row { border-top: 2px solid var(--swan); }
.row .title { font-weight: 700; }
.row .sub { color: var(--wolf); font-size: 14px; font-weight: 600; }
.avatar { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center;
  font-weight: 800; color: #fff; font-size: 18px; flex: none; overflow: hidden; }
.avatar.art svg { width: 112%; height: 112%; margin-top: 8%; }
.dialog .who svg { display: block; }

.pagetitle { font-size: 32px; font-weight: 800; margin: 28px 0 18px; }
.emptynote { color: var(--wolf); font-weight: 600; text-align: center; padding: 28px 0 36px;
  display: flex; flex-direction: column; align-items: center; gap: 10px; }
.emptynote svg { opacity: .9; }

/* ---------- progress bars ---------- */
.bar { height: 16px; border-radius: 99px; background: var(--swan); overflow: hidden; position: relative; }
.bar i { display: block; height: 100%; background: var(--feather); border-radius: 99px;
  transition: width .35s cubic-bezier(.2,.9,.3,1); position: relative; }
.bar i::after { content: ''; position: absolute; left: 8px; right: 8px; top: 3px; height: 4px;
  border-radius: 99px; background: rgba(255,255,255,.3); }
.bar.grew i { animation: sweep .7s ease-out; }
@keyframes sweep {
  from { filter: brightness(1.35); }
  to { filter: none; }
}
.bar.gold i { background: var(--bee); }

/* ---------- toast ---------- */
.toast-root { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); z-index: 300;
  transition: none;
  display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast-root.over-lesson { top: 84px; bottom: auto; }
.toast { background: #1f1f1f; color: #fff; font-weight: 700; padding: 12px 18px; border-radius: 14px;
  animation: pop .2s; box-shadow: 0 6px 18px rgba(0,0,0,.25); }

/* ---------- modal ---------- */
.modal-root { position: fixed; inset: 0; z-index: 400; display: grid; place-items: center;
  background: rgba(0,0,0,.5); padding: 20px; }
.modal { background: var(--snow); border-radius: 20px; padding: 24px; width: min(460px, 100%);
  text-align: center; animation: pop .2s; max-height: 90vh; overflow-y: auto; }
.modal h2 { font-size: 24px; font-weight: 800; margin-bottom: 8px; }
.modal p { color: var(--wolf); font-weight: 600; margin-bottom: 20px; }
.modal .btn { width: 100%; }
.modal .stack { display: flex; flex-direction: column; gap: 10px; }

/* ---------- bottom nav (mobile) ---------- */
.bottomnav { display: none; }

/* ============================ responsive ============================ */
@media (max-width: 1200px) {
  :root { --rail-w: 320px; }
}
@media (max-width: 1050px) {
  #app { grid-template-columns: var(--sidebar-w) minmax(0,1fr); }
  .rail { display: none; }
}
@media (max-width: 800px) {
  #app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .topbar { display: block; position: sticky; top: 0; z-index: 30; background: var(--snow);
    border-bottom: 2px solid var(--swan); }
  .topbar .statrow { justify-content: space-between; padding: 10px 16px; gap: 8px; }
  .main { padding: 0 16px 110px; }
  .path { --swing: 0.7px; }
  .section-banner { top: 54px; }
  .bottomnav { display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
    background: var(--snow); border-top: 2px solid var(--swan); padding: 8px 4px calc(8px + env(safe-area-inset-bottom));
    justify-content: space-around; }
  .bottomnav .navitem { flex-direction: column; gap: 0; padding: 8px; width: auto; flex: 1;
    align-items: center; justify-content: center; }
  .bottomnav .navitem span:not(.ico) { display: none; }
  .pagetitle { font-size: 26px; margin: 18px 0 14px; }
}

/* ============================================================
   Lesson player
   ============================================================ */
.overlay { position: fixed; inset: 0; z-index: 200; background: var(--snow);
  display: flex; flex-direction: column; }
.lesson-head { display: flex; align-items: center; gap: 16px; padding: 20px max(20px, 4vw) 8px;
  max-width: 1100px; width: 100%; margin: 0 auto; }
.quit { all: unset; cursor: pointer; color: var(--hare); font-size: 30px; line-height: 1;
  min-width: 44px; min-height: 44px; display: inline-grid; place-items: center; }
.quit:hover { color: var(--wolf); }
.lesson-head .bar { flex: 1; }
.hearts-ind { display: flex; align-items: center; gap: 6px; color: var(--cardinal);
  font-weight: 800; font-size: 20px; }
.hearts-ind .ico { font-size: 26px; }
.hearts-ind.pulse { animation: shake .4s; }

.lesson-body { flex: 1; overflow-y: auto; }
.lesson-inner { max-width: 700px; margin: 0 auto; padding: 24px max(20px, 4vw) 40px; }
.ex-prompt { font-size: 28px; font-weight: 800; margin-bottom: 24px; line-height: 1.25; }
@media (max-width: 700px) { .ex-prompt { font-size: 22px; margin-bottom: 18px; } }

/* what this unit actually lets you do */
.candoo { border: 2px solid var(--swan); border-radius: var(--radius); padding: 16px 18px;
  background: var(--polar); margin-bottom: 18px; }
html[data-theme="dark"] .candoo { background: #202f36; }
.candoo h4 { font-size: 14px; font-weight: 800; letter-spacing: .6px; text-transform: uppercase;
  color: var(--wolf); margin-bottom: 10px; }
.candoo li { display: flex; gap: 10px; align-items: flex-start; padding: 5px 0;
  font-weight: 600; line-height: 1.4; }
.candoo .tick { color: var(--feather); font-weight: 800; }

/* the tip card: the pattern, before the practice */
.tipcard { border: 2px solid var(--swan); border-radius: var(--radius); padding: 20px;
  background: var(--polar); }
html[data-theme="dark"] .tipcard { background: #202f36; }
.tiphead { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.tiphead h4 { font-size: 19px; font-weight: 800; }
.tipbadge { font-size: 24px; }
.tipcard p { color: var(--wolf); font-weight: 600; line-height: 1.55; margin-bottom: 14px; font-size: 17px; }
.tipcard p b, .tipcard p i { color: var(--eel); }
.tipcard .gb-ex { border-top: 2px solid var(--swan); }

/* why the answer was wrong */
.rulehint { display: flex; gap: 8px; align-items: flex-start; margin-top: 8px;
  font-size: 14px; font-weight: 600; opacity: .85; max-width: 60ch; line-height: 1.4; }

/* speech bubble + mascot */
.dialog { display: flex; align-items: flex-end; gap: 12px; margin-bottom: 28px; }
.dialog .who { width: 92px; flex: none; }
.dialog .who svg { width: 100%; height: auto; }
.bubble { position: relative; border: 2px solid var(--swan); border-radius: var(--radius);
  padding: 16px 18px; font-size: 22px; font-weight: 600; line-height: 1.35; flex: 0 1 auto; }
.dialog .bubble { max-width: calc(100% - 104px); }
.bubble.top::before { top: 16px; bottom: auto; }
.bubble::before { content: ''; position: absolute; left: -9px; bottom: 18px; width: 14px; height: 14px;
  background: var(--snow); border-left: 2px solid var(--swan); border-bottom: 2px solid var(--swan);
  transform: rotate(45deg); }
/* the learner's own bubble sits on the right, so its tail points the other way */
.dialog.me { flex-direction: row-reverse; }
.dialog.me .bubble::before { left: auto; right: -9px;
  border-left: 0; border-bottom: 0; border-right: 2px solid var(--swan); border-top: 2px solid var(--swan); }
.spk { all: unset; cursor: pointer; color: var(--macaw); font-size: 26px; margin-right: 6px;
  vertical-align: -3px; line-height: 0; min-width: 40px; min-height: 40px;
  display: inline-grid; place-items: center; }
.spk:hover { filter: brightness(1.15); }
.bubble .hintword { border-bottom: 2px dotted var(--hare); cursor: pointer; }
.bubble .hintword:hover { color: var(--macaw); border-color: var(--macaw); }

/* audio buttons */
.audio-row { display: flex; align-items: center; gap: 16px; margin-bottom: 28px; }
.speaker svg { width: 1em; height: 1em; }
.speaker { width: 90px; height: 90px; border-radius: var(--radius); border: 0; cursor: pointer;
  background: var(--macaw); box-shadow: 0 4px 0 var(--macaw-dark); color: #fff; font-size: 40px;
  display: grid; place-items: center; }
.speaker:active { transform: translateY(4px); box-shadow: none; }
.speaker.slow { width: 60px; height: 60px; background: var(--snow); color: var(--macaw);
  border: 2px solid var(--swan); box-shadow: 0 4px 0 var(--swan); font-size: 26px; }
.speaker.playing { animation: pulse .5s ease-in-out infinite alternate; }
@keyframes pulse { to { filter: brightness(1.15); } }

/* word bank */
.answer-area { min-height: 108px; border-bottom: 2px solid var(--swan); margin-bottom: 8px;
  padding-bottom: 8px; display: flex; flex-wrap: wrap; align-content: flex-start; gap: 8px; }
.answer-area.lined { background:
  repeating-linear-gradient(to bottom, transparent 0 46px, var(--swan) 46px 48px); }
.bank { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.tile { position: relative; border: 2px solid var(--swan); border-bottom-width: 4px; border-radius: 14px;
  background: var(--snow); padding: 10px 14px; font-size: 18px; font-weight: 600; cursor: pointer;
  transition: transform .06s, background .1s; user-select: none; }
.tile:hover { background: var(--polar); }
.tile:active { transform: translateY(2px); border-bottom-width: 2px; }
.tile.ghost { visibility: hidden; }
.tile.used { color: transparent; background: var(--swan); border-color: var(--swan); }
html[data-theme="dark"] .tile.used { background: #2b3a41; border-color: #2b3a41; }
.tile.picked { animation: pop .15s; }
.tile:active { transform: translateY(2px) scale(.97); }

/* choice tiles (images / text / single words) */
.choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; max-width: 560px; }
.choices.three { grid-template-columns: repeat(3, minmax(0, 1fr)); max-width: 680px; }
.choices.text { grid-template-columns: 1fr; max-width: none; }
.choices.words { display: flex; flex-wrap: wrap; gap: 12px; max-width: none; }
.choices.words .choice { flex: 0 1 auto; min-width: 120px; }
.choice { border: 2px solid var(--swan); border-bottom-width: 4px; border-radius: var(--radius);
  background: var(--snow); padding: 16px 12px 12px; cursor: pointer; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 10px; position: relative;
  transition: background .1s; }
.choice:hover { background: var(--polar); }
.choice .pic { font-size: 62px; line-height: 1; }
.choice .label { font-size: 19px; font-weight: 600; }
.choice .kbd, .pair .kbd { color: var(--wolf); font-size: 12px; font-weight: 800; border: 2px solid var(--swan);
  border-radius: 8px; min-width: 22px; height: 22px; display: inline-grid; place-items: center; }
.choice .kbd { position: absolute; left: 10px; bottom: 8px; }
.choices.text .choice .kbd, .choices.words .choice .kbd { position: static; flex: none; width: 14px; }
.choice.sel { border-color: #84d8ff; background: #ddf4ff; color: #1899d6; }
html[data-theme="dark"] .choice.sel:not(.ok):not(.bad) { background: #202f36; border-color: #3f85a7; }
html[data-theme="dark"] .pair.sel:not(.ok) { background: #202f36; border-color: #3f85a7; color: #49c0f8; }
.choice.ok  { border-color: var(--correct-br); background: var(--correct-bg); color: var(--correct-fg); }
.choice.bad { border-color: var(--wrong-br); background: var(--wrong-bg); color: var(--wrong-fg); }
.choices.text .choice, .choices.words .choice { flex-direction: row; justify-content: flex-start;
  text-align: left; padding: 16px; gap: 14px; }
@media (max-width: 520px) { .choices.three { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* match pairs */
.pairs { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 40px; align-items: stretch; }
.pairs .col { display: grid; grid-auto-rows: 1fr; gap: 12px; }
.pair { border: 2px solid var(--swan); border-bottom-width: 4px; border-radius: 14px; padding: 14px;
  font-size: 18px; font-weight: 600; cursor: pointer; display: flex; align-items: center; gap: 10px; }
.pair:hover { background: var(--polar); }
.pair.sel { border-color: #84d8ff; background: #ddf4ff; color: #1899d6; }
.pair.ok { border-color: var(--correct-br); background: var(--correct-bg); color: var(--correct-fg);
  animation: pop .2s; }
.pair.gone { opacity: .3; pointer-events: none; }
.pair.bad { animation: shake .4s; border-color: var(--wrong-br); background: var(--wrong-bg); }
@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

/* typed answer */
.typebox { width: 100%; min-height: 128px; border: 2px solid var(--swan); border-radius: var(--radius);
  padding: 16px; font-size: 19px; font-weight: 600; resize: none; outline: none; background: var(--snow); }
.typebox:focus { border-color: var(--hare); }
.toggle-input { all: unset; cursor: pointer; color: var(--macaw); font-weight: 800; font-size: 14px;
  letter-spacing: .8px; text-transform: uppercase; margin-top: 8px; display: inline-block;
  padding: 12px 4px; }

/* fill in the blank */
.blank { display: inline-block; min-width: 96px; border-bottom: 3px solid var(--hare);
  text-align: center; color: var(--macaw); }
.blank.filled { border-color: var(--macaw); }

/* speaking */
.mic { width: 100%; border: 2px solid var(--swan); border-bottom-width: 4px; border-radius: var(--radius);
  background: var(--snow); padding: 18px; font-size: 18px; font-weight: 700; color: var(--macaw);
  cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 12px; }
.mic.rec { background: var(--macaw); color: #fff; border-color: var(--macaw-dark); animation: pulse .6s infinite alternate; }
.heard { margin-top: 14px; font-weight: 600; color: var(--wolf); min-height: 24px; }

/* footer */
.lesson-foot { border-top: 2px solid var(--swan); padding: 16px max(20px,4vw) calc(20px + env(safe-area-inset-bottom)); }
.lesson-foot .inner { max-width: 1100px; margin: 0 auto; display: flex; align-items: center;
  justify-content: space-between; gap: 20px; }
.lesson-foot.ok, .lesson-foot.bad { border-color: transparent; animation: footerin .22s ease-out; }
.lesson-foot.ok  { background: var(--correct-bg); }
.lesson-foot.bad { background: var(--wrong-bg); }
@keyframes footerin { from { transform: translateY(100%); } to { transform: none; } }
.verdict { display: flex; align-items: center; gap: 14px; font-weight: 800; }
.verdict .mark { width: 52px; height: 52px; border-radius: 50%; background: #fff; display: grid;
  place-items: center; font-size: 30px; flex: none; }
.lesson-foot.ok  .verdict { color: var(--correct-fg); }
.lesson-foot.bad .verdict { color: var(--wrong-fg); }
.verdict .h { font-size: 22px; }
.verdict .s { font-size: 15px; font-weight: 700; }
.verdict .s b { font-weight: 800; }
.footbtns { display: flex; gap: 12px; align-items: center; }
.rep { all: unset; cursor: pointer; font-weight: 800; font-size: 20px; letter-spacing: .8px;
  text-transform: uppercase; opacity: .7; min-width: 44px; min-height: 44px;
  display: inline-grid; place-items: center; }
@media (max-width: 700px) {
  .lesson-foot .inner { gap: 12px; }
  .lesson-foot .btn.flat { padding: 13px 4px; }
  .lesson-foot #checkbtn { flex: 1; }
}

.combo-pop { position: fixed; bottom: 128px; left: 50%; transform: translateX(-50%); z-index: 210;
  background: var(--bee); color: #7d5f00; font-weight: 800; font-size: 17px; padding: 10px 22px;
  border-radius: 99px; box-shadow: 0 6px 0 var(--bee-dark); animation: pop .25s; transition: opacity .35s; }

/* lesson complete */
.finish { text-align: center; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 10px; height: 100%; padding: 20px; position: relative; }
.finish > * { animation: risein .45s both cubic-bezier(.2,.9,.3,1); }
.finish > *:nth-child(2) { animation-delay: .08s; }
.finish > *:nth-child(3) { animation-delay: .14s; }
.finish > *:nth-child(4) { animation-delay: .2s; }
.finish > *:nth-child(5) { animation-delay: .26s; }
@keyframes risein { from { opacity: 0; transform: translateY(14px) scale(.96); } }
.finish::before { content: ''; position: absolute; top: 8%; left: 50%; width: 420px; height: 420px;
  transform: translateX(-50%); border-radius: 50%; z-index: -1;
  background: radial-gradient(circle, rgba(255,200,0,.22), rgba(255,200,0,0) 62%);
  animation: glow 2.4s ease-in-out infinite alternate; }
@keyframes glow { from { opacity: .55; transform: translateX(-50%) scale(.92); } to { opacity: 1; transform: translateX(-50%) scale(1.04); } }
.finish h1 { font-size: 34px; font-weight: 800; color: var(--bee); }
.finish .sub { color: var(--wolf); font-weight: 700; margin-bottom: 20px; }
.scorecards { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; margin: 12px 0 8px; }
.scorecard { border-radius: 14px; padding: 2px; min-width: 128px;
  animation: popin .4s both cubic-bezier(.2,1.5,.4,1); }
.scorecard:nth-child(2) { animation-delay: .12s; }
.scorecard:nth-child(3) { animation-delay: .22s; }
@keyframes popin { from { opacity: 0; transform: scale(.7) translateY(10px); } }
.scorecard .in { background: var(--snow); border-radius: 12px; padding: 8px; }
.scorecard .k { font-size: 12px; font-weight: 800; letter-spacing: .8px; text-transform: uppercase; color: #fff; padding-bottom: 4px; }
.scorecard .v { font-size: 22px; font-weight: 800; display: flex; align-items: center; justify-content: center; gap: 6px; }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 250; overflow: hidden; }
.confetti i { position: absolute; width: 10px; height: 16px; border-radius: 2px; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); opacity: .9; } }

/* ============================================================
   Guidebook, quests, league, shop, profile
   ============================================================ */
.gb-wrap { padding-bottom: 60px; }
.gb-tip { border: 2px solid var(--swan); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; }
.gb-tip h4 { font-size: 18px; font-weight: 800; margin-bottom: 8px; }
.gb-tip p { color: var(--wolf); font-weight: 600; line-height: 1.5; margin-bottom: 12px; }
.gb-ex { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 2px solid var(--swan); }
.gb-ex .es { font-weight: 700; flex: 1; }
.gb-ex .en { color: var(--wolf); font-weight: 600; flex: 1; }
.gb-ex .spk { all: unset; cursor: pointer; color: var(--macaw); font-size: 24px; }
.vocab-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.vocab-card { border: 2px solid var(--swan); border-radius: 14px; padding: 12px; display: flex;
  align-items: center; gap: 10px; cursor: pointer; }
.vocab-card .e { font-size: 28px; }
.vocab-card .es { font-weight: 800; }
.vocab-card .en { color: var(--wolf); font-size: 14px; font-weight: 600; }
.strengthbar { height: 6px; border-radius: 99px; background: var(--swan); margin-top: 6px; overflow: hidden; }
.strengthbar i { display: block; height: 100%; border-radius: 99px; transition: width .4s; }

.quest { display: flex; align-items: center; gap: 14px; padding: 12px 0; }
.quest .qi { font-size: 34px; }
.quest .qt { font-weight: 700; margin-bottom: 6px; }
.quest .bar { height: 18px; }
.quest .bar span { position: absolute; inset: 0; display: grid; place-items: center; font-size: 12px;
  font-weight: 800; color: var(--eel); }
.chest { font-size: 30px; }

.league-tiers { display: flex; gap: 10px; overflow-x: auto; padding: 4px 0 12px; scrollbar-width: none; }
.league-tiers::-webkit-scrollbar { display: none; }
.tier { width: 64px; flex: none; text-align: center; opacity: .45; }
.tier.cur { opacity: 1; }
.tier .badge { font-size: 40px; }
.tier .nm { font-size: 11px; font-weight: 800; text-transform: uppercase; color: var(--wolf); }
.lb-row { display: flex; align-items: center; gap: 14px; padding: 10px 8px; border-radius: 12px; }
.lb-row.me { background: var(--polar); }
.lb-row .rank { width: 28px; font-weight: 800; text-align: center; color: var(--wolf); }
.lb-row .rank.top1 { color: #ffc800; } .lb-row .rank.top2 { color: #b7b7b7; } .lb-row .rank.top3 { color: #cd7f32; }
.lb-row .xp { font-weight: 700; color: var(--wolf); }
.lb-zone { display: flex; align-items: center; gap: 10px; margin: 6px 0; }
.lb-zone hr { flex: 1; border: 0; border-top: 2px dashed var(--feather); }
.lb-zone span { font-size: 12px; font-weight: 800; color: var(--feather); text-transform: uppercase; }
.lb-zone.demote hr { border-color: var(--cardinal); } .lb-zone.demote span { color: var(--cardinal); }

.shop-item { display: flex; align-items: center; gap: 16px; padding: 16px 0; border-top: 2px solid var(--swan); }
.shop-item .si { font-size: 46px; }
.shop-item .nm { font-weight: 800; font-size: 17px; }
.shop-item .ds { color: var(--wolf); font-weight: 600; font-size: 14px; }

.profile-head { display: flex; gap: 22px; align-items: center; margin: 24px 0; }
.profile-head .avatar { width: 112px; height: 112px; font-size: 44px; }
.charpick { all: unset; cursor: pointer; border: 2px solid var(--swan); border-bottom-width: 4px;
  border-radius: 14px; padding: 8px 6px 6px; text-align: center; width: 86px; }
.charpick:hover { background: var(--polar); }
.charpick.sel { border-color: #84d8ff; background: #ddf4ff; }
html[data-theme="dark"] .charpick.sel { background: #202f36; border-color: #3f85a7; }
.charpick .nm { display: block; font-size: 12px; font-weight: 800; color: var(--wolf); margin-top: 2px; }
.charpick svg { display: block; margin: 0 auto; }
.profile-head .nm { font-size: 28px; font-weight: 800; }
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stat-box { border: 2px solid var(--swan); border-radius: 14px; padding: 14px; display: flex;
  align-items: center; gap: 12px; }
.stat-box .e { font-size: 30px; }
.stat-box .v { font-weight: 800; font-size: 20px; }
.stat-box .k { color: var(--wolf); font-weight: 600; font-size: 13px; }
.ach { display: flex; gap: 14px; padding: 14px 0; align-items: center; }
.ach + .ach { border-top: 2px solid var(--swan); }
.ach .medal { width: 64px; height: 64px; flex: none; display: grid; place-items: center; font-size: 34px;
  border-radius: 50%; background: var(--polar); }
.ach.locked { opacity: .5; }

.streak-cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; text-align: center; }
.streak-cal .d { font-size: 11px; font-weight: 800; color: var(--hare); }
.streak-cal .c { aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center;
  background: var(--polar); font-weight: 800; font-size: 13px; color: var(--hare); }
.streak-cal .c.on { background: var(--fox); color: #fff; }
.streak-cal .c.today { outline: 2px solid var(--fox); }

.settings-row { display: flex; align-items: center; justify-content: space-between; padding: 16px 0;
  border-bottom: 2px solid var(--swan); font-weight: 700; gap: 12px; }
.settings-row:last-child { border-bottom: 0; }
input[type=range] { accent-color: var(--feather); }
.switch { width: 54px; height: 32px; border-radius: 99px; background: var(--swan); position: relative;
  cursor: pointer; border: 0; transition: background .15s; flex: none; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px;
  border-radius: 50%; background: #fff; transition: left .15s; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.switch.on { background: var(--feather); }
.switch.on::after { left: 25px; }

.practice-card { display: flex; align-items: center; gap: 16px; border: 2px solid var(--swan);
  border-bottom-width: 4px; border-radius: var(--radius); padding: 16px; cursor: pointer; margin-bottom: 12px; }
.practice-card:hover { background: var(--polar); }
.practice-card .pi { font-size: 40px; }
.practice-card .nm { font-weight: 800; font-size: 17px; }
.practice-card .ds { color: var(--wolf); font-weight: 600; font-size: 14px; }


/* Anyone who asks for less motion gets the interface, not the animation. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important;
    transition-duration: .001ms !important; }
}
