/* StrikeWatch — single stylesheet. Light by default, dark when the device is in dark mode. */
:root {
  --bg: #f4f6fa;
  --panel: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --line: #e5e7eb;
  --grid: #eceef2;
  --brand: #1d4ed8;
  --brand-soft: #e0e7ff;
  --up: #047857;
  --down: #b91c1c;
  --itm: #fff7d6;
  --atm: #dbeafe;
  /* chart series (validated pair): calls = blue, puts = orange */
  --calls: #2a78d6;
  --puts: #eb6834;
  --calls-wash: rgba(42, 120, 214, 0.16);
  --puts-wash: rgba(235, 104, 52, 0.16);
  /* option activity (always shown with its word) */
  --act-LB: #1baf7a;
  --act-SB: #e34948;
  --act-SC: #6250d6;
  --act-LU: #eda100;
  /* sentiment tone (always shown with an icon + word) */
  --bull: #0a8a0a;
  --bear: #d03b3b;
  --flat: #6b7280;
  --amber-bg: #fef3c7;
  --amber-text: #92400e;
  --green-bg: #d1fae5;
  --green-text: #065f46;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.08);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1120;
    --panel: #121a2b;
    --text: #e5e7eb;
    --muted: #94a3b8;
    --line: #1f2a40;
    --grid: #1a2335;
    --brand: #60a5fa;
    --brand-soft: #1e293b;
    --up: #34d399;
    --down: #f87171;
    --itm: #2a2414;
    --atm: #172554;
    --calls: #3987e5;
    --puts: #d95926;
    --calls-wash: rgba(57, 135, 229, 0.22);
    --puts-wash: rgba(217, 89, 38, 0.22);
    --act-LB: #199e70;
    --act-SB: #e66767;
    --act-SC: #9085e9;
    --act-LU: #c98500;
    --bull: #22c55e;
    --bear: #f87171;
    --flat: #94a3b8;
    --amber-bg: #3a2a0a;
    --amber-text: #fcd34d;
    --green-bg: #06281e;
    --green-text: #6ee7b7;
    --shadow: none;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; overflow-x: hidden; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
.muted { color: var(--muted); }
.small { font-size: 13px; }
small { font-size: 0.78em; }
[hidden] { display: none !important; }
.num, .rows, .profile, .cards, .chips { font-variant-numeric: tabular-nums; }

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 16px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 18px; }
.brand-mark { width: 28px; height: 28px; }
.brand-mark rect { fill: var(--brand); }
.brand-mark path { stroke: #fff; stroke-width: 3; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.status { display: flex; align-items: center; gap: 8px; font-size: 13px; text-align: right; flex-wrap: wrap; justify-content: flex-end; }
.badge { padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge.demo { background: var(--amber-bg); color: var(--amber-text); }
.badge.live { background: var(--green-bg); color: var(--green-text); }

.wrap { max-width: 920px; margin: 0 auto; padding: 16px; }

/* Index tabs */
.tabs { display: flex; flex-wrap: wrap; gap: 8px; }
.tabs button {
  border: 1px solid var(--line); background: var(--panel); color: var(--text);
  padding: 8px 14px; border-radius: 999px; font: inherit; font-weight: 600; font-size: 14px;
  cursor: pointer; transition: background .15s, color .15s, border-color .15s;
}
.tabs button:hover { border-color: var(--brand); }
.tabs button[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: #fff; }

/* Controls */
.controls { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin: 14px 0 6px; font-size: 14px; }
.controls label { display: flex; align-items: center; gap: 6px; color: var(--muted); }
.controls select {
  font: inherit; color: var(--text); background: var(--panel);
  border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px;
}
.controls .check { color: var(--text); cursor: pointer; }
button.ghost {
  font: inherit; font-size: 14px; color: var(--brand); background: transparent;
  border: 1px solid var(--brand); border-radius: 8px; padding: 6px 12px; cursor: pointer;
}
button.ghost:hover { background: var(--brand-soft); }

.notice { margin: 10px 0; padding: 10px 12px; border-radius: 10px; background: var(--amber-bg); color: var(--amber-text); font-size: 14px; }

/* Spot */
.spot { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; margin: 14px 0 10px; }
.spot-label { font-weight: 600; color: var(--muted); }
.spot-value { font-size: 28px; font-weight: 700; }
.spot-change { font-weight: 600; }
.up { color: var(--up); }
.down { color: var(--down); }

/* Shared card look */
.card-box, .card, .chart-box {
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow);
}
.eyebrow { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }

/* Index sentiment */
.flow { padding: 14px 16px; margin-bottom: 12px; }
.flow-head { display: flex; justify-content: space-between; gap: 8px; }
.flow-verdict { display: flex; align-items: center; gap: 8px; margin-top: 6px; flex-wrap: wrap; }
.flow-icon { width: 26px; height: 26px; display: inline-flex; }
.flow-icon svg { width: 100%; height: 100%; }
.flow-title { font-size: 22px; font-weight: 800; }
.flow.bull .flow-icon, .flow.bull .flow-title { color: var(--bull); }
.flow.bear .flow-icon, .flow.bear .flow-title { color: var(--bear); }
.flow.flat .flow-icon, .flow.flat .flow-title { color: var(--flat); }
.stars { margin-left: auto; letter-spacing: 2px; font-size: 16px; color: var(--muted); white-space: nowrap; }
.stars b { color: var(--text); font-weight: 400; }
.flow-note { margin: 4px 0 12px; color: var(--muted); font-size: 14px; }
.flow-sides { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.side-box { background: var(--bg); border-radius: 10px; padding: 8px 12px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.side-value { font-weight: 700; font-size: 16px; display: flex; align-items: center; gap: 6px; }
.strip { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; margin: 14px 0 4px; }
.strip-item { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.strip-item b { font-weight: 700; color: var(--text); }
.strip-mark { width: 12px; height: 18px; border-radius: 4px; background: var(--line); }
.strip-mark.bull { background: var(--bull); }
.strip-mark.bear { background: var(--bear); }
.strip-mark.flat { background: var(--flat); }
.strip-mark.none { background: transparent; border: 1.5px dashed var(--line); }
.flow-foot { margin: 10px 0 0; font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--bull); display: inline-block; }

/* Summary cards */
.cards { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
.card { padding: 10px 12px; min-width: 0; border-radius: 12px; }
.card-label { font-size: 12px; color: var(--muted); font-weight: 600; }
.card-label .hint { display: block; font-weight: 400; font-size: 11px; }
.card-value { font-size: 20px; font-weight: 700; margin-top: 2px; }
.card-sub { font-size: 12px; color: var(--muted); min-height: 1.2em; }
.chip { display: inline-block; padding: 1px 8px; border-radius: 999px; font-weight: 600; font-size: 12px; }
.chip.bull { background: var(--green-bg); color: var(--green-text); }
.chip.bear { background: #fee2e2; color: #991b1b; }
.chip.flat { background: var(--brand-soft); color: var(--brand); }
@media (prefers-color-scheme: dark) { .chip.bear { background: #3b1111; color: #fca5a5; } }

/* View tabs */
.views { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; margin: 16px 0 12px; padding: 4px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; }
.views button { font: inherit; font-weight: 700; font-size: 14px; color: var(--muted); background: transparent; border: 0; border-radius: 9px; padding: 9px 6px; cursor: pointer; }
.views button[aria-selected="true"] { background: var(--brand-soft); color: var(--brand); }

/* Chain actions + legend */
.actions { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.action { font: inherit; font-weight: 700; font-size: 14px; color: var(--brand); background: var(--panel); border: 1px solid var(--brand); border-radius: 10px; padding: 10px 14px; cursor: pointer; }
.action:hover { background: var(--brand-soft); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 12px 2px; font-size: 13px; color: var(--muted); }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; vertical-align: 0; }
.dot.LB, .badge-act.LB::before { background: var(--act-LB); }
.dot.SB, .badge-act.SB::before { background: var(--act-SB); }
.dot.SC, .badge-act.SC::before { background: var(--act-SC); }
.dot.LU, .badge-act.LU::before { background: var(--act-LU); }

/* Chain rows as cards */
.chain-head { display: grid; grid-template-columns: 1fr 76px 1fr; gap: 6px; padding: 0 10px 6px; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.chain-head span:nth-child(2) { text-align: center; align-self: end; }
.chain-head span:nth-child(3) { text-align: right; }
.chain-head small { display: block; font-weight: 500; letter-spacing: 0; text-transform: none; }
.rows { display: flex; flex-direction: column; gap: 8px; }
.row { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; scroll-margin-top: 70px; }
.row.atm { border-color: var(--brand); }
.row.peak { box-shadow: 0 0 0 2px var(--brand); }
.row-main { display: grid; grid-template-columns: 1fr 76px 1fr; gap: 6px; align-items: center; padding: 8px; }
.side { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.side-top { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; padding: 6px 8px; border-radius: 9px; background-color: var(--bg); background-repeat: no-repeat; }
.side.itm .side-top { background-color: var(--itm); }
.side.call .side-top { background-image: linear-gradient(var(--calls-wash), var(--calls-wash)); background-position: left; }
.side.put .side-top { background-image: linear-gradient(var(--puts-wash), var(--puts-wash)); background-position: right; flex-direction: row-reverse; }
.oi-val { font-weight: 700; font-size: 15px; white-space: nowrap; }
.ltp-val { font-size: 14px; color: var(--muted); white-space: nowrap; }
.side-bottom { display: flex; justify-content: space-between; align-items: center; gap: 6px; padding: 0 2px; min-height: 22px; }
.side.put .side-bottom { flex-direction: row-reverse; }
.chg { font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge-act { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 700; padding: 2px 7px 2px 6px; border-radius: 999px; border: 1px solid var(--line); white-space: nowrap; color: var(--text); }
.badge-act::before { content: ""; width: 7px; height: 7px; border-radius: 50%; }
.strike-col { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 0; }
.strike-tag { font-size: 10px; font-weight: 800; letter-spacing: .06em; color: var(--brand); min-height: 13px; }
.strike-num { font-size: 17px; font-weight: 800; }
.expand { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 2px 8px; border-radius: 6px; font-size: 14px; line-height: 1; }
.expand:hover { background: var(--bg); }
.expand[aria-expanded="true"] { transform: rotate(180deg); }
.row-detail { border-top: 1px solid var(--line); padding: 8px 12px 10px; display: grid; grid-template-columns: 1fr 1fr; gap: 4px 16px; font-size: 13px; }
.row-detail dl { margin: 0; display: grid; grid-template-columns: auto auto; gap: 2px 8px; justify-content: space-between; }
.row-detail dt { color: var(--muted); }
.row-detail dd { margin: 0; text-align: right; font-weight: 600; }
.row-detail h4 { margin: 0 0 4px; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.loading { text-align: center; color: var(--muted); padding: 24px; }

/* OI profile */
.chips { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
.chips .card { padding: 8px 10px; }
.seg { display: inline-flex; gap: 4px; padding: 3px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); margin-bottom: 10px; }
.seg button { font: inherit; font-size: 13px; font-weight: 600; color: var(--muted); background: transparent; border: 0; border-radius: 7px; padding: 6px 10px; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--brand-soft); color: var(--brand); }
.chart-legend { display: flex; gap: 14px; font-size: 13px; color: var(--muted); margin: 0 2px 8px; }
.swatch { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -1px; margin-right: 2px; }
.swatch.calls { background: var(--calls); }
.swatch.puts { background: var(--puts); }
.profile { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 8px 10px; }
.prow { display: grid; grid-template-columns: 1fr 64px 1fr; align-items: center; height: 26px; gap: 6px; cursor: default; }
.prow:hover, .prow.hl { background: var(--bg); border-radius: 6px; }
.prow.atm .pstrike { color: var(--brand); font-weight: 800; }
.pstrike { text-align: center; font-size: 13px; font-weight: 600; }
.pbar-wrap { position: relative; height: 18px; display: flex; }
.pbar-wrap.call { justify-content: flex-end; }
.pbar { height: 18px; max-height: 24px; min-width: 0; }
.pbar.call { background: var(--calls); border-radius: 4px 0 0 4px; }
.pbar.put { background: var(--puts); border-radius: 0 4px 4px 0; }
.pbar.neg.call { opacity: .45; }
.pbar.neg.put { opacity: .45; }
.pnote { margin: 8px 2px 0; font-size: 12px; color: var(--muted); }

/* Trends */
.chart-box { margin: 0 0 12px; padding: 10px 12px; }
.chart-box figcaption { font-size: 13px; font-weight: 700; margin-bottom: 6px; }
.chart { position: relative; height: 180px; }
.chart svg { display: block; width: 100%; height: 100%; overflow: visible; }
.chart .gridline { stroke: var(--grid); stroke-width: 1; }
.chart .baseline { stroke: var(--line); stroke-width: 1; }
.chart .axis-label { fill: var(--muted); font-size: 11px; }
.chart .line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .line.ink { stroke: var(--text); }
.chart .line.calls { stroke: var(--calls); }
.chart .line.puts { stroke: var(--puts); }
.chart .ref { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; }
.chart .cross { stroke: var(--muted); stroke-width: 1; }
.chart .mark { stroke: var(--panel); stroke-width: 2; }
.chart .end-label { fill: var(--text); font-size: 11px; font-weight: 600; }

/* Tooltip */
.tooltip { position: fixed; z-index: 20; pointer-events: none; background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 4px 16px rgba(0,0,0,.15); padding: 6px 9px; font-size: 12px; line-height: 1.4; font-variant-numeric: tabular-nums; max-width: 220px; }
.tooltip b { display: block; margin-bottom: 2px; }
.tooltip i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 4px; }

.disclaimer { font-size: 12px; color: var(--muted); margin-top: 18px; }

@media (max-width: 900px) {
  .cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .wrap { padding: 12px; }
  .topbar { padding: 8px 12px; }
  .brand { font-size: 16px; }
  .updated-label { display: none; }
  .tabs { gap: 6px; }
  .tabs button { padding: 6px 11px; font-size: 13px; }
  .controls { gap: 8px 10px; font-size: 13px; }
  .controls select, button.ghost { padding: 5px 6px; font-size: 13px; }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .card-value { font-size: 18px; }
  .spot-value { font-size: 24px; }
  .flow { padding: 12px; }
  .flow-title { font-size: 20px; }
  .chips { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .row-main { grid-template-columns: 1fr 62px 1fr; gap: 4px; padding: 6px; }
  .chain-head { grid-template-columns: 1fr 62px 1fr; }
  .side-top { padding: 5px 6px; gap: 4px; }
  .oi-val { font-size: 14px; }
  .ltp-val { font-size: 12.5px; }
  .strike-num { font-size: 15px; }
  .badge-act { font-size: 10px; padding: 1px 6px 1px 5px; gap: 4px; }
  .chg { font-size: 11px; }
  .row-detail { grid-template-columns: 1fr; }
}
