/* Bot Arena — dark trading-floor identity. Tokens first, everything else derives from them. */
:root {
  --bg: #0a0f1e;            /* ink navy */
  --bg-2: #0f1628;
  --panel: #131c33;
  --panel-2: #182340;
  --line: #22304f;
  --fg: #e9edf7;
  --muted: #8f9ab5;
  --accent: #ffb547;        /* arena spotlight */
  --accent-2: #58c4ff;      /* cool data blue */
  --ok: #3ddc97;
  --warn: #ffc857;
  --bad: #ff5c7a;
  --font: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --r: 14px;
  --gap: 14px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--fg); font: 15px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
body { background: radial-gradient(1200px 600px at 80% -10%, rgba(88, 196, 255, .10), transparent 60%), radial-gradient(900px 500px at -10% 10%, rgba(255, 181, 71, .08), transparent 55%), var(--bg); min-height: 100%; padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px)); }
a { color: var(--accent-2); }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.wrap { max-width: 1180px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
h2 { font-size: 1.15rem; font-weight: 800; margin: 0; letter-spacing: -.01em; text-wrap: balance; }
h3 { font-size: 1rem; font-weight: 700; margin: 18px 0 6px; }
.note { color: var(--muted); font-size: .9rem; margin: 6px 0 12px; max-width: 72ch; }
.eyebrow { text-transform: uppercase; letter-spacing: .14em; font-size: .72rem; color: var(--accent); margin: 0 0 6px; font-weight: 700; }

/* top bar */
.top { position: sticky; top: 0; z-index: 20; backdrop-filter: blur(14px); background: rgba(10, 15, 30, .72); border-bottom: 1px solid var(--line); padding-top: env(safe-area-inset-top, 0px); }
.top-inner { display: flex; align-items: center; justify-content: space-between; height: 54px; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--fg); text-decoration: none; font-weight: 800; letter-spacing: -.01em; }
.mark { width: 26px; height: 26px; color: var(--accent); }
.mark-core { fill: var(--ok); }
.fresh { display: flex; align-items: center; gap: 8px; font-size: .8rem; color: var(--muted); white-space: nowrap; }
.live-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 0 rgba(61, 220, 151, .5); }
.live-dot.small { width: 7px; height: 7px; }
.live-dot.stale { background: var(--warn); }

/* hero */
.hero { display: grid; grid-template-columns: 1fr; gap: var(--gap); margin: 18px 0 14px; }
@media (min-width: 820px) { .hero { grid-template-columns: 1.4fr 1fr; align-items: stretch; } }
.hero-main, .hero-side { background: linear-gradient(180deg, var(--panel-2), var(--panel)); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; box-shadow: var(--shadow); min-width: 0; }
.hero-eq { display: flex; align-items: baseline; gap: 8px; }
.hero-eq .mono { font-size: clamp(2.2rem, 7vw, 3.6rem); font-weight: 600; letter-spacing: -.02em; line-height: 1; }
.hero-cur { color: var(--muted); font-size: 1.2rem; }
.hero-sub { margin: 8px 0 12px; color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px; font-size: .82rem; color: var(--muted); background: rgba(255, 255, 255, .02); }
.chip b { color: var(--fg); font-family: var(--mono); }
.chip.ok b { color: var(--ok); } .chip.bad b { color: var(--bad); }
.side-title { text-transform: uppercase; letter-spacing: .12em; font-size: .7rem; color: var(--muted); margin-bottom: 8px; font-weight: 700; }
.movers { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.movers li { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; font-size: .92rem; }
.movers .bar { height: 6px; border-radius: 3px; background: var(--line); position: relative; overflow: hidden; grid-column: 1 / -1; }
.movers .bar i { position: absolute; top: 0; bottom: 0; border-radius: 3px; }

/* ticker */
.ticker { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 10px 14px; margin-bottom: 18px; }
.ticker-head { display: flex; align-items: center; gap: 8px; font-size: .75rem; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); font-weight: 700; }
.ticker-row { display: flex; gap: 10px; overflow-x: auto; padding-top: 8px; scrollbar-width: none; }
.ticker-row::-webkit-scrollbar { display: none; }
.coin { flex: 0 0 auto; min-width: 150px; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; background: var(--bg-2); }
.coin .sym { font-weight: 800; font-size: .85rem; }
.coin .px { font-family: var(--mono); font-size: 1.05rem; }
.coin .chg { font-family: var(--mono); font-size: .8rem; }
.coin .held { color: var(--muted); font-size: .72rem; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* panes & controls */
.pane { margin: 8px 0 26px; scroll-margin-top: 70px; }
.pane[hidden] { display: none; }
.pane-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; padding: 3px; gap: 2px; background: var(--bg-2); }
.seg button, .btn { font: inherit; font-size: .82rem; font-weight: 600; color: var(--muted); background: transparent; border: 0; border-radius: 999px; padding: 6px 12px; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--fg); color: var(--bg); }
.btn { border: 1px solid var(--line); color: var(--fg); background: var(--panel); }
.btn.primary { background: var(--accent); color: #1a1200; border-color: var(--accent); }
.seg button:focus-visible, .btn:focus-visible, .chipbtn:focus-visible, .tabs button:focus-visible, th:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }
.controls { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 10px 0; }
.controls input[type=range] { flex: 1 1 140px; min-width: 120px; accent-color: var(--accent); }
.cursor-date { font-size: 1.1rem; font-weight: 600; }

/* bot cards */
.bots { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); gap: var(--gap); }
.bot { background: linear-gradient(180deg, var(--panel-2), var(--panel)); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; display: grid; gap: 8px; min-width: 0; position: relative; box-shadow: var(--shadow); transition: transform .25s ease, border-color .25s ease; }
.bot:hover { transform: translateY(-2px); border-color: #35497a; }
.bot.dead { opacity: .58; filter: saturate(.6); }
.bot .name { display: flex; align-items: center; gap: 8px; font-weight: 800; min-width: 0; }
.bot .name .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.led { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); flex: none; }
.led.alive { background: var(--ok); } .led.probation { background: var(--warn); } .led.dead { background: var(--bad); }
.bot .meta { display: flex; flex-wrap: wrap; gap: 6px 10px; color: var(--muted); font-size: .78rem; }
.pill { border: 1px solid var(--line); border-radius: 999px; padding: 0 8px; font-size: .72rem; color: var(--muted); }
.pill.conservative { color: var(--ok); border-color: rgba(61, 220, 151, .5); }
.pill.balanced { color: var(--accent-2); border-color: rgba(88, 196, 255, .5); }
.pill.aggressive { color: var(--warn); border-color: rgba(255, 200, 87, .5); }
.pill.degenerate { color: var(--bad); border-color: rgba(255, 92, 122, .5); }
.bot .eq { font-family: var(--mono); font-size: 1.7rem; font-weight: 600; letter-spacing: -.01em; line-height: 1.1; }
.bot .ret { font-family: var(--mono); font-size: .95rem; }
.pos { color: var(--ok); } .neg { color: var(--bad); } .warnc { color: var(--warn); }
.track { position: relative; height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; }
.track .fill { position: absolute; top: 0; bottom: 0; border-radius: 3px; }
.track .mid { position: absolute; top: -2px; bottom: -2px; width: 1px; background: var(--muted); }
.spark { height: 42px; }
.spark svg { width: 100%; height: 100%; display: block; }
.bot .foot { color: var(--muted); font-size: .8rem; }
.bot .hold { display: grid; gap: 6px; }
.hbar { display: flex; height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; }
.hbar i { display: block; height: 100%; min-width: 2px; }
.hlist { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: .78rem; color: var(--fg); }
.hitem { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.hitem i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; flex: none; }
.bot .plan { color: var(--warn); font-size: .8rem; }
.bot .more, .feed .more { justify-self: start; font: inherit; font-size: .76rem; font-weight: 600; color: var(--accent-2); background: none; border: 0; padding: 0; cursor: pointer; }
.bot.open { grid-column: 1 / -1; }
.detail { border-top: 1px solid var(--line); padding-top: 8px; display: grid; gap: 8px; font-size: .84rem; }
.detail h4 { margin: 0; font-size: .7rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 700; }
.detail p { margin: 0; }
.detail ul { margin: 0; padding-left: 1.1rem; color: var(--muted); display: grid; gap: 2px; }
.detail .trades { display: grid; gap: 3px; }
.detail .tr { display: grid; grid-template-columns: 7.2rem minmax(0, 1fr) auto; gap: 8px; font-family: var(--mono); font-size: .76rem; }
.detail .tr .d { color: var(--muted); white-space: nowrap; }
.feed-wrap { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; margin-bottom: 14px; }
.feed { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; }
.feed li { display: grid; grid-template-columns: auto 5.8rem minmax(0, 1fr); gap: 8px; align-items: baseline; font-size: .86rem; }
.feed li.one { grid-template-columns: 1fr; }
.feed .dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; align-self: center; background: var(--muted); }
.feed .when { color: var(--muted); font-family: var(--mono); font-size: .74rem; white-space: nowrap; }
.feed .who { font-weight: 700; }
.feed .amt { font-family: var(--mono); }
.feed .why { color: var(--muted); }

/* race */
.race { display: grid; grid-template-columns: 1fr; gap: var(--gap); }
@media (min-width: 860px) { .race { grid-template-columns: minmax(0, 2fr) minmax(240px, 1fr); } }
.chart { position: relative; min-height: 300px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 10px; }
.chart.short { min-height: 220px; }
.chart svg { width: 100%; height: auto; display: block; }
.tick text { fill: var(--muted); font-size: 11px; font-family: var(--mono); }
.tick line, .tick path { stroke: var(--line); }
.gridline { stroke: var(--line); } .zero { stroke: #3a4a73; stroke-dasharray: 4 4; }
.death { fill: var(--muted); font-size: 12px; }
.tip { position: absolute; pointer-events: none; display: none; background: #0c1327; border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; font-size: .8rem; box-shadow: var(--shadow); z-index: 2; max-width: 240px; }
.tip .h { color: var(--muted); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 8px; margin-bottom: 10px; }
.chipbtn { font: inherit; font-size: .78rem; display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; background: var(--bg-2); color: var(--fg); cursor: pointer; }
.chipbtn[aria-pressed="false"] { opacity: .4; }
.sw { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; }
.board { display: grid; gap: 6px; align-content: start; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 12px; }
.lane { display: grid; grid-template-columns: 1.4rem minmax(0, 1fr) 5rem; gap: 8px; align-items: center; font-size: .82rem; }
.lane .rank { color: var(--muted); text-align: right; font-family: var(--mono); }
.lane .lname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lane .lbar { height: 5px; border-radius: 3px; margin-top: 3px; }
.lane .lval { text-align: right; font-family: var(--mono); }
.lane.dead { opacity: .45; }

/* tables */
.scroll { overflow: auto; max-height: 520px; border: 1px solid var(--line); border-radius: var(--r); background: var(--panel); }
.scroll.tall { max-height: 360px; }
.tbl { width: 100%; border-collapse: collapse; font-size: .82rem; }
.tbl th, .tbl td { padding: 8px 10px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--line); }
.tbl th.txt, .tbl td.txt { text-align: left; }
.tbl th { position: sticky; top: 0; background: var(--panel-2); color: var(--muted); font-weight: 700; cursor: pointer; user-select: none; }
.tbl th[aria-sort="ascending"]::after { content: " ▲"; } .tbl th[aria-sort="descending"]::after { content: " ▼"; }
.tbl td { font-family: var(--mono); }
.tbl td.txt { font-family: var(--font); }
.two { display: grid; grid-template-columns: 1fr; gap: var(--gap); }
@media (min-width: 900px) { .two { grid-template-columns: 1fr 1fr; } }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; min-width: 0; }
.card h3 { margin-top: 0; }
.def { color: var(--muted); font-size: .88rem; padding-left: 1.1rem; display: grid; gap: 6px; }
.def b { color: var(--fg); }
.foot { color: var(--muted); font-size: .8rem; margin: 30px 0 10px; }

/* bottom tabs */
.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: grid; grid-template-columns: repeat(4, 1fr); background: rgba(10, 15, 30, .9); backdrop-filter: blur(14px); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom, 0px); }
.tabs button { font: inherit; font-size: .72rem; font-weight: 700; color: var(--muted); background: transparent; border: 0; padding: 10px 4px 8px; display: grid; justify-items: center; gap: 2px; cursor: pointer; }
.tabs button .ico { font-size: 1.1rem; line-height: 1; }
.tabs button[aria-pressed="true"] { color: var(--accent); }
@media (min-width: 820px) {
  body { padding-bottom: 20px; }
  .tabs { position: sticky; top: 54px; bottom: auto; grid-template-columns: repeat(4, auto); justify-content: center; gap: 6px; border-top: 0; border-bottom: 1px solid var(--line); padding: 6px 0; }
  .tabs button { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; font-size: .85rem; border-radius: 999px; }
  .tabs button[aria-pressed="true"] { background: rgba(255, 181, 71, .12); }
}

/* motion */
@media (prefers-reduced-motion: no-preference) {
  .live-dot { animation: pulse 2.2s ease-out infinite; }
  .led.alive { animation: pulse 2.4s ease-out infinite; }
  @keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(61, 220, 151, .55); } 70% { box-shadow: 0 0 0 7px rgba(61, 220, 151, 0); } 100% { box-shadow: 0 0 0 0 rgba(61, 220, 151, 0); } }
  .bot { animation: rise .5s ease-out both; }
  .bots.settled .bot { animation: none; }
  @keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
  .track .fill, .lane .lbar, .movers .bar i { transition: width .6s ease-out, left .6s ease-out; }
  .lane { transition: transform .6s ease-out; }
}
