:root {
  --brand: #14235c;
  --brand-mid: #435098;
  --brand-soft: #dfe3ff;
  --brand-wash: #f1f3ff;
  --page: #f3f5fb;
  --surface: #fff;
  --ink: #1d2749;
  --muted: #59627f;
  --line: #cbd1e5;
  --gold: #f2c94c;
  --shadow: 0 18px 46px rgba(20, 35, 92, .09);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 20px; }
body { min-width: 320px; margin: 0; background: var(--page); color: var(--ink); font-family: "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", system-ui, sans-serif; line-height: 1.7; }
a { color: inherit; }
img { display: block; max-width: 100%; }
button, input { font: inherit; }
:focus-visible { outline: 3px solid var(--brand-mid); outline-offset: 3px; }
.skip-link { position: fixed; z-index: 20; top: 10px; left: 10px; padding: 8px 14px; border-radius: 999px; background: var(--brand); color: #fff; transform: translateY(-150%); }
.skip-link:focus { transform: none; }
.hero, .tools, .layout, footer { width: min(1280px, calc(100% - 40px)); margin-inline: auto; }
.hero { margin-top: 20px; padding: 24px 32px 36px; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); box-shadow: var(--shadow); }
.brand-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding-bottom: 18px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: .9rem; font-weight: 900; }
.brand-row img, footer img { width: 170px; height: 60px; object-fit: contain; }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1fr) 240px; gap: 48px; align-items: center; padding-top: 32px; }
.hero h1 { max-width: 820px; margin: 0; color: var(--brand); font-size: clamp(2.2rem, 5vw, 4.8rem); letter-spacing: -.05em; line-height: 1.08; }
.hero h1 + p { max-width: 720px; margin: 16px 0 24px; color: var(--muted); font-size: 1.05rem; }
.eyebrow, .source-label { margin: 0 0 8px; color: var(--brand-mid); font-size: .78rem; font-weight: 900; letter-spacing: .08em; }
.hero-stat { display: grid; min-height: 220px; place-items: center; align-content: center; border-radius: 24px; background: var(--brand); color: #fff; text-align: center; }
.hero-stat strong { font-size: 4rem; line-height: 1; }
.hero-stat span { font-weight: 900; }
.hero-stat small { margin-top: 10px; color: var(--brand-soft); }
.button { display: inline-block; padding: 11px 18px; border-radius: 999px; font-weight: 900; text-decoration: none; }
.button--gold { background: linear-gradient(135deg, #f7d866, var(--gold)); color: var(--brand); box-shadow: 0 8px 22px rgba(202, 151, 13, .25); }
.tools { display: grid; grid-template-columns: auto minmax(240px, 420px) 1fr; gap: 14px; align-items: center; margin-top: 20px; padding: 16px 20px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.tools label { font-weight: 900; }
.tools input { width: 100%; padding: 10px 14px; border: 1px solid var(--line); border-radius: 12px; }
.tools p { justify-self: end; margin: 0; color: var(--muted); font-size: .85rem; }
.layout { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 24px; align-items: start; margin-top: 24px; }
aside { position: sticky; top: 20px; max-height: calc(100vh - 40px); overflow: auto; padding: 20px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.aside-title { margin: 0 0 12px; color: var(--brand); font-weight: 900; }
aside ol { display: grid; gap: 5px; margin: 0; padding: 0; list-style: none; }
aside a { display: grid; grid-template-columns: 34px 1fr; gap: 8px; padding: 8px; border-radius: 10px; color: var(--muted); font-size: .85rem; font-weight: 750; text-decoration: none; }
aside a:hover { background: var(--brand-wash); color: var(--brand); }
aside a span { color: var(--brand-mid); font-variant-numeric: tabular-nums; }
main { display: grid; gap: 24px; }
.topic { padding: clamp(22px, 4vw, 40px); border: 1px solid var(--line); border-radius: 20px; background: var(--surface); box-shadow: var(--shadow); }
.topic-header { margin-bottom: 26px; }
.topic-header h2 { margin: 0; color: var(--brand); font-size: clamp(1.55rem, 3vw, 2.45rem); line-height: 1.2; }
.topic-header h2 + p { margin: 9px 0 0; color: var(--muted); }
.teacher-source { margin-top: 24px; }
.source-table-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: 16px; }
.source-table { width: 100%; min-width: 620px; border-collapse: separate; border-spacing: 0; }
.source-table caption { padding: 12px 16px; background: var(--brand); color: #fff; font-weight: 900; text-align: left; }
.source-table th, .source-table td { padding: 14px 16px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); vertical-align: middle; text-align: left; }
.source-table tr > :last-child { border-right: 0; }
.source-table tbody tr:last-child > * { border-bottom: 0; }
.source-table thead th { background: var(--brand-mid); color: #fff; font-weight: 900; text-align: center; }
.source-table tbody th { background: var(--brand-soft); color: var(--brand); font-weight: 900; }
.source-table tbody td { background: var(--brand-wash); font-weight: 650; }
.source-table [data-needs-confirmation="true"] { outline: 3px solid #c43b4d; outline-offset: -3px; }
.source-sections { display: grid; gap: 12px; }
.source-section { display: grid; grid-template-columns: minmax(140px, .32fr) minmax(0, 1fr); overflow: hidden; border: 1px solid var(--line); border-radius: 14px; }
.source-section h3 { margin: 0; padding: 16px; background: var(--brand-soft); color: var(--brand); font-size: 1rem; }
.source-section div { padding: 12px 16px; background: var(--brand-wash); }
.source-section p { margin: 0; }
.source-section p + p { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); }
.practice-card { margin-top: 28px; padding: 24px; border-radius: 18px; background: var(--brand); color: #fff; }
.practice-card h3 { margin: 0 0 18px; font-size: 1.15rem; line-height: 1.7; }
.question-source { margin: 0 0 10px; color: var(--brand-soft); font-size: .78rem; }
.practice-options { display: grid; gap: 10px; }
.practice-option { display: grid; grid-template-columns: 34px 1fr; gap: 12px; align-items: center; width: 100%; padding: 12px 14px; border: 1px solid rgba(255,255,255,.35); border-radius: 14px; background: #26366f; color: #fff; text-align: left; cursor: pointer; }
.practice-option:hover { border-color: #fff; }
.practice-option.is-correct { background: #e2f4ea; color: #104b34; border-color: #71cda0; }
.practice-option.is-incorrect { background: #fae6e8; color: #751f2a; border-color: #e18b95; }
.option-key { display: grid; width: 32px; height: 32px; place-items: center; border: 1px solid currentColor; border-radius: 999px; font-weight: 900; }
.question-result { margin-top: 14px; font-weight: 900; }
.question-analysis { margin-top: 22px; padding-top: 18px; border-top: 1px solid rgba(255,255,255,.25); }
.analysis-item { padding: 14px 0; border-bottom: 1px solid rgba(255,255,255,.18); }
.analysis-item h4, .analysis-item p { margin: 0; }
.analysis-item p { margin-top: 4px; white-space: pre-line; }
.practice-card--fallback p { max-width: 680px; }
.no-results { padding: 30px; border-radius: 16px; background: var(--surface); text-align: center; }
footer { display: grid; grid-template-columns: .65fr 1.35fr; gap: 30px; align-items: center; margin-block: 24px; padding: 28px 32px; border-radius: 20px; background: var(--brand); color: #fff; }
footer > div p { margin: 8px 0 0; color: var(--brand-soft); font-weight: 850; }
.footer-campaign { padding: 20px 24px; border: 2px solid rgba(242,201,76,.8); border-radius: 18px; background: linear-gradient(135deg, rgba(242,201,76,.18), rgba(255,255,255,.06)); }
.footer-campaign h2 { margin: 0; font-size: clamp(1.25rem, 3vw, 2rem); }
.footer-campaign h2 a { text-decoration-color: var(--gold); text-underline-offset: 5px; }
.footer-campaign p:last-child { margin: 10px 0 0; }
.footer-campaign strong { display: inline-block; padding: 4px 10px; border-radius: 999px; background: var(--gold); color: var(--brand); }
.discount-code--pending { background: #fff; color: #982f3b; }

@media (max-width: 820px) {
  .hero, .tools, .layout, footer { width: min(100% - 24px, 1280px); }
  .hero { padding: 20px; }
  .hero-grid, .layout, footer, main { grid-template-columns: minmax(0, 1fr); }
  .hero-stat { min-height: 150px; }
  .tools { grid-template-columns: 1fr; }
  .tools p { justify-self: start; }
  aside { position: static; max-height: none; }
  .source-section { grid-template-columns: 1fr; }
}
