/* The Pit. Layout: one continuous surface, no boxed cards. A full-bleed tick chart is the stage; the round board and tape sit
   in a left rail and the trade console in a right rail, separated by hairlines. Stacks to chart, console, board on a phone. */
:root {
  --bg: #07090c; --panel: #0c1015; --input: #0a0d11; --line: #1a212a; --border: #2b3542; --raised: #151b22;
  --fg: #dce3ea; --hi: #f5f8fb; --muted: #8291a1; --accent: #a9bccf; --steel: #7d9cbc;
  --green: #2fbf87; --red: #ea5a63; --green-bg: #0f241c; --red-bg: #2a151a; --blue-bg: #131c27;
  --on-accent: #07090c; --on-green: #03130c; --on-red: #1c0508;
  --font: Inter, -apple-system, "SF Pro Text", system-ui, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #ece4d4; --panel: #f1ebdf; --input: #f6f1e7; --line: #d6cab3; --border: #c4b598; --raised: #e2d8c5;
    --fg: #3d372f; --hi: #2a251f; --muted: #6c6356; --accent: #735c3f; --steel: #3f5d7a;
    --green: #3f6238; --red: #954737; --green-bg: #dfe2cc; --red-bg: #ecd8cc; --blue-bg: #e6dcc8;
    --on-accent: #f8f4ec; --on-green: #f8f4ec; --on-red: #f8f4ec;
    color-scheme: light;
  }
}
:root[data-theme="light"] {
  --bg: #ece4d4; --panel: #f1ebdf; --input: #f6f1e7; --line: #d6cab3; --border: #c4b598; --raised: #e2d8c5;
  --fg: #3d372f; --hi: #2a251f; --muted: #6c6356; --accent: #735c3f; --steel: #3f5d7a;
  --green: #3f6238; --red: #954737; --green-bg: #dfe2cc; --red-bg: #ecd8cc; --blue-bg: #e6dcc8;
  --on-accent: #f8f4ec; --on-green: #f8f4ec; --on-red: #f8f4ec;
  color-scheme: light;
}
html, body { height: 100%; margin: 0; }
[hidden] { display: none !important; }
body { background: var(--bg); color: var(--fg); font-family: var(--font); font-size: 14px; -webkit-font-smoothing: antialiased; }
* { box-sizing: border-box; }
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.35; }
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1, h2, p { margin: 0; }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.up { color: var(--green); } .down { color: var(--red); }
.muted { color: var(--muted); }
.label { font-size: 11px; font-weight: 600; letter-spacing: 0.09em; text-transform: uppercase; color: var(--muted); }

.app { height: 100%; display: flex; flex-direction: column; }
.gutter { padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }

/* ---- top bar ---- */
.top { position: relative; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px; height: 60px; flex: none; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand b { font-size: 21px; font-weight: 800; letter-spacing: -0.045em; color: var(--hi); white-space: nowrap; }
.brand b i { font-style: normal; color: var(--accent); }
.brand .by { font-size: 12px; color: var(--muted); white-space: nowrap; }
.tag { font-size: 10px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); border: 1px solid var(--border); border-radius: 6px; padding: 3px 7px; white-space: nowrap; }
.roundbox { display: flex; align-items: center; gap: 14px; }
.roundbox .clock { font-size: 26px; font-weight: 700; color: var(--hi); line-height: 1; }
.roundbox .clock.hot { color: var(--red); }
.roundbox .rn { display: flex; flex-direction: column; gap: 3px; align-items: flex-end; }
.roundbox .nx { display: flex; flex-direction: column; gap: 3px; }
.roundbox .v { font-size: 13px; font-weight: 600; color: var(--hi); white-space: nowrap; }
.right { display: flex; align-items: center; justify-content: flex-end; gap: 18px; min-width: 0; }
.live { display: flex; align-items: center; gap: 8px; font-size: 13px; white-space: nowrap; }
.dot { position: relative; width: 7px; height: 7px; border-radius: 50%; background: var(--green); }
.dot::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 1px solid var(--green); opacity: 0; animation: ping 2s ease-out infinite; }
@keyframes ping { 0% { transform: scale(0.5); opacity: 0.8; } 100% { transform: scale(1.6); opacity: 0; } }
.mode { display: flex; padding: 3px; border-radius: 9px; background: var(--raised); }
.mode button { height: 30px; padding: 0 11px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font-size: 12px; font-weight: 600; }
.mode button[aria-pressed="true"] { background: var(--panel); color: var(--hi); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25); }
.progress { position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; }
.progress i { display: block; height: 100%; background: var(--accent); transition: width 0.25s linear; }
.progress i.hot { background: var(--red); }

/* ---- main ---- */
.grid { flex: 1 1 auto; min-height: 0; display: grid; grid-template-columns: 308px minmax(0, 1fr) 356px; }
.rail { min-height: 0; overflow-y: auto; display: flex; flex-direction: column; background: var(--panel); }
.rail.l { border-right: 1px solid var(--line); }
.rail.r { border-left: 1px solid var(--line); }
.sec { padding: 16px 18px; border-bottom: 1px solid var(--line); }
.sec:last-child { border-bottom: 0; }
.sechead { display: flex; align-items: center; justify-content: space-between; padding-bottom: 10px; }

/* boards */
.board { position: relative; }
.brow { position: absolute; left: 0; right: 0; top: 0; height: 34px; display: flex; align-items: center; gap: 10px; padding: 0 8px; border-radius: 8px; transition: transform 0.45s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.3s; overflow: hidden; }
.brow .bar { position: absolute; top: 3px; bottom: 3px; right: 0; border-radius: 6px; opacity: 0.13; transition: width 0.4s; }
.brow > * { position: relative; }
.brow .rk { width: 18px; font-size: 12px; color: var(--muted); text-align: right; }
.brow.top3 .rk { color: var(--hi); font-weight: 700; }
.brow .nm { flex: 1 1 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.brow .pl { font-size: 13px; font-weight: 700; }
.brow .wn { font-size: 12px; color: var(--muted); width: 22px; text-align: right; }
.brow.you { background: var(--blue-bg); box-shadow: inset 0 0 0 1px var(--accent); }
.brow.you .nm { color: var(--hi); font-weight: 700; }
.brow.out .nm, .brow.out .av { opacity: 0.45; }
.av { width: 22px; height: 22px; flex: none; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 800; color: #fff; }
.av.me { background: var(--accent); color: var(--on-accent); }
.seg { display: flex; padding: 3px; border-radius: 10px; background: var(--raised); }
.seg button { flex: 1 1 0; height: 34px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-size: 13px; font-weight: 600; }
.seg button[aria-pressed="true"] { background: var(--panel); color: var(--hi); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25); }
.tape { display: flex; flex-direction: column; gap: 7px; font-size: 13px; }
.tape div { display: flex; align-items: center; gap: 8px; white-space: nowrap; overflow: hidden; }
.tape .t { flex: 1 1 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; color: var(--muted); }
.tape .t b { color: var(--fg); font-weight: 600; }

/* stage */
.stage { position: relative; min-width: 0; min-height: 0; display: flex; flex-direction: column; background: var(--bg); }
.cwrap { position: relative; flex: 1 1 auto; min-height: 320px; overflow: hidden; }
#cv { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.hud { position: absolute; left: 22px; top: 18px; right: 96px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 16px; pointer-events: none; }
.hud h1 { font-size: 40px; font-weight: 800; letter-spacing: -0.045em; line-height: 1; color: var(--hi); }
.hud .px { font-size: 34px; font-weight: 700; line-height: 1; }
.hud .mv { font-size: 13px; font-weight: 700; padding: 4px 8px; border-radius: 7px; }
.hud .mv.up { background: var(--green-bg); } .hud .mv.down { background: var(--red-bg); }
.hud .meta { flex-basis: 100%; font-size: 12px; color: var(--muted); padding-top: 4px; }
#tip { position: absolute; pointer-events: none; padding: 5px 10px; border-radius: 8px; background: var(--hi); color: var(--bg); font-size: 12px; font-weight: 600; white-space: nowrap; transform: translate(-50%, -160%); z-index: 2; }
.crowd { flex: none; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 14px; padding: 12px 22px; border-top: 1px solid var(--line); }
.crowd .side { font-size: 12px; font-weight: 700; white-space: nowrap; }
.crowd .bar { position: relative; height: 6px; border-radius: 999px; background: var(--red); overflow: hidden; }
.crowd .bar i { display: block; height: 100%; background: var(--green); transition: width 0.5s; }
.crowd .bar::after { content: ""; position: absolute; left: 50%; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--bg); }

/* console */
.hero { display: flex; flex-direction: column; gap: 10px; }
.hero .big { font-size: 40px; font-weight: 700; line-height: 1; color: var(--hi); }
.hero .sub { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; }
.cells { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 3px; }
.cells i { height: 8px; border-radius: 2px; background: var(--raised); transition: background 0.25s; }
.cells i.in { background: var(--accent); }
.cells i.gone { background: transparent; box-shadow: inset 0 0 0 1px var(--line); }
.rows { display: flex; flex-direction: column; gap: 12px; }
.crow { display: flex; flex-direction: column; gap: 6px; }
.crow .cl { display: flex; justify-content: space-between; align-items: baseline; }
.crow .cc { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 6px; }
.chip { height: 40px; padding: 0; border: 1px solid var(--line); border-radius: 10px; background: transparent; color: var(--fg); font-size: 13px; font-weight: 600; transition: background 0.12s, border-color 0.12s, transform 0.08s; }
.chip:hover:not(:disabled):not([aria-pressed="true"]) { border-color: var(--border); background: var(--raised); }
.chip:active:not(:disabled) { transform: scale(0.97); }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.note { font-size: 12px; color: var(--muted); line-height: 1.5; }
.ghost { height: 40px; border: 1px solid var(--line); border-radius: 10px; background: transparent; color: var(--fg); font-size: 13px; font-weight: 500; padding: 0 12px; display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; }
.ghost:hover { background: var(--raised); }
.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.go { position: relative; height: 68px; border: 0; border-radius: 14px; font-size: 18px; font-weight: 800; letter-spacing: -0.01em; display: flex; align-items: center; justify-content: center; gap: 8px; transition: transform 0.08s, filter 0.12s; }
.go::before { content: ""; position: absolute; inset: 0; border-radius: inherit; background: linear-gradient(180deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0) 55%); pointer-events: none; }
.go:hover:not(:disabled) { filter: brightness(1.08); }
.go:active:not(:disabled) { transform: translateY(1px) scale(0.985); }
.go.long { background: var(--green); color: var(--on-green); box-shadow: 0 10px 28px -12px var(--green); }
.go.short { background: var(--red); color: var(--on-red); box-shadow: 0 10px 28px -12px var(--red); }
.key { font-family: var(--mono); font-size: 10px; font-weight: 700; padding: 2px 5px; border-radius: 4px; border: 1px solid currentColor; opacity: 0.55; }
.closebtn { width: 100%; height: 76px; border: 1px solid var(--border); border-radius: 14px; background: var(--input); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; transition: transform 0.08s, border-color 0.2s, box-shadow 0.2s; }
.closebtn:active { transform: translateY(1px) scale(0.99); }
.closebtn .w { font-size: 11px; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.closebtn .p { font-size: 28px; font-weight: 700; line-height: 1.05; }
.closebtn.win { border-color: var(--green); box-shadow: 0 10px 30px -16px var(--green); }
.closebtn.lose { border-color: var(--red); box-shadow: 0 10px 30px -16px var(--red); }
.mid { height: 48px; border-radius: 12px; font-size: 14px; font-weight: 700; border: 1px solid var(--line); background: transparent; color: var(--fg); display: flex; align-items: center; justify-content: center; gap: 8px; }
.mid:hover:not(:disabled) { background: var(--raised); }
.mid.long { border-color: var(--green); color: var(--green); }
.mid.short { border-color: var(--red); color: var(--red); }
.kv { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font-size: 13px; }
.pending { display: flex; align-items: center; gap: 10px; border: 1px dashed var(--border); border-radius: 10px; padding: 6px 6px 6px 12px; font-size: 13px; }
.pending span { flex: 1 1 0; min-width: 0; }
.pending button { width: auto; flex: none; font-weight: 600; }
.busted { background: var(--red-bg); border: 1px solid var(--red); border-radius: 14px; padding: 18px; display: flex; flex-direction: column; gap: 8px; }
.busted b { font-size: 26px; font-weight: 800; letter-spacing: -0.03em; color: var(--red); }

/* overlays on the stage: kill feed, hot seat, stream board */
.hud { right: 330px; }
.feed { position: absolute; right: 92px; top: 16px; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; pointer-events: none; }
.feed div { display: flex; align-items: center; gap: 8px; padding: 5px 10px 5px 6px; border-radius: 9px; background: color-mix(in srgb, var(--panel) 88%, transparent); border: 1px solid var(--line); font-size: 12px; font-weight: 500; white-space: nowrap; animation: feedin 0.28s cubic-bezier(0.2, 0.8, 0.2, 1); transition: opacity 0.6s; }
.feed div.old { opacity: 0; }
.feed div.kill { border-color: var(--red); }
.feed div.win { border-color: var(--green); }
.feed b { color: var(--hi); font-weight: 700; }
.feed .av { width: 18px; height: 18px; font-size: 9px; }
@keyframes feedin { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.hot { position: absolute; left: 22px; bottom: 14px; display: flex; align-items: center; gap: 12px; padding: 9px 14px 9px 10px; border-radius: 12px; background: color-mix(in srgb, var(--panel) 88%, transparent); border: 1px solid var(--line); pointer-events: none; }
.hot .av { width: 30px; height: 30px; font-size: 13px; box-shadow: 0 0 0 2px var(--accent); }
.hot .c { display: flex; flex-direction: column; gap: 2px; }
.hot .n { font-size: 13px; font-weight: 700; color: var(--hi); }
.hot .p { font-size: 18px; font-weight: 700; padding-left: 6px; }
.ovboard { position: absolute; left: 22px; top: 128px; width: 250px; display: flex; flex-direction: column; gap: 5px; padding: 12px; border-radius: 12px; background: color-mix(in srgb, var(--panel) 88%, transparent); border: 1px solid var(--line); pointer-events: none; font-size: 13px; }
.ovboard div { display: flex; align-items: center; gap: 8px; }
.ovboard .nm { flex: 1 1 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.ovboard .rk { width: 14px; color: var(--muted); font-size: 12px; }
.ovboard .av { width: 20px; height: 20px; font-size: 9px; }
.tbtn { height: 30px; border: 1px solid var(--border); border-radius: 8px; background: transparent; color: var(--fg); padding: 0 11px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.tbtn[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.app.stream .rail, .app.stream .sim { display: none; }
.app.stream .grid { grid-template-columns: minmax(0, 1fr); }
#recap { position: fixed; inset: 0; z-index: 6; display: flex; align-items: center; justify-content: center; background: rgba(0, 0, 0, 0.6); padding: 16px; }
.rc { width: min(620px, 100%); background: var(--panel); border: 1px solid var(--border); border-radius: 18px; padding: 22px; display: flex; flex-direction: column; gap: 12px; box-shadow: 0 30px 80px -10px rgba(0, 0, 0, 0.6); }
.rc > b { font-size: 26px; font-weight: 800; letter-spacing: -0.035em; color: var(--hi); line-height: 1.1; }
.rcv { position: relative; height: 250px; border-radius: 12px; background: var(--bg); border: 1px solid var(--line); overflow: hidden; }
#rcv { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.rc .kv { font-size: 14px; align-items: center; }
.rc .kv { gap: 12px; }
.rc .kv > .num { font-size: 26px; font-weight: 700; flex: none; }
#rcCap { min-width: 0; line-height: 1.5; }
#rcCap .av { width: 20px; height: 20px; font-size: 9px; vertical-align: -5px; }

.sim { flex: none; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding-block: 8px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.sim button { height: 28px; border: 1px solid var(--border); border-radius: 7px; background: transparent; color: var(--fg); padding: 0 10px; font-size: 12px; font-weight: 600; }
#toast { position: fixed; left: 50%; top: calc(76px + env(safe-area-inset-top, 0px)); transform: translateX(-50%); width: max-content; max-width: calc(100% - 32px); z-index: 5; background: var(--panel); border: 1px solid var(--accent); border-radius: 16px; padding: 18px 26px; text-align: center; box-shadow: 0 24px 60px -10px rgba(0, 0, 0, 0.5); line-height: 1.5; }
#toast b { display: block; font-size: 20px; font-weight: 800; letter-spacing: -0.02em; color: var(--hi); }

@media (max-width: 1100px) {
  html, body { height: auto; }
  .app { height: auto; }
  .top { grid-template-columns: 1fr auto; height: auto; padding-block: 10px; row-gap: 8px; }
  .roundbox { grid-column: 1 / -1; grid-row: 2; justify-content: space-between; }
  .live { display: none; }
  .grid { grid-template-columns: minmax(0, 1fr); }
  .stage { order: 1; } .rail.r { order: 2; border-left: 0; border-top: 1px solid var(--line); } .rail.l { order: 3; border-right: 0; border-top: 1px solid var(--line); }
  .cwrap { flex: none; height: min(58vh, 460px); }
  .rail { overflow: visible; }
  .hud { left: 16px; right: 80px; top: 14px; }
  .feed { right: auto; left: 16px; top: auto; bottom: 62px; align-items: flex-start; }
  .hot { left: 16px; bottom: 10px; padding: 6px 10px 6px 8px; } .hot .p { font-size: 15px; }
  #stream { display: none; } .hud h1 { font-size: 28px; } .hud .px { font-size: 24px; }
  .chip, .seg button { height: 44px; }
  .key { display: none; }
}
/* the real site's extras: your name, the closed state, the watchers' vote, the name dialog */
.sim a { color: var(--fg); }
.closed { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 24px; text-align: center; }
.closed b { font-size: clamp(30px, 5vw, 56px); font-weight: 800; letter-spacing: -0.04em; color: var(--hi); line-height: 1; }
.closed span { color: var(--muted); font-size: 15px; max-width: 46ch; line-height: 1.6; }
.closed .num { color: var(--hi); font-weight: 700; }
.crowd button.side { border: 1px solid var(--line); background: transparent; border-radius: 8px; height: 30px; padding: 0 10px; }
.crowd button.side:hover { background: var(--raised); }
.crowd button.side[aria-pressed="true"] { border-color: currentColor; }
.bot { font-size: 9px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); border: 1px solid var(--border); border-radius: 4px; padding: 0 4px; margin-left: 6px; vertical-align: 1px; }
.overlay { position: fixed; inset: 0; z-index: 6; display: flex; align-items: center; justify-content: center; background: rgba(0, 0, 0, 0.6); padding: 16px; }
.rc input { height: 48px; border-radius: 12px; border: 1px solid var(--border); background: var(--input); color: var(--hi); font: inherit; font-size: 16px; font-weight: 600; padding: 0 14px; width: 100%; }
.rc input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.rc .primary { height: 48px; border-radius: 12px; border: 0; background: var(--accent); color: var(--on-accent); font-size: 14px; font-weight: 700; }
.how { width: min(480px, 100%); max-height: 100%; overflow-y: auto; gap: 16px; }
.how ol { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.how li { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 10px; font-size: 14px; line-height: 1.5; color: var(--fg); }
.how li .num { color: var(--muted); font-weight: 700; }
.how strong { color: var(--hi); font-weight: 700; }
.link { border: 0; background: transparent; color: var(--fg); font: inherit; padding: 0; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.link:hover { color: var(--hi); }
#meBtn { max-width: 190px; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 1100px) { #meBtn { max-width: 150px; } }
@media (max-width: 560px) { .by { display: none; } #meBtn { max-width: 112px; } }

@media (prefers-reduced-motion: reduce) { *, *::after { transition: none !important; animation: none !important; } }
