:root {
  --bg: #07090f; --bg2: #0d1220; --card: #101729; --line: #1f2a44; --ink: #e6ecf5; --dim: #8d98ad; --mute: #5d6880;
  --up: #3ddc84; --down: #ff4d6d; --gold: #ffb547; --cyan: #5ad1ff;
  --mono: 'JetBrains Mono', ui-monospace, monospace; --sans: 'Space Grotesk', system-ui, sans-serif;
  --top: 52px; --ca: 60px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.45 var(--sans); overflow-x: hidden; padding-bottom: calc(var(--ca) + env(safe-area-inset-bottom)); }
button, input { font: inherit; color: inherit; }
a { color: var(--cyan); }
[hidden] { display: none !important; }

.announce { background: var(--gold); color: #1a1205; font-weight: 700; text-align: center; padding: 8px 16px; }

/* header */
.top { position: sticky; top: 0; z-index: 20; height: var(--top); display: flex; align-items: center; gap: 10px; padding: 0 12px;
  background: rgba(7, 9, 15, .92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 9px; text-decoration: none; color: var(--ink); min-width: 0; }
.brand img { border-radius: 50%; flex: none; }
.brand span { display: flex; flex-direction: column; line-height: 1.1; min-width: 0; }
.brand b { font-size: 17px; letter-spacing: .06em; }
.brand i { font: 500 10px var(--mono); color: var(--gold); font-style: normal; white-space: nowrap; }
.rec { margin-left: auto; display: flex; align-items: baseline; gap: 6px; font-family: var(--mono); }
.rec .k { font-size: 10px; color: var(--dim); text-transform: uppercase; letter-spacing: .1em; }
.rec b { font-size: 17px; white-space: nowrap; }
.rec { white-space: nowrap; }
.streak { font-size: 11px; color: var(--gold); }
@media (max-width: 480px) { .streak { display: none; } .rec .k { display: none; } }
.mute { width: 44px; height: 44px; border: 1px solid var(--line); background: var(--bg2); border-radius: 10px; cursor: pointer; flex: none; }
.mute .off { display: none; } .mute.off .on { display: none; } .mute.off .off { display: inline; }

/* stage */
.wrap { display: block; }
.stage { position: relative; height: min(96vw, 420px); min-height: 300px; background: radial-gradient(ellipse at 50% 45%, #121c33 0%, var(--bg) 70%); overflow: hidden; }
#room { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.sides { position: absolute; left: 0; right: 0; top: 8px; display: flex; justify-content: space-between; padding: 0 12px; pointer-events: none; }
.side { display: flex; flex-direction: column; align-items: center; font-family: var(--mono); }
.side b { font-size: 22px; line-height: 1; }
.side span { font-size: 10px; letter-spacing: .2em; }
.side.up { color: var(--up); } .side.down { color: var(--down); }
.phase { position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); font: 700 12px var(--mono); letter-spacing: .08em; text-transform: uppercase;
  background: rgba(13, 18, 32, .85); border: 1px solid var(--line); padding: 6px 12px; border-radius: 999px; white-space: nowrap; max-width: calc(100% - 24px); overflow: hidden; text-overflow: ellipsis; }
.phase.hit { color: var(--gold); border-color: var(--gold); }
.phase.miss { color: var(--dim); }
.bubble { position: absolute; left: 10px; right: 10px; bottom: 46px; background: rgba(13, 18, 32, .94); border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px;
  transition: opacity .25s; }
.bubble.u { border-color: rgba(61, 220, 132, .6); } .bubble.d { border-color: rgba(255, 77, 109, .6); }
.bubble .who { font: 700 11px var(--mono); color: var(--dim); text-transform: uppercase; letter-spacing: .06em; }
.bubble .who b { color: var(--ink); }
.bubble .who .mine { color: var(--cyan); }
.bubble .said { font-size: 16px; font-weight: 700; margin-top: 2px; }
.toast { position: absolute; left: 50%; top: 44px; transform: translateX(-50%); background: var(--cyan); color: #04121a; font: 700 13px var(--sans); padding: 7px 14px; border-radius: 999px;
  box-shadow: 0 6px 24px rgba(90, 209, 255, .35); white-space: nowrap; max-width: calc(100% - 24px); overflow: hidden; text-overflow: ellipsis; }
.toast.leave { background: #2a3350; color: var(--ink); box-shadow: none; }

.mine { position: absolute; left: 50%; top: 8px; transform: translateX(-50%); font: 700 12px var(--mono); color: var(--cyan); background: rgba(13, 18, 32, .9);
  border: 1px solid var(--cyan); border-radius: 999px; padding: 6px 12px; text-decoration: none; white-space: nowrap; max-width: 52%; overflow: hidden; text-overflow: ellipsis; }
.mine b { color: var(--ink); }

/* cards */
.panel { padding: 10px 10px 16px; display: flex; flex-direction: column; gap: 10px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px; }
.card h2 { margin: 0 0 8px; font: 700 11px var(--mono); text-transform: uppercase; letter-spacing: .14em; color: var(--dim); display: flex; align-items: center; gap: 8px; }
.engine { margin-left: auto; color: var(--mute); letter-spacing: .04em; text-transform: none; font-weight: 500; }

.coin { display: grid; grid-template-columns: 52px 1fr auto; gap: 10px; align-items: center; }
.coin img { width: 52px; height: 52px; border-radius: 10px; object-fit: cover; background: var(--bg2); border: 1px solid var(--line); }
.cn { min-width: 0; display: flex; flex-direction: column; }
.cn b { font-size: 20px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cn span { color: var(--dim); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mc { text-align: right; display: flex; flex-direction: column; font-family: var(--mono); }
.mc .k { font-size: 9px; color: var(--dim); text-transform: uppercase; letter-spacing: .1em; }
.mc b { font-size: 17px; }
.chg { font-size: 12px; }
.chg.u { color: var(--up); } .chg.d { color: var(--down); }
#chart { width: 100%; height: 90px; display: block; margin: 8px 0 6px; }
.cons .bar { display: flex; height: 12px; border-radius: 6px; overflow: hidden; background: var(--bg2); }
.cons .bar i { display: block; height: 100%; transition: width .4s; }
#consUp { background: var(--up); width: 50%; } #consDown { background: var(--down); width: 50%; }
.cons .lbl { display: flex; justify-content: space-between; font: 700 12px var(--mono); margin-top: 4px; }
.cons .lbl span:first-child { color: var(--up); } .cons .lbl span:last-child { color: var(--down); }
.status { margin-top: 8px; font: 700 14px var(--mono); text-align: center; }
.status .u { color: var(--up); } .status .d { color: var(--down); } .status .g { color: var(--gold); }
.pending { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
.pending div { font: 500 12px var(--mono); color: var(--dim); display: flex; justify-content: space-between; gap: 8px; border-top: 1px dashed var(--line); padding-top: 6px; }

.lines { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; max-height: 340px; overflow-y: auto; }
.lines li { display: grid; grid-template-columns: 10px 1fr auto; gap: 8px; align-items: start; animation: pop .35s ease-out; }
.lines li .dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 5px; }
.lines li .t { min-width: 0; }
.lines li .n { font: 700 11px var(--mono); color: var(--dim); text-transform: uppercase; letter-spacing: .04em; }
.lines li .n b { color: var(--ink); }
.lines li .n .h { color: var(--cyan); }
.lines li .s { font-size: 15px; }
.lines li .v { font: 700 11px var(--mono); padding: 2px 6px; border-radius: 6px; margin-top: 2px; }
.v.u { color: var(--up); background: rgba(61, 220, 132, .12); } .v.d { color: var(--down); background: rgba(255, 77, 109, .12); }
.lines .wait { color: var(--mute); font-size: 13px; display: block; }
@keyframes pop { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.me .agent { display: grid; grid-template-columns: 44px 1fr; gap: 10px; align-items: center; }
.me .face { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font: 700 16px var(--mono); color: #07090f; }
.me .an b { font-size: 18px; display: block; }
.me .an span { color: var(--dim); font-size: 13px; }
.me .stats { display: flex; gap: 14px; margin-top: 8px; font: 500 12px var(--mono); color: var(--dim); flex-wrap: wrap; }
.me .stats b { color: var(--ink); }
.me p { margin: 0; color: var(--dim); }
.find { display: flex; gap: 8px; margin-top: 10px; }
.find input { flex: 1; min-width: 0; height: 44px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg2); padding: 0 12px; font: 500 13px var(--mono); }
.find button { height: 44px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--line); background: #1a2440; font-weight: 700; cursor: pointer; }

.calllist, .leadlist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.calllist li { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; padding: 7px 0; border-top: 1px solid var(--line); font: 500 13px var(--mono); align-items: center; }
.calllist li:first-child { border-top: 0; }
.calllist .sym { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.calllist .sym i { color: var(--mute); font-style: normal; }
.res { font-weight: 700; padding: 2px 7px; border-radius: 6px; min-width: 52px; text-align: center; }
.res.hit { background: rgba(255, 181, 71, .16); color: var(--gold); } .res.miss { background: #1a2238; color: var(--dim); } .res.void, .res.open { color: var(--mute); }
.leadlist li { display: grid; grid-template-columns: 22px 1fr auto; gap: 8px; padding: 7px 0; border-top: 1px solid var(--line); align-items: center; font-size: 14px; }
.leadlist li:first-child { border-top: 0; }
.leadlist .rk { font: 700 13px var(--mono); color: var(--gold); }
.leadlist .w { font: 500 11px var(--mono); color: var(--mute); }
.leadlist .sc { font: 700 13px var(--mono); }
.empty { color: var(--mute); font-size: 13px; padding: 4px 0; }
.calllist li.empty, .leadlist li.empty { display: block; border: 0; }

.big .cd { font: 700 26px var(--mono); color: var(--gold); }
.big p { margin: 4px 0 0; color: var(--dim); font-size: 13px; }
.bigrow { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; padding: 6px 0; border-top: 1px solid var(--line); font: 500 13px var(--mono); }
.bigrow .bv { height: 6px; background: var(--cyan); border-radius: 3px; margin-top: 4px; }
.bigrow.pick { color: var(--gold); }
.bigrow.pick .bv { background: var(--gold); }

.how ul { margin: 0; padding-left: 18px; color: var(--dim); display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.how b { color: var(--ink); }
.fine { color: var(--mute); font-size: 12px; margin: 10px 0 0; }

/* CA bar */
.cabar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; gap: 8px; align-items: center; padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  background: rgba(7, 9, 15, .96); border-top: 1px solid var(--line); backdrop-filter: blur(8px); }
.ca { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; }
.ca .k { font: 700 10px var(--mono); color: var(--dim); }
.ca code { font: 500 12px var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--gold); }
.btn { height: 44px; padding: 0 14px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; text-decoration: none; cursor: pointer; white-space: nowrap; flex: none; }
.btn.ghost { border: 1px solid var(--line); background: var(--bg2); }
.btn.buy { background: var(--up); color: #04150b; border: 0; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .45; pointer-events: none; }

/* desktop */
@media (min-width: 980px) {
  :root { --top: 60px; }
  .top { padding: 0 20px; }
  .wrap { display: grid; grid-template-columns: minmax(0, 1fr) 420px; }
  .stage { position: sticky; top: var(--top); height: calc(100vh - var(--top) - var(--ca)); min-height: 520px; }
  .panel { padding: 14px 14px 20px; max-height: none; }
  .side b { font-size: 34px; } .side span { font-size: 12px; }
  .sides { top: 16px; padding: 0 28px; }
  .bubble { left: 50%; right: auto; bottom: 64px; transform: translateX(-50%); width: min(560px, calc(100% - 40px)); padding: 12px 16px; }
  .bubble .said { font-size: 22px; }
  .phase { bottom: 18px; font-size: 14px; }
}

/* the livestream view */
body.stream { padding-bottom: 0; overflow: hidden; }
body.stream .panel > :not(.round), body.stream .top .mute { display: none; }
body.stream .wrap { display: block; }
body.stream .stage { position: fixed; inset: var(--top) 0 var(--ca) 0; height: auto; }
body.stream .panel { position: fixed; right: 18px; top: calc(var(--top) + 70px); width: 400px; padding: 0; z-index: 10; }
body.stream .bubble { bottom: 70px; }
@media (max-width: 979px) { body.stream .panel { display: none; } }
@media (prefers-reduced-motion: reduce) { .lines li { animation: none; } }
