/* Matrix57 Dashboard — draw-board styling.
   Palette: night-slate panels, brass-gold hits, plex-mono data lanes. */

:root {
  --bg: #11141d;
  --panel: #181d2a;
  --panel-2: #1f2535;
  --line: #2b3247;
  --ink: #dfe4f0;
  --ink-dim: #8b93a7;
  --gold: #e8b341;
  --gold-soft: #f2d27c;
  --green: #5fc88f;
  --red: #e06c5a;
  --display: "Saira Condensed", "Arial Narrow", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.45;
}

/* ------------------------------------------------------- masthead */
.masthead {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 20px 10px;
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: baseline; gap: 10px; }
.brand h1 {
  font-family: var(--display);
  font-weight: 700;
  font-size: 30px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin: 0;
}
.brand-sub {
  color: var(--ink-dim);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.brand-ball {
  width: 18px; height: 18px;
  border-radius: 50%;
  align-self: center;
  background: radial-gradient(circle at 35% 30%, var(--gold-soft), var(--gold) 60%, #9a7322);
  box-shadow: 0 0 10px rgba(232, 179, 65, 0.45);
}
.statusline { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 3px;
  padding: 4px 10px;
  font-size: 12px;
  color: var(--ink-dim);
  white-space: nowrap;
}
.chip.is-good { color: var(--green); border-color: rgba(95, 200, 143, 0.4); }
.chip.is-warn { color: var(--gold); border-color: rgba(232, 179, 65, 0.4); }
.chip.is-bad  { color: var(--red);  border-color: rgba(224, 108, 90, 0.4); }

/* ----------------------------------------------------------- tabs */
.tabs {
  display: flex;
  gap: 2px;
  padding: 0 20px;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}
.tab {
  font-family: var(--display);
  font-size: 16px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-dim);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 10px 14px 8px;
  cursor: pointer;
}
.tab:hover { color: var(--ink); }
.tab:focus-visible { outline: 2px solid var(--gold); outline-offset: -2px; }
.tab.is-active { color: var(--gold); border-bottom-color: var(--gold); }

/* ---------------------------------------------------------- views */
main { padding: 18px 20px 40px; max-width: 1400px; margin: 0 auto; }
.view { display: none; }
.view.is-active { display: block; }

.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 14px;
  margin-bottom: 14px;
}
.controls label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-dim);
}
select, input[type="number"] {
  background: var(--panel);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 6px 8px;
  font-family: var(--mono);
  font-size: 13px;
  min-width: 130px;
}
select:focus-visible, input:focus-visible, .btn:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 1px;
}
.btn {
  background: var(--gold);
  color: #221a08;
  border: none;
  border-radius: 3px;
  padding: 8px 16px;
  font-family: var(--display);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { background: var(--gold-soft); }
.btn-ghost {
  background: none;
  color: var(--gold);
  border: 1px solid var(--gold);
}
.btn-ghost:hover { background: rgba(232, 179, 65, 0.12); }
.btn[disabled] { opacity: 0.45; cursor: default; }

/* ------------------------------------------------ overview cards */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 14px 16px;
}
.card h3 {
  font-family: var(--display);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin: 0 0 8px;
}
.card .kv { display: flex; justify-content: space-between; gap: 10px; padding: 3px 0; }
.card .kv .k { color: var(--ink-dim); }
.card .picks { margin-top: 6px; color: var(--gold-soft); letter-spacing: 0.08em; }
.notposted { color: var(--red); }
.posted { color: var(--green); }

.panel-block {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 14px 16px;
  margin-bottom: 14px;
}
.panel-block h3 {
  font-family: var(--display);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0 0 8px;
  font-size: 18px;
}
.panel-block ul { margin: 0; padding-left: 18px; color: var(--ink-dim); }
.panel-block li strong { color: var(--ink); font-weight: 600; }

/* ------------------------------------------------- matrix tables */
.matrix-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--panel);
  max-height: 70vh;
}
table.matrix { border-collapse: collapse; width: max-content; min-width: 100%; }
table.matrix th, table.matrix td {
  padding: 4px 7px;
  text-align: center;
  font-size: 12px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
table.matrix thead th {
  position: sticky; top: 0;
  background: var(--panel-2);
  color: var(--gold);
  font-weight: 600;
  z-index: 6;
}
table.matrix td.date, table.matrix th.date {
  position: sticky; left: 0;
  background: var(--panel-2);
  color: var(--ink);
  text-align: left;
  z-index: 1;
}
table.matrix thead th.date { z-index: 7; }

/* PRED/pending row stays pinned just beneath the sticky header while scrolling.
   --pred-top is set per render (in JS) to the measured header height. */
table.matrix tbody tr.pred-row td {
  position: sticky; top: var(--pred-top, 26px);
  background: var(--panel);
  z-index: 4;
}
table.matrix tbody tr.pred-row td.date {
  z-index: 5;                /* frozen top-left corner: above header-left scroll and pred row */
  background: var(--panel-2);
}

/* Signature: skip heat lanes. 0 = drawn ball (gold chip);
   warm while fresh, fading to dim ink as the skip grows. */
td.s0 {
  background: radial-gradient(circle at 40% 35%, var(--gold-soft), var(--gold) 70%);
  color: #221a08;
  font-weight: 600;
  border-radius: 8px;
}
td.s1 { color: var(--gold-soft); }
td.s2 { color: #d8b86a; }
td.s3 { color: #b09a66; }
td.s4 { color: var(--ink-dim); }
td.s5 { color: #5b6275; }

.skip-meta { margin-bottom: 10px; color: var(--ink-dim); font-size: 12px; }
.skip-meta .tag {
  display: inline-block;
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 2px 7px;
  margin: 2px 4px 2px 0;
}
.skip-meta .tag.aligned { color: var(--gold); border-color: rgba(232,179,65,.45); }

/* ------------------------------------------------------------ run */
.run-note { color: var(--ink-dim); max-width: 70ch; }
.run-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 10px;
  margin: 14px 0 22px;
}
.run-grid .btn { width: 100%; padding: 12px 10px; }
.run-h2 {
  font-family: var(--display);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 18px;
}
.job-done { color: var(--green); }
.job-failed { color: var(--red); }
.job-running { color: var(--gold); }

.foot {
  border-top: 1px solid var(--line);
  color: var(--ink-dim);
  font-size: 12px;
  padding: 12px 20px 24px;
  text-align: center;
}

.empty { padding: 24px; color: var(--ink-dim); text-align: center; }

@media (max-width: 700px) {
  .brand h1 { font-size: 24px; }
  main { padding: 12px 10px 30px; }
}

/* ================================================================
   MOBILE / iPHONE — suppress header chrome so the matrix fills
   as much of the screen as possible.
   ================================================================ */
@media (max-width: 768px) {

  /* masthead: slim single line */
  .masthead {
    padding: 5px 10px 5px;
    gap: 6px;
    flex-wrap: nowrap;
    min-height: unset;
  }

  /* brand: tiny title only */
  .brand h1 { font-size: 14px; letter-spacing: 0.01em; }
  .brand-sub { display: none; }
  .brand-ball { width: 11px; height: 11px; }

  /* hide status chips — no room on mobile */
  .statusline { display: none; }

  /* hide run-controls if present */
  .masthead .run-controls { display: none; }

  /* tabs: very compact, hide +1 Patterns and Run entirely */
  .tabs { padding: 0 4px; gap: 0; overflow-x: auto; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { font-size: 10px; padding: 7px 8px 5px; letter-spacing: 0.02em; white-space: nowrap; }
  .tab[data-view="forecast"] { display: none; }
  .tab[data-view="run"]      { display: none; }

  /* main: maximum space for the matrix */
  main { padding: 6px 6px 100px; }
}

/* very small phones (iPhone SE 375px) */
@media (max-width: 390px) {
  .brand h1 { font-size: 13px; }
  .tab { font-size: 10px; padding: 7px 7px 5px; }
  main { padding: 6px 6px 100px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}


/* ---------------- prediction row ---------------- */
.pred-row td { border-bottom: 2px solid var(--gold, #e8b341); }
.pred-date { white-space: nowrap; color: var(--gold, #e8b341); font-weight: 600; }
.pred-tag { margin-left: 6px; padding: 1px 6px; border: 1px solid var(--gold, #e8b341);
  border-radius: 8px; font-size: 10px; letter-spacing: .08em; color: var(--gold, #e8b341); }
.pred-row td.pred-best, .pred-best { background: var(--gold, #e8b341) !important; color: #11141d !important;
  font-weight: 700; text-align: center; box-shadow: 0 0 0 2px rgba(232,179,65,.55) inset; font-size: 1.05em; }

/* Gold highlighter: value cells (PRED + history) matching the active skip/gap filter.
   Re-applied on every filtered render, so it changes live as the value is changed. */
table.matrix td.gold-hit { background: var(--gold, #e8b341) !important; color: #11141d !important;
  font-weight: 700; box-shadow: 0 0 0 2px rgba(232,179,65,.55) inset; }

/* Light-blue best-fit pattern match: PRED-row columns sitting at the most frequent
   golden-highlight values. Computed nightly; shown only when no skip/gap filter is active. */
table.matrix tr.pred-row td.pred-fit { background: #6db3f2 !important; color: #11141d !important;
  font-weight: 700; box-shadow: 0 0 0 2px rgba(109,179,242,.6) inset; }

/* Overlap: a PRED cell that is BOTH recommended-gold AND best-fit-blue -> green. */
table.matrix tr.pred-row td.pred-both { background: #34d27b !important; color: #08130c !important;
  font-weight: 700; text-align: center; box-shadow: 0 0 0 2px rgba(52,210,123,.6) inset; font-size: 1.05em; }
.pred-cov { color: var(--gold, #e8b341); border: 1px dashed rgba(232,179,65,.6); text-align: center; }
.pred-empty { background: rgba(255,255,255,.02); }


/* ------------- current skip value anchor row ------------- */
.current-row td { box-shadow: inset 0 2px 0 rgba(232,179,65,.45); }
.current-date { color: var(--gold, #e8b341); }
.cur-tag { margin-left: 6px; padding: 1px 5px; border-radius: 8px; font-size: 9px;
  letter-spacing: .08em; background: rgba(232,179,65,.18); color: var(--gold, #e8b341); }
.lane-row td { background: rgba(232,179,65,.07); border-bottom: 1px solid rgba(232,179,65,.4);
  font-size: 10px; line-height: 1.3; white-space: normal; max-width: 90px; }
.lane-label { white-space: nowrap; color: var(--gold, #e8b341); font-weight: 600; }
.lane-cell { color: #cfd6e4; text-align: center; }


/* ------------- original panorama layout ------------- */
th.extra, td.extra { color: #9aa3b5; font-size: 11px; white-space: nowrap; }
td.num-col { color: #e6ebf5; font-weight: 600; letter-spacing: .03em; }
td.sparse { background: rgba(255,255,255,.015); }
td.hit-cell { background: rgba(232,179,65,.16); color: var(--gold, #e8b341);
  font-weight: 700; text-align: center; }
td.pend-cell { color: #b9c2d4; text-align: center; }


/* ------------- play / no-play badge ------------- */
.play-badge { display: inline-block; margin: 0 0 8px 0; padding: 5px 14px;
  border-radius: 16px; font-size: 12px; font-weight: 700; letter-spacing: .06em; }
.badge-play { background: rgba(72,199,116,.15); color: #48c774;
  border: 1px solid rgba(72,199,116,.5); }
.badge-noplay { background: rgba(241,70,104,.12); color: #f14668;
  border: 1px solid rgba(241,70,104,.5); }

.forecast-strip { margin: 0 0 10px 0; font-size: 11px; color: #9aa3b5;
  letter-spacing: .03em; }

.pred-nums { color: var(--gold, #e8b341) !important; font-weight: 700; }

.btn-tool { background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.25);
  color: #e6ebf5 !important; }
.btn-tool:hover { background: rgba(232,179,65,.18); border-color: var(--gold, #e8b341);
  color: var(--gold, #e8b341) !important; }

.replay-tag { background: rgba(120,140,255,.18); color: #9fb0ff; border: 1px solid rgba(120,140,255,.4);
  padding: 1px 7px; border-radius: 8px; font-size: 10px; letter-spacing: .04em; }
.live-tag { background: rgba(86,205,130,.15); color: #6fe09a; border: 1px solid rgba(86,205,130,.4);
  padding: 1px 7px; border-radius: 8px; font-size: 10px; letter-spacing: .04em; }

.upcoming-tag { background: rgba(232,179,65,.16); color: var(--gold, #e8b341); border: 1px solid rgba(232,179,65,.45);
  padding: 1px 7px; border-radius: 8px; font-size: 10px; letter-spacing: .04em; }

.pred-gap { color: #8e9ab2; text-align: center; background: rgba(255,255,255,.03); }

.report-game { margin: 18px 0 26px; padding: 14px; border: 1px solid rgba(255,255,255,.08); border-radius: 6px; }
.report-h { margin: 0 0 10px; color: var(--gold, #e8b341); font-size: 15px; }
.report-sub { margin: 4px 0 8px; font-size: 12px; color: #aab4c8; text-transform: uppercase; letter-spacing: .05em; }
.report-cols { display: flex; gap: 28px; flex-wrap: wrap; }
.report-table td, .report-table th { padding: 4px 10px; }
.hit-num { color: var(--gold, #e8b341); font-weight: 700; }
.miss-num { color: #6b7488; }
.row-3plus td { background: rgba(86,205,130,.10); }
.small { font-size: 11px; margin-top: 6px; }

.report-sub-row { margin: 4px 0 10px; font-size: 12px; }
.best-tag { color: var(--gold, #e8b341); }

.bonus-row { font-size: 12px; color: #cdd5e3; padding: 4px 8px; background: rgba(232,179,65,.06);
  border-left: 3px solid var(--gold, #e8b341); border-radius: 3px; margin-bottom: 8px; }

.bonus-pick { color: var(--gold, #e8b341); font-weight: 700; }
.bonus-cell { white-space: nowrap; font-variant-numeric: tabular-nums; }

.band-small { color: #6fe09a; font-weight: 600; }
.band-mid { color: #e8b341; font-weight: 600; }

.band-large { color: #e57373; font-weight: 600; }
.band-row-small td { background: rgba(111,224,154,.06); }
.band-row-mid td { background: rgba(232,179,65,.06); }
.band-row-large td { background: rgba(229,115,115,.06); }
.stair-proj { font-weight: 700; }

.pkey { color: #aab4c8; font-weight: 600; white-space: nowrap; }

/* ---- column-selection checkbox dropdown ---- */
.coldd { position: relative; display: inline-block; }
.coldd > summary {
  list-style: none; cursor: pointer; padding: 7px 10px;
  border: 1px solid var(--line); border-radius: 8px;
  background: var(--panel-2); color: var(--ink); min-width: 120px;
  font-family: var(--mono); font-size: 13px;
}
.coldd > summary::-webkit-details-marker { display: none; }
.coldd > summary::after { content: " \25BE"; color: var(--ink-dim); }
.coldd[open] > summary { outline: 1px solid var(--gold); }
.coldd-menu {
  position: absolute; z-index: 60; top: calc(100% + 4px); left: 0;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 8px; min-width: 200px; max-height: 300px; overflow: auto;
  box-shadow: 0 10px 28px rgba(0,0,0,.45);
}
.coldd-acts { display: flex; gap: 8px; margin-bottom: 6px; }
.coldd-acts button {
  flex: 1; padding: 4px 6px; border: 1px solid var(--line); border-radius: 6px;
  background: var(--panel-2); color: var(--ink); cursor: pointer;
  font-family: var(--mono); font-size: 12px;
}
.coldd-acts button:hover { border-color: var(--gold); color: var(--gold-soft); }
.coldd-list { display: grid; grid-template-columns: repeat(4, auto); gap: 3px 12px; }
.coldd-list label {
  display: flex; align-items: center; gap: 5px; font-size: 12px;
  cursor: pointer; white-space: nowrap; color: var(--ink);
}
.coldd-list input { accent-color: var(--gold); }

/* ================================================================
   DEVICE-DEPENDENT LAYERS  (added — desktop >1024px unchanged)
   Tiers: touch tap-targets · iPad/tablet 769–1024 · phone refine
   ================================================================ */

/* momentum scrolling + clear edge cue on any touch matrix */
.matrix-wrap { -webkit-overflow-scrolling: touch; }

/* ---- touch devices: bigger tap targets for all controls ---- */
@media (pointer: coarse) {
  select, input[type="number"], .btn, button.btn {
    min-height: 40px;
    font-size: 15px;            /* avoids iOS zoom-on-focus (<16 zooms) */
  }
  .controls label { gap: 6px; }
  .tab { min-height: 38px; }
  /* coldd/value dropdowns and links easier to hit */
  .skip-filter-note a { padding: 2px 4px; }
}

/* ---- iPad / tablet (portrait + landscape, 769–1024px) ---- */
@media (min-width: 769px) and (max-width: 1024px) {
  main { padding: 14px 16px 60px; }
  .controls { gap: 12px; row-gap: 12px; }
  /* keep all status chips but let them wrap instead of overflow */
  .statusline { flex-wrap: wrap; }
  /* matrices: a touch more height since tablets are tall */
  .matrix-wrap { max-height: 74vh; }
  table.matrix th, table.matrix td { padding: 7px 9px; font-size: 13px; }
  .brand h1 { font-size: 20px; }
}

/* ---- phone refine (≤768px): make the crowded controls usable ---- */
@media (max-width: 768px) {
  /* each control gets a sensible min width and grows to fill the row */
  .controls { gap: 10px; row-gap: 10px; }
  .controls label { flex: 1 1 130px; min-width: 120px; }
  .controls select, .controls input[type="number"] { width: 100%; }
  /* Load button spans full width on its own line */
  .controls .btn, .controls button.btn { flex: 1 1 100%; width: 100%; }
  /* matrix fills the viewport width, scrolls sideways */
  .matrix-wrap { max-height: 66vh; border-radius: 6px; }
  table.matrix th, table.matrix td { padding: 6px 8px; font-size: 12px; }
  /* the column-value pickers and notes wrap cleanly */
  .skip-meta, #number-meta, #skip-meta { font-size: 12px; line-height: 1.6; }
}

/* very small phones: tighten control min-width so two fit per row */
@media (max-width: 390px) {
  .controls label { flex: 1 1 110px; min-width: 104px; }
}

/* ---- compact, uniform numeric value columns (narrow the wide ones) ---- */
table.matrix thead th:not(.date):not(.extra),
table.matrix td.hit-cell,
table.matrix td.sparse {
  width: 34px;
  min-width: 34px;
  max-width: 38px;
  padding-left: 3px;
  padding-right: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* tablet/phone: even tighter value columns */
@media (max-width: 1024px) {
  table.matrix thead th:not(.date):not(.extra),
  table.matrix td.hit-cell,
  table.matrix td.sparse { width: 30px; min-width: 30px; max-width: 34px; }
}

/* ---- Skip Matrix: narrower Date column ---- */
#skip-table table.matrix td.date,
#skip-table table.matrix th.date {
  width: 150px;
  min-width: 150px;
  max-width: 150px;
  white-space: normal;       /* let the LAST DRAW / PRED tag wrap under the date */
}
#skip-table table.matrix td.date .cur-tag,
#skip-table table.matrix td.date .pred-tag { white-space: nowrap; }

/* ---- trim wide columns on BOTH matrices (Number + Skip) ---- */
#number-table table.matrix td.date,
#number-table table.matrix th.date,
#skip-table table.matrix td.date,
#skip-table table.matrix th.date {
  width: 120px;
  min-width: 120px;
  max-width: 120px;
  white-space: normal;       /* LAST DRAW / PRED tag wraps under the date */
}
/* DOW / Draw / Numbers (the .extra columns): cap and keep on one line */
#number-table table.matrix td.extra,
#number-table table.matrix th.extra,
#skip-table table.matrix td.extra,
#skip-table table.matrix th.extra {
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* Numbers cell: fixed width that fits five 2-digit numbers; CLIP so it never spills into column 01 */
#number-table table.matrix th:nth-child(4),
#number-table table.matrix td:nth-child(4) { width: 150px; min-width: 150px; max-width: 150px; white-space: nowrap; overflow: hidden; text-overflow: clip; }
#skip-table table.matrix td.num-col { max-width: 130px; overflow: hidden; text-overflow: clip; }

/* ---- Skip Matrix: trim the DOW column (3rd column) ---- */
#skip-table table.matrix th:nth-child(3),
#skip-table table.matrix td:nth-child(3) {
  width: 72px;
  min-width: 72px;
  max-width: 72px;
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---- Skip Matrix: trim the Skip Number column (4th column) ---- */
#skip-table table.matrix th:nth-child(4),
#skip-table table.matrix td:nth-child(4) {
  width: 130px;
  min-width: 130px;
  max-width: 130px;
  white-space: normal;      /* let 5-value rows wrap instead of forcing width */
  word-spacing: 1px;
}

/* ---- Skip Matrix: trim the Draw column (1st column) ---- */
#skip-table table.matrix th:nth-child(1):not(.date),
#skip-table table.matrix td:nth-child(1):not(.date) {
  width: 54px;
  min-width: 54px;
  max-width: 54px;
  white-space: nowrap;
}

/* ---- matrix zoom +/- control ---- */
.zoomctl {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-left: 4px;
}
.zoomctl-lbl { font-size: 11px; color: var(--ink-dim); letter-spacing: .04em; }
.zoomctl-pct { min-width: 44px; text-align: center; font-size: 12px; font-family: var(--mono); color: var(--ink); }
.zoomctl .zbtn { min-width: 32px; padding: 5px 9px; font-size: 14px; line-height: 1; }
.zoomctl .zreset { font-size: 11px; padding: 5px 8px; }
@media (pointer: coarse) { .zoomctl .zbtn { min-height: 38px; } }


/* Odd/Even + Hot/Med/Cold blue-lane profile tags */
.blue-profile-strip { margin: 8px 2px 2px; font-size: 12px; color: var(--mut,#8aa0c6); display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.blue-profile-strip .bps-label { color: var(--mut,#8aa0c6); }
.blue-prof { display: inline-flex; gap: 5px; align-items: center; background: #0e1730; border: 1px solid #1e2a44; border-radius: 6px; padding: 2px 8px; }
.blue-prof b { color: #6db3f2; font-weight: 700; }
.blue-prof .bp-par { color: #9fb0d0; }
.blue-prof .bp-temp { font-weight: 700; }
.blue-prof .bp-temp.bp-hot { color: #ff7a59; }
.blue-prof .bp-temp.bp-medium { color: #f5c451; }
.blue-prof .bp-temp.bp-cold { color: #6db3f2; }

/* 3+ WATCH — pre-draw armed flash on both matrices. Honest by design:
   states true odds and that they never change; pulses only while tonight's
   lines are pending (unevaluated). */
.threeplus-armed {
  border: 1px solid rgba(232, 179, 65, 0.55);
  background: rgba(232, 179, 65, 0.08);
  color: var(--gold-soft, #f2d27c);
  animation: tpPulse 1.6s ease-in-out infinite;
  display: flex; align-items: center; gap: 8px;
}
.threeplus-armed b { color: var(--gold, #e8b341); letter-spacing: 0.06em; }
.tp-dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--gold, #e8b341);
  box-shadow: 0 0 6px var(--gold, #e8b341);
  animation: tpDot 1.6s ease-in-out infinite;
}
@keyframes tpPulse { 0%,100% { box-shadow: 0 0 0 0 rgba(232,179,65,0.0); } 50% { box-shadow: 0 0 10px 1px rgba(232,179,65,0.35); } }
@keyframes tpDot   { 0%,100% { opacity: 0.35; } 50% { opacity: 1; } }

/* Number->Skip sync: a skip-value column header whose value is some lane's
   CURRENT skip in the Number Matrix. Hover names the lanes sitting on it. */
th.sync-col { color: #6db3f2; box-shadow: inset 0 -2px 0 #3b82f6; position: relative; }
th.sync-col .sync-dot {
  display: inline-block; width: 5px; height: 5px; border-radius: 50%;
  background: #3b82f6; margin-left: 3px; vertical-align: super;
  box-shadow: 0 0 4px #3b82f6;
}

/* RED third-line pick on the PRED row: disjoint from gold+blue by construction. */
td.pred-red { background: rgba(224, 82, 82, 0.16); color: #ff8f8f; font-weight: 700; box-shadow: inset 0 0 0 1px rgba(224, 82, 82, 0.5); }

/* r21: positional analysis strip */
.pos-strip { border-left: 3px solid #b58cf2; }

/* r22: positional echo — history cell matching its column's current PRED value */
td.pos-echo { outline: 2px solid #e05252; outline-offset: -2px; border-radius: 3px; }

/* r23: gold/blue selections projected onto skip-value columns */
th.selsync-gold { box-shadow: inset 0 -3px 0 #f5c451; }
th.selsync-blue { box-shadow: inset 0 3px 0 #3b82f6; }
th.selsync-gold.selsync-blue { box-shadow: inset 0 -3px 0 #f5c451, inset 0 3px 0 #3b82f6; }

/* r24: reverse sync — PRED value has a live skip-value column */
tr.pred-row td.valsync { box-shadow: inset 0 -3px 0 rgba(59,130,246,.75); }

/* r25: shared gold+blue target columns on the Skip Matrix — split coloring */
#skip-table tr.pred-row td.pred-both {
  background: linear-gradient(135deg, #6b5416 0 49%, #1d3a6b 51% 100%) !important;
  box-shadow: inset 0 0 0 3px #22d3ee;           /* cyan, bold on overlap */
  font-weight: 900;
  color: #ffffff !important;                     /* white text on overlap */
}
th.selsync-gold.selsync-blue {                    /* overlapped header too */
  box-shadow: inset 0 -3px 0 #22d3ee, inset 0 3px 0 #22d3ee;
  color: #22d3ee; font-weight: 900;
}

/* r28: professional product UI refresh.
   This layer keeps the existing data/matrix mechanics intact while moving the
   shell toward a trust-forward SaaS dashboard.
   SCOPED 07/06: light is OPT-IN via <html data-theme="light">. Dark is the default. */
html[data-theme="light"] {
  color-scheme: light;
  --bg: #f6f8fb;
  --panel: #ffffff;
  --panel-2: #f8fafc;
  --line: #dbe3ef;
  --ink: #172033;
  --ink-dim: #64748b;
  --gold: #2563eb;
  --gold-soft: #8bb7ff;
  --green: #0f9f6e;
  --red: #c2410c;
  --display: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --mut: #64748b;
}

html[data-theme="light"] th.extra,
html[data-theme="light"] td.extra {
  color: #475569;
}

html[data-theme="light"] td.num-col,
html[data-theme="light"] .pred-nums {
  color: #172033 !important;
}

html[data-theme="light"] .pred-gap {
  background: #f8fafc;
  color: #475569;
}

html[data-theme="light"] .cur-tag {
  background: rgba(37, 99, 235, 0.1);
  color: #1e40af;
}

body * { letter-spacing: 0; }

body {
  background:
    linear-gradient(180deg, rgba(37, 99, 235, 0.04), rgba(20, 184, 166, 0) 320px),
    var(--bg);
  color: var(--ink);
  font-family: var(--display);
  font-size: 14px;
}

.masthead {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
  padding: 14px 24px 12px;
}

.brand {
  align-items: center;
  gap: 12px;
}

.brand h1 {
  font-family: var(--display);
  font-size: 22px;
  text-transform: none;
  color: var(--ink);
}

.brand-sub {
  color: var(--ink-dim);
  font-size: 12px;
  text-transform: none;
}

.brand-ball {
  width: 18px;
  height: 18px;
  border-radius: 5px;
  background: linear-gradient(135deg, #2563eb, #14b8a6);
  box-shadow: none;
}

.chip {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink-dim);
  font-family: var(--mono);
}

.chip.is-good {
  background: rgba(15, 159, 110, 0.08);
  color: #087553;
  border-color: rgba(15, 159, 110, 0.25);
}

.chip.is-warn {
  background: rgba(245, 158, 11, 0.1);
  color: #9a6200;
  border-color: rgba(245, 158, 11, 0.25);
}

.tabs {
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--line);
  gap: 4px;
  padding: 0 24px;
}

.tab {
  border-radius: 0;
  color: var(--ink-dim);
  font-family: var(--display);
  font-size: 14px;
  font-weight: 600;
  text-transform: none;
  padding: 12px 11px 10px;
}

.tab:hover {
  color: var(--ink);
  background: #f8fafc;
}

.tab:focus-visible,
select:focus-visible,
input:focus-visible,
.btn:focus-visible {
  outline: 2px solid rgba(37, 99, 235, 0.55);
  outline-offset: 2px;
}

.tab.is-active {
  color: #1d4ed8;
  border-bottom-color: #2563eb;
  background: transparent;
}

main {
  max-width: 1440px;
  padding: 20px 24px 44px;
}

.controls {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.04);
  padding: 12px;
}

.controls label {
  color: var(--ink-dim);
  font-family: var(--display);
  font-size: 12px;
  font-weight: 650;
  text-transform: none;
}

select,
input[type="number"],
.coldd > summary {
  background: #ffffff;
  border: 1px solid #cfd8e6;
  border-radius: 6px;
  color: var(--ink);
  font-family: var(--display);
  min-height: 36px;
}

.btn {
  background: #2563eb;
  border: 1px solid #2563eb;
  border-radius: 6px;
  color: #ffffff;
  font-family: var(--display);
  font-size: 14px;
  font-weight: 700;
  min-height: 36px;
  padding: 7px 14px;
  text-transform: none;
}

.btn:hover {
  background: #1d4ed8;
  border-color: #1d4ed8;
}

.btn-ghost,
.btn-tool {
  background: #ffffff;
  border: 1px solid #cfd8e6;
  color: #1d4ed8 !important;
}

.btn-ghost:hover,
.btn-tool:hover {
  background: #eff6ff;
  border-color: #93b8ff;
  color: #1d4ed8 !important;
}

.cards {
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 14px;
}

.card,
.panel-block,
.matrix-wrap,
.report-game {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.05);
}

.card {
  padding: 16px;
}

.card h3,
.panel-block h3,
.run-h2,
.report-h,
.report-sub {
  color: var(--ink);
  font-family: var(--display);
  text-transform: none;
}

.card h3 {
  font-size: 16px;
  margin-bottom: 12px;
}

.card .kv {
  align-items: baseline;
  border-top: 1px solid #eef2f7;
  padding: 7px 0;
}

.card .kv:first-of-type {
  border-top: 0;
}

.card .kv .k,
.panel-block ul,
.run-note,
.skip-meta,
.forecast-strip,
.small {
  color: var(--ink-dim);
}

.card .picks,
.pred-nums,
.bonus-pick {
  color: #1d4ed8 !important;
}

.posted {
  color: #087553;
  font-weight: 700;
}

.notposted {
  color: #b45309;
}

.matrix-wrap {
  background: #ffffff;
}

table.matrix th,
table.matrix td {
  border-bottom: 1px solid #e8eef6;
  font-family: var(--mono);
}

table.matrix thead th,
table.matrix td.date,
table.matrix th.date,
table.matrix tbody tr.pred-row td.date {
  background: #f8fafc;
}

table.matrix thead th {
  color: #1d4ed8;
}

td.s0 {
  background: #dff8ee;
  color: #075e45;
  border-radius: 4px;
}

td.s1 { color: #0f9f6e; }
td.s2 { color: #b7791f; }
td.s3 { color: #a16207; }
td.s4 { color: #64748b; }
td.s5 { color: #94a3b8; }

.pred-row td {
  border-bottom-color: #2563eb;
}

.pred-tag,
.upcoming-tag,
.live-tag,
.replay-tag {
  border-radius: 6px;
}

.pred-row td.pred-best,
.pred-best,
table.matrix td.gold-hit {
  background: #2563eb !important;
  color: #ffffff !important;
  box-shadow: inset 0 0 0 1px rgba(29, 78, 216, 0.35);
}

html[data-theme="light"] .live-tag {
  background: rgba(15, 159, 110, 0.1);
  border-color: rgba(15, 159, 110, 0.28);
  color: #087553;
}

html[data-theme="light"] .upcoming-tag {
  background: rgba(29, 78, 216, 0.1);
  border-color: rgba(29, 78, 216, 0.28);
  color: #1e40af;
}

html[data-theme="light"] .replay-tag {
  background: rgba(71, 85, 105, 0.1);
  border-color: rgba(71, 85, 105, 0.25);
  color: #334155;
}

html[data-theme="light"] .run-note {
  color: #475569;
}

.pred-cov {
  color: #1d4ed8;
  border-color: rgba(37, 99, 235, 0.45);
}

.pred-empty,
.pred-gap {
  background: #f8fafc;
}

.play-badge {
  border-radius: 6px;
  font-family: var(--display);
}

.badge-play {
  background: rgba(15, 159, 110, 0.08);
  color: #087553;
  border-color: rgba(15, 159, 110, 0.25);
}

.badge-noplay {
  background: rgba(100, 116, 139, 0.08);
  color: #475569;
  border-color: rgba(100, 116, 139, 0.25);
}

.threeplus-armed {
  background: #f8fbff;
  border-color: rgba(37, 99, 235, 0.22);
  color: #475569;
  animation: none;
}

.threeplus-armed b {
  color: #1d4ed8;
}

.tp-dot {
  background: #14b8a6;
  box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.12);
  animation: none;
}

.foot {
  background: #ffffff;
  border-top: 1px solid var(--line);
  color: var(--ink-dim);
  font-family: var(--display);
}

@media (max-width: 768px) {
  .masthead {
    background: #ffffff;
    padding: 8px 10px;
  }

  .brand h1 {
    font-size: 16px;
  }

  .tabs {
    padding: 0 6px;
  }

  main {
    padding: 10px 8px 100px;
  }

  .controls {
    padding: 10px;
  }

  .cards {
    grid-template-columns: 1fr;
  }
}

/* ---------- r31 device fit: final responsive guardrails ---------- */
html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

main,
.view,
.cards,
.card,
.panel-block,
.controls,
.matrix-wrap {
  min-width: 0;
  max-width: 100%;
}

.brand,
.statusline,
.tabs,
.controls,
.zoomctl {
  min-width: 0;
}

.brand h1,
.chip,
.tab {
  overflow: hidden;
  text-overflow: ellipsis;
}

.tabs {
  overscroll-behavior-inline: contain;
  -webkit-overflow-scrolling: touch;
}

.tab {
  flex: 0 0 auto;
  white-space: nowrap;
}

.matrix-wrap {
  width: 100%;
  overflow: auto;
  overscroll-behavior: contain;
}

.controls > *,
.controls label {
  min-width: 0;
}

@media (max-width: 1024px) {
  main {
    padding-inline: 16px;
  }

  .masthead {
    align-items: center;
  }

  .brand {
    flex: 1 1 auto;
  }

  .brand h1 {
    min-width: 0;
    white-space: nowrap;
  }

  .statusline {
    flex: 0 1 auto;
    justify-content: flex-end;
  }

  .cards {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  }
}

@media (min-width: 641px) and (max-width: 1024px) {
  .controls {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: end;
    gap: 10px;
  }

  .controls label,
  .controls select,
  .controls input[type="number"],
  .controls .btn,
  .controls button.btn {
    width: 100%;
    min-width: 0;
  }

  .zoomctl {
    grid-column: span 3;
    justify-content: flex-start;
    margin-left: 0;
  }

  .cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 768px) {
  body {
    font-size: 13px;
  }

  .masthead {
    flex-wrap: nowrap;
    gap: 8px;
    padding: 7px 8px;
  }

  .brand {
    gap: 8px;
    min-width: 0;
  }

  .brand h1 {
    font-size: 16px;
    line-height: 1.1;
  }

  .tabs {
    gap: 2px;
    padding: 0 6px;
  }

  .tab {
    min-height: 34px;
    padding: 8px 9px 6px;
    font-size: 12px;
    line-height: 1.05;
  }

  main {
    padding: 8px 8px 72px;
  }

  .controls {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: end;
    gap: 8px;
    padding: 8px;
  }

  .controls label {
    width: auto;
    min-width: 0;
  }

  .controls select,
  .controls input[type="number"],
  .controls .btn,
  .controls button.btn {
    width: 100%;
    min-width: 0;
    font-size: 12px;
  }

  .controls .btn,
  .controls button.btn {
    padding-inline: 8px;
  }

  .zoomctl {
    grid-column: 1 / -1;
    justify-content: space-between;
    width: 100%;
    margin-left: 0;
  }

  .card,
  .panel-block {
    padding: 12px;
  }

  .card .kv {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: baseline;
  }

  .card .kv > * {
    min-width: 0;
  }

  .matrix-wrap {
    max-height: calc(100dvh - 170px);
  }
}

@media (max-width: 640px) {
  .cards {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
  }
}

@media (max-width: 430px) {
  .brand h1 {
    font-size: 15px;
  }

  .tab {
    padding-inline: 8px;
    font-size: 11px;
  }

  main {
    padding-inline: 6px;
  }

  .controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
  }

  .card .kv {
    grid-template-columns: 1fr;
    gap: 2px;
  }
}

@media (max-width: 340px) {
  .controls {
    grid-template-columns: 1fr;
  }
}

/* r33 interface validation: readable controls, predictable focus, touch-safe rhythm */
:root {
  --control-radius: 6px;
  --control-min: 36px;
  --focus-blue: rgba(37, 99, 235, 0.62);
}

button,
.btn,
.tab,
select,
input[type="number"],
summary {
  -webkit-tap-highlight-color: rgba(37, 99, 235, 0.14);
}

button,
.btn,
.tab,
select,
input[type="number"],
.coldd > summary {
  transition:
    background-color 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease,
    box-shadow 0.15s ease,
    transform 0.08s ease;
}

select,
input[type="number"],
.coldd > summary {
  min-height: var(--control-min);
  line-height: 1.2;
}

.btn,
button.btn,
.tab,
select,
input[type="number"] {
  font-variant-numeric: tabular-nums;
}

.btn:not(:disabled):active,
button.btn:not(:disabled):active,
.tab:active,
.coldd > summary:active {
  transform: translateY(1px);
}

.btn[disabled],
button[disabled],
select:disabled,
input:disabled {
  cursor: not-allowed;
  filter: saturate(0.85);
}

.masthead {
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  backdrop-filter: saturate(180%) blur(14px);
}

.tab:focus-visible,
select:focus-visible,
input:focus-visible,
.btn:focus-visible,
.coldd > summary:focus-visible {
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

@media (pointer: coarse) {
  select,
  input[type="number"],
  .btn,
  button.btn,
  .coldd > summary {
    min-height: 40px;
  }

  .tab {
    min-height: 38px;
  }
}
