/* Hallmark · checked: 2026-11-19 · genre: playful (inferred) · scope: app
 * floor: 1 FAIL open (63, the Malay · English pairs: the owner's call) · fixed: 7a 10a 26a 34 39a 40 48 49a 50 56 67 38iii F1 F6 F19 F21 F23 · structural: printed (6b, 8, 9, 29, 47c)
 * built: the project · redesign: polish · v2.0.0 */
/* Hallmark · dismissed 40 · the teal Mula belajar button paints its own ground; the 1.00:1 reading samples the card gradient behind the Revision card, not the label */
/* Hallmark · waive 39b · each subject card and answer option is a tall card holding two lines, Malay then English, well over a 44px target · students tap the whole card to pilih subjek anda or choose an answer like Saya suka makan */
/* Hallmark · waive 49b · a real phrase in two languages that wraps to two lines at most on a 320px phone · the Pensyarah link to the Lecturer dashboard keeps both languages */
/* Hallmark · reworded "Bab · Chapters 10" to "Bab · Chapters" · 38iii named the count badge inside the heading; the count now sits beside it */
/* Jom Mandarin! — design system */
:root {
  /* palette: orange 60% · dark red 30% · gold 10% */
  --brand: #F2711C;
  --brand-deep: #C4520B;
  --brand-tint: #FFEDE0;
  --brand-ink: #A84508;

  --maroon: #8E1E1A; --maroon-deep: #661210; --maroon-tint: #FAE8E5; --maroon-ink: #7A1814;

  --ink: #2B1712;
  --ink-2: #5B403A;
  --muted: #765B54;
  --bg: #FFF8F2;
  --surface: #FFFDFB;
  --line: #F1E2D8;
  --line-2: #E3CDBF;

  --green: #24A353;  --green-deep: #1A7F40; --green-tint: #E4F8EA; --green-ink: #17793B;
  --red: #E5484D;    --red-deep: #B8323A;   --red-tint: #FFE8E8;   --red-ink: #B4232B;
  /* 'blue' and 'violet' are kept as names but now carry the dark-red and amber tones */
  --blue: #8E1E1A;   --blue-deep: #661210;  --blue-tint: #FAE8E5;  --blue-ink: #7A1814;
  --violet: #B5770D; --violet-deep: #8A5A06; --violet-tint: #FFF2D4; --violet-ink: #7A4D00;
  --gold: #F4B724;   --gold-deep: #C68E00;   --gold-tint: #FFF4D3; --gold-ink: #7D5600;
  /* fills that carry light text (contrast 3.8:1 or better for bold labels, 4.5:1 for small text) */
  --brand-fill: #C4520B; --brand-fill-deep: #9E3F08; --brand-fill-strong: #B84C0A;
  --on-fill: #FFFDFB;    /* near-white ink, tinted toward the paper */
  --ring: #661210;       /* focus ring on light and orange surfaces */
  --ring-on-dark: #FFE7A8;
  --field-edge: #9C7F75;  /* 3.5:1 on the paper, so a field's edge is visible */
  --c-coin-shine: #FFFFFF88;

  --zh: 'Noto Sans SC', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  --ui: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;

  --r-sm: 10px; --r: 14px; --r-lg: 20px;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-io: cubic-bezier(0.77, 0, 0.175, 1);
  --shadow-1: 0 1px 2px rgba(58,20,16,.06), 0 4px 14px rgba(58,20,16,.06);
  --shadow-2: 0 2px 4px rgba(58,20,16,.06), 0 14px 40px rgba(58,20,16,.12);
}
:root {
  /* colours lifted from the rules below (Hallmark polish); same values, now in one place */
  --c-000000: #000;
  --c-0d72a8: #0D72A8;
  --c-24a353: #24A353;
  --c-2a2a38: #2A2A38;
  --c-2b1712: #2B1712;
  --c-3a3a46: #3A3A46;
  --c-4f0e0b: #4F0E0B;
  --c-5a100d: #5A100D;
  --c-5a3a00: #5A3A00;
  --c-5b403a: #5B403A;
  --c-741714: #741714;
  --c-765b54: #765B54;
  --c-7a5f58: #7A5F58;
  --c-7e3300: #7E3300;
  --c-8a5a00: #8A5A00;
  --c-8a6f68: #8A6F68;
  --c-8e1e1a: #8E1E1A;
  --c-8f3a05: #8F3A05;
  --c-9ad7ae: #9AD7AE;
  --c-9be3b3: #9BE3B3;
  --c-9e3f08: #9E3F08;
  --c-a0-0-0-p08: rgba(0,0,0,.08);
  --c-a0-0-0-p18: rgba(0,0,0,.18);
  --c-a0-0-0-p2: rgba(0,0,0,.2);
  --c-a0-0-0-p25: rgba(0,0,0,.25);
  --c-a06a00: #A06A00;
  --c-a142-30-26-p22: rgba(142,30,26,.22);
  --c-a194-84-10-p55: rgba(194, 84, 10, .55);
  --c-a196-82-11-p8: rgba(196,82,11,.8);
  --c-a217-96-11-p25: rgba(217,96,11,.25);
  --c-a238-106-16-p14: rgba(238,106,16,.14);
  --c-a238-106-16-p18: rgba(238,106,16,.18);
  --c-a240-73-79-0: rgba(240,73,79,0);
  --c-a240-73-79-p35: rgba(240,73,79,.35);
  --c-a244-183-36-p35: rgba(244,183,36,.35);
  --c-a244-183-36-p45: rgba(244,183,36,.45);
  --c-a255-155-80-p35: rgba(255,155,80,.35);
  --c-a255-255-255-p10: rgba(255,255,255,.10);
  --c-a255-255-255-p12: rgba(255,255,255,.12);
  --c-a255-255-255-p14: rgba(255,255,255,.14);
  --c-a255-255-255-p16: rgba(255,255,255,.16);
  --c-a255-255-255-p18: rgba(255,255,255,.18);
  --c-a255-255-255-p22: rgba(255,255,255,.22);
  --c-a255-255-255-p25: rgba(255,255,255,.25);
  --c-a255-255-255-p35: rgba(255,255,255,.35);
  --c-a255-255-255-p8: rgba(255,255,255,.8);
  --c-a255-255-255-p92: rgba(255,255,255,.92);
  --c-a255-255-255-p96: rgba(255,255,255,.96);
  --c-a3261f: #A3261F;
  --c-a58-20-16-p08: rgba(58,20,16,.08);
  --c-a58-20-16-p1: rgba(58,20,16,.1);
  --c-a58-20-16-p14: rgba(58,20,16,.14);
  --c-a58-20-16-p15: rgba(58,20,16,.15);
  --c-a58-20-16-p25: rgba(58,20,16,.25);
  --c-a90-16-13-p35: rgba(90,16,13,.35);
  --c-a90-16-13-p5: rgba(90,16,13,.5);
  --c-a90-16-13-p55: rgba(90,16,13,.55);
  --c-a90-16-13-p6: rgba(90,16,13,.6);
  --c-b39a8f: #B39A8F;
  --c-b4232b: #B4232B;
  --c-b49a90: #B49A90;
  --c-bfe8cd: #BFE8CD;
  --c-c3edd1: #C3EDD1;
  --c-c9afa3: #C9AFA3;
  --c-d8bfb2: #D8BFB2;
  --c-e3cdbf: #E3CDBF;
  --c-e4f8ea: #E4F8EA;
  --c-e8bfb8: #E8BFB8;
  --c-effaf2: #EFFAF2;
  --c-f0494f: #F0494F;
  --c-f0d58a: #F0D58A;
  --c-f1c9a8: #F1C9A8;
  --c-f1e2d8: #F1E2D8;
  --c-f2711c: #F2711C;
  --c-f3b184: #F3B184;
  --c-f3b98c: #F3B98C;
  --c-f3c9c2: #F3C9C2;
  --c-f3cba9: #F3CBA9;
  --c-f3d9a0: #F3D9A0;
  --c-f3e6de: #F3E6DE;
  --c-f3e8e1: #F3E8E1;
  --c-f5eae3: #F5EAE3;
  --c-f6c29c: #F6C29C;
  --c-f6d2cc: #F6D2CC;
  --c-f8ece5: #F8ECE5;
  --c-fbe9e1: #FBE9E1;
  --c-fbeae7: #FBEAE7;
  --c-fbefe8: #FBEFE8;
  --c-fbf1eb: #FBF1EB;
  --c-fbf2ec: #FBF2EC;
  --c-ffb7b9: #FFB7B9;
  --c-ffc59a: #FFC59A;
  --c-ffc9a0: #FFC9A0;
  --c-ffcfcf: #FFCFCF;
  --c-ffd0d1: #FFD0D1;
  --c-ffd3b2: #FFD3B2;
  --c-ffd9bc: #FFD9BC;
  --c-ffe29a: #FFE29A;
  --c-ffe2c7: #FFE2C7;
  --c-ffe2cc: #FFE2CC;
  --c-ffe7a3: #FFE7A3;
  --c-ffe7a8: #FFE7A8;
  --c-ffe8e8: #FFE8E8;
  --c-ffe9b8: #FFE9B8;
  --c-ffe9d6: #FFE9D6;
  --c-ffebd6: #FFEBD6;
  --c-fff1e6: #FFF1E6;
  --c-fff3e8: #FFF3E8;
  --c-fff6ee: #FFF6EE;
  --c-fff7e0: #FFF7E0;
  --c-fff7ee: #FFF7EE;
  --c-fff8d6: #FFF8D6;
  --c-fff8f3: #FFF8F3;
  --c-fff8f8: #FFF8F8;
  --c-fff9f5: #FFF9F5;
  --c-fffbf3: #FFFBF3;
  --c-fffbf8: #FFFBF8;
  --c-fffcfa: #FFFCFA;
  --c-fffdf8: #FFFDF8;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--ui); font-weight: 600; font-size: 17px; line-height: 1.5;
  color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent; min-height: 100dvh;
}
::selection { background: var(--c-ffd9bc); color: var(--ink); }
img { max-width: 100%; display: block; }
a { color: var(--blue-ink); text-underline-offset: 3px; }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; font-weight: 800; text-wrap: balance; letter-spacing: -0.01em; }
p { margin: 0; text-wrap: pretty; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; border-radius: 10px; }
.zh { font-family: var(--zh); font-weight: 500; letter-spacing: 0.02em; }
.py { font-family: var(--ui); font-weight: 700; color: var(--muted); letter-spacing: 0; }
.muted { color: var(--muted); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ico { width: 1.15em; height: 1.15em; flex: none; }
html { scrollbar-color: var(--line-2) transparent; }
html, body { overflow-x: clip; }

/* ---------- buttons ---------- */
.btn {
  --c: var(--brand-fill); --cd: var(--brand-fill-deep); --tc: var(--on-fill);
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  min-height: 52px; padding: 0 22px; border: 0; border-radius: var(--r);
  background: var(--c); color: var(--tc); font-weight: 800; letter-spacing: .01em;
  box-shadow: 0 4px 0 var(--cd); cursor: pointer; text-decoration: none; user-select: none; font-size: 19px;
  transition: transform 110ms var(--ease-out), box-shadow 110ms var(--ease-out), background-color 150ms ease, opacity 150ms ease;
}
.btn:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 var(--cd); }
.btn:disabled { --c: var(--c-f1e2d8); --cd: var(--c-e3cdbf); --tc: var(--muted); cursor: not-allowed; }
.btn.wide { width: 100%; }
.btn.green { --c: var(--green); --cd: var(--green-deep); }
.btn.red { --c: var(--red); --cd: var(--red-deep); }
.btn.blue { --c: var(--blue); --cd: var(--blue-deep); }
.btn.ghost { --c: var(--surface); --cd: var(--line-2); --tc: var(--ink-2); border: 2px solid var(--line-2); box-shadow: 0 3px 0 var(--line-2); }
.btn.small { min-height: 42px; padding: 0 14px; font-size: 15px; border-radius: 12px; }
.btn.small.blue { --c: var(--blue-deep); --cd: var(--c-4f0e0b); }
.btn .sub { font-weight: 700; opacity: .85; }

.icon-btn {
  display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; border: 0;
  background: transparent; color: var(--muted); cursor: pointer; transition: background-color 150ms ease, color 150ms ease, transform 110ms var(--ease-out);
}
.icon-btn:active { transform: scale(.94); }
@media (hover: hover) and (pointer: fine) { .icon-btn:hover { background: var(--c-f5eae3); color: var(--ink); } }

.audio-btn {
  display: inline-grid; place-items: center; width: 44px; height: 44px; flex: none; border-radius: 12px; border: 0;
  background: var(--blue); color: var(--on-fill); box-shadow: 0 3px 0 var(--blue-deep); cursor: pointer;
  transition: transform 110ms var(--ease-out), box-shadow 110ms var(--ease-out);
}
.audio-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--blue-deep); }
.audio-btn.sm { width: 36px; height: 36px; border-radius: 10px; }
.audio-btn.slow { background: var(--surface); color: var(--blue-ink); box-shadow: 0 3px 0 var(--line-2); border: 2px solid var(--line-2); }
.audio-btn.playing { animation: pulse 900ms ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 3px 0 var(--blue-deep), 0 0 0 6px var(--c-a142-30-26-p22); } }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30; background: var(--c-a255-255-255-p92);
  backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 2px solid var(--line);
}
.topbar-in { max-width: 1180px; margin: 0 auto; height: 64px; padding: 0 16px; display: flex; align-items: center; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); min-width: 0; }
.brand img { width: 36px; height: 36px; }
.brand b { font-weight: 800; font-size: 19px; letter-spacing: -.01em; white-space: nowrap; }
.brand b span { color: var(--brand); }
.brand small { display: block; font-size: 12px; color: var(--muted); font-weight: 800; letter-spacing: .02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.spacer { flex: 1; }
.account { display: flex; align-items: center; gap: 10px; }
.points { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px 6px 8px; border-radius: 999px; background: var(--gold-tint); color: var(--c-8a5a00); font-weight: 800; font-variant-numeric: tabular-nums; }
.points img { width: 24px; height: 24px; }
.points.bump { animation: bump 420ms var(--ease-out); }
@keyframes bump { 30% { transform: scale(1.14); } }
.acct { position: relative; }
.acct-btn { width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--gold); color: var(--maroon-deep); font-weight: 800; font-size: 14px; cursor: pointer; box-shadow: 0 3px 0 var(--violet-deep); transition: transform 110ms var(--ease-out); }
.acct-btn:active { transform: scale(.94); }
.acct-menu {
  position: absolute; right: 0; top: calc(100% + 10px); width: 320px; max-width: calc(100% + 240px); background: var(--surface);
  border: 2px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-2); padding: 8px; z-index: 40;
  transform-origin: top right; animation: pop 180ms var(--ease-out);
}
@keyframes pop { from { opacity: 0; transform: scale(.96) translateY(-4px); } }
.acct-head { padding: 10px 12px 12px; border-bottom: 2px solid var(--line); margin-bottom: 6px; display: grid; gap: 2px; }
.acct-head b { min-width: 0; overflow-wrap: anywhere; line-height: 1.3; }
.acct-head span { font-size: 14px; color: var(--ink-2); overflow-wrap: anywhere; }
.acct-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; padding: 12px; border-radius: 10px; border: 0; background: none; text-align: left; font-size: 15px; font-weight: 700; color: var(--ink); text-decoration: none; cursor: pointer; }
.acct-row > span { display: flex; align-items: center; gap: 10px; }
.acct-row .ico { color: var(--muted); }
.acct-row:hover { background: var(--c-fbefe8); }
.acct-row.danger { color: var(--red-ink); justify-content: flex-start; gap: 10px; }
.acct-row.danger .ico { color: var(--red); }
.acct-row:not(.danger):not(label) { justify-content: flex-start; gap: 10px; }

.switch { appearance: none; width: 44px; height: 26px; border-radius: 99px; background: var(--line-2); position: relative; cursor: pointer; flex: none; transition: background-color 160ms ease; margin: 0; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--on-fill); box-shadow: 0 1px 3px var(--c-a0-0-0-p2); transition: transform 200ms var(--ease-out); }
.switch:checked { background: var(--green); }
.switch:checked::after { transform: translateX(18px); }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 80; max-width: calc(100% - 32px);
  background: var(--ink); color: var(--on-fill); padding: 12px 18px; border-radius: 14px; font-size: 15px; font-weight: 700;
  box-shadow: var(--shadow-2); opacity: 0; transform: translate(-50%, 16px); pointer-events: none;
  transition: opacity 260ms ease, transform 320ms var(--ease-out);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 90; width: 100%; height: 100%; }

/* ---------- forms ---------- */
.field { display: grid; gap: 6px; }
.field label { font-weight: 800; font-size: 15px; color: var(--ink-2); }
.field label small { font-weight: 700; color: var(--muted); }
.input, .select {
  width: 100%; min-height: 54px; padding: 0 16px; font: inherit; font-weight: 700; color: var(--ink);
  background: var(--c-fff8f3); border: 2px solid var(--field-edge); border-radius: 14px; outline: none;
  transition: border-color 150ms ease, background-color 150ms ease, box-shadow 150ms ease;
}
.input::placeholder { color: var(--c-8a6f68); font-weight: 600; }
.input:focus, .select:focus { background: var(--on-fill); }
.input:focus-visible, .select:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; }
.field.error .input, .field.error .select { border-color: var(--red); background: var(--c-fff8f8); }
.field .err { color: var(--red-ink); font-size: 14px; font-weight: 700; display: none; align-items: center; gap: 6px; }
.field.error .err { display: flex; }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238A6F68' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; background-size: 20px; padding-right: 44px; }
.email-wrap { position: relative; }
.email-wrap .suffix { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); font-weight: 700; font-size: 14px; pointer-events: none; }

/* ---------- sign-in page ---------- */
.auth {
  min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1fr); place-items: center; padding: 72px 16px 40px;
  background:
    radial-gradient(900px 500px at 110% -10%, var(--c-ffe2cc) 0%, transparent 60%),
    radial-gradient(700px 500px at -20% 110%, var(--c-ffe9b8) 0%, transparent 60%),
    var(--bg);
}
.auth-card { width: 100%; max-width: 460px; background: var(--surface); border: 2px solid var(--line); border-radius: 28px; box-shadow: var(--shadow-2); padding: 28px 24px 24px; }
@keyframes bob { 50% { transform: translateY(-6px) rotate(-3deg); } }
.auth form { display: grid; gap: 16px; }
.auth .note { font-size: 13px; color: var(--muted); text-align: center; margin-top: 14px; line-height: 1.45; }
.welcome { text-align: center; display: grid; gap: 12px; }
.welcome > * { min-width: 0; }
.welcome h2 { font-size: 26px; overflow-wrap: anywhere; }
.welcome .who b, .welcome .who span { overflow-wrap: anywhere; }
.welcome .who { background: var(--c-fff8f3); border: 2px solid var(--line); border-radius: var(--r); padding: 14px; text-align: left; display: grid; gap: 2px; font-size: 15px; color: var(--ink-2); }
.welcome .who b { color: var(--ink); font-size: 17px; }
.linkish { white-space: nowrap; background: none; border: 0; color: var(--blue-ink); font-weight: 800; cursor: pointer; padding: 10px; border-radius: 10px; }
.linkish:hover { background: var(--blue-tint); }

/* ---------- home ---------- */
.page { max-width: 1040px; margin: 0 auto; padding: 28px 16px 64px; }
.hello { display: flex; align-items: center; gap: 16px; margin-bottom: 26px; }
.hello img { width: 64px; height: 64px; flex: none; }
.hello > div { min-width: 0; }
.hello h1 { font-size: clamp(26px, 5vw, 34px); overflow-wrap: anywhere; }
.hello-mail { font-size: 14px; font-weight: 700; color: var(--muted); margin-top: 2px; overflow-wrap: anywhere; }
.hello p { color: var(--ink-2); margin-top: 2px; }
.notice { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--r); background: var(--red-tint); color: var(--red-ink); font-weight: 700; margin-bottom: 20px; border: 2px solid var(--c-ffcfcf); }
.subject-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 30px 0 14px; flex-wrap: wrap; }
.subject-head h2 { font-size: 22px; }
.subject-head span { color: var(--muted); font-weight: 800; font-size: 14px; }

.continue {
  display: grid; grid-template-columns: auto 1fr; gap: 18px; align-items: center; padding: 22px;
  border-radius: 24px; background: var(--c-f2711c); color: var(--ink); box-shadow: 0 6px 0 var(--brand-deep); position: relative; overflow: hidden;
}
.continue::after { content: ''; position: absolute; right: -60px; top: -80px; width: 260px; height: 260px; border-radius: 50%; background: var(--c-a255-255-255-p12); }
.continue .art { width: 96px; height: 96px; background: var(--c-a255-255-255-p35); border-radius: 22px; display: grid; place-items: center; }
.continue .art img { width: 72px; height: 72px; }
.continue .ch { font-weight: 800; font-size: 14px; }
.continue h3, .continue h2.h3 { font-size: clamp(22px, 4vw, 28px); margin: 2px 0 2px; }
.continue p { opacity: .92; font-size: 15px; }
.continue .row { display: flex; align-items: center; gap: 14px; margin-top: 14px; flex-wrap: wrap; position: relative; z-index: 1; }
.continue .btn { --c: var(--on-fill); --cd: var(--c-f3cba9); --tc: var(--brand-ink); }
.bar { height: 14px; border-radius: 99px; background: var(--c-a58-20-16-p08); overflow: hidden; position: relative; flex: 1; min-width: 120px; }
.bar > i { position: absolute; inset: 0 auto 0 0; border-radius: inherit; background: var(--green); }
.bar > i::after { content: ''; position: absolute; left: 8px; right: 8px; top: 3px; height: 3px; border-radius: 99px; background: var(--c-a255-255-255-p35); }
.continue .bar { background: var(--c-a58-20-16-p14); max-width: 260px; }
.continue .bar > i { background: var(--on-fill); }
.continue .bar > i::after { background: var(--c-a255-155-80-p35); }
.continue .pct { font-weight: 800; font-variant-numeric: tabular-nums; }

.chapters { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; }
.chap {
  display: grid; grid-template-columns: 64px 1fr; gap: 14px; align-items: center; padding: 16px;
  background: var(--surface); border: 2px solid var(--line); border-bottom-width: 5px; border-radius: 20px; text-decoration: none; color: inherit;
  transition: transform 140ms var(--ease-out), border-color 150ms ease;
}
a.chap:active { transform: scale(.98); }
@media (hover: hover) and (pointer: fine) { a.chap:hover { border-color: var(--c-ffc9a0); } }
.chap .art { width: 64px; height: 64px; border-radius: 16px; background: var(--brand-tint); display: grid; place-items: center; }
.chap .art img { width: 46px; height: 46px; }
.chap .n { font-size: 13px; font-weight: 800; color: var(--brand-ink); }
.chap h3, .chap h2.h3 { font-size: 18px; margin: 1px 0 1px; }
.chap .en { font-size: 14px; color: var(--muted); }
.chap .meta { display: flex; align-items: center; gap: 10px; margin-top: 8px; font-size: 13px; color: var(--ink-2); font-weight: 800; font-variant-numeric: tabular-nums; }
.chap .bar { height: 10px; }
.chap.locked { background: var(--c-fffbf8); border-style: dashed; border-bottom-width: 2px; }
.chap.locked .art { background: var(--c-f5eae3); }
.chap.locked .art img { filter: grayscale(1); opacity: .45; }
.chap.locked .n { color: var(--muted); }
.chap.locked h3, .chap.locked h2.h3 { color: var(--ink-2); }
.tag { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 800; padding: 4px 9px; border-radius: 99px; background: var(--c-f5eae3); color: var(--muted); letter-spacing: .02em; }
.tag.done { background: var(--green-tint); color: var(--green-ink); }
.empty { text-align: center; padding: 40px 20px; background: var(--surface); border: 2px dashed var(--line-2); border-radius: 24px; }
.empty img { width: 88px; height: 88px; margin: 0 auto 10px; }
.empty h3, .empty h2.h3 { font-size: 22px; }
.empty p { color: var(--ink-2); margin-top: 6px; }

/* ---------- lesson layout ---------- */
.lesson-top .topbar-in { gap: 10px; }
.lesson-top .progress { flex: 1; max-width: 520px; display: flex; align-items: center; gap: 10px; }
.lesson-top .progress .bar { height: 16px; background: var(--c-f3e6de); }
.lesson-top .progress small { font-weight: 800; color: var(--muted); font-variant-numeric: tabular-nums; font-size: 14px; white-space: nowrap; }
.lesson { max-width: 1180px; margin: 0 auto; display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 32px; padding: 24px 16px 96px; align-items: start; }
.rail { position: sticky; top: 88px; display: grid; gap: 4px; max-height: calc(100dvh - 110px); overflow: auto; padding: 4px; }
.rail h2 { font-size: 14px; color: var(--muted); padding: 4px 10px 8px; font-weight: 800; }
.sec-link {
  display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 14px;
  text-decoration: none; color: var(--ink); border: 2px solid transparent; transition: background-color 150ms ease, border-color 150ms ease;
}
.sec-link:hover { background: var(--c-f5eae3); }
.sec-link .dot { width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; background: var(--c-f3e6de); color: var(--muted); font-weight: 800; font-size: 13px; font-variant-numeric: tabular-nums; }
.sec-link .t { min-width: 0; }
.sec-link .t b { display: block; font-size: 15px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sec-link .t b .zh { font-weight: 700; }
.sec-link .t > span { display: block; font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 700; }
.sec-link .ok { color: var(--green); }
.sec-link.done .dot { background: var(--green-tint); color: var(--green-ink); }
.sec-link[aria-current="true"] { background: var(--surface); border-color: var(--line); box-shadow: var(--shadow-1); }
.sec-link[aria-current="true"] .dot { background: var(--brand-fill-strong); color: var(--on-fill); }

.sec-picker { display: none; }
.content { min-width: 0; max-width: 780px; }
.lesson > main { min-width: 0; }

/* section header */
.sec-head { display: grid; grid-template-columns: auto 1fr; gap: 16px; align-items: center; margin-bottom: 22px; }
.sec-head .art { width: 76px; height: 76px; border-radius: 22px; display: grid; place-items: center; background: var(--tone-tint, var(--brand-tint)); }
.sec-head .art img { width: 56px; height: 56px; }
.sec-head .k { font-size: 14px; font-weight: 800; color: var(--tone-ink, var(--brand-ink)); }
.sec-head h1 { font-size: clamp(26px, 5vw, 36px); }
.sec-head p { color: var(--ink-2); margin-top: 4px; }
.tone-blue { --tone: var(--blue); --tone-tint: var(--blue-tint); --tone-ink: var(--blue-ink); }
.tone-violet { --tone: var(--violet); --tone-tint: var(--violet-tint); --tone-ink: var(--violet-ink); }
.tone-green { --tone: var(--green); --tone-tint: var(--green-tint); --tone-ink: var(--green-ink); }
.tone-orange { --tone: var(--brand); --tone-tint: var(--brand-tint); --tone-ink: var(--brand-ink); }

.block { background: var(--surface); border: 2px solid var(--line); border-radius: var(--r-lg); padding: 22px; margin-bottom: 18px; }
.block > h2 { font-size: 20px; margin-bottom: 14px; }
.block > h2 img { width: 32px; height: 32px; display: inline-block; vertical-align: -7px; margin-right: 8px; }
.block > h2 small { font-size: 14px; color: var(--muted); font-weight: 800; }
.lead { color: var(--ink-2); margin-bottom: 14px; }
.bi { display: grid; gap: 2px; }
.bi .en { color: var(--muted); font-size: .92em; }

.toggles { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.chip-toggle { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 99px; border: 2px solid var(--line); background: var(--surface); font-size: 14px; font-weight: 800; color: var(--ink-2); cursor: pointer; transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease; }
.chip-toggle[aria-pressed="true"] { background: var(--blue-tint); border-color: var(--c-e8bfb8); color: var(--blue-ink); }

/* objectives */
.goals { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; counter-reset: g; }
.goals li { display: grid; grid-template-columns: 34px 1fr; gap: 12px; align-items: start; counter-increment: g; }
.goals li::before { content: counter(g); width: 34px; height: 34px; border-radius: 10px; background: var(--brand-tint); color: var(--brand-ink); display: grid; place-items: center; font-weight: 800; }
.goals .zh { font-weight: 700; color: var(--brand-ink); }
.howto { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.howto img { width: 36px; height: 36px; flex: none; }
.howto div { display: flex; gap: 12px; align-items: center; padding: 12px; border-radius: 14px; background: var(--c-fff8f3); font-size: 15px; }

/* vocabulary cards */
.vocab { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.vcard {
  position: relative; display: grid; gap: 4px; justify-items: center; text-align: center; padding: 16px 10px 14px;
  border-radius: 18px; border: 2px solid var(--line); border-bottom-width: 4px; background: var(--surface); cursor: pointer;
  transition: transform 120ms var(--ease-out), border-color 150ms ease; user-select: none;
}
.vcard:active { transform: scale(.97); }
@media (hover: hover) and (pointer: fine) { .vcard:hover { border-color: var(--c-e8bfb8); } }
.vcard img { width: 64px; height: 64px; margin-bottom: 4px; }
.vcard .zh { font-size: 26px; font-weight: 700; line-height: 1.25; }
.vcard .py { font-size: 15px; }
.vcard .m { font-size: 13.5px; color: var(--ink-2); line-height: 1.3; }
.vcard .m em { font-style: normal; color: var(--muted); display: block; }
.vcard .pos { position: absolute; top: 8px; left: 10px; font-size: 11px; font-weight: 800; color: var(--muted); }
.vcard .spk { position: absolute; top: 8px; right: 8px; color: var(--blue); }
.vcard.playing { border-color: var(--blue); }

.vlist { display: grid; gap: 8px; }
.vrow { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; align-items: center; gap: 14px; padding: 10px 12px; border-radius: 14px; background: var(--c-fff9f5); }
.vrow .w { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.vrow .zh { font-size: 24px; font-weight: 700; }
.vrow .py { font-size: 15px; }
.vrow .m { font-size: 14.5px; color: var(--ink-2); }
.vrow .m em { font-style: normal; color: var(--muted); }
.vrow .pos { font-size: 12px; font-weight: 800; color: var(--muted); padding: 2px 8px; border-radius: 99px; background: var(--c-f3e6de); }

/* dialogue */
.dialogue { display: grid; gap: 14px; }
.line { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 10px; align-items: start; }
.line.r { grid-template-columns: minmax(0, 1fr) 44px; }
.line.r .avatar { order: 2; }
.avatar { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; color: var(--on-fill); font-family: var(--zh); font-weight: 700; font-size: 18px; flex: none; }
.bubble { position: relative; padding: 12px 14px 12px 14px; border-radius: 6px 18px 18px 18px; background: var(--c-fbf1eb); border: 2px solid transparent; max-width: 100%; justify-self: start; transition: border-color 150ms ease, background-color 150ms ease; }
.line.r .bubble { border-radius: 18px 6px 18px 18px; justify-self: end; background: var(--brand-tint); }
.bubble .who { font-size: 12.5px; font-weight: 800; color: var(--muted); margin-bottom: 2px; display: flex; gap: 6px; align-items: baseline; }
.bubble .who .zh { font-weight: 700; color: var(--ink-2); }
.bubble .py { display: block; font-size: 14.5px; margin-bottom: 1px; }
.bubble .zh.say { display: block; font-size: 22px; line-height: 1.5; font-weight: 500; color: var(--ink); }
.bubble .tr { display: none; margin-top: 6px; padding-top: 6px; border-top: 2px dashed var(--c-a58-20-16-p1); font-size: 14.5px; color: var(--ink-2); }
.bubble .tr em { font-style: normal; color: var(--muted); display: block; }
.show-tr .bubble .tr { display: block; }
.hide-py .py { display: none !important; }
.bubble .play { position: absolute; right: 8px; top: 8px; width: 32px; height: 32px; border-radius: 9px; border: 0; background: var(--c-a255-255-255-p8); color: var(--blue); display: grid; place-items: center; cursor: pointer; }
.bubble { padding-right: 48px; }
.bubble.speaking { border-color: var(--blue); background: var(--blue-tint); }
.dlg-bar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }

/* grammar */
.rule { padding: 14px 16px; border-radius: 14px; background: var(--violet-tint); color: var(--c-5a3a00); margin-bottom: 14px; }
.rule b { color: var(--violet-ink); }
.formula { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 10px 0 4px; }
.formula span { padding: 6px 12px; border-radius: 10px; background: var(--on-fill); border: 2px solid var(--c-f3d9a0); font-weight: 800; font-size: 15px; }
.formula span.k { background: var(--violet-deep); border-color: var(--violet-deep); color: var(--on-fill); font-family: var(--zh); font-size: 18px; }
.formula i { font-style: normal; color: var(--violet-ink); font-weight: 800; }
.examples { display: grid; gap: 8px; }
.ex { display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 12px; align-items: center; padding: 10px 12px; border-radius: 14px; background: var(--c-fff9f5); }
.ex .zh { font-size: 20px; display: block; }
.ex .zh mark { background: none; color: var(--violet-ink); font-weight: 700; box-shadow: inset 0 -0.42em 0 var(--c-ffe7a8); border-radius: 2px; }
.ex .py { font-size: 14px; display: block; }
.ex .m { font-size: 14px; color: var(--ink-2); display: block; }
.ex .m em { font-style: normal; color: var(--muted); }
table.grid { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 15px; margin: 6px 0 4px; }
table.grid th { text-align: left; font-size: 12.5px;  color: var(--muted); font-weight: 800; padding: 8px 10px; border-bottom: 2px solid var(--line); }
table.grid td { padding: 10px; border-bottom: 2px solid var(--c-f8ece5); vertical-align: middle; }
table.grid td .zh { font-size: 19px; }
table.grid td .py { display: block; font-size: 13px; }
.scroll-x { overflow-x: auto; }

.fact { display: grid; grid-template-columns: 72px 1fr; gap: 16px; align-items: start; background: var(--gold-tint); border: 2px solid var(--c-ffe7a3); }
.fact img { width: 72px; height: 72px; }
.fact h2 { margin-bottom: 6px; }
.fact p + p { margin-top: 8px; }

/* ---------- activity card ---------- */
.act { border: 2px solid var(--line); border-radius: var(--r-lg); background: var(--surface); margin-bottom: 18px; overflow: hidden; scroll-margin-top: 90px; }
.act-head { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; padding: 16px 18px 12px; }
.act-head .badge { width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center; background: var(--brand-tint); }
.act-head .badge img { width: 32px; height: 32px; }
.act-head h3 { font-size: 18px; }
.act-head p { font-size: 14px; color: var(--muted); font-weight: 700; }
.act-head .best { font-size: 13px; font-weight: 800; color: var(--green-ink); background: var(--green-tint); padding: 5px 10px; border-radius: 99px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.act-prog { display: flex; gap: 5px; padding: 0 18px 4px; }
.act-prog i { flex: 1; height: 8px; border-radius: 99px; background: var(--c-f3e6de); transition: background-color 250ms ease; }
.act-prog i.ok { background: var(--green); }
.act-prog i.no { background: var(--red); }
.act-prog i.cur { background: var(--c-ffd3b2); }
.act-body { padding: 18px; min-height: 120px; }
.act-body.enter { animation: slideIn 260ms var(--ease-out); }
@keyframes slideIn { from { opacity: 0; transform: translateX(16px); } }
.q-prompt { margin-bottom: 16px; }
.q-prompt .ask { font-weight: 800; font-size: 15px; color: var(--ink-2); margin-bottom: 8px; }
.q-prompt .ask em { font-style: normal; color: var(--muted); font-weight: 700; }
.q-prompt .big { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.q-prompt .big .zh { font-size: 30px; font-weight: 700; line-height: 1.35; }
.q-prompt .big .py { display: block; font-size: 16px; }
.q-prompt .pic { width: 120px; height: 120px; object-fit: cover; margin: 4px auto 6px; }
.q-prompt.center { text-align: center; }
.q-prompt.center .big { justify-content: center; }
.q-prompt .blank { display: inline-block; min-width: 3.2em; border-bottom: 3px solid var(--line-2); text-align: center; color: var(--brand-ink); margin: 0 .15em; transition: border-color 150ms ease; }
.q-prompt .blank.filled { border-color: var(--brand); }
.claim { margin-top: 12px; padding: 12px 14px; border-radius: 14px; background: var(--gold-tint); border: 2px solid var(--c-ffe7a3); display: grid; gap: 2px; text-align: left; }
.claim .claim-k { font-size: 12px; font-weight: 800;  color: var(--c-8a5a00); }
.claim .zh { font-size: 22px; font-weight: 700; }
.claim .py { font-size: 14px; }
.listen-big {width: 96px; height: 96px; border-radius: 26px; margin: 4px auto 10px; }
.listen-big .ico { width: 42px; height: 42px; }
.listen-row { display: flex; gap: 10px; justify-content: center; align-items: center; }

.opts { display: grid; gap: 10px; }
.opts.grid2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.opts.pics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.opt {
  display: flex; align-items: center; gap: 12px; text-align: left; width: 100%; min-height: 58px; padding: 10px 14px;
  border: 2px solid var(--line); border-bottom-width: 4px; border-radius: 16px; background: var(--surface); cursor: pointer;
  transition: transform 110ms var(--ease-out), border-color 140ms ease, background-color 140ms ease;
}
.opt:active:not(:disabled) { transform: scale(.98); }
@media (hover: hover) and (pointer: fine) { .opt:hover:not(:disabled) { background: var(--c-fff9f5); } }
.opt .key { width: 28px; height: 28px; border-radius: 8px; border: 2px solid var(--line); display: grid; place-items: center; font-size: 13px; font-weight: 800; color: var(--muted); flex: none; }
.opt .zh { font-size: 22px; font-weight: 500; }
.opt .py { display: block; font-size: 13.5px; }
.opt .t { font-size: 16px; font-weight: 700; }
.opt .t em { display: block; font-style: normal; color: var(--muted); font-size: 14px; }
.opts.pics .opt { flex-direction: column; justify-content: center; text-align: center; padding: 14px 8px; gap: 6px; }
.opts.pics .opt img { width: 72px; height: 72px; }
.opts.pics .opt .key { position: absolute; }
.opt[aria-pressed="true"] { border-color: var(--c-e8bfb8); background: var(--blue-tint); }
.opt[aria-pressed="true"] .key { border-color: var(--blue); color: var(--blue-ink); }
.opt.right { border-color: var(--c-9be3b3); background: var(--green-tint); }
.opt.right .key { border-color: var(--green-deep); background: var(--green-deep); color: var(--on-fill); }
.opt.wrong { border-color: var(--c-ffb7b9); background: var(--red-tint); }
.opt.wrong .key { border-color: var(--red-deep); background: var(--red-deep); color: var(--on-fill); }
.opt:disabled { cursor: default; }

/* match */
.match { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.match .col { display: grid; gap: 10px; align-content: start; }
.mtile {
  display: flex; flex-direction: column; justify-content: center; align-items: center; min-height: 68px; padding: 8px 10px; border: 2px solid var(--line); border-bottom-width: 4px; border-radius: 14px; background: var(--surface);
  cursor: pointer; text-align: center; transition: transform 110ms var(--ease-out), border-color 140ms ease, background-color 140ms ease, opacity 260ms ease;
}
.mtile .zh { font-size: 22px; display: block; }
.mtile .py { font-size: 13px; display: block; }
.mtile .t { font-size: 14.5px; font-weight: 700; }
.mtile .t em { display: block; font-style: normal; color: var(--muted); font-size: 13px; }
.mtile:active { transform: scale(.97); }
.mtile.sel { border-color: var(--blue); background: var(--blue-tint); }
.mtile.ok { border-color: var(--c-9be3b3); background: var(--green-tint); cursor: default; animation: okpop 300ms var(--ease-out); }
.mtile.gone { opacity: .35; pointer-events: none; }
.mtile.bad { border-color: var(--red); background: var(--red-tint); animation: shake 320ms ease; }
@keyframes okpop { 40% { transform: scale(1.04); } }
@keyframes shake { 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }

/* sort */
.buckets { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.bucket { border: 2px dashed var(--line-2); border-radius: 16px; padding: 10px; min-height: 120px; background: var(--c-fffbf8); cursor: pointer; transition: border-color 150ms ease, background-color 150ms ease; display: flex; flex-direction: column; gap: 8px; }
.bucket.armed { border-color: var(--blue); background: var(--blue-tint); }
.bucket h4 { text-align: center; font-size: 15px; }
.bucket h4 .zh { font-size: 26px; display: block; font-weight: 700; color: var(--brand-ink); }
.bucket h4 small { display: block; color: var(--muted); font-size: 12px; font-weight: 800; }
.bucket .in { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.tray { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; padding: 12px; border-radius: 16px; background: var(--c-fbf1eb); min-height: 64px; }
.tile {
  display: inline-flex; flex-direction: column; align-items: center; padding: 6px 12px; border: 2px solid var(--line); border-bottom-width: 4px;
  border-radius: 12px; background: var(--surface); cursor: pointer; transition: transform 110ms var(--ease-out), border-color 140ms ease, background-color 140ms ease;
}
.tile .zh { font-size: 20px; line-height: 1.3; }
.tile .py { font-size: 12px; }
.tile:active { transform: scale(.95); }
.tile.sel { border-color: var(--blue); background: var(--blue-tint); transform: translateY(-2px); }
.tile.right { border-color: var(--c-9be3b3); background: var(--green-tint); }
.tile.wrong { border-color: var(--c-ffb7b9); background: var(--red-tint); }
.tile.ghost { visibility: hidden; }

/* build */
.answer-line { min-height: 72px; display: flex; flex-wrap: wrap; gap: 8px; align-content: flex-start; padding: 10px 4px 12px; border-bottom: 2px solid var(--line); margin-bottom: 16px; background-image: linear-gradient(to bottom, transparent 66px, var(--line) 66px, var(--line) 68px, transparent 68px); background-size: 100% 70px; }
.answer-line.vertical { flex-direction: column; flex-wrap: nowrap; background: none; border: 2px dashed var(--line-2); border-radius: 16px; padding: 10px; min-height: 100px; }
.tray.vertical { flex-direction: column; align-items: stretch; }
.tile.long { flex-direction: row; justify-content: flex-start; gap: 10px; text-align: left; align-items: center; width: 100%; padding: 10px 12px; }
.tile.long .who { font-family: var(--zh); font-weight: 700; color: var(--brand-ink); font-size: 15px; flex: none; }
.tile.long .zh { font-size: 18px; display: block; }
.tile.long .py { display: block; }
.tray.vertical .tile.ghost { display: none; }

/* footer + feedback */
.act-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 18px 18px; border-top: 2px solid var(--line); background: var(--c-fffcfa); transition: background-color 200ms ease, border-color 200ms ease; }
.act-foot .fb { flex: 1; display: none; align-items: center; gap: 12px; min-width: 0; }
.act-foot .fb .mark { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--on-fill); flex: none; }
.act-foot .fb .mark .ico { width: 26px; height: 26px; stroke-width: 3; }
.act-foot .fb b { display: block; font-size: 18px; font-weight: 800; }
.act-foot .fb .msg { display: block; font-size: 14.5px; font-weight: 700; }
.act-foot .fb .msg .zh { font-size: 17px; }
.act-foot.is-right { background: var(--green-tint); border-color: var(--c-c3edd1); }
.act-foot.is-right .fb { display: flex; color: var(--green-ink); }
.act-foot.is-right .fb .mark { color: var(--green); }
.act-foot.is-wrong { background: var(--red-tint); border-color: var(--c-ffd0d1); }
.act-foot.is-wrong .fb { display: flex; color: var(--red-ink); }
.act-foot.is-wrong .fb .mark { color: var(--red); }
.act-foot.is-right .fb, .act-foot.is-wrong .fb { animation: fbIn 240ms var(--ease-out); }
@keyframes fbIn { from { opacity: 0; transform: translateY(6px); } }

/* result */
.result { text-align: center; padding: 8px 4px 4px; display: grid; gap: 8px; justify-items: center; }
.result img { width: 96px; height: 96px; }
.result h4 { font-size: 24px; }
.result .score { font-size: 15px; color: var(--ink-2); font-weight: 800; }
.stars { display: flex; gap: 6px; margin: 2px 0 4px; }
.stars img { width: 38px; height: 38px; }
.stars img.off { filter: grayscale(1); opacity: .25; }
.stars img.on { animation: starIn 420ms var(--ease-out) both; }
.stars img.on:nth-child(2) { animation-delay: 110ms; }
.stars img.on:nth-child(3) { animation-delay: 220ms; }
@keyframes starIn { from { opacity: 0; transform: scale(.6) rotate(-20deg); } }
.stats { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 4px; }
.stat { min-width: 110px; padding: 8px 12px; border-radius: 14px; border: 2px solid var(--line); font-variant-numeric: tabular-nums; }
.stat b { display: block; font-size: 22px; font-weight: 800; }
.stat span { font-size: 12.5px; color: var(--muted); font-weight: 800; }
.stat.gold { border-color: var(--c-ffe29a); background: var(--gold-tint); }
.stat.gold b { color: var(--c-a06a00); }

/* section footer */
.sec-next { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 26px; padding-top: 22px; border-top: 2px solid var(--line); flex-wrap: wrap; }
.sec-next .status { display: flex; align-items: center; gap: 10px; color: var(--ink-2); font-weight: 800; font-size: 15px; }
.sec-next .status.ok { color: var(--green-ink); }

/* chapter complete banner */
.finish { text-align: center; padding: 28px 22px; border-radius: 24px; background: var(--green-deep); color: var(--on-fill); box-shadow: 0 6px 0 var(--green-ink); margin-top: 22px; }
.finish img { width: 96px; height: 96px; margin: 0 auto 6px; }
.finish h2 { font-size: 28px; }
.finish p { opacity: .95; margin-top: 4px; }
.finish .btn { --c: var(--on-fill); --cd: var(--c-bfe8cd); --tc: var(--green-ink); margin-top: 14px; }

/* ---------- responsive ---------- */
@media (max-width: 960px) {
  .lesson { grid-template-columns: 1fr; padding-top: 12px; gap: 0; }
  .rail { display: none; }
  .sec-picker { display: block; position: relative; margin-bottom: 18px; }
  .sec-picker > button { width: 100%; display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 14px; border: 2px solid var(--line); background: var(--surface); cursor: pointer; text-align: left; font-weight: 800; min-height: 52px; }
  .sec-picker > button .t { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .sec-picker > button small { color: var(--muted); font-variant-numeric: tabular-nums; }
  .sec-picker .menu { position: absolute; left: 0; right: 0; top: calc(100% + 8px); background: var(--surface); border: 2px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-2); padding: 6px; z-index: 25; max-height: 70dvh; overflow: auto; transform-origin: top center; animation: pop 180ms var(--ease-out); }
  .content { max-width: none; }
}
@media (max-width: 560px) {
  body { font-size: 16px; }
  .topbar-in { height: 58px; padding: 0 12px; }
  .brand small { display: none; }
  .brand b { font-size: 17px; }
  .points { padding: 5px 10px 5px 6px; }
  .block, .act-body { padding: 16px; }
  .act-head { padding: 14px 14px 10px; }
  .act-prog { padding: 0 14px 4px; }
  .act-foot { padding: 12px 14px 14px; flex-wrap: wrap; }
  .act-foot .fb { flex-basis: 100%; }
  .act-foot .btn { flex: 1; }
  .continue { grid-template-columns: 1fr; padding: 18px; }
  .continue .art { width: 72px; height: 72px; border-radius: 18px; }
  .continue .art img { width: 52px; height: 52px; }
  .vocab { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .vcard .zh { font-size: 22px; }
  .vrow { grid-template-columns: 40px minmax(0, 1fr); }
  .vrow .pos { display: none; }
  .bubble .zh.say { font-size: 20px; }
  .q-prompt .big .zh { font-size: 26px; }
  .opt .zh { font-size: 20px; }
  .lesson-top .progress small { display: none; }
  .fact { grid-template-columns: 1fr; }
  .fact img { width: 56px; height: 56px; }
  .match { gap: 8px; }
  .mtile .zh { font-size: 19px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; }
}

/* rail groups */
.rail-group {
  display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 10px;
  margin: 16px 2px 8px; padding: 9px 12px 9px 9px; border-radius: 16px; color: var(--on-fill);
  background: linear-gradient(135deg, var(--brand-fill-strong) 0%, var(--brand-fill-deep) 55%, var(--c-8f3a05) 100%);
  box-shadow: 0 4px 0 var(--c-7e3300), 0 10px 22px -8px var(--c-a194-84-10-p55), inset 0 1px 0 var(--c-a255-255-255-p25);
  position: relative; overflow: hidden;
}
.rail-group::after { content: ''; position: absolute; right: -24px; top: -30px; width: 90px; height: 90px; border-radius: 50%; background: var(--c-a255-255-255-p10); pointer-events: none; }
.rail-group:first-of-type { margin-top: 6px; }
.rail-group .gi { width: 34px; height: 34px; border-radius: 11px; background: var(--c-a255-255-255-p22); display: grid; place-items: center; box-shadow: inset 0 -2px 0 var(--c-a0-0-0-p08); }
.rail-group .gi img { width: 24px; height: 24px; }
.rail-group .gt { display: grid; gap: 0; min-width: 0; }
.rail-group .gt b { font-size: 15px; font-weight: 800; }
.rail-group .gt small { font-size: 12px; font-weight: 700; color: var(--on-fill); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rail-group .gt small .zh { color: var(--on-fill); }
.rail-group .gc { font-size: 12px; font-weight: 800; padding: 3px 8px; border-radius: 99px; background: var(--c-a0-0-0-p18); font-variant-numeric: tabular-nums; position: relative; z-index: 1; }
.rail-group.done .gc { background: var(--on-fill); color: var(--green-ink); display: grid; place-items: center; padding: 3px 6px; }
.rail-group .gc .ico { width: 14px; height: 14px; stroke-width: 3; }
.sec-picker .menu .rail-group { margin: 12px 2px 6px; }
.sec-link .t b .zh { font-weight: 700; }

/* textbook dialogue placeholder */
.tb-open { display: grid; grid-template-columns: 56px 1fr; gap: 14px; align-items: center; padding: 14px 16px; border-radius: 16px; background: var(--blue-tint); color: var(--blue-ink); }
.tb-open img { width: 56px; height: 56px; }
.tb-open b { display: block; font-size: 17px; }
.tb-open span { display: block; font-size: 15px; color: var(--ink-2); font-weight: 700; }
.tb-open span .zh { display: inline; color: var(--ink); }
[hidden] { display: none !important; }

/* lecturer mode */
.lec-band { display: grid; grid-template-columns: 48px 1fr auto auto; gap: 14px; align-items: center; padding: 12px 16px; border-radius: 18px; margin-bottom: 18px; color: var(--on-fill);
  background: linear-gradient(135deg, var(--c-a3261f) 0%, var(--c-8e1e1a) 60%, var(--c-741714) 100%); box-shadow: 0 4px 0 var(--c-5a100d), 0 10px 22px -10px var(--c-a90-16-13-p55); }
.lec-band img { width: 48px; height: 48px; }
.lec-band b { display: block; font-size: 16px; }
.lec-band span { display: block; font-size: 13.5px; color: var(--c-ffe7a8); font-weight: 700; }
.lec-band .select { min-height: 42px; width: auto; background-color: var(--on-fill); }
.lec-band .btn.ghost { --c: var(--on-fill); --cd: var(--c-f3d9a0); --tc: var(--violet-ink); border-color: var(--on-fill); }
.lec-tag { display: inline-flex !important; align-items: center; gap: 6px; color: var(--violet-ink) !important; font-weight: 800; }
.lec-tag .ico { width: 14px; height: 14px; }
@media (max-width: 640px) { .lec-band { grid-template-columns: 40px 1fr; } .lec-band img { width: 40px; height: 40px; } .lec-band .select, .lec-band .btn { grid-column: 1 / -1; } }

/* home button */
.home-btn { display: inline-flex; align-items: center; gap: 7px; height: 42px; padding: 0 14px 0 12px; border-radius: 13px; text-decoration: none; font-weight: 800; font-size: 15px;
  color: var(--brand-ink); background: var(--brand-tint); border: 2px solid var(--c-ffd3b2); box-shadow: 0 3px 0 var(--c-ffc59a); transition: transform 110ms var(--ease-out), box-shadow 110ms var(--ease-out); flex: none; }
.home-btn .ico { width: 20px; height: 20px; }
.home-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--c-ffc59a); }
@media (max-width: 560px) { .home-btn { padding: 0 11px; } .home-btn span { display: none; } }

/* part-of-speech (singkatan) */
.pos-full { color: var(--muted); font-weight: 700; }
.vrow .pos { display: inline-flex; flex-direction: column; align-items: flex-end; text-align: right; gap: 0; line-height: 1.2; padding: 4px 10px; border-radius: 10px; }
.vrow .pos small { font-size: 11px; font-weight: 700; color: var(--muted); }
.singkatan { margin-top: 14px; padding-top: 12px; border-top: 2px dashed var(--line); display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13.5px; color: var(--ink-2); }
.singkatan b { font-weight: 800; color: var(--ink); }
.singkatan .zh { color: var(--muted); }
@media (max-width: 560px) { .vrow .pos { display: inline-flex !important; grid-column: 2; justify-self: start; align-items: flex-start; text-align: left; flex-direction: row; gap: 6px; } }

/* colour swatches */
.swatch { display: block; width: 64px; height: 64px; border-radius: 50%; margin: 0 auto 6px; flex: none;
  box-shadow: inset 0 -6px 12px var(--c-a0-0-0-p18), inset 0 6px 10px var(--c-a255-255-255-p35), 0 3px 8px var(--c-a58-20-16-p15); border: 2px solid var(--c-a58-20-16-p08); }
.swatch.big { width: 120px; height: 120px; margin: 6px auto 10px; }
.opts.pics .opt .swatch { width: 60px; height: 60px; margin: 0 auto; }
.time-strip { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 4px; }
.time-strip div { border-radius: 14px; padding: 12px; text-align: center; background: var(--c-fff9f5); border: 2px solid var(--line); }
.time-strip div.now { background: var(--brand-tint); border-color: var(--c-ffd3b2); }
.time-strip b { display: block; font-family: var(--zh); font-size: 22px; }
.time-strip span { font-size: 13.5px; color: var(--ink-2); font-weight: 700; }
.vcard .swatch { width: 56px; height: 56px; margin: 4px auto 6px; }

/* write (汉字) */
.hz-word { display: flex; align-items: center; gap: 14px; margin-top: 8px; }
.hz-word .py { display: block; font-size: 15px; color: var(--muted); font-weight: 700; }
.hz-word .zh { display: block; font-size: 30px; line-height: 1.2; }
.hz-word .m { display: block; font-size: 15px; color: var(--ink-2); }
.hz-row { display: flex; justify-content: center; gap: 16px; margin: 18px 0 12px; flex-wrap: wrap; }
.hz-box { position: relative; width: 240px; height: 240px; border: 3px solid var(--line-2); border-radius: 16px; background: var(--c-fffdf8); touch-action: none; transition: border-color 160ms var(--ease-out), box-shadow 160ms var(--ease-out); }
.hz-box.on { border-color: var(--orange, var(--c-f2711c)); box-shadow: 0 0 0 4px var(--c-a238-106-16-p14); }
.hz-box.ok { border-color: var(--green, var(--c-24a353)); box-shadow: none; }
.hz-grid { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.hz-grid path { stroke: var(--c-f1c9a8); stroke-width: .6; stroke-dasharray: 2 2; fill: none; }
.hz-pad { position: absolute; inset: 0; }
.hz-tools { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }
.hz-note { text-align: center; font-size: 14px; margin-top: 10px; }

.vcard .nw { white-space: nowrap; }
.vcard .zh.multi { font-size: 21px; line-height: 1.35; }
@media (max-width: 560px) { .vcard .zh.multi { font-size: 18px; } }

/* dress-up */
.dress { display: grid; grid-template-columns: minmax(180px, 240px) 1fr; gap: 18px; margin-top: 14px; align-items: start; }
.dress-stage { background: linear-gradient(var(--c-fff7ee), var(--c-ffebd6)); border: 2px solid var(--line); border-radius: 18px; padding: 10px; display: grid; place-items: center; }
.dress-fig { width: 100%; max-width: 210px; height: auto; display: block; }
.dress-label { font-weight: 800; font-size: 14px; color: var(--ink-2); margin: 4px 0 8px; }
.dress-label .muted { font-weight: 600; font-size: 12.5px; }
.dress-items { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-bottom: 14px; }
.dress-item { display: grid; justify-items: center; gap: 1px; padding: 8px 4px; border-radius: 14px; border: 2px solid var(--line-2); background: var(--surface); cursor: pointer; box-shadow: 0 3px 0 var(--line-2); transition: transform 120ms var(--ease-out), border-color 120ms; }
.dress-item:active { transform: scale(.96); }
.dress-item img { width: 40px; height: 40px; }
.dress-item .zh { font-size: 17px; font-weight: 700; }
.dress-item .py { font-size: 11.5px; color: var(--muted); font-weight: 700; }
.dress-item.on { border-color: var(--green, var(--c-24a353)); background: var(--c-effaf2); box-shadow: 0 3px 0 var(--c-9ad7ae); }
.dress-item.sel { border-color: var(--brand, var(--c-f2711c)); box-shadow: 0 0 0 3px var(--c-a238-106-16-p18), 0 3px 0 var(--c-f3b98c); }
.dress-colors { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
.dress-col { display: grid; justify-items: center; gap: 4px; padding: 8px 2px; border-radius: 12px; border: 2px solid var(--line-2); background: var(--surface); cursor: pointer; }
.dress-col .sw { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--c-2a2a38); }
.dress-col .zh { font-size: 14px; font-weight: 700; }
.dress-col:disabled { opacity: .45; cursor: not-allowed; }
.dress-col.on { border-color: var(--brand, var(--c-f2711c)); background: var(--c-fff3e8); }
@media (max-width: 640px) {
  .dress { grid-template-columns: 1fr; }
  .dress-stage { max-width: 220px; margin: 0 auto; }
  .dress-colors { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* textbook photos */
.vcard img[src*="/bj-"] { width: 112px; height: 112px; border-radius: 16px; }
.opts.pics .opt img[src*="/bj-"] { width: 96px; height: 96px; border-radius: 14px; }
.q-prompt .pic[src*="/bj-"] { width: 180px; height: 180px; border-radius: 20px; }
.vcard img[src*="/ppl-"] { width: 104px; height: 104px; border-radius: 22px; }
.opts.pics .opt img[src*="/ppl-"] { width: 88px; height: 88px; border-radius: 18px; }

/* phone proportions */
@media (max-width: 560px) {
  .sec-head { gap: 12px; margin-bottom: 16px; }
  .sec-head .art { width: 56px; height: 56px; border-radius: 16px; }
  .sec-head .art img { width: 40px; height: 40px; }
  .sec-head h1 { font-size: 25px; }
  .sec-head p { font-size: 15px; }
  .block > h2 { font-size: 18px; line-height: 1.3; }
  .block > h2 img { width: 26px; height: 26px; vertical-align: -6px; margin-right: 6px; }
  .block > h2 small { font-size: 13px; }
  .vcard img[src*="/bj-"] { width: 92px; height: 92px; }
  .vcard img[src*="/ppl-"] { width: 88px; height: 88px; }
  .q-prompt .pic[src*="/bj-"] { width: 150px; height: 150px; }
  .rep-actions { display: grid !important; grid-template-columns: 1fr; }
  .rep-actions .btn { width: 100%; }
  .btn .sub { font-size: .92em; }
  .hz-box { max-width: calc(100% - 8px); max-height: calc(100svw - 72px); }
}
@media (max-width: 380px) {
  .vocab { gap: 8px; }
  .vcard { padding-left: 8px; padding-right: 8px; }
  .vcard .zh { font-size: 20px; }
  .opt .zh { font-size: 18px; }
}

/* footer credit */
.site-foot { border-top: 2px solid var(--line); background: var(--c-fffbf8); color: var(--muted); font-size: 13.5px; line-height: 1.55; }
.site-foot .sf-in { max-width: 1180px; margin: 0 auto; padding: 22px 20px 28px; display: grid; gap: 4px; text-align: center; }
.site-foot b { color: var(--ink-2); font-weight: 800; }
.site-foot .sf-brand b { font-size: 15px; color: var(--ink); }
.site-foot .sf-brand span { color: var(--brand-ink); }
.site-foot a { color: var(--blue-ink, var(--c-0d72a8)); font-weight: 700; text-decoration: none; overflow-wrap: anywhere; }
.site-foot .sf-small { font-size: 12.5px; margin-top: 4px; }
.sf-credits { max-width: 720px; margin: 6px auto 0; font-size: 12.5px; text-align: left; }
.sf-credits summary { cursor: pointer; text-align: center; font-weight: 800; color: var(--ink-2); list-style: none; }
.sf-credits summary::-webkit-details-marker { display: none; }
.sf-credits p { margin-top: 8px; }
@media print { .site-foot { display: none; } }

/* ---------- revision sections ---------- */
.chap.rev { background: linear-gradient(135deg, var(--on-fill) 55%, var(--violet-tint)); }
.chap.rev .art { background: var(--violet-tint); }
.chap.rev .n { color: var(--violet-ink); }
.test-brief { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; margin-top: 12px; }
.test-brief > div { border: 2px solid var(--line); border-radius: var(--r); padding: 14px 16px; background: var(--surface); }
.test-brief h4 { margin: 0 0 6px; font-size: 16px; display: flex; align-items: center; gap: 8px; }
.test-brief h4 img { width: 28px; height: 28px; }
.test-brief ul { margin: 0; padding-left: 18px; font-size: 14.5px; color: var(--ink-2); line-height: 1.55; }
.test-brief em, .tips em { color: var(--muted); font-style: normal; }
.tips { margin: 10px 0 0; padding-left: 20px; line-height: 1.6; }
.tips li { margin: 4px 0; }
.recap { width: 100%; border-collapse: collapse; font-size: 15px; }
.recap th, .recap td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.recap th { font-size: 13px; color: var(--muted); }
.recap td .zh { font-size: 17px; }
.recap td .py { display: block; font-size: 12.5px; color: var(--muted); font-weight: 700; }
.recap td a { font-weight: 800; color: var(--brand-ink); white-space: nowrap; font-size: 13px; }
.recap mark { background: var(--c-ffe2c7); border-radius: 4px; padding: 0 2px; color: inherit; }
.listen-hide summary { cursor: pointer; font-weight: 800; color: var(--brand-ink); margin-top: 10px; }
.listen-hide[open] summary { margin-bottom: 8px; }

/* ---------- speak activity ---------- */
.sp-q { justify-content: center; }
.sp-q .m { display: block; font-size: 14.5px; color: var(--muted); font-weight: 700; margin-top: 2px; }
.sp-tip { display: flex; gap: 8px; align-items: flex-start; justify-content: center; font-size: 14.5px; color: var(--ink-2); margin: 10px auto 0; max-width: 520px; text-align: left; }
.sp-tip .ico { width: 18px; height: 18px; flex: none; color: var(--gold-deep); margin-top: 2px; }
.sp-tip em { color: var(--muted); font-style: normal; }
.sp { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 6px 0 4px; text-align: center; }
.sp-mic { width: 84px; height: 84px; border-radius: 50%; border: 0; background: var(--red-deep); color: var(--on-fill); display: grid; place-items: center; cursor: pointer;
  box-shadow: 0 5px 0 var(--red-deep); transition: transform 160ms var(--ease-out), box-shadow 160ms var(--ease-out); }
.sp-mic .ico { width: 36px; height: 36px; }
.sp-mic:active { transform: translateY(3px) scale(.97); box-shadow: 0 2px 0 var(--red-deep); }
.sp-mic:disabled { background: var(--line-2); box-shadow: 0 5px 0 var(--c-d8bfb2); cursor: default; }
.sp-mic.on { background: var(--ink); box-shadow: 0 5px 0 var(--c-000000); animation: sp-pulse 1.4s ease-in-out infinite; }
.sp-mic.on .ico { width: 28px; height: 28px; }
.sp-mic.wide { width: auto; height: auto; border-radius: 18px; padding: 14px 22px; display: flex; gap: 10px; font: 800 17px var(--ui); text-align: left; }
.sp-mic.wide small { display: block; font-size: 13px; opacity: .85; }
@keyframes sp-pulse { 0%, 100% { outline: 0 solid var(--c-a240-73-79-p35); } 50% { outline: 12px solid var(--c-a240-73-79-0); } }
@media (prefers-reduced-motion: reduce) { .sp-mic.on { animation: none; } }
.sp-status { font-weight: 800; color: var(--ink-2); font-size: 15px; }
.sp-status em, .sp-self em { font-style: normal; color: var(--muted); font-weight: 700; }
.sp-note em { font-style: normal; }
.sp-heard { background: var(--blue-tint); border-radius: var(--r); padding: 10px 16px; min-width: 220px; max-width: 100%; }
.sp-heard small { display: block; font-size: 12px; font-weight: 800; color: var(--blue-ink); letter-spacing: .03em; }
.sp-heard .zh { font-size: 22px; }
.sp-tools { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.sp-model { border: 2px dashed var(--green); background: var(--green-tint); border-radius: var(--r); padding: 12px 16px; text-align: left; max-width: 100%; }
.sp-model > b { display: block; font-size: 12.5px; color: var(--green-ink); letter-spacing: .03em; margin-bottom: 6px; }
.sp-row { display: flex; gap: 12px; align-items: center; }
.sp-row .py { display: block; font-size: 13.5px; color: var(--muted); font-weight: 700; }
.sp-row .zh { display: block; font-size: 22px; line-height: 1.35; }
.sp-row .m { display: block; font-size: 14px; color: var(--ink-2); }
.sp-row .m em { color: var(--muted); font-style: normal; }
.sp-self p { margin: 0 0 8px; font-weight: 700; }
.sp-self > div { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.sp-note { font-size: 12.5px; color: var(--muted); margin: 0; }
@media (max-width: 560px) {
  .sp-mic { width: 74px; height: 74px; }
  .sp-row .zh, .sp-heard .zh { font-size: 19px; }
  .recap { font-size: 14px; } .recap th, .recap td { padding: 8px 6px; }
}
@media (max-width: 560px) {
  .recap.gram thead { display: none; }
  .recap.gram, .recap.gram tbody { display: block; }
  .recap.gram tr { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 10px 2px; border-bottom: 1px solid var(--line); }
  .recap.gram td { border: 0; padding: 0; }
  .recap.gram td:nth-child(1) { grid-column: 1; grid-row: 1; }
  .recap.gram td:nth-child(4) { grid-column: 2; grid-row: 1; align-self: center; }
  .recap.gram td:nth-child(2), .recap.gram td:nth-child(3) { grid-column: 1 / -1; }
  .recap.gram td:nth-child(3) .zh { font-size: 18px; }
}
.empty .tag.soon { display: inline-flex; align-items: center; gap: 6px; margin: 4px 0 8px; padding: 6px 12px; border-radius: 999px; background: var(--violet-tint); color: var(--violet-ink); font-weight: 800; font-size: 13.5px; }
.empty .tag.soon .ico { width: 15px; height: 15px; }
.chap.rev.locked { background: var(--c-fffbf8); }
.chap.rev.locked .art { background: var(--c-f5eae3); }

/* ---------- pinyin charts (Conversational Mandarin Bab 1) ---------- */
.pyonly { font-family: var(--ui) !important; font-weight: 800; letter-spacing: .01em; }
.py-h { display: flex; align-items: baseline; flex-wrap: wrap; gap: 8px; margin: 18px 0 8px; font-size: 18px; }
.py-h .zh { font-size: 20px; }
.py-h .pyl { font-weight: 800; color: var(--brand-ink); }
.py-h small { font-size: 13.5px; color: var(--muted); font-weight: 700; }
.pygrid { display: grid; grid-template-columns: repeat(var(--cols, 6), minmax(0, 1fr)); gap: 8px; }
.pykey { border: 2px solid var(--line); background: var(--surface); border-radius: 14px; padding: 10px 4px 8px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 2px;
  box-shadow: 0 3px 0 var(--line); transition: transform 140ms var(--ease-out), box-shadow 140ms var(--ease-out), border-color 140ms; font-family: var(--ui); }
.pykey b { font-size: 22px; font-weight: 800; color: var(--ink); }
.pykey small { font-size: 12.5px; color: var(--muted); font-weight: 700; }
.pykey:hover { border-color: var(--brand); }
.pykey:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--line); }
.pykey.playing { border-color: var(--brand); background: var(--brand-tint); }
.py-note { display: flex; gap: 10px; margin-top: 14px; padding: 12px 14px; border-radius: var(--r); background: var(--gold-tint, var(--c-fff7e0)); font-size: 14.5px; line-height: 1.55; }
.py-note .ico { width: 18px; height: 18px; flex: none; color: var(--gold-deep); margin-top: 2px; }
.syl { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 10px; margin: 14px 0 6px; font-family: var(--ui); }
.syl .part { border-radius: 14px; padding: 8px 14px; text-align: center; font-weight: 800; font-size: 24px; min-width: 64px; }
.syl .part small { display: block; font-size: 12px; font-weight: 800; opacity: .8; }
.syl .p1 { background: var(--blue-tint); color: var(--blue-ink); }
.syl .p2 { background: var(--green-tint); color: var(--green-ink); }
.syl .p3 { background: var(--violet-tint); color: var(--violet-ink); }
.syl .op { font-size: 22px; font-weight: 800; color: var(--muted); }
.syl .res { background: var(--brand-tint); color: var(--brand-ink); }
.big-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 14px; }
.big-stats div { border-radius: var(--r); padding: 12px; text-align: center; background: var(--surface-2, var(--c-fff8f3)); }
.big-stats b { display: block; font: 800 30px var(--ui); color: var(--brand-ink); font-variant-numeric: tabular-nums; }
.big-stats span { font-size: 14px; font-weight: 700; }
.tone-tbl { width: 100%; border-collapse: collapse; font-size: 15px; }
.tone-tbl td, .tone-tbl th { padding: 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.tone-tbl th { font-size: 13px; color: var(--muted); }
.tone-tbl .mk { font: 800 26px var(--ui); white-space: nowrap; }
.tone-svg { width: 100%; max-width: 560px; display: block; margin: 14px auto 0; }
@media (max-width: 560px) {
  .pygrid { grid-template-columns: repeat(min(var(--cols, 6), 4), minmax(0, 1fr)); }
  .pykey b { font-size: 19px; }
  .syl .part { font-size: 20px; min-width: 52px; padding: 6px 10px; }
  .big-stats b { font-size: 24px; }
}
.opt .pyonly, .tile .pyonly { font-size: 22px; }
.tile .pyonly { font-size: 20px; }

/* ---------- substitution drills (替换练习) ---------- */
.subst-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.subst-head > h2 { margin: 0; }
.subst .sno { flex: none; display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--ink); color: var(--on-fill); font: 800 15px var(--ui); margin-right: 4px; }
.sub-t { border-collapse: separate; border-spacing: 0 6px; width: 100%; }
.sub-t th { text-align: left; font-size: 13px; font-weight: 800; color: var(--ink-2); background: var(--c-fff8d6); padding: 8px 12px; }
.sub-t th small { display: block; font-size: 11.5px; color: var(--muted); font-weight: 700; }
.sub-t th:first-child { border-radius: 10px 0 0 10px; } .sub-t th:last-child { border-radius: 0 10px 10px 0; }
.sub-row { cursor: pointer; }
.sub-row td { padding: 8px 12px; background: var(--surface); border-top: 2px solid var(--line); border-bottom: 2px solid var(--line); vertical-align: bottom; white-space: nowrap; transition: background 140ms; }
.sub-row td:first-child { border-left: 2px solid var(--line); border-radius: 12px 0 0 12px; }
.sub-row td:last-child { border-right: 2px solid var(--line); border-radius: 0 12px 12px 0; }
.sub-row td.v { background: var(--c-fbe9e1); }
.sub-row td .py { display: block; font-size: 12.5px; color: var(--muted); font-weight: 700; min-height: 1em; }
.sub-row td .zh { font-size: 21px; }
.sub-row td.end { color: var(--blue); text-align: right; }
.sub-row td.end .ico { width: 20px; height: 20px; vertical-align: middle; margin-left: 6px; }
.sub-row:hover td, .sub-row.playing td { border-color: var(--blue); }
.sub-row.playing td { background: var(--blue-tint); }
.site-foot .internal { margin-top: 4px; font-weight: 800; letter-spacing: .02em; }
@media (max-width: 560px) { .sub-row td { padding: 6px 8px; } .sub-row td .zh { font-size: 18px; } }

/* ---------- pinyin combination chart (拼合总表) and rule tables ---------- */
.tone-tbl .pykey { display: inline-flex; flex-direction: column; align-items: center; margin: 3px 4px 3px 0; padding: 6px 10px; min-width: 0; }
.tone-tbl .pykey b { font-size: 18px; }
.tips .pykey { display: inline-flex; flex-direction: column; padding: 2px 9px; margin: 2px 2px; vertical-align: middle; min-width: 0; }
.tips .pykey b { font-size: 16px; }
.py-chart-wrap { border: 2px solid var(--line); border-radius: var(--r); max-height: 70vh; overflow: auto; }
.py-chart { border-collapse: separate; border-spacing: 0; font-family: var(--ui); }
.py-chart th, .py-chart td { padding: 2px; border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); text-align: center; min-width: 54px; }
.py-chart thead th { position: sticky; top: var(--topbar-h, 64px); z-index: 2; background: var(--c-fff8d6); font-weight: 800; font-size: 15px; padding: 8px 4px; }
.py-chart tbody th { position: sticky; left: 0; z-index: 1; background: var(--green-tint); color: var(--green-ink); font-weight: 800; font-size: 14px; padding: 4px 8px; white-space: nowrap; }
.py-chart tbody th small { display: block; font-size: 10.5px; font-weight: 800; opacity: .8; }
.py-chart thead th.corner { left: 0; z-index: 3; font-size: 11px; line-height: 1.3; }
.py-chart thead th.corner span { display: block; }
.py-chart tbody tr:nth-child(even) td { background: var(--c-fffbf8); }
.py-chart .pykey { width: 100%; padding: 5px 2px; border-width: 1px; box-shadow: none; border-radius: 8px; min-width: 0; }
.py-chart .pykey b { font-size: 13.5px; font-weight: 800; }

/* dress: pinyin under each colour; wraps when the palette is long */
.dress-colors { grid-template-columns: repeat(auto-fill, minmax(62px, 1fr)); }
.dress-col .py { font-size: 11px; font-weight: 700; color: var(--ink-2); opacity: .75; line-height: 1; }

/* ---------- pay: pay a price with Malaysian notes and coins ---------- */
.pay { margin-top: 14px; display: grid; gap: 12px; }
.pay-tray { border: 2px dashed var(--line-2); border-radius: 16px; padding: 12px; background: var(--c-fffbf3); min-height: 92px; }
.pay-head { display: flex; justify-content: space-between; align-items: baseline; font-weight: 800; color: var(--ink-2); font-size: 14px; margin-bottom: 8px; }
.pay-total { font-size: 22px; color: var(--ink); font-variant-numeric: tabular-nums; }
.pay-paid { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.pay-label { font-weight: 800; font-size: 14px; color: var(--ink-2); }
.pay-money { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.pay-btn, .pay-item { border: 0; background: none; padding: 0; cursor: pointer; display: grid; place-items: center; }
.pay-btn { padding: 8px 4px; border-radius: 14px; border: 2px solid var(--line-2); background: var(--surface); transition: transform 160ms cubic-bezier(.23,1,.32,1); }
.pay-btn:active, .pay-item:active { transform: scale(.96); }
.pay-btn:disabled, .pay-item:disabled { cursor: not-allowed; opacity: .7; background: var(--line); color: var(--muted); }
.money { display: inline-grid; place-items: center; font-weight: 800; color: var(--on-fill); text-shadow: 0 1px 0 var(--c-a0-0-0-p25); font-variant-numeric: tabular-nums; }
.money.note { width: 78px; height: 40px; border-radius: 6px; font-size: 14px; background: linear-gradient(135deg, var(--mc), color-mix(in srgb, var(--mc) 70%, var(--c-000000))); border: 2px solid color-mix(in srgb, var(--mc) 60%, var(--c-000000)); }
.money.coin { width: 44px; height: 44px; border-radius: 50%; font-size: 10.5px; line-height: 1.05; text-align: center; color: var(--c-3a3a46); text-shadow: none; background: radial-gradient(circle at 35% 30%, var(--c-coin-shine), transparent 60%), var(--mc); border: 2px solid color-mix(in srgb, var(--mc) 55%, var(--c-000000)); }
.pay-paid .money.note { width: 64px; height: 33px; font-size: 12px; }
.pay-paid .money.coin { width: 36px; height: 36px; font-size: 9px; }

/* ---------- menu card (food stall) ---------- */
.menu-card { margin-top: 12px; border: 2px solid var(--line-2); border-radius: 18px; background: var(--c-fffbf3); padding: 12px; }
.menu-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; align-items: baseline; margin-bottom: 10px; }
.menu-head b { font-size: 17px; }
.menu-head .muted { font-size: 13px; }
.menu-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.menu-card .menu-item { display: grid; grid-template-columns: 40px 1fr auto; align-items: center; gap: 10px; text-align: left; padding: 8px 10px; min-width: 0; width: 100%; }
.menu-item img { width: 40px; height: 40px; }
.menu-item b { display: block; font-size: 17px; }
.menu-item small { display: block; font-size: 12px; color: var(--muted); font-weight: 600; }
.menu-price { font-weight: 800; font-variant-numeric: tabular-nums; color: var(--ink); }

/* ---------- clock: set the time ---------- */
.clock { display: grid; grid-template-columns: minmax(160px, 220px) 1fr; gap: 18px; margin-top: 14px; align-items: center; }
.clock-stage { display: grid; place-items: center; }
.clock-fig { width: 100%; max-width: 220px; height: auto; display: block; }
.clock-panel { display: grid; gap: 10px; }
.clock-digital { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; background: var(--c-2b1712); color: var(--on-fill); border-radius: 14px; padding: 10px 14px; }
.clock-digital b { font-size: 32px; font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.clock-digital .zh { font-size: 18px; font-weight: 700; }
.clock-digital .py { font-size: 13px; opacity: .75; }
.clock-row { display: grid; grid-template-columns: 1fr 52px 52px; gap: 8px; align-items: center; }
.clock-lbl { font-weight: 800; color: var(--ink-2); font-size: 14px; }
.clock-btn { height: 48px; border-radius: 12px; border: 2px solid var(--line-2); background: var(--surface); font-size: 24px; font-weight: 800; color: var(--ink); cursor: pointer; box-shadow: 0 3px 0 var(--line-2); transition: transform 120ms cubic-bezier(.23,1,.32,1); }
.clock-btn:active { transform: translateY(2px) scale(.97); box-shadow: 0 1px 0 var(--line-2); }
.clock-btn:disabled { opacity: .6; cursor: not-allowed; background: var(--line); color: var(--muted); box-shadow: none; }
.clock-note { font-size: 12.5px; margin: 0; }
@media (max-width: 560px) { .clock { grid-template-columns: 1fr; } .clock-fig { max-width: 190px; } }

/* ---------- zodiac (生肖) ---------- */
.zd-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(116px, 1fr)); gap: 8px; margin-top: 8px; }
.zodiac .zd { display: grid; justify-items: center; gap: 2px; padding: 10px 6px; min-width: 0; }
.zodiac .zd img { width: 48px; height: 48px; }
.zodiac .zd b { font-size: 24px; }
.zodiac .zd small { font-size: 12px; }
.zodiac .zd .zd-y { color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.zodiac .zd.on { border-color: var(--orange, var(--c-f2711c)); background: var(--c-fff1e6); }
.zd-find { margin-top: 14px; padding: 12px; border-radius: 16px; background: var(--c-fffbf3); border: 2px dashed var(--line-2); }
.zd-row { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.zd-year { flex: 1 1 140px; min-width: 0; font: inherit; font-size: 18px; padding: 10px 12px; border-radius: 12px; border: 2px solid var(--line-2); }
.zd-out { display: flex; gap: 12px; align-items: center; margin-top: 10px; min-height: 8px; }
.zd-out img { width: 56px; height: 56px; }

/* ---------- strokes: watch a character being written ---------- */
.stk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-top: 8px; }
.stk { display: grid; justify-items: center; gap: 6px; text-align: center; padding: 10px; border: 2px solid var(--line); border-radius: 16px; background: var(--surface); }
.stk .stk-box { width: 120px; height: 120px; }
.stk-note { display: grid; gap: 2px; font-size: 13px; line-height: 1.3; }
.stk-note .muted { font-size: 12px; }
.stk-play .zh { font-size: 17px; }
.stk small { font-size: 12px; }

/* big tappable characters (汉字 introduction) */
.hz-row-big { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.pykey.hz-big { display: inline-grid; justify-items: center; gap: 2px; padding: 8px 14px; min-width: 88px; vertical-align: middle; }
.pykey.hz-big .zh { font-size: 34px; line-height: 1.1; }
.pykey.hz-big small { font-size: 12px; }

/* ---------- Map of Malaysia ---------- */
.mm-wrap { overflow-x: auto; margin-top: 10px; border-radius: 16px; border: 2px solid var(--line); -webkit-overflow-scrolling: touch; }
.mymap { display: block; width: 100%; min-width: 720px; height: auto; user-select: none; -webkit-user-select: none; }
.mm-sea { fill: var(--c-fbeae7); }
.mm-isl { fill: var(--c-f3e8e1); stroke: var(--c-b39a8f); stroke-width: 1; }
.mm-st { stroke: var(--c-7a5f58); stroke-width: 1.2; cursor: pointer; transition: fill 200ms ease, filter 160ms ease; }
.mm-st:hover, .mm-st.on { filter: brightness(.92) saturate(1.4); }
.mm-slot line { stroke: var(--c-5b403a); stroke-width: 1.5; }
.mm-slot circle { fill: var(--c-5b403a); }
.mm-slot rect { fill: var(--on-fill); stroke: var(--c-5b403a); stroke-width: 2; stroke-dasharray: 6 5; cursor: pointer; transition: stroke 160ms ease, fill 160ms ease; }
.mm-slot text { text-anchor: middle; pointer-events: none; fill: var(--c-2b1712); }
.mm-slot .zh { font-size: 19px; font-weight: 700; font-family: var(--zh, 'Noto Sans SC', sans-serif); }
.mm-slot .py { font-size: 12.5px; font-weight: 700; fill: var(--c-765b54); }
.mm-slot.filled rect, .mm-slot.given rect { stroke-dasharray: none; }
.mm-slot.given rect { fill: var(--c-fbf2ec); stroke: var(--c-c9afa3); }
.mm-slot.on rect { stroke: var(--c-f2711c); stroke-width: 3; fill: var(--c-fff1e6); }
.mymap.armed .mm-slot.target rect, .mm-slot.hover rect { stroke: var(--c-f2711c); fill: var(--c-fff6ee); }
.mm-slot.good rect { stroke: var(--c-24a353); fill: var(--c-e4f8ea); stroke-width: 3; }
.mm-slot.bad rect { stroke: var(--c-f0494f); fill: var(--c-ffe8e8); stroke-width: 3; }
.mm-here path { fill: var(--c-f0494f); stroke: var(--on-fill); stroke-width: 2; }
.mm-here text { font-size: 13px; font-weight: 800; fill: var(--c-b4232b); paint-order: stroke; stroke: var(--on-fill); stroke-width: 4px; }
.mm-info { min-height: 40px; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.mm-tray { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.mm-tile { display: inline-grid; justify-items: center; padding: 6px 12px; border-radius: 12px; border: 2px solid var(--line-2); background: var(--surface); box-shadow: 0 3px 0 var(--line-2); cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; transition: transform 140ms cubic-bezier(.23,1,.32,1); }
.mm-tile .zh { font-size: 20px; font-weight: 700; }
.mm-tile .py { font-size: 12px; color: var(--muted); font-weight: 700; }
.mm-tile:active { transform: scale(.97); }
.mm-tile.sel { border-color: var(--c-f2711c); background: var(--c-fff1e6); box-shadow: 0 3px 0 var(--c-f3b184); }
.mm-tile.lift { opacity: .35; }
.mm-ghost { position: fixed; z-index: 9999; pointer-events: none; transform: translate(-50%, -60%) rotate(-3deg) scale(1.05); box-shadow: 0 10px 24px var(--c-a58-20-16-p25); }
.mm-hint { font-size: 13px; margin: 8px 0 0; }
/* keep the name tray in view while scrolling the map */
.act:has(.mm-tray) { overflow: clip; }
.mm-tray { position: sticky; top: 70px; z-index: 6; background: var(--c-a255-255-255-p96); padding: 8px; margin-left: -8px; margin-right: -8px; border-radius: 14px; backdrop-filter: blur(6px); }
.mm-tray:empty, .mm-tray:not(:has(.mm-tile:not([hidden]))) { padding: 0; }

/* ================= theme 2026: orange 60% · dark red 30% · gold 10% ================= */
::selection { background: var(--c-ffd9bc); }
:focus-visible { outline-color: var(--maroon); }
.topbar :focus-visible, .s-hero :focus-visible { outline-color: var(--gold); }
h1, h2, h3, h4 { letter-spacing: -0.02em; }

/* top bar: dark red */
.topbar { background: var(--maroon); border-bottom: 0; box-shadow: 0 1px 0 var(--c-a0-0-0-p08), 0 6px 20px -12px var(--c-a90-16-13-p6); backdrop-filter: none; -webkit-backdrop-filter: none; }
.brand, .brand b { color: var(--on-fill); }
.brand b span { color: var(--gold); }
.brand small { color: var(--c-f3c9c2); }
.brand img { background: var(--c-a255-255-255-p12); border-radius: 10px; padding: 3px; }
.points { background: var(--c-a255-255-255-p12); color: var(--c-ffe7a8); box-shadow: inset 0 0 0 1.5px var(--c-a244-183-36-p45); }
.acct-btn { background: var(--gold); color: var(--maroon-deep); box-shadow: 0 3px 0 var(--gold-deep); }
.home-btn { color: var(--on-fill); background: var(--c-a255-255-255-p12); border-color: var(--c-a255-255-255-p22); box-shadow: none; }
.home-btn:active { box-shadow: none; }
.lesson-top .progress .bar { background: var(--c-a255-255-255-p16); }
.lesson-top .progress .bar > i { background: var(--gold); }
.lesson-top .progress small { color: var(--c-ffe7a8); }
.topbar .icon-btn { color: var(--c-f3c9c2); }
@media (hover: hover) and (pointer: fine) { .topbar .icon-btn:hover { background: var(--c-a255-255-255-p12); color: var(--on-fill); } }

/* progress bars: orange (done tags stay green) */
.bar > i { background: var(--brand); }

/* selection states: gold, so 'chosen' never looks like 'wrong' */
.opt[aria-pressed="true"] { border-color: var(--gold); background: var(--gold-tint); }
.opt[aria-pressed="true"] .key { border-color: var(--gold-deep); color: var(--gold-ink); }
.mtile.sel, .bucket.armed, .tile.sel { border-color: var(--gold); background: var(--gold-tint); }
.chip-toggle[aria-pressed="true"] { background: var(--gold-tint); border-color: var(--c-f0d58a); color: var(--gold-ink); }

/* inputs */
.input:focus, .select:focus { box-shadow: 0 0 0 4px var(--brand-tint); }
.linkish { white-space: nowrap; color: var(--maroon); }
.linkish:hover { background: var(--maroon-tint); }

/* ================= sign-in wizard ================= */
.auth { padding: 32px 16px 40px; background:
  radial-gradient(900px 520px at 110% -10%, var(--c-ffd9bc) 0%, transparent 60%),
  radial-gradient(760px 520px at -20% 110%, var(--c-f6d2cc) 0%, transparent 60%), var(--bg); }
.auth-card { max-width: 520px; border-radius: 24px; padding: 26px 24px 22px; border-color: var(--line); }
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.auth-brand img { width: 46px; height: 46px; }
.auth-brand b { display: block; font-size: 22px; font-weight: 800; letter-spacing: -.02em; }
.auth-brand b span { color: var(--brand-ink); }
.auth-brand small { display: block; font-size: 13px; color: var(--muted); font-weight: 700; }
.wz-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 14px; }
.wz-steps i { height: 6px; border-radius: 99px; background: var(--line); transition: background-color 250ms ease; }
.wz-steps i.on { background: var(--brand); }
.wz-steps i.done { background: var(--maroon); }
.wz-kick { font-size: 13px; font-weight: 800; color: var(--maroon); }
.wz-h { font-size: 26px; margin: 4px 0 2px; }
.wz-sub { color: var(--ink-2); font-size: 15px; margin-bottom: 16px; }
.wz-step { animation: wzIn 260ms var(--ease-out); }
@keyframes wzIn { from { opacity: 0; transform: translateX(12px); } }
.wz-subjects { display: grid; gap: 10px; }
.wz-subj { display: grid; grid-template-columns: 48px 1fr auto; gap: 14px; align-items: center; padding: 14px 16px; border-radius: 16px;
  border: 2px solid var(--line); background: var(--surface); cursor: pointer; text-align: left; transition: border-color 150ms ease, background-color 150ms ease, transform 120ms var(--ease-out); }
.wz-subj:active { transform: scale(.985); }
.wz-subj .dot { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; font-family: var(--zh); font-weight: 700; font-size: 20px; color: var(--on-fill); background: var(--brand-fill); }
.wz-subj:nth-child(2) .dot { background: var(--maroon); }
.wz-subj:nth-child(3) .dot { background: var(--gold); color: var(--maroon-deep); }
.wz-subj b { display: block; font-size: 17px; font-weight: 800; }
.wz-subj small { display: block; font-size: 13px; color: var(--muted); font-weight: 700; }
.wz-subj .tick { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--line-2); display: grid; place-items: center; color: transparent; }
.wz-subj[aria-checked="true"] { border-color: var(--brand); background: var(--c-fff6ee); }
.wz-subj[aria-checked="true"] .tick { background: var(--brand-fill-strong); border-color: var(--brand-fill-strong); color: var(--on-fill); }
@media (hover: hover) and (pointer: fine) { .wz-subj:hover { border-color: var(--c-f6c29c); } }
.wz-classes { display: flex; flex-wrap: wrap; gap: 8px; }
.wz-cls { min-height: 46px; padding: 0 16px; border-radius: 12px; border: 2px solid var(--line-2); background: var(--surface); font-weight: 800; font-size: 15px; cursor: pointer; color: var(--ink); transition: border-color 150ms ease, background-color 150ms ease, transform 120ms var(--ease-out); }
.wz-cls:active { transform: scale(.96); }
.wz-cls[aria-checked="true"] { background: var(--maroon); border-color: var(--maroon); color: var(--on-fill); }
@media (hover: hover) and (pointer: fine) { .wz-cls:not([aria-checked="true"]):hover { border-color: var(--maroon); } }
.wz-picked { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.wz-picked span { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 800; padding: 5px 10px; border-radius: 99px; background: var(--brand-tint); color: var(--brand-ink); }
.wz-picked span + span { background: var(--maroon-tint); color: var(--maroon-ink); }
.wz-nav { display: flex; flex-wrap: wrap-reverse; gap: 10px; margin-top: 20px; }
.wz-nav .btn { flex: 1 1 220px; min-width: 0; font-size: 17px; padding: 0 16px; }
.wz-nav .btn.ghost { flex: 1 1 140px; }
.auth-card { min-width: 0; }
.wz-err { color: var(--red-ink); font-size: 14px; font-weight: 700; margin-top: 10px; display: none; }
.wz-err.on { display: block; }
.auth .foot-links { display: flex; justify-content: center; text-align: center; gap: 10px; flex-wrap: wrap; margin-top: 16px; font-size: 13px; }
.auth .foot-links a { color: var(--maroon); font-weight: 800; text-decoration: none; }

/* ================= home ================= */
.s-hero { position: relative; overflow: hidden; border-radius: 24px; padding: 26px 26px 24px; color: var(--on-fill);
  background: linear-gradient(120deg, var(--brand-fill-strong) 0%, var(--brand-fill-deep) 60%, var(--c-9e3f08) 100%); box-shadow: 0 18px 40px -24px var(--c-a196-82-11-p8); margin-bottom: 18px; }
.s-hero::before { content: ''; position: absolute; right: -90px; bottom: -120px; width: 380px; height: 380px; border-radius: 50%; background: var(--maroon); opacity: .9; }
.s-hero::after { content: ''; position: absolute; right: 250px; bottom: -34px; width: 84px; height: 84px; border-radius: 50%; background: var(--gold); opacity: .9; }
.s-hero > * { position: relative; z-index: 1; }
.s-hero .glyph { position: absolute; z-index: 1; right: 34px; bottom: 6px; font-family: var(--zh); font-weight: 700; font-size: 150px; line-height: 1; color: var(--c-a255-255-255-p14); pointer-events: none; }
.s-hero .code { display: inline-flex; gap: 8px; align-items: center; font-size: 13px; font-weight: 800; background: var(--c-a90-16-13-p35); padding: 5px 10px; border-radius: 99px; }
.s-hero h1 { font-size: clamp(28px, 5vw, 40px); margin: 10px 0 4px; max-width: 620px; font-weight: 800; }
.s-hero p { color: var(--on-fill); font-weight: 600; max-width: 560px; }
.s-hero .who { margin-top: 14px; display: flex; gap: 8px; flex-wrap: wrap; }
.s-hero .who span { font-size: 13px; font-weight: 700; padding: 5px 10px; border-radius: 99px; background: var(--c-a255-255-255-p16); overflow-wrap: anywhere; }

.continue { background: var(--surface); color: var(--ink); border: 2px solid var(--line); box-shadow: var(--shadow-1); border-radius: 20px; }
.continue::after { display: none; }
.continue .art { background: var(--brand-tint); }
.continue .ch { color: var(--maroon); opacity: 1; }
.continue p { color: var(--ink-2); }
.continue .btn { --c: var(--brand-fill); --cd: var(--brand-fill-deep); --tc: var(--on-fill); }
.continue .bar { background: var(--brand-tint); }
.continue .bar > i { background: var(--brand); }
.continue .bar > i::after { background: var(--c-a255-255-255-p35); }

.ch-tools { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; justify-content: space-between; margin: 28px 0 14px; }
.ch-tools h2 { font-size: 22px; display: flex; align-items: center; gap: 10px; }
.ch-tools .ch-h { display: flex; align-items: center; gap: 10px; }
.ch-tools .count { font-size: 13px; font-weight: 800; padding: 3px 9px; border-radius: 99px; background: var(--maroon-tint); color: var(--maroon-ink); }
.ch-search { position: relative; flex: 1 1 260px; max-width: 340px; }
.ch-search .ico { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.ch-search .input { padding-left: 42px; min-height: 46px; border-radius: 12px; }
.ch-filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.ch-filter { min-height: 38px; padding: 0 14px; border-radius: 99px; border: 2px solid var(--line-2); background: var(--surface); font-weight: 800; font-size: 14px; cursor: pointer; color: var(--ink-2); transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease; }
.ch-filter[aria-pressed="true"] { background: var(--maroon); border-color: var(--maroon); color: var(--on-fill); }
@media (hover: hover) and (pointer: fine) { .ch-filter:not([aria-pressed="true"]):hover { border-color: var(--maroon); color: var(--maroon); } }
.ch-none { padding: 26px; text-align: center; color: var(--muted); border: 2px dashed var(--line-2); border-radius: 18px; display: none; }
.ch-none.on { display: block; }

.chap { grid-template-columns: 60px 1fr; border-bottom-width: 2px; border-radius: 18px; box-shadow: var(--shadow-1); align-items: start; }
.chap .art { width: 60px; height: 60px; }
.chap .n { color: var(--maroon); font-weight: 800; font-size: 13px; }
.chap { grid-template-rows: 1fr auto; }
.chap .go { grid-column: 1 / -1; display: grid; gap: 12px; margin-top: 2px; align-self: end; }
.chap .go .prog { display: flex; align-items: center; gap: 10px; }
.chap .go .tag { justify-self: start; }
.chap .cta .ico { width: 16px; height: 16px; }
.chap .go .bar { height: 8px; }
.chap .go .frac { font-size: 13px; font-weight: 800; color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.chap .cta { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 0 14px; border-radius: 11px; font-weight: 800; font-size: 14px; white-space: nowrap;
  background: var(--teal); color: var(--on-fill); box-shadow: 0 3px 0 var(--teal-deep); transition: transform 110ms var(--ease-out), box-shadow 110ms var(--ease-out); }
.chap .cta.review { background: var(--surface); color: var(--maroon); box-shadow: inset 0 0 0 2px var(--maroon); }
a.chap:active .cta { transform: translateY(2px); box-shadow: 0 1px 0 var(--brand-deep); }
@media (hover: hover) and (pointer: fine) { a.chap:hover { border-color: var(--c-f6c29c); transform: translateY(-2px); } }
.chap.locked { box-shadow: none; }
.chap.rev { background: linear-gradient(135deg, var(--on-fill) 55%, var(--gold-tint)); }
.chap.rev .n { color: var(--gold-ink); }
.chap .tag.done { margin-left: auto; }
@media (max-width: 560px) {
  .s-hero { padding: 20px 18px; border-radius: 20px; }
  .s-hero .glyph { font-size: 110px; right: 10px; }
  .ch-search { max-width: none; }
}
@media (prefers-reduced-motion: reduce) { .wz-step { animation: none; } }
@media (max-width: 560px) { .continue .btn { font-size: 16px; width: 100%; min-height: 48px; } .continue .row .bar { max-width: none; } }

/* "Mula belajar · Start learning" buttons: deep teal-blue gradient */
:root { --teal: #0B7F86; --teal-2: #0A817B; --teal-deep: #075C61; }
.chap .cta:not(.review), .continue .btn:not(.ghost), .btn.teal {
  background: linear-gradient(135deg, var(--teal-2) 0%, var(--teal) 100%); color: var(--on-fill); box-shadow: 0 3px 0 var(--teal-deep);
}
.continue .btn:not(.ghost), .btn.teal { --cd: var(--teal-deep); box-shadow: 0 4px 0 var(--teal-deep); }
a.chap:active .cta:not(.review) { box-shadow: 0 1px 0 var(--teal-deep); }
.btn.teal:active:not(:disabled), .continue .btn:not(.ghost):active { box-shadow: 0 1px 0 var(--teal-deep); }

/* Student Leaderboard link (top bar) */
.lb-link { display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 12px; border-radius: 12px; text-decoration: none; font-weight: 800; font-size: 14px;
  color: var(--c-ffe7a8); background: var(--c-a255-255-255-p10); box-shadow: inset 0 0 0 1.5px var(--c-a244-183-36-p35); transition: background-color 150ms ease, transform 110ms var(--ease-out); }
.lb-link .ico { width: 18px; height: 18px; color: var(--gold); }
.lb-link:active { transform: scale(.96); }
@media (hover: hover) and (pointer: fine) { .lb-link:hover { background: var(--c-a255-255-255-p18); } }
@media (max-width: 720px) { .lb-link span { display: none; } .lb-link { padding: 0 10px; } }

/* floating feedback button */
.fb-float { position: fixed; right: max(16px, env(safe-area-inset-right)); bottom: max(16px, env(safe-area-inset-bottom)); z-index: 60;
  display: inline-flex; align-items: center; gap: 8px; min-height: 46px; padding: 0 16px 0 14px; border-radius: 999px; text-decoration: none;
  background: var(--gold); color: var(--maroon-deep); font-weight: 800; font-size: 15px; box-shadow: 0 3px 0 var(--gold-deep), 0 10px 24px -10px var(--c-a90-16-13-p5);
  transition: transform 140ms var(--ease-out), box-shadow 140ms var(--ease-out); }
.fb-float .ico { width: 20px; height: 20px; }
.fb-float small { font-size: inherit; font-weight: 700; opacity: .8; }
.fb-float:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--gold-deep); }
@media (hover: hover) and (pointer: fine) { .fb-float:hover { transform: translateY(-2px); } }
@media (max-width: 560px) { .fb-float { min-height: 44px; padding: 0 14px 0 12px; font-size: 14px; } .fb-float small { display: none; } }
body { padding-bottom: 0; }
.site-foot { padding-bottom: 84px !important; }
.s-hero .hero-lb { display: inline-flex; align-items: center; gap: 8px; margin-top: 16px; min-height: 42px; padding: 0 16px; border-radius: 12px; text-decoration: none;
  background: var(--gold); color: var(--maroon-deep); font-weight: 800; font-size: 15px; box-shadow: 0 3px 0 var(--gold-deep); transition: transform 110ms var(--ease-out); }
.s-hero .hero-lb .ico { width: 18px; height: 18px; }
.s-hero .hero-lb:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--gold-deep); }

/* ---------- polish (Hallmark audit, 19 Nov 2026) ---------- */
:root { --topbar-h: 64px; }
/* focus rings that read on every surface */
.s-hero :focus-visible, .topbar :focus-visible { outline: 3px solid var(--ring-on-dark); outline-offset: 3px; }
.s-hero .hero-lb:focus-visible { outline-color: var(--on-fill); }
/* button labels never wrap; smaller on very narrow phones */
.chap .cta, .continue .btn, .wz-nav .btn { white-space: nowrap; }
@media (max-width: 380px) { .chap .cta { font-size: 13px; padding: 0 10px; } .continue .btn { font-size: 15px; padding: 0 12px; } }
/* white-on-orange fills use the deeper orange */
.chap .cta.review { color: var(--maroon); }
.ch-filter[aria-pressed="true"], .wz-cls[aria-checked="true"] { color: var(--on-fill); }
.wz-subj .dot { background: var(--brand-fill); color: var(--on-fill); }
.wz-subj[aria-checked="true"] .tick { background: var(--brand-fill); border-color: var(--brand-fill); color: var(--on-fill); }
/* feedback: floating on wide screens; on phones it lives in the footer and the account menu so it never covers a button */
.fb-foot { display: none; }
@media (max-width: 720px) {
  .fb-float { display: none; }
  .fb-foot { display: inline-flex; align-items: center; gap: 8px; margin: 4px auto 14px; min-height: 44px; padding: 0 16px; border-radius: 999px; text-decoration: none; font-weight: 800; font-size: 15px; background: var(--gold); color: var(--maroon-deep); box-shadow: 0 3px 0 var(--gold-deep); }
  .fb-foot .ico { width: 18px; height: 18px; }
  .site-foot { padding-bottom: 24px !important; }
}
.subst-head > h2 { font-size: 20px; }
.subst-head > h2 img { width: 32px; height: 32px; display: inline-block; vertical-align: -7px; margin-right: 8px; }
@media (max-width: 560px) { .subst-head > h2 { font-size: 18px; line-height: 1.3; } .subst-head > h2 img { width: 26px; height: 26px; vertical-align: -6px; margin-right: 6px; } }
/* feedback on laptops: a round icon in the corner, so it never covers a card; the full pill only where the gutter is wide */
@media (min-width: 721px) and (max-width: 1599px) {
  .fb-float { width: 52px; height: 52px; min-height: 52px; padding: 0; justify-content: center; right: 12px; }
  .fb-float span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .fb-float .ico { width: 24px; height: 24px; }
}
/* subjects with levels (MLP: HSK 1, HSK 2) */
.lvl + .lvl { margin-top: 28px; }
.lvl-h { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin: 4px 0 12px; }
.lvl-h .lvl-t { font-size: 20px; font-weight: 800; color: var(--maroon); }
.lvl-h span { font-size: 14px; font-weight: 700; color: var(--muted); }
.lvl-soon { display: flex; align-items: center; gap: 10px; padding: 18px 20px; border: 2px dashed var(--line-2); border-radius: 18px; color: var(--ink-2); font-weight: 700; background: var(--surface); }
.lvl-soon .ico { width: 18px; height: 18px; color: var(--muted); }
.wz-subj:nth-child(4) .dot { background: var(--teal); color: var(--on-fill); }

/* vocabulary number (as in the textbook word list) */
.vcard .vno { position: absolute; top: 7px; left: 8px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; background: var(--brand-tint); color: var(--brand-ink); font-size: 12px; font-weight: 800; display: grid; place-items: center; }
.vcard .vno + .pos { left: 34px; }

/* syllable builder (sylbuild block) */
.sylb .sb-row { display: grid; grid-template-columns: 116px 1fr; gap: 10px; align-items: start; margin-top: 12px; }
.sylb .sb-l { font-family: var(--zh); font-weight: 800; font-size: 17px; color: var(--ink); padding-top: 8px; line-height: 1.2; }
.sylb .sb-l small { display: block; font-family: var(--ui); font-size: 12px; color: var(--muted); font-weight: 700; }
.sylb .sb-opts { display: flex; flex-wrap: wrap; gap: 6px; }
.sylb .sb-o { min-width: 46px; min-height: 44px; padding: 6px 10px; border: 2px solid var(--line-2); background: var(--surface); border-radius: 12px; font: 800 17px var(--ui); color: var(--ink); cursor: pointer; transition: transform 160ms var(--ease-out), border-color 160ms ease; }
.sylb .sb-o:hover { border-color: var(--brand); }
.sylb .sb-o:active { transform: scale(0.96); }
.sylb .sb-o[aria-checked="true"] { border-color: var(--gold-deep); background: var(--gold-tint); color: var(--gold-ink); }
.sylb .sb-o:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; }
.sylb .sb-out { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; margin-top: 16px; padding: 14px 18px; border-radius: var(--r); background: var(--brand-tint); }
.sylb .sb-syl { min-width: 110px; font-size: 40px; font-weight: 800; color: var(--brand-ink); line-height: 1.1; }
.sylb .sb-syl.no { font-size: 24px; color: var(--red-ink); display: flex; align-items: center; gap: 6px; }
.sylb .sb-syl.no .ico { width: 22px; height: 22px; }
.sylb .sb-msg { flex: 1; min-width: 200px; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; font-size: 14.5px; line-height: 1.5; }
.sylb .sb-msg .zh { font-size: 18px; }
@media (max-width: 560px) {
  .sylb .sb-row { grid-template-columns: 1fr; gap: 4px; }
  .sylb .sb-l { padding-top: 0; }
  .sylb .sb-syl { font-size: 34px; }
}

/* cast list (Meet the characters) */
.cast-list { display: grid; gap: 10px; }
.cast-list > div { display: flex; gap: 12px; align-items: center; line-height: 1.45; }
.cast-list .zh { font-size: 19px; }

/* ================= Palette A · Modern lacquer (20 Nov 2026) =================
   60% rice-paper white + ink, 30% cinnabar red 朱红, 10% gold; jade for "done".
   html:root outranks the pages' own :root blocks, so every page picks this up. */
html:root {
  --brand: #D93B2B; --brand-deep: #B32D20; --brand-tint: #FBEAE7; --brand-ink: #A12A1E;
  --maroon: #1C1B1F; --maroon-deep: #0F0E11; --maroon-tint: #F0ECE6; --maroon-ink: #1C1B1F;
  --blue: #1C1B1F; --blue-deep: #0F0E11; --blue-tint: #F0ECE6; --blue-ink: #1C1B1F;
  --ink: #1C1B1F; --ink-2: #4A4542; --muted: #6B6460;
  --bg: #FAF7F2; --surface: #FFFFFF; --line: #EDE6DD; --line-2: #DDD3C7;
  --green: #1F8A6A; --green-deep: #176B52; --green-tint: #E6F3EE; --green-ink: #14614B;
  --gold: #E8B04A; --gold-deep: #B9862A; --gold-tint: #FBF1DC; --gold-ink: #6E4E0C;
  --brand-fill: #C9362A; --brand-fill-deep: #A82B20; --brand-fill-strong: #C3352A;
  --on-fill: #FFFFFF; --ring: #1C1B1F; --ring-on-dark: #F5D58A; --field-edge: #9A928B;
  --teal: #D93B2B; --teal-2: #C3352A; --teal-deep: #8F2219;
  --shadow-1: 0 1px 2px rgba(28,27,31,.05), 0 4px 14px rgba(28,27,31,.05);
  --shadow-2: 0 2px 4px rgba(28,27,31,.05), 0 14px 40px rgba(28,27,31,.10);
  /* warm-orange literals → neutral paper and cinnabar tints */
  --c-f2711c: #D93B2B; --c-8f3a05: #8F2219; --c-7e3300: #7A1D15; --c-9e3f08: #A82B20;
  --c-a194-84-10-p55: rgba(169,43,32,.40); --c-a196-82-11-p8: rgba(28,27,31,.45);
  --c-fffbf8: #FFFFFF; --c-fff9f5: #FCFAF7; --c-fff8f3: #FBF8F4; --c-fffbf3: #FFFDF8; --c-fff6ee: #F9F5F0; --c-fff1e6: #F7F2EC;
  --c-fff7ee: #FBF8F4; --c-ffebd6: #F3ECE3;
  --c-f5eae3: #EFE9E2; --c-f3e6de: #EDE6DD; --c-fbf1eb: #F5F0EA;
  --c-ffd9bc: #F6D5D0; --c-ffd3b2: #F4CCC6; --c-ffc59a: #F0B9B1; --c-f6c29c: #EFB8B0;
  --c-f3c9c2: #CFC8C2; --c-a238-106-16-p14: rgba(217,59,43,.12); --c-a238-106-16-p18: rgba(217,59,43,.16);
  --c-a217-96-11-p25: rgba(217,59,43,.22); --c-a255-155-80-p35: rgba(217,59,43,.28);
  /* leaderboard + report page tokens */
  --c-0b7f86: #1C1B1F; --c-d9f4f2: #F0ECE6; --c-a11-127-134-p08: rgba(28,27,31,.06); --c-c4520b: #C3352A; --c-ffebdc: #FBEAE7;
  --c-de6512: #D93B2B; --c-c2540a: #C3352A; --c-a64300: #A82B20; --c-ffe9d6: #FBEAE7;
}
/* subject banner: one traditional colour per subject, with a faint scene (moon, hills, pagoda, lanterns) */
html:root {
  --hero-pm1-a: #C3352A; --hero-pm1-b: #7E1E17;   /* 朱红 cinnabar */
  --hero-pm2-a: #1A7A5E; --hero-pm2-b: #0D4A39;   /* 玉 jade */
  --hero-cm-a: #1F5394;  --hero-cm-b: #122F57;    /* 青花 porcelain blue */
  --hero-mlp-a: #7A2E63; --hero-mlp-b: #4A1A3D;   /* 紫 plum */
}
.s-hero { --ha: var(--hero-pm1-a); --hb: var(--hero-pm1-b);
  background: radial-gradient(120% 140% at 0% 0%, rgba(255,255,255,.10), transparent 55%), linear-gradient(120deg, var(--ha) 0%, var(--hb) 100%);
  box-shadow: 0 18px 40px -24px var(--hb); }
.s-hero[data-subj="pm2"] { --ha: var(--hero-pm2-a); --hb: var(--hero-pm2-b); }
.s-hero[data-subj="cm"] { --ha: var(--hero-cm-a); --hb: var(--hero-cm-b); }
.s-hero[data-subj="mlp"] { --ha: var(--hero-mlp-a); --hb: var(--hero-mlp-b); }
.s-hero::before { inset: 0; right: 0; bottom: 0; width: auto; height: auto; border-radius: 0; background: url(../img/hero-scene.svg) right bottom / auto 100% no-repeat; opacity: .22; }
.s-hero::after { display: none; }
.s-hero .glyph { color: rgba(255,255,255,.10); right: 250px; }
.s-hero .code { background: rgba(0,0,0,.22); }
@media (max-width: 640px) { .s-hero::before { opacity: .18; background-size: auto 85%; } .s-hero .glyph { right: 16px; color: rgba(255,255,255,.07); } }
.lec-band { background: linear-gradient(135deg, #2A2830 0%, #1C1B1F 70%); box-shadow: 0 4px 0 #0F0E11, 0 10px 22px -10px rgba(28,27,31,.5); }
.topbar { box-shadow: 0 1px 0 rgba(0,0,0,.2), 0 6px 20px -12px rgba(28,27,31,.5); }

/* ================= Subject colours (whole site) =================
   PM1 cinnabar 朱红 · PM2 jade 玉 · CM porcelain blue 青花 · MLP plum 紫.
   Buttons, progress bars, section headers, highlights and the top bar follow the subject;
   gold stays for stars and the leaderboard, green for "done". No subject (sign-in start, lecturer dashboard) = cinnabar + ink. */
html[data-subj="pm1"] {
  --brand: #D93B2B; --brand-deep: #B32D20; --brand-tint: #FBEAE7; --brand-ink: #A12A1E;
  --brand-fill: #C9362A; --brand-fill-deep: #A82B20; --brand-fill-strong: #C3352A;
  --teal: #D93B2B; --teal-2: #C3352A; --teal-deep: #8F2219; --top: #7E1E17;
}
html[data-subj="pm2"] {
  --brand: #1A8A68; --brand-deep: #136E53; --brand-tint: #E3F3EC; --brand-ink: #0F5E47;
  --brand-fill: #17795C; --brand-fill-deep: #105A44; --brand-fill-strong: #167358;
  --teal: #1A8A68; --teal-2: #167358; --teal-deep: #0B4434; --top: #0D4A39;
}
html[data-subj="cm"] {
  --brand: #2563B0; --brand-deep: #1D4F8E; --brand-tint: #E5EEF9; --brand-ink: #1A4A86;
  --brand-fill: #1F5394; --brand-fill-deep: #173F72; --brand-fill-strong: #1E4F8C;
  --teal: #2563B0; --teal-2: #1F5394; --teal-deep: #102C52; --top: #122F57;
}
html[data-subj="mlp"] {
  --brand: #9A3A7D; --brand-deep: #7A2E63; --brand-tint: #F5E6F0; --brand-ink: #6E2858;
  --brand-fill: #7A2E63; --brand-fill-deep: #5C2249; --brand-fill-strong: #74305F;
  --teal: #9A3A7D; --teal-2: #7A2E63; --teal-deep: #3E1534; --top: #4A1A3D;
}
html[data-subj] {
  --c-f2711c: var(--brand); --c-8f3a05: var(--teal-deep); --c-7e3300: var(--teal-deep); --c-9e3f08: var(--brand-fill-deep);
  --c-a194-84-10-p55: color-mix(in srgb, var(--brand) 40%, transparent);
  --c-a238-106-16-p14: color-mix(in srgb, var(--brand) 12%, transparent); --c-a238-106-16-p18: color-mix(in srgb, var(--brand) 16%, transparent);
  --c-a217-96-11-p25: color-mix(in srgb, var(--brand) 22%, transparent); --c-a255-155-80-p35: color-mix(in srgb, var(--brand) 28%, transparent);
  --c-ffd9bc: color-mix(in srgb, var(--brand) 22%, white); --c-ffd3b2: color-mix(in srgb, var(--brand) 26%, white);
  --c-ffc59a: color-mix(in srgb, var(--brand) 34%, white); --c-f6c29c: color-mix(in srgb, var(--brand) 34%, white);
  --c-0b7f86: var(--brand-fill); --c-d9f4f2: var(--brand-tint); --c-c4520b: var(--brand-fill); --c-ffebdc: var(--brand-tint);
  --c-de6512: var(--brand); --c-c2540a: var(--brand-fill); --c-a64300: var(--brand-fill-deep); --c-ffe9d6: var(--brand-tint);
}
html[data-subj] .topbar { background: var(--top); }
html[data-subj] .lec-band { background: linear-gradient(135deg, var(--brand-fill) 0%, var(--top) 80%); box-shadow: 0 4px 0 var(--teal-deep), 0 10px 22px -10px var(--top); }
.site-foot .nw { white-space: nowrap; }
.sylb .sb-sp { font-size: 14px; background: var(--surface); border: 1px solid var(--line-2); border-radius: 999px; padding: 2px 10px; }
.block ol.rules { margin: 4px 0 0; padding-left: 22px; display: grid; gap: 10px; line-height: 1.6; }
.block ol.rules li::marker { font-weight: 800; color: var(--brand-ink); }

/* namecard block: build a Chinese name */
.namecard .nc-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 18px; margin-top: 12px; align-items: start; }
.namecard h3 { font-size: 16px; margin: 6px 0 8px; } .namecard h3 small { font-size: 12.5px; color: var(--muted); font-weight: 700; }
.namecard .nc-opts { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.namecard .nc-o { min-width: 54px; padding: 6px 8px; border: 2px solid var(--line-2); border-radius: 12px; background: var(--surface); cursor: pointer; display: grid; justify-items: center; line-height: 1.15; transition: transform 160ms var(--ease-out), border-color 160ms ease; }
.namecard .nc-o .zh { font-size: 22px; font-weight: 700; color: var(--ink); } .namecard .nc-o small { font-size: 12px; color: var(--muted); font-weight: 700; }
.namecard .nc-o:hover { border-color: var(--brand); } .namecard .nc-o:active { transform: scale(0.96); }
.namecard .nc-o[aria-pressed="true"] { border-color: var(--gold-deep); background: var(--gold-tint); }
.namecard .nc-o:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; }
.namecard .nc-card { position: sticky; top: 90px; border-radius: 18px; padding: 16px 18px 18px; background: var(--surface); border: 2px solid var(--brand); box-shadow: var(--shadow-2); text-align: center; }
.namecard .nc-top { display: flex; justify-content: space-between; align-items: center; font-size: 12.5px; font-weight: 800; color: var(--brand-ink); }
.namecard .nc-top .ico3d, .namecard .nc-top img { width: 30px; height: 30px; }
.namecard .nc-name { font-size: 54px; font-weight: 700; color: var(--ink); letter-spacing: .08em; margin-top: 6px; }
.namecard .nc-py { font-size: 20px; font-weight: 800; color: var(--brand-ink); }
.namecard .nc-mean { font-size: 13.5px; color: var(--ink-2); margin-top: 8px; line-height: 1.5; }
.namecard .nc-btns { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 12px; }
.namecard .nc-voice[aria-pressed="true"] { background: var(--gold-tint); border-color: var(--gold-deep); }
.namecard .nc-intro { margin-top: 10px; font-size: 14px; } .namecard .nc-intro .zh { font-size: 17px; color: var(--ink); display: block; }
@media (max-width: 720px) { .namecard .nc-grid { grid-template-columns: 1fr; } .namecard .nc-card { position: static; order: -1; } }
.chap.lab .art { background: var(--brand-tint); }
.block .tw { font-size: 26px; line-height: 1.5; color: var(--ink); margin: 2px 0; }
.block .tw-py { font-size: 15px; font-weight: 700; color: var(--brand-ink); margin-bottom: 6px; }
.block .lab-link { margin-top: 12px; font-size: 14px; padding: 10px 14px; border-radius: var(--r); background: var(--brand-tint); }
.block .lab-link a { font-weight: 800; color: var(--brand-ink); }
.block ul.tips { margin: 4px 0 0; padding-left: 20px; display: grid; gap: 10px; line-height: 1.6; }

/* candos block (Learning Summary self-check) */
.candos .cd-t { margin-top: 10px; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.candos .cd-r { display: grid; grid-template-columns: minmax(0, 1fr) 76px 76px; align-items: center; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--line); }
.candos .cd-r:first-child { border-top: 0; }
.candos .cd-h { background: var(--brand-tint); font-weight: 800; font-size: 13.5px; color: var(--brand-ink); }
.candos .cd-h span:not(:first-child) { text-align: center; font-family: var(--zh); } .candos .cd-h small { display: block; font-family: var(--ui); font-size: 11.5px; }
.candos .cd-ex { display: block; font-size: 16px; color: var(--ink); margin-top: 2px; }
.candos .cd-r > span:not(:first-child) { display: grid; place-items: center; }
.candos .cd-b { width: 44px; height: 44px; border-radius: 12px; border: 2px solid var(--line-2); background: var(--surface); color: transparent; cursor: pointer; display: grid; place-items: center; transition: transform 160ms var(--ease-out); }
.candos .cd-b:active { transform: scale(0.94); }
.candos .cd-b[aria-pressed="true"] { background: var(--green); border-color: var(--green-deep); color: var(--on-fill); }
.candos .cd-b:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; }
.candos .cd-sum { margin-top: 8px; font-weight: 700; }
@media (max-width: 560px) { .candos .cd-r { grid-template-columns: minmax(0, 1fr) 52px 52px; padding: 8px; } }
/* L3 character passports */
.passports{display:grid;grid-template-columns:repeat(auto-fill,minmax(150px,1fr));gap:10px;margin-top:12px}
.passports .pp{display:flex;flex-direction:column;gap:2px;padding:12px 14px;border-radius:14px;background:linear-gradient(160deg,var(--brand,#9A3A7D) 0%,var(--teal-deep,#3E1534) 100%);color:#fff;font-size:.86rem;box-shadow:0 2px 8px rgba(0,0,0,.12)}
.passports .pp-t{font-size:.66rem;letter-spacing:.12em;opacity:.75;color:#E8B04A}
.passports .pp b.zh{font-size:1.3rem}
.passports .pp .py{opacity:.85;color:#fff}
/* L5 calendar */
.cal{max-width:360px;margin:12px auto 0;border-radius:14px;overflow:hidden;border:1px solid color-mix(in srgb,var(--brand,#9A3A7D) 25%,transparent);background:#fff}
.cal-h{background:var(--brand,#9A3A7D);color:#fff;font-weight:800;padding:8px 12px;font-size:15px}
.cal-g{display:grid;grid-template-columns:repeat(7,1fr);gap:2px;padding:8px;text-align:center;font-size:13px}
.cal-g b{font-size:12px;color:var(--muted);padding-bottom:4px}
.cal-g span{padding:5px 0;border-radius:8px;line-height:1.1;font-variant-numeric:tabular-nums}
.cal-g span.mk{background:var(--brand-tint,#F5E6F0);color:var(--brand-ink,#6E2858);font-weight:800}
.cal-g span small{display:block;font-size:10px;font-weight:700}
/* book credits (7pt) */
.site-foot .sf-books { font-size: 7pt; line-height: 1.5; margin-top: 10px; padding-top: 8px; border-top: 1px dashed var(--line); color: var(--muted); }
.site-foot .sf-books b { font-weight: 800; color: var(--ink-2); font-size: inherit; }

/* ===== Login page (index.html): soft cream poster panel + solid subject tiles ===== */
:root { --display: 'Bricolage Grotesque', var(--ui); --login-cream: #FBEBC4; --login-orange: #F57C00; --login-glyph: #EE9A86; }
.auth2 { padding: 0; background: var(--bg); min-height: 100vh; min-height: 100dvh; display: grid; align-content: start; }
.auth2 .auth-hero { position: relative; overflow: hidden; isolation: isolate; background: var(--login-cream); color: var(--ink); padding: 22px 22px 30px; }
.auth2 .auth-hero::before { content: ''; position: absolute; inset: 0; z-index: -2; background: url('../img/login-students.webp') center 60% / cover no-repeat; opacity: .22; mix-blend-mode: multiply; }
.auth2 .auth-hero::after { content: '学'; position: absolute; z-index: -1; right: -30px; top: -40px; font-family: var(--zh); font-weight: 700; font-size: 230px; line-height: 1; color: var(--login-glyph); opacity: .55; pointer-events: none; }
.ah-brand { display: flex; align-items: center; gap: 10px; }
.ah-brand img { width: 44px; height: 44px; }
.ah-brand b { font-family: var(--display); font-weight: 800; font-size: 22px; letter-spacing: -.03em; white-space: nowrap; }
.ah-brand b span, .ah-h .or { color: var(--login-orange); }
.ah-h { font-family: var(--display); font-weight: 780; letter-spacing: -.03em; line-height: .98; font-size: clamp(42px, 12vw, 104px); margin: 64px 0 14px; overflow-wrap: break-word; min-width: 0; }
.ah-h span, .ah-sub span { display: block; white-space: nowrap; }
.ah-sub { font-size: 16px; font-weight: 600; color: var(--ink-2); line-height: 1.55; }
.auth2 .auth-card { max-width: 560px; width: 100%; margin: 0 auto; border: 0; box-shadow: none; background: transparent; padding: 24px 20px 32px; }
.auth2 .auth-brand { display: none; }
.auth2 .wz-h { font-family: var(--display); font-weight: 780; letter-spacing: -.025em; font-size: 34px; line-height: 1.05; }
.auth2 .wz-subjects { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.auth2 .wz-subj { position: relative; overflow: hidden; isolation: isolate; display: flex; flex-direction: column; justify-content: flex-end; align-items: flex-start; text-align: left; min-height: 150px; padding: 16px; border: 0; border-radius: 18px; color: var(--on-fill); background: var(--hero-pm1-a); box-shadow: none; transition: transform 160ms var(--ease-out); }
.auth2 .wz-subj[data-subj="pm2"] { background: var(--hero-pm2-a); }
.auth2 .wz-subj[data-subj="cm"] { background: var(--hero-cm-a); }
.auth2 .wz-subj[data-subj="mlp"] { background: var(--hero-mlp-a); }
.auth2 .wz-subj:hover { transform: translateY(-3px); }
.auth2 .wz-subj:active { transform: scale(.98); }
.auth2 .wz-subj:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }
.auth2 .wz-subj .dot { position: absolute; z-index: -1; right: -6px; top: -18px; width: auto; height: auto; background: none !important; border-radius: 0; font-size: 110px; line-height: 1; color: rgba(255,255,255,.22) !important; }
.auth2 .wz-subj b { font-family: var(--display); font-size: 20px; line-height: 1.08; letter-spacing: -.02em; font-weight: 780; color: var(--on-fill); }
.auth2 .wz-subj small { color: rgba(255,255,255,.8); margin-top: 4px; }
.auth2 .wz-subj .tick { position: absolute; top: 12px; left: 12px; border-color: rgba(255,255,255,.7); color: transparent; }
.auth2 .wz-subj[aria-checked="true"] { outline: 4px solid var(--gold); outline-offset: 3px; background-blend-mode: normal; }
.auth2 .wz-subj[aria-checked="true"] .tick { background: var(--gold) !important; border-color: var(--gold) !important; color: var(--ink) !important; }
@media (max-width: 379px) { .auth2 .wz-subj b { font-size: 17px; } .auth2 .wz-subj { min-height: 136px; padding: 14px; } }
@media (min-width: 880px) {
  .auth2 { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); align-content: stretch; }
  .auth2 .auth-hero { padding: 40px 56px; display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; position: sticky; top: 0; }
  .auth2 .auth-hero::after { font-size: 420px; right: -60px; top: -80px; }
  .ah-h { margin-top: auto; }
  .ah-sub { margin-bottom: auto; }
  .auth2 .auth-card { align-self: center; padding: 40px 48px; }
  .auth2 .wz-subj { min-height: 170px; }
}
@media (prefers-reduced-motion: reduce) { .auth2 .wz-subj { transition: none; } }
/* login: full-width hero on phones; black Next button */
.auth2 { place-items: stretch; justify-items: stretch; }
.auth2 .wz-nav .btn[data-next]:not(:disabled) { --c: var(--ink); --cd: #000; --tc: #FFFFFF; }
.auth2 .wz-nav .btn[data-next] .sub { color: rgba(255,255,255,.75); }
.ah-h { font-size: clamp(40px, 11vw, 96px); }

/* login: frosted-glass headline panel over a clearer class photo (25 Nov 2026) */
.auth2 .auth-hero::before { opacity: .55; mix-blend-mode: normal; filter: saturate(.9); }
.auth2 .auth-hero::after { color: #E9775F; opacity: 1; }
.auth2 .ah-glass { position: relative; margin-top: 56px; padding: 22px 24px 24px; border-radius: 28px;
  background: linear-gradient(135deg, rgba(255,255,255,.42), rgba(255,255,255,.16));
  -webkit-backdrop-filter: blur(16px) saturate(1.5); backdrop-filter: blur(16px) saturate(1.5);
  border: 1px solid rgba(255,255,255,.65);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.9), inset 0 -1px 0 rgba(255,255,255,.25), 0 24px 48px rgba(90,50,10,.18); }
.auth2 .ah-glass .ah-h { margin: 0 0 12px; }
.auth2 .ah-glass .ah-sub { color: var(--ink); margin-bottom: 0; }
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) { .auth2 .ah-glass { background: rgba(255,250,240,.88); } }
@media (min-width: 880px) { .auth2 .ah-glass { margin: auto 0; padding: 34px 38px 36px; } }
/* login: "Jom Mandarin!" brand in a frosted-glass pill so it stands apart from the big 学 */
.auth2 .ah-brand { align-self: flex-start; width: max-content; padding: 8px 16px 8px 8px; border-radius: 999px;
  background: linear-gradient(135deg, rgba(255,255,255,.55), rgba(255,255,255,.25));
  -webkit-backdrop-filter: blur(14px) saturate(1.5); backdrop-filter: blur(14px) saturate(1.5);
  border: 1px solid rgba(255,255,255,.7); box-shadow: inset 0 1px 0 rgba(255,255,255,.9), 0 10px 24px rgba(90,50,10,.15); }
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) { .auth2 .ah-brand { background: rgba(255,250,240,.9); } }
/* login: the class photo is small (480×240), so soften it rather than show enlarged pixels */
.auth2 .auth-hero::before { filter: blur(7px) saturate(.9); transform: scale(1.06); }

/* Justified prose (2 Dec 2026): paragraphs of reading text in lesson blocks (text, scene, tip/fact, grammar rule, leads; not bullet lists, which are too narrow on phones)
   are justified for a neater edge. Headings, buttons, cards, exercise prompts, tables and dialogue bubbles keep their alignment.
   Lines that end with a forced break (<br>) and each paragraph's last line stay left-aligned, as browsers do for justify. */
.block > p, .block.fact p, .block .rule > div:not(.formula), .block > p.lead, .block .lead {
  text-align: justify;
  text-justify: inter-word;
  text-wrap: pretty;
}
