/* Course platform styles: the Sunset Boulevard theme. Self-hosted fonts; light and dark versions via prefers-color-scheme. */

/* ------------------------------------------------------------------ fonts */
/* DejaVu Serif Bold for headings and DejaVu Sans for text (the Sunset Boulevard theme), subset to Latin, Greek and
   common symbols. Bitstream Vera and Arev licences, DejaVu changes public domain: fonts/LICENSE-DejaVu.txt. */
@font-face { font-family: "DejaVu Sans"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/dejavu-sans-400-normal.woff2") format("woff2"); }
@font-face { font-family: "DejaVu Sans"; font-style: italic; font-weight: 400; font-display: swap; src: url("../fonts/dejavu-sans-400-italic.woff2") format("woff2"); }
@font-face { font-family: "DejaVu Sans"; font-style: normal; font-weight: 700; font-display: swap; src: url("../fonts/dejavu-sans-700-normal.woff2") format("woff2"); }
@font-face { font-family: "DejaVu Sans"; font-style: italic; font-weight: 700; font-display: swap; src: url("../fonts/dejavu-sans-700-italic.woff2") format("woff2"); }
@font-face { font-family: "DejaVu Serif"; font-style: normal; font-weight: 700; font-display: swap; src: url("../fonts/dejavu-serif-700-normal.woff2") format("woff2"); }

/* ------------------------------------------------------------------ tokens */
:root {
  color-scheme: light;
  /* Sunset Boulevard: Burnt Orange #E76F51, Coral #F4A261, Warm Sand #E9C46A, Deep Purple #264653. Shades used for
     text are darker versions that meet WCAG AA contrast (4.5:1 for text, 3:1 for borders and icons). */
  --deep: #264653; --brand: #B63E20; --sand: #E9C46A; --slate: #4E6974; --panel: #FBF3EA;
  --bg: #FDF8F3; --surface: #FFFFFF; --ink: #264653; --text: #243A42; --muted: #4E6974; --rule: #EEDFCF; --rule-strong: #D6BFA4; --soft: #F9EEE3;
  --link: #B63E20; --link-hover: #264653; --focus: #B63E20; --accent: #DC5838; --amber-ink: #826417;
  --btn: #B63E20; --btn-ink: #FFFFFF; --btn-hover: #264653;
  --pass: #1E6B45; --pass-bg: #E7F3EB; --pass-rule: #A5D3B7; --fail: #B32419; --fail-bg: #FDECEA; --fail-rule: #F1B5AE;
  --open: #826417; --open-bg: #FBF1D6; --none-bg: #F5EFE8;
  --th-bg: #264653; --th-ink: #FFFFFF; --zebra: #FDF8F3;
  --c-story: #E0B34E; --b-story: #FDF7E6; --l-story: #826417;
  --c-case: #264653; --b-case: #EDF3F5; --l-case: #264653;
  --c-practice: #E76F51; --b-practice: #FDF0EB; --l-practice: #B63E20;
  --c-key: #F4A261; --b-key: #FEF4EA; --l-key: #A15517;
  --c-pitfall: #B32419; --b-pitfall: #FDECEA; --l-pitfall: #A12017;
  --c-safety: #A31515; --b-safety: #FDECEC; --l-safety: #8E1212;
  --c-think: #3A7788; --b-think: #EBF4F6; --l-think: #2E5E6B;
  --c-tool: #4D7949; --b-tool: #EEF5EC; --l-tool: #3D6039;
  --shadow: 0 1px 2px rgba(38, 70, 83, .06), 0 6px 20px rgba(38, 70, 83, .08);
  --shadow-lg: 0 18px 48px rgba(38, 70, 83, .16);
  --radius: 12px; --radius-sm: 8px;
  --serif: "DejaVu Serif", Georgia, "Times New Roman", serif;
  --sans: "DejaVu Sans", Verdana, "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --topbar-h: 60px;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --brand: #F4A261; --panel: #18313A;
    --bg: #0F1E24; --surface: #152A31; --ink: #FCEFE3; --text: #EADFD4; --muted: #A89C92; --rule: #274550; --rule-strong: #3B5E6A; --soft: #1C3640;
    --link: #F4A261; --link-hover: #FFFFFF; --focus: #F4A261; --accent: #E76F51; --amber-ink: #E9C46A;
    --btn: #F4A261; --btn-ink: #1A2E35; --btn-hover: #E9C46A;
    --pass: #7FD3A0; --pass-bg: #13281D; --pass-rule: #2D5B3F; --fail: #F4978B; --fail-bg: #331A17; --fail-rule: #6E3029;
    --open: #E9C46A; --open-bg: #2A2413; --none-bg: #172C33;
    --th-bg: #1F3B45; --th-ink: #FCEFE3; --zebra: #132730;
    --c-story: #E9C46A; --b-story: #262211; --l-story: #F0D48C;
    --c-case: #9FC3CE; --b-case: #132A31; --l-case: #BCD6DE;
    --c-practice: #E76F51; --b-practice: #2C1914; --l-practice: #F29A82;
    --c-key: #F4A261; --b-key: #2B2015; --l-key: #F7BB86;
    --c-pitfall: #F4978B; --b-pitfall: #331A17; --l-pitfall: #F7ADA3;
    --c-safety: #FF8A80; --b-safety: #3A1414; --l-safety: #FFA39B;
    --c-think: #7FB8C6; --b-think: #11272E; --l-think: #9CCAD5;
    --c-tool: #8CCB95; --b-tool: #15271B; --l-tool: #A8D8AE;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25);
    --shadow-lg: 0 18px 48px rgba(0, 0, 0, .45);
  }
}

/* ------------------------------------------------------------------ base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: calc(var(--topbar-h) + 16px); }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--sans); font-size: 16px; line-height: 1.55; min-height: 100vh; display: flex; flex-direction: column; }
img, svg { max-width: 100%; }
img { height: auto; }
a { color: var(--link); text-underline-offset: .18em; text-decoration-thickness: 1px; }
a:hover { color: var(--link-hover); text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 3px; }
h1, h2, h3, h4 { color: var(--ink); line-height: 1.25; text-wrap: balance; }
h1 { font-family: var(--serif); font-weight: 700; font-size: clamp(1.75rem, 1.35rem + 1.6vw, 2.5rem); margin: 0 0 .5rem; letter-spacing: -.01em; }
h2 { font-family: var(--serif); font-weight: 600; font-size: 1.45rem; margin: 2rem 0 .75rem; }
h3 { font-family: var(--serif); font-weight: 700; font-size: 1.08rem; margin: 1.5rem 0 .5rem; }
p { margin: .6rem 0; }
code { font-family: var(--mono); font-size: .9em; background: var(--soft); padding: .08em .35em; border-radius: 5px; }
hr { border: 0; border-top: 1px solid var(--rule); margin: 2rem 0; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: 12px; top: -60px; z-index: 100; background: var(--deep); color: #fff; padding: 10px 16px; border-radius: 8px; font-weight: 600; text-decoration: none; }
.skip-link:focus { top: 10px; color: #fff; }
.muted { color: var(--muted); }
.icon { flex: none; vertical-align: -0.2em; }
.icon-sm { width: 16px; height: 16px; }
.icon-lg { width: 26px; height: 26px; }
[hidden] { display: none !important; }
main:focus { outline: none; }

/* ------------------------------------------------------------------ buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; min-height: 44px; padding: .55rem 1.1rem; border-radius: var(--radius-sm); border: 1.5px solid transparent;
  font: 600 .95rem/1.2 var(--sans); text-decoration: none; cursor: pointer; transition: background .15s, border-color .15s, color .15s; white-space: nowrap; }
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--btn); color: var(--btn-ink); }
.btn-primary:hover { background: var(--btn-hover); color: var(--btn-ink); }
.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--rule-strong); }
.btn-ghost:hover { border-color: var(--ink); color: var(--ink); }
.btn-accent { background: #E9C46A; color: #264653; }
.btn-accent:hover { background: #F4A261; color: #264653; }
.btn-on-dark { background: transparent; color: #FFFFFF; border-color: rgba(255, 255, 255, .6); }
.btn-on-dark:hover { border-color: #FFFFFF; background: rgba(255, 255, 255, .1); color: #FFFFFF; }
.btn-danger { background: var(--fail); color: #FFFFFF; }
.btn-danger:hover { background: #861B13; color: #FFFFFF; }
.btn-danger-ghost { background: var(--surface); color: var(--fail); border-color: var(--fail-rule); }
.btn-danger-ghost:hover { border-color: var(--fail); color: var(--fail); }
@media (prefers-color-scheme: dark) { .btn-danger { color: #1B1210; } .btn-danger:hover { background: #F9BDB5; color: #1B1210; } }
.btn-sm { min-height: 38px; padding: .4rem .85rem; font-size: .88rem; }
.btn-xs { min-height: 32px; padding: .25rem .6rem; font-size: .82rem; }
.btn-lg { min-height: 52px; padding: .75rem 1.5rem; font-size: 1.02rem; }
.btn-block { width: 100%; }
.btn[aria-disabled="true"] { opacity: .45; pointer-events: none; }
.btn-row { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; margin: 1rem 0; }
.linklike { background: none; border: 0; padding: 0; font: inherit; color: var(--link); cursor: pointer; text-decoration: underline; text-underline-offset: .18em; }
.icon-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 8px; border: 0; background: transparent; color: var(--muted); cursor: pointer; }
.icon-btn:hover { background: var(--soft); color: var(--ink); }
.inline-form { display: inline; margin: 0; }

/* ------------------------------------------------------------------ top bar and navigation */
.topbar { position: sticky; top: 0; z-index: 40; background: var(--surface); border-bottom: 1px solid var(--rule); }
.topbar-inner { display: flex; align-items: center; gap: 14px; height: var(--topbar-h); padding: 0 20px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); min-width: 0; }
.brand:hover { color: var(--ink); }
.brand-mark { width: 32px; height: 32px; flex: none; }
.pub-header .brand-mark rect { fill: #33606F; }
@media (prefers-color-scheme: dark) { .brand-mark rect { fill: #1F3B45; } }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-name { font-family: var(--serif); font-weight: 700; font-size: 1.1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-sub { font-size: .72rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: .01em; }
.nav-toggle { display: none; align-items: center; gap: 6px; padding: 8px 10px; border-radius: 8px; color: var(--ink); text-decoration: none; font-weight: 600; font-size: .9rem; border: 1px solid var(--rule); }
.area-switch { display: flex; background: var(--soft); border-radius: 999px; padding: 3px; gap: 2px; margin-left: 8px; }
.area-switch a { padding: 5px 14px; border-radius: 999px; font-size: .85rem; font-weight: 600; color: var(--muted); text-decoration: none; }
.area-switch a:hover { color: var(--ink); }
.area-switch a[aria-current="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
.topbar-search { margin-left: auto; display: flex; align-items: center; background: var(--bg); border: 1px solid var(--rule); border-radius: 10px; padding-left: 12px; width: min(300px, 32vw); }
.topbar-search:focus-within { border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 25%, transparent); }
.topbar-search input[type="search"] { border: 0; background: transparent; font: 400 .92rem var(--sans); color: var(--text); padding: 9px 0; min-height: 0; flex: 1; min-width: 0; outline: none; box-shadow: none; }
.account-menu { position: relative; }
/* Pages without the search box (the platform's own pages) still put the account menu at the right. */
.brand + .account-menu { margin-left: auto; }
.account-menu > summary { list-style: none; display: flex; align-items: center; gap: 8px; cursor: pointer; padding: 5px 8px 5px 5px; border-radius: 999px; border: 1px solid var(--rule); }
.account-menu > summary::-webkit-details-marker { display: none; }
.account-menu[open] > summary { border-color: var(--rule-strong); background: var(--soft); }
.avatar { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--deep); color: #fff; font-size: .78rem; font-weight: 700; letter-spacing: .02em; }
@media (prefers-color-scheme: dark) { .avatar { background: #B63E20; } }
.account-name { font-size: .88rem; font-weight: 600; color: var(--ink); max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-panel { position: absolute; right: 0; top: calc(100% + 8px); width: 280px; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 8px; z-index: 60; }
.account-panel a, .account-panel .linklike { display: block; width: 100%; text-align: left; padding: 9px 12px; border-radius: 8px; color: var(--ink); text-decoration: none; font-size: .92rem; }
.account-panel a:hover, .account-panel .linklike:hover { background: var(--soft); }
.account-who { display: flex; flex-direction: column; gap: 2px; padding: 8px 12px 12px; margin: 0 0 6px; border-bottom: 1px solid var(--rule); font-size: .85rem; color: var(--muted); }
.account-who strong { color: var(--ink); font-size: .95rem; }
.role-badge { align-self: flex-start; margin-top: 4px; font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--link); }
.signout-form { margin: 0; }
.account-areas { display: flex; gap: 6px; padding: 4px 4px 8px; margin-bottom: 4px; border-bottom: 1px solid var(--rule); }
.account-panel .account-areas a { flex: 1; text-align: center; padding: 7px 8px; border: 1px solid var(--rule); font-weight: 600; font-size: .86rem; }
.account-panel .account-areas a[aria-current="true"] { background: var(--soft); border-color: var(--rule-strong); }

.shell { flex: 1; display: grid; grid-template-columns: 264px minmax(0, 1fr); }
.shell-single { grid-template-columns: minmax(0, 1fr); }
.sidenav { position: sticky; top: var(--topbar-h); height: calc(100vh - var(--topbar-h)); overflow-y: auto; padding: 18px 12px 40px 16px; border-right: 1px solid var(--rule); background: var(--surface); }
.sidenav-head { display: none; }
.nav-group { margin-bottom: 14px; }
.nav-group-label { margin: 10px 12px 4px; font-size: .72rem; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); }
.sidenav ul { list-style: none; margin: 0; padding: 0; }
.sidenav a { display: block; padding: 7px 12px; border-radius: 8px; color: var(--ink); text-decoration: none; font-size: .93rem; line-height: 1.35; }
.sidenav a:hover { background: var(--soft); }
.sidenav a[aria-current="page"] { background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--link); font-weight: 650; box-shadow: inset 3px 0 0 var(--accent); }
.main { padding: 28px clamp(16px, 3.5vw, 48px) 80px; min-width: 0; max-width: 1180px; width: 100%; }
.main-wide { max-width: 1320px; }

/* crumbs, page heads */
.crumbs ol { display: flex; flex-wrap: wrap; gap: 4px; list-style: none; margin: 0 0 18px; padding: 0; font-size: .84rem; color: var(--muted); }
.crumbs li + li::before { content: "/"; margin-right: 4px; color: var(--rule-strong); }
.crumbs a { color: var(--muted); }
.page-head { margin-bottom: 1.5rem; }
.page-head .lead, .lead { font-size: 1.08rem; color: var(--muted); max-width: 46rem; margin-top: .25rem; }
.eyebrow { margin: 0 0 .35rem; font: 700 .76rem/1.3 var(--sans); letter-spacing: .1em; text-transform: uppercase; color: var(--link); }
.head-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1rem; }
.section-title { font-size: 1.25rem; margin: 2.2rem 0 1rem; }

/* notices, badges, panels */
.notice { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--radius-sm); margin: 0 0 1.25rem; border: 1px solid; font-size: .95rem; }
.notice > .icon { margin-top: 2px; }
.notice > div { min-width: 0; flex: 1; }
.notice p:first-child { margin-top: 0; }
.notice-ok { background: var(--pass-bg); border-color: var(--pass-rule); color: var(--text); }
.notice-ok > .icon { color: var(--pass); }
.notice-error { background: var(--fail-bg); border-color: var(--fail-rule); color: var(--text); }
.notice-error > .icon { color: var(--fail); }
.notice-warn { background: var(--open-bg); border-color: color-mix(in srgb, var(--open) 40%, transparent); color: var(--text); }
.notice-warn > .icon { color: var(--open); }
p.notice { display: block; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; background: var(--soft); color: var(--muted); font: 600 .74rem/1.4 var(--sans); letter-spacing: .02em; vertical-align: middle; }
.badge-open, .badge-warn { background: var(--open-bg); color: var(--open); }
.badge-ess { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--link); }
.badge-full { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--link); }
.badge-essentials { background: var(--b-key); color: var(--l-key); }
.badge-glossary { background: var(--b-story); color: var(--l-story); }
.panel { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 20px 22px; margin: 0 0 1.25rem; box-shadow: var(--shadow); }
.panel h2 { font-size: 1.2rem; margin: 0 0 .75rem; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.panel-head a { font-size: .9rem; font-weight: 600; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem; align-items: start; }
.grid-2 > .panel { margin: 0; }
.kv { display: grid; gap: 8px; margin: 0; }
.kv div { display: grid; grid-template-columns: minmax(0, 14rem) minmax(0, 1fr); gap: 12px; border-bottom: 1px solid var(--rule); padding-bottom: 8px; }
.kv dt { color: var(--muted); font-size: .9rem; }
.kv dd { margin: 0; font-weight: 500; }
.empty-state { text-align: center; padding: 48px 20px; border: 1px dashed var(--rule-strong); border-radius: var(--radius); color: var(--muted); background: var(--surface); }
.empty-state h2 { margin: .5rem 0; font-size: 1.2rem; }
.empty-state .icon { color: var(--accent); }

/* forms */
.stack-form { display: grid; gap: 16px; }
.compact-form { gap: 10px; }
.field { display: grid; gap: 6px; }
.field label { font-weight: 600; font-size: .93rem; color: var(--ink); }
.field .optional { font-weight: 400; color: var(--muted); }
.hint { margin: 0; font-size: .85rem; color: var(--muted); }
.error-text { margin: 0; font-size: .87rem; color: var(--fail); font-weight: 600; display: flex; gap: 6px; align-items: center; }
input[type="text"], input[type="email"], input[type="password"], input[type="search"], input[type="number"], select, textarea {
  width: 100%; min-height: 46px; padding: 10px 12px; border: 1.5px solid var(--rule-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); font: 400 1rem var(--sans); }
textarea { min-height: 120px; line-height: 1.5; font-family: var(--mono); font-size: .92rem; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 28%, transparent); }
.has-error input, .has-error select, .has-error textarea { border-color: var(--fail); }
input[type="file"] { font: .92rem var(--sans); color: var(--text); padding: 8px 0; }
input[type="checkbox"], input[type="radio"] { width: 18px; height: 18px; accent-color: var(--brand); }
.check-field label { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; }
.field .show-password:not([hidden]) { display: inline-flex; gap: 8px; align-items: center; font-weight: 500; font-size: .87rem; color: var(--muted); }
.preview-fieldset { border: 0; padding: 0; margin: 0; min-width: 0; display: grid; gap: 14px; opacity: .6; }
.preview-note { font-size: .85rem; color: var(--muted); display: flex; gap: 6px; align-items: center; margin: 8px 0 0; }
.radio-group { border: 0; padding: 0; margin: 0; display: grid; gap: 10px; }
.radio-card { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border: 1.5px solid var(--rule); border-radius: var(--radius-sm); cursor: pointer; }
.radio-card:has(input:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 7%, transparent); }
.radio-card span { display: grid; gap: 2px; }
.pill-radio { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border: 1px solid var(--rule); border-radius: 999px; font-size: .88rem; cursor: pointer; background: var(--surface); }
.pill-radio:has(input:checked) { border-color: var(--accent); color: var(--link); font-weight: 600; }

/* ------------------------------------------------------------------ public pages */
.pub-header { background: var(--deep); color: #fff; }
.landing .pub-header, .auth .pub-header { position: relative; z-index: 2; }
.pub-header-inner { max-width: 1200px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px clamp(16px, 3vw, 32px); }
.pub-header .brand, .pub-header .brand:hover { color: #fff; }
.pub-header .brand-sub { color: #E3D3C3; }
.pub-actions { display: flex; gap: 8px; }
.pub-header .btn-ghost { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .5); }
.pub-header .btn-ghost:hover { border-color: #fff; }
.pub-header .btn-primary { background: #F4A261; color: #264653; }
.pub-header .btn-primary:hover { background: #E9C46A; }
.pub-main { flex: 1; width: 100%; }
.pub-narrow { max-width: 1100px; margin: 0 auto; padding: 40px 16px 72px; }
.public:not(.landing) .pub-main:not(.pub-narrow) { max-width: 1100px; margin: 0 auto; padding: 40px 16px 72px; }

.hero { background: linear-gradient(160deg, #264653 0%, #1F3C47 60%, #18313A 100%); color: #F1E6DB;
  border-bottom: 6px solid transparent; border-image: linear-gradient(90deg, #E76F51, #F4A261 55%, #E9C46A) 1; }
.hero-inner { max-width: 1200px; margin: 0 auto; padding: clamp(40px, 7vw, 88px) clamp(16px, 3vw, 32px) clamp(48px, 7vw, 96px); display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); gap: clamp(24px, 4vw, 56px); align-items: center; }
.eyebrow-on-dark { color: #E9C46A; }
.hero-title { color: #fff; font-size: clamp(2.5rem, 1.6rem + 3.6vw, 4.25rem); line-height: 1.02; margin: .2rem 0 .4rem; letter-spacing: -.02em; }
.hero-sub { font-family: var(--sans); font-size: clamp(1.15rem, 1rem + .6vw, 1.5rem); color: #F8D3BF; margin: 0 0 1.25rem; font-style: italic; }
.hero-lead { font-family: var(--sans); font-size: 1.06rem; line-height: 1.7; color: #F1E6DB; max-width: 38rem; }
.hero-lead strong { color: #fff; font-weight: 600; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 1.75rem 0 1rem; }
.hero-note { display: flex; gap: 8px; align-items: flex-start; font-size: .88rem; color: #D8CABD; max-width: 34rem; }
.hero-art { background: rgba(255, 255, 255, .04); border: 1px solid rgba(255, 255, 255, .1); border-radius: 20px; padding: 18px; }
.hero-svg { display: block; width: 100%; height: auto; }
.art-grid { stroke: rgba(255, 255, 255, .07); stroke-width: 1; }
.art-num { fill: #FFFFFF; font: 700 13px var(--sans); }
.art-part { fill: #E3D3C3; font: 700 10px var(--sans); letter-spacing: .12em; }
.art-flag { fill: #E9C46A; font: 600 13px var(--sans); }
.glance { background: var(--surface); border-bottom: 1px solid var(--rule); }
.glance-list { max-width: 1200px; margin: 0 auto; padding: 20px clamp(16px, 3vw, 32px); display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; }
.glance-item dt { font: 700 .72rem var(--sans); letter-spacing: .1em; text-transform: uppercase; color: var(--link); }
.glance-item dd { margin: 4px 0 0; font-size: .95rem; color: var(--text); }
.land-section { max-width: 1200px; margin: 0 auto; padding: clamp(40px, 6vw, 72px) clamp(16px, 3vw, 32px) 0; }
.land-section h2 { font-size: clamp(1.5rem, 1.2rem + 1.2vw, 2.1rem); margin: .2rem 0 .75rem; }
.land-text { font-family: var(--sans); font-size: 1.05rem; line-height: 1.7; max-width: 46rem; color: var(--text); }
.land-cols { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 40px; align-items: center; }
.chips { list-style: none; display: flex; flex-wrap: wrap; gap: 10px; margin: 0; padding: 0; }
.chips li { padding: 8px 14px; border-radius: 999px; background: var(--surface); border: 1px solid var(--rule); font-weight: 600; font-size: .9rem; color: var(--ink); box-shadow: var(--shadow); }
.parts-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; margin-top: 1.5rem; }
.part-card { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 18px 16px; border-top: 4px solid var(--pc, var(--accent)); box-shadow: var(--shadow); }
.part-I { --pc: #264653; } .part-II { --pc: #3A7788; } .part-III { --pc: #E76F51; } .part-IV { --pc: #F4A261; } .part-V { --pc: #E9C46A; }
@media (prefers-color-scheme: dark) { .part-I { --pc: #9FC3CE; } }
.part-num { margin: 0; font: 700 .72rem var(--sans); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.part-card h3 { font-family: var(--serif); font-size: 1.12rem; margin: .2rem 0 .8rem; }
.module-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.module-list li { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 8px; font-size: .88rem; line-height: 1.4; color: var(--text); }
.mod-n { display: inline-grid; place-items: center; min-width: 26px; height: 26px; padding: 0 6px; border-radius: 7px; background: var(--soft); color: var(--ink); font: 700 .8rem var(--sans); }
.formats-grid, .feature-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; margin-top: 1.5rem; }
/* A course with fewer than five parts or three formats fills the width (cols-N is set by the landing page). */
@media (min-width: 1100px) {
  .parts-grid.cols-1 { grid-template-columns: minmax(0, 1fr); }
  .parts-grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .parts-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .parts-grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (min-width: 1024px) {
  .formats-grid.cols-1 { grid-template-columns: minmax(0, 1fr); }
  .formats-grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.format-card { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.format-card h3 { font-family: var(--serif); font-size: 1.3rem; margin: 0 0 .3rem; }
.format-intensive { border-top: 4px solid #E76F51; } .format-weekly { border-top: 4px solid #264653; } .format-short { border-top: 4px solid #E9C46A; }
@media (prefers-color-scheme: dark) { .format-weekly { border-top-color: #9FC3CE; } }
.format-lead { color: var(--muted); margin: 0 0 1rem; }
.format-card dl { margin: 0; display: grid; gap: 10px; }
.format-card dt { font: 700 .72rem var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.format-card dd { margin: 2px 0 0; font-size: .93rem; }
.feature { padding: 4px 0; }
.feature .icon { color: var(--accent); }
.feature h3 { margin: .6rem 0 .3rem; font-size: 1.05rem; }
.feature p { margin: 0; color: var(--muted); font-size: .95rem; }
.cta-band { margin-top: clamp(48px, 7vw, 88px); background: linear-gradient(160deg, #264653, #18313A); color: #F1E6DB; }
.cta-inner { max-width: 1200px; margin: 0 auto; padding: 48px clamp(16px, 3vw, 32px); }
.cta-inner h2 { color: #fff; margin: 0 0 .3rem; }

.auth-card { max-width: 30rem; margin: 0 auto; background: var(--surface); border: 1px solid var(--rule); border-radius: 16px; padding: clamp(22px, 4vw, 36px); box-shadow: var(--shadow-lg); }
.auth-card-wide { max-width: 34rem; }
.auth-head h1 { font-size: 1.9rem; }
.auth-head .lead { font-size: 1rem; margin-bottom: 1.25rem; }
.auth-foot { margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid var(--rule); font-size: .92rem; }
.auth-foot p { margin: .4rem 0; }
.auth .pub-main { background: radial-gradient(900px 400px at 50% -10%, color-mix(in srgb, var(--accent) 12%, transparent), transparent 70%); }
.error-page { max-width: 36rem; margin: 40px auto; text-align: center; }
.error-page .lead { margin-left: auto; margin-right: auto; }

.site-footer { border-top: 1px solid var(--rule); background: var(--surface); font-size: .86rem; color: var(--muted); }
.footer-inner { max-width: 1200px; margin: 0 auto; padding: 18px clamp(16px, 3vw, 32px); display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; }
.footer-inner p { margin: 0; }
.footer-brand { font-family: var(--serif); font-weight: 600; color: var(--ink); }
.preview-banner { position: fixed; left: 0; right: 0; bottom: 0; z-index: 95; background: #E9C46A; color: #264653; text-align: center; font: 500 .9rem/1.4 var(--sans); padding: 8px 16px; box-shadow: 0 -4px 18px rgba(0, 0, 0, .18); }
body.has-preview { padding-bottom: 64px; }
@media (max-width: 719px) { body.has-preview { padding-bottom: 116px; } }
.preview-banner a { color: #264653; font-weight: 700; }
.preview-links { display: inline-block; margin-left: 10px; }
.demo-panel { margin-top: 1.5rem; }
.demo-panel .questions { margin-top: 1rem; }

/* ------------------------------------------------------------------ student home */
.home-top { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1.25rem; margin-bottom: 1.25rem; align-items: stretch; }
.start-card, .continue-card { display: flex; flex-direction: column; gap: 6px; padding: 22px 24px; border-radius: var(--radius); text-decoration: none; box-shadow: var(--shadow); }
.start-card { background: linear-gradient(150deg, #264653, #2F5566); color: #F1E6DB; }
.start-card:hover { color: #fff; background: linear-gradient(150deg, #1F3C47, #B63E20); }
.start-card:hover .start-kicker { color: #fff; }
.continue-card { background: var(--surface); border: 1px solid var(--rule); color: var(--text); }
.continue-card:hover { border-color: var(--accent); color: var(--text); }
.start-kicker { font: 700 .74rem var(--sans); letter-spacing: .1em; text-transform: uppercase; color: #E9C46A; }
.continue-card .start-kicker { color: var(--link); }
.start-title { font-family: var(--serif); font-size: 1.3rem; font-weight: 600; line-height: 1.3; color: #fff; }
.continue-card .start-title { color: var(--ink); }
.start-text { font-size: .93rem; }
.start-go { margin-top: auto; padding-top: 10px; font-weight: 650; display: inline-flex; gap: 6px; align-items: center; }
.home-top > .panel { margin: 0; }
.area-lecturer .home-top { align-items: start; }
.area-lecturer .home-top .start-card { min-height: 220px; }
.progress-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; margin: 6px 0 16px; }
.progress-track { background: var(--panel); border-radius: var(--radius-sm); padding: 14px 16px; }
.progress-label { margin: 0; font: 700 .74rem var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.progress-big { margin: 4px 0 8px; font-size: 1rem; }
.progress-big strong { font-family: var(--serif); font-size: 1.6rem; color: var(--ink); }
progress { width: 100%; height: 10px; border-radius: 999px; overflow: hidden; appearance: none; border: 0; background: var(--rule); }
progress::-webkit-progress-bar { background: var(--rule); border-radius: 999px; }
progress::-webkit-progress-value { background: var(--accent); border-radius: 999px; }
progress::-moz-progress-bar { background: var(--accent); border-radius: 999px; }
.progress-final { margin: 10px 0 0; font-size: .9rem; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.progress-table th[scope="row"] { font-weight: 500; white-space: nowrap; }
.score-link { text-decoration: none; }
.link-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.link-card { display: flex; flex-direction: column; gap: 4px; height: 100%; padding: 16px 18px; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--surface); text-decoration: none; color: var(--text); transition: border-color .15s, transform .15s; }
.link-card:hover { border-color: var(--accent); color: var(--text); transform: translateY(-1px); }
.link-card .icon { color: var(--accent); margin-bottom: 6px; }
.link-card-title { font-weight: 650; color: var(--ink); }
.link-card-text { font-size: .88rem; color: var(--muted); }
.link-grid-compact .link-card { flex-direction: row; align-items: center; gap: 12px; }
.link-grid-compact .link-card .icon { margin: 0; }

/* scores */
.score { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 999px; font: 650 .85rem var(--sans); white-space: nowrap; }
.score-pass { background: var(--pass-bg); color: var(--pass); }
.score-fail { background: var(--fail-bg); color: var(--fail); }
.score-open { background: var(--open-bg); color: var(--open); }
.score-none { background: var(--none-bg); color: var(--muted); font-weight: 500; }

/* ------------------------------------------------------------------ tables */
.table-wrap { overflow-x: auto; margin: 1rem 0; border: 1px solid var(--rule); border-radius: var(--radius-sm); background: var(--surface); -webkit-overflow-scrolling: touch; }
.table-wrap:focus-visible { outline-offset: 0; }
table { border-collapse: collapse; width: 100%; font-size: .92rem; line-height: 1.45; font-variant-numeric: tabular-nums; }
th, td { text-align: left; vertical-align: top; padding: 10px 12px; }
thead th { background: var(--soft); color: var(--ink); font-weight: 650; font-size: .84rem; border-bottom: 1px solid var(--rule); white-space: nowrap; }
tbody tr + tr > * { border-top: 1px solid var(--rule); }
tbody th { font-weight: 600; color: var(--ink); }
.panel .table-wrap { margin: .5rem 0 0; }

/* ------------------------------------------------------------------ documents (textbook, notes, pages) */
.doc-layout { display: grid; grid-template-columns: minmax(0, 46rem) minmax(0, 15rem); gap: 56px; align-items: start; }
.doc { min-width: 0; }
.doc-head { margin-bottom: 1.5rem; }
.doc-head h1 { font-size: clamp(1.8rem, 1.4rem + 1.6vw, 2.6rem); line-height: 1.15; }
.doc-meta { display: flex; flex-wrap: wrap; gap: 8px 20px; align-items: center; font-size: .9rem; color: var(--muted); margin-top: .75rem; }
.doc-meta a { font-weight: 600; display: inline-flex; gap: 5px; align-items: center; }
.doc-toc { position: sticky; top: calc(var(--topbar-h) + 24px); max-height: calc(100vh - var(--topbar-h) - 48px); overflow-y: auto; font-size: .86rem; padding-left: 14px; border-left: 1px solid var(--rule); }
.doc-toc-title { margin: 0 0 .5rem; font: 700 .72rem var(--sans); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.toc-list { list-style: none; margin: 0; padding: 0; }
.toc-list li { margin: 0; }
.toc-list a { display: block; padding: 5px 0; color: var(--muted); text-decoration: none; line-height: 1.35; }
.toc-list a:hover, .toc-list a.is-current { color: var(--link); }
.toc-list a.is-current { font-weight: 650; }
.doc-toc-inline { display: none; margin: 0 0 1.5rem; border: 1px solid var(--rule); border-radius: var(--radius-sm); background: var(--surface); }
.doc-toc-inline summary { cursor: pointer; padding: 12px 14px; font-weight: 650; color: var(--ink); }
.doc-toc-inline .count { color: var(--muted); font-weight: 400; }
.doc-toc-inline nav { padding: 0 14px 12px; }

.prose { font-family: var(--sans); font-size: 1.075rem; line-height: 1.72; color: var(--text); }
.prose > :first-child { margin-top: 0; }
.prose p { margin: .85em 0; }
.prose h2 { font-size: 1.55rem; margin: 2.4em 0 .7em; padding-top: .9em; border-top: 1px solid var(--rule); }
.prose h3 { font-family: var(--serif); font-size: 1.12rem; margin: 1.9em 0 .5em; }
.prose h4 { font-family: var(--serif); font-size: 1rem; margin: 1.5em 0 .4em; }
.prose ul, .prose ol { padding-left: 1.5em; }
.prose li { margin: .35em 0; }
.prose li::marker { color: var(--brand); font-weight: 700; }
.prose strong { color: var(--ink); font-weight: 600; }
.prose pre { background: var(--soft); border: 1px solid var(--rule); border-radius: var(--radius-sm); padding: 14px 16px; overflow-x: auto; font-size: .88rem; line-height: 1.55; }
.prose pre code { background: none; padding: 0; white-space: pre; }
.prose .table-wrap { font-family: var(--sans); margin: 1.4em 0; }
.prose table { font-size: .9rem; }
.prose thead th { background: var(--th-bg); color: var(--th-ink); border-bottom: 0; white-space: normal; }
.prose tbody tr:nth-child(even) td { background: var(--zebra); }
.prose blockquote { margin: 1.2em 0; padding-left: 16px; border-left: 3px solid var(--rule-strong); color: var(--muted); }
.chapter-opening { background: var(--panel); border-left: 4px solid var(--accent); border-radius: 0 var(--radius) var(--radius) 0; padding: 18px 22px; margin-bottom: 2rem; font-size: 1rem; }
.chapter-opening > :first-child { margin-top: 0; }
.chapter-opening > :last-child { margin-bottom: 0; }
.callout { margin: 1.6em 0; padding: 16px 20px 14px; border-radius: 0 var(--radius) var(--radius) 0; border-left: 5px solid var(--cc); background: var(--cb); }
.callout-label { margin: 0 0 .35em !important; font: 700 .76rem/1.3 var(--sans); letter-spacing: .1em; text-transform: uppercase; color: var(--cl); }
.callout > p:last-child, .callout > ul:last-child, .callout > ol:last-child { margin-bottom: .1em; }
.callout p:nth-child(2) { margin-top: 0; }
.c-story { --cc: var(--c-story); --cb: var(--b-story); --cl: var(--l-story); }
.c-case { --cc: var(--c-case); --cb: var(--b-case); --cl: var(--l-case); }
.c-practice { --cc: var(--c-practice); --cb: var(--b-practice); --cl: var(--l-practice); }
.c-key { --cc: var(--c-key); --cb: var(--b-key); --cl: var(--l-key); }
.c-key p { font-size: 1.05em; color: var(--ink); }
.c-pitfall { --cc: var(--c-pitfall); --cb: var(--b-pitfall); --cl: var(--l-pitfall); }
.c-think { --cc: var(--c-think); --cb: var(--b-think); --cl: var(--l-think); }
.c-tool { --cc: var(--c-tool); --cb: var(--b-tool); --cl: var(--l-tool); }
.c-safety { --cc: var(--c-safety); --cb: var(--b-safety); --cl: var(--l-safety); }
.chapter-end { margin-top: 3rem; padding: 22px 24px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--rule); }
.chapter-end h2 { margin: 0 0 .3rem; font-size: 1.3rem; border: 0; padding: 0; }
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 3rem; padding-top: 1.5rem; border-top: 1px solid var(--rule); }
.pager a { display: flex; flex-direction: column; gap: 3px; padding: 14px 16px; border: 1px solid var(--rule); border-radius: var(--radius-sm); text-decoration: none; background: var(--surface); color: var(--ink); }
.pager a:hover { border-color: var(--accent); }
.pager-next { text-align: right; grid-column: 2; }
.pager-dir { font: 700 .74rem var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); display: inline-flex; gap: 6px; align-items: center; }
.pager-next .pager-dir { justify-content: flex-end; }
.pager-title { font-family: var(--serif); font-weight: 600; line-height: 1.3; }
.prose-page { max-width: 46rem; margin: 0 auto; }

/* book contents */
.download-row { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 1.25rem; }
.download { display: inline-flex; align-items: center; gap: 10px; padding: 10px 14px; border: 1px solid var(--rule); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink); text-decoration: none; }
.download:hover { border-color: var(--accent); color: var(--ink); }
.download .icon { color: var(--accent); }
.download-text { display: flex; flex-direction: column; line-height: 1.25; }
.download-name { font-weight: 600; font-size: .92rem; }
.download-meta { font-size: .78rem; color: var(--muted); }
.is-live-only { opacity: .75; border-style: dashed; }
.audio-file { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; max-width: 100%; }
.audio-file audio { width: 22rem; max-width: 100%; }
.audio-fallback { margin: 0; font-size: .85rem; color: var(--muted); }
.toc-front { font-family: var(--sans); font-size: 1.05rem; margin: 0 0 1rem; }
.toc-part { margin-top: 2rem; }
.toc-part h2 { font-size: 1.3rem; margin: 0 0 .75rem; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.part-label { font: 700 .76rem var(--sans); letter-spacing: .1em; text-transform: uppercase; color: var(--link); }
.toc-chapters { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.toc-chapter { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius-sm); padding: 14px 16px; }
.toc-ch-head { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 12px; align-items: baseline; }
.toc-ch-num { font-family: var(--serif); font-size: 1.5rem; font-weight: 700; color: var(--brand); line-height: 1; }
.toc-ch-title { font-family: var(--serif); font-size: 1.1rem; font-weight: 600; color: var(--ink); text-decoration: none; }
a.toc-ch-title:hover { color: var(--link); text-decoration: underline; }
.toc-ch-meta { font-size: .82rem; color: var(--muted); white-space: nowrap; }
.toc-sections { margin: 8px 0 0 52px; }
.toc-sections summary { cursor: pointer; font-size: .85rem; color: var(--muted); font-weight: 600; }
.toc-sections ol { margin: 8px 0 0; padding-left: 0; list-style: none; columns: 2; column-gap: 24px; font-size: .9rem; }
.toc-sections li { break-inside: avoid; padding: 2px 0; }
.toc-extras { font-size: .84rem; color: var(--muted); }
.toc-apps { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; font-family: var(--sans); font-size: 1.05rem; }
.is-missing { color: var(--muted); }

/* search */
.search-form { margin-bottom: 1.5rem; }
.search-row { display: flex; gap: 10px; }
.search-row input { flex: 1; }
.scope-row { border: 0; padding: 0; margin: 12px 0 0; display: flex; flex-wrap: wrap; gap: 8px; }
.result-count { color: var(--muted); font-size: .92rem; margin: 0 0 1rem; }
.search-results { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.search-result { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius-sm); padding: 14px 18px; }
.sr-meta { margin: 0; font-size: .82rem; color: var(--muted); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.sr-title { font-family: var(--serif); font-size: 1.05rem; margin: .35rem 0 .2rem; }
.sr-snippet { margin: 0; font-family: var(--sans); font-size: .95rem; color: var(--text); }
mark { background: color-mix(in srgb, var(--sand) 30%, transparent); color: inherit; border-radius: 3px; padding: 0 2px; }

/* resources: flashcards */
.deck-grid { list-style: none; margin: 1.5rem 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.deck-card { display: flex; flex-direction: column; gap: 4px; padding: 16px; border-radius: var(--radius); border: 1px solid var(--rule); background: var(--surface); text-decoration: none; color: var(--text); box-shadow: var(--shadow); height: 100%; }
.deck-card:hover { border-color: var(--accent); color: var(--text); }
.deck-n { font: 700 .72rem var(--sans); letter-spacing: .1em; text-transform: uppercase; color: var(--link); }
.deck-title { font-family: var(--serif); font-weight: 600; color: var(--ink); line-height: 1.3; }
.deck-count { font-size: .85rem; color: var(--muted); margin-top: auto; }
.fc-app { max-width: 44rem; }
.fc-bar { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between; margin-bottom: 12px; font-size: .9rem; color: var(--muted); }
.fc-piles { display: flex; gap: 8px; flex-wrap: wrap; }
.fc-pile { padding: 4px 10px; border-radius: 999px; background: var(--soft); font-weight: 600; font-size: .82rem; }
.fc-pile-know { background: var(--pass-bg); color: var(--pass); }
.fc-pile-again { background: var(--open-bg); color: var(--open); }
.fc-stage { perspective: 1400px; }
.fc-card { position: relative; display: block; width: 100%; min-height: 280px; border: 0; padding: 0; background: none; cursor: pointer; text-align: left; font: inherit; color: inherit; border-radius: 18px; }
.fc-inner { position: relative; display: block; width: 100%; min-height: 280px; transition: transform .45s cubic-bezier(.2, .7, .2, 1); transform-style: preserve-3d; }
.fc-card.is-flipped .fc-inner { transform: rotateY(180deg); }
.fc-face { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: center; gap: 12px; padding: 28px 32px; border-radius: 18px; backface-visibility: hidden; -webkit-backface-visibility: hidden; border: 1px solid var(--rule); box-shadow: var(--shadow-lg); }
.fc-front { background: var(--surface); }
.fc-back { background: linear-gradient(160deg, #264653, #2F5566); color: #FBF3EA; transform: rotateY(180deg); border-color: transparent; }
.fc-label { font: 700 .72rem var(--sans); letter-spacing: .12em; text-transform: uppercase; color: var(--link); }
.fc-back .fc-label { color: #E9C46A; }
.fc-term { font-family: var(--serif); font-size: clamp(1.5rem, 1.1rem + 1.6vw, 2.2rem); font-weight: 600; color: var(--ink); line-height: 1.2; }
.fc-def { font-family: var(--sans); font-size: 1.18rem; line-height: 1.55; }
.fc-hint { position: absolute; bottom: 14px; right: 18px; font-size: .78rem; color: var(--muted); }
.fc-back .fc-hint { color: #D8CABD; }
.fc-actions { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; margin-top: 16px; }
.fc-actions .btn { min-height: 52px; }
.btn-again { background: var(--open-bg); color: var(--open); border-color: color-mix(in srgb, var(--open) 35%, transparent); }
.btn-know { background: var(--pass-bg); color: var(--pass); border-color: var(--pass-rule); }
.fc-tools { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.fc-done { text-align: center; padding: 40px 20px; border: 1px dashed var(--rule-strong); border-radius: 18px; background: var(--surface); }
.fc-done h2 { margin-top: 0; }
.fc-list { display: grid; gap: 10px; margin: 0; }
.fc-item { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius-sm); padding: 12px 16px; }
.fc-item dt { font-weight: 650; color: var(--ink); }
.fc-item dd { margin: 4px 0 0; font-family: var(--sans); }
.kbd-hint { font-size: .82rem; color: var(--muted); }

/* resources: filters, cases, glossary */
.filter-bar { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1.2fr) minmax(0, 1.2fr) auto; gap: 12px; align-items: end; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 14px 16px; margin: 0 0 1rem; }
.filter-bar-single { grid-template-columns: minmax(0, 1fr) auto; }
.filter-actions { display: flex; gap: 8px; }
.case-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.case-card { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 18px 20px; display: flex; flex-direction: column; box-shadow: var(--shadow); }
.case-meta { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; font-size: .8rem; }
.case-when { font-weight: 700; color: var(--amber-ink); }
.case-sector { color: var(--muted); }
.case-sector::before { content: "·"; margin-right: 8px; }
.case-name { font-family: var(--serif); font-size: 1.15rem; margin: .35rem 0 .25rem; }
.case-card p { font-size: .93rem; }
.case-lesson { border-top: 1px solid var(--rule); padding-top: 10px; margin-top: auto !important; }
.case-link { margin-bottom: 0; font-size: .87rem; font-weight: 600; }
.empty-filter { padding: 24px; text-align: center; color: var(--muted); }
.az ul { list-style: none; display: flex; flex-wrap: wrap; gap: 4px; margin: 0 0 1rem; padding: 0; }
.az a, .az span { display: inline-grid; place-items: center; min-width: 34px; height: 34px; border-radius: 8px; font-weight: 650; font-size: .9rem; text-decoration: none; }
.az a { background: var(--surface); border: 1px solid var(--rule); color: var(--ink); }
.az a:hover { border-color: var(--accent); color: var(--link); }
.az span { color: var(--rule-strong); }
.gl-letter { margin-bottom: 1.5rem; }
.gl-letter-h { font-size: 1.6rem; color: var(--brand); margin: 1.5rem 0 .5rem; border-bottom: 1px solid var(--rule); padding-bottom: 4px; }
.gl-list { margin: 0; display: grid; gap: 4px; }
.gl-item { display: grid; grid-template-columns: minmax(0, 15rem) minmax(0, 1fr); gap: 20px; padding: 10px 0; border-bottom: 1px solid var(--rule); }
.gl-item dt { font-weight: 650; color: var(--ink); }
.gl-item dd { margin: 0; }
.gl-item dd p { margin: 0; font-family: var(--sans); }
.gl-item dd p.gl-ch { font-family: var(--sans); font-size: .82rem; color: var(--muted); margin-top: 4px; }
.gl-item:target { background: color-mix(in srgb, var(--sand) 14%, transparent); border-radius: 6px; }
.reading-ch { margin-top: 1.5rem; }
.reading-ch h2 { font-size: 1.2rem; display: flex; flex-direction: column; gap: 2px; }
.reading-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.reading-list li { padding: 12px 16px; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius-sm); }
.reading-list .ref { margin: 0; font-family: var(--sans); }
.reading-list .why { margin: 4px 0 0; font-size: .9rem; color: var(--muted); }
.sheet-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 10px; }
.sheet-link { display: flex; gap: 12px; align-items: center; padding: 14px 16px; border: 1px solid var(--rule); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink); text-decoration: none; font-weight: 600; line-height: 1.35; height: 100%; }
a.sheet-link:hover { border-color: var(--accent); color: var(--link); }
.step-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.step-list li { display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 12px; align-items: baseline; }
.step-n { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--deep); color: #fff; font-weight: 700; font-size: .9rem; }
@media (prefers-color-scheme: dark) { .step-n { background: #B63E20; } }
.step-list a { font-family: var(--serif); font-weight: 600; font-size: 1.02rem; }
.step-meta { display: block; font-size: .84rem; color: var(--muted); }
.file-table th[scope="row"] { font-weight: 600; min-width: 12rem; }
.dl-groups { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.dl-group-h { font-family: var(--serif); font-size: 1.05rem; margin: .8rem 0 .5rem; }

/* ------------------------------------------------------------------ tests */
.tests-track { margin-bottom: 2rem; }
.tests-table td, .tests-table th { vertical-align: middle; }
.final-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 20px; align-items: center; margin-top: 1rem; padding: 20px 22px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--rule); border-left: 5px solid var(--sand); box-shadow: var(--shadow); }
.final-card h3 { font-family: var(--serif); font-size: 1.25rem; margin: 0 0 .5rem; }
.final-side { text-align: right; }
.final-side p { margin: 0 0 8px; }
.rules { list-style: none; margin: .5rem 0 1rem; padding: 0; display: grid; gap: 6px; }
.rules li { display: flex; gap: 8px; align-items: flex-start; }
.rules .icon { color: var(--accent); margin-top: 2px; }
.grid-2-wide { grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); }
.attempt-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.attempt-list li { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; padding: 10px 12px; background: var(--panel); border-radius: var(--radius-sm); font-size: .9rem; }
.attempt-n { font-weight: 650; color: var(--ink); }
.attempt-date { color: var(--muted); }
.attempt-bar { position: sticky; top: var(--topbar-h); z-index: 20; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px 20px; margin: -28px calc(-1 * clamp(16px, 3.5vw, 48px)) 24px; padding: 14px clamp(16px, 3.5vw, 48px); background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--rule); }
.attempt-title h1 { font-size: 1.35rem; margin: 0; }
.attempt-title .eyebrow { margin-bottom: 2px; }
.attempt-status { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; font-size: .88rem; }
.answered { font-weight: 650; color: var(--ink); }
.save-state { color: var(--muted); }
.save-state.is-error { color: var(--fail); font-weight: 650; }
.timer { display: inline-flex; gap: 6px; align-items: center; padding: 6px 12px; border-radius: 999px; background: var(--deep); color: #fff; font-weight: 700; font-variant-numeric: tabular-nums; }
@media (prefers-color-scheme: dark) { .timer { background: #1F3B45; } .timer.is-low { color: #1B1210; } }
.timer.is-low { background: var(--fail); color: #fff; }
.timer-alert { margin: 0 0 1rem; padding: 12px 16px; border-radius: var(--radius-sm); background: var(--fail-bg); color: var(--fail); font-weight: 650; border: 1px solid var(--fail-rule); }
.questions { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; }
.question { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 20px 22px; box-shadow: var(--shadow); }
.question fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.question legend { padding: 0; margin-bottom: 14px; width: 100%; }
.q-num { display: flex; gap: 6px; align-items: center; margin: 0 0 6px; font: 700 .76rem var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.q-mod { font-weight: 600; }
.q-stem { display: block; font-family: var(--sans); font-size: 1.12rem; line-height: 1.55; color: var(--ink); }
.options { display: grid; gap: 10px; }
.option { display: flex; gap: 12px; align-items: flex-start; padding: 13px 16px; border: 1.5px solid var(--rule); border-radius: var(--radius-sm); cursor: pointer; background: var(--surface); transition: border-color .12s, background .12s; }
.option:hover { border-color: var(--rule-strong); background: var(--panel); }
.option input { margin-top: 3px; flex: none; }
.option:has(input:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 9%, transparent); }
.option:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
.option-text { line-height: 1.5; }
.submit-bar { display: flex; flex-wrap: wrap; gap: 14px 24px; align-items: center; justify-content: space-between; margin-top: 24px; padding: 20px 22px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--rule); }
.submit-bar p { margin: 0; color: var(--muted); max-width: 36rem; }
.result-summary { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 28px; align-items: center; padding: 24px 28px; border-radius: 16px; margin-bottom: 1.25rem; border: 1px solid; }
.result-summary.is-pass { background: var(--pass-bg); border-color: var(--pass-rule); }
.result-summary.is-fail { background: var(--fail-bg); border-color: var(--fail-rule); }
.result-pct { margin: 0; font-family: var(--serif); font-size: clamp(2.8rem, 2rem + 3vw, 4rem); font-weight: 700; line-height: 1; color: var(--ink); }
.result-verdict { margin: 6px 0 0; display: flex; gap: 6px; align-items: center; font-weight: 700; font-size: 1.05rem; }
.is-pass .result-verdict { color: var(--pass); }
.is-fail .result-verdict { color: var(--fail); }
.result-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 14px; margin: 0; }
.result-facts dt { font: 700 .72rem var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.result-facts dd { margin: 4px 0 0; font-weight: 600; color: var(--ink); }
.review-head { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 8px; }
.review-filter { margin: 0; font-weight: 600; }
.review-item.is-right { border-left: 5px solid var(--pass); }
.review-item.is-wrong { border-left: 5px solid var(--fail); }
.review-item.is-right .q-num { color: var(--pass); }
.review-item.is-wrong .q-num { color: var(--fail); }
.answer-options { list-style: none; margin: 12px 0; padding: 0; display: grid; gap: 8px; }
.answer-options li { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: baseline; padding: 10px 14px; border: 1px solid var(--rule); border-radius: var(--radius-sm); }
.answer-options li.is-correct { border-color: var(--pass-rule); background: var(--pass-bg); }
.answer-options li.is-chosen-wrong { border-color: var(--fail-rule); background: var(--fail-bg); }
.opt-letter { font-weight: 700; color: var(--muted); }
.opt-text { flex: 1 1 16rem; }
.opt-tag { font: 700 .72rem var(--sans); letter-spacing: .05em; text-transform: uppercase; padding: 2px 8px; border-radius: 999px; }
.tag-correct { background: var(--pass); color: #fff; }
.tag-yours { background: var(--fail); color: #fff; }
.tag-yours-right { background: var(--surface); color: var(--pass); border: 1px solid var(--pass-rule); }
@media (prefers-color-scheme: dark) { .tag-correct, .tag-yours { color: #0F1E24; } }
.opt-share { font-size: .8rem; color: var(--muted); margin-left: auto; }
.explanation { margin: .5rem 0; font-family: var(--sans); }
.revisit { margin: .4rem 0 0; font-size: .9rem; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }

/* ------------------------------------------------------------------ lecturer */
.code-panel .code-display { margin: .2rem 0 .4rem; }
.code-display code { display: inline-block; font-size: 1.6rem; font-weight: 700; letter-spacing: .08em; padding: 8px 16px; border-radius: 10px; background: var(--panel); color: var(--ink); border: 1px dashed var(--rule-strong); }
.code-panel form + form { margin-top: 10px; }
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin: 4px 0 16px; }
.stat { background: var(--panel); border-radius: var(--radius-sm); padding: 14px 16px; display: flex; flex-direction: column; }
.stat-n { font-family: var(--serif); font-size: 1.7rem; font-weight: 700; color: var(--ink); line-height: 1.1; }
.stat-l { font-size: .84rem; color: var(--muted); }
.rate { display: flex; align-items: center; gap: 10px; }
.bar { width: 120px; height: 8px; flex: none; }
.bar-bg { fill: var(--rule); }
.bar-fg { fill: var(--accent); }
.rate-table td { vertical-align: middle; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--rule); margin: 0 0 1rem; }
.tabs a { padding: 10px 16px; text-decoration: none; color: var(--muted); font-weight: 650; border-bottom: 3px solid transparent; margin-bottom: -1px; }
.tabs a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); }
.legend { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; font-size: .84rem; }
.matrix-wrap { max-height: 70vh; overflow: auto; }
.matrix { font-size: .84rem; }
.matrix thead th { position: sticky; top: 0; z-index: 2; text-align: center; }
.matrix thead th.matrix-name { text-align: left; z-index: 3; left: 0; }
.matrix-name { position: sticky; left: 0; z-index: 1; background: var(--surface); min-width: 13rem; box-shadow: 1px 0 0 var(--rule); }
.matrix thead .matrix-name { background: var(--soft); }
.matrix-email { display: block; font-weight: 400; font-size: .78rem; color: var(--muted); }
.cell { text-align: center; white-space: nowrap; padding: 8px 6px; min-width: 64px; position: relative; }
.cell-best { font-weight: 700; }
.cell-n { display: block; font-size: .72rem; opacity: .8; }
.cell-pass { background: var(--pass-bg); color: var(--pass); }
.cell-fail { background: var(--fail-bg); color: var(--fail); }
.cell-open { background: var(--open-bg); color: var(--open); }
.cell-none { color: var(--rule-strong); }
.histogram { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.histogram li { display: grid; grid-template-columns: 6rem minmax(0, 1fr) 3rem; gap: 12px; align-items: center; font-size: .9rem; }
.histogram .bar { width: 100%; height: 12px; }
.h-n { text-align: right; font-weight: 650; }
.detail-attempts { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.detail-attempts details { border: 1px solid var(--rule); border-radius: var(--radius-sm); background: var(--surface); }
.detail-attempts summary { cursor: pointer; padding: 12px 14px; display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; }
.detail-attempts details > :not(summary) { margin-left: 14px; margin-right: 14px; }
.da-test { font-weight: 650; color: var(--ink); }
.da-date { color: var(--muted); font-size: .86rem; margin-left: auto; }
.answers-table td { font-size: .86rem; }
.row-wrong td { background: color-mix(in srgb, var(--fail-bg) 60%, transparent); }
.people-table .actions { white-space: nowrap; display: flex; gap: 6px; flex-wrap: wrap; }
.temp-pw code.pw { font-size: 1.02rem; font-weight: 700; letter-spacing: .04em; background: var(--surface); border: 1px solid var(--rule-strong); }
.danger-panel { border-color: var(--fail-rule); }
.slides-table td { vertical-align: middle; }
.mini-dl { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.mini-dl .download { padding: 5px 9px; gap: 6px; }
.mini-dl .download-meta { display: none; }
.bank-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.bank-item { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); scroll-margin-top: calc(var(--topbar-h) + 16px); }
.bank-item:target { border-color: var(--sand); }
.bank-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: .82rem; }
.bank-foot { display: flex; flex-wrap: wrap; gap: 8px 16px; justify-content: space-between; font-size: .88rem; margin: .6rem 0 0; }
.bank-stat { color: var(--muted); }
.dots { display: inline-flex; gap: 3px; align-items: center; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--rule-strong); }
.dot.on { background: var(--sand); }

/* slide viewer */
.viewer-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 12px 20px; margin-bottom: 16px; }
.viewer-head h1 { font-size: clamp(1.4rem, 1.1rem + 1vw, 1.9rem); margin: 0; max-width: 46rem; }
.viewer-dl { display: flex; gap: 8px; flex-wrap: wrap; }
.slide-frame { margin: 0; aspect-ratio: 16 / 9; width: 100%; background: #FFFFFF; border: 1px solid var(--rule); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-lg); display: grid; place-items: center; }
.slide-img { width: 100%; height: 100%; object-fit: contain; display: block; }
.slide-textcard { width: 100%; height: 100%; padding: clamp(16px, 4%, 48px); overflow: auto; background: #FFFFFF; color: #264653; font-family: var(--sans); }
.stc-kicker { margin: 0 0 .5rem; font: 700 .72rem var(--sans); letter-spacing: .1em; text-transform: uppercase; color: #B63E20; }
.stc-title { font-family: var(--serif); color: #264653; font-size: clamp(1.1rem, .9rem + 1.2vw, 1.9rem); margin: 0 0 .8rem; border: 0; padding: 0; }
.stc-body { font-size: clamp(.85rem, .78rem + .35vw, 1.05rem); color: #243A42; }
.stc-body ul { padding-left: 1.2em; margin: .3em 0; }
.st-h { font-weight: 700; margin: .6em 0 .2em; }
.st-small { font-size: .85em; color: #4E6974; }
.st-big { font-family: var(--serif); font-size: 2em; font-weight: 700; color: #B63E20; margin: .2em 0; }
.viewer-controls { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; }
.counter { margin: 0; font-size: 1rem; color: var(--muted); }
.counter strong { color: var(--ink); }
.notes-panel { margin-top: 18px; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 18px 22px; }
.notes-panel h2 { margin: 0 0 .4rem; font-size: 1.1rem; font-family: var(--serif); }
.notes-body { font-family: var(--sans); font-size: 1.05rem; line-height: 1.7; }
.slide-text { margin-top: 12px; font-size: .92rem; }
.slide-text summary { cursor: pointer; color: var(--muted); font-weight: 600; }
.thumbs { margin-top: 18px; }
.thumbs ol { list-style: none; margin: 0; padding: 4px 2px 12px; display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x proximity; }
.thumbs li { flex: none; scroll-snap-align: start; }
.thumbs a { position: relative; display: block; width: 160px; aspect-ratio: 16 / 9; border-radius: 8px; overflow: hidden; border: 2px solid var(--rule); background: #fff; text-decoration: none; }
.thumbs a[aria-current="true"] { border-color: var(--sand); box-shadow: 0 0 0 2px color-mix(in srgb, var(--sand) 35%, transparent); }
.thumbs img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb-text { display: block; padding: 8px; font-size: .7rem; line-height: 1.3; color: #264653; }
.thumb-n { position: absolute; left: 6px; bottom: 6px; background: rgba(38, 70, 83, .85); color: #fff; font: 700 .72rem var(--sans); padding: 1px 6px; border-radius: 5px; }

/* ------------------------------------------------------------------ responsive */
@media (max-width: 1279px) {
  .doc-layout { grid-template-columns: minmax(0, 46rem); }
  .doc-toc { display: none; }
  .doc-toc-inline { display: block; }
}
@media (max-width: 1099px) {
  .parts-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .glance-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1023px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .nav-toggle { display: inline-flex; }
  .sidenav { position: fixed; top: 0; left: 0; bottom: 0; height: auto; width: min(320px, 88vw); z-index: 80; transform: translateX(-104%); transition: transform .2s ease; box-shadow: var(--shadow-lg); padding-top: 12px; }
  .sidenav:target, .nav-open .sidenav { transform: none; }
  .sidenav-head { display: flex; justify-content: space-between; align-items: center; padding: 4px 4px 10px 12px; margin-bottom: 6px; border-bottom: 1px solid var(--rule); font-weight: 700; color: var(--ink); }
  .sidenav-close { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 8px; color: var(--ink); }
  .nav-scrim { position: fixed; inset: 0; background: rgba(15, 30, 36, .45); z-index: 70; }
  .brand-sub { display: none; }
  .home-top, .grid-2, .grid-2-wide { grid-template-columns: minmax(0, 1fr); }
  .hero-inner { grid-template-columns: minmax(0, 1fr); }
  .hero-art { max-width: 560px; }
  .formats-grid, .feature-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .land-cols { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .filter-bar { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .filter-bar > .field:first-child { grid-column: 1 / -1; }
}
@media (max-width: 719px) {
  .topbar-inner { gap: 8px; padding: 0 12px; }
  .nav-toggle span { display: none; }
  .nav-toggle { border: 0; padding: 8px; }
  .brand-name { font-size: 1rem; }
  .area-switch { display: none; }
  .topbar-search { width: auto; background: transparent; border: 0; padding: 0; }
  .topbar-search input { display: none; }
  .account-name { display: none; }
  .account-menu > summary { padding: 3px; }
  .account-panel { position: fixed; left: 12px; right: 12px; top: calc(var(--topbar-h) + 6px); width: auto; }
  .main { padding-top: 20px; }
  body { font-size: 15.5px; }
  .prose { font-size: 1.02rem; line-height: 1.68; }
  .prose h2 { font-size: 1.35rem; }
  .parts-grid, .formats-grid, .feature-grid, .glance-list { grid-template-columns: minmax(0, 1fr); }
  .pub-actions .btn-primary { display: none; }
  .pub-header .brand-sub { display: none; }
  .filter-bar, .filter-bar-single { grid-template-columns: minmax(0, 1fr); }
  .filter-actions { justify-content: flex-start; }
  .pager { grid-template-columns: minmax(0, 1fr); }
  .pager-next { grid-column: 1; }
  .toc-ch-head { grid-template-columns: 32px minmax(0, 1fr); }
  .toc-ch-meta { grid-column: 2; }
  .toc-sections { margin-left: 0; }
  .toc-sections ol { columns: 1; }
  .gl-item { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .final-card { grid-template-columns: minmax(0, 1fr); }
  .final-side { text-align: left; }
  .result-summary { grid-template-columns: minmax(0, 1fr); gap: 14px; padding: 20px; }
  .attempt-bar { margin-top: -20px; padding-top: 10px; padding-bottom: 10px; }
  .attempt-title h1 { font-size: 1.1rem; }
  .question { padding: 16px; }
  .kv div { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .fc-face { padding: 22px 20px; }
  .fc-actions .btn { padding: .5rem; font-size: .9rem; }
  .search-row { flex-direction: column; }
  .case-grid { grid-template-columns: minmax(0, 1fr); }
  .viewer-controls .btn { padding: .5rem .7rem; }
  .thumbs a { width: 120px; }
  .histogram li { grid-template-columns: 4.5rem minmax(0, 1fr) 2rem; }
  .people-table .actions { flex-direction: column; align-items: flex-start; }
  .audio-file { flex: 1 1 100%; }
  .audio-file audio { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* ------------------------------------------------------------------ print */
@media print {
  .topbar, .sidenav, .site-footer, .pager, .doc-toc, .doc-toc-inline, .crumbs, .skip-link, .btn, .download-row, .chapter-end, .preview-banner { display: none !important; }
  body { background: #fff; color: #000; }
  .shell { display: block; }
  .main { padding: 0; max-width: none; }
  .doc-layout { display: block; }
  .prose { font-size: 11pt; }
  .callout, .table-wrap { break-inside: avoid; }
  .audio-file audio { display: none; }
  a { color: inherit; text-decoration: none; }
}

/* Platform: the front page's course list and "Your courses". */
.hero-inner-single { grid-template-columns: minmax(0, 1fr); }
.course-grid { list-style: none; margin: 1.5rem 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; }
.course-card { height: 100%; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--rule); border-top: 4px solid var(--accent); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.course-card h3 { font-family: var(--serif); font-size: 1.35rem; margin: 0 0 .25rem; }
.course-card h3 a { color: var(--ink); text-decoration: none; }
.course-card h3 a:hover { text-decoration: underline; }
.course-card .role-badge { margin: 0 0 .4rem; }
.course-sub { font-family: var(--sans); font-style: italic; color: var(--muted); margin: 0 0 .75rem; }
.course-text { font-size: .95rem; line-height: 1.6; margin: 0 0 .75rem; }
.course-meta { font-size: .85rem; color: var(--muted); margin: auto 0 .75rem; }
.course-links { display: flex; flex-wrap: wrap; gap: 10px; margin: auto 0 0; }
.join-panel { max-width: 34rem; }
