/* Draw the Rest: Market Edition. Same class names as /draw/style.css (the game code is shared); the terminal look is only these variables. */
:root {
  --paper: #0a0e0b; --paper2: #101611; --ink: #d9e4dc; --ink2: #8a9a8f; --rule: #1f2b22;
  --up: #22c55e; --down: #ef4444; --real: #22c55e; --you: #f5b83d; --base: #8f9d94; --tint: #16a34a;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, "Liberation Mono", monospace;
  --serif: var(--mono);
  --sans: system-ui, -apple-system, "Segoe UI", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 16px/1.5 var(--sans); min-height: 100vh; overflow-x: hidden; }
button, input { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--tint); outline-offset: 3px; }
[hidden] { display: none !important; }
.sr { position: absolute; top: 0; left: 0; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.top { max-width: 760px; margin: 0 auto; padding: 12px 16px 0; display: flex; justify-content: space-between; align-items: center; font-family: var(--sans); }
.back { color: var(--ink); text-decoration: none; font-size: 15px; padding: 6px 0; }
.back:hover { text-decoration: underline; }
.tool { background: transparent; border: 1.5px solid var(--ink2); border-radius: 999px; padding: 4px 12px; font: 600 14px var(--sans); cursor: pointer; min-height: 34px; }
.tool:hover { border-color: var(--tint); }

#app { max-width: 760px; margin: 0 auto; padding: 8px 16px 48px; }

.mast { border-bottom: 1px solid var(--tint); padding: 6px 0 10px; margin-bottom: 14px; display: flex; align-items: baseline; gap: 6px 14px; flex-wrap: wrap; }
.brand { font: 700 22px/1.1 var(--mono); margin: 0; color: var(--tint); letter-spacing: -.3px; }
.brand::before { content: "▲ "; font-size: 15px; vertical-align: 2px; }
.deck { font: 15px/1.4 var(--sans); margin: 0; color: var(--ink2); flex: 1 1 240px; }

.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 10px 22px; border: 1.5px solid var(--ink2); background: var(--paper2); color: var(--ink); font: 700 16px var(--sans); cursor: pointer; border-radius: 4px; touch-action: manipulation; }
.btn:hover { border-color: var(--ink); }
.btn.primary { background: var(--tint); border-color: var(--tint); color: #04130a; min-width: 160px; }
.btn.primary:hover { background: #1db556; border-color: #1db556; }
.btn:disabled { opacity: .35; cursor: not-allowed; }

.kicker { font: 700 13px var(--mono); color: var(--tint); margin: 6px 0 4px; text-transform: uppercase; letter-spacing: .08em; }
.r-title { font: 700 28px/1.15 var(--mono); margin: 0 0 4px; letter-spacing: -.5px; }
html:lang(zh-Hans) .r-title { font-family: var(--sans); font-size: 24px; }
.r-q { font: 14px/1.4 var(--mono); margin: 0 0 10px; color: var(--ink2); }
.chart-wrap { position: relative; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); padding: 6px 0 2px; background: #0c120d; }
.chart { display: block; width: 100%; touch-action: none; user-select: none; -webkit-user-select: none; cursor: crosshair; }
.chart:focus-visible { outline-offset: 0; }
.chart.locked { cursor: default; }
.c-grid { stroke: var(--rule); stroke-width: 1; }
.c-zero { stroke: var(--ink2); stroke-width: 1; stroke-dasharray: 2 3; }
.c-lab { font: 11px var(--mono); fill: var(--ink2); }
.c-hide { fill: var(--paper2); }
.c-split { stroke: var(--ink2); stroke-width: 1; stroke-dasharray: 3 4; }
.c-q { font: 700 46px var(--mono); fill: var(--ink2); opacity: .35; text-anchor: middle; }
.c-real { fill: none; stroke: var(--ink); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.c-truth { fill: none; stroke: var(--real); stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; }
.c-truth.down { stroke: var(--down); }
.c-truth.anim { transition: stroke-dashoffset 1.3s ease-in-out; }
.c-you { fill: none; stroke: var(--you); stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; }
.c-gap { fill: var(--you); opacity: .13; }
.c-base { fill: none; stroke: var(--base); stroke-width: 1.8; stroke-dasharray: 6 5; }
.c-tag { font: 700 11px var(--mono); paint-order: stroke; stroke: var(--paper2); stroke-width: 4px; stroke-linejoin: round; }
.c-tagbg { fill: var(--paper2); fill-opacity: .92; stroke: var(--rule); stroke-width: 1; }
.c-tag.base { fill: var(--base); } .c-tag.truth { fill: var(--real); } .c-tag.truth.down { fill: var(--down); } .c-tag.you { fill: var(--you); }
.c-anchor { fill: var(--you); }
.c-anchor.pulse { animation: pulse 1.4s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes pulse { 50% { transform: scale(1.7); opacity: .55; } }
.c-cursor { fill: none; stroke: var(--you); stroke-width: 2; }
.r-unit { font: 12px var(--mono); color: var(--ink2); margin: 4px 0 0; }
.r-help { font: 14px var(--sans); color: var(--ink2); margin: 6px 0 0; min-height: 1.5em; }
.disc { font: 12px var(--mono); color: var(--ink2); margin: 6px 0 0; }
.r-result { margin-top: 12px; }
.scores { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.sc { border-top: 3px solid var(--ink2); padding-top: 4px; font: 12px var(--mono); color: var(--ink2); min-width: 0; text-transform: uppercase; letter-spacing: .06em; }
.sc b { display: block; font: 700 38px/1.05 var(--mono); color: var(--ink); letter-spacing: -1px; }
.sc.you { border-top-color: var(--you); } .sc.you b { color: var(--you); }
.sc .nm { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.r-parts { font: 13px var(--mono); color: var(--ink2); margin: 8px 0 0; }
.r-line { font: 700 16px var(--sans); margin: 8px 0 4px; }
.r-fact { font: 16px/1.5 var(--sans); margin: 0; padding: 10px 0 0; border-top: 1px solid var(--rule); }
.r-dates { font: 12px/1.5 var(--mono); color: var(--ink2); margin: 6px 0 0; }
.r-src { font: 12px/1.5 var(--sans); color: var(--ink2); margin: 4px 0 0; }
.r-src a { color: var(--ink2); }
.r-actions { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.r-actions .btn.primary { flex: 1 1 auto; }

.share { border-top: 1px solid var(--tint); padding-top: 14px; margin-top: 26px; }
.share h2 { font: 700 18px/1.15 var(--mono); margin: 0 0 10px; }
html:lang(zh-Hans) .share h2 { font-family: var(--sans); }
.linkbox { display: block; width: 100%; margin-top: 10px; padding: 8px 10px; border: 1.5px solid var(--rule); background: var(--paper2); font: 13px var(--mono); }
.end-links { display: flex; gap: 10px 18px; flex-wrap: wrap; align-items: center; margin: 4px 0 12px; font: 700 15px var(--sans); }
.end-links a:not(.btn) { color: var(--ink); }
.status { min-height: 1.5em; margin: 8px 0 0; font: 14px var(--sans); }
.tally { font: 13px/1.5 var(--mono); color: var(--ink2); margin: 22px 0 0; }
.tally:empty { display: none; }
.how { margin-top: 18px; font: 14px/1.6 var(--sans); color: var(--ink2); border-top: 1px solid var(--rule); padding-top: 10px; }
.how summary { cursor: pointer; font-weight: 700; color: var(--ink); }
.how p { margin: 8px 0; }
.backline { margin: 24px 0 0; font-family: var(--sans); }
.backline a { color: var(--ink); }

@media (max-width: 520px) {
  .r-title { font-size: 22px; }
  html:lang(zh-Hans) .r-title { font-size: 20px; }
  .sc b { font-size: 30px; }
  .brand { font-size: 19px; }
}
/* Short frames (phone held sideways, GamePix 800x450): one-line masthead, chart sized to the space that is left, buttons pinned at the bottom */
@media (max-height: 560px) and (orientation: landscape) {
  .top { padding-top: 6px; }
  .back { padding: 2px 0; }
  .tool { min-height: 28px; padding: 2px 12px; }
  #app { padding-bottom: 0; }
  .mast { padding: 0 0 4px; margin-bottom: 6px; }
  .brand { font-size: 16px; }
  .deck, .mast [data-more], .how, .backline, .tally { display: none; }
  .kicker { margin: 0 0 2px; }
  .r-title { margin-bottom: 0; font-size: 18px; }
  .r-q { margin-bottom: 2px; font-size: 12px; }
  .r-unit { display: none; }   /* the % ticks say it; keeps the disclaimer and buttons on screen */
  .r-help { margin-top: 2px; min-height: 0; font-size: 13px; }
  .disc { margin-top: 2px; font-size: 11px; }
  .r-actions { position: sticky; bottom: 0; z-index: 5; margin-top: 4px; padding: 6px 0; background: var(--paper); }
  .r-actions .btn { min-height: 40px; padding: 6px 18px; }
}
@media (prefers-reduced-motion: reduce) {
  .c-truth.anim { transition: none; }
  .c-anchor.pulse { animation: none; }
}
.toast { position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); max-width: min(92vw, 420px); margin: 0; padding: 10px 16px; background: var(--ink); color: var(--paper); font: 600 15px/1.4 var(--sans); border-radius: 4px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 50; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }
@media (pointer: coarse) { .top a, .top .tool { min-height: 40px; display: inline-flex; align-items: center; } }
