:root {
  --forest: #1B365D;
  --forest-2: #12284A;
  --sage: #6A9BD8;
  --sage-soft: #E7F0FB;
  --cream: #F4F7FB;
  --cream-2: #E6EDF6;
  --brown: #3E6FB0;
  --brown-dark: #2E5A94;
  --honey: #2F64A8;
  --honey-soft: #EAF3FD;
  --white: #FFFFFF;
  --ink: #1A2433;
  --muted: #556274;
  --line: #D9E2EE;
  --ok: #2f7a4b;
  --ok-bg: #e5f2e8;
  --bad: #a6452e;
  --bad-bg: #f8e6e0;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(27,54,93,.06), 0 6px 20px rgba(27,54,93,.07);
  --shadow-lg: 0 10px 40px rgba(27,54,93,.12);
  --font: 'Nunito Sans', system-ui, -apple-system, Segoe UI, sans-serif;
  --logo: 'Fraunces', Georgia, serif;
  --max: 1160px;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; font-family: var(--font); color: var(--ink); background: var(--cream); line-height: 1.6; font-size: 16px; -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4 { font-weight: 800; line-height: 1.25; color: var(--forest); margin: 0 0 .5em; }
h1 { font-size: clamp(1.9rem, 4vw, 2.8rem); letter-spacing: -.01em; }
h2 { font-size: clamp(1.4rem, 2.6vw, 1.9rem); }
h3 { font-size: 1.15rem; }
p { margin: 0 0 1em; }
a { color: var(--forest); }
img, svg { max-width: 100%; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--forest); color: #fff; padding: 8px 14px; border-radius: 8px; z-index: 100; }
.skip:focus { left: 8px; }
:focus-visible { outline: 3px solid var(--brown); outline-offset: 2px; border-radius: 6px; }
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 20px; }
main { min-height: 70vh; outline: none; }
.section { padding: 64px 0; }
.section-sm { padding: 36px 0; }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: .78rem; font-weight: 700; color: var(--brown-dark); margin-bottom: .6em; }
.lead { font-size: 1.12rem; color: var(--muted); max-width: 60ch; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.center { text-align: center; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.grid { display: grid; gap: 20px; }
.g2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.g6 { grid-template-columns: repeat(3, minmax(0,1fr)); }
@media (max-width: 900px) { .g3, .g4, .g6 { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (max-width: 600px) { .g2, .g3, .g4, .g6 { grid-template-columns: 1fr; } .section { padding: 44px 0; } }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: 600 .98rem var(--font); padding: 11px 20px; border-radius: 999px; border: 1.5px solid transparent; cursor: pointer; text-decoration: none; transition: background .15s, transform .15s, box-shadow .15s; white-space: nowrap; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--forest); color: #fff; }
.btn-primary:hover { background: var(--forest-2); }
.btn-honey { background: var(--honey); color: #fff; }
.btn-honey:hover { background: #24528C; }
.btn-ghost { background: transparent; color: var(--forest); border-color: var(--forest); }
.btn-ghost:hover { background: rgba(27,54,93,.06); }
.btn-soft { background: var(--sage-soft); color: var(--forest); }
.btn-soft:hover { background: #D5E4F6; }
.btn-light { background: #fff; color: var(--forest); border-color: var(--line); }
.btn-light:hover { border-color: var(--sage); }
.btn-sm { padding: 7px 14px; font-size: .88rem; }
.btn-danger { background: var(--bad-bg); color: var(--bad); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--forest); font: inherit; font-weight: 700; cursor: pointer; text-decoration: underline; }

/* Topbar */
.topbar { position: sticky; top: 0; z-index: 50; background: rgba(244,247,251,.94); backdrop-filter: saturate(1.2) blur(8px); border-bottom: 1px solid var(--line); }
.nav { display: flex; align-items: center; gap: 18px; height: 68px; }
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--forest); flex-shrink: 0; }
.logo-word { font-family: var(--logo); font-weight: 700; font-size: 1.45rem; letter-spacing: -.01em; line-height: 1; }
.logo-sub { display: block; font-family: var(--logo); font-style: italic; font-size: .86rem; font-weight: 300; color: var(--brown-dark); letter-spacing: .01em; margin-top: 3px; }
.nav-links { display: flex; gap: 4px; list-style: none; margin: 0 auto 0 12px; padding: 0; }
.nav-links > li { position: relative; }
.nav-links a, .nav-links button.navbtn { display: block; padding: 8px 14px; border-radius: 999px; color: var(--ink); text-decoration: none; font: 600 .97rem var(--font); background: none; border: 0; cursor: pointer; }
.nav-links a:hover, .nav-links button.navbtn:hover, .nav-links a.active, .nav-links button.active { background: var(--sage-soft); color: var(--forest); }
.caret { font-size: .7em; margin-left: 4px; opacity: .6; }
.dropdown { position: absolute; top: calc(100% + 6px); left: 0; min-width: 220px; background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lg); padding: 8px; display: none; z-index: 60; }
.dropdown.right { left: auto; right: 0; }
.open > .dropdown { display: block; }
.dropdown a, .dropdown button { display: flex; width: 100%; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px; text-decoration: none; color: var(--ink); font: 600 .94rem var(--font); background: none; border: 0; cursor: pointer; text-align: left; }
.dropdown a:hover, .dropdown button:hover { background: var(--cream); }
.dropdown .ico { width: 22px; text-align: center; }
.dropdown hr { border: 0; border-top: 1px solid var(--line); margin: 6px 4px; }
.nav-right { display: flex; align-items: center; gap: 8px; position: relative; }
.lang { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; background: #fff; }
.lang button { border: 0; background: none; padding: 6px 10px; font: 700 .8rem var(--font); cursor: pointer; color: var(--muted); }
.lang button.on { background: var(--forest); color: #fff; }
.iconbtn { position: relative; width: 40px; height: 40px; display: inline-grid; place-items: center; border-radius: 50%; border: 1px solid var(--line); background: #fff; cursor: pointer; font-size: 1.05rem; }
.iconbtn:hover { border-color: var(--sage); }
.badge { position: absolute; top: -3px; right: -3px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--brown); color: #fff; font-size: .7rem; font-weight: 800; display: grid; place-items: center; }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--honey); color: #fff; font-weight: 800; display: grid; place-items: center; border: 0; cursor: pointer; font-family: var(--font); }
.notif-list { width: 320px; max-height: 380px; overflow: auto; }
.notif-item { padding: 10px 12px; border-radius: 10px; font-size: .9rem; }
.notif-item.unread { background: var(--honey-soft); }
.burger { display: none; }
.has-dd { position: relative; }
@media (max-width: 1100px) {
  .burger { display: inline-grid; }
  .nav-links { display: none; position: absolute; top: 68px; left: 0; right: 0; background: var(--cream); border-bottom: 1px solid var(--line); flex-direction: column; padding: 10px 16px 16px; margin: 0; }
  .nav-links.show { display: flex; }
  .dropdown { position: static; box-shadow: none; border: 0; background: transparent; padding: 0 0 0 14px; }
  .nav-right .hide-sm { display: none; }
  .nav { gap: 10px; }
  .nav-right { margin-left: auto; }
}

/* Cards */
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.card-link { text-decoration: none; color: inherit; display: block; transition: transform .18s, box-shadow .18s, border-color .18s; }
.card-link:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: var(--sage); }
.card h3 { margin-bottom: .35em; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 11px; border-radius: 999px; font-size: .78rem; font-weight: 700; background: var(--cream); color: var(--brown-dark); border: 1px solid var(--line); }
.pill.seed { background: #EEF3F9; color: var(--brown-dark); border-color: #D3DEEC; }
.pill.sprout { background: var(--sage-soft); color: var(--forest); border-color: #C9DBF1; }
.pill.bloom { background: var(--honey-soft); color: #1F4A80; border-color: #C4DAF3; }
.pill.free { background: var(--ok-bg); color: var(--ok); border-color: #cfe6d6; }
.pill.lock { background: #EDF1F6; color: var(--muted); }
.skill-ico { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; font-size: 1.4rem; background: var(--sage-soft); margin-bottom: 14px; }

/* Hero */
.hero { padding: 56px 0 40px; }
.hero-grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: 40px; align-items: center; }
.hero h1 { font-family: var(--logo); font-weight: 700; font-size: clamp(2.6rem, 6vw, 4.2rem); letter-spacing: -.015em; line-height: 1.08; text-wrap: balance; }
.hero .brand { font-family: var(--logo); font-size: 1.15rem; color: var(--brown-dark); font-weight: 600; margin-bottom: 10px; }
.hero-art { background: var(--sage-soft); border-radius: 32px; padding: 30px; display: grid; place-items: center; aspect-ratio: 1.15; position: relative; }
.hero-art .quote { position: absolute; bottom: 18px; left: 50%; transform: translateX(-50%); font-family: var(--logo); color: var(--forest); font-size: 1rem; white-space: nowrap; }
.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 26px; }
.trust { display: flex; gap: 22px; margin-top: 30px; flex-wrap: wrap; color: var(--muted); font-size: .9rem; }
.trust b { color: var(--forest); }
@media (max-width: 800px) { .hero-grid { grid-template-columns: 1fr; } .hero-art { max-width: 420px; margin: 0 auto; width: 100%; } }

/* Course cards */
.course-card { border-radius: 22px; padding: 28px; position: relative; overflow: hidden; border: 1px solid var(--line); display: flex; flex-direction: column; min-height: 100%; }
.course-card.seed { background: linear-gradient(160deg, #F8FAFD, #E4ECF6); }
.course-card.sprout { background: linear-gradient(160deg, #F1F6FC, #D2E2F5); }
.course-card.bloom { background: linear-gradient(160deg, var(--forest), #0F2341); color: #EEF3FA; }
.course-card.bloom h3, .course-card.bloom .cname { color: #fff; }
.course-card .cname { font-family: var(--logo); font-size: 2rem; font-weight: 700; color: var(--forest); letter-spacing: .02em; line-height: 1; }
.course-card .tag { font-style: italic; margin: 6px 0 14px; }
.course-card ul { padding-left: 18px; margin: 10px 0 18px; }
.course-card .lvl { font-weight: 800; font-size: .85rem; }
.course-card .grow { flex: 1; }
.course-card.bloom .btn-ghost { color: #fff; border-color: #fff; }
.course-card.bloom .muted { color: #BFCDE0; }
.course-card .stage { position: absolute; right: 18px; top: 18px; font-size: 2rem; opacity: .9; }
.note { background: var(--honey-soft); border: 1px solid #C4DAF3; border-radius: 12px; padding: 12px 16px; font-size: .92rem; color: #1F3F6B; }
.note.sage { background: var(--sage-soft); border-color: #C9DBF1; color: var(--forest); }

/* Why */
.why { background: #fff; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.why-item { display: flex; gap: 14px; align-items: flex-start; }
.why-num { flex-shrink: 0; width: 38px; height: 38px; border-radius: 50%; background: var(--honey); color: #fff; font-weight: 800; display: grid; place-items: center; }
.sequence { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: center; margin-top: 26px; }
.sequence span { background: var(--cream); border: 1px solid var(--line); padding: 6px 14px; border-radius: 999px; font-weight: 700; font-size: .9rem; color: var(--forest); }
.sequence i { color: var(--sage); font-style: normal; }

/* Footer */
.footer { background: var(--forest); color: #D6E0EE; padding: 48px 0 26px; margin-top: 40px; }
.footer a { color: #EEF3FA; text-decoration: none; }
.footer a:hover { text-decoration: underline; }
.footer h4 { color: #fff; font-size: .95rem; }
.footer ul { list-style: none; padding: 0; margin: 0; }
.footer li { margin-bottom: 8px; font-size: .93rem; }
.footer .fgrid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 30px; }
.footer .legal { border-top: 1px solid rgba(255,255,255,.15); margin-top: 32px; padding-top: 18px; font-size: .8rem; color: #A9B9D0; }
.footer .logo-word { color: #fff; }
@media (max-width: 800px) { .footer .fgrid { grid-template-columns: 1fr 1fr; } }

/* Page header */
.page-head { padding: 40px 0 24px; }
.crumbs { font-size: .86rem; color: var(--muted); margin-bottom: 10px; }
.crumbs a { color: var(--muted); }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin-bottom: 24px; }
.tabs a, .tabs button { padding: 10px 16px; text-decoration: none; color: var(--muted); font: 700 .94rem var(--font); border: 0; background: none; border-bottom: 3px solid transparent; cursor: pointer; margin-bottom: -1px; }
.tabs a.on, .tabs button.on { color: var(--forest); border-bottom-color: var(--forest); }

/* Course page */
.unit { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 16px; overflow: hidden; }
.unit-head { padding: 18px 22px; display: flex; justify-content: space-between; gap: 12px; align-items: center; cursor: pointer; background: none; border: 0; width: 100%; text-align: left; font: inherit; color: inherit; }
.unit-head h3 { margin: 0; }
.unit-body { padding: 0 22px 18px; }
.lesson-row { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); margin-top: 10px; text-decoration: none; color: inherit; background: var(--cream); }
.lesson-row:hover { border-color: var(--sage); background: #fff; }
.lesson-row .tick { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--sage); display: grid; place-items: center; font-size: .85rem; flex-shrink: 0; color: #fff; }
.lesson-row .tick.done { background: var(--sage); }
.lesson-row .grow { flex: 1; }
.progress { height: 8px; background: var(--cream-2); border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--sage); border-radius: 999px; transition: width .4s; }
.progress.honey > span { background: var(--honey); }

/* Lesson player */
.stepper { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0 22px; }
.stepper button { flex: 1; min-width: 88px; border: 1px solid var(--line); background: #fff; border-radius: 12px; padding: 8px 6px; font: 700 .82rem var(--font); color: var(--muted); cursor: pointer; }
.stepper button.on { background: var(--forest); color: #fff; border-color: var(--forest); }
.stepper button.seen:not(.on) { background: var(--sage-soft); color: var(--forest); }
.stepper .n { display: block; font-size: .7rem; opacity: .75; }
.lesson-layout { display: grid; grid-template-columns: 1fr 280px; gap: 24px; align-items: start; }
@media (max-width: 900px) { .lesson-layout { grid-template-columns: 1fr; } }
.side-card { position: sticky; top: 88px; }
.mini-table { border-collapse: collapse; width: 100%; margin: 10px 0; font-size: .95rem; }
.mini-table th, .mini-table td { border: 1px solid var(--line); padding: 8px 10px; text-align: left; }
.mini-table th { background: var(--cream); }
.passage-box { background: var(--cream); border-left: 4px solid var(--sage); padding: 14px 18px; border-radius: 10px; margin: 10px 0; }
.example { background: var(--honey-soft); border-radius: 12px; padding: 14px 18px; margin-top: 12px; }
textarea, input[type=text], input[type=email], input[type=password], input[type=date], input[type=number], select { width: 100%; font: inherit; padding: 11px 14px; border-radius: 12px; border: 1.5px solid var(--line); background: #fff; color: var(--ink); }
textarea:focus, input:focus, select:focus { border-color: var(--sage); outline: none; box-shadow: 0 0 0 3px rgba(106,155,216,.25); }
textarea { min-height: 140px; resize: vertical; line-height: 1.6; }
label { font-weight: 700; font-size: .92rem; display: block; margin-bottom: 6px; color: var(--forest); }
.field { margin-bottom: 16px; }
.confidence { display: flex; gap: 10px; flex-wrap: wrap; margin: 10px 0 16px; }
.confidence button { border: 1.5px solid var(--line); background: #fff; border-radius: 14px; padding: 10px 14px; cursor: pointer; font: 600 .92rem var(--font); }
.confidence button.on { border-color: var(--forest); background: var(--sage-soft); }

/* Exercises */
.ex { border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; margin-bottom: 14px; background: #fff; }
.ex .qn { font-weight: 800; color: var(--brown-dark); margin-right: 6px; }
.ex .q { font-weight: 600; margin-bottom: 10px; }
.opts { display: grid; gap: 8px; }
.opt { display: flex; align-items: center; gap: 10px; border: 1.5px solid var(--line); padding: 9px 14px; border-radius: 12px; cursor: pointer; font-weight: 600; background: #fff; text-align: left; font-family: var(--font); font-size: .95rem; color: var(--ink); }
.opt:hover { border-color: var(--sage); }
.opt.sel { border-color: var(--forest); background: var(--sage-soft); }
.opt.right { border-color: var(--ok); background: var(--ok-bg); }
.opt.wrong { border-color: var(--bad); background: var(--bad-bg); }
.opt .key { width: 24px; height: 24px; border-radius: 50%; border: 1.5px solid currentColor; display: grid; place-items: center; font-size: .75rem; flex-shrink: 0; opacity: .7; }
.opts.inline { grid-template-columns: repeat(3, auto); justify-content: start; }
.gapin { max-width: 320px; }
.gapin.right { border-color: var(--ok); background: var(--ok-bg); }
.gapin.wrong { border-color: var(--bad); background: var(--bad-bg); }
.fb { margin-top: 10px; padding: 9px 13px; border-radius: 10px; font-size: .92rem; display: none; }
.fb.show { display: block; }
.fb.ok { background: var(--ok-bg); color: var(--ok); }
.fb.no { background: var(--bad-bg); color: var(--bad); }
.score-box { display: flex; align-items: center; gap: 18px; padding: 18px 22px; border-radius: 16px; background: var(--sage-soft); margin: 18px 0; flex-wrap: wrap; }
.score-big { font-size: 2.2rem; font-weight: 800; color: var(--forest); line-height: 1; }
.audio-bar { display: flex; align-items: center; gap: 10px; background: var(--forest); color: #fff; padding: 12px 16px; border-radius: 14px; margin-bottom: 16px; flex-wrap: wrap; }
.audio-bar .btn { background: var(--honey); color: #fff; }
.audio-bar select { width: auto; padding: 6px 10px; border-radius: 999px; font-size: .85rem; }
.script { white-space: pre-wrap; background: var(--cream); padding: 14px; border-radius: 12px; font-size: .93rem; display: none; }
.script.show { display: block; }

/* Test runner */
.test-shell { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
.test-shell .pane { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; max-height: calc(100vh - 190px); overflow: auto; }
.test-bar { position: sticky; top: 68px; z-index: 20; background: var(--cream); padding: 12px 0; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.timer { font-variant-numeric: tabular-nums; font-weight: 800; font-size: 1.2rem; background: #fff; border: 1px solid var(--line); padding: 6px 14px; border-radius: 999px; color: var(--forest); }
.timer.low { color: var(--bad); border-color: var(--bad); }
.palette { display: flex; gap: 6px; flex-wrap: wrap; }
.palette button { width: 34px; height: 34px; border-radius: 8px; border: 1.5px solid var(--line); background: #fff; font: 700 .85rem var(--font); cursor: pointer; }
.palette button.answered { background: var(--sage); color: #fff; border-color: var(--sage); }
.palette button.right { background: var(--ok); color: #fff; border-color: var(--ok); }
.palette button.wrong { background: var(--bad); color: #fff; border-color: var(--bad); }
@media (max-width: 900px) { .test-shell { grid-template-columns: 1fr; } .test-shell .pane { max-height: none; } }

/* Flashcard */
.flash { max-width: 520px; margin: 0 auto; perspective: 1000px; }
.flash-card { background: #fff; border: 1px solid var(--line); border-radius: 22px; min-height: 260px; padding: 34px; text-align: center; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; justify-content: center; }
.flash-word { font-family: var(--logo); font-size: 2.3rem; color: var(--forest); }
.boxes { display: flex; gap: 6px; justify-content: center; margin-top: 10px; }
.boxes span { width: 28px; height: 8px; border-radius: 4px; background: var(--cream-2); }
.boxes span.on { background: var(--sage); }

/* Tables */
.table { width: 100%; border-collapse: collapse; font-size: .94rem; }
.table th, .table td { padding: 12px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.table th { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.table-wrap { overflow-x: auto; }
.stat { padding: 20px; }
.stat .num { font-size: 2rem; font-weight: 800; color: var(--forest); line-height: 1.1; }
.stat .lab { color: var(--muted); font-size: .88rem; font-weight: 600; }

/* Auth */
.auth { max-width: 440px; margin: 48px auto; }
.demo-box { margin-top: 18px; padding: 14px; border: 1px dashed var(--sage); border-radius: 12px; background: var(--sage-soft); font-size: .9rem; }
.error { color: var(--bad); font-weight: 700; font-size: .9rem; margin: 6px 0 10px; min-height: 1.2em; }

/* External */
.ext-card { background: linear-gradient(135deg, var(--forest), #234574); color: #fff; border-radius: 22px; padding: 28px; display: grid; grid-template-columns: 1fr auto; gap: 22px; align-items: center; text-decoration: none; }
.ext-card h3 { color: #fff; margin: 0; font-size: 1.4rem; }
.ext-card .big-ico { width: 64px; height: 64px; border-radius: 18px; background: rgba(255,255,255,.12); display: grid; place-items: center; font-size: 2rem; }
.ext-card .tagline { font-family: var(--logo); color: #fff; margin: 4px 0 6px; }
.ext-card .attr { font-size: .8rem; color: #BFCDE0; margin-top: 8px; }
.ext-card:hover { box-shadow: var(--shadow-lg); }
@media (max-width: 700px) { .ext-card { grid-template-columns: 1fr; } }

.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(120px); background: var(--forest); color: #fff; padding: 12px 20px; border-radius: 999px; font-weight: 700; box-shadow: var(--shadow-lg); transition: transform .25s; z-index: 200; max-width: 90vw; }
.toast.show { transform: translateX(-50%) translateY(0); }
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty svg { width: 120px; margin-bottom: 8px; }
.chip-row { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { border: 1.5px solid var(--line); background: #fff; padding: 6px 14px; border-radius: 999px; font: 700 .86rem var(--font); cursor: pointer; color: var(--muted); }
.chip.on { background: var(--forest); color: #fff; border-color: var(--forest); }
.prose { max-width: 72ch; }
.prose h2 { margin-top: 1.4em; }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--bad); display: inline-block; animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .2; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; scroll-behavior: auto !important; } }
.admin-layout { display: grid; grid-template-columns: 220px 1fr; gap: 24px; align-items: start; }
.admin-nav { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; position: sticky; top: 88px; }
.admin-nav a { display: block; padding: 10px 12px; border-radius: 10px; text-decoration: none; color: var(--ink); font-weight: 700; font-size: .94rem; }
.admin-nav a.on, .admin-nav a:hover { background: var(--sage-soft); color: var(--forest); }
@media (max-width: 800px) { .admin-layout { grid-template-columns: 1fr; } .admin-nav { position: static; display: flex; flex-wrap: wrap; } }
details.edit { border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; margin-bottom: 10px; background: var(--cream); }
details.edit summary { cursor: pointer; font-weight: 700; color: var(--forest); }
.crit { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
@media (max-width: 600px) { .crit { grid-template-columns: 1fr 1fr; } }

/* Google sign-in */
.btn-google { background: #fff; color: #1f1f1f; border: 1px solid #c7ccd4; display: inline-flex; align-items: center; justify-content: center; gap: 10px; font-weight: 700; }
.btn-google:hover { background: #f4f7fb; border-color: var(--sage); }
/* Weekly Rank */
.rank-table td.pos { width: 44px; font-weight: 800; color: var(--muted); }
.rank-table tr.top td.pos { color: var(--forest); }
.rank-table tr.me td { background: var(--sage-soft); }
.level-pick { text-align: left; font: inherit; color: inherit; cursor: pointer; border: 1px solid var(--line); }
.nav-links a, .nav-links button.navbtn { white-space: nowrap; }

/* Task 1 model answers */
.model-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 22px; align-items: start; }
@media (max-width: 900px) { .model-layout { grid-template-columns: 1fr; } }
.model-fig { margin: 8px 0 0; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 8px; }
.model-fig + .model-fig { margin-top: 12px; }
.model-fig svg { display: block; width: 100%; height: auto; }
.model-para { border-left: 3px solid var(--sage); padding: 2px 0 2px 14px; margin-top: 14px; }
.model-para p { margin: 4px 0 0; }
.model-tag { font-size: .74rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--brown-dark); }
.check-list { padding-left: 18px; }
.models-banner { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }

/* Lily photo */
.lily-photo { border-radius: 50%; object-fit: cover; object-position: 50% 28%; display: inline-block; max-width: 100%; height: auto; aspect-ratio: 1; }
.avatar.has-photo { padding: 0; overflow: hidden; }
.avatar.has-photo img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 28%; display: block; }
.logo .lily-photo { width: 40px; height: 40px; }

/* Words in Context */
.vr-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 22px; align-items: start; }
.vr-passage-col { position: sticky; top: 84px; max-height: calc(100vh - 100px); overflow: auto; }
@media (max-width: 960px) { .vr-layout { grid-template-columns: 1fr; } .vr-passage-col { position: static; max-height: none; } }
.vr-para { line-height: 1.75; }
.vr-letter { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 6px; background: var(--forest); color: #fff; font-size: .8rem; margin-right: 8px; }
.tw { text-decoration: underline; text-decoration-color: var(--sage); text-decoration-thickness: 2px; text-underline-offset: 3px; }
mark.ev-hl { background: #FFE58A; color: inherit; padding: 1px 2px; border-radius: 3px; }
.vr-sec { margin-bottom: 20px; }
.vr-item { padding: 12px 0; border-top: 1px solid var(--line); }
.vr-item:first-of-type { border-top: 0; }
.vr-q { margin-bottom: 8px; }
.vr-q .qn { font-weight: 800; color: var(--brown-dark); margin-right: 4px; }
.vr-item select { width: 100%; max-width: 100%; }
.vr-fb { margin-top: 10px; padding: 10px 12px; border-radius: 10px; font-size: .92rem; }
.vr-fb.ok { background: var(--ok-bg); color: #1d4d30; }
.vr-fb.bad { background: var(--bad-bg); color: #6b2a1b; }
.vr-fb .linkbtn { margin-top: 6px; color: inherit; }
.vr-box { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px; border: 1px dashed var(--sage); border-radius: 10px; margin-bottom: 12px; }
.vr-box span { background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px; font-size: .9rem; font-weight: 600; }
.vr-summary { background: var(--cream); padding: 12px 14px; border-radius: 10px; line-height: 1.8; }
.vr-summary .gapno { color: var(--forest); }
.vr-result { margin-bottom: 20px; }
.vi-note { font-style: italic; }
.print-only { display: none; }
@media print {
  .topbar, .footer, .no-print, .toast, .vr-fb .linkbtn, .print-hide { display: none !important; }
  .print-only { display: inline; }
  body { background: #fff; font-size: 11.5pt; }
  .wrap { max-width: none; padding: 0; }
  .card { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; }
  .vr-layout { display: block; }
  .vr-passage-col { position: static; max-height: none; overflow: visible; margin-bottom: 14px; }
  .vr-item select { -webkit-appearance: none; appearance: none; border: 0; border-bottom: 1px solid #333; border-radius: 0; background: none; color: transparent; min-height: 22px; }
  .opt { border: 1px solid #999; padding: 4px 10px; }
  .vr-item { break-inside: avoid; }
}

/* Profile pictures */
.av { display: inline-grid; place-items: center; flex: none; border-radius: 50%; background: var(--honey); color: #fff; font-weight: 800; overflow: hidden; line-height: 1; }
.av.has-photo { background: var(--cream-2); }
.av img { width: 100%; height: 100%; object-fit: cover; display: block; }
.av-edit { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.av-edit label.btn { margin: 0; cursor: pointer; }
.rank-who { display: inline-flex; align-items: center; gap: 10px; }
.av-dialog { border: 0; border-radius: 18px; padding: 24px; box-shadow: 0 20px 60px rgba(18, 40, 74, .3); max-width: calc(100vw - 24px); }
.av-dialog::backdrop { background: rgba(18, 40, 74, .45); }
.av-stage { position: relative; margin: 0 auto; border-radius: 12px; overflow: hidden; background: var(--cream-2); touch-action: none; }
.av-stage canvas { display: block; cursor: grab; }
.av-stage canvas:active { cursor: grabbing; }
.av-mask { position: absolute; inset: 0; pointer-events: none; border-radius: 50%; box-shadow: 0 0 0 200px rgba(18, 40, 74, .5); outline: 2px solid #fff; outline-offset: -2px; }
.av-tools { display: flex; align-items: center; gap: 10px; margin-top: 14px; }
.av-tools input[type=range] { flex: 1; accent-color: var(--forest); }

/* ---------- Interactive reading ---------- */
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.rd-root [data-blk] { -webkit-user-select: text; user-select: text; }
mark.uhl { color: inherit; border-radius: 3px; padding: 0 1px; cursor: pointer; }
.hl-yellow { background: #FBE9A6; } .hl-green { background: #CFEBD3; } .hl-blue { background: #CFE2F7; } .hl-pink { background: #F7D4DF; }
mark.uhl.rd-find { background: #FBE9A6; box-shadow: 0 0 0 2px var(--forest); animation: rdPulse 1.2s ease 2; }
@keyframes rdPulse { 50% { box-shadow: 0 0 0 5px rgba(27,54,93,.25); } }
.rd-hint { margin: 0 0 12px; }
.rd-bar { position: fixed; z-index: 60; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; max-width: calc(100vw - 16px); background: var(--forest-2); color: #fff; padding: 6px; border-radius: 12px; box-shadow: var(--shadow-lg); animation: rdIn .14s ease-out; }
@keyframes rdIn { from { opacity: 0; transform: translateY(4px); } }
.rd-bar button { border: 0; background: transparent; color: #fff; font: 700 .84rem var(--font); padding: 8px 10px; border-radius: 8px; cursor: pointer; min-height: 36px; }
.rd-bar button:hover, .rd-bar button:focus-visible { background: rgba(255,255,255,.14); outline: none; }
.rd-colors { display: flex; gap: 2px; padding-right: 4px; margin-right: 2px; border-right: 1px solid rgba(255,255,255,.2); }
.rd-bar .rd-dot { width: 30px; min-height: 30px; padding: 0; display: grid; place-items: center; }
.rd-bar .rd-dot::before { content: ''; width: 18px; height: 18px; border-radius: 50%; background: inherit; border: 2px solid #fff; }
.rd-bar .rd-dot { background: transparent !important; }
.rd-bar .rd-dot.hl-yellow::before { background: #FBE9A6; } .rd-bar .rd-dot.hl-green::before { background: #CFEBD3; } .rd-bar .rd-dot.hl-blue::before { background: #CFE2F7; } .rd-bar .rd-dot.hl-pink::before { background: #F7D4DF; }

/* ---------- Word dialog ---------- */
.wd-dialog { border: 0; border-radius: 18px; padding: 22px; width: min(620px, calc(100vw - 20px)); max-height: calc(100vh - 30px); box-shadow: 0 20px 60px rgba(18,40,74,.3); }
.wd-dialog::backdrop { background: rgba(18,40,74,.45); }
.wd-dialog textarea { min-height: 0; }
.wd-actions { justify-content: flex-end; margin-top: 8px; position: sticky; bottom: -22px; background: #fff; padding: 10px 0 2px; }
.wd-loading { text-align: center; padding: 30px 0; color: var(--muted); }
.spinner { display: inline-block; width: 26px; height: 26px; border-radius: 50%; border: 3px solid var(--cream-2); border-top-color: var(--forest); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.wd-word { font-size: 1.6rem; font-weight: 800; color: var(--forest); }
.wd-mean { font-size: 1.2rem; font-weight: 700; margin-top: 8px; }
.wd-sent { margin-top: 12px; padding: 10px 14px; background: var(--cream); border-radius: 10px; }

/* ---------- Vocabulary dashboard ---------- */
.vstat-row { display: grid; grid-template-columns: repeat(6, minmax(0,1fr)); gap: 12px; }
.vstat-row .stat { padding: 14px 16px; }
.vstat-row .stat .num { font-size: 1.6rem; }
@media (max-width: 900px) { .vstat-row { grid-template-columns: repeat(3, minmax(0,1fr)); } }
@media (max-width: 480px) { .vstat-row { grid-template-columns: repeat(2, minmax(0,1fr)); } }
.plan-row { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.plan-row:first-of-type { border-top: 0; }
.wk-bars { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; height: 120px; align-items: end; border-bottom: 1px solid var(--line); }
.wk-col { position: relative; height: 100%; display: flex; align-items: flex-end; justify-content: center; outline: none; }
.wk-bar { width: min(28px, 70%); min-height: 2px; background: var(--sage); border-radius: 4px 4px 0 0; transition: background .15s; }
.wk-bar.is-today { background: var(--forest); }
.wk-col:hover .wk-bar, .wk-col:focus .wk-bar { background: var(--brown); }
.wk-tip { position: absolute; bottom: calc(100% + 4px); left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; font-size: .78rem; padding: 5px 8px; border-radius: 6px; white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity .12s; z-index: 2; }
.wk-col:hover .wk-tip, .wk-col:focus .wk-tip { opacity: 1; }
.wk-col:first-child .wk-tip { left: 0; transform: none; } .wk-col:last-child .wk-tip { left: auto; right: 0; transform: none; }
.wk-axis { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; text-align: center; font-size: .78rem; color: var(--muted); margin-top: 4px; }

/* ---------- Notebook ---------- */
.nb-tools { display: grid; grid-template-columns: 2fr repeat(5, 1fr); gap: 8px; margin-bottom: 14px; }
@media (max-width: 900px) { .nb-tools { grid-template-columns: 1fr 1fr; } .nb-tools input { grid-column: 1 / -1; } }
.nb-list { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; margin-bottom: 14px; }
@media (max-width: 760px) { .nb-list { grid-template-columns: 1fr; } }
.nb-item { padding: 16px 18px; display: flex; flex-direction: column; gap: 4px; }
.nb-word { font-size: 1.15rem; color: var(--forest); }
.nb-mean { font-weight: 700; }
.nb-sent { background: var(--cream); padding: 6px 10px; border-radius: 8px; margin: 4px 0; }
.nb-foot { margin-top: auto; padding-top: 8px; gap: 8px; flex-wrap: wrap; }
.nb-status { width: auto; padding: 4px 8px; font-size: .82rem; }
.vtable td { vertical-align: top; }

/* ---------- Flashcards ---------- */
.fc-wrap { max-width: 640px; margin: 0 auto; }
.fc-top { gap: 10px; flex-wrap: wrap; }
.fc-card { background: #fff; border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); min-height: 230px; padding: 28px 24px; display: flex; flex-direction: column; justify-content: center; text-align: center; cursor: pointer; animation: fcIn .2s ease-out; }
.fc-card.is-flipped { background: var(--sage-soft); }
.fc-card:focus-visible { outline: 3px solid var(--sage); outline-offset: 2px; }
@keyframes fcIn { from { opacity: .4; transform: rotateX(8deg); } }
.fc-word { font-size: 2rem; font-weight: 800; color: var(--forest); }
.fc-mean { font-size: 1.4rem; font-weight: 700; }
.fc-sub { color: var(--muted); margin: 4px 0; }
.fc-ex { margin-top: 12px; font-size: .95rem; }
.fc-hint { margin-top: 14px; }
.fc-own { margin-top: 14px; text-align: left; }
.fc-own input { margin-top: 4px; }
.fc-rate { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 14px; }
.fc-rate .btn { flex-direction: column; gap: 0; padding: 8px 6px; line-height: 1.2; }
.fc-rate .btn span { font-size: .75rem; font-weight: 600; opacity: .8; }
.fc-r-again { background: var(--bad-bg); color: var(--bad); } .fc-r-hard { background: #f6eedc; color: #7a5a12; } .fc-r-good { background: var(--ok-bg); color: var(--ok); } .fc-r-easy { background: var(--sage-soft); color: var(--forest); }
.fc-ctrl { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; margin-top: 16px; }
.fc-done { max-width: 640px; margin: 0 auto; }

/* ---------- Quiz ---------- */
.quiz-run, .quiz-setup, .quiz-res { max-width: 760px; margin: 0 auto; }
.q-ctx { background: var(--cream); padding: 10px 14px; border-radius: 10px; margin: 6px 0 12px; }
.q-mask { font-family: ui-monospace, Menlo, monospace; font-size: 1.15rem; letter-spacing: .08em; }
.conf-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 14px; }
.conf-row .chip { padding: 4px 12px; }
.match { display: grid; gap: 8px; }
.match-row { display: grid; grid-template-columns: minmax(110px, .6fr) 1.4fr; gap: 10px; align-items: center; }
.match-row select.right { border-color: var(--ok); background: var(--ok-bg); } .match-row select.wrong { border-color: var(--bad); background: var(--bad-bg); }
.res-row { padding: 10px 12px; border-left: 3px solid var(--line); margin-bottom: 8px; background: var(--cream); border-radius: 0 8px 8px 0; }
.res-row.ok { border-left-color: var(--ok); } .res-row.bad { border-left-color: var(--bad); }
.chip:disabled { opacity: .45; cursor: not-allowed; }
.unit-tabs { overflow-x: auto; flex-wrap: nowrap; }
.unit-tabs a { white-space: nowrap; }
@media print { .rd-bar, .rd-hint { display: none !important; } mark.uhl { background: none; } }
.rd-bar[hidden] { display: none; }
@media (max-width: 960px) { .vr-layout { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 440px) { .logo-sub { font-size: .74rem; margin-top: 2px; } .nav { gap: 6px; } .nav-right { gap: 4px; } .logo .lily-photo { width: 34px; height: 34px; } }
@media (max-width: 440px) { .nav .wrap, header .wrap { padding: 0 12px; } .logo-word { font-size: 1.2rem; } .lang button { padding: 5px 7px; } .logo { gap: 7px; } }

/* Teacher photo: the white ring sits exactly on the photo, so it is always centred */
.hero-art .lily-photo { width: min(320px, 78%); box-shadow: 0 0 0 12px #fff, 0 14px 30px rgba(27,54,93,.12); }
.lily-photo.is-edited { object-position: 50% 50%; }

/* Banner under the homepage headline */
/* full content width; trims only the empty navy space above and below the artwork */
.hero-banner { display: block; width: 100%; height: auto; aspect-ratio: 2.1 / 1; object-fit: cover; object-position: 50% 55%; border-radius: 20px; margin: 22px 0 26px; box-shadow: 0 14px 30px rgba(27,54,93,.14); }
@media (max-width: 600px) { .hero-banner { border-radius: 14px; margin: 16px 0 20px; } }
.hero-grid.hero-single { grid-template-columns: minmax(0, 1fr); }
.sync-status { position: fixed; left: 16px; bottom: 16px; z-index: 90; background: #fff; border: 1px solid var(--line); box-shadow: var(--shadow); border-radius: 999px; padding: 6px 14px; font-size: .82rem; font-weight: 700; color: var(--muted); }
.sync-status.saved { color: var(--ok); }
.sync-status.error { color: var(--bad); border-color: var(--bad); }

.pw-wrap { position: relative; }
.pw-wrap input { width: 100%; padding-right: 46px; }
.pw-eye { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); background: none; border: 0; padding: 6px; cursor: pointer; color: var(--muted); display: grid; place-items: center; border-radius: 8px; }
.pw-eye:hover, .pw-eye:focus-visible { color: var(--forest); background: var(--cream); }
