/* ─────────────────────────────────────────────────────────────────────────
   beat-the-quant.css — the 1v1 duel "Beat the Quant".
   Ported from the prototype's inline <style>, scoped under #btq-root (native
   CSS nesting) so the duel's generic class names (.arena/.move/.field/.btn…)
   never collide with the app. #btq-root is a full-screen fixed overlay above
   everything (Kurus 199, modals 300, toasts 400).
   ───────────────────────────────────────────────────────────────────────── */

#btq-root {
  --bg: #0e1116; --ink: #eef2f7; --muted: #6f7c8f; --soft: #aeb8c7;
  --line: #26303d; --line2: #324053;
  --warm: #f0c267; --you: #ffe9c2; --you-glow: #f0c267;
  --cool: #7fb4ff; --quant: #9ab4ff; --quant-glow: #8f9bff;
  --green: #5fd0a0; --red: #ff8b8b;
  --disp: 'Fraunces', Georgia, serif;
  --body: 'Spline Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --mono: 'Spline Sans Mono', ui-monospace, Menlo, monospace;

  position: fixed; inset: 0; z-index: 500; overflow: hidden;
  background: var(--bg); color: var(--ink); font-family: var(--body);
  -webkit-font-smoothing: antialiased;

  & * { box-sizing: border-box; }
  & canvas { display: block; }

  /* ambient + texture layers */
  & .fluid { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; }
  & .grain { position: absolute; inset: 0; pointer-events: none; opacity: .03; z-index: 1; mix-blend-mode: overlay;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); }
  & .vig { position: absolute; inset: 0; pointer-events: none; z-index: 1;
    background: radial-gradient(125% 95% at 50% 40%, transparent 50%, rgba(10, 12, 16, .78) 100%); }

  & .stage { position: absolute; inset: 0; z-index: 2; will-change: transform; }

  /* the arena */
  & .arena { position: absolute; inset: 0; display: grid; grid-template-rows: auto 1fr auto; align-items: stretch; }

  & .fighter { display: flex; align-items: center; gap: 16px; padding: 18px 26px 0; }
  & .fighter.you { flex-direction: row-reverse; text-align: right; padding-bottom: 0; }
  & .orb { width: 96px; height: 96px; flex: none; position: relative; }
  & .orb canvas { width: 100%; height: 100%; }
  & .fmeta { flex: 1; min-width: 0; max-width: 360px; }
  & .fname { font-family: var(--disp); font-weight: 500; font-size: clamp(18px, 2.4vw, 24px); letter-spacing: -.01em; line-height: 1; }
  & .ftag { font-family: var(--mono); font-size: 10px; letter-spacing: .24em; text-transform: uppercase; color: var(--muted); margin-top: 6px; }
  & .you .ftag { color: var(--warm); }
  & .quant .ftag { color: var(--cool); }
  & .bar { position: relative; height: 9px; border-radius: 99px; background: rgba(255, 255, 255, .05); border: .5px solid var(--line); margin-top: 11px; overflow: hidden; }
  & .bar .fill { position: absolute; inset: 0; width: 83%; border-radius: 99px; transform-origin: left; background: var(--soft); transition: background .25s linear; }
  & .you .bar .fill { transform-origin: right; left: auto; right: 0; }
  & .stack { display: flex; align-items: baseline; gap: 8px; margin-top: 9px; }
  & .you .stack { flex-direction: row-reverse; }
  & .stack .v { font-family: var(--disp); font-weight: 500; font-variant-numeric: tabular-nums; font-size: 20px; letter-spacing: -.01em; }
  & .stack .d { font-family: var(--mono); font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
  & .stake { font-family: var(--mono); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin-top: 7px; }

  /* the chart = battlefield */
  & .field { position: relative; margin: 6px 22px 0; border-radius: 16px; overflow: hidden; border: .5px solid var(--line); background: linear-gradient(180deg, rgba(20, 25, 34, .35), rgba(14, 17, 22, .1)); }
  & .field canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
  & .badge { position: absolute; left: 50%; top: 14px; transform: translateX(-50%); z-index: 3; opacity: 0;
    font-family: var(--mono); font-size: 11px; letter-spacing: .36em; text-transform: uppercase; color: var(--soft);
    padding: 6px 14px; border: .5px solid var(--line2); border-radius: 99px; background: rgba(14, 17, 22, .6);
    -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); white-space: nowrap; }
  & .qcard { position: absolute; right: 16px; top: 16px; z-index: 4; width: 208px; opacity: 0; transform-origin: right center;
    background: rgba(18, 22, 32, .92); border: .5px solid var(--line2); border-radius: 13px; padding: 13px 14px;
    -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); box-shadow: 0 14px 40px rgba(0, 0, 0, .45); }
  & .qcard .h { font-family: var(--mono); font-size: 9.5px; letter-spacing: .2em; text-transform: uppercase; color: var(--cool); }
  & .qcard .alloc { font-size: 12.5px; color: var(--soft); line-height: 1.55; margin: 7px 0 9px; }
  & .qcard .alloc b { color: var(--ink); font-weight: 500; }
  & .qcard .conf { font-family: var(--mono); font-size: 11px; color: var(--muted); border-top: .5px solid var(--line); padding-top: 8px; }
  & .qcard .conf b { color: var(--red); }

  /* speech (quant taunts top-center) */
  & .speech { position: absolute; left: 50%; top: 118px; transform: translateX(-50%); z-index: 5; max-width: min(560px, 86vw); text-align: center; opacity: 0; pointer-events: none; }
  & .speech .q { font-family: var(--disp); font-style: italic; font-weight: 500; font-size: clamp(15px, 2vw, 20px); line-height: 1.4; letter-spacing: -.01em; text-shadow: 0 2px 22px rgba(0, 0, 0, .6); }
  & .speech .q em { font-style: normal; color: var(--cool); }
  & .speech .by { font-family: var(--mono); font-size: 9.5px; letter-spacing: .26em; text-transform: uppercase; color: var(--muted); margin-top: 9px; }

  /* move bar */
  & .movebar { padding: 16px 22px 18px; }
  & .mb-prompt { text-align: center; font-family: var(--mono); font-size: 10px; letter-spacing: .24em; text-transform: uppercase; color: var(--muted); margin-bottom: 13px; }
  & .moves { display: flex; gap: 11px; justify-content: center; flex-wrap: wrap; max-width: 760px; margin: 0 auto; }
  & .move { position: relative; width: 168px; text-align: left; cursor: pointer; border: .5px solid var(--line); border-radius: 13px; padding: 13px 14px 14px; background: rgba(20, 25, 34, .6);
    transition: transform .16s cubic-bezier(.2, .8, .2, 1), border-color .16s, box-shadow .16s, background .16s; }
  & .move:hover { transform: translateY(-3px); box-shadow: 0 14px 34px rgba(0, 0, 0, .4); }
  & .move::before { content: ""; position: absolute; left: 14px; top: 14px; width: 9px; height: 9px; border-radius: 50%; background: var(--mc); box-shadow: 0 0 12px 1px var(--mc); }
  & .move .mn { font-size: 14px; font-weight: 600; padding-left: 18px; }
  & .move .ms { font-family: var(--mono); font-size: 10px; letter-spacing: .04em; color: var(--muted); margin-top: 6px; padding-left: 18px; }
  & .ticker { margin-top: 14px; text-align: center; font-family: var(--mono); font-size: 10px; letter-spacing: .08em; color: var(--muted); opacity: .7; display: flex; gap: 9px; justify-content: center; align-items: center; flex-wrap: wrap; }
  & .ticker .dot { display: inline-block; width: 5px; height: 5px; border-radius: 50%; background: var(--cool); box-shadow: 0 0 8px 1px var(--cool); animation: btq-pulse 2.2s ease-in-out infinite; }

  /* VS splash */
  & .vs { position: absolute; inset: 0; z-index: 20; display: flex; align-items: center; justify-content: center; background: radial-gradient(120% 90% at 50% 45%, rgba(20, 25, 34, .4), rgba(8, 10, 14, .94)); }
  & .vs-inner { position: relative; width: 100%; max-width: 760px; display: flex; align-items: center; justify-content: space-between; padding: 0 6vw; }
  & .vs-side { text-align: center; }
  & .vs-side .lab { font-family: var(--mono); font-size: 11px; letter-spacing: .34em; text-transform: uppercase; color: var(--muted); }
  & .vs-side .nm { font-family: var(--disp); font-weight: 500; font-size: clamp(26px, 5vw, 46px); letter-spacing: -.02em; line-height: 1.04; margin-top: 8px; }
  & .vs-you .nm { color: var(--you); }
  & .vs-quant .nm { color: var(--quant); }
  & .vs-you .lab { color: var(--warm); }
  & .vs-quant .lab { color: var(--cool); }
  & .vs-mark { font-family: var(--disp); font-style: italic; font-weight: 500; font-size: clamp(34px, 7vw, 72px); color: var(--ink); position: relative; }
  & .vs-mark::after { content: ""; position: absolute; left: 50%; top: 50%; width: 160%; height: 1px; background: linear-gradient(90deg, transparent, var(--line2), transparent); transform: translate(-50%, -50%) rotate(-18deg); z-index: -1; }
  & .vs-round { position: absolute; left: 0; right: 0; bottom: 13%; text-align: center; font-family: var(--mono); font-size: 11px; letter-spacing: .22em; text-transform: uppercase; color: var(--soft); padding: 0 24px; line-height: 1.8; }
  & .vs-round b { color: var(--red); }

  /* serious beat */
  & .dim { position: absolute; inset: 0; z-index: 14; background: rgba(8, 10, 14, .6); opacity: 0; pointer-events: none; -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); }
  & .serious { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 16; width: min(520px, 88vw); text-align: center; opacity: 0; pointer-events: none; }
  & .serious .eye { font-family: var(--mono); font-size: 10px; letter-spacing: .3em; text-transform: uppercase; color: var(--quant); display: flex; align-items: center; gap: 9px; justify-content: center; }
  & .serious .eye .d { width: 8px; height: 8px; border-radius: 50%; background: var(--quant-glow); box-shadow: 0 0 12px 2px var(--quant-glow); }
  & .serious .l { font-family: var(--disp); font-weight: 500; font-size: clamp(19px, 2.7vw, 27px); line-height: 1.4; letter-spacing: -.01em; margin-top: 16px; }
  & .serious .l b { color: var(--red); font-weight: 500; font-variant-numeric: tabular-nums; }

  /* danger flash */
  & .flash { position: absolute; inset: 0; z-index: 13; pointer-events: none; opacity: 0; background: radial-gradient(120% 90% at 50% 60%, transparent 40%, rgba(255, 80, 80, .34) 100%); }

  /* reveal */
  & .reveal { position: absolute; inset: 0; z-index: 18; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 24px; opacity: 0; pointer-events: none; background: radial-gradient(120% 90% at 50% 45%, rgba(20, 25, 34, .35), rgba(8, 10, 14, .82)); }
  & .reveal.show { opacity: 1; pointer-events: auto; }
  & .reveal .verdict { font-family: var(--mono); font-size: 11px; letter-spacing: .3em; text-transform: uppercase; color: var(--muted); }
  & .reveal h1 { font-family: var(--disp); font-weight: 500; font-size: clamp(34px, 6vw, 62px); letter-spacing: -.02em; line-height: 1.04; margin: 10px 0 4px; }
  & .reveal h1.win { color: var(--warm); }
  & .reveal h1.lose { color: var(--quant); }
  & .reveal h1.tie { color: var(--soft); }
  & .reveal .score { font-family: var(--mono); font-size: 13px; color: var(--soft); font-variant-numeric: tabular-nums; letter-spacing: .04em; margin-bottom: 18px; }
  & .reveal .kq { font-family: var(--disp); font-style: italic; font-weight: 500; font-size: clamp(15px, 2vw, 19px); line-height: 1.5; max-width: 48ch; margin: 0 auto; color: var(--ink); }
  & .reveal .kq em { font-style: normal; color: var(--cool); }
  & .reveal .crowd { display: flex; align-items: center; gap: 8px; margin-top: 18px; font-family: var(--mono); font-size: 11px; letter-spacing: .04em; color: var(--soft); }
  & .reveal .crowd .d { width: 6px; height: 6px; border-radius: 50%; background: var(--warm); }
  & .reveal .credits { margin-top: 6px; font-family: var(--mono); font-size: 12px; letter-spacing: .1em; }
  & .reveal .credits.up { color: var(--green); }
  & .reveal .credits.down { color: var(--red); }
  & .reveal .btns { display: flex; gap: 11px; margin-top: 26px; flex-wrap: wrap; justify-content: center; }
  & .btn { display: flex; align-items: center; gap: 8px; font-size: 13px; font-family: var(--body); font-weight: 500; padding: 11px 18px; border-radius: 11px; border: .5px solid var(--line2); background: rgba(20, 25, 34, .7); color: var(--ink); cursor: pointer; transition: transform .14s, border-color .14s, box-shadow .14s; }
  & .btn:hover { transform: translateY(-2px); box-shadow: 0 12px 30px rgba(0, 0, 0, .4); }
  & .btn.primary { border-color: var(--warm); color: var(--warm); }
  & .btn .ic { font-family: var(--mono); font-size: 14px; }

  /* close (×) — added for the app overlay (the standalone prototype had no exit) */
  & .btq-close { position: absolute; right: 16px; top: 14px; z-index: 9; width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--muted); border: .5px solid var(--line); background: rgba(14, 17, 22, .6); font-size: 18px; line-height: 1; }
  & .btq-close:hover { color: var(--ink); border-color: var(--line2); }

  & .corner { position: absolute; left: 22px; top: 18px; z-index: 9; font-family: var(--mono); font-size: 10px; letter-spacing: .2em; text-transform: uppercase; color: var(--muted); }
  & .corner b { color: var(--soft); }
}

@keyframes btq-pulse { 0%, 100% { opacity: .4; } 50% { opacity: 1; } }

@media (max-width: 680px) {
  #btq-root .orb { width: 72px; height: 72px; }
  #btq-root .qcard { width: 170px; right: 10px; top: 10px; }
  #btq-root .move { width: 46%; }
  #btq-root .fighter { padding: 14px 16px 0; }
  #btq-root .field { margin: 6px 12px 0; }
  #btq-root .movebar { padding: 12px 14px 16px; }
}
@media (prefers-reduced-motion: reduce) { #btq-root * { animation-duration: .001ms !important; } }

/* ── Season mode (brokerage screen) — #btq-root.btq-season ─────────────────── */
#btq-root.btq-season {
  display: grid; grid-template-rows: auto auto 1fr; gap: 10px; padding: 14px 16px;
  font-family: var(--body); color: var(--ink);
}
#btq-root.btq-season .bs-loading { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-family: var(--mono); color: var(--muted); letter-spacing: .1em; }
#btq-root.btq-season .up { color: var(--green); }
#btq-root.btq-season .down { color: var(--red); }
#btq-root.btq-season .flat { color: var(--soft); }

#btq-root.btq-season .bs-top { display: flex; align-items: center; gap: 16px; }
#btq-root.btq-season .bs-title { font-family: var(--disp); font-size: 19px; }
#btq-root.btq-season .bs-day { font-family: var(--mono); font-size: 11px; letter-spacing: .12em; color: var(--soft); margin-left: auto; margin-right: 44px; }
#btq-root.btq-season .bs-day b { color: var(--ink); }

#btq-root.btq-season .bs-score { display: flex; align-items: center; justify-content: center; gap: 22px; padding: 10px; border: .5px solid var(--line2); border-radius: 14px; background: rgba(18,22,32,.55); }
#btq-root.btq-season .bs-side { display: flex; flex-direction: column; align-items: center; min-width: 150px; }
#btq-root.btq-season .bs-side.you .bs-lab { color: var(--warm); }
#btq-root.btq-season .bs-side.quant .bs-lab { color: var(--cool); }
#btq-root.btq-season .bs-lab { font-family: var(--mono); font-size: 10px; letter-spacing: .18em; text-transform: uppercase; }
#btq-root.btq-season .bs-val { font-family: var(--disp); font-size: 26px; font-variant-numeric: tabular-nums; }
#btq-root.btq-season .bs-pct { font-family: var(--mono); font-size: 12px; font-variant-numeric: tabular-nums; }
#btq-root.btq-season .bs-gap { font-family: var(--mono); font-size: 14px; font-variant-numeric: tabular-nums; padding: 4px 10px; border-radius: 99px; border: .5px solid var(--line2); }

#btq-root.btq-season .bs-main { display: grid; grid-template-columns: 1fr 280px; gap: 12px; min-height: 0; }
#btq-root.btq-season .bs-left { display: grid; grid-template-rows: 1fr auto; gap: 10px; min-height: 0; }
#btq-root.btq-season .bs-right { display: flex; flex-direction: column; gap: 10px; min-height: 0; }
#btq-root.btq-season .bs-chart-wrap { position: relative; border: .5px solid var(--line); border-radius: 12px; background: linear-gradient(180deg, rgba(20,25,34,.35), rgba(14,17,22,.1)); min-height: 150px; }
#btq-root.btq-season .bs-chart-wrap canvas { position: absolute; inset: 0; width: 100%; height: 100%; }

#btq-root.btq-season .bs-watch { overflow-y: auto; max-height: 38vh; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px 12px; align-content: start; }
#btq-root.btq-season .sec-group { }
#btq-root.btq-season .sec-label { font-family: var(--mono); font-size: 9px; letter-spacing: .2em; text-transform: uppercase; color: var(--muted); padding: 4px 0 2px; }
#btq-root.btq-season .btq-row { display: flex; align-items: baseline; gap: 8px; padding: 5px 8px; border-radius: 8px; cursor: pointer; border: .5px solid transparent; transition: background .12s, border-color .12s; }
#btq-root.btq-season .btq-row:hover { background: rgba(127,180,255,.07); }
#btq-root.btq-season .btq-row.sel { border-color: var(--cool); background: rgba(127,180,255,.12); }
#btq-root.btq-season .r-sym { font-weight: 600; font-size: 13px; flex: 1; }
#btq-root.btq-season .r-held { font-style: normal; font-size: 10px; color: var(--cool); margin-left: 4px; }
#btq-root.btq-season .r-px { font-family: var(--mono); font-size: 11px; color: var(--soft); font-variant-numeric: tabular-nums; }
#btq-root.btq-season .r-ch { font-family: var(--mono); font-size: 11px; font-variant-numeric: tabular-nums; min-width: 52px; text-align: right; }

#btq-root.btq-season .bs-positions { border: .5px solid var(--line); border-radius: 10px; padding: 10px; font-size: 12px; max-height: 30vh; overflow-y: auto; }
#btq-root.btq-season .pos-cash { font-family: var(--mono); color: var(--soft); margin-bottom: 6px; }
#btq-root.btq-season .pos-cash b { color: var(--ink); }
#btq-root.btq-season .pos-empty { color: var(--muted); font-style: italic; }
#btq-root.btq-season .pos-row { display: flex; justify-content: space-between; font-family: var(--mono); padding: 2px 0; color: var(--soft); font-variant-numeric: tabular-nums; }

#btq-root.btq-season .bs-ticket { border: .5px solid var(--line2); border-radius: 10px; padding: 12px; background: rgba(18,22,32,.6); }
#btq-root.btq-season .tk-hint { color: var(--muted); font-size: 12px; font-style: italic; }
#btq-root.btq-season .tk-head { font-weight: 600; margin-bottom: 8px; }
#btq-root.btq-season .tk-side { display: flex; gap: 6px; margin-bottom: 8px; }
#btq-root.btq-season .tk-side button { flex: 1; padding: 6px; border-radius: 7px; border: .5px solid var(--line2); background: transparent; color: var(--soft); cursor: pointer; font-size: 12px; }
#btq-root.btq-season .tk-side button.on { border-color: var(--cool); color: var(--cool); background: rgba(127,180,255,.12); }
#btq-root.btq-season .tk-qty { width: 64px; padding: 5px 8px; border-radius: 7px; border: .5px solid var(--line2); background: rgba(10,14,26,.6); color: var(--ink); font-family: var(--mono); }
#btq-root.btq-season .tk-est { font-family: var(--mono); font-size: 11px; color: var(--muted); margin: 8px 0; }
#btq-root.btq-season .tk-place { width: 100%; padding: 9px; border-radius: 8px; border: .5px solid var(--warm); background: rgba(240,194,103,.1); color: var(--warm); cursor: pointer; font-weight: 500; text-transform: capitalize; }

#btq-root.btq-season .bs-next { padding: 11px; border-radius: 9px; border: .5px solid var(--line2); background: rgba(20,25,34,.7); color: var(--ink); cursor: pointer; font-weight: 500; font-size: 14px; }
#btq-root.btq-season .bs-next:hover { border-color: var(--cool); }
#btq-root.btq-season .bs-kurus { font-family: var(--disp); font-style: italic; font-size: 13px; color: var(--soft); min-height: 18px; opacity: 0; transition: opacity .3s; }
#btq-root.btq-season .bs-kurus.show { opacity: 1; }

#btq-root.btq-season .bs-fomo { position: absolute; left: 50%; top: 76px; transform: translateX(-50%); z-index: 8; max-width: 90vw; padding: 10px 16px; border-radius: 12px; border: .5px solid var(--red); background: rgba(44,23,24,.92); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); font-size: 13px; opacity: 0; pointer-events: none; transition: opacity .3s, transform .3s; }
#btq-root.btq-season .bs-fomo.show { opacity: 1; pointer-events: auto; transform: translateX(-50%) translateY(0); }
#btq-root.btq-season .bs-fomo b { color: var(--red); }
#btq-root.btq-season #bsFomoX { margin-left: 10px; color: var(--muted); cursor: pointer; text-decoration: underline; font-size: 11px; }

#btq-root.btq-season .bs-rev-stats { display: flex; gap: 16px; justify-content: center; margin: 10px 0; font-family: var(--mono); font-size: 12px; color: var(--soft); }
#btq-root.btq-season .bs-rev-stats span { padding: 4px 10px; border: .5px solid var(--line); border-radius: 99px; }

@media (max-width: 720px) {
  #btq-root.btq-season .bs-main { grid-template-columns: 1fr; }
  #btq-root.btq-season .bs-score { gap: 10px; flex-wrap: wrap; }
  #btq-root.btq-season .bs-side { min-width: 110px; }
}
