/* ============================================================
 * EVSTREAM · /tools interactive-widget styles.
 * Loaded by the EV, Kelly, De-Vigger and Overround tools — their calculator
 * cards are built/driven by client islands (so they can't be MUI sx). Tokens +
 * rules transcribed from the design; var values match the content theme.
 * Buttons/CTAs are rendered with MUI, so no .btn system is needed here.
 * ============================================================ */
:root {
  --bg: #0a0b0d; --bg-2: #0e1218;
  --panel: #13181f; --panel-2: #191f28; --panel-3: #1f2630;
  --line: #222a35; --line-2: #2c3442; --line-3: #3a4453;
  --ink: #e9ecf0; --ink-2: #9ba6b3; --ink-3: #6a7382; --ink-4: #4a5260;
  --accent: #22c55e; --accent-soft: rgba(34,197,94,.10); --accent-strong: #86efac;
  --warn-strong: #fcd34d; --warn-soft: rgba(245,158,11,.10);
  --rose-strong: #fecdd3; --rose-soft: rgba(251,113,133,.12);
  --bf-back: #3b82f6;
  --mono: 'JetBrains Mono', 'SFMono-Regular', Menlo, Consolas, monospace;
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

/* ---- tabs ---- */
.tool-tabs { display: flex; align-items: center; gap: 4px; padding: 12px 12px 0; border-bottom: 1px solid var(--line); }
.tool-tab { position: relative; height: 44px; padding: 0 16px; border: none; background: transparent; cursor: pointer; color: var(--ink-3); font-family: var(--sans); font-size: 13.5px; font-weight: 600; display: inline-flex; align-items: center; gap: 8px; transition: color .14s; }
.tool-tab .tab-ic { width: 15px; height: 15px; color: var(--ink-4); transition: color .14s; }
.tool-tab:hover { color: var(--ink-2); }
.tool-tab:hover .tab-ic { color: var(--ink-3); }
.tool-tab.is-on { color: var(--ink); }
.tool-tab.is-on .tab-ic { color: var(--accent); }
.tool-tab.is-on::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--accent); }
.tool-tab .tab-url { font-family: var(--mono); font-size: 9px; color: var(--ink-4); font-weight: 600; letter-spacing: .02em; padding: 2px 5px; border-radius: 4px; background: var(--bg); border: 1px solid var(--line); }
@media (max-width: 560px) { .tool-tab .tab-url { display: none; } }
.tool-body { padding: 30px; }
@media (max-width: 560px) { .tool-body { padding: 22px 18px; } }
.tool-pane { display: none; }
.tool-pane.is-on { display: block; }

/* ---- field row: label + input ---- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 620px) { .form-grid { grid-template-columns: 1fr; } }
.field { display: flex; flex-direction: column; gap: 9px; }
.field.span2 { grid-column: 1 / -1; }
.fld-label { display: flex; align-items: center; gap: 8px; font-family: var(--mono); font-size: 10.5px; color: var(--ink-3); letter-spacing: .08em; text-transform: uppercase; font-weight: 700; }
.fld-label .hint { margin-left: auto; color: var(--ink-4); font-size: 9.5px; letter-spacing: .04em; text-transform: none; font-weight: 600; }
.input { display: flex; align-items: center; height: 54px; border-radius: 10px; overflow: hidden; background: var(--bg); border: 1.5px solid var(--line-2); transition: border-color .14s, box-shadow .14s; }
.input:focus-within { border-color: rgba(34,197,94,.5); box-shadow: 0 0 0 4px rgba(34,197,94,.08); }
.input.invalid { border-color: rgba(251,113,133,.6); box-shadow: 0 0 0 4px rgba(251,113,133,.08); }
.input .pfx { padding: 0 0 0 16px; color: var(--ink-4); font-family: var(--mono); font-size: 18px; font-weight: 600; }
.input .sfx { padding: 0 16px 0 0; color: var(--ink-4); font-family: var(--mono); font-size: 15px; font-weight: 600; }
.input input { flex: 1; min-width: 0; width: 100%; height: 100%; padding: 0 16px; background: transparent; border: none; outline: none; color: var(--ink); font-family: var(--mono); font-size: 24px; font-weight: 700; letter-spacing: -.01em; font-feature-settings: "tnum" 1, "zero" 1; }
.input input::placeholder { color: var(--ink-4); }
.helptext { font-family: var(--mono); font-size: 10px; color: var(--ink-4); letter-spacing: .03em; font-weight: 600; }

/* ---- segmented control ---- */
.seg { display: inline-flex; background: var(--bg); border: 1px solid var(--line-2); border-radius: 9px; padding: 3px; gap: 2px; }
.seg.full { display: flex; width: 100%; }
.seg button { flex: 1; height: 34px; padding: 0 14px; border: none; border-radius: 6px; background: transparent; cursor: pointer; color: var(--ink-3); font-family: var(--sans); font-size: 12.5px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap; transition: all .13s; }
.seg button .sub { font-family: var(--mono); font-size: 9px; color: var(--ink-4); font-weight: 600; }
.seg button:hover { color: var(--ink-2); }
.seg button.on { background: var(--panel-3); color: var(--ink); box-shadow: inset 0 1px 0 rgba(255,255,255,.05), 0 1px 2px rgba(0,0,0,.3); }
.seg button.on .sub { color: var(--accent-strong); }
.seg button[disabled] { opacity: .4; cursor: not-allowed; }
.seg-label { display: flex; align-items: center; gap: 8px; font-family: var(--mono); font-size: 10.5px; color: var(--ink-3); letter-spacing: .08em; text-transform: uppercase; font-weight: 700; margin-bottom: 10px; }

/* ---- hero readout (EV / Kelly) ---- */
.hero { display: flex; align-items: center; gap: 24px; padding: 26px 28px; border-radius: 13px; border: 1px solid var(--line); background: linear-gradient(180deg, rgba(34,197,94,.05), transparent); }
.hero.bad { background: linear-gradient(180deg, rgba(251,113,133,.07), transparent); border-color: rgba(251,113,133,.22); }
.hero.neutral { background: var(--bg); }
.hero-main { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.hero-main .k { font-family: var(--mono); font-size: 11px; color: var(--ink-3); letter-spacing: .1em; text-transform: uppercase; font-weight: 700; }
.hero-main .v { font-family: var(--mono); font-size: clamp(44px,7vw,60px); font-weight: 700; line-height: .9; letter-spacing: -.03em; color: var(--accent-strong); font-feature-settings: "tnum" 1; }
.hero.bad .hero-main .v { color: var(--rose-strong); }
.hero.neutral .hero-main .v { color: var(--ink); }
.hero-main .note { font-family: var(--mono); font-size: 11px; color: var(--ink-4); font-weight: 600; letter-spacing: .02em; }
.hero-main .note em { font-style: normal; color: var(--accent-strong); }
.hero-side { margin-left: auto; display: flex; flex-direction: column; align-items: flex-end; gap: 10px; flex-shrink: 0; }
.hero-secondary { font-family: var(--mono); font-size: clamp(20px,3vw,26px); font-weight: 700; color: var(--ink); text-align: right; line-height: 1; }
.hero-secondary .sk { display: block; font-size: 9.5px; color: var(--ink-3); letter-spacing: .1em; text-transform: uppercase; margin-bottom: 4px; font-weight: 700; }
@media (max-width: 560px) { .hero { flex-wrap: wrap; gap: 16px; } .hero-side { margin-left: 0; align-items: flex-start; } .hero-secondary { text-align: left; } }

/* ---- metrics grid ---- */
.metrics { display: grid; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; margin-top: 14px; }
.metrics.c2 { grid-template-columns: 1fr 1fr; }
.metrics.c3 { grid-template-columns: repeat(3,1fr); }
.metrics.c4 { grid-template-columns: repeat(4,1fr); }
@media (max-width: 560px) { .metrics.c3, .metrics.c4 { grid-template-columns: 1fr 1fr; } }
.metric { background: var(--bg); padding: 15px 18px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.metric .k { font-family: var(--mono); font-size: 9.5px; color: var(--ink-3); letter-spacing: .08em; text-transform: uppercase; font-weight: 700; }
.metric .v { font-family: var(--mono); font-size: 20px; color: var(--ink); font-weight: 700; letter-spacing: -.01em; font-feature-settings: "tnum" 1; }
.metric .v.good { color: var(--accent-strong); }
.metric .v.warn { color: var(--warn-strong); }
.metric .v.bad { color: var(--rose-strong); }

/* ---- Kelly fraction table ---- */
.kelly-table { width: 100%; border-collapse: collapse; margin-top: 16px; border: 1px solid var(--line); border-radius: 11px; overflow: hidden; }
.kelly-table th { font-family: var(--mono); font-size: 9.5px; color: var(--ink-3); letter-spacing: .08em; text-transform: uppercase; font-weight: 700; text-align: right; padding: 11px 16px; background: var(--panel); border-bottom: 1px solid var(--line); }
.kelly-table th:first-child { text-align: left; }
.kelly-table td { font-family: var(--mono); font-size: 14px; font-weight: 700; color: var(--ink-2); text-align: right; padding: 13px 16px; border-bottom: 1px solid var(--line); font-feature-settings: "tnum" 1; }
.kelly-table td:first-child { text-align: left; color: var(--ink); }
.kelly-table tr:last-child td { border-bottom: none; }
.kelly-table tr.is-sel td { background: var(--accent-soft); }
.kelly-table tr.is-sel td:first-child { color: var(--accent-strong); }
.kelly-table td .stake { color: var(--accent-strong); }
.kelly-table .rec { display: inline-block; font-family: var(--mono); font-size: 8px; font-weight: 700; letter-spacing: .05em; padding: 1px 5px; border-radius: 4px; margin-left: 7px; color: var(--accent-strong); background: var(--accent-soft); border: 1px solid rgba(34,197,94,.3); text-transform: uppercase; vertical-align: middle; }

/* ---- no-bet + responsible-gambling note ---- */
.nobet { display: flex; gap: 14px; align-items: flex-start; padding: 22px 26px; border-radius: 13px; background: var(--rose-soft); border: 1px solid rgba(251,113,133,.3); }
.nobet .ic { flex-shrink: 0; width: 34px; height: 34px; border-radius: 9px; background: rgba(251,113,133,.16); border: 1px solid rgba(251,113,133,.34); color: var(--rose-strong); display: flex; align-items: center; justify-content: center; }
.nobet .t { font-size: 16px; font-weight: 700; color: var(--rose-strong); letter-spacing: -.01em; margin: 0 0 4px; }
.nobet p { margin: 0; font-size: 13.5px; color: var(--ink-2); line-height: 1.5; }
.rg-note { margin-top: 16px; display: flex; gap: 11px; align-items: flex-start; padding: 13px 16px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line); }
.rg-note svg { flex-shrink: 0; color: var(--ink-3); margin-top: 1px; }
.rg-note p { margin: 0; font-size: 12px; line-height: 1.5; color: var(--ink-3); }
.rg-note p strong { color: var(--ink-2); font-weight: 600; }

/* ---- de-vig / overround "info" note ---- */
.conv-note { margin-top: 16px; display: flex; gap: 11px; align-items: flex-start; padding: 14px 16px; border-radius: 10px; background: var(--warn-soft); border: 1px solid rgba(245,158,11,.26); }
.conv-note svg { flex-shrink: 0; color: var(--warn-strong); margin-top: 2px; }
.conv-note p { margin: 0; font-size: 13px; line-height: 1.5; color: var(--ink-2); }
.conv-note p strong { color: var(--warn-strong); font-weight: 600; }

/* ---- runner table (de-vigger / overround) ---- */
.rt-list { display: flex; flex-direction: column; gap: 7px; }
.rt-row { display: grid; grid-template-columns: 26px minmax(90px,1.1fr) 116px 1fr 34px; gap: 10px; align-items: center; padding: 7px 9px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); transition: border-color .14s, background .14s; }
.rt-row:focus-within { border-color: rgba(34,197,94,.4); background: var(--panel); }
.rt-row.rt-invalid { border-color: rgba(251,113,133,.45); }
.rt-num { font-family: var(--mono); font-size: 12px; color: var(--ink-4); font-weight: 700; text-align: center; }
.rt-name { width: 100%; height: 40px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 0 12px; color: var(--ink); font-family: var(--sans); font-size: 13.5px; font-weight: 500; outline: none; transition: border-color .14s; }
.rt-name:focus { border-color: var(--line-3); }
.rt-name::placeholder { color: var(--ink-4); }
.rt-oddswrap { display: flex; align-items: center; height: 40px; background: var(--panel); border: 1px solid var(--line-2); border-radius: 8px; overflow: hidden; transition: border-color .14s; }
.rt-oddswrap:focus-within { border-color: var(--line-3); }
.rt-oddswrap.invalid { border-color: rgba(251,113,133,.6); background: rgba(251,113,133,.06); }
.rt-pfx { padding-left: 11px; color: var(--ink-4); font-family: var(--mono); font-size: 15px; font-weight: 600; }
.rt-odds { flex: 1; min-width: 0; width: 100%; height: 40px; background: transparent; border: none; outline: none; padding: 0 11px; color: var(--ink); font-family: var(--mono); font-size: 17px; font-weight: 700; font-feature-settings: "tnum" 1; }
.rt-oddswrap.invalid .rt-odds { color: var(--rose-strong); }
.rt-odds::placeholder { color: var(--ink-4); }
.rt-out { display: flex; align-items: center; gap: 14px; justify-content: flex-end; padding-right: 4px; }
.rt-cell { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; min-width: 54px; }
.rt-cell .ck { font-family: var(--mono); font-size: 8px; color: var(--ink-4); letter-spacing: .06em; text-transform: uppercase; font-weight: 700; }
.rt-cell .cv { font-family: var(--mono); font-size: 14px; font-weight: 700; color: var(--ink); font-feature-settings: "tnum" 1; }
.rt-cell .cv.fair { color: var(--accent-strong); }
.rt-cell .cv.tax { color: var(--warn-strong); }
.rt-cell .cv.muted { color: var(--ink-3); }
.rt-del { width: 30px; height: 30px; border-radius: 7px; background: transparent; border: 1px solid transparent; color: var(--ink-4); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; transition: all .12s; }
.rt-del:hover { background: var(--rose-soft); border-color: rgba(251,113,133,.3); color: var(--rose-strong); }
.rt-foot { display: flex; gap: 8px; margin-top: 12px; }
.rt-add { height: 38px; padding: 0 14px; border-radius: 8px; background: var(--panel); border: 1px dashed var(--line-3); color: var(--ink-2); cursor: pointer; display: inline-flex; align-items: center; gap: 7px; font-family: var(--sans); font-size: 12.5px; font-weight: 600; transition: all .13s; }
.rt-add:hover { border-color: var(--accent); color: var(--accent-strong); background: var(--accent-soft); }
.rt-clear { height: 38px; padding: 0 14px; border-radius: 8px; background: transparent; border: 1px solid var(--line); color: var(--ink-3); cursor: pointer; font-family: var(--mono); font-size: 11px; font-weight: 700; letter-spacing: .04em; transition: all .13s; }
.rt-clear:hover { border-color: var(--line-2); color: var(--ink); }
@media (max-width: 680px) {
  .rt-row { grid-template-columns: 22px 1fr 96px 30px; }
  .rt-out { grid-column: 1 / -1; justify-content: flex-start; flex-wrap: wrap; border-top: 1px dashed var(--line); padding-top: 8px; margin-top: 2px; }
}

/* ---- book strip ---- */
.book-strip { display: flex; align-items: stretch; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; margin-bottom: 18px; }
.bs-cell { flex: 1; background: var(--bg-2); padding: 15px 18px; display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.bs-cell .k { font-family: var(--mono); font-size: 9.5px; color: var(--ink-3); letter-spacing: .09em; text-transform: uppercase; font-weight: 700; }
.bs-cell .v { font-family: var(--mono); font-size: 26px; font-weight: 700; letter-spacing: -.01em; color: var(--ink); line-height: 1; font-feature-settings: "tnum" 1; }
.bs-cell .v.book { color: var(--warn-strong); }
.bs-cell .v.fairv { color: var(--accent-strong); }
.bs-cell .sub { font-family: var(--mono); font-size: 10px; color: var(--ink-4); font-weight: 600; }
.bs-cell .sub em { font-style: normal; color: var(--warn-strong); }
@media (max-width: 560px) { .book-strip { flex-wrap: wrap; } }

/* ---- verdict chip ---- */
.vchip { display: inline-flex; align-items: center; gap: 8px; height: 30px; padding: 0 13px; border-radius: 99px; font-family: var(--mono); font-size: 12px; font-weight: 700; letter-spacing: .02em; }
.vchip svg { width: 14px; height: 14px; }
.vchip.good { background: var(--accent-soft); border: 1px solid rgba(34,197,94,.4); color: var(--accent-strong); }
.vchip.bad { background: var(--rose-soft); border: 1px solid rgba(251,113,133,.4); color: var(--rose-strong); }
.vchip.warn { background: var(--warn-soft); border: 1px solid rgba(245,158,11,.4); color: var(--warn-strong); }

/* ---- compare table (de-vigger) ---- */
.cmp-wrap { margin-top: 18px; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; display: none; }
.cmp-wrap.show { display: block; }
.cmp-head { padding: 12px 18px; background: var(--panel); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.cmp-head .ct { font-family: var(--mono); font-size: 10px; color: var(--ink-3); letter-spacing: .1em; text-transform: uppercase; font-weight: 700; }
.cmp-head .kpill { font-family: var(--mono); font-size: 10px; font-weight: 700; color: var(--bf-back); padding: 2px 7px; border-radius: 5px; background: rgba(59,130,246,.12); border: 1px solid rgba(59,130,246,.3); }
.cmp-table { width: 100%; border-collapse: collapse; }
.cmp-table th { font-family: var(--mono); font-size: 9.5px; color: var(--ink-3); letter-spacing: .08em; text-transform: uppercase; font-weight: 700; text-align: right; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.cmp-table th:first-child { text-align: left; }
.cmp-table td { font-family: var(--mono); font-size: 13.5px; font-weight: 700; color: var(--ink-2); text-align: right; padding: 11px 16px; border-bottom: 1px solid var(--line); font-feature-settings: "tnum" 1; }
.cmp-table td:first-child { text-align: left; color: var(--ink); }
.cmp-table tr:last-child td { border-bottom: none; }
.cmp-table .longer { color: var(--accent-strong); }
.cmp-table .longer::after { content: " ↑"; font-size: .85em; }
.cmp-note { padding: 13px 18px; border-top: 1px solid var(--line); background: var(--bg-2); font-size: 12.5px; color: var(--ink-2); line-height: 1.5; }
.cmp-note strong { color: var(--accent-strong); font-weight: 600; }
