/* TaipeiPoll 設計系統「白＋香檳金」
   淺色：暖白底、白卡片、香檳金細線與重點色；深色模式：純黑底＋香檳金。
   不使用任何政黨代表色。字體：Manrope（數字、英文）＋ 思源黑體／蘋方（中文）。 */

:root {
  --bg: #f7f5f0;
  --card: #ffffff;
  --soft: #faf8f3;
  --ink: #191713;
  --ink-2: #5f5a51;
  --ink-3: #736d63;
  --line: rgba(160, 135, 90, .22);
  --line-2: rgba(160, 135, 90, .34);
  --gold: #c9ad78;
  --gold-ink: #191713;
  --num: #a8864f;
  --on-ink: #ffffff;
  --danger: #b3261e;
  --r-card: 20px;
  --r-item: 14px;
  --r-btn: 12px;
  --shadow: 0 1px 2px rgba(25, 23, 19, .03), 0 10px 26px -18px rgba(25, 23, 19, .2);
  --font: "Manrope", "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", system-ui, sans-serif;
  --ease: cubic-bezier(.16, 1, .3, 1);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0b0a;
    --card: #141413;
    --soft: #1a1917;
    --ink: #f4efe4;
    --ink-2: #b3ac9e;
    --ink-3: #a39d90;
    --line: #2a2823;
    --line-2: #3a362e;
    --gold: #d9c49b;
    --gold-ink: #0b0b0a;
    --num: #d9c49b;
    --on-ink: #0b0b0a;
    --danger: #f2877d;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--font); font-size: 15px; line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration-color: var(--gold); text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
::selection { background: var(--gold); color: var(--gold-ink); }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; border-radius: 6px; }
[tabindex="-1"]:focus { outline: none; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.wrap { max-width: 640px; margin: 0 auto; padding: 0 16px; }
.wrap.wide { max-width: 760px; }

/* ── 頁首：置中報頭 ───────────────────────── */
.site-header { max-width: 640px; margin: 0 auto; padding: 22px 16px 0; text-align: center; }
.site-header.wide { max-width: 760px; }
.masthead-top { margin: 0; font-size: .7rem; letter-spacing: .3em; color: var(--ink-3); }
.brand { display: inline-flex; align-items: baseline; margin: 2px 0 12px; text-decoration: none; font-size: 1.85rem; letter-spacing: -.03em; line-height: 1.2; }
.brand span { font-weight: 800; }
.brand strong { font-weight: 800; color: var(--num); }
.site-header nav { display: flex; justify-content: center; gap: 28px; padding: 10px 0; border-top: 1px solid var(--line-2); border-bottom: 1px solid var(--line-2); }
.site-header nav a { position: relative; text-decoration: none; color: var(--ink-2); font-size: .88rem; white-space: nowrap; }
.site-header nav a:hover { color: var(--ink); }
.site-header nav a[aria-current="page"] { color: var(--ink); font-weight: 700; }
.site-header nav a[aria-current="page"]::after { content: ""; position: absolute; left: 50%; bottom: -11px; width: 18px; height: 2px; margin-left: -9px; border-radius: 2px; background: var(--gold); }
@media (max-width: 400px) { .masthead-top { letter-spacing: .18em; } .site-header nav { gap: 20px; } }

.site-footer { margin-top: 48px; padding: 22px 16px 48px; border-top: 1px solid var(--line); font-size: .76rem; color: var(--ink-3); line-height: 1.8; }
.site-footer p { margin: 0 0 8px; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.site-footer nav a { color: var(--ink-2); }

/* ── 卡片與文字 ───────────────────────────── */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-card); box-shadow: var(--shadow); padding: 28px 24px; margin: 12px 0; }
@media (max-width: 480px) { .card { padding: 24px 18px; } }
.stack { padding-top: 12px; animation: rise .45s var(--ease) both; }
@keyframes rise { from { opacity: .001; transform: translateY(8px); } }
@media (prefers-reduced-motion: reduce) { .stack { animation: none; } }

h1, h2, h3 { margin: 0; font-weight: 800; letter-spacing: -.02em; text-wrap: balance; }
h1 { font-size: clamp(1.95rem, 7.5vw, 2.5rem); line-height: 1.16; letter-spacing: -.025em; }
h2 { font-size: 1.2rem; line-height: 1.4; }
p { margin: 0 0 12px; }
.lead { font-size: 1rem; color: var(--ink-2); margin: 12px 0 0; }
.muted { color: var(--ink-2); font-size: .92rem; }
.small { font-size: .8rem; color: var(--ink-3); }

/* 小標：字距拉開的小字，前面一條香檳金短線 */
.tag {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: .76rem; font-weight: 700; letter-spacing: .14em; color: var(--ink-2);
  margin-bottom: 14px;
}
.tag::before { content: ""; width: 16px; height: 2px; border-radius: 2px; background: var(--gold); }

/* ── 首頁 ─────────────────────────────────── */
.hero { padding-top: 30px; padding-bottom: 28px; }
.countdown { display: flex; align-items: center; gap: 14px; margin-top: 22px; }
.countdown .days { font-size: clamp(3.4rem, 15vw, 4.4rem); font-weight: 800; line-height: 1; letter-spacing: -.05em; color: var(--num); font-variant-numeric: tabular-nums; }
.countdown .unit { font-size: .86rem; color: var(--ink-2); line-height: 1.5; padding-left: 14px; border-left: 1px solid var(--line-2); }
.countdown .unit b { display: block; color: var(--ink); font-size: 1rem; }
@media (max-width: 520px) { .countdown.clock { flex-direction: column; align-items: flex-start; gap: 10px; } .countdown.clock .unit { padding-left: 0; border-left: 0; } }

.tiles { display: grid; grid-template-columns: repeat(3, 1fr); margin: 0; border: 1px solid var(--line); border-radius: var(--r-item); overflow: hidden; }
.tiles div { padding: 14px 16px 12px; background: var(--soft); }
.tiles div + div { border-left: 1px solid var(--line); }
.tiles dt { font-size: .74rem; color: var(--ink-3); }
.tiles dd { margin: 2px 0 0; font-weight: 700; font-size: .98rem; line-height: 1.4; }
@media (max-width: 480px) {
  .tiles { grid-template-columns: 1fr; }
  .tiles div { display: flex; justify-content: space-between; align-items: baseline; padding: 12px 16px; }
  .tiles div + div { border-left: 0; border-top: 1px solid var(--line); }
}

.points { list-style: none; margin: 18px 0 0; padding: 0; }
.points li { display: flex; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); color: var(--ink-2); font-size: .92rem; }
.points li:first-child { border-top: 0; padding-top: 2px; }
.points li::before { content: ""; flex: none; width: 6px; height: 6px; margin-top: .7em; border-radius: 50%; background: var(--gold); }

.check { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; font-size: .92rem; line-height: 1.75; }
.check input { appearance: none; flex: none; width: 22px; height: 22px; margin: 2px 0 0; border: 1.5px solid var(--line-2); border-radius: 6px; background: var(--card); display: grid; place-content: center; cursor: pointer; transition: background .15s, border-color .15s; }
.check input::after { content: ""; width: 10px; height: 6px; border: 2px solid var(--gold-ink); border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px, -1px); opacity: 0; }
.check input:checked { background: var(--gold); border-color: var(--gold); }
.check input:checked::after { opacity: 1; }

details.disclose { margin-top: 16px; border: 1px solid var(--line); background: var(--soft); border-radius: var(--r-item); padding: 0 16px; }
details.disclose summary { cursor: pointer; list-style: none; display: flex; justify-content: space-between; align-items: center; height: 46px; font-size: .86rem; color: var(--ink-2); }
details.disclose summary::-webkit-details-marker { display: none; }
details.disclose summary::after { content: ""; width: 7px; height: 7px; border-right: 1.5px solid var(--num); border-bottom: 1.5px solid var(--num); transform: rotate(45deg) translateY(-2px); transition: transform .2s var(--ease); }
details.disclose[open] summary::after { transform: rotate(-135deg) translateY(-2px); }
details.disclose dl { padding-bottom: 8px; }

/* ── 表格式列表 ───────────────────────────── */
dl.rows { display: grid; grid-template-columns: 7.5em 1fr; margin: 0; }
dl.rows dt, dl.rows dd { padding: 12px 0; margin: 0; border-top: 1px solid var(--line); }
dl.rows dt { color: var(--ink-3); font-size: .85rem; padding-right: 16px; }
dl.rows dd { font-size: .92rem; }
dl.rows > dt:first-of-type, dl.rows > dt:first-of-type + dd { border-top: 0; }
dl.rows.compact dt, dl.rows.compact dd { padding: 9px 0; font-size: .8rem; }
@media (max-width: 480px) {
  dl.rows { grid-template-columns: 1fr; }
  dl.rows dd { border-top: 0; padding-top: 0; }
  dl.rows dt { padding-bottom: 2px; }
}

/* ── 按鈕 ─────────────────────────────────── */
.btn {
  font: inherit; font-weight: 800; font-size: .95rem;
  height: 52px; padding: 0 24px; border-radius: var(--r-btn); cursor: pointer;
  border: 1px solid var(--gold); background: var(--gold); color: var(--gold-ink);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: transform .15s var(--ease), opacity .15s, filter .15s;
}
.btn:hover { filter: brightness(1.04); }
.btn:active { transform: scale(.985); }
.btn[disabled] { opacity: .35; cursor: not-allowed; transform: none; filter: none; }
.btn.block { width: 100%; }
.btn.light { background: var(--card); color: var(--ink); border-color: var(--line-2); }
.btn.light:hover { border-color: var(--gold); filter: none; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); padding: 0 12px; font-weight: 600; }
.btn.ghost:hover { color: var(--ink); background: var(--soft); filter: none; }
.btn.small { height: 34px; padding: 0 12px; font-size: .8rem; white-space: nowrap; border-radius: 10px; }

/* ── 作答畫面 ─────────────────────────────── */
.q-top { display: flex; justify-content: space-between; align-items: center; margin: 2px 2px 10px; font-size: .8rem; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.q-top b { color: var(--ink); }
.progress { height: 4px; border-radius: 999px; background: var(--line); overflow: hidden; margin: 0 2px; }
.progress span { display: block; width: 100%; height: 100%; border-radius: 999px; background: var(--ink); transform-origin: left; transition: transform .5s var(--ease); }

.q-card { padding-top: 26px; }
.q-text { font-size: 1.26rem; font-weight: 800; line-height: 1.5; letter-spacing: -.01em; margin: 0; text-wrap: pretty; }
.q-help { font-size: .85rem; color: var(--ink-3); margin: 8px 0 0; }

.options { display: grid; gap: 8px; margin-top: 22px; }
.options.grid { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 420px) { .options.grid { grid-template-columns: repeat(2, 1fr); } }
.opt-sep { height: 1px; background: var(--line); margin: 6px 2px; }
.options.grid .opt-sep { grid-column: 1 / -1; }

.opt {
  display: flex; align-items: center; gap: 14px; width: 100%;
  min-height: 56px; padding: 12px 16px;
  text-align: left; font: inherit; font-size: .96rem; line-height: 1.45; color: var(--ink);
  background: var(--card); border: 1px solid var(--line-2); border-radius: var(--r-item);
  cursor: pointer; transition: background .15s, border-color .15s, color .15s, transform .12s var(--ease);
}
.opt:hover { border-color: var(--gold); }
.opt:active { transform: scale(.99); }
.opt[aria-checked="true"] { background: var(--gold); border-color: var(--gold); color: var(--gold-ink); }
.opt .num {
  flex: none; width: 38px; height: 38px; border-radius: 50%;
  display: grid; place-content: center;
  border: 1px solid var(--line-2);
  font-weight: 800; font-size: 1.05rem; font-variant-numeric: tabular-nums;
}
.opt[aria-checked="true"] .num { border-color: currentColor; }
.opt .body { display: flex; flex-direction: column; min-width: 0; }
.opt .name { font-weight: 700; }
.opt .sub { font-size: .78rem; color: var(--ink-3); }
.opt[aria-checked="true"] .sub { color: inherit; opacity: .75; }
.opt.fixed { min-height: 48px; background: transparent; border-color: var(--line); color: var(--ink-2); font-size: .9rem; }
.opt.fixed[aria-checked="true"] { background: var(--gold); border-color: var(--gold); color: var(--gold-ink); }
.options.grid .opt { justify-content: center; text-align: center; padding: 12px 8px; }

select {
  font: inherit; font-size: 1rem; color: var(--ink);
  width: 100%; height: 56px; padding: 0 44px 0 16px;
  background: var(--card); border: 1px solid var(--line-2); border-radius: var(--r-item);
  appearance: none; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--num) 50%), linear-gradient(135deg, var(--num) 50%, transparent 50%);
  background-position: calc(100% - 22px) 50%, calc(100% - 16px) 50%;
  background-size: 6px 6px; background-repeat: no-repeat;
}
select:hover { border-color: var(--gold); }

.matrix-row { padding: 18px 0; border-top: 1px solid var(--line); }
.matrix-row:first-child { border-top: 0; padding-top: 4px; }
.matrix-row .label { font-weight: 700; margin-bottom: 10px; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.matrix-row .label .sub { font-weight: 400; font-size: .78rem; color: var(--ink-3); }
.matrix-row .options { grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: 6px; margin-top: 0; }
.matrix-row .opt { min-height: 44px; padding: 8px 6px; justify-content: center; text-align: center; font-size: .84rem; border-radius: 10px; }
.rows-wrap { margin-top: 18px; }

.actions {
  position: sticky; bottom: 0; z-index: 10;
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  margin: 12px -16px 0; padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.2) blur(12px); -webkit-backdrop-filter: saturate(1.2) blur(12px);
  border-top: 1px solid var(--line);
}
.actions .right { display: flex; gap: 4px; align-items: center; }
.actions .btn { height: 48px; }
.error { color: var(--danger); font-size: .86rem; margin: 12px 0 0; }
.error:empty { display: none; }

/* ── 提示與答卷代碼 ───────────────────────── */
.notice { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-item); padding: 12px 16px; font-size: .86rem; color: var(--ink-2); margin: 12px 0; }
.test-bar { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: .76rem; color: var(--ink-3); padding: 10px 2px 0; }

.receipt { border: 1px dashed var(--gold); background: var(--soft); border-radius: var(--r-item); padding: 16px 18px; margin: 20px 0 0; }
.receipt .label { font-size: .74rem; color: var(--ink-3); margin: 0; letter-spacing: .1em; }
.receipt .code { font-size: 1.8rem; font-weight: 800; letter-spacing: .1em; margin: 2px 0 6px; color: var(--num); font-variant-numeric: tabular-nums; }
.receipt p:last-child { font-size: .8rem; color: var(--ink-2); margin: 0; }
.row-actions { display: flex; gap: 8px; margin-top: 22px; }
.row-actions .btn { flex: 1; }

/* ── 文件頁 ───────────────────────────────── */
.doc-head { padding: 32px 24px; }
.doc-head .updated { margin-top: 14px; font-size: .8rem; color: var(--ink-3); }
.toc { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 22px; }
.toc a { text-decoration: none; font-size: .82rem; color: var(--ink-2); border: 1px solid var(--line-2); padding: 5px 12px; border-radius: 10px; }
.toc a:hover { border-color: var(--gold); color: var(--ink); }
.doc section { scroll-margin-top: 76px; }
.doc section h2 { padding-bottom: 14px; margin-bottom: 4px; border-bottom: 1px solid var(--line-2); position: relative; }
.doc section h2::after { content: ""; position: absolute; left: 0; bottom: -1px; width: 36px; height: 2px; background: var(--gold); }
.doc section p, .doc section li { color: var(--ink-2); font-size: .93rem; }
.doc section h2 + p, .doc section h2 + ol, .doc section h2 + ul { margin-top: 14px; }
.doc section strong { color: var(--ink); }
.doc ol, .doc ul { padding-left: 1.2em; margin: 12px 0; }
.doc li { padding: 5px 0; }
.doc li + li { border-top: 1px solid var(--line); }
.doc li::marker { color: var(--num); font-weight: 700; }
.doc section > :last-child { margin-bottom: 0; }

/* 結果長條 */
.bar-row { display: grid; grid-template-columns: 7em 1fr 3.4em; gap: 12px; align-items: center; padding: 10px 0; font-size: .9rem; border-top: 1px solid var(--line); }
.bar { height: 10px; background: var(--soft); border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--gold); border-radius: 999px; }
.bar-row .pct { text-align: right; font-weight: 800; font-variant-numeric: tabular-nums; }

.turnstile-slot { position: fixed; bottom: 88px; left: 50%; transform: translateX(-50%); z-index: 30; }

/* 矩陣題：程度選項排一列，「不知道／不了解」獨立成下方整條 */
.matrix-row .options { grid-template-columns: repeat(4, 1fr); }
.matrix-row .options > .opt:nth-child(5):last-child { grid-column: 1 / -1; min-height: 38px; color: var(--ink-2); }
.matrix-row .options > .opt:nth-child(5):last-child[aria-checked="true"] { color: var(--gold-ink); }
