:root {
  --bg: #0f1216;
  --panel: #171b21;
  --panel2: #1e232b;
  --line: #2a313b;
  --text: #e6e9ee;
  --muted: #8b95a3;
  --up: #2fbf71;
  --down: #ef5350;
  --safe: #3fb6c9;
  --aggro: #f08a3c;
  --vwap: #e3b341;
  --fast: #6ea8fe;
  --slow: #b48cf2;
  --radius: 12px;
  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f4f6f9;
    --panel: #ffffff;
    --panel2: #eef1f5;
    --line: #dde2e8;
    --text: #151a21;
    --muted: #5d6876;
    --up: #138a4b;
    --down: #d23a36;
    --safe: #13879b;
    --aggro: #d0661a;
    --vwap: #b58105;
    --fast: #2f6fd8;
    --slow: #7a4fd0;
    color-scheme: light;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding-bottom: env(safe-area-inset-bottom);
}
h1 { font-size: 18px; margin: 0; letter-spacing: -0.01em; }
h2 { font-size: 13px; margin: 0 0 10px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.num { font-variant-numeric: tabular-nums; }
.up { color: var(--up); }
.down { color: var(--down); }
.muted { color: var(--muted); }

.top {
  position: sticky; top: 0; z-index: 5;
  display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; }
.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pill {
  padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: var(--panel2); border: 1px solid var(--line); white-space: nowrap;
}
.pill.live { color: var(--up); border-color: color-mix(in srgb, var(--up) 40%, var(--line)); }
.pill.demo { color: var(--vwap); border-color: color-mix(in srgb, var(--vwap) 40%, var(--line)); }
.pill.muted { color: var(--muted); font-weight: 500; }

.banner {
  margin: 12px 16px 0; padding: 10px 14px; border-radius: var(--radius);
  background: color-mix(in srgb, var(--vwap) 14%, var(--panel)); border: 1px solid color-mix(in srgb, var(--vwap) 35%, var(--line));
}
.banner.error { background: color-mix(in srgb, var(--down) 14%, var(--panel)); border-color: color-mix(in srgb, var(--down) 40%, var(--line)); }

main { padding: 12px 16px 24px; max-width: 1280px; margin: 0 auto; display: flex; flex-direction: column; gap: 12px; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.card-head h2 { margin: 0; }

.versus { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.bot { border-top: 3px solid var(--accent); }
.bot-name { font-size: 17px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); flex: none; }
.dot.on { background: var(--up); box-shadow: 0 0 0 3px color-mix(in srgb, var(--up) 25%, transparent); }
.blurb { color: var(--muted); font-size: 12.5px; margin: 2px 0 10px; }
.status { font-size: 13px; margin-bottom: 12px; }
.big { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; }
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px 12px; margin-top: 10px; }
.kpi .label { font-size: 11.5px; color: var(--muted); }
.kpi .value { font-size: 15px; font-weight: 600; }
.meter { margin-top: 12px; }
.meter .bar { height: 6px; background: var(--panel2); border-radius: 99px; overflow: hidden; margin-top: 4px; }
.meter .fill { height: 100%; background: var(--down); width: 0; transition: width .3s; }
.meter .fill.ok { background: var(--up); }

.btn {
  appearance: none; border: 1px solid var(--line); background: var(--panel2); color: var(--text);
  padding: 8px 14px; border-radius: 9px; font: inherit; font-weight: 600; cursor: pointer; min-height: 38px;
}
.btn:hover { border-color: var(--muted); }

.seg { display: flex; gap: 4px; background: var(--panel2); padding: 3px; border-radius: 10px; }
.seg button {
  border: 0; background: transparent; color: var(--muted); font: inherit; font-size: 12.5px; font-weight: 600;
  padding: 5px 10px; border-radius: 7px; cursor: pointer; white-space: nowrap;
}
.seg button.on { background: var(--panel); color: var(--text); box-shadow: 0 1px 2px rgb(0 0 0 / .2); }
.seg.scroll { overflow-x: auto; max-width: 70%; scrollbar-width: none; }

.tabs { display: flex; gap: 8px; position: sticky; top: 56px; z-index: 4; }
.tabs button {
  flex: 1; padding: 11px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--panel);
  color: var(--muted); font: inherit; font-weight: 700; cursor: pointer;
}
.tabs button.on { color: var(--text); border-color: var(--accent); box-shadow: inset 0 -3px 0 var(--accent); }

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.span2 { grid-column: span 2; }

.chart { width: 100%; height: 220px; display: block; }
.chart.tall { height: 320px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--muted); margin-top: 8px; }
.legend i { display: inline-block; width: 12px; height: 3px; border-radius: 2px; vertical-align: middle; margin-right: 5px; }
.legend i.dash { height: 0; border-top: 2px dashed; background: none; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; color: var(--muted); font-weight: 600; font-size: 11.5px; padding: 6px 6px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 7px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
td.r, th.r { text-align: right; }
tr:last-child td { border-bottom: 0; }
.tbl { overflow-x: auto; }
.empty { color: var(--muted); padding: 10px 0; }
.scrollbox { max-height: 340px; overflow: auto; }
.log div { padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 12.5px; }
.log time { color: var(--muted); margin-right: 8px; font-variant-numeric: tabular-nums; }
.tag { font-size: 11.5px; color: var(--muted); }
.rules { margin: 0; padding-left: 18px; }
.rules li { margin: 4px 0; }
.watch-row { cursor: pointer; }
.watch-row:hover td { background: var(--panel2); }


footer { text-align: center; color: var(--muted); font-size: 12px; padding: 0 16px 24px; }

@media (max-width: 760px) {
  .versus, .grid { grid-template-columns: 1fr; }
  .span2 { grid-column: auto; }
  .big { font-size: 22px; }
  .chart.tall { height: 260px; }
  .seg.scroll { max-width: 62%; }
  .hide-sm { display: none; }
}


.summary { margin: 12px 0 4px; font-size: 13.5px; }
.status { margin-bottom: 4px; }

.trade {
  display: block; width: 100%; text-align: left; font: inherit; color: inherit; cursor: pointer;
  background: var(--panel2); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; margin-bottom: 8px;
}
.trade:hover, .trade:focus-visible { border-color: var(--muted); outline: none; }
.trade.open { border-color: color-mix(in srgb, var(--fast) 45%, var(--line)); }
.trade-top { display: flex; align-items: center; gap: 8px; }
.trade-top .result { margin-left: auto; font-weight: 700; font-size: 15px; }
.trade-line { color: var(--muted); font-size: 12.5px; margin-top: 3px; }
.trade-why { font-size: 13px; margin-top: 2px; }
.sym { font-weight: 800; font-size: 15px; letter-spacing: 0.01em; }
.sym.big, .num.big { font-size: 22px; }
.badge { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 99px; background: var(--panel); border: 1px solid var(--line); }
.badge.win { color: var(--up); border-color: color-mix(in srgb, var(--up) 40%, var(--line)); }
.badge.loss { color: var(--down); border-color: color-mix(in srgb, var(--down) 40%, var(--line)); }
.badge.live { color: var(--fast); border-color: color-mix(in srgb, var(--fast) 40%, var(--line)); }
.day-head { font-size: 12px; font-weight: 700; color: var(--muted); margin: 10px 0 6px; }
.day-head:first-child { margin-top: 0; }
.legend i.tri { width: auto; height: auto; background: none; font-style: normal; font-size: 11px; }

.detail {
  width: min(560px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); overflow: auto;
  background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 16px; padding: 18px;
}
.detail::backdrop { background: rgb(0 0 0 / .55); }
.detail-head { display: flex; align-items: center; gap: 10px; }
.detail-head .num.big { margin-left: auto; font-weight: 800; }
.detail h3 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); margin: 16px 0 4px; }
.detail p { margin: 0; line-height: 1.55; }
.facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 16px 0 12px; }
.facts div { display: flex; flex-direction: column; background: var(--panel2); border-radius: 8px; padding: 8px 10px; }
.facts b { font-size: 14px; }
.detail .chart { height: 180px; margin-top: 4px; }
.detail .close { width: 100%; margin-top: 14px; }

.glossary { margin: 0; }
.glossary dt { font-weight: 700; margin-top: 8px; }
.glossary dt:first-child { margin-top: 0; }
.glossary dd { margin: 2px 0 0; color: var(--muted); font-size: 13px; }

@media (max-width: 760px) {
  .facts { grid-template-columns: repeat(2, 1fr); }
}
