/* AI Trade Bot — trading-app design system. Light and dark follow the device unless the viewer picks one;
   high contrast and three text sizes are for low-vision users. No inline styles anywhere (CSP). */
:root {
  --sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --scale: 1;
  --r: 14px; --r-sm: 9px; --gap: 18px;
  --bg: #f3f5f9; --surface: #ffffff; --surface-2: #eef2f7; --line: #dde3ec; --grid: #eef1f6;
  --text: #0f172a; --muted: #475467; --faint: #5c6470;
  --accent: #2059d8; --accent-ink: #ffffff; --accent-soft: rgba(32, 89, 216, .16);
  --good: #0d7a45; --good-bg: #e3f5eb; --bad: #c0283a; --bad-bg: #fbe7ea; --warn: #9a5800; --warn-bg: #fdf1dc;
  --shade: rgba(192, 40, 58, .10);
  --shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 8px 24px -12px rgba(15, 23, 42, .18);
  --bar: rgba(255, 255, 255, .86);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a0e16; --surface: #111724; --surface-2: #18202f; --line: #243046; --grid: #161e2c;
    --text: #e7ecf4; --muted: #a3afc2; --faint: #8390a6;
    --accent: #5b8cff; --accent-ink: #06122e; --accent-soft: rgba(91, 140, 255, .22);
    --good: #34d17f; --good-bg: rgba(52, 209, 127, .12); --bad: #ff6b78; --bad-bg: rgba(255, 107, 120, .12);
    --warn: #f5b04a; --warn-bg: rgba(245, 176, 74, .12); --shade: rgba(255, 107, 120, .14);
    --shadow: 0 1px 0 rgba(255, 255, 255, .03) inset, 0 12px 32px -16px rgba(0, 0, 0, .7);
    --bar: rgba(10, 14, 22, .82); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0a0e16; --surface: #111724; --surface-2: #18202f; --line: #243046; --grid: #161e2c;
  --text: #e7ecf4; --muted: #a3afc2; --faint: #8390a6;
  --accent: #5b8cff; --accent-ink: #06122e; --accent-soft: rgba(91, 140, 255, .22);
  --good: #34d17f; --good-bg: rgba(52, 209, 127, .12); --bad: #ff6b78; --bad-bg: rgba(255, 107, 120, .12);
  --warn: #f5b04a; --warn-bg: rgba(245, 176, 74, .12); --shade: rgba(255, 107, 120, .14);
  --shadow: 0 1px 0 rgba(255, 255, 255, .03) inset, 0 12px 32px -16px rgba(0, 0, 0, .7);
  --bar: rgba(10, 14, 22, .82); color-scheme: dark;
}
:root.contrast {
  --bg: #000; --surface: #000; --surface-2: #111; --line: #fff; --grid: #333; --text: #fff; --muted: #fff; --faint: #fff;
  --accent: #ffd400; --accent-ink: #000; --accent-soft: rgba(255, 212, 0, .25); --good: #5dff9b; --good-bg: #000;
  --bad: #ff8a8a; --bad-bg: #000; --warn: #ffd400; --warn-bg: #000; --shadow: none; --bar: #000; color-scheme: dark;
}
:root.size2 { --scale: 1.15; } :root.size3 { --scale: 1.32; }

*, *::before, *::after { box-sizing: border-box; }
html { font-size: calc(16px * var(--scale)); -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 1rem/1.5 var(--sans); font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
a { color: var(--accent); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; z-index: 50; background: var(--accent); color: var(--accent-ink); padding: 10px 14px; border-radius: 8px; }
.skip:focus { left: 8px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.muted { color: var(--muted); } .sm { font-size: .84rem; } .up { color: var(--good); } .down { color: var(--bad); }
.lede { color: var(--muted); max-width: 72ch; margin: 6px 0 12px; }

/* ---------------------------------------------------------------- top bar */
.bar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 16px; padding: 10px clamp(12px, 3vw, 28px);
  background: var(--bar); backdrop-filter: saturate(1.4) blur(12px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 800; letter-spacing: -.01em; white-space: nowrap; }
.brand svg { width: 28px; height: 28px; fill: none; stroke: var(--accent); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.brand svg circle { fill: var(--accent); stroke: none; }
.pill { display: inline-flex; align-items: center; gap: 8px; padding: 5px 12px; border-radius: 999px; font-size: .84rem; font-weight: 650;
  background: var(--surface-2); border: 1px solid var(--line); white-space: nowrap; }
.pill .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--faint); }
.pill.good .dot { background: var(--good); box-shadow: 0 0 0 0 var(--good); animation: pulse 2s infinite; }
.pill.warn .dot { background: var(--warn); } .pill.bad .dot { background: var(--bad); }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 var(--good-bg); } 70% { box-shadow: 0 0 0 8px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
.ticker { display: flex; align-items: baseline; gap: 8px; margin-left: auto; font-family: var(--mono); white-space: nowrap; }
.ticker .t-sym { color: var(--muted); font-size: .8rem; font-weight: 700; } .ticker b { font-size: 1.12rem; }
.ticker .t-chg { font-size: .84rem; } .ticker b.flash-up { color: var(--good); } .ticker b.flash-down { color: var(--bad); }
.tools { display: flex; align-items: center; gap: 6px; }
.tool { font: 650 .84rem var(--sans); color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 9px;
  min-height: 38px; min-width: 38px; padding: 0 10px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; justify-content: center; }
.tool:hover { border-color: var(--accent); } .tool[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }
.tool.big1 { font-size: 1rem; } .tool.big2 { font-size: 1.18rem; } .tool .ts { display: none; }
.seg { display: inline-flex; } .seg .tool { border-radius: 0; margin-left: -1px; } .seg .tool:first-child { border-radius: 9px 0 0 9px; margin-left: 0; }
.seg .tool:last-child { border-radius: 0 9px 9px 0; }
.ico { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ico path:first-child { fill: currentColor; }

/* ---------------------------------------------------------------- tabs */
.tabs { display: flex; gap: 4px; padding: 10px clamp(12px, 3vw, 28px) 0; max-width: 1360px; margin: 0 auto; }
.tabs [role="tab"] { font: 650 .95rem var(--sans); color: var(--muted); background: none; border: 0; border-radius: 10px; padding: 10px 16px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; }
.tabs [role="tab"] svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.tabs [role="tab"]:hover { color: var(--text); background: var(--surface-2); }
.tabs [role="tab"][aria-selected="true"] { color: var(--text); background: var(--surface); box-shadow: var(--shadow); border: 1px solid var(--line); }

main { max-width: 1360px; margin: 0 auto; padding: 16px clamp(12px, 3vw, 28px) 40px; }
main > *, .panel-page > *, .two > *, .main-grid > *, .side > * { min-width: 0; }
.panel-page { display: grid; gap: var(--gap); animation: enter .25s ease-out; }
@keyframes enter { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.page-title { font-size: 1.5rem; letter-spacing: -.02em; }
.headline { font-size: clamp(1.15rem, 1rem + .8vw, 1.6rem); font-weight: 750; letter-spacing: -.02em; margin: 4px 0 0; }

/* ---------------------------------------------------------------- cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; box-shadow: var(--shadow); }
.card h2 { font-size: 1.02rem; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.btn { font: 700 .9rem var(--sans); border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text);
  padding: 10px 16px; min-height: 42px; cursor: pointer; }
.btn:hover { border-color: var(--accent); } .btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.sm { min-height: 36px; padding: 6px 12px; font-size: .84rem; }
.btn:disabled { opacity: .6; cursor: progress; }

/* KPI tiles */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--gap); }
.kpi { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 4px; overflow: hidden; }
.kpi h2 { font-size: .74rem; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); font-weight: 750; }
.kpi .big { font-size: clamp(1.35rem, 1.1rem + 1vw, 1.9rem); font-weight: 780; letter-spacing: -.02em; font-family: var(--mono); }
.kpi .sub { color: var(--muted); font-size: .86rem; }
.kpi .spark { width: 100%; height: 38px; margin-top: 6px; }
.kpi progress { width: 100%; height: 8px; margin: 6px 0 4px; }
.kpi .btn { align-self: flex-start; margin-top: 6px; }
.kpi[data-state="good"] { border-top: 3px solid var(--good); } .kpi[data-state="warn"] { border-top: 3px solid var(--warn); }
.kpi[data-state="bad"] { border-top: 3px solid var(--bad); }
progress { appearance: none; border: 0; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
progress::-webkit-progress-bar { background: var(--surface-2); } progress::-webkit-progress-value { background: var(--accent); border-radius: 99px; }
progress::-moz-progress-bar { background: var(--accent); border-radius: 99px; }

/* overview grid */
.main-grid { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: var(--gap); }
.side { display: grid; gap: var(--gap); align-content: start; }
.chart { width: 100%; height: 460px; } .chart-md { height: 320px; }
.chart-card { display: flex; flex-direction: column; } .chart-card .chart { flex: 1; min-height: 440px; height: auto; }
.canvas-md { width: 100%; height: 170px; display: block; }
.live-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--good); margin: 0 6px 2px 8px; animation: pulse 2s infinite; }
.next { display: grid; gap: 10px; }
.lvl { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 10px 12px; border-radius: var(--r-sm); background: var(--surface-2); }
.lvl b { font-family: var(--mono); font-size: 1.05rem; } .lvl span { color: var(--muted); font-size: .84rem; }
.lvl.sell { border-left: 3px solid var(--bad); } .lvl.buy { border-left: 3px solid var(--good); } .lvl.now { border-left: 3px solid var(--accent); }
.mix { height: 10px; border-radius: 99px; background: var(--good-bg); overflow: hidden; display: block; width: 100%; }
.mix::-webkit-progress-value { background: var(--accent); } .mix::-moz-progress-bar { background: var(--accent); }

/* live feed */
.feed-card { display: flex; flex-direction: column; max-height: 520px; }
.feed { list-style: none; margin: 0; padding: 0; overflow-y: auto; display: grid; gap: 2px; }
.feed li { display: grid; grid-template-columns: 26px 1fr; gap: 10px; padding: 9px 4px; border-bottom: 1px solid var(--line); animation: enter .35s ease-out; }
.feed .ic { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: .78rem; font-weight: 800; background: var(--surface-2); color: var(--muted); }
.feed .buy .ic { background: var(--good-bg); color: var(--good); } .feed .sell .ic { background: var(--bad-bg); color: var(--bad); }
.feed .bad .ic, .feed .warn .ic { background: var(--warn-bg); color: var(--warn); }
.feed .meta { font-size: .76rem; color: var(--faint); font-family: var(--mono); } .feed .msg { font-size: .9rem; }
.feed .buy .msg, .feed .sell .msg { font-weight: 700; }

/* health layers */
.layers { list-style: none; margin: 10px 0 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 20px; }
.layers li { display: grid; grid-template-columns: 14px 1fr; gap: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.layers .light { width: 12px; height: 12px; border-radius: 50%; margin-top: 5px; background: var(--faint); }
.layers .light.good { background: var(--good); } .layers .light.warn { background: var(--warn); } .layers .light.bad { background: var(--bad); }
.layers b { display: block; } .layers .job { display: block; font-size: .88rem; } .layers .detail { display: block; font-size: .82rem; color: var(--muted); margin-top: 3px; }

/* trading */
.books { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: var(--gap); }
.book { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; box-shadow: var(--shadow); display: grid; gap: 6px; }
.book .top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.book .name { font-weight: 750; font-family: var(--mono); font-size: .92rem; }
.book .val { font-size: 1.45rem; font-weight: 780; font-family: var(--mono); letter-spacing: -.02em; }
.book .spark { width: 100%; height: 44px; } .book .sub { color: var(--muted); font-size: .84rem; }
.badge { font: 750 .7rem var(--sans); letter-spacing: .06em; text-transform: uppercase; padding: 3px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.badge.good { background: var(--good-bg); color: var(--good); } .badge.bad { background: var(--bad-bg); color: var(--bad); } .badge.warn { background: var(--warn-bg); color: var(--warn); }
.inline { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: .86rem; }
select, input { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; min-height: 38px; }
.filters { display: flex; gap: 12px; flex-wrap: wrap; }
.locks { list-style: none; padding: 0; margin: 10px 0; display: grid; gap: 8px; }
.locks li { display: grid; grid-template-columns: 22px 1fr; gap: 8px; }
.locks .ok { color: var(--good); font-weight: 800; } .locks .no { color: var(--bad); font-weight: 800; }

/* tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .86rem; }
th { text-align: left; color: var(--muted); font-weight: 650; font-size: .76rem; letter-spacing: .03em; padding: 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline dotted; }
td { padding: 9px 8px; border-bottom: 1px solid var(--line); font-family: var(--mono); font-size: .82rem; white-space: nowrap; }
table.wrap td { white-space: normal; font-family: var(--sans); }
.num { text-align: right; } tr.mine td { font-weight: 750; background: var(--surface-2); }
tbody tr:hover td { background: var(--surface-2); }

/* simulator and lab */
.sim { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 22px; }
.sim-controls { display: grid; gap: 16px; align-content: start; }
.sim-controls label { display: grid; gap: 6px; font-weight: 650; font-size: .9rem; }
.sim-controls output { font-family: var(--mono); color: var(--accent); font-weight: 750; }
input[type="range"] { width: 100%; accent-color: var(--accent); padding: 0; border: 0; min-height: 28px; background: none; }
.sim-kpis, .stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-bottom: 12px; }
.stat { background: var(--surface-2); border-radius: var(--r-sm); padding: 10px 12px; }
.stat b { display: block; font: 780 1.2rem var(--mono); } .stat span { font-size: .8rem; color: var(--muted); }
.lab { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)) auto; gap: 12px; align-items: end; margin: 12px 0; }
.lab label { display: grid; gap: 4px; font-size: .84rem; color: var(--muted); } .lab .opt { font-size: .74rem; }
.err { color: var(--bad); font-weight: 650; }

/* research */
.two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--gap); }
.gauge { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 8px 0; }
.roadmap { max-height: 480px; overflow: auto; } .roadmap pre { white-space: pre-wrap; font: .8rem/1.6 var(--mono); margin: 0; }

/* connect */
.steps { list-style: none; counter-reset: s; margin: 0; padding: 0; display: grid; gap: 14px; }
.steps li { counter-increment: s; display: grid; grid-template-columns: 44px 1fr; gap: 14px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); padding: 18px; box-shadow: var(--shadow); }
.steps li::before { content: counter(s); width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-weight: 800;
  background: var(--surface-2); border: 2px solid var(--line); }
.steps li.done::before { content: "✓"; background: var(--good); color: var(--accent-ink); border-color: var(--good); }
.steps h2 { font-size: 1.05rem; margin-bottom: 4px; } .steps p { margin: 6px 0; color: var(--muted); }
.copy-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
code { font: 700 .95rem var(--mono); background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; color: var(--text); }
.ticks { margin: 8px 0; padding-left: 20px; display: grid; gap: 6px; }
.notice { border-left: 4px solid var(--good); }

footer { max-width: 1360px; margin: 0 auto; padding: 0 clamp(12px, 3vw, 28px) 90px; color: var(--muted); font-size: .82rem; }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 1100px) { .main-grid { grid-template-columns: 1fr; } .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } .layers { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 860px) {
  .chart-card .chart { min-height: 360px; }
  .two, .sim { grid-template-columns: 1fr; } .lab { grid-template-columns: 1fr 1fr; } .lab button { grid-column: 1 / -1; }
  .tools .tl { display: none; } .tool .ts { display: inline; } .pill { display: none; }
  .tabs { position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; justify-content: space-around; padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    background: var(--bar); backdrop-filter: blur(12px); border-top: 1px solid var(--line); max-width: none; }
  .tabs [role="tab"] { flex-direction: column; gap: 2px; font-size: .7rem; padding: 6px 4px; flex: 1; }
  .tabs [role="tab"][aria-selected="true"] { box-shadow: none; border: 0; color: var(--accent); background: none; }
  .chart { height: 360px; } .chart-md { height: 260px; }
}
@media (max-width: 560px) {
  .bar { flex-wrap: wrap; gap: 8px 12px; } .ticker { margin-left: auto; } .tools { width: 100%; justify-content: flex-end; }
  .kpis, .layers { grid-template-columns: 1fr; } .chart { height: 320px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
@media print { .bar, .tabs, .tools { position: static; } [role="tabpanel"][hidden] { display: grid !important; } }
.sub-h { font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 16px 0 8px; }
.feat-filters { margin: 4px 0 12px; } .feat-wrap { max-height: 640px; overflow: auto; }
.st { font: 750 .72rem var(--sans); letter-spacing: .05em; text-transform: uppercase; padding: 3px 8px; border-radius: 999px; white-space: nowrap; }
.st.built { background: var(--good-bg); color: var(--good); } .st.partial { background: var(--warn-bg); color: var(--warn); }
.st.planned { background: var(--surface-2); color: var(--muted); } .st.excluded { background: var(--bad-bg); color: var(--bad); }
.feat-note { display: block; color: var(--muted); font-size: .8rem; margin-top: 2px; }

/* markets */
.markets { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.mkt { display: grid; gap: 2px; text-align: left; padding: 10px 12px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--surface-2);
  color: var(--text); font: inherit; cursor: pointer; min-height: 44px; }
.mkt:hover { border-color: var(--accent); } .mkt[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.mkt b { font-size: .92rem; } .mkt .px { font: 700 1rem var(--mono); } .mkt .ch { font: 600 .82rem var(--mono); }

/* ---------------------------------------------------------------- product switch (Betting Intelligence is its own site) */
.product-switch .tool { font-size: .8rem; text-decoration: none; }
.product-switch .tool[aria-current="page"] { background: var(--text); color: var(--bg); border-color: var(--text); cursor: default; }
@media (max-width: 860px) { .product-switch { order: 5; width: 100%; } .product-switch .tool { flex: 1; } }
table.edit input[data-k="selection"], table.edit input[data-k="event"] { min-width: 150px; } table.edit input[data-k="sport"], table.edit input[data-k="book"] { min-width: 100px; }
