/* Design preview v2 — "premium professional learning".
   Warm white, charcoal text, warm-grey hairlines, ONE accent (HKCT navy) for primary actions, selection and progress.
   Gold survives only inside the HKCT logo mark. Dark surfaces are reserved for the video viewing area.
   Everything is scoped to body.v2 so the current design is untouched until approved. */
body.v2 {
  --bg: #faf9f7; --surface: #ffffff; --ink: #1f2328; --ink-2: #4a505c; --ink-3: #6b7280;
  --line: #e8e5e0; --line-2: #d8d4cd;
  /* accent = the blue in the HKCT logo (#1145B6), so buttons and links match the logo beside them */
  --accent: #1145b6; --accent-h: #0d3894; --accent-50: #eaf0fb; --accent-100: #d5e1f7;
  --ok: #1f7a47; --ok-50: #e6f3ec; --err: #b4232f;
  --shadow-1: 0 1px 2px rgba(31,35,40,.05), 0 1px 1px rgba(31,35,40,.03);
  --shadow-2: 0 2px 4px rgba(31,35,40,.05), 0 8px 24px rgba(31,35,40,.08);
  --cine: #16181d; --cine-2: #1f2228; --cine-line: #2c3038; --on-cine: #eceef2; --on-cine-2: #a7adb9;
  --r: 8px; --r-sm: 6px;
  --focus: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent);
  background: var(--bg); color: var(--ink); line-height: 1.65; font-weight: 450;
  /* re-point v1 tokens so shared components follow the new palette */
  --paper: var(--bg); --card: var(--surface); --muted: var(--ink-3); --navy: var(--accent); --navy-d: var(--accent-h); --navy-ink: var(--ink);
  --navy-50: var(--accent-50); --gold-ink: var(--accent); --green: var(--ok); --green-50: var(--ok-50);
}
body.v2 h1, body.v2 h2, body.v2 h3 { color: var(--ink); font-weight: 700; letter-spacing: -0.015em; }
body.v2 h1 { font-size: clamp(1.5rem, 1.25rem + 1vw, 2rem); }
body.v2 h2 { font-size: 1.2rem; }
body.v2 a { color: var(--accent); }
body.v2 :focus-visible { box-shadow: var(--focus); outline: none; }

/* preview ribbon (admins only) */
.preview-bar { background: #fff8e6; color: #5c4400; border-bottom: 1px solid #f0dca8; font-size: .88rem; padding: 6px 16px; display: flex; gap: 12px; justify-content: center; align-items: center; flex-wrap: wrap; }
.preview-bar a { color: #5c4400; font-weight: 700; }

/* header: light, quiet */
body.v2 .top { background: var(--surface); color: var(--ink); border-bottom: 1px solid var(--line); height: 64px; }
body.v2 .brand { color: var(--ink); }
body.v2 .brand .bname { font-weight: 700; }
body.v2 .nav a { color: var(--ink-2); font-weight: 600; border-bottom-width: 2px; }
body.v2 .nav a:hover { color: var(--ink); border-bottom-color: var(--line-2); }
body.v2 .nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); }
body.v2 .nav select { color: var(--ink); border-color: var(--line-2); background-image: linear-gradient(45deg, transparent 50%, var(--ink-2) 50%), linear-gradient(135deg, var(--ink-2) 50%, transparent 50%); }
body.v2 .foot { background: var(--bg); border-top-color: var(--line); color: var(--ink-3); }

/* buttons: primary = filled accent; secondary = outlined neutral; tertiary = text */
body.v2 .btn { background: var(--accent); border-radius: var(--r-sm); font-weight: 650; box-shadow: var(--shadow-1); transition: background-color .15s ease, box-shadow .15s ease; }
body.v2 .btn, body.v2 a.btn { color: #fff; }
body.v2 .btn:hover { background: var(--accent-h); color: #fff; }
body.v2 .btn.ghost, body.v2 .btn.secondary, body.v2 a.btn.ghost, body.v2 a.btn.secondary { background: var(--surface); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line-2); }
body.v2 .btn.ghost:hover, body.v2 .btn.secondary:hover { background: var(--bg); box-shadow: inset 0 0 0 1px var(--ink-3); }
body.v2 .btn.light, body.v2 a.btn.light { background: var(--surface); color: var(--ink); }
body.v2 .btn.on-dark, body.v2 a.btn.on-dark { background: transparent; color: #fff; }
body.v2 .btn.text, body.v2 a.btn.text { background: none; box-shadow: none; color: var(--accent); padding-left: 4px; padding-right: 4px; }
body.v2 .btn.text:hover { text-decoration: underline; background: none; }
body.v2 .chip { border: 1px solid var(--line-2); color: var(--ink-2); background: var(--surface); font-weight: 600; }
body.v2 .chip:hover { border-color: var(--ink-3); color: var(--ink); }
body.v2 .chip[aria-pressed="true"], body.v2 .chip.on { background: var(--ink); border-color: var(--ink); color: #fff; }
body.v2 input, body.v2 select, body.v2 textarea { border: 1px solid var(--line-2); border-radius: var(--r-sm); }
body.v2 input:focus, body.v2 select:focus, body.v2 textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-100); }
body.v2 .badge.blue { background: var(--accent-50); color: var(--accent); }
body.v2 .badge.green { background: var(--ok-50); color: var(--ok); }
body.v2 .badge.gold { background: var(--accent-50); color: var(--accent); }

/* progress: accent only (meaningful progress is the one place colour carries information) */
body.v2 .gauge { background: var(--line); height: 6px; }
body.v2 .gauge > span { background: var(--accent); }
body.v2 .gauge.thin { height: 4px; }
body.v2 .gauge.on-dark { background: rgba(255,255,255,.18); }
body.v2 .gauge.on-dark > span { background: #fff; }
body.v2 .ep { color: var(--ink-3); font-weight: 700; }

/* ---------- home ---------- */
body.v2 .wrap { padding-top: var(--s5); }
body.v2 .greet { margin-bottom: var(--s4); }
body.v2 .greet h1 { font-size: 1.6rem; margin: 0 0 2px; }
body.v2 .greet p { color: var(--ink-3); }

/* hero: the learner's next step, with the lesson image as the "strong course imagery" */
.v2hero { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; box-shadow: var(--shadow-1); margin: 0 0 var(--s6); }
.v2hero .media { position: relative; aspect-ratio: 16 / 9; background: var(--cine); display: block; }
.v2hero .media img { width: 100%; height: 100%; object-fit: cover; }
.v2hero .media .gauge { position: absolute; left: 0; right: 0; bottom: 0; border-radius: 0; }
.v2hero .media .play { position: absolute; inset: 0; display: grid; place-items: center; }
.v2hero .media .play span { width: 64px; height: 64px; border-radius: 50%; background: rgba(255,255,255,.94); box-shadow: var(--shadow-2); display: grid; place-items: center; transition: transform .15s ease; }
.v2hero .media:hover .play span { transform: scale(1.06); }
.v2hero .media .play svg { width: 22px; height: 22px; margin-left: 3px; fill: var(--ink); }
.v2hero .body { padding: var(--s5); display: flex; flex-direction: column; justify-content: center; gap: 10px; }
.v2hero .status { color: var(--accent); font-weight: 700; font-size: .92rem; margin: 0; }
.v2hero h2 { font-size: clamp(1.3rem, 1.1rem + .8vw, 1.75rem); line-height: 1.25; margin: 0; }
.v2hero h2 a { color: var(--ink); text-decoration: none; }
.v2hero h2 a:hover { text-decoration: underline; text-decoration-thickness: 1px; }
.v2hero .where { color: var(--ink-2); margin: 0; font-size: .95rem; }
.v2hero .prog { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center; color: var(--ink-3); font-size: .88rem; font-weight: 600; max-width: 420px; }
.v2hero .why { color: var(--ink-2); margin: 0; max-width: 52ch; }
.v2hero .actions { display: flex; gap: var(--s2); flex-wrap: wrap; align-items: center; margin-top: var(--s2); }
@media (max-width: 820px) { .v2hero { grid-template-columns: 1fr; } .v2hero .body { padding: var(--s3) var(--s3) var(--s4); } }

/* course cards: one consistent 16:9 image, title, provider, facts, progress */
body.v2 .courses { grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: var(--s4); }
.v2card { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; text-decoration: none; color: inherit; box-shadow: var(--shadow-1); transition: box-shadow .18s ease, border-color .18s ease; }
.v2card:hover { box-shadow: var(--shadow-2); border-color: var(--line-2); }
.v2card .media { position: relative; aspect-ratio: 16 / 9; background: var(--cine); }
.v2card .media img { width: 100%; height: 100%; object-fit: cover; }
.v2card .media .count { position: absolute; right: 10px; bottom: 10px; background: rgba(22,24,29,.86); color: #fff; font-size: .78rem; font-weight: 700; padding: 3px 8px; border-radius: 4px; }
.v2card .body { padding: var(--s3) var(--s3) var(--s3); display: flex; flex-direction: column; gap: 6px; flex: 1; }
.v2card h3 { font-size: 1.08rem; line-height: 1.35; margin: 0; color: var(--ink); }
.v2card:hover h3 { color: var(--accent); }
.v2card .by { color: var(--ink-2); font-size: .9rem; margin: 0; }
.v2card .facts { display: flex; flex-wrap: wrap; gap: 4px 14px; list-style: none; padding: 0; margin: 2px 0 0; color: var(--ink-3); font-size: .86rem; }
.v2card .facts li { display: inline-flex; align-items: center; gap: 5px; }
.v2card .facts svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 1.8; }
.v2card .foot2 { margin-top: auto; padding-top: 12px; display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; font-size: .84rem; color: var(--ink-3); font-weight: 600; }
.v2card .foot2.done { grid-template-columns: auto; color: var(--ok); }

/* lesson cards in "All lessons" follow the same thumbnail style */
body.v2 .lcard .shot { border-radius: var(--r); box-shadow: var(--shadow-1); }
body.v2 .lcard .dur { background: rgba(22,24,29,.86); }
body.v2 .lcard h3 { color: var(--ink); font-weight: 650; }
body.v2 .lcard:hover h3 { color: var(--accent); }
body.v2 .lcard .ctx { color: var(--ink-3); }
body.v2 .lcard .shot img { transition: none; }
body.v2 .lcard:hover .shot img { transform: none; }
body.v2 .lcard:hover .shot { box-shadow: var(--shadow-2); }
body.v2 .noshot { background: var(--cine-2); }

/* ---------- lesson page: dark viewing area, light details ---------- */
body.v2 .theatre { background: var(--cine); color: var(--on-cine); }
body.v2 .theatre .inner { padding-top: var(--s3); padding-bottom: var(--s3); }
body.v2 .crumbs { color: var(--on-cine-2); }
body.v2 .crumbs a { color: var(--on-cine); }
body.v2 .player { border-radius: var(--r); }
body.v2 .playlist { background: var(--cine-2); border: 1px solid var(--cine-line); }
body.v2 .playlist-head { border-bottom-color: var(--cine-line); }
body.v2 .playlist-head h2 { color: var(--on-cine); font-size: .98rem; }
body.v2 .playlist .mod { color: var(--on-cine-2); font-weight: 700; font-size: .8rem; letter-spacing: .01em; }
body.v2 .playlist a { color: var(--on-cine); padding: 10px 16px; }
body.v2 .playlist .t { font-size: .92rem; font-weight: 550; line-height: 1.4; }
body.v2 .playlist .s { color: var(--on-cine-2); font-size: .8rem; }
body.v2 .playlist a:hover { background: rgba(255,255,255,.05); }
body.v2 .playlist a[aria-current="true"] { background: rgba(255,255,255,.08); box-shadow: inset 3px 0 0 #fff; }
body.v2 .playlist .ep, body.v2 .theatre .ep { color: var(--on-cine-2); }
body.v2 .playlist .done { color: #8ad1a5; }
body.v2 .overlay { background: rgba(22,24,29,.95); }
body.v2 .toast { background: rgba(31,35,40,.94); }
body.v2 .resume { background: rgba(31,35,40,.94); }
body.v2 .shortcuts { color: var(--on-cine-2); }
.v2details { max-width: 1400px; margin: 0 auto; padding: var(--s4) var(--s3) var(--s3); display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: var(--s3); }
.v2details .head { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--s3); flex-wrap: wrap; }
.v2details h1 { margin: 0 0 4px; font-size: clamp(1.35rem, 1.15rem + .8vw, 1.85rem); }
.v2details .meta { color: var(--ink-3); margin: 0; font-size: .92rem; }
.v2details .summary { color: var(--ink-2); margin: var(--s3) 0 0; max-width: 70ch; }
.v2details .nav2 { display: flex; gap: var(--s2); flex-wrap: wrap; }
.v2details .shortcuts { color: var(--ink-3); margin-top: var(--s3); }
.v2details .shortcuts kbd { color: var(--ink); border-color: var(--line-2); background: var(--surface); }
@media (max-width: 1080px) { .v2details { grid-template-columns: 1fr; } }
@media (max-width: 640px) { .v2details { padding: var(--s3) var(--s3) var(--s2); } .v2details .nav2 .btn { flex: 1; } }
body.v2 .below { padding-top: 0; }
body.v2 .below .card { box-shadow: var(--shadow-1); border-color: var(--line); }
body.v2 .opt { border-color: var(--line); }
body.v2 .opt:hover { border-color: var(--accent); }

/* course page + landing follow the palette via re-pointed tokens; dark bands become light in v2 */
body.v2 .course-hero { background: var(--surface); color: var(--ink); border-bottom: 1px solid var(--line); }
body.v2 .course-hero h1 { color: var(--ink); }
body.v2 .course-hero .tagline { color: var(--accent); }
body.v2 .course-hero .back, body.v2 .course-hero .cta .progress-line { color: var(--ink-3); }
body.v2 .course-hero .btn.light { background: var(--accent); color: #fff; }
body.v2 .course-hero .gauge.on-dark { background: var(--line); }
body.v2 .course-hero .gauge.on-dark > span { background: var(--accent); }
body.v2 .spec { border: 1px solid var(--line); border-top: 4px solid var(--accent); box-shadow: var(--shadow-1); }
body.v2 .spec-title { border-bottom-color: var(--ink); }
body.v2 .module-head { border-bottom-color: var(--ink); }
body.v2 .outcomes li::before { background: var(--accent-50) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 8.5l2.5 2.5L12 5.5' fill='none' stroke='%231145b6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/12px no-repeat; }
body.v2 .tick { background: var(--ok); }

/* narrow screens: video → title and prev/next → lesson list → quiz. The list becomes a light card here. */
body.v2 .v2details .btn { white-space: nowrap; }
@media (max-width: 1080px) {
  body.v2 main#main:has(> .theatre) { display: flex; flex-direction: column; }
  body.v2 .theatre, body.v2 .theatre .inner { display: contents; }
  body.v2 .stage { order: 1; background: var(--cine); padding: var(--s3) var(--s3) var(--s3); }
  body.v2 .v2details { order: 2; }
  body.v2 .playlist { order: 3; margin: 0 var(--s3) var(--s4); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-1); border-radius: var(--r); }
  body.v2 .playlist-head { border-bottom-color: var(--line); }
  body.v2 .playlist-head h2 { color: var(--ink); }
  body.v2 .playlist-head .progress-line { color: var(--ink-3); }
  body.v2 .playlist .gauge.on-dark { background: var(--line); }
  body.v2 .playlist .gauge.on-dark > span { background: var(--accent); }
  body.v2 .playlist .mod { color: var(--ink-3); }
  body.v2 .playlist a { color: var(--ink); }
  body.v2 .playlist a:hover { background: var(--bg); }
  body.v2 .playlist a[aria-current="true"] { background: var(--accent-50); box-shadow: inset 3px 0 0 var(--accent); }
  body.v2 .playlist .s { color: var(--ink-3); }
  body.v2 .playlist .ep { color: var(--ink-3); }
  body.v2 .playlist .done { color: var(--ok); }
  body.v2 .below { order: 4; width: 100%; }
}
@media (max-width: 640px) {
  body.v2 .stage { padding: 12px 0 0; }
  body.v2 .stage .crumbs { padding: 0 var(--s3) 10px; }
  body.v2 .player { border-radius: 0; }
}
/* form controls need a 3:1 boundary against the page (WCAG 1.4.11) */
body.v2 input, body.v2 select, body.v2 textarea, body.v2 .chip { border-color: #8c877f; }
body.v2 .v2details { width: 100%; }

/* ---------- HKCT logo ---------- */
body.v2 .brand { gap: 14px; }
body.v2 .brand-logo, body.v2 .brand-logo img { display: block; height: 44px; width: auto; }
body.v2 .bdiv { width: 1px; height: 28px; background: var(--line-2); }
body.v2 .brand .bname { color: var(--ink-2); font-weight: 600; font-size: 1rem; }
@media (max-width: 640px) {
  body.v2 .brand-logo, body.v2 .brand-logo img { height: 32px; }
  body.v2 .brand .bname, body.v2 .bdiv { display: none; }
}
/* footer: small mark + note */
body.v2 .foot-v2 { display: flex; gap: 14px; align-items: center; justify-content: center; flex-wrap: wrap; }
body.v2 .foot-v2 img { height: 24px; width: auto; }
/* lessons with no thumbnail yet: white HKCT mark on the viewing-area charcoal, not a text placeholder */
body.v2 .noshot { background: var(--cine-2) url(/static/brand/hkct-mark-white.webp) center / 42% auto no-repeat; color: transparent; }
body.v2 .spec-title { align-items: center; }
body.v2 .spec-title img { height: 20px; width: auto; }

/* ---------- sign-in / landing (signed-out) ---------- */
/* The header carries the full HKCT logo; the page itself stays warm white. Value proposition left, sign-in right. */
body.v2 .landing { max-width: 1180px; margin: 0 auto; min-height: 0; grid-template-columns: minmax(0, 1.2fr) minmax(340px, .9fr); column-gap: var(--s6); }
body.v2 .landing-story { background: none; color: var(--ink); padding: var(--s6) var(--s3) var(--s2); }
body.v2 .landing-more { background: none; color: var(--ink); padding: 0 var(--s3) var(--s6); }
body.v2 .landing-auth { background: none; padding: var(--s6) var(--s3) var(--s4); justify-content: flex-start; }
body.v2 .landing .from { color: var(--accent); font-weight: 650; font-size: .95rem; margin-bottom: var(--s3); }
body.v2 .landing .from .logo { display: none; }
body.v2 .landing-story h1 { color: var(--ink); font-size: clamp(1.9rem, 1.4rem + 1.8vw, 2.6rem); font-weight: 750; line-height: 1.15; max-width: 18ch; margin-bottom: var(--s3); }
body.v2 .landing-story .lede { color: var(--ink-2); font-size: 1.08rem; line-height: 1.7; max-width: 56ch; }
body.v2 .landing-more h2 { color: var(--ink); font-size: 1.05rem; margin: var(--s5) 0 var(--s3); }
body.v2 .audiences li { border-color: var(--line-2); color: var(--ink-2); background: var(--surface); font-weight: 550; }
body.v2 .catalog { border-top: 1px solid var(--line); max-width: 640px; }
body.v2 .catalog li { border-bottom: 1px solid var(--line); padding: 16px 0; }
body.v2 .catalog strong { color: var(--ink); }
body.v2 .catalog .tag { color: var(--accent); font-weight: 600; }
body.v2 .catalog .meta { color: var(--ink-3); }
body.v2 .steps li { color: var(--ink-2); }
body.v2 .steps li::before { background: var(--accent); }
body.v2 .auth-card { box-shadow: var(--shadow-2); border-color: var(--line); border-radius: 12px; padding: var(--s5) var(--s4); }
body.v2 .auth-card h2 { font-size: 1.4rem; }
body.v2 .access { color: var(--ink-3); }
body.v2 .access h3 { color: var(--ink); }
body.v2 .linkbtn { color: var(--accent); }
@media (max-width: 900px) {
  body.v2 .landing { grid-template-columns: 1fr; column-gap: 0; }
  body.v2 .landing-story { padding: var(--s4) var(--s3) var(--s2); }
  body.v2 .landing-auth { padding: var(--s3) var(--s3) var(--s2); }
  body.v2 .landing-more { padding: 0 var(--s3) var(--s5); }
  body.v2 .landing-story h1 { font-size: 1.8rem; }
}

/* ---------- other states in the new style ---------- */
body.v2 .continue.done { background: var(--surface); color: var(--ink); border: 1px solid var(--line); box-shadow: var(--shadow-1); grid-template-columns: 1fr; }
body.v2 .continue.done h2 { color: var(--ink); }
body.v2 .continue.done .kicker { color: var(--ok); }
body.v2 .continue.done .where { color: var(--ink-2); }
body.v2 .card { border-color: var(--line); box-shadow: var(--shadow-1); }
body.v2 .msg.err, body.v2 #msg { color: var(--err); }

/* ---------- admin screens ---------- */
body.v2.admin .kpi { border-left-color: var(--accent); box-shadow: var(--shadow-1); border-top-color: var(--line); border-right-color: var(--line); border-bottom-color: var(--line); }
body.v2.admin .kv { color: var(--ink); }
body.v2.admin .filters { border-color: var(--line); box-shadow: var(--shadow-1); }
body.v2.admin th { color: var(--ink-3); border-bottom-color: var(--line); }
body.v2.admin td { border-bottom-color: var(--line); }
body.v2.admin .meter span { background: var(--accent); }
body.v2.admin .chart .bar, body.v2.admin .chart .line { fill: var(--accent); }
body.v2.admin .chart .line { fill: none; stroke: var(--accent); }
body.v2.admin .chart .area { fill: rgba(17,69,182,.12); }
body.v2.admin h1 { font-size: 1.6rem; }
body.v2 input[type="date"] { height: 44px; padding-top: 0; padding-bottom: 0; }
body.v2 .brand, body.v2 .brand-logo, body.v2 .brand-logo img { flex-shrink: 0; }
body.v2 .nav a { white-space: nowrap; }
@media (max-width: 640px) {
  body.v2.admin .top { height: auto; flex-wrap: wrap; padding: 10px 12px 0; row-gap: 4px; }
  body.v2.admin .nav { width: 100%; overflow-x: auto; gap: 18px; padding-bottom: 6px; scrollbar-width: none; }
}
/* focus ring must win over any button/link style that removes shadows */
body.v2 .btn:focus-visible, body.v2 a.btn.text:focus-visible, body.v2 .chip:focus-visible, body.v2 .lcard:focus-visible, body.v2 .v2card:focus-visible, body.v2 .playlist a:focus-visible { box-shadow: var(--focus); outline: none; }

/* =====================================================================
   TYPOGRAPHY v2.1
   Two faces with clear jobs (both in the HKCT brand spec):
   - Montserrat: headings, buttons, navigation, labels, numbers that act as labels
   - Noto Sans: everything you read; matches Noto Sans SC so EN / BM / 中文 sit together
   One scale (px): 13 · 14 · 16 · 18 · 22 · 28 · 36 · 44. Four weights: 400 · 500 · 600 · 700.
   ===================================================================== */
@font-face {
  font-family: "Noto Sans"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url(/static/fonts/noto-sans-latin-wght-normal.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
body.v2 {
  --font-display: Montserrat, "Noto Sans SC", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  --font-text: "Noto Sans", "Noto Sans SC", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", Roboto, Arial, sans-serif;
  --fs-1: .8125rem; --fs-2: .875rem; --fs-3: 1rem; --fs-4: 1.125rem; --fs-5: 1.375rem; --fs-6: 1.75rem; --fs-7: 2.25rem; --fs-8: 2.75rem;
  --lh-tight: 1.15; --lh-snug: 1.3; --lh-small: 1.5; --lh-body: 1.6;
  font-family: var(--font-text); font-size: var(--fs-3); line-height: var(--lh-body); font-weight: 400;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility;
}
/* form controls inherit the reading face */
body.v2 input, body.v2 select, body.v2 textarea, body.v2 button { font-family: inherit; }
body.v2 textarea:not(.prose) { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: var(--fs-2); }

/* ---------- headings ---------- */
body.v2 h1, body.v2 h2, body.v2 h3, body.v2 legend { font-family: var(--font-display); color: var(--ink); text-wrap: balance; }
body.v2 h1 { font-size: clamp(var(--fs-5), 1.1rem + 1.2vw, var(--fs-6)); font-weight: 700; line-height: var(--lh-tight); letter-spacing: -0.02em; }
body.v2 h2 { font-size: var(--fs-5); font-weight: 700; line-height: var(--lh-snug); letter-spacing: -0.015em; }
body.v2 h3 { font-size: var(--fs-4); font-weight: 600; line-height: var(--lh-snug); letter-spacing: -0.01em; }
body.v2 p, body.v2 li, body.v2 .summary, body.v2 .lede, body.v2 .why { text-wrap: pretty; }
/* section titles on long pages are a step smaller than page titles */
body.v2 .section-head h2, body.v2 .course-body h2, body.v2 .aside-block h2 { font-size: var(--fs-5); }

/* ---------- UI text: Montserrat ---------- */
body.v2 .btn, body.v2 .chip, body.v2 .nav a, body.v2 .nav select, body.v2 label, body.v2 .badge, body.v2 th, body.v2 .kl,
body.v2 .crumbs, body.v2 .back, body.v2 .brand .bname, body.v2 .status, body.v2 .kicker, body.v2 .spec-title, body.v2 .tabs,
body.v2 .playlist .mod, body.v2 .lcard .dur, body.v2 .v2card .count, body.v2 .preview-bar { font-family: var(--font-display); }
body.v2 .btn { font-size: var(--fs-3); font-weight: 600; letter-spacing: 0; }
body.v2 .btn.small { font-size: var(--fs-2); }
body.v2 .chip { font-size: var(--fs-2); font-weight: 600; }
body.v2 .nav a { font-size: var(--fs-2); font-weight: 600; }
body.v2 .nav select { font-size: var(--fs-2); font-weight: 500; }
body.v2 .brand .bname { font-size: var(--fs-3); font-weight: 600; }
body.v2 label { font-size: var(--fs-2); font-weight: 600; }
body.v2 label.inline { font-weight: 500; }
body.v2 .badge { font-size: var(--fs-1); font-weight: 600; letter-spacing: .01em; }
body.v2 th { font-size: var(--fs-1); font-weight: 600; letter-spacing: .01em; }
body.v2 .back, body.v2 .crumbs { font-size: var(--fs-2); font-weight: 500; }
body.v2 .crumbs a { font-weight: 600; }

/* ---------- reading text: sizes by role ---------- */
body.v2 .note, body.v2 .muted, body.v2 .where, body.v2 .ctx, body.v2 .by, body.v2 .facts, body.v2 .count, body.v2 .meta,
body.v2 .caption, body.v2 .ks, body.v2 .access, body.v2 .foot, body.v2 .shortcuts, body.v2 .s, body.v2 .greet p,
body.v2 .catalog .meta, body.v2 .module-head span, body.v2 .prog, body.v2 .progress-line, body.v2 .foot2 { font-size: var(--fs-2); line-height: var(--lh-small); }
body.v2 .shortcuts, body.v2 .foot, body.v2 .lcard .ctx, body.v2 .playlist .s, body.v2 .badge { font-size: var(--fs-1); }
body.v2 .summary, body.v2 .lede, body.v2 .course-hero .summary { font-size: var(--fs-4); line-height: var(--lh-body); max-width: 62ch; }
body.v2 .aside-block p, body.v2 .outcomes li, body.v2 .why, body.v2 .v2details .summary { font-size: var(--fs-3); }
body.v2 .msg { font-weight: 500; font-size: var(--fs-2); }

/* ---------- numbers: tabular so times and counts line up ---------- */
body.v2 .dur, body.v2 .count, body.v2 .meta, body.v2 .prog, body.v2 .progress-line, body.v2 .foot2, body.v2 .kv, body.v2 td,
body.v2 .spec td, body.v2 .ep, body.v2 .s, body.v2 .r, body.v2 .catalog .meta, body.v2 .module-head span, body.v2 .facts { font-variant-numeric: tabular-nums; }
body.v2 .ep { font-family: var(--font-display); font-weight: 700; color: var(--ink-3); margin-right: .1em; }

/* ---------- component roles ---------- */
/* header */
body.v2 .greet h1 { font-size: var(--fs-6); }
/* hero */
body.v2 .v2hero .status { font-size: var(--fs-2); font-weight: 600; letter-spacing: 0; }
body.v2 .v2hero h2 { font-size: clamp(var(--fs-5), 1.05rem + .9vw, var(--fs-6)); font-weight: 700; line-height: var(--lh-tight); letter-spacing: -0.02em; }
body.v2 .v2hero .where { font-size: var(--fs-2); }
/* course card */
body.v2 .v2card h3 { font-size: var(--fs-4); font-weight: 700; line-height: var(--lh-snug); }
body.v2 .v2card .by { font-size: var(--fs-2); color: var(--ink-2); }
body.v2 .v2card .count, body.v2 .lcard .dur { font-size: var(--fs-1); font-weight: 600; }
/* lesson card */
body.v2 .lcard h3 { font-family: var(--font-display); font-size: var(--fs-3); font-weight: 600; line-height: 1.35; letter-spacing: -0.005em; }
/* lesson page */
body.v2 .v2details h1 { font-size: clamp(var(--fs-5), 1.05rem + 1vw, var(--fs-6)); }
body.v2 .playlist-head h2 { font-size: var(--fs-3); font-weight: 700; letter-spacing: -0.01em; }
body.v2 .playlist .t { font-family: var(--font-display); font-size: var(--fs-2); font-weight: 500; line-height: 1.4; }
body.v2 .playlist .mod { font-size: var(--fs-1); font-weight: 600; letter-spacing: .02em; }
body.v2 .overlay h2 { font-size: var(--fs-5); }
/* course page */
body.v2 .course-hero h1 { font-size: clamp(var(--fs-6), 1.4rem + 1.3vw, var(--fs-7)); line-height: var(--lh-tight); letter-spacing: -0.025em; }
body.v2 .course-hero .tagline { font-family: var(--font-display); font-size: var(--fs-3); font-weight: 600; }
body.v2 .spec-title { font-size: var(--fs-2); font-weight: 700; }
body.v2 .spec th { font-family: var(--font-text); font-size: var(--fs-2); font-weight: 400; }
body.v2 .spec td { font-size: var(--fs-2); font-weight: 600; }
body.v2 .module-head h3 { font-size: var(--fs-3); font-weight: 700; }
body.v2 .syllabus .t { font-family: var(--font-display); font-size: var(--fs-3); font-weight: 600; }
body.v2 .syllabus .s { font-size: var(--fs-2); }
/* landing */
body.v2 .landing-story h1 { font-size: clamp(var(--fs-7), 1.6rem + 2vw, var(--fs-8)); font-weight: 700; line-height: 1.1; letter-spacing: -0.03em; max-width: 16ch; }
body.v2 .landing .from { font-family: var(--font-display); font-size: var(--fs-2); font-weight: 600; }
body.v2 .landing-more h2 { font-size: var(--fs-4); }
body.v2 .auth-card h2 { font-size: var(--fs-5); }
body.v2 .catalog strong { font-family: var(--font-display); font-size: var(--fs-3); font-weight: 600; }
body.v2 .catalog .tag { font-size: var(--fs-2); font-weight: 500; }
body.v2 .audiences li { font-size: var(--fs-2); font-weight: 500; }
/* admin */
body.v2 .kl { font-size: var(--fs-1); font-weight: 600; }
body.v2 .kv { font-family: var(--font-display); font-size: var(--fs-6); font-weight: 700; letter-spacing: -0.02em; }
body.v2 td { font-size: var(--fs-2); }

/* ---------- 中文: no negative tracking, a little more leading ---------- */
html[lang="zh-Hans"] body.v2 { line-height: 1.75; }
html[lang="zh-Hans"] body.v2 :is(h1, h2, h3, .v2hero h2, .landing-story h1, .course-hero h1, .kv) { letter-spacing: 0; line-height: 1.3; }
html[lang="zh-Hans"] body.v2 .summary, html[lang="zh-Hans"] body.v2 .lede { line-height: 1.85; }
/* BM headings run long: allow a slightly wider measure */
html[lang="ms"] body.v2 .landing-story h1 { max-width: 18ch; }
/* type fixes after review */
html[lang="en"] body.v2, html[lang="ms"] body.v2 { word-break: keep-all; overflow-wrap: anywhere; }   /* never split "中文" mid-word in EN/BM text */
body.v2 .access h3 { font-size: var(--fs-3); }
body.v2 .syllabus li a, body.v2 .lcard, body.v2 .v2card, body.v2 .playlist a, body.v2 .v2hero h2 a { color: var(--ink); }
body.v2 .syllabus li a:hover .t, body.v2 .v2hero h2 a:hover { color: var(--accent); }
body.v2 .landing-story .lede { font-size: var(--fs-4); }

/* =====================================================================
   v2.2 — fixes from the UI review (empty states, mobile sign-in, thumbnails)
   ===================================================================== */
/* language switch: one compact segmented control; the selection is quiet (tint), so "Send code" stays the only strong action */
body.v2 .langs.seg { display: inline-flex; flex-wrap: nowrap; gap: 2px; padding: 3px; margin-bottom: var(--s3); border: 1px solid var(--line-2); border-radius: 999px; background: var(--surface); }
body.v2 .langs.seg .chip { border: 0; background: transparent; color: var(--ink-2); min-height: 36px; padding: 4px 14px; border-radius: 999px; }
body.v2 .langs.seg .chip:hover { color: var(--ink); background: var(--bg); }
body.v2 .langs.seg .chip[aria-pressed="true"] { background: var(--accent-50); color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent-100); }
body.v2 .langs.seg .chip:focus-visible { box-shadow: var(--focus); }
/* phones: headline 26px, first sentence only, form on the first screen */
@media (max-width: 640px) {
  body.v2 .landing-story { padding: var(--s3) var(--s3) 0; }
  body.v2 .landing .from { margin-bottom: 6px; font-size: var(--fs-1); }
  body.v2 .landing-story h1 { font-size: 1.625rem; line-height: 1.2; max-width: none; margin-bottom: 8px; letter-spacing: -0.02em; }
  body.v2 .landing-story .lede { font-size: var(--fs-3); line-height: 1.55; }
  body.v2 .landing-story .lede .l2 { display: none; }
  body.v2 .landing-auth { padding: var(--s3) var(--s3) var(--s2); }
  body.v2 .auth-card { padding: var(--s3) var(--s3) var(--s4); box-shadow: var(--shadow-1); }
  body.v2 .auth-card h2 { font-size: var(--fs-4); margin-bottom: 4px; }
  body.v2 .auth-card .note { margin-bottom: 12px; }
}

/* signed-in learner with nothing assigned */
body.v2 .empty-state { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-1); padding: var(--s5) var(--s4); max-width: 760px; }
body.v2 .empty-state h2 { font-size: var(--fs-5); margin: 0 0 var(--s2); max-width: 30ch; }
body.v2 .empty-state > p { color: var(--ink-2); max-width: 62ch; margin: 0 0 var(--s2); }
body.v2 .empty-state .actions { display: flex; flex-wrap: wrap; gap: 12px; margin: var(--s3) 0 0; }
body.v2 .empty-state h3 { font-size: var(--fs-3); margin: var(--s5) 0 var(--s2); }
@media (max-width: 640px) { body.v2 .empty-state { padding: var(--s4) var(--s3); } body.v2 .empty-state .actions .btn { flex: 1 1 100%; justify-content: center; } }

/* admin first run */
body.v2 .setup h2 { margin-bottom: 4px; }
body.v2 .setup-steps { list-style: none; padding: 0; margin: var(--s4) 0 var(--s3); display: grid; gap: var(--s4); max-width: 760px; }
body.v2 .setup-steps li { display: grid; grid-template-columns: 32px 1fr; gap: 14px; align-items: start; }
body.v2 .setup-steps .num { width: 32px; height: 32px; border-radius: 999px; display: grid; place-items: center; font-family: var(--font-display); font-weight: 700; font-size: var(--fs-2); background: var(--accent); color: #fff; }
body.v2 .setup-steps li.done .num { background: var(--ok-50); color: var(--ok); }
body.v2 .setup-steps h3 { font-size: var(--fs-3); margin: 4px 0 4px; }
body.v2 .setup-steps p { margin: 0; color: var(--ink-2); }
body.v2 .setup-steps .actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 12px; }
body.v2 .chart + .empty, body.v2 .card > .empty { color: var(--ink-3); }

/* ---------- lesson and course covers (replace downscaled slide frames) ----------
   Charcoal like the viewing area; the episode number and topic are set large so lessons differ at a glance.
   Text sizes follow the cover's own width (container units), capped so the hero doesn't shout. */
body.v2 :is(.lcard .shot, .v2hero .media, .v2card .media) { container-type: inline-size; }
body.v2 .cover { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: flex-end; gap: 2px;
  padding: clamp(10px, 6cqw, 28px); background: var(--cine-2); color: #fff; overflow: hidden; text-align: left; }
body.v2 .cover .cmark { position: absolute; top: clamp(10px, 5cqw, 24px); left: clamp(10px, 6cqw, 28px); height: clamp(14px, 4.2cqw, 24px); width: auto; opacity: .95; }
body.v2 .cover .cnum { font-family: var(--font-display); font-weight: 700; line-height: .9; letter-spacing: -0.03em; font-size: clamp(28px, 19cqw, 104px); font-variant-numeric: tabular-nums; color: #fff; }
body.v2 .cover .cnum small { font-size: .26em; letter-spacing: .04em; font-weight: 600; color: var(--on-cine-2); margin-right: .25em; vertical-align: .2em; }
body.v2 .cover .ctxt { display: block; margin-top: clamp(4px, 2cqw, 12px); padding-top: clamp(4px, 2cqw, 12px); border-top: 2px solid var(--accent); max-width: 92%; }
body.v2 .cover .ctxt small { display: block; font-family: var(--font-display); font-size: clamp(10px, 4cqw, 16px); font-weight: 500; color: var(--on-cine-2); line-height: 1.3; }
body.v2 .cover .ctxt b { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-family: var(--font-display); font-weight: 600;
  font-size: clamp(13px, 7cqw, 34px); line-height: 1.15; letter-spacing: -0.01em; color: #fff; text-wrap: balance; }
body.v2 .cover.noep .ctxt { border-top: 0; margin-top: 0; }
body.v2 .cover.noep .ctxt b { -webkit-line-clamp: 3; font-size: clamp(15px, 8.5cqw, 38px); }
body.v2 .cover.course .ctxt { border-top: 0; margin: 0; }
body.v2 .cover.course .ctxt b { -webkit-line-clamp: 3; font-size: clamp(16px, 7.5cqw, 32px); font-weight: 700; }
body.v2 .cover.course { box-shadow: inset 0 -4px 0 var(--accent); }
html[lang="zh-Hans"] body.v2 .cover b { letter-spacing: 0; line-height: 1.3; }
/* small covers (phone lesson rows): number only, centred */
@container (max-width: 190px) {
  body.v2 .cover { justify-content: center; align-items: center; padding: 8px; }
  body.v2 .cover .ctxt { display: none; }
  body.v2 .cover .cnum { font-size: 34cqw; }
  body.v2 .cover.noep .ctxt, body.v2 .cover.course .ctxt { display: block; border: 0; margin: 0; padding: 0; max-width: 100%; }
  body.v2 .cover.noep .ctxt b { font-size: 11cqw; text-align: center; }
}
/* badges on lesson cards sit on top of the cover: duration top-right, completed top-left */
body.v2 .lcard .shot { background: var(--cine-2); }
body.v2 .lcard .dur, body.v2 .lcard .state, body.v2 .lcard .shot .gauge { z-index: 1; }
body.v2 .lcard .dur { top: 8px; bottom: auto; }
/* hero: play control moves to the corner so it never covers the text */
body.v2 .v2hero .media .play { inset: auto clamp(12px, 4cqw, 24px) clamp(14px, 5cqw, 28px) auto; place-items: end; z-index: 1; }
body.v2 .v2hero .media .play span { width: 52px; height: 52px; }
body.v2 .v2hero .media .gauge { z-index: 1; }

/* ---------- outline and lesson list: number badges instead of tiny pictures ---------- */
body.v2 .nbadge { width: 36px; height: 36px; border-radius: var(--r-sm); display: grid; place-items: center; flex-shrink: 0;
  font-family: var(--font-display); font-weight: 600; font-size: var(--fs-2); font-variant-numeric: tabular-nums;
  background: var(--bg); color: var(--ink-2); box-shadow: inset 0 0 0 1px var(--line-2); }
body.v2 .nbadge.done { background: var(--ok-50); color: var(--ok); box-shadow: none; }
body.v2 .nbadge.cur { background: var(--accent); color: #fff; box-shadow: none; }
body.v2 .syllabus li a { grid-template-columns: 36px 1fr auto; align-items: start; }
body.v2 .syllabus .t { padding-top: 6px; }
body.v2 .playlist a { grid-template-columns: 32px 1fr; align-items: start; }
body.v2 .playlist .nbadge { width: 32px; height: 32px; background: rgba(255,255,255,.07); color: var(--on-cine); box-shadow: none; }
body.v2 .playlist .nbadge.done { background: rgba(138,209,165,.14); color: #8ad1a5; }
body.v2 .playlist .nbadge.cur { background: #fff; color: var(--ink); }
body.v2 .playlist .t { padding-top: 5px; }
@media (max-width: 1080px) {
  body.v2 .syllabus li a { grid-template-columns: 36px 1fr; }
  body.v2 .syllabus .r { grid-column: 2; }
  body.v2 .playlist .nbadge { background: var(--bg); color: var(--ink-2); box-shadow: inset 0 0 0 1px var(--line-2); }
  body.v2 .playlist .nbadge.done { background: var(--ok-50); color: var(--ok); box-shadow: none; }
  body.v2 .playlist .nbadge.cur { background: var(--accent); color: #fff; box-shadow: none; }
}
body.v2 .v2card .count { top: clamp(10px, 4cqw, 18px); bottom: auto; right: clamp(10px, 4cqw, 18px); z-index: 1; }
body.v2 .cover.course .ctxt b { -webkit-line-clamp: 4; font-size: clamp(16px, 6.6cqw, 28px); line-height: 1.18; }
/* small covers, refined: number centred on its glyphs, duration back to the bottom corner, HKCT mark for one-off videos */
@container (max-width: 190px) {
  body.v2 .cover .cnum { font-size: 30cqw; line-height: 1; display: flex; align-items: baseline; padding-bottom: 6%; }
  body.v2 .cover .cnum small { vertical-align: 0; }
  body.v2 .cover.noep { background: var(--cine-2) url(/static/brand/hkct-mark-white.webp) center 42% / 52% auto no-repeat; }
  body.v2 .cover.noep .ctxt { display: none; }
  body.v2 .lcard .dur { top: auto; bottom: 6px; right: 6px; }
}
@container (max-width: 190px) {
  body.v2 .cover:not(.noep) { justify-content: flex-start; align-items: flex-start; padding: 8px 10px; }
}
/* every selected chip uses the quiet tint (filters, tabs), leaving filled colour to primary buttons */
body.v2 .chip[aria-pressed="true"], body.v2 .chip.on { background: var(--accent-50); border-color: var(--accent); color: var(--accent); }
body.v2 .syllabus .r { padding-top: 7px; }
/* fix: the lesson list sits on the dark viewing area on desktop, so its titles must be light there (regression from v2.1) */
body.v2 .playlist a { color: var(--on-cine); }
@media (max-width: 1080px) { body.v2 .playlist a { color: var(--ink); } }

/* legal footer */
.foot .foot-legal{flex-basis:100%;font-size:.78rem;line-height:1.5;opacity:.85;margin-top:6px}
