@charset "UTF-8";
/* ===========================================================================
   MacauZX Learning Portal — Trusted Institutional design system
   照搬 Next.js 版：深藍（機構）＋ 米白羊皮紙底 ＋ 金色裝飾線
   Lora（標題襯線）＋ Inter（內文），中文落 PingFang / 思源
   =========================================================================== */

:root {
  /* 品牌色（同舊版 globals.css 一樣） */
  --brand-50:  #f3f6fb;
  --brand-100: #e0ebf6;
  --brand-500: #2c6695;
  --brand-600: #1f4b78;
  --brand-700: #143461;
  --brand-800: #0c2849;
  --brand-900: #061a33;

  --cream-50:  #fdfbf6;
  --cream-100: #faf6ec;
  --cream-200: #f3ecd8;
  --cream-300: #e8dcbc;
  --cream-400: #d4c4a0;

  --gold-400: #c4a35a;
  --gold-500: #a98745;
  --gold-600: #8b6f3e;

  /* 語義 token —— 所有頁面（課堂、考試、後台）都用呢組 */
  --paper:     var(--cream-50);
  --paper-2:   var(--cream-100);
  --card:      #ffffff;
  --ink:       var(--brand-800);
  --muted:     #4f6079;
  --rule:      var(--cream-300);
  --rule-firm: var(--cream-400);
  --jade:      var(--brand-700);   /* 主要動作色（沿用舊名，免改 JS） */
  --jade-ink:  var(--brand-800);
  --jade-soft: var(--cream-200);
  --gold:      var(--gold-500);
  --gold-ink:  var(--gold-600);
  --seal:      #8a2a22;            /* 錯誤／未合格；合格印章用金色 */
  --seal-soft: #f6e6e2;
  --ok:        #2d6e3e;
  --ok-soft:   #e3f0e6;
  --on-dark:   var(--cream-100);

  --display: "Lora", "Noto Serif TC", "Songti TC", "Times New Roman", Georgia, serif;
  --sans:    "Inter", -apple-system, "PingFang HK", "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  --code:    ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --shell: 72rem;
  --gut:   1.5rem;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper:     #0a1322;
    --paper-2:   #0e1a2c;
    --card:      #0c1c30;
    --ink:       #ede5d2;
    --muted:     #b3ab98;
    --rule:      #1d3150;
    --rule-firm: #2a4468;
    --jade:      #c4a35a;
    --jade-ink:  #d8bd7c;
    --jade-soft: #14243b;
    --gold:      #c4a35a;
    --gold-ink:  #d2b471;
    --seal:      #e28a7c;
    --seal-soft: #2a1714;
    --ok:        #7fc792;
    --ok-soft:   #132a1b;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper:     #0a1322;
  --paper-2:   #0e1a2c;
  --card:      #0c1c30;
  --ink:       #ede5d2;
  --muted:     #b3ab98;
  --rule:      #1d3150;
  --rule-firm: #2a4468;
  --jade:      #c4a35a;
  --jade-ink:  #d8bd7c;
  --jade-soft: #14243b;
  --gold:      #c4a35a;
  --gold-ink:  #d2b471;
  --seal:      #e28a7c;
  --seal-soft: #2a1714;
  --ok:        #7fc792;
  --ok-soft:   #132a1b;
  color-scheme: dark;
}

/* --------------------------------------------------------------- reset */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--paper); -webkit-font-smoothing: antialiased; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.65;
}
img, svg { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }

a { color: var(--jade); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--jade-ink); }

:focus-visible { outline: 2px solid var(--gold-400); outline-offset: 2px; border-radius: 2px; }

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

/* --------------------------------------------------------------- type */
h1, h2, h3, h4 {
  font-family: var(--display);
  font-weight: 500;
  line-height: 1.25;
  margin: 0 0 .5em;
  letter-spacing: -.01em;
  color: var(--ink);
}
h1 { font-size: clamp(2rem, 4.2vw, 2.75rem); }
h2 { font-size: clamp(1.6rem, 3vw, 2rem); }
h3 { font-size: 1.375rem; }
h4 { font-size: 1.125rem; }
p  { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }

.lead  { font-size: 1.0625rem; color: var(--muted); line-height: 1.75; }
.fine  { font-size: .8125rem; color: var(--muted); line-height: 1.6; }
.num   { font-variant-numeric: tabular-nums lining-nums; }
.code  { font-family: var(--code); font-size: .875em; letter-spacing: .02em; }
.prose { max-width: 36em; }
.prose p, .prose li { line-height: 1.85; }
.prose ul, .prose ol { padding-left: 1.3em; margin: 0 0 1em; }
.prose table { width: 100%; border-collapse: collapse; margin: 1em 0; font-size: .9375rem; }
.prose th, .prose td { padding: .45rem .6rem; border-bottom: 1px solid var(--rule); text-align: left; }
.prose th { font-weight: 600; background: var(--paper-2); }
.prose strong { font-weight: 600; }
.center { text-align: center; }

/* 舊版招牌：兩邊金線夾住嘅細字標題 */
.ornament {
  display: inline-flex; align-items: center; gap: 12px;
  color: var(--gold-500); font-size: 10px; letter-spacing: .3em;
  text-transform: uppercase; font-weight: 500; line-height: 1.6;
}
.ornament::before, .ornament::after {
  content: ""; width: 24px; height: 1px; background: currentColor; opacity: .5;
}
.kicker {
  font-size: .6875rem; letter-spacing: .15em; text-transform: uppercase;
  color: var(--gold-600); font-weight: 500;
}

/* --------------------------------------------------------------- shell */
.shell { max-width: var(--shell); margin-inline: auto; padding-inline: var(--gut); }
.shell--mid { max-width: 56rem; }
.shell--narrow { max-width: 44rem; }
@media (min-width: 40rem) { :root { --gut: 2rem; } }

.parchment {
  background:
    radial-gradient(at 30% 0%, rgba(31, 75, 120, .04) 0%, transparent 50%),
    radial-gradient(at 90% 100%, rgba(196, 163, 90, .06) 0%, transparent 40%),
    var(--paper);
}
.band { border-bottom: 1px solid var(--rule); }
.band--tint { background: var(--paper-2); border-top: 1px solid var(--rule); }

/* --------------------------------------------------------------- crest */
.crest { width: var(--sz, 36px); height: var(--sz, 36px); flex: none; object-fit: contain; }
.crest--disc {
  background: var(--cream-50); border-radius: 50%;
  padding: calc(var(--sz, 48px) * .08);
}

/* --------------------------------------------------------------- masthead */
.masthead {
  position: sticky; top: 0; z-index: 40;
  border-bottom: 1px solid var(--rule);
  background: color-mix(in srgb, var(--paper) 95%, transparent);
  backdrop-filter: blur(8px);
}
.masthead__in { display: flex; align-items: center; gap: 1rem; min-height: 3.75rem; padding-block: .5rem; }
.brand { display: flex; align-items: center; gap: .75rem; text-decoration: none; color: var(--ink); }
.brand__name {
  font-family: var(--display); font-style: italic; font-weight: 500;
  font-size: 1.0625rem; line-height: 1.15; margin: 0; color: var(--ink);
}
.brand__tag { font-size: .625rem; letter-spacing: .18em; color: var(--gold-600); margin: 0; line-height: 1.4; }
.nav { flex: 1; display: flex; justify-content: center; align-items: center; gap: .15rem; flex-wrap: wrap; }
.nav a, .navlink {
  padding: .35rem .75rem; border-radius: 3px; text-decoration: none;
  color: color-mix(in srgb, var(--ink) 80%, transparent);
  font-size: .875rem; font-weight: 500;
}
.nav a:hover, .navlink:hover { color: var(--ink); background: var(--jade-soft); }
.nav a[aria-current="page"] { color: var(--ink); background: var(--jade-soft); }
.acct { display: flex; align-items: center; gap: .5rem; }
.acct__who { text-align: right; line-height: 1.25; }
.acct__name { font-size: .875rem; font-weight: 500; margin: 0; }
.acct__role { font-size: .625rem; letter-spacing: .1em; text-transform: uppercase; color: var(--gold-600); margin: 0; }
@media (max-width: 40rem) {
  .brand__text { display: none; }
  .acct__who { display: none; }
  .masthead__in { flex-wrap: wrap; }
  .nav { order: 3; flex-basis: 100%; justify-content: flex-start; margin-left: -.5rem; }
}

/* --------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: .625rem 1.25rem; border-radius: 4px; cursor: pointer;
  font-size: .875rem; font-weight: 500; text-decoration: none; line-height: 1.4;
  border: 1px solid var(--brand-700); background: var(--brand-700); color: var(--cream-50);
  transition: background .15s, color .15s, border-color .15s;
}
.btn:hover { background: var(--brand-800); border-color: var(--brand-800); color: var(--cream-50); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn--ghost { background: transparent; color: var(--brand-700); }
.btn--ghost:hover { background: var(--brand-700); color: var(--cream-50); }
.btn--quiet { background: transparent; color: var(--muted); border-color: var(--rule-firm); }
.btn--quiet:hover { background: var(--paper-2); color: var(--ink); border-color: var(--rule-firm); }
.btn--seal, .btn--gold { background: var(--gold-500); border-color: var(--gold-500); color: #fff; }
.btn--seal:hover, .btn--gold:hover { background: var(--gold-600); border-color: var(--gold-600); color: #fff; }
.btn--sm { padding: .35rem .8rem; font-size: .8125rem; }
.btn--wide { width: 100%; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .btn { background: var(--gold-400); border-color: var(--gold-400); color: #0a1322; }
  :root:not([data-theme="light"]) .btn:hover { background: #d4b36a; border-color: #d4b36a; color: #0a1322; }
  :root:not([data-theme="light"]) .btn--ghost { background: transparent; color: var(--cream-100); border-color: var(--cream-100); }
  :root:not([data-theme="light"]) .btn--ghost:hover { background: var(--cream-100); color: #0a1322; }
  :root:not([data-theme="light"]) .btn--quiet { background: transparent; color: var(--muted); border-color: var(--rule-firm); }
}
:root[data-theme="dark"] .btn { background: var(--gold-400); border-color: var(--gold-400); color: #0a1322; }
:root[data-theme="dark"] .btn--ghost { background: transparent; color: var(--cream-100); border-color: var(--cream-100); }
:root[data-theme="dark"] .btn--quiet { background: transparent; color: var(--muted); border-color: var(--rule-firm); }

/* --------------------------------------------------------------- hero (首頁) */
.hero { padding: 4.5rem 0 3.5rem; }
@media (min-width: 40rem) { .hero { padding: 6.5rem 0 4rem; } }
.hero__grid { display: grid; gap: 3rem; align-items: center; }
@media (min-width: 64rem) { .hero__grid { grid-template-columns: 1.4fr 1fr; } }
.hero__title {
  font-size: clamp(2.25rem, 5vw, 3.75rem); line-height: 1.12; letter-spacing: -.02em;
  margin: 1.25rem 0 0; font-weight: 500;
}
.hero__title em { font-style: normal; color: var(--gold-600); }
.hero__sub { margin-top: 1.5rem; max-width: 36rem; font-size: 1rem; line-height: 1.75; color: color-mix(in srgb, var(--ink) 75%, transparent); }
.hero__cta { margin-top: 2rem; display: flex; flex-wrap: wrap; gap: .75rem; }
.hero__crest { display: none; justify-content: center; }
@media (min-width: 64rem) { .hero__crest { display: flex; } }
.rings { position: relative; width: 18rem; height: 18rem; display: grid; place-items: center; }
.rings::before, .rings::after {
  content: ""; position: absolute; border-radius: 50%;
  border: 1px solid color-mix(in srgb, var(--gold-400) 30%, transparent);
}
.rings::before { inset: 0; }
.rings::after  { inset: 2rem; border-color: color-mix(in srgb, var(--gold-400) 20%, transparent); }
.rings img { width: 220px; height: auto; position: relative; }

.stats {
  margin-top: 4rem; padding-top: 2.5rem; border-top: 1px solid var(--rule);
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 2rem;
}
.stat__n {
  font-family: var(--display); font-weight: 500; line-height: 1;
  font-size: clamp(1.9rem, 5vw, 3rem); font-variant-numeric: tabular-nums lining-nums; margin: 0;
}
.stat__l { margin: .6rem 0 0; font-size: .75rem; letter-spacing: .15em; color: var(--gold-600); }

/* --------------------------------------------------------------- 一試三證 */
.section { padding: 3rem 0; }
.section--lg { padding: 5rem 0; }
.section--tight { padding: 1.75rem 0; }
.section-head { max-width: 42rem; margin: 0 auto; text-align: center; }
.section-head h2 { margin: 1rem 0 0; }
.section-head p { margin-top: .9rem; color: var(--muted); }

.tiers { margin-top: 3.5rem; display: grid; gap: 1.5rem; }
@media (min-width: 64rem) { .tiers { grid-template-columns: repeat(3, 1fr); align-items: start; } }
.tier {
  position: relative; background: var(--card);
  border: 1px solid var(--rule); border-radius: 8px; padding: 2rem;
}
.tier--featured { border-color: var(--gold-400); box-shadow: 0 0 0 4px rgba(196, 163, 90, .1); }
.tier__badge {
  position: absolute; top: -.75rem; left: 50%; transform: translateX(-50%);
  background: var(--gold-500); color: #fff; border-radius: 2px;
  padding: .25rem .75rem; font-size: .625rem; letter-spacing: .15em; font-weight: 500; white-space: nowrap;
}
.seal-char {
  width: 3.5rem; height: 3.5rem; margin: 0 auto; border-radius: 50%;
  border: 1px solid var(--gold-400); display: grid; place-items: center;
  font-family: var(--display); font-size: 1.25rem; font-weight: 500; color: var(--ink);
}
.seal-char--sm { width: 3rem; height: 3rem; font-size: 1.125rem; }
.tier__img {
  display: block; margin: 1rem auto 0; height: 11rem; width: auto; max-width: 100%;
  object-fit: contain; cursor: zoom-in;
}
.tier__code { margin: 1rem 0 0; text-align: center; font-size: .625rem; letter-spacing: .2em; color: var(--gold-600); }
.tier__name { margin: .25rem 0 0; text-align: center; font-size: 1.25rem; }
.tier__price {
  margin: 1rem 0 0; text-align: center; font-family: var(--display); font-weight: 500;
  font-size: 1.875rem; letter-spacing: -.01em; font-variant-numeric: lining-nums;
}
.tier__list { list-style: none; margin: 1.5rem 0 0; padding: 1.5rem 0 0; border-top: 1px solid var(--rule); display: grid; gap: .6rem; }
.tier__list li { display: flex; gap: .6rem; align-items: flex-start; font-size: .875rem; color: color-mix(in srgb, var(--ink) 80%, transparent); }
.tier__list li::before { content: "✦"; color: var(--gold-500); line-height: 1.5; }
.plaque { margin-top: 1.5rem; padding-top: 1.5rem; border-top: 1px solid var(--rule); text-align: center; }
.plaque img { display: block; margin: 0 auto; height: 10rem; width: auto; max-width: 100%; object-fit: contain; cursor: zoom-in; }
.plaque p { margin: .75rem 0 0; font-size: .8125rem; color: color-mix(in srgb, var(--ink) 80%, transparent); }

/* 圖片放大檢視 */
.lightbox {
  position: fixed; inset: 0; z-index: 95; display: grid; place-items: center;
  background: rgba(6, 26, 51, .82); padding: 1.5rem; cursor: zoom-out;
}
.lightbox img { max-width: min(64rem, 100%); max-height: 86vh; width: auto; height: auto; border-radius: 4px; box-shadow: 0 12px 48px rgba(0,0,0,.4); background: #fff; }
.lightbox p { color: var(--cream-100); text-align: center; margin: .75rem 0 0; font-size: .875rem; }

/* --------------------------------------------------------------- 課程目錄卡 */
.cards { display: grid; gap: 1.5rem; }
@media (min-width: 40rem) { .cards { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 64rem) { .cards { grid-template-columns: repeat(3, 1fr); } }
.ccard {
  display: flex; flex-direction: column; overflow: hidden; text-decoration: none; color: inherit;
  background: var(--card); border: 1px solid var(--rule); border-radius: 8px;
  transition: border-color .15s, box-shadow .15s;
}
.ccard:hover { border-color: var(--brand-500); box-shadow: 0 4px 14px rgba(12, 40, 73, .08); color: inherit; }
.ccard__cover {
  position: relative; height: 8rem; overflow: hidden;
  background: linear-gradient(135deg, var(--brand-700), var(--brand-900));
  display: grid; place-items: center;
}
.ccard__cover svg { width: 80px; height: 80px; opacity: .2; }
.ccard__cat {
  position: absolute; left: 1rem; top: 1rem; border-radius: 2px;
  background: rgba(253, 251, 246, .95); color: var(--brand-800);
  padding: .2rem .6rem; font-size: .625rem; letter-spacing: .15em; font-weight: 500;
}
.ccard__lvl {
  position: absolute; right: 1rem; top: 1rem; border-radius: 2px;
  border: 1px solid rgba(196, 163, 90, .6); color: var(--gold-400);
  padding: .15rem .55rem; font-size: .6875rem; letter-spacing: .1em;
}
.ccard__body { flex: 1; display: flex; flex-direction: column; padding: 1.25rem; }
.ccard__title { font-size: 1.125rem; line-height: 1.4; margin: 0; }
.ccard__desc {
  margin: .5rem 0 0; font-size: .875rem; color: var(--muted);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.ccard__foot { margin-top: auto; padding-top: 1.25rem; }
.ccard__meta { display: flex; flex-wrap: wrap; gap: .3rem .75rem; font-size: .75rem; color: var(--gold-600); }
.ccard__state { margin-top: .6rem; }

/* --------------------------------------------------------------- 卡片 / 面板 */
.panel, .card { border: 1px solid var(--rule); border-radius: 8px; padding: 1.5rem; background: var(--card); }
@media (min-width: 40rem) { .panel, .card { padding: 2rem; } }
.card--soft { border-radius: 16px; }
.panel--tint { background: var(--paper-2); }
.grid3 { display: grid; gap: 1rem; }
@media (min-width: 40rem) { .grid3 { grid-template-columns: repeat(3, 1fr); } }
.grid2 { display: grid; gap: 1.25rem; }
@media (min-width: 48rem) { .grid2 { grid-template-columns: repeat(2, 1fr); } }

.authority { display: block; text-decoration: none; color: inherit; transition: border-color .15s, box-shadow .15s; }
.authority:hover { border-color: var(--brand-500); box-shadow: 0 4px 14px rgba(12, 40, 73, .08); color: inherit; }
.authority__head { display: flex; align-items: center; gap: .75rem; }
.authority__mark {
  width: 3rem; height: 3rem; border-radius: 2px; display: grid; place-items: center; flex: none;
  font-family: var(--display); font-size: 1.25rem; color: var(--cream-50);
}
.authority__cta { margin: 1rem 0 0; font-size: .8125rem; color: var(--jade); }
.authority:hover .authority__cta { text-decoration: underline; text-underline-offset: 3px; }

.note {
  border-left: 2px solid var(--gold-500); background: var(--paper-2);
  padding: .8rem 1rem; border-radius: 0 6px 6px 0; font-size: .9375rem;
}
.note--seal { border-left-color: var(--seal); background: var(--seal-soft); }
.note--ok { border-left-color: var(--ok); background: var(--ok-soft); }

.empty { padding: 3rem 1rem; text-align: center; color: var(--muted); border: 1px dashed var(--rule-firm); border-radius: 8px; }

/* --------------------------------------------------------------- 驗證結果 */
.vbadge { display: inline-block; border-radius: 2px; padding: .35rem .9rem; font-size: .875rem; font-weight: 500; }
.vbadge--ok { background: var(--ok-soft); color: var(--ok); }
.vbadge--bad { background: var(--seal-soft); color: var(--seal); }
.dl { display: grid; grid-template-columns: 1fr; gap: 1.1rem 1.5rem; margin: 1.5rem 0 0; }
@media (min-width: 34rem) { .dl { grid-template-columns: 1fr 1fr; } }
.dl dt { font-size: .6875rem; letter-spacing: .12em; color: var(--gold-600); margin: 0; }
.dl dd { margin: .2rem 0 0; font-size: .9375rem; }
.serialform { display: flex; gap: .5rem; }
.serialform .input { font-family: var(--code); letter-spacing: .03em; }
.frame { width: 100%; height: 72vh; min-height: 32rem; border: 1px solid var(--rule); border-radius: 8px; background: #fff; }

/* --------------------------------------------------------------- ledger (帳戶頁、課程詳情) */
.ledger { border-top: 1px solid var(--rule-firm); margin: 0 0 2.5rem; }
.ledger__row {
  display: grid; grid-template-columns: minmax(7rem, 14rem) 1fr; gap: 1rem;
  align-items: baseline; padding: .85rem 0; border-bottom: 1px solid var(--rule);
}
.ledger__key { color: var(--muted); font-size: .9375rem; }
.ledger__val { font-variant-numeric: tabular-nums lining-nums; }
.ledger__val--fig {
  font-family: var(--display); font-weight: 500; text-align: right;
  font-size: clamp(2rem, 7vw, 3rem); line-height: 1.05; letter-spacing: -.01em;
}
.ledger--record { max-width: 42rem; }
.reading { max-width: 46rem; }
.reading .block, .reading .sheet { max-width: 100%; }

/* --------------------------------------------------------------- 課堂列表 */
.track { border-top: 1px solid var(--rule-firm); }
.course {
  display: grid; grid-template-columns: 4.5rem 1fr auto; gap: 1.25rem; align-items: start;
  padding: 1.25rem .5rem; border-bottom: 1px solid var(--rule);
  text-decoration: none; color: inherit;
}
a.course:hover { background: var(--paper-2); color: inherit; }
.course__level {
  font-family: var(--display); font-size: 1rem; font-weight: 500; color: var(--gold-600);
  line-height: 1.5; border-right: 1px solid var(--rule); padding-right: 1rem; min-height: 2.5rem;
}
.course__title { font-family: var(--display); font-size: 1.1875rem; font-weight: 500; margin: 0 0 .2rem; }
.course__meta { font-size: .875rem; color: var(--muted); }
.course__meta b { font-weight: 500; color: var(--ink); font-variant-numeric: tabular-nums; }
.course__right { text-align: right; font-size: .875rem; white-space: nowrap; }
@media (max-width: 36rem) {
  .course { grid-template-columns: 3.5rem 1fr; }
  .course__right { grid-column: 2; text-align: left; }
}

/* --------------------------------------------------------------- status tags */
.tag {
  display: inline-block; padding: .1rem .55rem; border-radius: 2px;
  font-size: .75rem; line-height: 1.6; white-space: nowrap;
  border: 1px solid var(--rule-firm); color: var(--muted); background: transparent;
}
.tag--jade { border-color: var(--brand-500); color: var(--brand-700); background: var(--brand-50); }
.tag--seal { border-color: var(--gold-500); color: #fff; background: var(--gold-500); font-weight: 500; }
.tag--ok { border-color: var(--ok); color: var(--ok); background: var(--ok-soft); }
.tag--plain { border-style: dashed; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .tag--jade { border-color: var(--gold-400); color: var(--gold-400); background: transparent; }
}

/* --------------------------------------------------------------- forms */
.field { margin: 0 0 1.1rem; }
.field > label { display: block; font-size: .8125rem; margin-bottom: .35rem; color: var(--muted); font-weight: 500; }
.input, .select, .textarea {
  width: 100%; padding: .6rem .75rem;
  background: var(--card); color: var(--ink);
  border: 1px solid var(--rule-firm); border-radius: 4px;
}
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--brand-500); outline: none;
  box-shadow: 0 0 0 3px rgba(44, 102, 149, .15);
}
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 34rem) { .row2 { grid-template-columns: 1fr; } }
.authcard { max-width: 28rem; margin: 0 auto; }
.authcard h1 { text-align: center; font-size: 2rem; margin: .75rem 0 1.5rem; }

/* --------------------------------------------------------------- lesson */
.lesson__bar {
  display: flex; align-items: center; gap: 1rem; padding: .75rem 0;
  border-bottom: 1px solid var(--rule); font-size: .875rem; color: var(--muted); flex-wrap: wrap;
}
.pager { display: flex; gap: 3px; flex: 1; min-width: 8rem; }
.pager__seg { flex: 1; height: 4px; background: var(--rule); border: 0; padding: 0; cursor: pointer; border-radius: 1px; }
.pager__seg[data-state="seen"] { background: var(--rule-firm); }
.pager__seg[data-state="here"] { background: var(--gold-500); }
.page { padding: 2rem 0 1rem; }
.page__kind { font-size: .6875rem; letter-spacing: .15em; color: var(--gold-600); margin: 0 0 .35rem; font-weight: 500; }
.block {
  border-left: 2px solid var(--brand-500); background: var(--card);
  border-top: 1px solid var(--rule); border-right: 1px solid var(--rule); border-bottom: 1px solid var(--rule);
  padding: 1.1rem 1.25rem; border-radius: 0 8px 8px 0; margin: 1.25rem 0;
}
.block--quiz { border-left-color: var(--gold-500); }
.choices { list-style: none; margin: .8rem 0 0; padding: 0; display: grid; gap: .45rem; }
.choice {
  display: flex; gap: .6rem; align-items: flex-start;
  padding: .6rem .8rem; border: 1px solid var(--rule-firm);
  border-radius: 4px; background: var(--card); cursor: pointer; text-align: left;
  width: 100%; line-height: 1.5;
}
.choice:hover { border-color: var(--brand-500); }
.choice[aria-pressed="true"] { border-color: var(--brand-700); background: var(--brand-50); }
.choice[data-verdict="right"] { border-color: var(--ok); background: var(--ok-soft); }
.choice[data-verdict="wrong"] { border-color: var(--seal); background: var(--seal-soft); }
.choice__k { font-family: var(--code); font-weight: 600; color: var(--muted); flex: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .choice[aria-pressed="true"] { background: var(--jade-soft); border-color: var(--gold-400); }
}
.gradefill {
  display: inline-block; width: 7rem; padding: .25rem .45rem;
  border: 0; border-bottom: 1.5px solid var(--rule-firm); background: transparent;
  text-align: right; font-variant-numeric: tabular-nums;
}
.gradefill[data-verdict="right"] { border-bottom-color: var(--ok); color: var(--ok); }
.gradefill[data-verdict="wrong"] { border-bottom-color: var(--seal); color: var(--seal); }

/* --------------------------------------------------------------- exam */
.examhead {
  display: flex; align-items: baseline; gap: 1rem; flex-wrap: wrap;
  padding: .8rem 0; border-bottom: 1px solid var(--rule-firm);
  position: sticky; top: 3.75rem; background: var(--paper); z-index: 30;
}
.clock { margin-left: auto; font-family: var(--code); font-size: 1.25rem; font-variant-numeric: tabular-nums; }
.clock[data-warn="true"] { color: var(--seal); }
.q { padding: 1.4rem 0; border-bottom: 1px solid var(--rule); display: grid; grid-template-columns: 2.5rem 1fr; gap: 1rem; }
.q__n { font-family: var(--display); font-size: 1.0625rem; color: var(--gold-600); font-variant-numeric: tabular-nums; }
.q__prompt { margin: 0 0 .25rem; line-height: 1.7; }

/* --------------------------------------------------------------- result */
.verdict { border-top: 1px solid var(--rule-firm); border-bottom: 1px solid var(--rule-firm); padding: 2rem 0; margin: 0 0 2rem; }
.verdict__grid { display: grid; grid-template-columns: 1fr auto; gap: 1.5rem; align-items: center; }
.verdict__score {
  font-family: var(--display); font-weight: 500; line-height: .9;
  font-size: clamp(3.5rem, 16vw, 6rem); font-variant-numeric: lining-nums;
}
.stamp {
  border: 2px solid var(--gold-500); color: var(--gold-600);
  font-family: var(--display); font-weight: 600; font-size: 1.5rem;
  padding: .5rem 1.1rem; border-radius: 4px; letter-spacing: .12em;
  transform: rotate(-6deg); white-space: nowrap;
}
.stamp--fail { border-color: var(--rule-firm); color: var(--muted); transform: none; letter-spacing: .06em; }
@media (max-width: 34rem) { .verdict__grid { grid-template-columns: 1fr; } }

/* --------------------------------------------------------------- tables */
.sheet { width: 100%; border-collapse: collapse; font-size: .9375rem; background: var(--card); }
.sheet th, .sheet td { padding: .65rem .75rem; border-bottom: 1px solid var(--rule); text-align: left; vertical-align: top; }
.sheet thead th { border-bottom: 1px solid var(--rule-firm); font-weight: 500; font-size: .75rem; letter-spacing: .08em; color: var(--gold-600); background: var(--paper-2); }
.sheet td.n, .sheet th.n { text-align: right; font-variant-numeric: tabular-nums; }
.sheet tbody tr:hover { background: var(--paper-2); }
.scroll-x { overflow-x: auto; border: 1px solid var(--rule); border-radius: 8px; }
.scroll-x .sheet tr:last-child td { border-bottom: 0; }

/* --------------------------------------------------------------- misc */
.stack > * + * { margin-top: var(--s, 1rem); }
.cluster { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.between { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; flex-wrap: wrap; }
.pagehead { padding: 3.5rem 0 3rem; }
@media (min-width: 40rem) { .pagehead { padding: 4.5rem 0 4rem; } }
.pagehead h1 { margin: 1rem 0 0; font-size: clamp(2.25rem, 4.5vw, 3rem); }
.pagehead p { margin-top: .75rem; max-width: 42rem; color: var(--muted); }

.toast {
  position: fixed; left: 50%; bottom: 1.5rem; transform: translateX(-50%);
  background: var(--brand-800); color: var(--cream-50); padding: .65rem 1.1rem;
  border-radius: 4px; font-size: .9375rem; z-index: 90; max-width: calc(100vw - 2rem);
  box-shadow: 0 6px 24px rgba(0,0,0,.18);
}
.toast[data-kind="error"] { background: var(--seal); color: #fff; }

/* --------------------------------------------------------------- footer（深藍） */
.footer {
  margin-top: 6rem; background: var(--brand-900); color: var(--cream-100);
  padding: 3.5rem 0 2rem; border-top: 1px solid var(--rule);
}
.footer a { color: color-mix(in srgb, var(--cream-100) 80%, transparent); text-decoration: none; }
.footer a:hover { color: var(--cream-50); text-decoration: underline; text-underline-offset: 4px; }
.footer__grid { display: grid; gap: 2.5rem; }
@media (min-width: 48rem) { .footer__grid { grid-template-columns: 1.3fr 1fr 1fr; } }
.footer__brand { display: flex; align-items: center; gap: .75rem; }
.footer__name { font-family: var(--display); font-style: italic; font-weight: 500; font-size: 1.125rem; color: var(--cream-50); margin: 0; line-height: 1.2; }
.footer__tag { font-size: .625rem; letter-spacing: .18em; color: var(--gold-400); margin: 0; }
.footer__about { margin: 1.25rem 0 0; max-width: 24rem; font-size: .875rem; color: color-mix(in srgb, var(--cream-100) 70%, transparent); }
.footer__regions { margin: .5rem 0 0; font-size: .75rem; letter-spacing: .15em; color: color-mix(in srgb, var(--gold-400) 80%, transparent); }
.footer__addr { margin: 1rem 0 0; font-size: .75rem; color: color-mix(in srgb, var(--cream-100) 60%, transparent); }
.footer__col h2 { font-family: var(--sans); font-size: .75rem; font-weight: 500; letter-spacing: .18em; color: var(--gold-400); margin: 0; }
.footer__col ul { list-style: none; margin: 1rem 0 0; padding: 0; display: grid; gap: .6rem; font-size: .875rem; }
.footer__base {
  margin-top: 3rem; padding-top: 1.5rem; border-top: 1px solid rgba(20, 52, 97, .4);
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem; font-size: .75rem;
  color: color-mix(in srgb, var(--cream-100) 60%, transparent);
}
.footer__base a { color: inherit; }
.footer__base a:hover { color: var(--gold-400); }

.spinner { display: inline-block; width: 1em; height: 1em; border: 2px solid var(--rule-firm); border-top-color: var(--gold-500); border-radius: 50%; animation: spin .7s linear infinite; vertical-align: -.15em; }
@keyframes spin { to { transform: rotate(360deg); } }

.hide { display: none !important; }
.sr {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* 程式切頁時 focus 去 #view（俾讀屏器），但唔需要畫外框 */
#view:focus, #view:focus-visible { outline: none; }

/* 會徽 JPEG 係白底：淺色模式用 multiply 融入米白底色，唔再見到白色方格 */
.rings img, .brand .crest, .authcard .crest { mix-blend-mode: multiply; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .rings img,
  :root:not([data-theme="light"]) .brand .crest,
  :root:not([data-theme="light"]) .authcard .crest {
    mix-blend-mode: normal; background: var(--cream-50); border-radius: 50%; padding: 6%;
  }
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .rings img { border-radius: 12px; padding: 14px 18px; }
}
