/* Trend Arena reader styles. One file, light and dark. */
:root {
  --paper: #f5f2ec; --card: #fffdf9; --ink: #1c1a17; --soft: #5d574e; --line: #ddd6c9;
  --accent: #b92d1a; --accent-ink: #fff; --link: #1b4f8a; --good: #1f6b45; --mark: #f3e6c4;
  --serif: "Noto Serif TC", "Songti TC", "Source Han Serif TC", "PMingLiU", Georgia, "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", "PingFang TC", "Microsoft JhengHei", "Noto Sans TC", sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --paper: #171614; --card: #201e1b; --ink: #ece7de; --soft: #a9a195; --line: #38342e; --accent: #ef6a55; --accent-ink: #1a0f0c; --link: #8dbbf0; --good: #7fcfa4; --mark: #3b3320; }
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 16px/1.6 var(--sans); overflow-wrap: anywhere; }
a { color: var(--link); text-underline-offset: 3px; }
h1, h2, h3, h4, p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .55; }
:focus-visible { outline: 3px solid var(--link); outline-offset: 2px; border-radius: 4px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--card); padding: 8px 12px; z-index: 20; }
.skip:focus { left: 8px; }

button, .chip, .vote, .ghost, .account, .tabs a, .duel-option, .source, a.read, .primary, .secondary {
  transition: background-color 150ms cubic-bezier(0.16, 1, 0.3, 1),
              border-color 150ms cubic-bezier(0.16, 1, 0.3, 1),
              color 150ms cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 150ms cubic-bezier(0.16, 1, 0.3, 1);
}

/* Server-rendered copy is for crawlers and for readers before the app starts. */
body.app-ready:not(.keep-ssr) #ssr-prerender { display: none; }

.top { position: sticky; top: 0; z-index: 10; background: color-mix(in srgb, var(--paper) 92%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.top-row, .tabs, main, .foot { max-width: 1120px; margin: 0 auto; padding-left: 20px; padding-right: 20px; }
.top-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 8px; padding-bottom: 6px; }
.brand { white-space: nowrap; min-width: 0; display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font: 700 1.25rem/1 var(--serif); letter-spacing: .04em; }
.brand-mark { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; color: var(--accent); flex: none; }
.brand-mark svg { width: 100%; height: 100%; display: block; }
.top-actions { flex: none; display: flex; align-items: center; gap: 4px; }
.ghost { white-space: nowrap; background: none; border: 0; padding: 8px 10px; min-height: 40px; color: var(--soft); text-decoration: none; border-radius: 6px; display: inline-flex; align-items: center; }
.ghost:hover { color: var(--ink); background: color-mix(in srgb, var(--ink) 7%, transparent); }
.account { background: var(--ink); color: var(--paper); border: 0; border-radius: 6px; padding: 8px 14px; min-height: 40px; max-width: 11em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tabs { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.tabs a { flex: none; padding: 7px 12px 9px; color: var(--soft); text-decoration: none; border-bottom: 3px solid transparent; }
.tabs a[aria-current="page"] { color: var(--ink); border-color: var(--accent); font-weight: 600; }

main { padding-top: 20px; padding-bottom: 36px; display: grid; align-content: start; gap: 32px; min-height: 50vh; }
main:focus { outline: none; }
.since { color: var(--soft); font-size: .95rem; }
.fine { color: var(--soft); font-size: .9rem; }
.topic-disclaimer { font-size: .8rem; line-height: 1.45; }
.how { color: var(--soft); font-size: .8rem; line-height: 1.5; margin-bottom: -16px; }
.older-head { font: 700 1.25rem/1.3 var(--serif); }
.pages { justify-content: center; }

.topic, .duel { scroll-margin-top: 110px; }
.topic { display: grid; align-content: start; gap: 12px; padding-top: 22px; border-top: 1px solid var(--line); box-shadow: 0 -2px 0 0 var(--accent); }
.topic.lead { border-top: 0; box-shadow: none; padding-top: 0; }
.banner { width: 100%; aspect-ratio: 21 / 9; max-height: 300px; object-fit: cover; border-radius: 6px; background: var(--line); border: 1px solid var(--line); }
.kicker { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; color: var(--soft); font-size: .88rem; }
.cat { color: var(--accent); font-weight: 600; letter-spacing: .06em; }
.new { background: var(--accent); color: var(--accent-ink); font-size: .72rem; font-weight: 600; padding: 1px 7px; border-radius: 3px; }
.topic h1, .topic h2 { font-family: var(--serif); line-height: 1.3; letter-spacing: .01em; }
.topic h1 { font-size: clamp(1.7rem, 4.2vw, 2.7rem); }
.topic h2 { font-size: clamp(1.35rem, 2.6vw, 1.8rem); }
.topic h1 a, .topic h2 a { color: inherit; text-decoration: none; }
.topic h1 a:hover, .topic h2 a:hover { text-decoration: underline; text-decoration-thickness: 2px; }
.note { background: var(--mark); padding: 12px 16px; border-left: 4px solid var(--accent); max-width: 78ch; border-radius: 0 4px 4px 0; }
.note strong { display: block; font-size: .82rem; letter-spacing: .08em; color: var(--soft); margin-bottom: 2px; }

.sources { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; align-content: start; }
.source { background: var(--card); border: 1px solid var(--line); border-top: 2px solid color-mix(in srgb, var(--ink) 75%, transparent); border-radius: 6px; padding: 15px 16px; display: flex; flex-direction: column; gap: 8px; }
.source:hover { border-top-color: var(--accent); }
.source header { padding-bottom: 6px; border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent); }
.source h4 { font: 700 1.1rem/1.3 var(--serif); }
.meta { color: var(--soft); font-size: .84rem; }
.focus { background: color-mix(in srgb, var(--mark) 55%, transparent); padding: 6px 10px; border-left: 3px solid var(--accent); border-radius: 0 4px 4px 0; font-weight: 600; color: var(--ink); }
.summary { color: var(--ink); }
.read { font-weight: 600; align-self: flex-start; color: var(--ink); text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
.read:hover { color: var(--accent); }
.host { font-weight: 400; color: var(--soft); font-size: .88rem; }
.votes { margin-top: auto; padding-top: 10px; border-top: 1px dashed var(--line); display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.vote { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 6px 14px; border: 1px solid var(--line); background: var(--paper); border-radius: 5px; font-weight: 500; }
.vote b { font-variant-numeric: tabular-nums; }
.vote:hover:not(:disabled) { border-color: var(--ink); }
.vote.up:hover:not(:disabled) { border-color: var(--good); background: color-mix(in srgb, var(--good) 12%, var(--paper)); }
.vote.down:hover:not(:disabled) { border-color: var(--ink); background: color-mix(in srgb, var(--ink) 10%, var(--paper)); }
.vote.up[aria-pressed="true"] { background: var(--good); border-color: var(--good); color: var(--card); }
.vote.down[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.vote-status { color: var(--soft); font-size: .85rem; }
.vote-cta { color: var(--accent); font-weight: 600; }
/* Post-vote stance sharing and the Today sort chips. Tokens already switch with the colour scheme, so light and dark both inherit. */
.stance-share { flex-basis: 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 8px 10px; background: color-mix(in srgb, var(--mark) 55%, transparent); border-left: 3px solid var(--accent); border-radius: 0 4px 4px 0; }
.stance-share[hidden] { display: none; }
.stance-share-label { color: var(--soft); font-size: .85rem; font-weight: 600; margin-right: 2px; }
.share-chip { display: inline-flex; align-items: center; justify-content: center; min-height: 36px; padding: 4px 13px; border: 1px solid var(--line); background: var(--paper); border-radius: 999px; color: var(--ink); font-size: .85rem; font-weight: 600; text-decoration: none; cursor: pointer; }
.share-chip:hover { border-color: var(--accent); color: var(--accent); }
.today-filter { margin: 0 0 4px; }

.actions, .chips, .row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.chip { min-height: 36px; padding: 4px 13px; border: 1px solid var(--line); background: transparent; border-radius: 999px; font-size: .9rem; color: var(--soft); }
.chip:hover { border-color: var(--ink); color: var(--ink); }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }

.chip.tip { border-color: var(--accent); color: var(--accent); font-weight: 600; }
.notice { background: var(--mark); border-left: 4px solid var(--good); padding: 12px 16px; max-width: 78ch; border-radius: 0 4px 4px 0; }
.tip-warning { font-weight: 600; padding: 10px 14px; background: var(--mark); border-left: 4px solid var(--accent); max-width: 78ch; border-radius: 0 4px 4px 0; }
.tip-receipt { color: var(--soft); font-size: .9rem; display: grid; align-content: start; gap: 2px; max-width: 78ch; }

.duel { background: #1b1917; color: #f5f2ec; border: 1px solid #2d2925; border-top: 3px solid var(--accent); border-radius: 8px; padding: 20px 22px; display: grid; align-content: start; gap: 12px; }
.duel .kicker { color: #a8a29e; }
.duel .cat { color: #fff; background: var(--accent); padding: 1px 8px; border-radius: 3px; }
.duel h2 { font: 700 1.3rem/1.35 var(--serif); color: #f5f2ec; }
.duel-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; align-content: start; }
.duel-option { text-align: left; background: rgba(255, 255, 255, 0.06); color: #f5f2ec; border: 1px solid rgba(255, 255, 255, 0.16); border-radius: 6px; padding: 12px 14px; display: grid; align-content: start; gap: 4px; line-height: 1.5; min-height: 44px; }
.duel-option b { font: 700 1.3rem/1 var(--serif); }
.duel-option:hover:not(:disabled) { border-color: var(--accent); background: rgba(255, 255, 255, 0.12); }
.duel-option.picked { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 22%, rgba(255, 255, 255, 0.08)); opacity: 1; }
.duel-result { display: grid; align-content: start; gap: 6px; }
.duel-result ul { margin: 0; padding: 0; list-style: none; }
.duel-result .read { color: #f5f2ec; text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: 1.5px; }

.panel { display: grid; align-content: start; gap: 10px; max-width: 78ch; }
.panel h1 { font: 700 1.85rem/1.25 var(--serif); }
.panel h2 { font: 700 1.25rem/1.3 var(--serif); }
.panel h3 { font-size: 1rem; margin-top: 6px; }
.empty { background: var(--card); border: 1px solid var(--ink); border-top: 3px solid var(--accent); border-radius: 8px; padding: 24px 20px; display: grid; align-content: start; gap: 8px; justify-items: start; max-width: 78ch; }
.empty h2 { font: 700 1.25rem/1.3 var(--serif); }
.rank { margin: 0; padding: 0; list-style: none; counter-reset: rank; }
.rank li { counter-increment: rank; display: flex; align-items: baseline; gap: 14px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.rank li::before { content: counter(rank); font: 700 1.5rem/1 var(--serif); color: var(--accent); min-width: 1.6em; }
.rank li span { margin-left: auto; color: var(--soft); font-variant-numeric: tabular-nums; }
.records { margin: 0; padding: 0; list-style: none; }
.records li { padding: 8px 0; border-bottom: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; }
.records li p { flex-basis: 100%; color: var(--soft); }

label { font-weight: 600; font-size: .92rem; }
input[type="text"], input[type="date"], select, textarea { background: var(--card); border: 1px solid var(--line); border-radius: 6px; padding: 9px 12px; min-height: 42px; max-width: 100%; }
textarea { width: 100%; resize: vertical; }
.row input[type="text"] { flex: 1 1 12em; min-width: 0; }
.primary, .secondary { min-height: 42px; padding: 8px 16px; border-radius: 6px; border: 1px solid var(--ink); font-weight: 600; }
.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.secondary { background: transparent; }
.link { background: none; border: 0; padding: 4px 0; color: var(--link); text-decoration: underline; text-underline-offset: 3px; font-size: .88rem; }
.status { color: var(--soft); min-height: 1.4em; }

.sheet { width: min(560px, calc(100vw - 24px)); max-height: min(86vh, 760px); padding: 0; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); color: var(--ink); }
.sheet::backdrop { background: rgba(10, 8, 6, .55); }
.sheet-head { position: sticky; top: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 18px; background: var(--paper); border-bottom: 1px solid var(--line); }
.sheet-head h2 { font: 700 1.2rem/1.3 var(--serif); }
.sheet-body { padding: 16px 18px; display: grid; align-content: start; gap: 10px; }
.sheet-body h3 { font-size: 1rem; margin-top: 6px; }
.sheet-body section { display: grid; align-content: start; gap: 8px; padding-top: 12px; border-top: 1px solid var(--line); }
.sheet-body section button { min-height: 42px; padding: 8px 14px; border-radius: 6px; border: 1px solid var(--line); background: transparent; text-align: left; }
.signin { display: grid; align-content: start; gap: 10px; justify-items: start; }
.price { font-weight: 600; }
.seats { display: grid; align-content: start; gap: 10px; }
.seat { background: var(--card); border: 1px solid var(--line); border-radius: 6px; padding: 12px 14px; display: grid; align-content: start; gap: 8px; }
.seat-feed { display: grid; align-content: start; gap: 8px; }
.seat-topic { display: grid; align-content: start; gap: 2px; padding-top: 8px; border-top: 1px dashed var(--line); }
.seat-topic h4 { font: 700 1.05rem/1.4 var(--serif); }
.seat-sources { margin: 4px 0 0; padding: 0; list-style: none; display: grid; align-content: start; gap: 8px; }
.seat-sources li { padding-left: 12px; border-left: 2px solid var(--line); }
.seat-sources p { color: var(--soft); font-size: .92rem; }
.comment { padding: 10px 0; border-bottom: 1px solid var(--line); display: grid; align-content: start; gap: 4px; }
.comment header { display: flex; gap: 10px; align-items: baseline; }
.comment time { color: var(--soft); font-size: .84rem; }

.foot { border-top: 1px solid var(--line); padding-top: 22px; padding-bottom: 36px; display: grid; align-content: start; gap: 8px; color: var(--soft); font-size: .9rem; }
.foot h2 { font: 700 1.05rem/1.3 var(--serif); color: var(--ink); }
.foot p { max-width: 78ch; }
.foot nav { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; margin-top: 4px; }

@media (prefers-color-scheme: dark) {
  .source { border-top-color: #4f4940; }
  .source:hover { border-top-color: var(--accent); }
  .empty { border-color: #4a443c; border-top-color: var(--accent); }
  .duel { background: #100f0d; color: #ece7de; border: 1px solid #3f3a32; border-top: 3px solid var(--accent); }
  .duel .kicker { color: #9c9488; }
  .duel .cat { color: var(--accent-ink); background: var(--accent); }
  .duel h2 { color: #ece7de; }
  .duel-option { background: rgba(255, 255, 255, 0.04); color: #ece7de; border: 1px solid #38342e; }
  .duel-option:hover:not(:disabled) { border-color: var(--accent); background: rgba(255, 255, 255, 0.08); }
  .duel-option.picked { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 25%, #181614); }
  .duel-result .read { color: #ece7de; }
}

@media (max-width: 640px) {
  body { font: 15px/1.5 var(--sans); }
  .top-row, .tabs, main, .foot { padding-left: 16px; padding-right: 16px; }
  .sources, .duel-options { grid-template-columns: minmax(0, 1fr); }
  .top-row { gap: 6px; padding-top: 6px; padding-bottom: 4px; }
  .brand { font-size: 1.02rem; gap: 8px; }
  .brand-mark { width: 30px; height: 30px; }
  .ghost { padding: 8px 8px; min-height: 44px; }
  .account { padding: 8px 12px; min-height: 44px; }
  .tabs a { padding: 8px 10px; min-height: 44px; display: inline-flex; align-items: center; }
  main { padding-top: 14px; padding-bottom: 24px; gap: 20px; min-height: auto; align-content: start; }
  .how { font-size: .78rem; line-height: 1.45; margin-bottom: -10px; }
  .since { font-size: .88rem; }
  .fine { font-size: .84rem; }
  .topic { gap: 10px; padding-top: 16px; }
  .topic.lead { padding-top: 0; }
  .banner { aspect-ratio: 21 / 9; max-height: 140px; }
  .kicker { gap: 2px 10px; font-size: .82rem; }
  .topic h1 { font-size: clamp(1.4rem, 5.2vw, 1.85rem); line-height: 1.25; }
  .topic h2 { font-size: clamp(1.18rem, 4vw, 1.45rem); line-height: 1.28; }
  .note { padding: 9px 12px; }
  .note strong { font-size: .78rem; margin-bottom: 1px; }
  .sources { gap: 10px; }
  .source { padding: 12px 13px; gap: 7px; }
  .source h4 { font-size: 1.02rem; line-height: 1.28; }
  .votes { padding-top: 8px; gap: 6px; }
  .vote { min-height: 44px; padding: 6px 13px; font-size: .88rem; }
  .chip { min-height: 40px; padding: 5px 12px; font-size: .86rem; }
  .share-chip { min-height: 44px; min-width: 44px; padding: 8px 14px; }
  .today-filter .chip { min-height: 44px; }
  .duel { padding: 15px 14px; gap: 10px; }
  .duel h2 { font-size: 1.15rem; line-height: 1.3; }
  .duel-options { gap: 8px; }
  .duel-option { padding: 11px 12px; gap: 3px; line-height: 1.45; min-height: 44px; }
  .panel { gap: 8px; }
  .panel h1 { font-size: 1.5rem; }
  .panel h2 { font-size: 1.15rem; }
  .empty { padding: 18px 16px; gap: 8px; }
  .empty h2 { font-size: 1.15rem; }
  .rank li { padding: 8px 0; gap: 10px; }
  .records li { padding: 7px 0; gap: 3px 8px; }
  input[type="text"], input[type="date"], select, textarea { min-height: 44px; padding: 8px 12px; }
  .primary, .secondary { min-height: 44px; padding: 9px 16px; }
  .sheet-head { padding: 10px 14px; }
  .sheet-body { padding: 14px; gap: 8px; }
  .sheet-body section { gap: 8px; padding-top: 10px; }
  .sheet-body section button { min-height: 44px; }
  .seat { padding: 10px 12px; gap: 6px; }
  .comment { padding: 8px 0; }
  .foot { padding-top: 16px; padding-bottom: 24px; gap: 6px; font-size: .84rem; }
  .foot nav { gap: 6px 12px; margin-top: 2px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

/* Account sheet: optional private-data export choices. */
.sheet fieldset { border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; margin: 12px 0; }
.sheet fieldset legend { padding: 0 6px; color: var(--soft); font-size: .9rem; }
.sheet fieldset label { display: flex; gap: 8px; align-items: flex-start; padding: 6px 0; min-height: 32px; }

/* Reserved ad placements (app.js renders them on Today only): neutral containers,
   no third-party code. Completely hidden until ads-page.js marks a live
   configuration with data-ad-ready. */
.ad-slot { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px; padding: 18px; min-height: 96px; border: 1px dashed var(--line); border-radius: 8px; background: var(--card); color: var(--soft); text-align: center; }
.ad-slot strong { font-size: .78rem; letter-spacing: .08em; font-weight: 600; }
.ad-slot small { font-size: .74rem; line-height: 1.6; }
.ad-slot--feed { min-height: 250px; }
.ad-slot:not([data-ad-ready]) { display: none; }

/* Subscription sheet: real-sample teaser above the sign-in wall (A4). */
.sample-body { display: grid; align-content: start; gap: 8px; }
.sample[hidden] { display: none; }
