/* The game screen (/play): news studio × quiz show (spec 8.1). Mobile first, breakpoints 600 / 1024 / 1440 (spec 8.5).
 * Colours come from tokens.css only, so both themes work. */

body[data-page="play"] .site-foot { padding-bottom: 56px; }
.game { position: relative; min-height: 100vh; padding-bottom: calc(44px + env(safe-area-inset-bottom, 0px)); }
.game::before { content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(60% 40% at 30% -5%, var(--glow-1), transparent 70%), radial-gradient(40% 35% at 85% -10%, var(--glow-2), transparent 70%),
    repeating-linear-gradient(90deg, var(--wall) 0 120px, transparent 120px 124px); }
.game > * { position: relative; }

/* on-air strip */
.onair { border-bottom: 1px solid var(--line); }
.onair-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding-block: 8px; font-size: .85rem; color: var(--text-muted); }
.clock { font-family: var(--font-num); color: var(--text); font-variant-numeric: tabular-nums; }
.onair-prize { margin-left: auto; }
.onair-prize b { font-family: var(--font-num); color: var(--text); }

.game-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; padding-block: 12px 20px; }
.play { display: grid; gap: 14px; min-width: 0; align-content: start; }
.loading, .notice { margin: 0; padding: 16px; background: var(--bg-panel); border: 1px solid var(--line); border-radius: 10px; }

/* HUD: question number, prize, timer */
.hud { display: grid; gap: 8px; }
.qno { margin: 0; display: flex; justify-content: space-between; gap: 12px; font-size: .95rem; color: var(--text-muted); }
.qno b { color: var(--text); font-family: var(--font-num); }
.timer { display: flex; align-items: center; gap: 10px; }
.timer[hidden] { display: none; }
.timer-track { flex: 1; height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.timer-fill { display: block; height: 100%; width: 100%; background: var(--gold); transform-origin: left; transition: width 1s linear; }
.timer.low .timer-fill { background: var(--breaking); }
.timer-sec { font-family: var(--font-num); font-size: .9rem; min-width: 4.5em; text-align: right; }
.timer-sec b { font-size: 1.1rem; }

/* lifelines + walk away */
.tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.lifelines { display: flex; flex-wrap: wrap; gap: 8px; align-items: stretch; }
.ll-title { flex-basis: 100%; margin: 0; font-size: .8rem; color: var(--text-muted); letter-spacing: .04em; }
.ll { border-radius: 12px; text-align: left; }
.ll-text { display: grid; line-height: 1.3; }
.ll-text small { font-size: .75rem; color: var(--text-muted); font-weight: 400; }
.ll.is-used .ll-text small::after { content: "（已使用）"; }
.ll, .walk { font: inherit; font-size: .9rem; cursor: pointer; min-height: 44px; padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg-panel); color: var(--text); display: inline-flex; align-items: center; gap: 6px; }
.ll-icon { font-weight: 700; color: var(--gold); }
[data-theme="light"] .ll-icon { color: var(--primary); }
.ll:hover:not(:disabled), .walk:hover:not(:disabled) { border-color: var(--primary); }
.ll:disabled { opacity: .5; cursor: not-allowed; }
.ll.is-used { opacity: .35; text-decoration: line-through; }
.walk-row { display: flex; justify-content: flex-end; }
.walk { border-color: var(--gold); }
[data-theme="light"] .walk { border-color: var(--text); }
.walk:disabled { opacity: .45; cursor: not-allowed; }

/* host */
.host { display: flex; gap: 10px; align-items: flex-start; }
.host-avatar { flex: none; width: 36px; height: 36px; }
.host-bg { fill: var(--bg-panel); stroke: var(--line); }
.host-fig { fill: var(--primary); }
.host-tie { fill: var(--gold); }
.host-line { margin: 0; background: var(--bg-panel); border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; font-size: .95rem; }
.host-line b { display: block; font-size: .75rem; color: var(--primary); letter-spacing: .06em; }

.prompt { margin: 0; font-family: var(--font-display); font-weight: var(--display-weight, 700); font-size: clamp(1.15rem, 3.6vw, 1.6rem); line-height: 1.45; text-wrap: pretty; }

/* simulated posts / articles / chats: neutral, fictional UI (spec 6) */
.media { width: 100%; } /* as wide as the options (user request 2026-10-23) */
.fake { background: var(--post-bg); color: var(--post-fg); border: 1px solid var(--post-line); border-radius: 12px; padding: 12px 14px; font-size: .95rem; line-height: 1.6; box-shadow: 0 6px 24px rgba(0, 0, 0, .25); display: grid; gap: 8px; }
.fake p { margin: 0; }
.fake-head { display: flex; gap: 10px; align-items: center; }
.fake-avatar { width: 36px; height: 36px; border-radius: 50%; flex: none; background: linear-gradient(135deg, var(--primary), var(--gold)); }
.fake-avatar.is-default { background: var(--post-line); }
.fake-who { display: grid; }
.fake-who b { font-size: .92rem; }
.fake small, .fake-meta, .fake-stats { color: var(--post-muted); font-size: .8rem; }
.fake-figure { margin: 0; border-radius: 8px; overflow: hidden; }
.fake-figure img { display: block; width: 100%; height: auto; }
.fake-img { display: grid; place-items: center; gap: 4px; padding: 26px 12px; background: var(--post-line); color: var(--post-muted); text-align: center; font-size: .85rem; }
.fake-img-icon { font-size: 1.6rem; line-height: 1; }
.fake-chart { margin: 0; display: grid; gap: 4px; padding: 10px; border: 1px solid var(--post-line); border-radius: 8px; }
.fake-chart-title { font-weight: 700; font-size: .9rem; }
.fake-chart-svg { display: block; width: 100%; max-width: 520px; height: auto; margin-inline: auto; }
.fake-chart-note { font-size: .75rem; color: var(--post-muted); }
.chart-grid { stroke: var(--post-line); stroke-width: 1; }
.chart-axis { stroke: var(--post-muted); stroke-width: 1.5; }
.chart-bar { fill: var(--post-muted); }
.chart-bar.is-last { fill: var(--breaking); }
.chart-tick, .chart-label { fill: var(--post-muted); font-size: 12px; font-family: var(--font-num); }
.chart-value { fill: var(--post-fg); font-size: 14px; font-weight: 700; font-family: var(--font-num); }
.fake-link { display: grid; gap: 2px; padding: 8px 10px; border: 1px solid var(--post-line); border-radius: 8px; background: var(--post-bg); }
.fake-link-domain { font-family: var(--font-num); font-size: .75rem; color: var(--post-muted); text-transform: lowercase; }
.fake-link-title { font-weight: 700; font-size: .9rem; }
.fake-stats { display: flex; gap: 14px; flex-wrap: wrap; padding-top: 6px; border-top: 1px solid var(--post-line); }
.fake-url { display: flex; gap: 6px; align-items: baseline; padding: 6px 10px; border-radius: 999px; background: var(--post-line); font-family: var(--font-num); font-size: .78rem; color: var(--post-fg); min-width: 0; }
.fake-lock { font-size: .7rem; }
.fake-masthead { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.fake-outlet { font-weight: 900; letter-spacing: .04em; }
.fake-ad { font-size: .72rem; padding: 1px 6px; border: 1px solid var(--post-muted); border-radius: 3px; color: var(--post-muted); }
.fake-headline { margin: 0; font-family: var(--font-display); font-weight: 700; font-size: 1.2rem; line-height: 1.4; }
.fake-meta { display: flex; gap: 10px; flex-wrap: wrap; }
.fake-lead { font-weight: 500; }
.fake-body { display: grid; gap: 6px; }
.fake-chat { background: var(--post-line); }
.fake-group { font-size: .8rem; color: var(--post-muted); text-align: center; }
.fake-msg { display: flex; gap: 8px; align-items: flex-start; }
.fake-chat .fake-avatar { width: 32px; height: 32px; background: var(--post-muted); }
.fake-msg-body { display: grid; gap: 3px; min-width: 0; }
.fake-sender { font-size: .85rem; }
.fake-forwarded { font-size: .75rem; color: var(--post-muted); }
.fake-forwarded::before { content: "↪ "; }
.fake-bubble { display: grid; gap: 8px; background: var(--post-bg); border-radius: 4px 14px 14px 14px; padding: 8px 12px; }
.fake-time { font-size: .72rem; }

/* find_the_flaw hotspots (spec 6): four parts of the media, A–D, clickable like the options */
.hotspot { position: relative; cursor: pointer; outline: 2px dashed var(--primary); outline-offset: 3px; border-radius: 6px; padding-left: 30px; min-height: 28px; }
.hotspot:hover, .hotspot:focus-visible { outline-style: solid; outline-color: var(--gold); }
[data-theme="light"] .hotspot:hover, [data-theme="light"] .hotspot:focus-visible { outline-color: var(--text); }
.hotspot-key { position: absolute; top: 2px; left: 2px; z-index: 1; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; background: var(--primary); color: var(--on-primary); font: 700 .75rem/1 var(--font-num); }
.hotspot.is-selected, .hotspot.is-locked { outline: 3px solid var(--selected-bg); background: color-mix(in srgb, var(--selected-bg) 18%, transparent); }
.hotspot.is-selected .hotspot-key, .hotspot.is-locked .hotspot-key { background: var(--selected-bg); color: var(--on-selected); }
.hotspot.is-locked { animation: locked 1.1s ease-in-out infinite; }
.hotspot.is-correct { outline: 3px solid var(--correct); animation: none; }
.hotspot.is-correct .hotspot-key { background: var(--correct); color: var(--on-correct); }
.hotspot.is-wrong { outline: 3px solid var(--wrong); animation: none; }
.hotspot.is-wrong .hotspot-key { background: var(--wrong); color: var(--on-wrong); }
.hotspot.is-removed { opacity: .35; cursor: not-allowed; outline-style: dotted; }
.hotspot[aria-disabled="true"] { cursor: default; }
.flaw-hint { margin: 0; font-size: .9rem; color: var(--text-muted); }

/* explanation: where the clues were (spec 10.1) */
.is-clue { position: relative; box-shadow: 0 0 0 3px var(--breaking); border-radius: 6px; }
.clue-no { position: absolute; top: -10px; right: 8px; z-index: 2; width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; background: var(--breaking); color: var(--on-breaking); font: 700 .75rem/1 var(--font-num); }
.bar .clue-no { top: 4px; right: 4px; } /* option bars clip overflow */
.clues { margin: 0; padding-left: 1.4em; display: grid; gap: 4px; }

/* URLs: wrap only after "/" or "." (see linkSafe in dom.js) */
.url { overflow-wrap: normal; word-break: normal; }
.bar-text .url, .prompt .url { font-family: var(--font-num); font-size: .92em; }

/* answer options: news lower-thirds (spec 8.1) */
.options { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.bar { font: inherit; text-align: left; cursor: pointer; display: flex; align-items: stretch; min-height: 56px; padding: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-option); color: var(--text); overflow: hidden; }
.bar-key { flex: none; width: 44px; display: grid; place-items: center; font-family: var(--font-num); font-weight: 700; background: var(--line); color: var(--gold); }
[data-theme="light"] .bar-key { background: var(--text); color: #FFFFFF; }
.bar-text { flex: 1; min-width: 0; padding: 10px 12px; align-self: center; font-size: 1rem; line-height: 1.45; }
.bar-tag { flex: none; align-self: center; padding: 0 12px; font-size: .8rem; font-weight: 700; }
.bar:hover:not(:disabled) { border-color: var(--primary); }
[data-theme="light"] .bar { border-left: 6px solid var(--primary); }
.bar.is-selected { background: var(--selected-bg); color: var(--on-selected); border-color: var(--selected-bg); }
.bar.is-selected .bar-key { background: rgba(0, 0, 0, .12); color: var(--on-selected); }
.bar.is-locked { background: var(--selected-bg); color: var(--on-selected); animation: locked 1.1s ease-in-out infinite; }
.bar.is-correct { background: var(--correct); color: var(--on-correct); border-color: var(--correct); animation: none; }
.bar.is-wrong { background: var(--wrong); color: var(--on-wrong); border-color: var(--wrong); animation: none; }
.bar.is-correct .bar-key, .bar.is-wrong .bar-key { background: rgba(0, 0, 0, .15); color: inherit; }
.bar.is-removed { opacity: .25; cursor: not-allowed; }
.bar.is-removed .bar-text { text-decoration: line-through; }
.bar:disabled:not(.is-removed) { cursor: default; }
@keyframes locked { 50% { opacity: .72; } }

/* lifeline results */
.assist { background: var(--bg-panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: grid; gap: 10px; }
.assist h2 { margin: 0; font-size: .95rem; color: var(--text-muted); font-weight: 700; }
.assist p { margin: 0; }
.call { display: flex; gap: 10px; align-items: flex-start; }
.call-icon { flex: none; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--correct); color: var(--on-correct); font-weight: 700; }
.poll { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; align-items: end; height: 150px; }
.poll-col { display: grid; grid-template-rows: auto 1fr auto; height: 100%; text-align: center; font-family: var(--font-num); font-size: .85rem; gap: 4px; }
.poll-slot { position: relative; display: flex; align-items: flex-end; background: var(--line); border-radius: 4px; overflow: hidden; }
.poll-fill { display: block; width: 100%; background: var(--primary); transition: height .8s ease-out; }
.poll-col.top .poll-fill { background: var(--gold); }
.poll-note { font-size: .85rem; color: var(--text-muted); }

/* confirm ("這則，你要轉傳嗎？") */
.confirm { background: var(--bg-panel); border: 1px solid var(--gold); border-radius: 12px; padding: 14px; display: grid; gap: 12px; }
.confirm-q { margin: 0; font-family: var(--font-display); font-weight: 700; font-size: 1.1rem; }
.confirm-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.btn { font: inherit; font-weight: 700; cursor: pointer; min-height: 48px; padding: 8px 20px; border-radius: var(--radius); border: 1px solid transparent; }
.btn-gold { background: var(--selected-bg); color: var(--on-selected); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--primary); }

/* reveal / result (the full explanation card comes with spec step 7) */
.reveal, .result { background: var(--bg-panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px; display: grid; gap: 10px; }
.reveal h2, .result h2 { margin: 0; font-family: var(--font-display); font-weight: var(--display-weight, 700); font-size: 1.3rem; }
.reveal p, .result p { margin: 0; }
.reveal .label { font-size: .8rem; color: var(--text-muted); letter-spacing: .06em; }
.reveal .lesson { padding: 10px 12px; border-left: 4px solid var(--breaking); background: var(--bg); }
.skill { display: grid; gap: 2px; padding: 10px 14px; border: 1px dashed var(--gold); border-radius: 8px; }
.skill b { font-size: 1.05rem; }
.result .big { font-family: var(--font-num); font-size: clamp(1.8rem, 7vw, 2.8rem); font-weight: 700; color: var(--gold); }
[data-theme="light"] .result .big { color: var(--text); }
.result .fine { font-size: .9rem; color: var(--text-muted); }
.result .safe-note { padding: 10px 12px; border-left: 4px solid var(--breaking); background: var(--bg); font-size: .95rem; }

/* explanation card (spec 10.1) */
.reveal { gap: 14px; }
.xp-head { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: space-between; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.xp-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.xp-actions .btn { display: inline-flex; align-items: center; text-decoration: none; }
.xp-kicker { margin: 0; font-size: .8rem; letter-spacing: .08em; color: var(--text-muted); }
.xp-step { display: grid; gap: 6px; }
.xp-label { margin: 0; display: flex; align-items: center; gap: 8px; font-size: .85rem; font-weight: 700; color: var(--text-muted); letter-spacing: .04em; }
.xp-no { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; background: var(--primary); color: var(--on-primary); font: 700 .75rem/1 var(--font-num); }
.xp-hint { font-size: .85rem; color: var(--text-muted); }
.xp-true { color: var(--correct); font-weight: 700; }
[data-theme="light"] .xp-true { color: var(--correct); }
.crowd { margin: 0; font-size: .9rem; color: var(--text-muted); }
.optout { display: inline-flex; gap: 8px; align-items: center; min-height: 44px; font-size: .85rem; color: var(--text-muted); }
.optout input { width: 18px; height: 18px; accent-color: var(--primary); }
.credit { margin: 0; font-size: .75rem; color: var(--text-muted); }
.skill { position: relative; border: 0; padding: 14px 16px 12px; background: var(--bg); border-radius: 10px; overflow: hidden; }
/* ET Home trans flag colours as the card's top edge (spec 8.2) */
.skill::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 5px; background: linear-gradient(90deg, #5BCEFA 0 20%, #F5A9B8 20% 40%, #FFFFFF 40% 60%, #F5A9B8 60% 80%, #5BCEFA 80%); }
.skill-tag { justify-self: start; font-size: .75rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--text-muted); }
.skill-tag.is-new { background: var(--selected-bg); color: var(--on-selected); border-color: var(--selected-bg); }
.round-cards ul { margin: 6px 0 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 8px; }
.round-cards li { display: inline-flex; gap: 6px; align-items: center; padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); }

/* prize ladder: strip on phones/tablets (lowest first), headline ranking column on desktop */
.ladder { list-style: none; margin: 0; padding: 6px; display: flex; gap: 4px; overflow-x: auto; background: var(--bg-panel); border: 1px solid var(--line); border-radius: 10px; font-family: var(--font-num); font-size: .72rem; font-variant-numeric: tabular-nums; scrollbar-width: thin; }
.ladder li { flex: none; display: flex; flex-direction: column; align-items: center; padding: 3px 7px; border-radius: 3px; color: var(--text-muted); white-space: nowrap; }
.ladder li.safe { background: var(--breaking); color: var(--on-breaking); }
.ladder li.safe .lv::after { content: " 保底"; font-family: var(--font-sans); font-size: .65rem; font-weight: 700; }
.ladder li.done { color: var(--text); }
.ladder li.now { background: var(--selected-bg); color: var(--on-selected); font-weight: 700; }
.ladder li.now .lv::before { content: "▶ "; }

/* ticker */
.ticker { position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; display: flex; align-items: center; background: var(--ticker-bg); color: var(--ticker-fg); font-size: .9rem; padding-bottom: env(safe-area-inset-bottom, 0px); padding-left: env(safe-area-inset-left, 0px); padding-right: env(safe-area-inset-right, 0px); }
.ticker-label { flex: none; background: var(--breaking); color: var(--on-breaking); padding: 10px 12px; font-weight: 900; letter-spacing: .08em; }
.ticker-window { flex: 1; overflow: hidden; }
.ticker-run { margin: 0; padding-left: 100%; white-space: nowrap; display: inline-block; animation: ticker 40s linear infinite; overflow-wrap: normal; }
@keyframes ticker { to { transform: translateX(-100%); } }
@media (prefers-reduced-motion: reduce) { .ticker-run { animation: none; padding-left: 12px; white-space: normal; } .bar.is-locked { animation: none; } }

@media (max-width: 599px) {
  .host-avatar { width: 28px; height: 28px; }
  .host-line { padding: 6px 10px; font-size: .9rem; }
  .host-line b { display: inline; margin-right: 6px; }
  .host-line span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .ll, .walk { font-size: .85rem; padding: 6px 10px; }
  .play { gap: 12px; }
}
@media (min-width: 600px) {
  .options { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .host-avatar { width: 44px; height: 44px; }
}
@media (min-width: 1024px) {
  .game-grid { grid-template-columns: minmax(0, 1fr) 250px; gap: 24px; padding-block: 20px 28px; }
  .ladder { grid-column: 2; grid-row: 1; flex-direction: column-reverse; overflow: visible; padding: 10px; gap: 2px; font-size: .85rem; align-self: start; position: sticky; top: 12px; }
  .ladder li { flex-direction: row; justify-content: space-between; }
  .play { grid-column: 1; grid-row: 1; }
}
@media (min-width: 1440px) {
  .game-grid { grid-template-columns: minmax(0, 1fr) 290px; }
  .bar-text { font-size: 1.1rem; }
}
/* landscape phones: keep the question and options on screen (spec 8.5.3) */
@media (max-height: 500px) and (orientation: landscape) {
  .host { display: none; }
  .ticker { font-size: .75rem; }
  .ticker-label { padding: 6px 10px; }
}
