:root {
  --bg: #f6f1ea; --surface: #fffdf9; --ink: #221d26; --muted: #6b6270;
  --line: #e4dbd0; --accent: #b4475f; --accent-ink: #fff; --bar: #e9c6cf;
  --r: 14px; --gap: 16px;
  --fs-1: 13px; --fs-2: 16px; --fs-3: 20px; --fs-4: 26px; --fs-5: 34px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16141a; --surface: #201d25; --ink: #f1ecf2; --muted: #a79fae;
    --line: #34303b; --accent: #e7899e; --accent-ink: #1b1218; --bar: #5a3542;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--ink);
  font: 400 var(--fs-2)/1.65 -apple-system, "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  min-height: 100dvh; display: flex; flex-direction: column;
}
main { flex: 1; width: 100%; max-width: 520px; margin: 0 auto; padding: 24px 16px 32px; }
h1, h2, h3 { line-height: 1.3; margin: 0; text-wrap: balance; }
h1 { font-size: var(--fs-5); font-weight: 800; letter-spacing: -.01em; }
h2 { font-size: var(--fs-4); font-weight: 700; }
h3 { font-size: var(--fs-3); font-weight: 700; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: var(--fs-1); }
.stack > * + * { margin-top: var(--gap); }

.btn {
  display: flex; align-items: center; justify-content: center; width: 100%;
  min-height: 52px; padding: 0 20px; border-radius: 999px; border: 0;
  background: var(--accent); color: var(--accent-ink);
  font: 700 var(--fs-2)/1 inherit; cursor: pointer; text-decoration: none;
  transition: transform .12s ease, opacity .12s ease;
}
.btn:active { transform: scale(.98); }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn:focus-visible, .opt:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.row { display: flex; gap: 12px; }
.row > * { flex: 1; }

/* 首頁 */
.intro { min-height: 70dvh; display: flex; flex-direction: column; justify-content: center; }
.kicker { font-size: var(--fs-1); color: var(--accent); font-weight: 700; letter-spacing: .12em; }

/* 作答 */
.progress { height: 4px; background: var(--line); border-radius: 2px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--accent); transition: width .25s ease; }
.qhead { display: flex; justify-content: space-between; align-items: center; font-size: var(--fs-1); color: var(--muted); }
.back { background: none; border: 0; color: var(--muted); font: inherit; padding: 8px 0; cursor: pointer; min-height: 44px; }
.back:disabled { visibility: hidden; }
.qtext { font-size: var(--fs-4); font-weight: 700; line-height: 1.4; min-height: 4.2em; display: flex; align-items: center; }
.opts { display: grid; gap: 10px; }
.opt {
  min-height: 52px; padding: 0 18px; text-align: left; border-radius: var(--r);
  background: var(--surface); color: var(--ink); border: 1px solid var(--line);
  font: 500 var(--fs-2)/1.3 inherit; cursor: pointer;
}
.opt[aria-pressed="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }

/* 結果 */
.hero { text-align: center; padding: 8px 0 4px; }
.hero .type { font-size: 44px; font-weight: 800; color: var(--accent); line-height: 1.15; margin: 6px 0; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; }
.bars { display: grid; gap: 8px; }
.bar { display: grid; grid-template-columns: 4.5em 1fr 2.6em; align-items: center; gap: 10px; font-size: var(--fs-1); }
.bar .track { height: 10px; background: var(--line); border-radius: 5px; overflow: hidden; }
.bar .track > i { display: block; height: 100%; background: var(--bar); }
.bar.main .track > i { background: var(--accent); }
.bar b { text-align: right; font-variant-numeric: tabular-nums; }
.locked { position: relative; overflow: hidden; }
.locked .blur { filter: blur(6px); user-select: none; pointer-events: none; }
.locked .cover {
  position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: center;
  gap: 12px; padding: 20px; text-align: center;
  background: color-mix(in srgb, var(--surface) 55%, transparent);
}
.refs { font-size: var(--fs-1); color: var(--muted); padding-left: 1.2em; margin: 8px 0 0; }
.refs li + li { margin-top: 6px; }
.foot { max-width: 520px; margin: 0 auto; padding: 0 16px 28px; font-size: var(--fs-1); color: var(--muted); text-align: center; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 999px; font-size: var(--fs-1); }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
