/* 政見盲測｜受試者端樣式
   視覺：米白紙張底、粗黑標題、撕紙拼貼肖像、斜貼黑底標籤、白卡片與鮭魚色代號方塊。
   手機優先；所有顏色集中在 :root。 */

@font-face {
  font-family: "BT Display";
  src: url("fonts/noto-sans-tc-bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light;
  --paper: #f6f3ef;
  --paper-hi: #fbf9f6;
  --ink: #1b1b1b;
  --ink-2: #3a3836;
  --muted: #706a64;
  --line: #e2dcd4;
  --card: #ffffff;
  --coral: #e5483f;
  --coral-dark: #c8362e;
  --salmon: #f0857f;
  --pink: #f5b7b4;
  --pink-soft: #fdeceb;
  --gray-badge: #b9b2aa;
  --note: #fff8e6;
  --note-line: #ecd9a6;
  --shadow-card: 0 1px 0 rgba(60, 40, 20, .05), 0 8px 18px -4px rgba(60, 40, 20, .22);
  --shadow-lift: 0 2px 0 rgba(60, 40, 20, .05), 0 14px 26px -6px rgba(60, 40, 20, .3);
  --font-display: "BT Display", "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", "Heiti TC", sans-serif;
  --font-body: -apple-system, BlinkMacSystemFont, "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-latin: "Arial Black", "Helvetica Neue", "BT Display", Arial, sans-serif;
  --wrap: 760px;
  --gutter: 16px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper) url("img/paper.png") repeat;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.7;
  overflow-x: hidden;
}
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
p { margin: 0 0 12px; }
[hidden] { display: none !important; }
.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}
:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }

/* ---------- 頁首 ---------- */
.masthead {
  position: relative;
  z-index: 5;
  background: var(--paper-hi);
  box-shadow: 0 2px 10px rgba(60, 40, 20, .16);
}
.masthead-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 12px var(--gutter);
  display: flex;
  align-items: center;
}
.brand { display: inline-flex; align-items: center; gap: 12px; }
.brand-tag {
  display: inline-block;
  background: var(--ink);
  color: #fff;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 19px;
  letter-spacing: .12em;
  line-height: 1;
  padding: 8px 12px 8px 14px;
  transform: rotate(-3deg);
  clip-path: polygon(0 6%, 97% 0, 100% 88%, 3% 100%);
}
.brand-sub { font-size: 13px; color: var(--muted); letter-spacing: .08em; white-space: nowrap; }
.brand-tag { white-space: nowrap; }

/* 英文版：中文排版用的寬字距在英文會太鬆 */
:lang(en) .brand-tag { letter-spacing: .03em; font-size: 17px; }
:lang(en) h1, :lang(en) h2, :lang(en) h3, :lang(en) .title-tag, :lang(en) .name-tag, :lang(en) .btn,
:lang(en) .hero-kicker, :lang(en) .opt-text, :lang(en) .q-text, :lang(en) .source-tag,
:lang(en) .result-sentence, :lang(en) .bubble .who { letter-spacing: .01em; }
:lang(en) .hero-kicker { letter-spacing: .08em; }

/* ---------- 進度（紙飛機） ---------- */
.progress { background: transparent; }
.progress-inner { max-width: var(--wrap); margin: 0 auto; padding: 18px var(--gutter) 0; }
.progress-label {
  margin: 0 0 2px 4px;
  color: var(--salmon);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 17px;
  letter-spacing: .04em;
}
.progress-track {
  position: relative;
  height: 12px;
  margin: 18px 6px 22px 34px;
  background: var(--pink);
  opacity: .95;
}
.progress-fill {
  position: absolute; inset: 0 auto 0 0;
  width: 0;
  background: var(--coral);
  transition: width .5s ease;
}
.progress-plane {
  position: absolute;
  top: 50%;
  left: 0;
  width: 78px;
  height: auto;
  transform: translate(-50%, -58%) rotate(-8deg);
  transition: left .5s ease;
  filter: drop-shadow(0 4px 4px rgba(60, 40, 20, .25));
}

/* ---------- 版面 ---------- */
.app { max-width: var(--wrap); margin: 0 auto; padding: 24px var(--gutter) 120px; }
.app.wide { max-width: 1080px; }
.loading { color: var(--muted); text-align: center; padding: 80px 0; }
.page-enter { animation: enter .35s ease both; }
@keyframes enter { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

h1, h2, h3 { font-family: var(--font-display); font-weight: 700; color: var(--ink); }
.page-title { font-size: 28px; line-height: 1.35; margin: 4px 0 18px; letter-spacing: .04em; }
.section-title { font-size: 22px; line-height: 1.4; margin: 36px 0 14px; letter-spacing: .04em; }
.lead { color: var(--ink-2); }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.prewrap { white-space: pre-wrap; }

/* 斜貼黑底標籤（沿用參考設計的人名標籤） */
.title-tag, .name-tag {
  display: inline-block;
  background: var(--ink);
  color: #fff;
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: .14em;
  line-height: 1.15;
  transform: rotate(-2.5deg);
  clip-path: polygon(0 8%, 98% 0, 100% 90%, 2% 100%);
}
.title-tag { font-size: 15px; padding: 6px 12px 6px 14px; margin: 0 10px 10px 0; vertical-align: middle; }
.page-title .title-tag { font-size: 16px; position: relative; top: -3px; }

/* ---------- 按鈕 ---------- */
.actions { margin: 28px 0 8px; display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }
.btn {
  appearance: none;
  border: 0;
  background: var(--ink);
  color: #fff;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 19px;
  letter-spacing: .14em;
  min-width: 220px;
  min-height: 58px;
  padding: 12px 36px;
  cursor: pointer;
  box-shadow: 0 6px 0 -1px rgba(0, 0, 0, .12), 0 10px 18px -6px rgba(0, 0, 0, .45);
  transition: transform .12s ease, box-shadow .12s ease, background .2s;
}
.btn:hover:not(:disabled) { transform: translateY(-2px); }
.btn:active:not(:disabled) { transform: translateY(1px); box-shadow: 0 2px 6px -2px rgba(0, 0, 0, .45); }
.btn:disabled { background: #b7b0a9; cursor: not-allowed; box-shadow: none; }
.btn.secondary { background: var(--card); color: var(--ink); box-shadow: inset 0 0 0 2px var(--ink); }
.btn.block { width: 100%; }
.link-btn {
  appearance: none; background: none; border: 0; padding: 4px 2px;
  color: var(--muted); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; font-size: 15px;
}
.link-btn:hover { color: var(--ink); }

/* ---------- 首頁＋同意書 ---------- */
.hero { position: relative; text-align: center; padding: 8px 0 12px; overflow-x: clip; }
.hero::before, .hero::after {           /* 零星的淡紅墨點（不重複拼貼；留在 hero 範圍內，避免手機出現橫向捲動） */
  content: ""; position: absolute; z-index: -1; pointer-events: none;
  width: 170px; height: 150px;
  background:
    radial-gradient(circle at 18% 22%, rgba(229, 72, 63, .22) 0 5px, transparent 6px),
    radial-gradient(circle at 34% 30%, rgba(229, 72, 63, .14) 0 2px, transparent 3px),
    radial-gradient(circle at 62% 58%, rgba(229, 72, 63, .18) 0 8px, transparent 9px),
    radial-gradient(circle at 70% 49%, rgba(229, 72, 63, .12) 0 3px, transparent 4px),
    radial-gradient(circle at 44% 78%, rgba(229, 72, 63, .10) 0 4px, transparent 5px),
    radial-gradient(ellipse 16px 5px at 80% 70%, rgba(229, 72, 63, .12) 0 60%, transparent 70%);
  background-repeat: no-repeat;
}
.hero::before { top: 130px; left: 0; transform: rotate(18deg); }
.hero::after { top: 20px; right: 0; transform: rotate(-30deg) scaleX(-1); }
.hero-kicker {
  margin: 8px 0 10px;
  color: var(--coral);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: .2em;
}
.hero-title {
  font-size: clamp(27px, 6.6vw, 46px);
  line-height: 1.3;
  letter-spacing: .06em;
  margin: 0 auto 8px;
  max-width: 18em;
}
.hero-portraits {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(10px, 5vw, 64px);
  max-width: 760px;
  margin: 18px auto 0;
  padding: 0 4px;
}
.cutout { position: relative; margin: 0; }
.cutout img { width: 100%; height: auto; }
.cutout-1 { transform: rotate(-3deg); }
.cutout-2 { transform: rotate(2.5deg) translateY(clamp(12px, 4vw, 36px)); }
.cutout .name-tag {
  position: absolute;
  left: -2%;
  bottom: 9%;
  font-size: clamp(20px, 5.4vw, 40px);
  padding: .16em .42em .2em .5em;
  letter-spacing: .3em;
  box-shadow: 0 6px 12px rgba(0, 0, 0, .25);
}
.cutout-2 .name-tag { transform: rotate(3deg); left: auto; right: -2%; }
.tag-en {
  position: absolute;
  bottom: 1%;
  left: 40%;
  font-family: var(--font-latin);
  font-weight: 900;
  font-size: clamp(11px, 2.6vw, 20px);
  letter-spacing: .06em;
  color: var(--ink-2);
  transform: rotate(-3deg);
  white-space: nowrap;
}
.cutout-2 .tag-en { left: auto; right: 44%; transform: rotate(2deg); }
/* 首頁主視覺：副標題下方的拼貼插畫 */
.hero-art { margin: 20px auto 0; max-width: 420px; padding: 0 4px; }
.hero-art img {
  display: block; width: 100%; height: auto;
  box-shadow: var(--shadow-lift);
  transform: rotate(-1deg);
}
.hero-art + .hero-chips { margin-top: 28px; }
.hero-chips {
  list-style: none;
  display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 10px;
  padding: 0; margin: clamp(40px, 9vw, 64px) 0 6px;
}
.hero-chips li {
  background: var(--card);
  box-shadow: var(--shadow-card);
  padding: 6px 14px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: .04em;
}
.scroll-hint {
  display: inline-flex; flex-direction: column; align-items: center; gap: 2px;
  margin-top: 18px; color: var(--muted); font-size: 14px; text-decoration: none; letter-spacing: .08em;
}
.scroll-hint::after { content: "↓"; font-size: 20px; animation: bob 1.6s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(4px); } }

.consent { max-width: var(--wrap); margin: 0 auto; scroll-margin-top: 16px; }
.doc {
  background: var(--card);
  box-shadow: var(--shadow-card);
  padding: 26px 22px 24px;
  font-size: 16px;
  line-height: 1.85;
  color: var(--ink-2);
}
.doc h2 { font-size: 22px; margin: 0 0 16px; letter-spacing: .06em; color: var(--ink); }
.doc h3 {
  font-size: 17px; margin: 26px 0 8px; color: var(--ink); letter-spacing: .04em;
  display: flex; align-items: center; gap: 10px;
}
.doc h3::before { content: ""; width: 14px; height: 4px; background: var(--coral); flex: none; }
.doc p { margin: 0 0 10px; }
.doc .doc-li { padding-left: 1.6em; text-indent: -1.6em; }
.doc-meta {
  background: var(--paper);
  border-left: 4px solid var(--ink);
  padding: 12px 14px;
  margin: 0 0 18px;
  font-size: 14.5px;
  line-height: 1.75;
}
.doc-meta p { margin: 0 0 4px; }
.doc-meta b { color: var(--ink); }

.agree {
  display: flex; gap: 14px; align-items: flex-start;
  margin: 22px 0 0;
  padding: 18px 18px;
  background: var(--card);
  box-shadow: var(--shadow-card);
  cursor: pointer;
  font-weight: 600;
  line-height: 1.6;
  border: 3px solid transparent;
  transition: border-color .15s;
}
.agree.checked { border-color: var(--coral); }
.agree input {
  appearance: none; flex: none;
  width: 28px; height: 28px; margin: 0;
  border: 2.5px solid var(--ink); background: #fff;
  display: grid; place-content: center; cursor: pointer;
}
.agree input::before {
  content: ""; width: 14px; height: 8px; margin-top: -4px;
  border: solid #fff; border-width: 0 0 3.5px 3.5px; transform: rotate(-45deg) scale(0);
  transition: transform .12s ease;
}
.agree input:checked { background: var(--coral); border-color: var(--coral); }
.agree input:checked::before { transform: rotate(-45deg) scale(1); }
.consent-links { display: flex; justify-content: center; gap: 18px; margin-top: 6px; }
.need-check { text-align: center; color: var(--coral-dark); font-weight: 600; margin: 10px 0 0; }

/* ---------- 政見盲測 ---------- */
.tip {
  position: relative;
  background: var(--note);
  border: 1px solid var(--note-line);
  padding: 22px 18px 14px;
  margin: 10px 0 30px;
  font-size: 15.5px;
  color: var(--ink-2);
  transform: rotate(-.4deg);
}
.tip .title-tag { position: absolute; top: -14px; left: 14px; margin: 0; font-size: 14px; }
.quiz-topic {
  margin: 0 0 10px 76px;
  color: var(--muted);
  font-size: 14px;
  letter-spacing: .1em;
}
.quiz-head { display: grid; grid-template-columns: 64px 1fr; gap: 12px; align-items: start; margin-bottom: 34px; }
.qnum {
  font-family: var(--font-latin);
  font-weight: 900;
  font-size: 36px;
  line-height: 1.05;
  letter-spacing: -.01em;
  padding-bottom: 10px;
  position: relative;
  justify-self: start;
  margin-top: 2px;
}
.qnum::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 6px; background: var(--coral); }
.quiz-stem {
  font-size: clamp(22px, 5.4vw, 30px);
  line-height: 1.5;
  letter-spacing: .06em;
  margin: 0;
}
.options { display: grid; gap: 22px; }
.opt {
  position: relative;
  display: block;
  background: var(--card);
  box-shadow: var(--shadow-card);
  padding: 22px 22px 26px;
  cursor: pointer;
  outline: 3px solid transparent;
  outline-offset: -3px;
  transition: transform .14s ease, box-shadow .14s ease, outline-color .14s;
  -webkit-tap-highlight-color: transparent;
}
.opt:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); }
.opt:has(input:focus-visible) { outline-color: var(--ink); }
.opt.selected { outline-color: var(--coral); box-shadow: var(--shadow-lift); }
.opt-badge {
  display: inline-grid; place-content: center;
  width: 56px; height: 56px;
  background: var(--salmon);
  color: #fff;
  font-family: var(--font-latin);
  font-weight: 900;
  font-size: 32px;
  line-height: 1;
  transition: background .14s;
}
.opt.selected .opt-badge { background: var(--coral); }
.opt-text {
  display: block;
  margin-top: 22px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18.5px;
  line-height: 1.65;
  letter-spacing: .06em;
  color: var(--ink);
}
.opt-check {
  position: absolute; top: 18px; right: 18px;
  width: 30px; height: 30px; border-radius: 50%;
  border: 2.5px solid var(--line);
  display: grid; place-content: center;
  transition: all .14s;
}
.opt.selected .opt-check { background: var(--coral); border-color: var(--coral); }
.opt.selected .opt-check::before {
  content: ""; width: 12px; height: 7px; margin-top: -3px;
  border: solid #fff; border-width: 0 0 3px 3px; transform: rotate(-45deg);
}
.opt-none { padding: 16px 22px; display: flex; align-items: center; gap: 16px; background: rgba(255, 255, 255, .7); }
.opt-none .opt-badge { width: 44px; height: 44px; font-size: 22px; background: var(--gray-badge); }
.opt-none .opt-text { margin: 0; color: var(--ink-2); }
.opt-none .opt-check { top: 50%; transform: translateY(-50%); }
.opt-none.selected .opt-badge { background: var(--ink-2); }

/* ---------- 問卷 ---------- */
.form-page { counter-reset: q; }
.q {
  background: var(--card);
  box-shadow: var(--shadow-card);
  padding: 20px 18px 18px;
  margin: 0 0 18px;
  border-left: 5px solid transparent;
  transition: border-color .15s;
  counter-increment: q;
}
.q.invalid { border-left-color: var(--coral); }
.q-head { display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: baseline; margin-bottom: 14px; }
.q-head::before {
  content: counter(q, decimal-leading-zero);
  font-family: var(--font-latin);
  font-weight: 900;
  font-size: 16px;
  color: var(--coral);
  border-bottom: 3px solid var(--coral);
  line-height: 1.3;
}
.q-text { font-family: var(--font-display); font-weight: 700; font-size: 18px; line-height: 1.6; letter-spacing: .03em; }
.q-prompt, .help { font-size: 14.5px; color: var(--muted); margin: -6px 0 12px; }
.field-error { color: var(--coral-dark); font-size: 14px; font-weight: 600; margin-top: 10px; }

.choices { display: grid; gap: 10px; }
.choice {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  background: var(--paper-hi);
  border: 2px solid var(--line);
  cursor: pointer;
  font-weight: 500;
  line-height: 1.5;
  transition: border-color .12s, background .12s;
  -webkit-tap-highlight-color: transparent;
}
.choice:hover { border-color: #c9c1b8; }
.choice input {
  appearance: none; flex: none; margin: 0;
  width: 22px; height: 22px; border-radius: 50%;
  border: 2px solid #a59d94; background: #fff;
  display: grid; place-content: center;
}
.choice input::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: #fff; transform: scale(0); transition: transform .12s; }
.choice input:checked { border-color: var(--coral); background: var(--coral); }
.choice input:checked::before { transform: scale(1); }
.choice.selected { border-color: var(--coral); background: var(--pink-soft); font-weight: 600; }
/* 複選：方框＋勾 */
.choice input[type="checkbox"] { border-radius: 4px; }
.choice input[type="checkbox"]::before {
  width: 6px; height: 11px; border-radius: 0; background: none;
  border: solid #fff; border-width: 0 3px 3px 0; transform: rotate(45deg) scale(0); margin-top: -3px;
}
.choice input[type="checkbox"]:checked::before { transform: rotate(45deg) scale(1); }
.choice:has(input:focus-visible) { outline: 3px solid var(--ink); outline-offset: 2px; }
/* 橫向排列（頻率、同意度）：由左到右，圓鈕在上、文字在下 */
.choices.horizontal { grid-template-columns: repeat(var(--n, 5), minmax(0, 1fr)); gap: 6px; }
.choices.horizontal .choice {
  flex-direction: column; justify-content: flex-start; gap: 8px;
  padding: 12px 4px; text-align: center; font-size: 14.5px; line-height: 1.35;
}
.choices.horizontal .choice span { white-space: pre-line; word-break: break-all; }

.scale { display: grid; grid-template-columns: repeat(var(--n, 11), minmax(0, 1fr)); gap: 4px; }
.scale button {
  appearance: none;
  min-height: 44px;
  padding: 0;
  border: 2px solid var(--line);
  background: var(--paper-hi);
  font-family: var(--font-latin);
  font-weight: 900;
  font-size: 15px;
  cursor: pointer;
  transition: background .12s, border-color .12s, color .12s;
}
.scale button:hover { border-color: #c9c1b8; }
.scale button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.scale-labels { display: flex; justify-content: space-between; gap: 12px; font-size: 13.5px; color: var(--muted); margin-top: 6px; line-height: 1.4; }
.scale-labels span:last-child { text-align: right; }
.scale-labels.top { margin: 0 0 10px; }
.na-btn { margin-top: 6px; padding: 6px 14px; border: 2px solid var(--line); border-radius: 0; background: #fff; font: inherit; font-size: 14px; color: var(--muted); cursor: pointer; }
.na-btn[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.matrix-row { padding: 12px 0; border-top: 1px dashed var(--line); }
.matrix-row:first-of-type { border-top: 0; padding-top: 0; }
.row-label { font-weight: 600; margin-bottom: 8px; }
select, input[type="number"], input[type="text"], textarea {
  width: 100%;
  padding: 12px 14px;
  border: 2px solid var(--line);
  background: var(--paper-hi);
  border-radius: 0;
  font-size: 17px;
}
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--ink) 50%), linear-gradient(135deg, var(--ink) 50%, transparent 50%); background-position: calc(100% - 22px) 52%, calc(100% - 16px) 52%; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 44px; }
input[type="number"] { max-width: 180px; }
select:focus, input:focus, textarea:focus { border-color: var(--ink); outline: none; }
textarea { min-height: 120px; resize: vertical; line-height: 1.6; }
.info-block {
  background: var(--note);
  border: 1px solid var(--note-line);
  padding: 16px 18px;
  margin: 0 0 18px;
  font-size: 15.5px;
  color: var(--ink-2);
}
.info-block.heading { background: none; border: 0; border-left: 5px solid var(--ink); padding: 4px 0 4px 14px; font-family: var(--font-display); font-weight: 700; font-size: 18px; color: var(--ink); margin-top: 28px; }
.notice { background: var(--note); border: 1px solid var(--note-line); padding: 14px 16px; color: var(--ink-2); font-size: 15.5px; }

/* ---------- 錯誤與對話框 ---------- */
.error-banner {
  background: var(--card);
  border-left: 5px solid var(--coral);
  box-shadow: var(--shadow-card);
  padding: 14px 16px;
  margin: 0 0 18px;
  color: var(--coral-dark);
  font-weight: 600;
}
.overlay {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(27, 27, 27, .55);
  display: grid; place-items: center;
  padding: 16px;
  animation: fade .18s ease both;
}
@keyframes fade { from { opacity: 0; } }
.dialog {
  width: min(460px, 100%);
  background: var(--paper-hi);
  box-shadow: 0 24px 60px rgba(0, 0, 0, .4);
  padding: 30px 22px 20px;
  position: relative;
}
.dialog .title-tag { position: absolute; top: -16px; left: 18px; margin: 0; font-size: 16px; }
.dialog p { margin: 8px 0 0; color: var(--ink-2); }
.dialog .actions { margin-top: 22px; }
.dialog .btn { min-width: 0; flex: 1 1 160px; font-size: 17px; min-height: 50px; padding: 10px 16px; }

/* ---------- 結果頁 ---------- */
.result-hero {
  position: relative;
  background: var(--card);
  box-shadow: var(--shadow-card);
  padding: 34px 22px 22px;
  margin: 18px 0 18px;
}
.result-hero > .title-tag { position: absolute; top: -16px; left: 16px; margin: 0; font-size: 17px; }
.result-sentence {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(20px, 4.8vw, 25px);
  line-height: 1.6;
  letter-spacing: .04em;
  color: var(--ink);
  margin: 0 0 12px;
}
.result-counts { color: var(--muted); font-size: 15px; margin: 0; }
.items { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; }
.item-card { background: var(--card); box-shadow: var(--shadow-card); padding: 16px 18px 14px; }
.item-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 10px; }
.item-head .qnum { font-size: 20px; padding-bottom: 5px; margin: 0; }
.item-head .qnum::after { height: 4px; }
.item-topic { color: var(--muted); font-size: 14px; letter-spacing: .08em; }
.item-choice { display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: start; margin: 0 0 10px; font-weight: 600; line-height: 1.6; }
.item-choice .opt-badge { width: 32px; height: 32px; font-size: 18px; }
.item-choice .opt-badge.none { background: var(--gray-badge); }
.source-tag {
  display: inline-block;
  background: var(--ink); color: #fff;
  font-family: var(--font-display); font-weight: 700;
  font-size: 14px; letter-spacing: .1em;
  padding: 4px 10px 4px 12px;
  transform: rotate(-1.5deg);
  clip-path: polygon(0 8%, 98% 0, 100% 92%, 2% 100%);
}
.section-title.small { font-size: 18px; margin-top: 24px; }
/* 政見知識測驗結果 */
.quiz-score { font-family: var(--font-display); font-weight: 700; font-size: 26px; letter-spacing: .04em; margin: 0 0 14px; }
.quiz-mark { font-weight: 700; font-size: 14px; padding: 2px 10px; color: #fff; background: var(--gray-badge); flex: none; }
.quiz-mark.ok { background: var(--coral); }
.item-text { margin: 0 0 8px; line-height: 1.6; font-weight: 600; }
.quiz-ans { margin: 2px 0 0; font-size: 15px; line-height: 1.6; }
.quiz-ans.muted { color: var(--muted); }
details { margin-top: 10px; font-size: 15px; }
summary { cursor: pointer; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }
details ul { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 8px; }
details li { background: var(--paper); padding: 10px 12px; line-height: 1.6; }
details li b { font-family: var(--font-latin); margin-right: 6px; }
details li .src { display: block; font-size: 13.5px; color: var(--muted); margin-top: 2px; }

/* ---------- AI 對話 ---------- */
.disclaimer {
  display: flex; gap: 10px; align-items: flex-start;
  background: var(--note); border: 1px solid var(--note-line);
  padding: 12px 14px; font-size: 14.5px; color: var(--ink-2); margin: 0 0 20px;
}
.disclaimer::before { content: "!"; flex: none; width: 22px; height: 22px; display: grid; place-content: center; background: var(--ink); color: #fff; font-weight: 900; font-size: 14px; border-radius: 50%; margin-top: 1px; }
.chat { display: flex; flex-direction: column; gap: 16px; margin: 0 0 12px; }
.bubble {
  position: relative;
  max-width: 92%;
  padding: 22px 16px 14px;
  line-height: 1.75;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 16px;
}
.bubble .who {
  position: absolute; top: -11px; left: 12px;
  background: var(--ink); color: #fff;
  font-family: var(--font-display); font-weight: 700;
  font-size: 13px; letter-spacing: .12em;
  padding: 3px 9px; transform: rotate(-2deg);
}
.bubble.ai { align-self: flex-start; background: var(--card); box-shadow: var(--shadow-card); }
.bubble.user { align-self: flex-end; background: var(--pink-soft); border: 2px solid var(--pink); }
.bubble.user .who { left: auto; right: 12px; background: var(--coral); transform: rotate(2deg); }
.bubble.notice { align-self: stretch; max-width: none; background: var(--paper-hi); border: 2px dashed #cfc6bb; color: var(--ink-2); font-size: 15px; padding-top: 16px; }
.typing { color: var(--muted); font-size: 15px; margin: 4px 0 14px; display: flex; align-items: center; gap: 8px; }
.typing::after { content: ""; width: 26px; height: 8px; background: radial-gradient(circle, var(--muted) 0 3px, transparent 3.5px) 0 0 / 9px 8px repeat-x; animation: dots 1s steps(4) infinite; }
@keyframes dots { from { width: 0; } to { width: 36px; } }
.composer { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: end; margin-top: 8px; }
.composer textarea { min-height: 64px; }
.composer .btn { min-width: 0; min-height: 64px; padding: 10px 22px; font-size: 17px; }
.turns { font-size: 14px; color: var(--muted); margin: 8px 0 0; }
.wait { text-align: center; font-size: 14px; color: var(--muted); }

/* ---------- 結束頁 ---------- */
.end-title { font-size: clamp(28px, 7vw, 42px); text-align: center; letter-spacing: .08em; margin: 16px 0 12px; }
.end-body { text-align: center; color: var(--ink-2); max-width: 32em; margin: 0 auto 8px; }
.code-card { position: relative; background: var(--card); box-shadow: var(--shadow-card); padding: 30px 20px 22px; margin: 34px 0 10px; text-align: center; }
.code-card .title-tag { position: absolute; top: -16px; left: 50%; transform: translateX(-50%) rotate(-2.5deg); margin: 0; }
.code-box {
  display: inline-block; margin-top: 8px;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 28px; font-weight: 700; letter-spacing: .18em;
  padding: 8px 16px; border: 3px dashed var(--ink); background: var(--paper);
  user-select: all;
}
.debrief { margin-top: 30px; }
.center { text-align: center; }

/* ---------- 說明頁（v3） ---------- */
.hero-sub { color: var(--ink-2); font-size: clamp(16px, 4vw, 19px); margin: 6px auto 0; max-width: 26em; }
.hero .actions { margin-top: 22px; }

/* ---------- 聊天（v3）：輸入區固定在畫面下方 ---------- */
.chat-dock {
  position: sticky; bottom: 0; z-index: 5;
  margin: 0 calc(-1 * var(--gutter));
  padding: 10px var(--gutter) calc(10px + env(safe-area-inset-bottom));
  background: rgba(246, 243, 239, .96);
  border-top: 2px solid var(--ink);
  backdrop-filter: blur(4px);
}
.chat-dock .error-banner { margin: 0 0 8px; }
.chat-dock .composer { margin-top: 6px; }
.chat-dock textarea { min-height: 56px; max-height: 30vh; }
.chat-dock .composer .btn { min-height: 56px; }
.topic-banner {
  display: inline-block; margin: 0;
  background: var(--ink); color: #fff;
  font-family: var(--font-display); font-weight: 700; font-size: 14px; letter-spacing: .1em;
  padding: 3px 10px; transform: rotate(-1deg);
}
.chat-page .actions { margin-top: 18px; }

/* ---------- 結果頁（v3） ---------- */
.type-card { --type: var(--coral); text-align: center; padding: 40px 22px 26px; border-top: 10px solid var(--type); }
.type-name {
  font-family: var(--font-display); font-weight: 900;
  font-size: clamp(40px, 12vw, 64px); line-height: 1.15; letter-spacing: .08em;
  color: var(--type); margin: 6px 0 10px;
}
.type-tagline { font-family: var(--font-display); font-weight: 700; font-size: clamp(17px, 4.4vw, 21px); margin: 0 0 12px; }
.type-body { color: var(--ink-2); margin: 0 auto; max-width: 30em; text-align: left; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.stat { background: var(--card); box-shadow: var(--shadow-card); padding: 14px 8px 12px; text-align: center; display: grid; gap: 2px; }
.stat-v { font-family: var(--font-latin); font-weight: 900; font-size: clamp(26px, 8vw, 36px); line-height: 1.1; }
.stat-k { font-size: 13px; color: var(--muted); line-height: 1.4; }
.share { margin: 30px 0 18px; }
.share-preview {
  width: min(300px, 70vw); height: auto; margin: 0 auto;
  box-shadow: var(--shadow-lift); transform: rotate(-1.5deg);
}
.share .actions { margin-top: 22px; }

/* ---------- 寬螢幕 ---------- */
@media (min-width: 720px) {
  :root { --gutter: 24px; }
  .app { padding-top: 32px; }
  .doc { padding: 36px 40px 32px; }
  .q { padding: 24px 26px 22px; }
  .opt { padding: 26px 28px 30px; }
  .options { gap: 26px; }
  .quiz-head { grid-template-columns: 84px 1fr; gap: 18px; }
  .quiz-topic { margin-left: 102px; }
  .qnum { font-size: 44px; }
  .scale button { min-height: 48px; font-size: 16px; }
}

/* ---------- 列印（同意書副本） ---------- */
@media print {
  body { background: #fff; font-size: 12pt; }
  .masthead, .progress, .hero, .agree, .actions, .consent-links, .need-check, .scroll-hint { display: none !important; }
  .app { padding: 0; max-width: none; }
  .doc { box-shadow: none; padding: 0; }
}

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

/* Demo 控制面板 */
.demo-fab { position: fixed; right: 14px; bottom: 14px; z-index: 50; padding: 10px 16px; border: 0; background: #d6332b; color: #fff;
  font: inherit; font-weight: 900; letter-spacing: .04em; box-shadow: 0 4px 14px rgba(0,0,0,.35); cursor: pointer; }
.demo-panel { position: fixed; right: 14px; bottom: 64px; z-index: 50; width: min(380px, calc(100vw - 28px)); max-height: 70vh; overflow: auto;
  background: var(--card, #fff); border: 3px solid var(--ink); padding: 14px 16px; box-shadow: 0 8px 28px rgba(0,0,0,.35); }
.demo-panel[hidden] { display: none; }
.demo-title { margin: 0 0 8px; font-weight: 900; }
.demo-label { margin: 12px 0 6px; font-size: 13.5px; color: var(--muted); }
.demo-row { display: flex; flex-wrap: wrap; gap: 6px; }
.demo-chip { padding: 7px 12px; border: 2px solid var(--ink); background: #fff; color: var(--ink); font: inherit; font-size: 14px; cursor: pointer; }
.demo-chip[aria-pressed="true"] { background: var(--ink); color: #fff; }
.demo-foot { margin-top: 14px; }
.demo-note { margin: 10px 0 0; font-size: 12.5px; color: var(--muted); line-height: 1.5; }
@media print { .demo-fab, .demo-panel { display: none !important; } }
.test-badge { margin: 0 0 14px; padding: 6px 10px; border: 2px dashed #d6332b; color: #d6332b; background: #fff;
  font-size: 13px; font-weight: 700; line-height: 1.4; }

/* ---------- 結果頁：三個數字 ---------- */
.metrics { padding: 38px 20px 22px; }
.metric-label { font-family: var(--font-display); font-weight: 700; font-size: 17px; letter-spacing: .06em; margin: 0 0 10px; }
.metric-caption { color: var(--muted); font-size: 13.5px; line-height: 1.6; margin: 8px 0 0; }
.lean-bar { display: flex; height: 34px; overflow: hidden; background: var(--gray-badge); }
.lean-seg { flex: 0 1 0; min-width: 0; }
.lean-bar.empty { align-items: center; justify-content: center; }
.lean-empty { color: #fff; font-weight: 700; font-size: 15px; }
.lean-bar.locked { height: auto; min-height: 56px; padding: 10px 14px; background: #1b1b1b; text-align: center; }
.lean-bar.locked .lean-empty { line-height: 1.5; }
.lean-legend { display: flex; justify-content: space-between; margin-top: 8px; }
.lean-item { display: grid; font-weight: 700; }
.lean-item:last-child { text-align: right; }
.lean-pct { font-family: var(--font-latin); font-weight: 900; font-size: clamp(34px, 10vw, 46px); line-height: 1.05; }
.lean-name { font-size: 15px; }
.score-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 22px; }
.score-tile { background: var(--coral); color: #fff; padding: 14px 12px 14px; text-align: center; }
.score-pr { font-family: var(--font-latin); font-weight: 900; font-size: 22px; margin: 2px 0 0; }
.eng-stats { margin-top: 12px; }
.score-tile.dark { background: var(--ink); }
.score-tile .metric-label { margin: 0; font-size: 15px; }
.score-tile .metric-caption { color: rgba(255, 255, 255, .8); margin-top: 2px; }
.score-v { margin: 2px 0 0; font-family: var(--font-latin); font-weight: 900; line-height: 1; }
.score-v span { font-size: clamp(44px, 14vw, 64px); }
.score-v small { font-size: 16px; font-weight: 600; opacity: .8; margin-left: 2px; }
.type-card.small { margin-top: 40px; padding-top: 34px; }
.type-card.small .type-name { font-size: clamp(32px, 9vw, 44px); }
details li .src a { color: var(--ink-2); word-break: break-all; }
.demo-select { width: 100%; padding: 6px 8px; font: inherit; font-size: 14px; border: 2px solid var(--ink); background: #fff; }

.turn-counter { margin: 12px 0 0; text-align: center; font-weight: 600; color: var(--muted, #555); }
.turn-hint { margin: 8px 0 0; font-size: 0.9em; color: var(--muted, #555); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* 收不到回覆／被限速時，輸入區上方的提示（可帶「重試」按鈕）；手機寬度下按鈕換行、不撐破版面 */
.chat-dock .chat-note { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; overflow-wrap: anywhere; }
.chat-dock .chat-note span { flex: 1 1 12em; min-width: 0; }
.chat-dock .chat-note .btn { flex: 0 0 auto; min-height: 40px; padding: 6px 16px; }
