/* Direction B "redacted archive" (Zhiyuan 2026-10-19): dark archive paper, serif display type, blacked-out dates, news as clippings. */
:root {
  --bg: #0f0d0b;
  --panel: #16130f;
  --chart: #14110e;
  --line: #3a2f24;
  --paper: #ece4d4;
  --muted: #a79a85;
  --dim: #6e6455;
  --amber: #f0b34a;          /* long / capital band / primary action */
  --steel: #7fa7c9;          /* short side of the knob */
  --danger: #d6503c;
  --gutter: 16px;
  --serif: "Noto Serif SC", "Songti SC", "STSong", Georgia, serif;
  --sans: "Noto Sans SC", system-ui, -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  /* a blacked-out financial newspaper page (scripts/make_paper_bg.py), dimmed toward the centre so text stays readable */
  background: radial-gradient(ellipse at 50% 45%, rgba(15,13,11,.55) 0%, rgba(15,13,11,0) 75%) fixed,
    radial-gradient(900px 600px at 25% -10%, rgba(42,33,24,.9) 0%, rgba(15,13,11,0) 62%) fixed,
    url("paper.svg") center / cover no-repeat fixed, var(--bg);
  color: var(--paper);
  font: 15px/1.55 var(--sans); overscroll-behavior: none; -webkit-tap-highlight-color: transparent;
}
/* paper grain */
body::before { content: ""; position: fixed; inset: 0; pointer-events: none; opacity: .07; z-index: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='140' height='140'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2'/></filter><rect width='140' height='140' filter='url(%23n)'/></svg>"); }
#app { height: 100%; max-width: 1400px; margin: 0 auto; position: relative; z-index: 1; }
.screen { display: none; height: 100%; padding: var(--gutter); padding-bottom: max(var(--gutter), env(safe-area-inset-bottom)); overflow-y: auto; }
.screen.active { display: block; }
.num { font-variant-numeric: tabular-nums; }

/* shared pieces */
.stamp { display: inline-block; font: 500 11px var(--serif); letter-spacing: .4em; color: #b0855a; border: 1px solid #5a432d; padding: 3px 8px 3px 10px; transform: rotate(-2deg); }
.redact { display: inline-block; height: 1em; vertical-align: -2px; background: var(--paper); border-radius: 1px; position: relative; overflow: hidden; }
.redact.w2 { width: 4.2em; } .redact.w3 { width: 6.2em; } .redact.w5 { width: 9.5em; }
.redact::after { content: ""; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 30%, rgba(255,255,255,.55) 50%, transparent 70%); transform: translateX(-100%); animation: sheen 5s ease-in-out infinite; }
@keyframes sheen { 60%, 100% { transform: translateX(100%); } }
button {
  font: inherit; color: var(--paper); background: transparent; border: 1px solid var(--line);
  border-radius: 2px; padding: 10px 16px; min-height: 44px; cursor: pointer;
}
button[aria-pressed="true"] { border-color: var(--amber); color: var(--amber); }
button.primary { display: block; width: 100%; background: var(--amber); color: #1a1209; border-color: var(--amber); font: 900 17px var(--serif); letter-spacing: .4em; padding-left: calc(16px + .4em); margin-top: 18px; min-height: 52px; }
button.primary:active { transform: translateY(1px); }
button:focus-visible, .slider:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
.fine { color: var(--dim); font-size: .72rem; line-height: 1.6; margin-top: 12px; }

/* ---------- start ---------- */
.start .stamp { align-self: flex-start; }
.start { max-width: 520px; margin: 0 auto; min-height: 100%; display: flex; flex-direction: column; padding-top: 2vh; }
.start h1 { font: 900 clamp(52px, 16vw, 76px)/1 var(--serif); margin: 18px 0 6px; letter-spacing: .08em; }
.start .lead { color: var(--muted); font: 500 14px/1.7 var(--serif); margin: 0; }
.dossier { margin: 18px 0 14px; border: 1px solid var(--line); background: rgba(255,240,215,.03); padding: 10px 14px; font-size: 13.5px; line-height: 2.1; }
.dossier .k { color: var(--dim); display: inline-block; min-width: 4.2em; margin-right: .6em; }
.dossier .v { color: var(--paper); }
.dossier .hand { font: 900 14px var(--serif); color: var(--amber); }
.dossier .arrow { color: var(--dim); margin: 0 .4em; }
.rules { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; font-size: 13.5px; color: #c9bea9; }
.rules li { display: grid; grid-template-columns: 24px 1fr; }
.rules em { font: 900 14px var(--serif); color: var(--amber); font-style: normal; }
.delay { margin-top: auto; padding-top: 18px; }
.label { color: var(--dim); font-size: 12px; margin-bottom: 6px; }
.seg { display: flex; gap: 8px; }
.seg button { flex: 1; font-size: 13px; color: var(--muted); }
.hint { color: var(--dim); font-size: 12px; min-height: 2.6em; margin-top: 6px; }

/* ---------- game ---------- */
#screen-game.active { display: flex; flex-direction: column; gap: 6px; overflow: hidden; }
.hud { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; color: var(--muted); font-size: 12px; }
.hud b { font: 900 19px var(--serif); color: var(--paper); margin: 0 2px; }
button.icon { min-height: 30px; padding: 0 10px; font-size: 15px; color: var(--dim); align-self: center; }
button.icon[aria-pressed="true"] { color: var(--amber); border-color: var(--amber); }
.ddbar { height: 3px; background: var(--line); position: relative; }
.ddbar i { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: var(--amber); transition: width .15s linear; }
.ddbar b { position: absolute; right: 0; top: -3px; bottom: -3px; width: 2px; background: var(--danger); }
.context { color: var(--dim); font-size: 11.5px; letter-spacing: .03em; }
.clip { position: relative; z-index: 2; min-height: 64px; margin: 2px 4px 4px; background: #e9e0cd; color: #1d1710; padding: 8px 12px 9px;
  transform: rotate(var(--tilt, -.6deg)) translateY(-6px); box-shadow: 0 6px 18px rgba(0,0,0,.5); font: 900 15px/1.35 var(--serif);
  opacity: 0; transition: opacity .25s, transform .25s; }
.clip.show { opacity: 1; transform: rotate(var(--tilt, -.6deg)); }
.clip small { display: flex; align-items: center; gap: 6px; font: 400 10.5px var(--sans); color: #6b5d48; margin-bottom: 3px; }
.clip small .redact { background: #1d1710; width: 4.6em; height: .9em; }
.clip small .redact::after { display: none; }
.clip svg { width: 14px; height: 14px; fill: none; stroke: #6b5d48; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.stage { flex: 1; min-height: 0; display: flex; gap: 10px; }
#chart { flex: 1 1 0; width: 0; min-width: 0; height: 100%; background: var(--chart); border: 1px solid var(--line); touch-action: none; }
.slider { width: 66px; display: flex; flex-direction: column; align-items: center; gap: 8px; touch-action: none; user-select: none; -webkit-user-select: none; cursor: ns-resize; }
.slider-value { font: 900 20px var(--serif); color: var(--amber); min-width: 3.2em; text-align: center; }
.slider.short .slider-value { color: var(--steel); }
.slider.cash .slider-value { color: var(--muted); }
.slider-label { color: var(--dim); font-size: 11px; }
.track { position: relative; flex: 1; width: 6px; background: var(--line); margin: 10px 0; }
.fill { position: absolute; left: 0; right: 0; background: var(--amber); }
.slider.short .fill { background: var(--steel); }
.track .zero { position: absolute; left: -14px; right: -14px; bottom: 25%; border-top: 1px solid var(--muted); }
.tick { position: absolute; left: 16px; transform: translateY(50%); font-size: 9.5px; color: var(--dim); }
.tick.zero-t { color: var(--muted); }
.thumb { position: absolute; left: -17px; width: 40px; height: 20px; border-radius: 2px; background: var(--paper); transform: translateY(50%); box-shadow: 0 3px 10px rgba(0,0,0,.6); }
.thumb::after { content: ""; position: absolute; left: 10px; right: 10px; top: 9px; border-top: 2px solid rgba(29,23,16,.35); }

.overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(8,6,4,.72); padding: var(--gutter); z-index: 5; }
.overlay.hidden { display: none; }
.card { background: #e9e0cd; color: #1d1710; padding: 20px 20px 18px; max-width: 360px; width: 100%; text-align: center; box-shadow: 0 14px 40px rgba(0,0,0,.6); transform: rotate(-.4deg); }
.card .kicker { font: 500 11px var(--serif); letter-spacing: .4em; color: #8a6a45; }
.card h2 { font: 900 30px/1.2 var(--serif); margin: .25em 0 .3em; letter-spacing: .06em; }
.card p { color: #4d4232; margin: .3em 0; font-size: 14px; }
.card .extra { color: #8a6a45; font-size: 13px; min-height: 0; }
.card .extra:empty { display: none; }
.card button.primary { background: #1d1710; color: var(--amber); border-color: #1d1710; }
.card.broken h2 { color: #8b2a1d; }

/* ---------- reveal ---------- */
.reveal { max-width: 640px; margin: 0 auto; }
.rv-title { font: 900 38px/1.1 var(--serif); margin: 12px 0 10px; letter-spacing: .08em; }
.scores { display: grid; grid-template-columns: repeat(3, 1fr) 1.3fr; gap: 6px; }
.scores div { border: 1px solid var(--line); padding: 8px 6px; text-align: center; }
.scores b { display: block; font: 900 22px var(--serif); font-variant-numeric: tabular-nums; }
.scores .tot b { color: var(--amber); }
.scores span { color: var(--dim); font-size: 11px; }
.dossier.open .v b { font: 900 15px var(--serif); color: var(--amber); }
.dossier.open .reveal-in { animation: unredact .9s ease-out both; }
@keyframes unredact { from { background: var(--paper); color: transparent; } to { background: transparent; } }
#replay { display: block; width: 100%; height: 220px; background: var(--chart); border: 1px solid var(--line); }
.replay-note { color: var(--dim); font-size: 11.5px; margin: 6px 0 0; }
.reveal h3 { margin: 22px 0 6px; color: var(--muted); font: 500 14px var(--serif); letter-spacing: .1em; }
.newslist { list-style: none; padding: 0; margin: 0; }
.newslist li { padding: 10px 0; border-bottom: 1px solid var(--line); font: 900 14.5px/1.45 var(--serif); }
.newslist small { display: block; color: var(--dim); font: 400 11.5px var(--sans); margin-top: 3px; }
.newslist a { color: var(--amber); }
.newslist .rvnote { display: block; margin-top: 4px; font: 500 12.5px/1.5 var(--sans); color: var(--muted); }
.newslist .rvnote b { color: var(--ink, inherit); font-weight: 700; }
.newslist li.dim { opacity: .62; }

@media (min-width: 760px) {
  .clip { max-width: 560px; }
  .slider { width: 80px; }
}
@media (prefers-reduced-motion: reduce) {
  .redact::after { animation: none; }
  .clip, .ddbar i { transition: none; }
  .dossier.open .reveal-in { animation: none; }
}

/* major-news pause: the card sits top-left so the knob stays reachable */
.overlay.pause { pointer-events: none; background: transparent; align-items: flex-start; justify-content: flex-start; padding: calc(var(--gutter) + 90px) calc(var(--gutter) + 78px) var(--gutter) var(--gutter); }
.overlay.pause .card { pointer-events: auto; box-shadow: 0 14px 40px rgba(0,0,0,.75); }
.card.event h2 { font-size: 19px; line-height: 1.35; white-space: pre-line; letter-spacing: .02em; }

/* every headline now pauses the game and is shown in the popup, so the clipping strip is gone and the chart gets its height */
#news { display: none; }
.overlay.pause.right { justify-content: flex-end; }

/* ---------- briefing / news card facts ---------- */
:root { --rival: #5fc4b8; }
.card .meta { color: #6b5d48; font: 400 12px/1.5 var(--sans); white-space: pre-line; margin: .1em 0 .5em; }
.card .meta:empty { display: none; }
.card .facts { list-style: none; padding: 0; margin: .7em 0 .3em; text-align: left; border-top: 1px solid rgba(29,23,16,.22); }
.card .facts:empty { display: none; }
.card .facts li { display: grid; grid-template-columns: 5.2em 1fr; gap: 8px; padding: 5px 0; border-bottom: 1px solid rgba(29,23,16,.12); font-size: 13px; line-height: 1.45; }
.card .facts .k { color: #8a6a45; }
.card .facts .v { color: #1d1710; }
.card .facts .v em { font-style: normal; font-weight: 700; }
.card .facts .v .redbar { display: inline-block; width: 4.6em; height: .85em; background: #1d1710; vertical-align: -1px; margin-right: .4em; }
.card.briefing { max-width: 420px; }
.card.briefing h2 { font-size: 26px; }
.card .zh { display: block; font: 500 13px/1.45 var(--sans); color: #4d4232; letter-spacing: 0; margin-top: .35em; }
.card .tag { display: inline-block; font: 700 11px var(--sans); letter-spacing: .06em; color: #8b2a1d; border: 1px solid #8b2a1d; padding: 0 6px; margin-right: 6px; vertical-align: 1px; }
.overlay.pause .card { max-width: 400px; }
.overlay.pause .card.event h2 .hl { display: block; }
.overlay.pause .card.event h2 .hl + .hl { margin-top: .5em; padding-top: .5em; border-top: 1px solid rgba(29,23,16,.2); }

/* ---------- challenge ---------- */
.chnote { margin: 10px 0 0; padding: 10px 14px; border: 1px solid var(--rival); color: var(--paper); background: rgba(95,196,184,.07); font: 500 14px/1.6 var(--serif); }
.chnote.err { border-color: var(--danger); background: rgba(214,80,60,.08); }
.chnote b { color: var(--rival); }
.chbox { margin-top: 22px; padding: 14px; border: 1px solid var(--line); background: rgba(255,240,215,.03); }
.chbox h3 { margin: 0 0 6px; }
.chbox input[type=text] { width: 100%; min-height: 44px; margin-top: 4px; padding: 8px 12px; font: inherit; color: var(--paper); background: var(--chart); border: 1px solid var(--line); border-radius: 2px; }
.chbox input.chlink { margin-top: 10px; font-size: 12px; color: var(--muted); }
.verdict { margin: 10px 0 12px; padding: 12px 14px; border: 1px solid var(--line); font: 900 22px/1.3 var(--serif); }
.verdict small { display: block; margin-top: 4px; font: 400 13px var(--sans); color: var(--muted); }
.verdict.win { border-color: var(--amber); color: var(--amber); }
.verdict.lose { border-color: var(--rival); color: var(--rival); }
.cmp-table { width: 100%; border-collapse: collapse; margin: 6px 0 10px; text-align: center; font-variant-numeric: tabular-nums; }
.cmp-table th { color: var(--dim); font: 400 11.5px var(--sans); padding: 4px 6px; }
.cmp-table th.me { color: var(--amber); } .cmp-table th.them { color: var(--rival); }
.cmp-table td { padding: 7px 6px; border-top: 1px solid var(--line); font: 900 18px var(--serif); color: var(--muted); }
.cmp-table td.mid { font: 400 12px var(--sans); color: var(--dim); }
.cmp-table td.w { color: var(--paper); }
.cmp-table tr.tot td { border-top: 2px solid var(--line); }
.cmp-table tr.tot td.w { color: var(--amber); }
.cmp-table td.w.them { color: var(--rival); }
.cmp { display: grid; grid-template-columns: 1fr; gap: 12px; margin-top: 8px; }
.cmp-panel h4 { margin: 0 0 4px; font: 500 13px var(--serif); letter-spacing: .08em; color: var(--muted); }
.cmp-panel h4.me { color: var(--amber); } .cmp-panel h4.them { color: var(--rival); }
.cmp-panel canvas { display: block; width: 100%; height: 190px; background: var(--chart); border: 1px solid var(--line); }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 4px; color: var(--dim); font-size: 11.5px; }
.legend i { display: inline-block; width: 16px; height: 0; border-top: 3px solid currentColor; vertical-align: 3px; margin-right: 5px; }
@media (min-width: 760px) {
  .reveal.wide { max-width: 980px; }
  .cmp.two { grid-template-columns: 1fr 1fr; }
  .cmp-panel canvas { height: 230px; }
}
.newslist .zhg { display: block; font: 500 13px/1.45 var(--sans); color: var(--muted); margin-top: 2px; }
.cmp-table td small { display: block; font: 400 11px var(--sans); color: var(--dim); }
.chbox .primary[disabled] { opacity: .5; }

[hidden] { display: none !important; }   /* button.primary / .scores etc. set display and would otherwise win over the hidden attribute */
.cmp-table { max-width: 560px; margin-left: auto; margin-right: auto; }
