:root {
  --rose: #c8566b;
  --rose-dark: #a63d52;
  --rose-light: #fbe9ec;
  --gold: #b88a3e;
  --cream: #fffaf5;
  --ink: #3a2f2f;
  --muted: #7a6b6b;
  --line: #ecdcd8;
  --ok: #2f8f5b;
  --ok-bg: #e5f6ec;
  --bad: #c0392b;
  --bad-bg: #fdebe8;
  --radius: 16px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
body {
  margin: 0;
  font-family: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", system-ui, sans-serif;
  color: var(--ink);
  background: var(--cream);
  line-height: 1.7;
}
[hidden] { display: none !important; }
body:not(.is-host) .host-only { display: none !important; }
body.is-host .player-only { display: none !important; }

.mock-banner { background: #fff3cd; color: #6b5200; font-size: 14px; padding: 8px 16px; text-align: center; }

.site-header {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 20px; background: rgba(255, 250, 245, .95);
  backdrop-filter: blur(6px); border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; color: var(--rose-dark); text-decoration: none; font-size: 18px; }
.main-nav { display: flex; gap: 6px; }
.main-nav a { color: var(--ink); text-decoration: none; padding: 6px 12px; border-radius: 999px; font-size: 15px; }
.main-nav a:hover, .main-nav a:focus-visible { background: var(--rose-light); color: var(--rose-dark); }
.nav-toggle {
  display: none; font-size: 22px; background: none; border: 1px solid var(--line);
  border-radius: 8px; padding: 2px 10px; cursor: pointer; color: var(--ink);
}

.hero { text-align: center; padding: 64px 20px 80px; background: linear-gradient(180deg, var(--rose-light), var(--cream)); }
.hero-photo { margin: 0 auto 24px; width: min(260px, 70vw); }
.hero-photo img { display: block; width: 100%; height: auto; border-radius: 50%; box-shadow: 0 10px 30px rgba(166, 61, 82, .25); }
.hero-photo figcaption { margin-top: 8px; font-size: 12px; color: var(--muted); }
.eyebrow { letter-spacing: .3em; color: var(--gold); font-size: 13px; margin: 0 0 8px; }
.hero h1 { font-size: clamp(36px, 8vw, 64px); margin: 0 0 8px; color: var(--rose-dark); }
.amp { color: var(--gold); font-style: italic; }
.hero-date { font-size: 18px; margin: 0 0 12px; }
.hero-lead { max-width: 520px; margin: 0 auto 28px; color: var(--muted); }

.section { padding: 56px 20px; max-width: 980px; margin: 0 auto; }
.section-alt { max-width: none; background: #fff; }
.section-alt > * { max-width: 940px; margin-left: auto; margin-right: auto; }
.section h2 { margin: 0 0 4px; font-size: 28px; color: var(--rose-dark); }
.section-sub { color: var(--muted); margin: 0 0 24px; }
.tag { font-size: 12px; font-weight: 500; vertical-align: middle; background: #fff3cd; color: #6b5200; padding: 2px 8px; border-radius: 999px; }

.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; box-shadow: 0 6px 20px rgba(120, 60, 60, .06); }

.btn {
  display: inline-block; border: 0; cursor: pointer; text-decoration: none;
  font: inherit; font-weight: 600; padding: 10px 22px; border-radius: 999px;
  transition: transform .1s, background .2s;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--rose); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--rose-dark); }
.btn-ghost { background: transparent; color: var(--rose-dark); border: 1px solid var(--rose); }
.btn-ghost:hover { background: var(--rose-light); }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

label { display: block; font-weight: 600; margin: 0 0 6px; }
input { width: 100%; font: inherit; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); }
input.invalid { border-color: var(--bad); background: var(--bad-bg); }
.error { color: var(--bad); font-size: 14px; min-height: 22px; margin: 4px 0 8px; }
.note { color: var(--muted); font-size: 14px; min-height: 22px; margin: 10px 0 0; }
.empty { text-align: center; color: var(--muted); padding: 24px 12px; border: 2px dashed var(--line); border-radius: 12px; }
.net-banner { background: var(--bad-bg); color: var(--bad); border: 1px solid var(--bad); border-radius: 12px; padding: 10px 14px; margin-bottom: 16px; font-size: 14px; }

/* 時間軸 */
.timeline { list-style: none; margin: 0; padding: 0 0 0 22px; border-left: 3px solid var(--rose-light); }
.timeline li { position: relative; margin-bottom: 22px; padding-left: 16px; }
.timeline li::before { content: ""; position: absolute; left: -31px; top: 8px; width: 14px; height: 14px; border-radius: 50%; background: var(--rose); border: 3px solid var(--cream); }
.timeline strong { color: var(--gold); display: block; }

/* 遊戲 */
.game { max-width: 720px; margin: 0 auto; }
.panel.center { text-align: center; }
.panel h3 { margin: 0 0 8px; }
.panel h4 { margin: 20px 0 6px; color: var(--rose-dark); }
.welcome { font-weight: 600; color: var(--ok); margin: 0 0 12px; }
.chips { list-style: none; margin: 0 0 14px; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.chips li { background: var(--rose-light); color: var(--rose-dark); border-radius: 999px; padding: 4px 14px; font-size: 15px; word-break: break-all; }
.chips li.me { background: var(--rose); color: #fff; }
.qr-box { text-align: center; margin-bottom: 18px; }
#qrcode { display: inline-block; padding: 10px; background: #fff; border: 1px solid var(--line); border-radius: 12px; min-width: 60px; }
#qrcode img { display: block; }
.qr-tip { margin: 8px 0 0; font-weight: 600; }
.url { margin: 2px 0 0; color: var(--muted); font-size: 13px; word-break: break-all; }

.play-top { display: flex; justify-content: space-between; font-weight: 600; margin-bottom: 8px; }
.bar { height: 8px; background: var(--rose-light); border-radius: 99px; overflow: hidden; }
.bar-fill { height: 100%; width: 100%; background: var(--rose); transition: width .25s linear, background .3s; }
.bar-fill.low { background: var(--bad); }
.timer { text-align: right; font-size: 14px; color: var(--muted); margin: 4px 0 0; }
#questionText, #rQuestion { font-size: 21px; margin: 12px 0 16px; }
.options { display: grid; gap: 10px; }
.option {
  display: flex; align-items: center; gap: 12px; text-align: left; font: inherit; padding: 12px 16px;
  border-radius: 12px; cursor: pointer; border: 2px solid var(--line); background: #fff; color: var(--ink);
}
.opt-label { flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--rose-light); color: var(--rose-dark); font-weight: 700; display: grid; place-items: center; }
.option:hover:not(:disabled) { border-color: var(--rose); background: var(--rose-light); }
.option:disabled { cursor: default; color: var(--ink); }
.option.picked { border-color: var(--rose); background: var(--rose-light); }
.option.correct { border-color: var(--ok); background: var(--ok-bg); }
.option.wrong { border-color: var(--bad); background: var(--bad-bg); }
.feedback { min-height: 28px; font-weight: 600; margin: 14px 0 8px; }
.feedback.ok { color: var(--ok); }
.feedback.bad { color: var(--bad); }

/* 前 5 名 */
.board { list-style: none; margin: 0; padding: 0; }
.board li { display: flex; align-items: center; gap: 12px; padding: 8px; border-bottom: 1px solid var(--line); }
.board li:last-child { border-bottom: 0; }
.board .rank { width: 36px; text-align: center; font-weight: 700; color: var(--gold); }
.board .name { flex: 1; word-break: break-all; }
.board .pts { font-weight: 700; color: var(--rose-dark); font-variant-numeric: tabular-nums; }
.board li.me { background: var(--rose-light); border-radius: 10px; }

/* 頒獎台 */
.podium { display: flex; align-items: flex-end; justify-content: center; gap: 10px; margin: 20px 0 8px; }
.pod { flex: 1; max-width: 170px; border-radius: 14px 14px 0 0; padding: 12px 6px; background: var(--rose-light); }
.pod-1 { min-height: 210px; background: #fff0b8; }
.pod-2 { min-height: 170px; background: #e9edf2; }
.pod-3 { min-height: 140px; background: #f6dcc6; }
.pod .medal { font-size: 44px; line-height: 1.2; }
.pod .title { font-weight: 700; color: var(--rose-dark); }
.pod .who { font-size: 18px; font-weight: 700; word-break: break-all; margin-top: 4px; }
.pod .pts { color: var(--muted); font-variant-numeric: tabular-nums; }

.host-tools { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 20px; padding-top: 14px; border-top: 1px dashed var(--line); color: var(--muted); font-size: 14px; }

.site-footer { text-align: center; padding: 32px 20px; color: var(--muted); font-size: 14px; }
.site-footer p { margin: 2px 0; }
.site-footer a { color: var(--muted); }

/* 主持人大螢幕 */
body.is-host .game { max-width: 960px; }
body.is-host #questionText, body.is-host #rQuestion { font-size: 30px; }
body.is-host .option { font-size: 20px; }
@media (min-width: 720px) { body.is-host .options { grid-template-columns: 1fr 1fr; } }

@media (max-width: 720px) {
  .nav-toggle { display: block; }
  .main-nav { display: none; position: absolute; top: 100%; left: 0; right: 0; flex-direction: column; background: var(--cream); padding: 8px 16px 14px; border-bottom: 1px solid var(--line); }
  .main-nav.open { display: flex; }
  .hero { padding: 48px 16px 56px; }
  .card { padding: 18px; }
  .section { padding: 40px 16px; }
  .pod .medal { font-size: 36px; }
  .pod .who { font-size: 15px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .bar-fill { transition: none; }
}
