/* Premium Dark Glass (spec §64): dark, dense but calm, glass panels where they help, numbers first.
   Colour carries meaning only for confidence (green / yellow / red / grey) and for the accent. */
:root {
  --bg-0: #050a14; --bg-1: #0a1322; --bg-2: #0f1b30;
  --glass: rgba(148, 178, 222, 0.06); --glass-strong: rgba(148, 178, 222, 0.10);
  --stroke: rgba(160, 190, 235, 0.12); --stroke-strong: rgba(160, 190, 235, 0.22);
  --text: #eaf1fb; --text-2: #b4c2d6; --muted: #7f90a8;
  --accent: #46d2ff; --accent-2: #8f7cff; --accent-ink: #03131f;
  --green: #34d399; --yellow: #fbbf24; --red: #f87171; --grey: #6b7a90;
  --green-bg: rgba(52, 211, 153, 0.12); --yellow-bg: rgba(251, 191, 36, 0.12);
  --red-bg: rgba(248, 113, 113, 0.12); --grey-bg: rgba(107, 122, 144, 0.14);
  --radius: 16px; --radius-s: 10px; --gap: 14px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
  font: 15px/1.45 var(--font);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; color: var(--text); min-height: 100vh;
  background:
    radial-gradient(900px 500px at 12% -8%, rgba(70, 210, 255, 0.10), transparent 60%),
    radial-gradient(800px 500px at 100% 0%, rgba(143, 124, 255, 0.10), transparent 55%),
    linear-gradient(180deg, var(--bg-1), var(--bg-0) 60%) fixed;
}
.num-tab, .big, .stat b, td.n, .odds-pill { font-variant-numeric: tabular-nums; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
button, select, input {
  font: inherit; color: var(--text); background: var(--glass-strong); border: 1px solid var(--stroke);
  border-radius: var(--radius-s); padding: 8px 12px; min-height: 38px;
}
button { cursor: pointer; transition: background .15s, border-color .15s; }
button:hover { border-color: var(--stroke-strong); }
button.primary { background: linear-gradient(135deg, var(--accent), #6fb8ff); color: var(--accent-ink); border: 0; font-weight: 650; }
button.on { border-color: var(--accent); color: var(--accent); background: rgba(70, 210, 255, 0.10); }
select { appearance: none; padding-right: 30px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 16px) 16px, calc(100% - 11px) 16px; background-size: 5px 5px; background-repeat: no-repeat; }

/* ---------- glass ---------- */
.glass { background: linear-gradient(180deg, rgba(160, 190, 235, 0.08), rgba(160, 190, 235, 0.03));
  border: 1px solid var(--stroke); border-radius: var(--radius); box-shadow: var(--shadow);
  -webkit-backdrop-filter: blur(14px) saturate(120%); backdrop-filter: blur(14px) saturate(120%); }
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) { .glass { background: var(--bg-2); } }

/* ---------- header and navigation ---------- */
.top { position: sticky; top: 0; z-index: 10; display: flex; gap: 14px; align-items: center; justify-content: space-between;
  padding: 10px 20px; background: rgba(6, 12, 22, 0.72); border-bottom: 1px solid var(--stroke);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); }
.brand { display: flex; gap: 11px; align-items: center; cursor: pointer; min-width: 0; }
.brand b { letter-spacing: .01em; }
.brand > div { min-width: 0; overflow: hidden; }
.brand small { display: block; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.logo { flex: none; width: 30px; height: 30px; border-radius: 9px;
  background: conic-gradient(from 210deg, var(--accent), var(--accent-2), var(--accent));
  box-shadow: 0 0 18px rgba(70, 210, 255, 0.35); }
.tabs { display: flex; gap: 2px; padding: 3px; border-radius: 12px; background: var(--glass); border: 1px solid var(--stroke); }
.tabs a { display: flex; align-items: center; gap: 7px; padding: 7px 12px; border-radius: 9px; color: var(--text-2); white-space: nowrap; font-size: 14px; }
.tabs a:hover { text-decoration: none; color: var(--text); }
.tabs a.active { background: var(--glass-strong); color: var(--text); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06); }
.tabs svg { width: 17px; height: 17px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
main { max-width: 1160px; margin: 0 auto; padding: 18px 20px 48px; }
.banner { max-width: 1160px; margin: 12px auto 0; padding: 10px 14px; border-radius: var(--radius-s);
  background: var(--yellow-bg); border: 1px solid rgba(251, 191, 36, 0.35); color: #fde3a1; }
.banner.error { background: var(--red-bg); border-color: rgba(248, 113, 113, 0.4); color: #fecaca; }
.foot { text-align: center; color: var(--muted); font-size: 12px; padding: 18px 16px 28px; }

/* ---------- sections and filters ---------- */
.section-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 10px; margin: 28px 0 12px; }
h2 { font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin: 0; font-weight: 650; }
.section-head .meta { text-align: right; }
.toolbar { position: sticky; top: 61px; z-index: 5; display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  padding: 8px; margin: 0 -8px; border-radius: 14px; }
.toolbar.stuck { background: rgba(6, 12, 22, 0.78); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); }
.seg { display: inline-flex; background: var(--glass); border: 1px solid var(--stroke); border-radius: 12px; padding: 3px; }
.seg button { border: 0; background: none; min-height: 32px; padding: 5px 12px; color: var(--text-2); border-radius: 9px; }
.seg button.on { background: var(--glass-strong); color: var(--text); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06); }
.funnel { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; color: var(--muted); font-size: 12px; }
.funnel b { color: var(--text-2); font-weight: 600; }
.funnel i { opacity: .5; font-style: normal; }
.grid { display: grid; gap: var(--gap); grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.meta { color: var(--muted); font-size: 12px; }
.muted { color: var(--muted); }

/* ---------- confidence semantics ---------- */
.tone-GREEN { --tone: var(--green); --tone-bg: var(--green-bg); }
.tone-YELLOW { --tone: var(--yellow); --tone-bg: var(--yellow-bg); }
.tone-RED { --tone: var(--red); --tone-bg: var(--red-bg); }
.tone-BLACK { --tone: var(--grey); --tone-bg: var(--grey-bg); }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px;
  font-weight: 650; color: var(--tone); background: var(--tone-bg); white-space: nowrap; }
.trust { display: flex; flex-wrap: wrap; gap: 6px 10px; margin-top: 10px; font-size: 12px; color: var(--muted); }
.trust > span { white-space: nowrap; }
.life { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 650;
  border: 1px solid rgba(255, 255, 255, 0.14); color: var(--text, #e8eef6); }
.life-VALID { border-color: var(--green); color: var(--green); }
.life-CANDIDATE { border-color: var(--yellow); color: var(--yellow); }
.life-DEGRADED { border-color: var(--yellow); color: var(--yellow); }
.life-INVALIDATED, .life-EXPIRED { border-color: var(--grey); color: var(--grey); }
.fresh-STALE, .fresh-UNKNOWN { color: var(--red); } .fresh-AGING { color: var(--yellow); }
.chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--tone); box-shadow: 0 0 8px var(--tone); }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--tone); box-shadow: 0 0 10px var(--tone); }
.mock { color: #c9b3ff; border: 1px dashed #b39cff; border-radius: 6px; padding: 0 6px; font-size: 11px; margin-left: 6px; font-weight: 600; }

/* ---------- pick card ---------- */
.pick { position: relative; padding: 16px 16px 14px 19px; overflow: hidden; }
.pick::before { content: ""; position: absolute; left: 0; top: 14px; bottom: 14px; width: 3px; border-radius: 0 3px 3px 0;
  background: var(--tone); box-shadow: 0 0 12px var(--tone); }
.pick-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.pick h3 { margin: 8px 0 2px; font-size: 17px; font-weight: 650; letter-spacing: -.005em; }
.pick-sel { color: var(--text-2); font-size: 14px; }
.pick-sel b { color: var(--text); }
.hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 14px 0 8px; }
.big { font-size: 34px; line-height: 1; font-weight: 700; letter-spacing: -.02em; }
.hero small, .stat small { display: block; color: var(--muted); font-size: 11px; margin-top: 5px; letter-spacing: .02em; }
.odds-pill { text-align: right; flex: none; }
.odds-pill small { display: block; color: var(--muted); font-size: 11px; font-weight: 400; margin-top: 5px; }
.odds-pill .big { font-size: 26px; color: var(--text-2); }
/* probability bar: fill = our estimate, tick = bookmakers' fair probability */
.pbar { position: relative; height: 8px; border-radius: 999px; background: rgba(255, 255, 255, 0.07); margin: 6px 0 4px; }
.pbar .fill { position: absolute; inset: 0 auto 0 0; border-radius: 999px;
  background: linear-gradient(90deg, rgba(70, 210, 255, 0.55), var(--accent)); }
.pbar .tick { position: absolute; top: -4px; width: 2px; height: 16px; border-radius: 2px; background: #fff; opacity: .85; }
.pbar-legend { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(86px, 1fr)); gap: 8px; margin-top: 12px; }
.stat { padding: 8px 10px; border-radius: var(--radius-s); background: rgba(0, 0, 0, 0.22); border: 1px solid rgba(255, 255, 255, 0.04); }
.stat b { font-size: 15px; font-weight: 650; white-space: nowrap; }
.stat b.pos { color: var(--green); } .stat b.neg { color: var(--red); }
.gauge { display: flex; align-items: center; gap: 8px; }
.gauge svg { width: 30px; height: 30px; flex: none; transform: rotate(-90deg); }
.gauge circle { fill: none; stroke-width: 4; }
.gauge .track { stroke: rgba(255, 255, 255, 0.10); }
.gauge .val { stroke: var(--accent); stroke-linecap: round; }
.pick-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 12px; }
details { margin-top: 10px; }
details summary { cursor: pointer; color: var(--accent); list-style: none; font-size: 14px; }
details summary::-webkit-details-marker { display: none; }
details summary::before { content: "›"; display: inline-block; margin-right: 6px; transition: transform .15s; }
details[open] summary::before { transform: rotate(90deg); }
ul.factors { margin: 8px 0 0; padding: 0; list-style: none; }
ul.factors li { padding: 3px 0 3px 20px; position: relative; font-size: 13px; color: var(--text-2); }
ul.factors li.pos::before, ul.factors li.neg::before { position: absolute; left: 2px; top: 3px; font-weight: 800; }
ul.factors li.pos::before { content: "+"; color: var(--green); }
ul.factors li.neg::before { content: "–"; color: var(--red); }

/* ---------- parlays ---------- */
.parlay { padding: 16px; }
.parlay h3 { margin: 0; font-size: 15px; font-weight: 650; }
.parlay .head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 10px; }
.parlay .head .big { font-size: 28px; }
.leg { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid var(--stroke); }
.leg .meta { margin-top: 2px; }
.leg b { font-size: 15px; }

.empty { color: var(--muted); padding: 16px; border: 1px dashed var(--stroke-strong); border-radius: var(--radius); text-align: center; }
.empty strong { display: block; color: var(--text-2); margin-bottom: 4px; }

/* ---------- event list ---------- */
.events { display: flex; flex-direction: column; gap: 6px; }
.ev { display: grid; grid-template-columns: 96px minmax(0, 1fr) 210px 170px; gap: 12px; align-items: center; padding: 10px 14px;
  border-radius: 12px; background: var(--glass); border: 1px solid transparent; cursor: pointer; }
.ev:hover { border-color: var(--stroke-strong); background: var(--glass-strong); }
.ev .time { color: var(--text-2); font-size: 13px; font-variant-numeric: tabular-nums; }
.ev .teams { min-width: 0; }
.ev .teams b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev .best { font-size: 13px; color: var(--text-2); }
.ev .best .pbar { height: 5px; margin: 5px 0 0; }
.ev .state { font-size: 12px; text-align: right; }
.ev .state .meta { margin-top: 3px; }

/* ---------- tables and sections ---------- */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--stroke); vertical-align: top; }
th { color: var(--muted); font-weight: 550; font-size: 12px; }
td.n { text-align: right; }
.section { padding: 2px 16px; margin: 12px 0; }
.section > summary { padding: 13px 0; color: var(--text); font-weight: 650; font-size: 15px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; }
.row label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--muted); }
.row input { width: 116px; }
.card { padding: 16px; }
.kpis { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
svg.spark { width: 100%; height: 64px; }
.title-block h1 { font-size: 22px; margin: 6px 0 2px; letter-spacing: -.01em; }

/* ---------- skeleton ---------- */
.skeleton { border-radius: var(--radius); background: linear-gradient(100deg, var(--glass) 40%, var(--glass-strong) 50%, var(--glass) 60%);
  background-size: 300% 100%; animation: shimmer 1.4s infinite linear; border: 1px solid var(--stroke); }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }
@media (prefers-reduced-motion: reduce) {
  .skeleton { animation: none; } * { transition: none !important; }
}

/* ---------- phone ---------- */
@media (max-width: 760px) {
  /* a backdrop-filter on the header would make it the containing block of the fixed bottom bar */
  .top { padding: 9px 14px; -webkit-backdrop-filter: none; backdrop-filter: none; background: rgba(6, 12, 22, 0.95); }
  .brand { flex: 1; }
  main { padding: 12px 14px 96px; }
  .tabs { position: fixed; z-index: 20; left: 10px; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom));
    justify-content: space-around; padding: 5px; border-radius: 16px; background: rgba(8, 15, 28, 0.86);
    -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5); }
  .tabs a { flex-direction: column; gap: 3px; padding: 6px 4px; font-size: 10.5px; flex: 1; justify-content: center; }
  .tabs svg { width: 20px; height: 20px; }
  .toolbar { position: static; margin: 0; padding: 0; }   /* three rows would cover the screen if sticky */
  .grid { grid-template-columns: 1fr; }
  .big { font-size: 30px; }
  .ev { grid-template-columns: 1fr auto; grid-template-areas: "time state" "teams teams" "best best"; gap: 4px 10px; }
  .ev .time { grid-area: time; font-size: 12px; }
  .ev .teams { grid-area: teams; } .ev .state { grid-area: state; } .ev .best { grid-area: best; }
  .ev .state .meta { display: none; }
  table { display: block; overflow-x: auto; }     /* wide tables scroll inside themselves, not the page */
  .foot { padding-bottom: 96px; }
}

/* history, diagnostics and other plain sections */
#app > h2 { margin: 26px 0 10px; }
#app > table { border-radius: var(--radius); background: var(--glass); border: 1px solid var(--stroke); overflow: hidden; }
#app > table tr:last-child td { border-bottom: 0; }
#app > p { color: var(--text-2); }

span.pos { color: var(--green); font-weight: 650; } span.neg { color: var(--red); font-weight: 650; }

/* connection indicator in the header */
.conn { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-left: 6px; vertical-align: middle; }
.conn.ok { background: var(--green); box-shadow: 0 0 8px var(--green); }
.conn.wait { background: var(--yellow); box-shadow: 0 0 8px var(--yellow); }
.conn.off { background: var(--red); box-shadow: 0 0 8px var(--red); }
