/* CFLI learning platform. Mirrors the "04 · LMS v2" frames in Figma:
   one family (Plus Jakarta Sans), cool neutral canvas, navy ink, one red accent.
   Radius rule: buttons are pills, cards 12px, inputs and options 8-10px. */

:root {
  --canvas: #F4F5F1;
  --surface: #FFFFFF;
  --tint: #E8ECF2;
  --ink: #0B1B3A;
  --muted: #4B5568;
  --soft: #6B7385;
  --line: #D9DDE3;
  --accent: #C8281C;
  --accent-bg: #FBEAE8;
  --success: #1E7A4C;
  --success-bg: #E7F3EC;
  --warning: #9A5B00;
  --warning-bg: #FBF1DE;
  --focus: #1846A3;
  --sans: "Plus Jakarta Sans", "Noto Sans Thai", "Noto Sans Khmer", "Noto Sans Lao", "Noto Sans Myanmar", system-ui, -apple-system, "Segoe UI", sans-serif;
  --ease: cubic-bezier(.16, 1, .3, 1);
  --nav-h: 64px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--sans); font-size: 16px; line-height: 1.55; color: var(--ink); background: var(--canvas); -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4, p, ul, ol, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: inherit; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
img { display: block; max-width: 100%; }
svg.i { width: 20px; height: 20px; flex: none; fill: currentColor; }
svg.i--sm { width: 16px; height: 16px; }
svg.i--lg { width: 24px; height: 24px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }

/* Type */
.t-xl { font-size: clamp(30px, 3.2vw, 40px); line-height: 1.15; font-weight: 600; letter-spacing: -0.02em; text-wrap: balance; }
.t-l { font-size: clamp(22px, 2.2vw, 28px); line-height: 1.25; font-weight: 600; letter-spacing: -0.015em; text-wrap: balance; }
.t-m { font-size: 20px; line-height: 1.35; font-weight: 600; letter-spacing: -0.005em; }
.t-s { font-size: 16px; line-height: 1.45; font-weight: 600; }
.t-read { font-size: 18px; line-height: 1.65; color: var(--muted); text-wrap: pretty; }
.t-body { font-size: 16px; line-height: 1.55; }
.t-small { font-size: 14px; line-height: 1.5; }
.t-label { font-size: 13px; line-height: 1.4; font-weight: 500; color: var(--muted); }
.t-num { font-size: 32px; line-height: 1.1; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.accent { color: var(--accent); }
.ok { color: var(--success); }
.warn { color: var(--warning); }
.stack { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; }
.gap-4 { gap: 4px; } .gap-8 { gap: 8px; } .gap-10 { gap: 10px; } .gap-20 { gap: 20px; } .gap-28 { gap: 28px; } .gap-56 { gap: 56px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; } .gap-24 { gap: 24px; } .gap-32 { gap: 32px; } .gap-40 { gap: 40px; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1 1 auto; min-width: 0; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 22px; border-radius: 999px; border: 1px solid transparent; font-weight: 500; font-size: 16px; line-height: 1.2; text-decoration: none; white-space: nowrap; transition: transform .15s var(--ease), background-color .15s, border-color .15s, color .15s; }
.btn:active { transform: scale(.98); }
.btn--primary { background: var(--accent); color: #fff; }
.btn--primary:hover { background: #B22216; }
.btn--secondary { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn--secondary:hover { border-color: var(--ink); }
.btn--dark { background: var(--ink); color: #fff; }
.btn--quiet { background: transparent; color: var(--ink); padding-inline: 8px; }
.btn--sm { min-height: 36px; padding: 7px 16px; font-size: 14px; }
.btn[disabled], .btn[aria-disabled="true"] { background: var(--tint); color: var(--soft); border-color: transparent; cursor: not-allowed; transform: none; }
.btn--block { width: 100%; }
.link { display: inline-flex; align-items: center; gap: 6px; color: var(--accent); font-weight: 500; font-size: 14px; text-decoration: none; background: none; border: 0; padding: 0; }
.link:hover { text-decoration: underline; text-underline-offset: 3px; }
.link--ink { color: var(--ink); }

/* Top bar */
.topbar { position: sticky; top: 0; z-index: 20; height: var(--nav-h); background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar__in { height: 100%; display: flex; align-items: center; justify-content: space-between; padding: 0 48px; gap: 24px; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.brand img { width: 32px; height: 32px; }
.brand__t { display: flex; flex-direction: column; font-size: 14px; line-height: 1.3; font-weight: 700; }
.brand__t span { font-size: 12px; font-weight: 500; color: var(--muted); }
.navlinks { display: flex; gap: 28px; height: 100%; }
.navlinks a { display: flex; align-items: center; height: 100%; font-size: 14px; font-weight: 500; color: var(--muted); text-decoration: none; border-bottom: 2px solid transparent; padding-top: 2px; }
.navlinks a:hover { color: var(--ink); }
.navlinks a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); }
.topbar__right { display: flex; align-items: center; gap: 16px; }
.pts { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 500; color: var(--muted); text-decoration: none; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--tint); display: grid; place-items: center; font-size: 13px; font-weight: 600; border: 0; }
.menu { position: relative; }
.menu__pop { position: absolute; right: 0; top: calc(100% + 8px); min-width: 220px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 8px; box-shadow: 0 12px 32px rgba(11, 27, 58, .1); }
.menu__pop a, .menu__pop button { display: flex; width: 100%; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px; border: 0; background: none; font-size: 14px; text-align: left; text-decoration: none; }
.menu__pop a:hover, .menu__pop button:hover { background: var(--tint); }

/* Layout */
.page { max-width: 1440px; margin: 0 auto; padding: 48px 120px 96px; }
.cols { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 48px; align-items: start; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 24px; }
.panel--flush { padding: 0; }
.panel--tint { background: var(--tint); border-color: transparent; }
.hair { height: 1px; background: var(--line); border: 0; margin: 0; }
.crumbs { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font-size: 14px; color: var(--muted); }
.crumbs a { text-decoration: none; }
.crumbs a:hover { color: var(--ink); }
.crumbs [aria-current] { color: var(--ink); }
.photo { border-radius: 10px; object-fit: cover; background: var(--tint); }
.bar { height: 4px; border-radius: 2px; background: var(--line); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: inherit; transition: width .6s var(--ease); }
.bar--ink > i { background: var(--ink); }
.bar--ok > i { background: var(--success); }

/* Home */
.resume { display: flex; align-items: center; gap: 28px; padding: 20px; }
.resume img { width: 220px; height: 148px; }
.mrow { display: flex; align-items: center; gap: 20px; padding: 18px 24px; border-bottom: 1px solid var(--line); text-decoration: none; }
.mrow:last-child { border-bottom: 0; }
a.mrow:hover { background: #FAFBFC; }
.mrow__n { width: 36px; font-size: 20px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.mrow--current .mrow__n { color: var(--accent); }
.mrow--locked { color: var(--muted); }
.mrow__status { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); white-space: nowrap; }
.pathpick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }

/* Module overview */
.mhead { display: grid; grid-template-columns: minmax(0, 1fr) 440px; gap: 64px; align-items: center; }
.facts { display: flex; flex-wrap: wrap; gap: 8px 24px; font-size: 14px; font-weight: 500; }
.facts span { display: inline-flex; align-items: center; gap: 6px; }
.facts svg { color: var(--muted); }
.vclip { width: 100%; aspect-ratio: 16 / 9; border-radius: 10px; background: var(--ink); display: block; }
.vclip::cue { font-family: inherit; font-size: 0.95em; line-height: 1.35; background: rgba(11, 27, 58, .78); color: #fff; }
.vsubs { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 500; }
.vsubs select { height: 36px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.vthumb { position: relative; border-radius: 10px; overflow: hidden; }
.vthumb img { width: 100%; aspect-ratio: 440 / 260; object-fit: cover; }
.play { position: absolute; inset: 0; margin: auto; width: 64px; height: 64px; border-radius: 50%; background: #fff; border: 0; display: grid; place-items: center; color: var(--ink); box-shadow: 0 6px 20px rgba(0,0,0,.18); }
.olist { counter-reset: o; display: flex; flex-direction: column; gap: 14px; }
.olist li { display: grid; grid-template-columns: 24px 1fr; gap: 12px; }
.olist li::before { counter-increment: o; content: counter(o); color: var(--accent); font-weight: 600; }
.lessons-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 28px 48px; }
.lesson-link { display: grid; grid-template-columns: 28px 1fr auto; gap: 8px; align-items: center; padding: 6px 0; font-size: 14px; text-decoration: none; }
.lesson-link:hover span:nth-child(2) { text-decoration: underline; text-underline-offset: 3px; }

/* Lesson shell */
.lshell { display: grid; grid-template-columns: 320px minmax(0, 1fr); min-height: calc(100vh - var(--nav-h)); }
.side { background: var(--surface); border-right: 1px solid var(--line); padding: 28px 20px 40px; position: sticky; top: var(--nav-h); height: calc(100vh - var(--nav-h)); overflow-y: auto; }
.side__group { display: flex; flex-direction: column; gap: 2px; margin-top: 22px; }
.side__group h3 { font-size: 14px; font-weight: 500; margin-bottom: 4px; }
.side a.item { display: grid; grid-template-columns: 24px 1fr auto; gap: 10px; align-items: center; padding: 7px 10px; border-radius: 6px; font-size: 14px; line-height: 1.35; text-decoration: none; }
.side a.item:hover { background: var(--canvas); }
.side a.item[aria-current="page"] { background: var(--tint); font-weight: 500; }
.side a.item.is-done { color: var(--muted); }
.side .num { font-size: 13px; font-weight: 500; color: var(--muted); font-variant-numeric: tabular-nums; }
.side .tag { font-size: 12px; color: var(--muted); }
.lmain { padding: 48px 96px 96px; }
.lcol { max-width: 760px; display: flex; flex-direction: column; gap: 28px; }
.lfoot { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 24px; border-top: 1px solid var(--line); margin-top: 12px; }
.lfoot__prev { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 14px; text-decoration: none; max-width: 50%; }
.lfoot__prev:hover { color: var(--ink); }
.side-toggle { display: none; }
.toast { position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px); opacity: 0; background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 999px; font-size: 14px; display: flex; align-items: center; gap: 10px; z-index: 50; transition: opacity .3s, transform .3s var(--ease); pointer-events: none; }
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* Lesson building blocks */
.kicker { font-size: 14px; font-weight: 500; color: var(--accent); }
.lead-def { font-size: 20px; line-height: 1.5; font-weight: 500; text-wrap: pretty; }
.takeaway { background: var(--tint); border-radius: 12px; padding: 20px 24px; display: flex; flex-direction: column; gap: 6px; }
.takeaway b { font-size: 14px; font-weight: 500; }
.takeaway p { font-size: 18px; line-height: 1.5; font-weight: 600; text-wrap: pretty; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; }
.dotlist { display: flex; flex-direction: column; gap: 10px; }
.dotlist li { position: relative; padding-left: 18px; }
.dotlist li::before { content: ""; position: absolute; left: 0; top: .7em; width: 6px; height: 6px; border-radius: 50%; background: var(--line); }
.dotlist--accent li::before { background: var(--accent); }
.ask { border-left: 2px solid var(--accent); padding-left: 14px; }
.chiprow { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 8px 16px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-size: 14px; font-weight: 500; transition: border-color .15s, background-color .15s; }
.chip:hover { border-color: var(--ink); }
.chip[aria-pressed="true"], .chip[aria-selected="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }

/* Options (radio-like answers) */
.opts { display: flex; flex-direction: column; gap: 10px; }
.opt { display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; padding: 14px 16px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); font-size: 16px; line-height: 1.45; transition: border-color .15s, background-color .15s; }
.opt:hover:not([disabled]) { border-color: var(--ink); }
.opt__mark { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--line); flex: none; display: grid; place-items: center; background: #fff; }
.opt__letter { font-size: 14px; font-weight: 500; color: var(--muted); }
.opt[aria-checked="true"] { border: 2px solid var(--ink); padding: 13px 15px; }
.opt[aria-checked="true"] .opt__mark { border-color: var(--ink); }
.opt[aria-checked="true"] .opt__mark::after { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--ink); }
.opt.is-correct { border: 2px solid var(--success); background: var(--success-bg); padding: 13px 15px; }
.opt.is-correct .opt__mark { background: var(--success); border-color: var(--success); color: #fff; }
.opt.is-wrong { border: 2px solid var(--warning); background: var(--warning-bg); padding: 13px 15px; }
.opt.is-wrong .opt__mark { background: var(--warning); border-color: var(--warning); color: #fff; }
.opt.is-dim { color: var(--muted); }
.opt[disabled] { cursor: default; }
.opt .opt__mark svg { width: 12px; height: 12px; }

/* Feedback */
.fb { border-radius: 12px; padding: 20px 24px; display: flex; flex-direction: column; gap: 10px; animation: rise .4s var(--ease); }
.fb--ok { background: var(--success-bg); }
.fb--warn { background: var(--warning-bg); }
.fb--plain { background: var(--surface); border: 1px solid var(--line); }
.fb h3 { display: flex; align-items: center; gap: 10px; font-size: 18px; font-weight: 600; }
.fb--ok h3 { color: var(--success); }
.fb--warn h3 { color: var(--warning); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* Forms */
.field { display: flex; flex-direction: column; gap: 8px; }
.field > span { font-size: 14px; font-weight: 500; }
.field small { font-size: 14px; color: var(--muted); }
.input, .textarea, .select { width: 100%; border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 12px 14px; font-size: 16px; line-height: 1.45; transition: border-color .15s, box-shadow .15s; }
.textarea { min-height: 96px; resize: vertical; }
.input:focus, .textarea:focus, .select:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.input::placeholder, .textarea::placeholder { color: #7A8293; }
.saved { font-size: 13px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.check { display: flex; gap: 12px; align-items: flex-start; font-size: 15px; line-height: 1.5; cursor: pointer; }
.check input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--ink); flex: none; }

/* Process / flow */
.flow { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 0; position: relative; }
.flow__step { position: relative; display: flex; flex-direction: column; gap: 10px; padding: 0 12px 0 0; text-align: left; background: none; border: 0; }
.flow__dot { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); display: grid; place-items: center; font-size: 14px; font-weight: 600; position: relative; z-index: 1; transition: background-color .2s, color .2s, border-color .2s; }
.flow__step::before { content: ""; position: absolute; top: 18px; left: 36px; right: 0; height: 1px; background: var(--line); }
.flow__step:last-child::before { display: none; }
.flow__step[aria-selected="true"] .flow__dot { background: var(--ink); border-color: var(--ink); color: #fff; }
.flow__step.is-seen .flow__dot { border-color: var(--ink); }
.flow__label { font-size: 14px; font-weight: 600; line-height: 1.35; padding-right: 8px; }
.flow__detail { margin-top: 4px; min-height: 96px; }

/* Compare explorer */
.cmp { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 0; }
.cmp__tabs { display: flex; flex-direction: column; border-right: 1px solid var(--line); padding: 8px; gap: 2px; }
.cmp__tab { text-align: left; border: 0; background: none; padding: 12px 14px; border-radius: 8px; font-size: 15px; font-weight: 500; color: var(--muted); }
.cmp__tab:hover { color: var(--ink); background: var(--canvas); }
.cmp__tab[aria-selected="true"] { background: var(--tint); color: var(--ink); }
.cmp__body { padding: 24px 28px; display: flex; flex-direction: column; gap: 18px; }
.cmp__cell b { display: block; font-size: 13px; font-weight: 500; color: var(--muted); margin-bottom: 2px; }

/* Cards that flip (review) */
.ideas { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.idea { min-height: 150px; perspective: 900px; border: 0; padding: 0; background: none; text-align: left; }
.idea__in { position: relative; width: 100%; height: 100%; min-height: 150px; transition: transform .6s var(--ease); transform-style: preserve-3d; }
.idea.is-flipped .idea__in { transform: rotateY(180deg); }
.idea__f, .idea__b { position: absolute; inset: 0; backface-visibility: hidden; border-radius: 12px; padding: 20px; display: flex; flex-direction: column; gap: 8px; }
.idea__f { background: var(--surface); border: 1px solid var(--line); justify-content: space-between; }
.idea__b { background: var(--ink); color: #fff; transform: rotateY(180deg); font-size: 15px; line-height: 1.5; }

/* Games and sorters */
.sorter__item { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 20px 24px; display: flex; flex-direction: column; gap: 14px; }
.buckets { display: grid; grid-template-columns: repeat(var(--n, 3), 1fr); gap: 12px; }
.bucket { border: 1px dashed var(--line); border-radius: 12px; padding: 14px; min-height: 120px; display: flex; flex-direction: column; gap: 8px; background: rgba(255,255,255,.5); }
.bucket h4 { font-size: 14px; font-weight: 600; display: flex; justify-content: space-between; }
.token { font-size: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; display: flex; gap: 8px; align-items: flex-start; animation: rise .35s var(--ease); }
.token.is-ok { border-color: var(--success); background: var(--success-bg); }
.token.is-bad { border-color: var(--warning); background: var(--warning-bg); }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; }
.seg i { height: 4px; border-radius: 2px; background: var(--line); transition: background-color .3s; }
.seg i.is-ok { background: var(--success); }
.seg i.is-bad { background: var(--warning); }
.seg i.is-cur { background: var(--ink); }
.msg { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 20px 24px; display: flex; flex-direction: column; gap: 8px; }
.msg p { font-size: 18px; line-height: 1.55; }
.score-big { display: flex; align-items: baseline; gap: 8px; }

/* Visualisation canvas */
.viz { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 24px; display: flex; flex-direction: column; gap: 20px; }
.viz__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.viz__head h3 { font-size: 16px; font-weight: 600; }
.viz__head p { font-size: 14px; color: var(--muted); }
.viz svg text { font-family: var(--sans); }
.pipe { display: grid; grid-template-columns: 1fr 56px 1.1fr 56px 1fr; align-items: stretch; }
.pipe__col { border: 1px solid var(--line); border-radius: 10px; padding: 16px; display: flex; flex-direction: column; gap: 10px; background: var(--canvas); }
.pipe__col h4 { font-size: 13px; font-weight: 500; color: var(--muted); }
.pipe__arrow { display: grid; place-items: center; color: var(--muted); }
.pipe__model { background: var(--ink); color: #fff; border-color: var(--ink); }
.pipe__model h4 { color: #B9C3DA; }
.toggle { display: flex; align-items: center; gap: 10px; font-size: 14px; cursor: pointer; }
.toggle input { appearance: none; width: 36px; height: 20px; border-radius: 999px; background: var(--line); position: relative; transition: background-color .2s; flex: none; margin: 0; cursor: pointer; }
.toggle input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .2s var(--ease); }
.toggle input:checked { background: var(--ink); }
.toggle input:checked::after { transform: translateX(16px); }
.meter { display: flex; flex-direction: column; gap: 8px; }
.meter__track { height: 10px; border-radius: 5px; background: var(--tint); overflow: hidden; }
.meter__fill { height: 100%; border-radius: 5px; background: var(--ink); transition: width .5s var(--ease), background-color .3s; }
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.tile { border: 1px solid var(--line); background: var(--surface); border-radius: 12px; padding: 16px; display: flex; flex-direction: column; gap: 10px; text-align: left; transition: border-color .15s, background-color .15s; }
.tile:hover { border-color: var(--ink); }
.tile[aria-pressed="true"] { border-color: var(--ink); background: var(--tint); }
.tile__ic { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: var(--canvas); }
.layers { display: flex; flex-direction: column; gap: 6px; }
.layer { border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 14px 16px; text-align: left; display: grid; grid-template-columns: 28px 1fr; gap: 12px; transition: margin .3s var(--ease), background-color .2s, border-color .2s; }
.layer[aria-expanded="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
.letter { background: #FCFCFD; border: 1px solid var(--line); border-radius: 10px; padding: 24px 28px; font-size: 15px; line-height: 1.7; white-space: pre-wrap; }
.letter mark { background: var(--warning-bg); color: inherit; border-radius: 3px; padding: 0 2px; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.claim { background: none; border: 0; border-bottom: 2px dashed var(--line); padding: 0 1px; font: inherit; text-align: left; }
.claim:hover { border-bottom-color: var(--ink); }
.claim.is-found { border-bottom: 2px solid var(--accent); background: var(--accent-bg); }
.claim.is-ok { border-bottom-color: var(--success); background: var(--success-bg); }
.idcard { position: relative; width: 100%; max-width: 420px; aspect-ratio: 1.586; border-radius: 14px; background: linear-gradient(135deg, #E8ECF2, #F7F8FA); border: 1px solid var(--line); padding: 18px; display: grid; grid-template-columns: 96px 1fr; gap: 16px; overflow: hidden; }
.idcard__photo { background: #CBD2DC; border-radius: 8px; }
.idcard__lines { display: flex; flex-direction: column; gap: 8px; padding-top: 4px; }
.idcard__lines i { display: block; height: 8px; border-radius: 4px; background: #CBD2DC; }
.idcard__wm { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.idcard__wm span { transform: rotate(-18deg); color: rgba(200, 40, 28, .55); font-weight: 700; font-size: 15px; text-align: center; line-height: 1.4; max-width: 90%; border: 2px solid rgba(200, 40, 28, .45); padding: 6px 10px; border-radius: 6px; }

/* Focus mode (quiz) */
.focusbar { position: sticky; top: 0; z-index: 20; height: var(--nav-h); background: var(--surface); border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; padding: 0 48px; }
.focus { max-width: 720px; margin: 0 auto; padding: 56px 24px 96px; display: flex; flex-direction: column; gap: 24px; }
.focus--wide { max-width: 1000px; display: grid; grid-template-columns: minmax(0, 1fr) 200px; gap: 64px; align-items: start; }
.qnav { display: grid; grid-template-columns: repeat(4, 40px); gap: 8px; }
.qnav button { width: 40px; height: 40px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); font-size: 14px; font-weight: 500; color: var(--muted); }
.qnav button.is-answered { background: var(--ink); border-color: var(--ink); color: #fff; }
.qnav button[aria-current="true"] { border: 2px solid var(--accent); color: var(--ink); }
.qnav button.is-answered[aria-current="true"] { background: var(--ink); color: #fff; }
.topic-bars { display: flex; flex-direction: column; gap: 10px; }
.topic-bars .tb { display: grid; grid-template-columns: 200px 1fr 48px; gap: 12px; align-items: center; font-size: 14px; }
.tb__track { display: flex; gap: 4px; }
.tb__track i { height: 12px; flex: 1; border-radius: 3px; background: var(--line); }
.tb__track i.is-ok { background: var(--success); }
.tb__track i.is-bad { background: var(--warning); }

/* Progress page */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 24px 0; }
.stats > div { padding: 4px 24px; border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px; }
.stats > div:last-child { border-right: 0; }
.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 20px; }
.badge { display: flex; align-items: center; gap: 12px; }
.badge__ic { width: 44px; height: 44px; border-radius: 50%; background: var(--tint); display: grid; place-items: center; flex: none; }
.badge.is-locked .badge__ic { background: var(--canvas); border: 1px solid var(--line); color: var(--soft); }
.badge.is-locked b { color: var(--muted); }

/* Video gate */
.vplayer { position: relative; border-radius: 12px; overflow: hidden; background: var(--ink); }
.vplayer img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; opacity: .9; }
.vplayer__bar { display: flex; align-items: center; gap: 16px; padding: 14px 20px; background: var(--ink); color: #fff; font-size: 14px; font-weight: 500; }
.vplayer__bar .bar { flex: 1; background: rgba(255,255,255,.2); }
.vplayer__bar .bar > i { background: #fff; }
.vplayer__bar button { background: none; border: 0; color: #fff; display: grid; place-items: center; padding: 0; }
.vplayer__cap { position: absolute; left: 24px; right: 24px; bottom: 76px; color: #fff; font-size: 18px; font-weight: 500; text-shadow: 0 1px 8px rgba(0,0,0,.6); text-align: center; }

/* Certificate */
.cert { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 48px; display: flex; flex-direction: column; gap: 48px; }
.gate { min-height: calc(100vh - var(--nav-h)); display: grid; place-items: center; padding: 48px 24px; }

/* Bottom tab bar (mobile) */
.tabbar { display: none; }

@media (max-width: 1180px) {
  .page { padding: 40px 48px 96px; }
  .lmain { padding: 40px 48px 96px; }
  .cols { grid-template-columns: 1fr; }
  .mhead { grid-template-columns: 1fr; gap: 32px; }
}

@media (max-width: 900px) {
  .navlinks { display: none; }
  .topbar__in { padding: 0 16px; }
  .brand__t { display: none; }
  .page { padding: 24px 16px 120px; }
  .lshell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: var(--nav-h) 0 0 0; height: auto; z-index: 30; transform: translateX(-100%); transition: transform .3s var(--ease); border-right: 0; }
  .side.is-open { transform: none; }
  .side-toggle { display: inline-flex; }
  .lmain { padding: 20px 16px 120px; }
  .lfoot { position: fixed; left: 0; right: 0; bottom: 0; background: var(--surface); padding: 12px 16px 24px; margin: 0; z-index: 15; }
  .lfoot__prev span { display: none; }
  .lfoot .btn--primary, .lfoot .btn[disabled] { flex: 1; }
  .two, .lessons-grid, .pathpick { grid-template-columns: 1fr; gap: 20px; }
  .resume { flex-direction: column; align-items: stretch; }
  .resume img { width: 100%; height: 160px; }
  .mrow { padding: 14px 16px; gap: 12px; }
  .mrow__n { width: 24px; font-size: 15px; }
  .mrow__status .t-small { display: none; }
  .cmp { grid-template-columns: 1fr; }
  .cmp__tabs { flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .cmp__tab { white-space: nowrap; }
  .flow { grid-auto-flow: row; gap: 12px; }
  .flow__step { flex-direction: row; align-items: center; }
  .flow__step::before { display: none; }
  .pipe { grid-template-columns: 1fr; gap: 8px; }
  .pipe__arrow { transform: rotate(90deg); height: 28px; }
  .buckets { grid-template-columns: 1fr; }
  .tiles { grid-template-columns: repeat(2, 1fr); }
  .stats { grid-template-columns: 1fr 1fr; gap: 16px 0; }
  .stats > div:nth-child(2) { border-right: 0; }
  .focus--wide { grid-template-columns: 1fr; gap: 32px; }
  .focusbar { padding: 0 16px; }
  .topic-bars .tb { grid-template-columns: 1fr 80px 40px; }
  .cert { padding: 28px 20px; }
  .tabbar { display: grid; grid-template-columns: repeat(4, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 15; background: var(--surface); border-top: 1px solid var(--line); padding: 8px 8px 22px; }
  .tabbar a { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 12px; font-weight: 500; color: var(--muted); text-decoration: none; }
  .tabbar a[aria-current="page"] { color: var(--accent); }
  body.is-lesson .tabbar, body.is-focus .tabbar { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

@media (max-width: 1100px) {
  .pathways { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
  .pathways > :nth-child(4) { grid-column: 1 / -1; min-height: 64px; }
  .journey { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
}
@media (max-width: 900px) {
  .plan-grid { grid-template-columns: 1fr !important; }
}

@media print {
  .topbar, .tabbar, aside, .toast, .btn { display: none !important; }
  body { background: #fff; }
  .page { padding: 0; }
  .cols { display: block; }
  .cert { border: 1px solid #999; break-inside: avoid; }
}

/* Language menu */
.lang-menu { position: relative; }
.lang-btn { display: inline-flex; align-items: center; gap: 6px; background: none; border: 0; font-size: 14px; font-weight: 500; color: var(--muted); padding: 6px 4px; }
.lang-btn:hover { color: var(--ink); }
.lang-pop { position: absolute; right: 0; top: calc(100% + 8px); min-width: 200px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 6px; box-shadow: 0 12px 32px rgba(11, 27, 58, .1); z-index: 30; }
.lang-pop button { display: flex; width: 100%; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 12px; border: 0; background: none; border-radius: 8px; font-size: 15px; text-align: left; }
.lang-pop button:hover { background: var(--tint); }
.lang-pop button[aria-current="true"] { font-weight: 600; color: var(--accent); }
/* Scripts with tall glyphs need a little more line height */
:lang(th) body, :lang(km) body, :lang(lo) body, :lang(my) body { line-height: 1.7; }
:lang(my) .t-xl, :lang(my) .t-l, :lang(km) .t-xl, :lang(km) .t-l { line-height: 1.45; }
