:root {
  /* Neutral overlay base. Borders, dividers, hover washes and small chips are
     written as rgba(var(--ink-rgb), a); team (light) themes flip this to 0,0,0
     so the same rules read correctly on a light background. */
  --ink-rgb: 255, 255, 255;

  --bg: #080b14;
  --bg2: #0e1422;
  --bg-top: #0c111d;   /* body gradient: top */
  --bg-bot: #070a12;   /* body gradient: bottom */

  --panel: rgba(255, 255, 255, 0.035);
  --panel2: rgba(255, 255, 255, 0.06);
  --border: rgba(var(--ink-rgb), 0.09);
  --border2: rgba(var(--ink-rgb), 0.16);

  --text: #e9eef8;
  --muted: #8a95ab;
  --muted2: #5f6a80;

  --accent: #f5c518;
  --accent2: #56a6ff;
  --accent-ink: #1a1404;
  --accent2-ink: #06203f;
  --accent-soft: rgba(245, 197, 24, 0.28);

  /* Active / pressed affordance (selected tab, selected theme). Defaults to the
     brand accent; team themes point these at the team's SECONDARY colour. */
  --active-bg: var(--accent);
  --active-ink: var(--accent-ink);
  --active-soft: var(--accent-soft);

  --patreon: #f96854;

  /* Semantic stat colours + RGB triplets. The triplets drive the subtle "wash"
     backgrounds (e.g. qualified-row tint) and flip to darker, readable variants
     in light team themes. */
  --green: #3ddc97; --green-rgb: 61, 220, 151; --green-ink: #06281a;
  --amber: #f3a73b; --amber-rgb: 243, 167, 59; --amber-ink: #2a1a02;
  --red:   #f0556b; --red-rgb: 240, 85, 107;
  --blue:  #56a6ff; --blue-rgb: 86, 166, 255;
  --purple:#b388ff;
  --live:  #ff315a; --live-rgb: 255, 49, 90;

  --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  --radius: 14px;
  font-synthesis: none;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: linear-gradient(165deg, var(--bg-top) 0%, var(--bg-bot) 100%);
  background-attachment: fixed;
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body { min-height: 100vh; padding-bottom: 60px; }

h1, h2, h3 { margin: 0; font-weight: 800; letter-spacing: -0.01em; }
a { color: inherit; }
button { font-family: inherit; cursor: pointer; }

.tnum { font-variant-numeric: tabular-nums; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 14px clamp(14px, 4vw, 40px);
  background: linear-gradient(180deg, color-mix(in srgb, var(--bg) 96%, transparent), color-mix(in srgb, var(--bg) 86%, transparent));
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.topbar__brand { display: flex; align-items: center; gap: 14px; }
.topbar__trophy { font-size: 34px; filter: drop-shadow(0 4px 10px var(--accent-soft)); }
.topbar__title { font-size: clamp(18px, 2.4vw, 26px); letter-spacing: 0.08em; }
.topbar__title span { color: var(--accent); }
.topbar__sub { margin: 2px 0 0; color: var(--muted); font-size: 12px; letter-spacing: 0.02em; }
.topbar__status { display: flex; align-items: center; gap: 18px; }
.topbar__updated { font-size: 11px; color: var(--muted2); text-align: right; }

.conn { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--muted); }
.conn__dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted2); }
.conn--live .conn__dot { background: var(--green); box-shadow: 0 0 0 0 rgba(var(--green-rgb), 0.6); animation: ping 2s infinite; }
.conn--live .conn__label { color: var(--green); }
.conn--reconnecting .conn__dot { background: var(--amber); }
.conn--reconnecting .conn__label { color: var(--amber); }
@keyframes ping { 0% { box-shadow: 0 0 0 0 rgba(var(--green-rgb), 0.5); } 70% { box-shadow: 0 0 0 8px rgba(var(--green-rgb), 0); } 100% { box-shadow: 0 0 0 0 rgba(var(--green-rgb), 0); } }

/* ---------- Hero (live / next) ---------- */
.hero { padding: 16px clamp(14px, 4vw, 40px) 0; }
.hero__row { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
.livecard, .nextcard {
  flex: 1 1 340px; min-width: 300px;
  background: linear-gradient(160deg, var(--panel2), var(--panel));
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.livecard { border-color: rgba(var(--live-rgb), 0.4); }
.livecard::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(400px 120px at 100% 0%, rgba(var(--live-rgb), 0.12), transparent 70%);
}
.livecard__top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.livetag {
  display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 800;
  letter-spacing: 0.1em; color: #fff; background: var(--live); padding: 3px 9px; border-radius: 999px;
}
.livetag__dot { width: 7px; height: 7px; border-radius: 50%; background: #fff; animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: 0.25; } }
.live__minute { font-weight: 800; color: var(--live); }
.live__meta { font-size: 11px; color: var(--muted); }

.match-line { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; }
.match-side { display: flex; align-items: center; gap: 9px; min-width: 0; }
.match-side--away { flex-direction: row-reverse; text-align: right; }
.match-side__name { font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.match-score { font-size: 30px; font-weight: 800; letter-spacing: 0.02em; display: flex; gap: 8px; align-items: baseline; }
.match-score small { font-size: 13px; color: var(--muted); font-weight: 700; }
.score-flash { animation: flash 1s ease; }
@keyframes flash { 0% { color: var(--accent); transform: scale(1.25); } 100% { color: inherit; transform: scale(1); } }

.wpbar { display: flex; height: 8px; border-radius: 999px; overflow: hidden; margin-top: 12px; background: rgba(var(--ink-rgb), 0.06); }
.wpbar span { display: block; height: 100%; }
.wpbar__h { background: var(--blue); }
.wpbar__d { background: var(--muted2); }
.wpbar__a { background: var(--amber); }
.wplegend { display: flex; justify-content: space-between; font-size: 10.5px; color: var(--muted); margin-top: 5px; }

.poss { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 11px; color: var(--muted); }
.poss__bar { flex: 1; height: 5px; border-radius: 999px; background: var(--amber); overflow: hidden; }
.poss__bar span { display: block; height: 100%; background: var(--blue); }

.nextcard__label { font-size: 11px; letter-spacing: 0.12em; color: var(--muted); font-weight: 700; }
.nextcard__when { color: var(--accent); font-weight: 700; }

/* Full-time result card */
.finalcard {
  flex: 1 1 340px; min-width: 300px;
  background: linear-gradient(160deg, var(--panel2), var(--panel));
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.finalcard::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(420px 120px at 0% 0%, rgba(var(--green-rgb), 0.08), transparent 70%);
}
.fttag {
  display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 800;
  letter-spacing: 0.1em; color: var(--text); background: rgba(var(--ink-rgb), 0.12);
  border: 1px solid var(--border2); padding: 3px 9px; border-radius: 999px; cursor: help;
}
.finalcard .match-side--win .match-side__name { font-weight: 800; color: var(--text); }
.finalcard .match-side--win::after {
  content: "▸"; color: var(--green); font-size: 12px; margin-left: 2px;
}
.finalcard .match-side--away.match-side--win::after { content: "◂"; margin: 0 2px 0 0; order: -1; }
.finalcard .match-side--lose { opacity: 0.58; }

/* ---------- Tabs ---------- */
.tabs {
  position: sticky; top: var(--topbar-h, 82px); z-index: 30;
  display: flex; gap: 6px; flex-wrap: wrap;
  padding: 12px clamp(14px, 4vw, 40px) 12px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 10px 18px -12px rgba(0, 0, 0, 0.8);
}
.tab {
  border: 1px solid var(--border); background: var(--panel); color: var(--muted);
  padding: 9px 16px; border-radius: 999px; font-weight: 700; font-size: 13.5px; transition: all .15s;
}
.tab:hover { color: var(--text); border-color: var(--border2); }
.tab--active { background: var(--active-bg); color: var(--active-ink); border-color: var(--active-bg); box-shadow: 0 6px 18px var(--active-soft); }

/* ---------- View container ---------- */
.view { padding: 8px clamp(14px, 4vw, 40px) 40px; max-width: 1500px; margin: 0 auto; }
.loading { padding: 60px; text-align: center; color: var(--muted); }
/* Crawler-visible intro shown until live data renders (then replaced by JS). */
.seo-intro { max-width: 760px; margin: 0 auto; padding: 48px 20px; text-align: center; color: var(--muted); }
.seo-intro h2 { font-size: 20px; color: var(--text); margin: 0 0 12px; }
.seo-intro p { margin: 0; font-size: 14px; line-height: 1.6; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 6px 0 14px; flex-wrap: wrap; }
.section-head h2 { font-size: 20px; }
.section-head p { margin: 0; color: var(--muted); font-size: 13px; }

/* ---------- Group cards ---------- */
.group-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 14px; }
.gcard {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; transition: transform .15s, border-color .15s; cursor: pointer;
}
.gcard:hover { transform: translateY(-3px); border-color: var(--border2); }
.gcard__head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.gcard__name { font-size: 15px; font-weight: 800; letter-spacing: 0.04em; }
.gcard__meta { font-size: 11px; color: var(--muted); display: flex; gap: 8px; align-items: center; }
.badge { font-size: 10px; font-weight: 800; padding: 2px 7px; border-radius: 999px; letter-spacing: 0.04em; }
.badge--live { background: var(--live); color: #fff; }
.badge--done { background: rgba(var(--green-rgb), 0.15); color: var(--green); border: 1px solid rgba(var(--green-rgb), 0.3); }

table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted2); font-weight: 700; padding: 7px 6px; text-align: center; }
.tbl th.l, .tbl td.l { text-align: left; }
.tbl td { padding: 7px 6px; text-align: center; border-top: 1px solid rgba(var(--ink-rgb), 0.05); }
.tbl tr.row--q { background: linear-gradient(90deg, rgba(var(--green-rgb), 0.10), transparent 60%); }
.tbl tr.row--third { background: linear-gradient(90deg, rgba(var(--amber-rgb), 0.10), transparent 60%); }
.tbl tr.row--out { opacity: 0.62; }
.pos { width: 22px; height: 22px; display: inline-flex; align-items: center; justify-content: center; border-radius: 6px; font-weight: 800; font-size: 11px; background: rgba(var(--ink-rgb), 0.06); }
.row--q .pos { background: var(--green); color: var(--green-ink); }
.row--third .pos { background: var(--amber); color: var(--amber-ink); }
.teamcell { display: flex; align-items: center; gap: 8px; }
.flag { border-radius: 3px; object-fit: cover; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.4); vertical-align: middle; }
.teamcell__abbr { font-weight: 700; }
.clinch { font-weight: 900; font-size: 11px; }
.clinch--q { color: var(--green); }
.clinch--x { color: var(--red); }
.pts { font-weight: 800; }
.adv-mini { width: 58px; }

.chip { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.chip__name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip--tbd { color: var(--muted2); font-style: italic; }

.bar { position: relative; width: 100%; border-radius: 999px; overflow: hidden; }
.bar__fill { height: 100%; border-radius: 999px; transition: width .6s ease; }
.bar__label { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); font-size: 10px; font-weight: 700; }
.stack { display: flex; width: 100%; border-radius: 6px; overflow: hidden; background: rgba(var(--ink-rgb), 0.05); }
.stack__seg { display: block; height: 100%; }

/* ---------- Third place race ---------- */
.third-list { display: flex; flex-direction: column; gap: 8px; max-width: 920px; }
.third-row {
  display: grid; grid-template-columns: 34px 1.4fr 58px 46px 1.7fr; gap: 12px; align-items: center;
  padding: 10px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--panel);
}
.third-prob { display: flex; align-items: center; gap: 9px; }
.third-prob .bar { flex: 1; min-width: 60px; }
.third-prob__main { min-width: 40px; text-align: right; font-weight: 700; }
.third-prob__adv { min-width: 64px; font-size: 11px; color: var(--muted2); cursor: help; white-space: nowrap; }
.third-row--in { border-color: rgba(var(--green-rgb), 0.35); background: linear-gradient(90deg, rgba(var(--green-rgb), 0.08), var(--panel)); }
.third-row--out { opacity: 0.7; }
.third-rank { font-weight: 800; font-size: 16px; color: var(--muted); }
.third-row--in .third-rank { color: var(--green); }
.cutline { display: flex; align-items: center; gap: 12px; margin: 6px 0; color: var(--amber); font-size: 12px; font-weight: 700; letter-spacing: 0.05em; }
.cutline::before, .cutline::after { content: ""; height: 1px; flex: 1; background: linear-gradient(90deg, transparent, var(--amber), transparent); }

/* ---------- Bracket ---------- */
.bracket-scroll { overflow-x: auto; padding-bottom: 16px; }
.bracket { display: flex; gap: 26px; min-width: max-content; padding: 4px; }
.bround { display: flex; flex-direction: column; min-width: 240px; }
.bround__title { font-size: 12px; font-weight: 800; letter-spacing: 0.08em; color: var(--muted); text-transform: uppercase; margin-bottom: 10px; text-align: center; }
.bround__matches { display: flex; flex-direction: column; justify-content: space-around; flex: 1; gap: 12px; }
.bmatch {
  background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; position: relative;
  transition: border-color .15s, transform .15s;
}
.bmatch:hover { border-color: var(--border2); }
.bmatch--live { border-color: rgba(var(--live-rgb), 0.5); box-shadow: 0 0 0 1px rgba(var(--live-rgb), 0.25); }
.bmatch__no { position: absolute; top: -8px; left: 8px; font-size: 9px; color: var(--muted2); background: var(--bg2); padding: 0 5px; border-radius: 4px; border: 1px solid var(--border); }
.bteam { display: flex; align-items: center; gap: 8px; padding: 5px 4px; font-size: 13px; border-radius: 6px; }
.bteam + .bteam { border-top: 1px solid rgba(var(--ink-rgb), 0.05); }
.bteam--win { font-weight: 800; }
.bteam--lose { opacity: 0.5; }
.bteam__score { margin-left: auto; font-weight: 800; }
.bteam__name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bteam__odds { margin-left: auto; font-size: 10.5px; color: var(--muted); font-weight: 700; }
.bteam--proj .bteam__name { color: var(--muted); font-style: italic; }
.bteam--confirmed .bteam__name { color: var(--text); font-style: normal; }
.bteam__tag { font-size: 9px; color: var(--muted2); }

/* ---------- Projections ---------- */
.proj-top { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-bottom: 22px; }
.donut-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; text-align: center; }
.donut-card h4 { margin: 8px 0 0; font-size: 13px; display: flex; gap: 7px; align-items: center; justify-content: center; }
.donut { display: block; margin: 0 auto; }
.donut__val { fill: var(--text); font-size: 19px; font-weight: 800; }
.donut__sub { fill: var(--muted); font-size: 9px; }

.proj-scroll { max-height: 72vh; overflow: auto; border: 1px solid var(--border); border-radius: 12px; }
.proj-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.proj-table th { position: sticky; top: 0; z-index: 2; background: var(--bg2); cursor: pointer; user-select: none; padding: 9px 8px; font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); border-bottom: 1px solid var(--border); white-space: nowrap; }
.proj-table th:hover { color: var(--text); }
.proj-table th.sorted::after { content: " ▾"; color: var(--accent); }
.proj-table td { padding: 7px 8px; border-bottom: 1px solid rgba(var(--ink-rgb), 0.05); text-align: center; }
.proj-table td.l { text-align: left; }
.proj-table tr:hover { background: var(--panel); cursor: pointer; }
.roadbar-cell { min-width: 200px; }

/* ---------- Pairings ---------- */
.pair-wrap { display: grid; grid-template-columns: 280px 1fr; gap: 20px; }
.team-picker { display: flex; flex-direction: column; gap: 4px; max-height: 72vh; overflow-y: auto; padding-right: 6px; }
.picker-item { display: flex; align-items: center; gap: 9px; padding: 8px 10px; border-radius: 9px; border: 1px solid transparent; font-size: 13px; }
.picker-item:hover { background: var(--panel); }
.picker-item--active { background: var(--panel2); border-color: var(--border2); }
.picker-item__odds { margin-left: auto; font-size: 11px; color: var(--muted); font-weight: 700; }
.pair-panel { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.opp-row { display: grid; grid-template-columns: 150px 1fr 48px; gap: 10px; align-items: center; padding: 5px 0; font-size: 13px; }
.opp-bar { height: 16px; }

.metricgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 8px; margin: 14px 0 20px; }
.metric { background: var(--bg2); border: 1px solid var(--border); border-radius: 10px; padding: 10px; text-align: center; }
.metric__v { font-size: 20px; font-weight: 800; }
.metric__l { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; margin-top: 2px; }

/* ---------- Drawer (team / group detail) ---------- */
.drawer-backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.55); backdrop-filter: blur(2px); z-index: 50; }
.drawer {
  position: fixed; top: 0; right: 0; height: 100vh; width: min(560px, 94vw); z-index: 51;
  background: var(--bg2); border-left: 1px solid var(--border2); box-shadow: -20px 0 50px rgba(0, 0, 0, 0.5);
  overflow-y: auto; padding: 20px clamp(16px, 3vw, 26px);
  animation: slideIn .22s ease;
}
@keyframes slideIn { from { transform: translateX(30px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.drawer__close { position: absolute; top: 16px; right: 16px; background: var(--panel2); border: 1px solid var(--border); color: var(--text); width: 34px; height: 34px; border-radius: 9px; font-size: 18px; }
.drawer__title { display: flex; align-items: center; gap: 12px; margin-bottom: 4px; font-size: 22px; }
.drawer__sub { color: var(--muted); font-size: 13px; margin-bottom: 16px; }
.drawer h3 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 20px 0 10px; }
.drawer-tablewrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -4px; }
.drawer-tablewrap .tbl { min-width: 460px; }
.drawer-tablewrap .tbl .teamcell { white-space: nowrap; }

.fixture { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: center; padding: 8px 10px; border: 1px solid var(--border); border-radius: 9px; margin-bottom: 6px; font-size: 13px; }
.fixture--fin { background: var(--panel); }
.fixture__res { font-weight: 800; padding: 2px 8px; border-radius: 6px; background: var(--panel2); }
.fixture__res--live { background: var(--live); color: #fff; }

.footer { position: fixed; bottom: 0; left: 0; right: 0; display: flex; justify-content: space-between; gap: 12px; padding: 8px clamp(14px, 4vw, 40px); font-size: 11px; color: var(--muted2); background: color-mix(in srgb, var(--bg) 90%, transparent); border-top: 1px solid var(--border); backdrop-filter: blur(8px); }

/* ---------- Tooltips ---------- */
.term { border-bottom: 1px dotted var(--muted); cursor: help; outline: none; }
.term:hover, .term:focus-visible { border-bottom-color: var(--accent); color: var(--text); }
.term:focus-visible { box-shadow: 0 0 0 2px var(--accent-soft); border-radius: 3px; }
[data-term], [data-tip] { cursor: help; }
.gcard[data-group], [data-team], [data-pick], .tab, button, a { cursor: pointer; }

.info {
  display: inline-flex; align-items: center; justify-content: center;
  width: 15px; height: 15px; margin-left: 5px; border-radius: 50%;
  font-size: 10px; font-weight: 800; line-height: 1; cursor: help; vertical-align: middle;
  color: var(--muted); background: var(--panel2); border: 1px solid var(--border); outline: none;
}
.info:hover, .info:focus-visible { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }

.tooltip {
  position: fixed; z-index: 100; max-width: 286px; pointer-events: none;
  background: linear-gradient(180deg, #1c2436, #141b2a);
  border: 1px solid rgba(255, 255, 255, 0.16); border-radius: 10px;
  padding: 10px 12px; box-shadow: 0 14px 40px rgba(0, 0, 0, 0.55);
  opacity: 0; transform: translateY(4px) scale(0.98); transition: opacity .12s ease, transform .12s ease;
  font-size: 12.5px; line-height: 1.5; color: #eaf0fb;
}
.tooltip--show { opacity: 1; transform: translateY(0) scale(1); }
.tooltip::after {
  content: ""; position: absolute; left: var(--arrow-x, 50%); width: 10px; height: 10px;
  background: #141b2a; border: 1px solid rgba(255, 255, 255, 0.16); transform: translateX(-50%) rotate(45deg);
}
.tooltip[data-placement="top"]::after { bottom: -6px; border-top: none; border-left: none; }
.tooltip[data-placement="bottom"]::after { top: -6px; border-bottom: none; border-right: none; }
.tip__title { font-weight: 800; font-size: 12.5px; color: var(--accent); margin-bottom: 3px; letter-spacing: 0.01em; }
.tip__body { color: #c5cee0; }
.tip__body b { color: #ffffff; }

/* ---------- Topbar controls: theme selector + Patreon toggle ---------- */
.topbar__controls { display: flex; align-items: center; gap: 8px; }
.ctrl-btn {
  display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 12px;
  border-radius: 999px; border: 1px solid var(--border); background: var(--panel);
  color: var(--text); font-weight: 700; font-size: 13px; line-height: 1; transition: border-color .15s, background .15s, color .15s;
}
.ctrl-btn:hover { border-color: var(--border2); }
.ctrl-ico { font-size: 14px; line-height: 1; }
.ctrl-lock { font-size: 11px; opacity: 0.85; margin-left: -2px; }
.theme-swatch--btn { width: 16px; height: 16px; border-radius: 5px; border: 1px solid rgba(var(--ink-rgb), 0.3); }

.patreon-btn--on {
  background: color-mix(in srgb, var(--patreon) 22%, transparent);
  border-color: var(--patreon); color: var(--text);
}
.patreon-btn--on .ctrl-ico { color: var(--patreon); }

/* Dropdown */
.theme-menu { position: relative; }
.theme-panel {
  position: fixed; width: 320px; max-height: 64vh;
  display: flex; flex-direction: column; z-index: 60;
  background: var(--bg2); border: 1px solid var(--border2); border-radius: 14px;
  box-shadow: 0 22px 55px rgba(0, 0, 0, 0.6); overflow: hidden;
  animation: panelIn .15s ease;
}
@keyframes panelIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }
.theme-panel[hidden] { display: none; }
.theme-panel__head { padding: 10px; border-bottom: 1px solid var(--border); }
#theme-search {
  width: 100%; padding: 9px 12px; border-radius: 9px; border: 1px solid var(--border);
  background: var(--panel); color: var(--text); font-size: 13px; outline: none;
}
#theme-search:focus { border-color: var(--accent); }
.theme-list { overflow-y: auto; padding: 8px; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.theme-item {
  display: flex; align-items: center; gap: 8px; padding: 8px; border-radius: 10px;
  border: 1px solid transparent; background: transparent; color: var(--text);
  text-align: left; font-size: 12.5px; cursor: pointer; min-width: 0;
}
.theme-item:hover { background: var(--panel); }
.theme-item--active { border-color: var(--active-bg); background: var(--panel2); }
.theme-item__flag { width: 22px; height: 22px; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.theme-item__flagemoji { font-size: 16px; }
.theme-item__flag .flag { border-radius: 3px; }
.theme-item__name { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.theme-swatch { width: 22px; height: 14px; border-radius: 4px; border: 1px solid rgba(var(--ink-rgb), 0.25); flex: 0 0 auto; }
.theme-empty { grid-column: 1 / -1; padding: 18px; text-align: center; color: var(--muted); font-size: 13px; }

/* Gentle supporter popup */
.pgate {
  position: fixed; inset: 0; z-index: 80; display: flex; align-items: center; justify-content: center;
  padding: 20px; opacity: 0; pointer-events: none; transition: opacity .25s ease;
}
.pgate--show { opacity: 1; pointer-events: auto; }
.pgate__backdrop { position: absolute; inset: 0; background: rgba(4, 6, 12, 0.62); backdrop-filter: blur(3px); }
.pgate__card {
  position: relative; max-width: 380px; width: 100%; text-align: center;
  background: linear-gradient(180deg, color-mix(in srgb, var(--bg2) 84%, white 7%), var(--bg2));
  border: 1px solid var(--border2); border-radius: 16px; padding: 26px 24px;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.6);
  transform: translateY(12px) scale(0.97); transition: transform .25s ease;
}
.pgate--show .pgate__card { transform: none; }
.pgate__icon { font-size: 36px; filter: drop-shadow(0 4px 12px var(--accent-soft)); }
.pgate__title { font-size: 18px; font-weight: 800; margin: 10px 0 8px; }
.pgate__body { color: var(--muted); font-size: 13.5px; line-height: 1.65; }
.pgate__actions { display: flex; gap: 10px; margin-top: 20px; }
.pgate__btn {
  flex: 1; padding: 11px 12px; border-radius: 10px; font-weight: 700; font-size: 13.5px;
  border: 1px solid var(--border); background: var(--panel); color: var(--text);
  text-decoration: none; display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
}
.pgate__btn:hover { border-color: var(--border2); }
.pgate__btn--primary { background: var(--patreon); border-color: var(--patreon); color: #fff; }
.pgate__hint {
  margin-top: 14px; background: none; border: none; color: var(--muted2); font-size: 11.5px;
  text-decoration: underline; cursor: pointer;
}
.pgate__hint:hover { color: var(--muted); }

/* Account popover (signed-in) — reuses the .pgate card */
.acct__avatar {
  width: 60px; height: 60px; border-radius: 50%; object-fit: cover;
  display: block; margin: 0 auto; border: 2px solid var(--border2);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}
.acct__badge {
  display: inline-block; margin-top: 10px; padding: 3px 11px; border-radius: 999px;
  font-size: 12px; font-weight: 800; letter-spacing: 0.01em;
  color: var(--muted); background: var(--panel); border: 1px solid var(--border);
}
.acct__badge--sup {
  color: #fff; background: var(--patreon); border-color: var(--patreon);
}

/* Tiny toast for auth outcomes */
.wc-toast {
  position: fixed; left: 50%; bottom: 22px; transform: translate(-50%, 16px); z-index: 120;
  display: flex; align-items: center; gap: 8px; max-width: min(92vw, 460px);
  padding: 11px 16px; border-radius: 999px;
  background: var(--bg2); border: 1px solid var(--border2);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
  color: var(--text); font-size: 13px; font-weight: 600;
  opacity: 0; pointer-events: none; transition: opacity .2s ease, transform .2s ease;
}
.wc-toast--show { opacity: 1; transform: translate(-50%, 0); }
.wc-toast__ico { font-size: 15px; line-height: 1; }

@media (prefers-reduced-motion: reduce) {
  .theme-panel, .pgate, .pgate__card { animation: none; transition: none; }
  .wc-toast { transition: opacity .2s ease; }
}

/* ============================================================================
   THE PIRATE'S COVE BAR
   A slim parent-site strip across the top: "back to the Cove" navigation on the
   left and the single, site-wide Patreon sign-in control on the right (rendered
   by js/cove-bar.js, using the shared /api/auth flow). Styled to echo the Cove
   home page — gold ship's-wheel brand, coral Patreon button, account dropdown.
   =================================================================== */
.covebar {
  --cove-gold: #e8b24c;
  --cove-gold-bright: #f7d27e;
  --cove-coral: #ff5b53;
  position: relative;
  z-index: 45;
  background: rgba(8, 11, 20, 0.72);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(10px);
}
.covebar__inner {
  max-width: 1180px;
  margin: 0 auto;
  min-height: 50px;
  padding: 7px clamp(14px, 4vw, 40px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.covebar__home {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  border-radius: 999px;
  padding: 4px 12px 4px 6px;
  transition: background-color 0.2s ease;
}
.covebar__home:hover { background: rgba(255, 255, 255, 0.05); }
.covebar__back {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  color: var(--cove-gold-bright);
  transition: transform 0.2s ease;
}
.covebar__back svg { width: 19px; height: 19px; }
.covebar__home:hover .covebar__back { transform: translateX(-2px); }
.covebar__mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  border-radius: 50%;
  color: var(--cove-gold-bright);
  background: radial-gradient(circle at 32% 28%, rgba(255, 255, 255, 0.14), rgba(8, 11, 20, 0.6));
  border: 2px solid var(--cove-gold);
  transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}
.covebar__home:hover .covebar__mark { transform: rotate(40deg); }
.covebar__mark svg { width: 20px; height: 20px; }
.covebar__brandtext { display: flex; flex-direction: column; line-height: 1; }
.covebar__the {
  font-family: 'Cinzel', Georgia, serif;
  font-size: 0.56rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--cove-gold);
  margin-bottom: 3px;
}
.covebar__name {
  font-family: 'Cinzel Decorative', 'Cinzel', Georgia, serif;
  font-weight: 700;
  font-size: 1.04rem;
  color: var(--text);
  letter-spacing: 0.01em;
}

/* Auth slot */
.covebar__actions { display: flex; align-items: center; gap: 10px; }
.covebar__contact {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font: inherit;
  font-weight: 600;
  font-size: 0.86rem;
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border2);
  border-radius: 999px;
  padding: 8px 13px;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease;
}
.covebar__contact:hover { border-color: var(--cove-gold, #e8b24c); color: var(--cove-gold-bright, #f7d27e); }
.covebar__contact svg { width: 16px; height: 16px; }
.cove-auth { position: relative; display: flex; align-items: center; }
.cove-auth__skeleton {
  width: 142px;
  height: 38px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.05));
  background-size: 200% 100%;
  animation: cove-shimmer 1.3s ease-in-out infinite;
}
@keyframes cove-shimmer { to { background-position: -200% 0; } }

.cove-login {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font: inherit;
  font-weight: 600;
  font-size: 0.9rem;
  color: #fff;
  background: var(--cove-coral);
  border: none;
  border-radius: 999px;
  padding: 9px 16px;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.28);
  transition: background-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}
.cove-login:hover {
  background: #f5443b;
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(255, 91, 83, 0.4);
}
.cove-login svg { width: 16px; height: 16px; }
.cove-login__short { display: none; }

.cove-user {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 5px 9px 5px 5px;
  border-radius: 999px;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border2);
  color: var(--text);
  font: inherit;
  transition: border-color 0.2s ease;
}
.cove-user:hover { border-color: var(--cove-gold); }
.cove-avatar {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  font-size: 0.72rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(160deg, #5b91c4, #34608f);
  border: 2px solid var(--cove-gold);
}
.cove-avatar img { width: 100%; height: 100%; object-fit: cover; }
.cove-avatar.lg { width: 44px; height: 44px; font-size: 1rem; }
.cove-user__meta { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.15; }
.cove-user__name {
  font-weight: 600;
  font-size: 0.86rem;
  color: var(--text);
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cove-user__role { font-size: 0.68rem; color: var(--muted); }
.cove-caret { display: grid; place-items: center; color: var(--muted); transition: transform 0.2s ease; }
.cove-caret svg { width: 15px; height: 15px; }
.cove-caret.open { transform: rotate(180deg); }

.cove-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 236px;
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: 16px;
  box-shadow: 0 28px 64px rgba(0, 0, 0, 0.5);
  padding: 8px;
  z-index: 60;
  animation: cove-menu-in 0.18s ease;
}
@keyframes cove-menu-in { from { opacity: 0; transform: translateY(-6px); } }
.cove-menu__head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 10px 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 6px;
}
.cove-menu__id { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.cove-menu__item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  border-radius: 10px;
  padding: 10px 11px;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.cove-menu__item:hover { background: rgba(255, 255, 255, 0.07); color: var(--cove-gold-bright); }
.cove-menu__item svg { width: 16px; height: 16px; color: var(--muted); flex-shrink: 0; }
.cove-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  align-self: flex-start;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border2);
}
.cove-badge--sup {
  color: #3c2807;
  background: linear-gradient(180deg, var(--cove-gold-bright), var(--cove-gold));
  border-color: rgba(247, 210, 126, 0.5);
}
.wc-toast a { color: var(--cove-gold-bright, #f7d27e); font-weight: 700; text-decoration: underline; }

@media (max-width: 540px) {
  .covebar__the { display: none; }
  .cove-login__full { display: none; }
  .cove-login__short { display: inline; }
  .cove-user__meta { display: none; }
}

/* ---------- Live change flashes ---------- */
@keyframes flashbg {
  0% { background-color: color-mix(in srgb, var(--accent) 55%, transparent); box-shadow: 0 0 0 3px var(--accent-soft); }
  100% { background-color: transparent; box-shadow: 0 0 0 3px transparent; }
}
@keyframes flashup {
  0% { background-color: rgba(var(--green-rgb), 0.55); color: var(--green-ink); }
  100% { background-color: transparent; }
}
@keyframes flashdown {
  0% { background-color: rgba(var(--red-rgb), 0.5); }
  100% { background-color: transparent; }
}
.flash { animation: flashbg 1.4s ease-out; border-radius: 5px; }
.flash.flash-up { animation: flashup 1.6s ease-out; border-radius: 5px; }
.flash.flash-down { animation: flashdown 1.6s ease-out; border-radius: 5px; }

@keyframes pulsehl {
  0% { transform: scale(1); }
  35% { transform: scale(1.5); filter: brightness(1.6); }
  100% { transform: scale(1); }
}
.pulse { animation: pulsehl 0.7s ease-out; }
.topbar__updated.pulse { display: inline-block; animation: pulsehl 0.7s ease-out; transform-origin: right center; }
@media (prefers-reduced-motion: reduce) {
  .flash, .flash-up, .flash-down, .pulse, .score-flash { animation: none !important; }
}

/* ===================================================================
   WHAT-IF SANDBOX
   =================================================================== */
.whatif-btn { position: relative; }
.whatif-btn--on {
  background: color-mix(in srgb, var(--accent) 20%, transparent);
  border-color: var(--accent); color: var(--text);
}
.whatif-btn--on .ctrl-ico { filter: drop-shadow(0 0 6px var(--accent-soft)); }
.whatif-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 17px; height: 17px; padding: 0 4px; margin-left: 1px;
  border-radius: 999px; background: var(--accent); color: var(--accent-ink);
  font-size: 10.5px; font-weight: 800; line-height: 1;
}
.whatif-spin {
  width: 11px; height: 11px; margin-left: 2px; border-radius: 50%;
  border: 2px solid var(--accent-soft); border-top-color: var(--accent);
  animation: wispin 0.7s linear infinite;
}
@keyframes wispin { to { transform: rotate(360deg); } }

/* Scenario tray (under the tabs) */
.wi-tray {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  flex-wrap: wrap; padding: 10px clamp(14px, 4vw, 40px);
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 9%, var(--bg)), var(--bg));
  border-bottom: 1px solid var(--border);
}
.wi-tray[hidden] { display: none; }
.wi-tray__main { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; min-width: 0; }
.wi-tray__title { font-weight: 800; font-size: 13px; letter-spacing: 0.02em; white-space: nowrap; }
.wi-tray__hint { color: var(--muted); font-size: 12.5px; }
.wi-tray__hint b { color: var(--text); }
.wi-tray__right { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.wi-tray__movers { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.wi-tray__label { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted2); }
.wi-mover { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 700; }
.wi-mover .flag { border-radius: 3px; }
.wi-delta { font-weight: 800; font-variant-numeric: tabular-nums; }
.wi-delta.up { color: var(--green); }
.wi-delta.down { color: var(--red); }

.wi-chips { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.wi-chip2 {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 6px 4px 10px;
  border-radius: 999px; background: var(--panel2); border: 1px solid var(--border2);
  font-size: 12px; font-weight: 700; white-space: nowrap;
}
.wi-chip2__x {
  display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px;
  border-radius: 50%; border: none; background: rgba(var(--ink-rgb), 0.1); color: var(--muted);
  font-size: 11px; line-height: 1; cursor: pointer;
}
.wi-chip2__x:hover { background: var(--red); color: #fff; }
.wi-reset, .wi-share {
  border: 1px solid var(--border2); background: var(--panel); color: var(--text);
  padding: 6px 12px; border-radius: 999px; font-weight: 700; font-size: 12.5px; cursor: pointer;
}
.wi-reset:hover { border-color: var(--red); color: var(--red); }
.wi-share:hover { border-color: var(--accent); }
.wi-share--ok { background: var(--green); border-color: var(--green); color: var(--green-ink); }

/* Bracket: "click a team to advance them" while the sandbox is active */
body.wi-on .bmatch[data-editable="1"] { cursor: default; }
body.wi-on .bmatch[data-editable="1"] .bteam[data-side] {
  cursor: pointer; border-radius: 6px; transition: background .12s, box-shadow .12s;
}
body.wi-on .bmatch[data-editable="1"] .bteam[data-side]:hover {
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  box-shadow: inset 2px 0 0 var(--accent);
}
.bteam--pick {
  background: color-mix(in srgb, var(--green) 20%, transparent) !important;
  box-shadow: inset 3px 0 0 var(--green);
}
.bteam--pick .bteam__name { font-weight: 800; }
body.wi-on .bmatch[data-editable="1"]::after {
  content: "advance ▸"; position: absolute; top: -8px; right: 8px;
  font-size: 8.5px; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--accent); opacity: 0; transition: opacity .12s;
}
body.wi-on .bmatch[data-editable="1"]:hover::after { opacity: 0.8; }

/* Group drawer: editable fixtures */
.wi-fix {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px;
  padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px; margin-bottom: 7px;
  background: var(--panel);
}
.wi-fix--edited { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--panel)); }
.wi-fix__side { display: flex; align-items: center; gap: 7px; font-weight: 700; font-size: 13px; min-width: 0; }
.wi-fix__side .flag { border-radius: 3px; }
.wi-fix__side--away { flex-direction: row-reverse; }
.wi-fix__score { display: flex; align-items: center; gap: 4px; }
.wi-step {
  width: 22px; height: 22px; border-radius: 6px; border: 1px solid var(--border2);
  background: var(--panel2); color: var(--text); font-size: 14px; font-weight: 800; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
}
.wi-step:hover { border-color: var(--accent); color: var(--accent); }
.wi-fix__num { min-width: 16px; text-align: center; font-weight: 800; font-size: 15px; font-variant-numeric: tabular-nums; }
.wi-fix__colon { color: var(--muted2); margin: 0 2px; }
.wi-fix__quick { grid-column: 1 / -1; display: flex; align-items: center; justify-content: center; gap: 6px; }
.wi-chip {
  border: 1px solid var(--border2); background: var(--panel2); color: var(--muted);
  padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 700; cursor: pointer;
  max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.wi-chip:hover { border-color: var(--accent); color: var(--text); }
.wi-chip--clear:hover { border-color: var(--red); color: var(--red); }
.wi-fix__actual { font-size: 10.5px; color: var(--muted2); text-transform: uppercase; letter-spacing: 0.04em; }

/* Inline odds deltas (Projections table, while sandbox active) */
.proj-delta { font-size: 10px; font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.proj-delta.up { color: var(--green); }
.proj-delta.down { color: var(--red); }

/* ===================================================================
   SUPPORTERS WALL
   =================================================================== */
.footer__sup {
  border: 1px solid var(--border2); background: var(--panel); color: var(--text);
  padding: 5px 12px; border-radius: 999px; font-size: 11.5px; font-weight: 700; cursor: pointer;
  transition: border-color .15s, color .15s;
}
.footer__sup:hover { border-color: var(--patreon); color: var(--patreon); }

.supmodal {
  position: fixed; inset: 0; z-index: 90; display: flex; align-items: center; justify-content: center;
  padding: 20px; opacity: 0; pointer-events: none; transition: opacity .22s ease;
}
.supmodal[hidden] { display: none; }
.supmodal--show { opacity: 1; pointer-events: auto; }
.supmodal__backdrop { position: absolute; inset: 0; background: rgba(4, 6, 12, 0.62); backdrop-filter: blur(3px); }
.supmodal__card {
  position: relative; width: 100%; max-width: 480px; max-height: 86vh; overflow-y: auto;
  background: var(--bg2); border: 1px solid var(--border2); border-radius: 16px;
  padding: 26px 24px 20px; box-shadow: 0 30px 60px rgba(0, 0, 0, 0.55);
  transform: translateY(12px) scale(0.98); transition: transform .22s ease;
}
.supmodal--show .supmodal__card { transform: none; }
.supmodal__close {
  position: absolute; top: 14px; right: 14px; width: 32px; height: 32px; border-radius: 9px;
  background: var(--panel2); border: 1px solid var(--border); color: var(--text); font-size: 18px; cursor: pointer;
}
.supmodal__close:hover { border-color: var(--border2); }
.supmodal__head { text-align: center; margin-bottom: 16px; }
.supmodal__icon { font-size: 34px; filter: drop-shadow(0 4px 12px var(--accent-soft)); }
.supmodal__head h2 { font-size: 21px; margin: 8px 0 6px; }
.supmodal__head p { margin: 0 auto; max-width: 380px; color: var(--muted); font-size: 13px; line-height: 1.6; }

.sup-tier { margin-top: 16px; }
.sup-tier__head { display: flex; align-items: center; gap: 8px; }
.sup-tier__emoji { font-size: 16px; }
.sup-tier__name { font-weight: 800; font-size: 14px; letter-spacing: 0.01em; }
.sup-tier__count {
  margin-left: auto; font-size: 11px; font-weight: 800; color: var(--muted);
  background: var(--panel2); border: 1px solid var(--border); padding: 1px 8px; border-radius: 999px;
}
.sup-tier__blurb { margin: 4px 0 8px; color: var(--muted2); font-size: 12px; }
.sup-tier__people { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.sup-person {
  font-size: 12.5px; font-weight: 600; color: var(--text);
  background: var(--panel); border: 1px solid var(--border); padding: 5px 11px; border-radius: 999px;
}
.sup-empty { color: var(--muted); text-align: center; padding: 16px; }

.supmodal__foot {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--border);
}
.supmodal__count { font-size: 12.5px; color: var(--muted); font-weight: 700; }
.supmodal__cta {
  background: var(--patreon); border: 1px solid var(--patreon); color: #fff;
  padding: 9px 16px; border-radius: 10px; font-weight: 700; font-size: 13px; text-decoration: none;
  display: inline-flex; align-items: center;
}
.supmodal__cta:hover { filter: brightness(1.06); }
.supmodal__note { margin: 14px 0 0; color: var(--muted2); font-size: 11px; line-height: 1.5; text-align: center; }

@media (prefers-reduced-motion: reduce) {
  .supmodal, .supmodal__card { transition: none; }
}
@media (max-width: 680px) {
  .footer__sup { order: -1; }
  .supmodal__card { padding: 22px 16px 16px; }
}

@media (max-width: 680px) {
  .wi-tray { padding: 9px 12px; gap: 10px; }
  .wi-tray__movers { width: 100%; }
}
@media (prefers-reduced-motion: reduce) { .whatif-spin { animation: none; } }

/* ===================================================================
   RESPONSIVE / MOBILE
   =================================================================== */

/* Neutralise sticky :hover states and tap flashes on touch devices. */
@media (hover: none) {
  .gcard:hover { transform: none; border-color: var(--border); }
  .bmatch:hover, .tab:hover, .picker-item:hover { transform: none; }
  * { -webkit-tap-highlight-color: transparent; }
}

/* Tablet / small laptop */
@media (max-width: 900px) {
  .group-grid { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
}
@media (max-width: 760px) {
  .pair-wrap { grid-template-columns: 1fr; }
}

/* ---------- Phones ---------- */
@media (max-width: 680px) {
  body { padding-bottom: 0; overflow-x: clip; }

  /* Top bar: one compact, fixed-height row */
  .topbar { height: 54px; padding: 0 12px; gap: 10px; }
  .topbar__brand { gap: 10px; }
  .topbar__trophy { font-size: 24px; }
  .topbar__title { font-size: 17px; letter-spacing: 0.04em; }
  .topbar__sub { display: none; }
  .topbar__status { gap: 8px; }
  .topbar__updated { display: none; }
  .conn__label { display: none; }

  /* Controls: icon-only buttons; dropdown becomes a bottom sheet */
  .ctrl-label { display: none; }
  .ctrl-btn { height: 32px; padding: 0 10px; }
  .conn { order: 3; }
  .theme-panel {
    position: fixed; left: 0; right: 0; bottom: 0; top: auto; width: auto;
    max-height: 74vh; border-radius: 16px 16px 0 0; animation: sheetIn .2s ease;
    padding-bottom: env(safe-area-inset-bottom);
  }
  @keyframes sheetIn { from { transform: translateY(100%); } to { transform: translateY(0); } }
  .theme-list { grid-template-columns: 1fr 1fr; }
  .tabs {
    top: var(--topbar-h, 54px); flex-wrap: nowrap; overflow-x: auto; gap: 6px;
    padding: 10px 12px 8px; -webkit-overflow-scrolling: touch;
    scrollbar-width: none; -ms-overflow-style: none; scroll-snap-type: x proximity;
  }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { flex: 0 0 auto; white-space: nowrap; padding: 8px 14px; font-size: 13px; scroll-snap-align: start; }

  /* Hero: one card per view, swipe between live / final / next */
  .hero { padding: 12px 12px 0; }
  .hero__row { gap: 10px; scroll-snap-type: x mandatory; scroll-padding-left: 12px; }
  .hero__row > * { flex: 0 0 87%; min-width: 0; scroll-snap-align: start; }
  .match-score { font-size: 26px; }
  .match-side__name { font-size: 14px; }

  /* View padding */
  .view { padding: 8px 12px 28px; }
  .section-head { margin: 4px 0 12px; }
  .section-head h2 { font-size: 18px; }
  .section-head p { font-size: 12.5px; }

  /* Groups: single column, bigger tap targets */
  .group-grid { grid-template-columns: 1fr; gap: 12px; }
  .tbl td { padding: 9px 6px; }

  /* Third place: rank+team+pts/gd on row 1, probability bar on row 2 */
  .third-row {
    grid-template-columns: 28px 1fr auto auto; row-gap: 8px; column-gap: 10px;
    padding: 10px 12px;
  }
  .third-rank { font-size: 15px; }
  .third-prob { grid-column: 1 / -1; }
  .third-prob .bar { min-width: 80px; }

  /* Bracket: smooth horizontal scroll, slightly tighter columns */
  .bracket-scroll { -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; }
  .bracket { gap: 16px; }
  .bround { min-width: 190px; }
  .bteam { font-size: 12px; }

  /* Projections: simplify to Team + Win Cup + road bar; full detail on tap */
  .proj-scroll { max-height: none; overflow: visible; border: none; border-radius: 0; }
  .proj-table th { position: static; }
  .pcol-hide { display: none; }
  .roadbar-cell { min-width: 120px; }
  .proj-top { gap: 8px; }
  .donut-card { padding: 12px 8px; }
  .proj-table td, .proj-table th { padding: 9px 6px; }

  /* Pairings: keep picker short so the panel is reachable */
  .pair-wrap { gap: 14px; }
  .team-picker { max-height: 40vh; flex-direction: row; flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; gap: 8px; padding-bottom: 6px; -webkit-overflow-scrolling: touch; }
  .picker-item { flex: 0 0 auto; flex-direction: column; text-align: center; gap: 4px; min-width: 84px; }
  .picker-item span:not(.picker-item__odds) { font-size: 11px; max-width: 84px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .picker-item__odds { margin: 0; }
  .pair-panel { padding: 14px; }
  .opp-row { grid-template-columns: 116px 1fr 40px; gap: 8px; }

  /* Drawer: near full-screen */
  .drawer { width: 100vw; padding: 18px 14px calc(18px + env(safe-area-inset-bottom)); }
  .metricgrid { grid-template-columns: repeat(3, 1fr); }

  /* Footer flows at the end instead of covering content */
  .footer { position: static; flex-direction: column; align-items: center; gap: 4px; text-align: center; font-size: 10.5px; padding: 12px; }

  /* Tooltips fit small screens */
  .tooltip { max-width: min(86vw, 300px); }
}

/* ---------- Very small phones ---------- */
@media (max-width: 380px) {
  .topbar__title { font-size: 16px; }
  .topbar__trophy { font-size: 21px; }
  .topbar__updated, .topbar__updated.pulse { display: none; }
  .match-score { font-size: 23px; }
  .third-row { grid-template-columns: 24px 1fr auto; }
  .third-row .tnum[data-term="gd"] { display: none; }
  .metricgrid { grid-template-columns: repeat(2, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  .topbar, .tabs, .hero__row, .bracket-scroll, .team-picker { scroll-behavior: auto; }
}

/* ============================================================================
   CONTACT MODAL (shared "Contact" dialog for the sub-app)
   Mirrors the React ContactModal on the hub.
   =================================================================== */
.cc-root { position: fixed; inset: 0; z-index: 200; }
.cc-backdrop {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(4px);
  animation: ccFade .18s ease;
}
@keyframes ccFade { from { opacity: 0; } }
.cc-modal {
  position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(100% - 32px, 460px); max-height: calc(100vh - 40px); overflow-y: auto;
  background: var(--bg2); border: 1px solid var(--border2);
  border-radius: 16px; box-shadow: 0 28px 64px rgba(0, 0, 0, 0.55);
  padding: clamp(22px, 4vw, 30px); animation: ccIn .2s ease;
  scrollbar-width: thin; scrollbar-color: rgba(var(--ink-rgb), 0.28) transparent;
}
.cc-modal::-webkit-scrollbar { width: 11px; }
.cc-modal::-webkit-scrollbar-track { background: transparent; }
.cc-modal::-webkit-scrollbar-thumb {
  background: rgba(var(--ink-rgb), 0.22); border-radius: 999px;
  border: 3px solid transparent; background-clip: padding-box;
}
.cc-modal::-webkit-scrollbar-thumb:hover { background: rgba(var(--ink-rgb), 0.4); background-clip: padding-box; }
@keyframes ccIn { from { opacity: 0; transform: translate(-50%, calc(-50% + 8px)); } }
.cc-close {
  position: absolute; top: 12px; right: 12px;
  display: grid; place-items: center; width: 34px; height: 34px;
  border-radius: 50%; color: var(--muted); background: transparent;
  border: 1px solid transparent; cursor: pointer; transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}
.cc-close:hover { color: var(--text); background: rgba(255, 255, 255, 0.06); border-color: var(--border2); }
.cc-close svg { width: 20px; height: 20px; }
.cc-title { font-size: 1.4rem; color: var(--text); margin: 0 28px 0 0; }
.cc-sub { margin: 6px 0 0; color: var(--muted); font-size: 0.92rem; }
.cc-tabs { display: flex; gap: 8px; margin: 18px 0 16px; }
.cc-tab {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 12px; border-radius: 12px; font-weight: 600; font-size: 0.92rem; cursor: pointer;
  color: var(--muted); background: rgba(255, 255, 255, 0.04); border: 1px solid var(--border2);
  transition: color .15s ease, border-color .15s ease, background-color .15s ease;
}
.cc-tab svg { width: 17px; height: 17px; }
.cc-tab:hover { color: var(--text); }
.cc-tab.is-active { color: var(--cove-gold-bright, #f7d27e); border-color: rgba(232, 178, 76, 0.55); background: rgba(232, 178, 76, 0.12); }
.cc-form { display: flex; flex-direction: column; gap: 14px; }
.cc-label { display: flex; flex-direction: column; gap: 6px; font-size: 0.82rem; font-weight: 600; color: var(--muted); }
.cc-optional { font-weight: 400; color: var(--muted2); }
.cc-input {
  font: inherit; font-size: 0.95rem; color: var(--text);
  background: rgba(0, 0, 0, 0.28); border: 1px solid var(--border2);
  border-radius: 10px; padding: 10px 12px; transition: border-color .15s ease, box-shadow .15s ease;
}
.cc-input::placeholder { color: var(--muted2); }
.cc-input:focus { outline: none; border-color: var(--cove-gold, #e8b24c); box-shadow: 0 0 0 3px rgba(232, 178, 76, 0.18); }
.cc-textarea { resize: vertical; min-height: 96px; }
.cc-hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.cc-turnstile { display: flex; justify-content: center; min-height: 65px; }
.cc-turnstile:empty { min-height: 0; }
.cc-context { font-size: 0.78rem; color: var(--muted2); margin: -2px 0 0; }
.cc-context strong { color: var(--muted); }
.cc-submit {
  width: 100%; font: inherit; font-weight: 600; font-size: 0.95rem; color: #fff;
  background: var(--patreon, #f96854); border: none; border-radius: 999px; padding: 11px 16px; cursor: pointer;
  transition: filter .15s ease;
}
.cc-submit:hover { filter: brightness(1.05); }
.cc-submit:disabled { opacity: 0.55; cursor: not-allowed; }
.cc-note { font-size: 0.86rem; margin: 0; padding: 9px 12px; border-radius: 10px; }
.cc-note-warn { color: var(--cove-gold-bright, #f7d27e); background: rgba(232, 178, 76, 0.12); border: 1px solid rgba(232, 178, 76, 0.4); }
.cc-note-err { color: #f0a3a0; background: rgba(240, 85, 107, 0.12); border: 1px solid rgba(240, 85, 107, 0.4); }
.cc-result { text-align: center; padding: 14px 4px 4px; }
.cc-result-emoji { font-size: 2.6rem; }
.cc-result .cc-title { margin: 10px 0 0; }
.cc-result-text { color: var(--muted); margin: 8px auto 20px; max-width: 36ch; }
.cc-done {
  min-width: 120px; font: inherit; font-weight: 600; color: var(--text);
  background: rgba(255, 255, 255, 0.06); border: 1px solid var(--border2); border-radius: 999px; padding: 10px 16px; cursor: pointer;
}
.cc-done:hover { border-color: var(--cove-gold, #e8b24c); }
@media (prefers-reduced-motion: reduce) { .cc-backdrop, .cc-modal { animation: none; } }
@media (max-width: 480px) { .covebar__contact-label { display: none; } }
