/* getraun.is — "midnight pitch": a refined dark UI carried by typography,
   depth, and detail. Self-hosted fonts; no build step. */

/* ---- fonts (self-hosted woff2) ---- */
@font-face { font-family: "Bricolage"; src: url("/static/fonts/bricolage-600.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Bricolage"; src: url("/static/fonts/bricolage-700.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Hanken"; src: url("/static/fonts/hanken-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Hanken"; src: url("/static/fonts/hanken-500.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Hanken"; src: url("/static/fonts/hanken-600.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "JBMono"; src: url("/static/fonts/jetbrains-500.woff2") format("woff2"); font-weight: 500; font-display: swap; }

:root {
  --bg: #0a0b0f;
  --surface: #13151c;
  --surface-2: #181b23;
  --line: #232733;
  --line-2: #2f3441;
  --fg: #e9ebf1;
  --fg-dim: #aeb6c4;
  --muted: #8b94a6;          /* WCAG AA on dark surfaces (was #6f7889 — failed) */
  --accent: #4f8cff;
  --accent-bright: #6ea0ff;
  --accent-soft: rgba(79, 140, 255, 0.14);
  --good: #37d39a;
  --bad: #ff6b6b;
  --gold: #f4c95b;

  /* semantic (theme-swappable) */
  --heading: #ffffff;
  --glass: rgba(10, 11, 15, 0.72);            /* sticky top bar */
  --hover: rgba(255, 255, 255, 0.03);          /* subtle row / element hover */
  --btn-hover: #20242e;
  --accent-btn: #3568e0;                        /* solid-accent bg behind WHITE text — AA (link --accent is too light) */
  --accent-btn-hover: #2a5be8;
  --place2: #cbd2dc;                            /* leaderboard 2nd / 3rd place */
  --place3: #d29a67;
  --live: #ff5a5f;
  --glow-a: rgba(79, 140, 255, 0.12);          /* single soft blue glow — green/gold dropped (muddy under the header) */
  --glow-b: transparent;
  --glow-c: transparent;
  --grain: 0.022;
  --grid: rgba(255, 255, 255, 0.04);            /* graph-paper background */
  --grid-size: 30px;

  --display: "Bricolage", Georgia, serif;
  --body: "Hanken", system-ui, -apple-system, sans-serif;
  --mono: "JBMono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 28px rgba(0, 0, 0, 0.35);
  --maxw: 940px;
}

/* ---- light theme: warm paper + ink (designed, not an invert) ---- */
:root[data-theme="light"] {
  --bg: #f1ede4;
  --surface: #ffffff;
  --surface-2: #f6f2e9;
  --line: #e5dece;
  --line-2: #d8cfbc;
  --fg: #1a1d24;
  --fg-dim: #505661;
  --muted: #67614f;          /* WCAG AA on paper (was #8a8475 — failed) */
  --accent: #1a4ee8;            /* deepened so links clear AA on warm paper */
  --accent-bright: #1842c8;
  --accent-soft: rgba(47, 99, 255, 0.12);
  --good: #0b6e45;              /* all deepened for AA on light */
  --bad: #bd3528;
  --gold: #7a5810;

  --heading: #15171d;
  --glass: rgba(246, 242, 233, 0.82);
  --hover: rgba(20, 22, 28, 0.045);
  --btn-hover: #ebe4d6;
  --accent-btn: #1a4ee8;
  --accent-btn-hover: #1842c8;
  --place2: #5f6772;
  --place3: #8a5326;
  --live: #c62828;
  --glow-a: rgba(47, 99, 255, 0.05);
  --glow-b: transparent;
  --glow-c: transparent;
  --grain: 0.03;
  --grid: rgba(28, 30, 38, 0.07);
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.7), 0 16px 36px rgba(60, 52, 38, 0.12);
}

/* Smooth cross-fade when the theme flips (no flash on load — the head script sets
   the theme before paint, so this only fires on an actual toggle). */
*, *::before, *::after {
  transition: background-color 0.3s ease, border-color 0.3s ease, color 0.28s ease;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--fg);
  font: 400 15.5px/1.55 var(--body);
  letter-spacing: 0.005em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  display: flex;
  flex-direction: column; /* footer sticks to the bottom on short pages */
}
/* Atmosphere: a soft accent glow + faint grain, fixed behind everything. */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -2; pointer-events: none;
  background:
    radial-gradient(820px 520px at 12% -6%, var(--glow-a), transparent 60%),
    radial-gradient(760px 560px at 92% 4%, var(--glow-b), transparent 55%),
    radial-gradient(900px 720px at 72% 110%, var(--glow-c), transparent 60%),
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: auto, auto, auto, var(--grid-size) var(--grid-size), var(--grid-size) var(--grid-size);
}
body::after {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: var(--grain);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

::selection { background: var(--accent-soft); }

/* ---- typography ---- */
h1, h2, h3 { font-family: var(--display); font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; color: var(--heading); }
h1 { font-size: clamp(1.7rem, 1.2rem + 1.7vw, 2.3rem); margin: 0 0 0.2em; }
h2 { font-size: 1.3rem; font-weight: 600; margin: 0 0 0.6rem; }
h3 { font-size: 1.02rem; font-weight: 600; margin: 0 0 0.5rem; }
p { margin: 0.5rem 0; }
a { color: var(--accent); text-decoration: none; transition: color 0.15s ease; }
a:hover { color: var(--accent-bright); }
.muted { color: var(--muted); }
.code, code { font-family: var(--mono); font-size: 0.86em; color: var(--fg-dim); }

/* ---- top bar ---- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 0.25rem 1rem;
  padding: 0.7rem 1.25rem;
  background: var(--glass);
  backdrop-filter: saturate(140%) blur(14px);
  -webkit-backdrop-filter: saturate(140%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.brand {
  font-family: var(--display); font-weight: 700; font-size: 1.18rem; letter-spacing: -0.03em;
  display: inline-flex; align-items: center; gap: 0.5rem; color: var(--heading);
}
.brand:hover { color: var(--heading); }
.brand .mark { width: 1.32em; height: 1.32em; display: block; color: var(--fg); flex: none; }
.brand .mark .ring { stroke: var(--accent); fill: none; }
.brand .mark .spot { fill: var(--accent); }
.brand .dot { color: var(--accent); }
.topbar nav { display: flex; align-items: center; gap: 1.1rem; }
.topbar nav > * { white-space: nowrap; }
.topbar nav a { color: var(--fg-dim); font-weight: 500; font-size: 0.94rem; }
.topbar nav a:hover { color: var(--fg); }
/* The logout control is a POST form (CSRF-safe); style its button as a nav link. */
.topbar nav form.logout { display: inline; margin: 0; }
.topbar nav form.logout button { background: none; border: 0; padding: 0; margin: 0; cursor: pointer; font: inherit; color: var(--fg-dim); font-weight: 500; font-size: 0.94rem; }
.topbar nav form.logout button:hover { color: var(--fg); }
.me { color: var(--muted); font-size: 0.9rem; }

/* theme toggle: a light bulb. dark = lights off (outline), light = lights on (gold glow) */
.bulb {
  appearance: none; -webkit-appearance: none; padding: 0; cursor: pointer;
  width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--fg-dim);
  transition: transform 0.15s ease, border-color 0.2s ease, color 0.25s ease, background-color 0.3s ease;
}
.bulb:hover { color: var(--fg); border-color: var(--line-2); transform: translateY(-1px); }
.bulb:active { transform: scale(0.92); }
.bulb svg { width: 16px; height: 16px; }
.bulb .glass { fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.bulb .rays { stroke: var(--gold); stroke-width: 1.7; stroke-linecap: round; opacity: 0; transition: opacity 0.25s ease; }
.bulb .fill { fill: var(--gold); opacity: 0; transition: opacity 0.25s ease; }
:root[data-theme="light"] .bulb { color: var(--gold); }
:root[data-theme="light"] .bulb .glass { stroke: var(--gold); }
:root[data-theme="light"] .bulb .rays { opacity: 1; }
:root[data-theme="light"] .bulb .fill { opacity: 0.92; }
@keyframes flick { 40% { transform: scale(1.2); } }
.bulb.flick svg { animation: flick 0.3s ease; }

/* ---- layout ---- */
main { width: 100%; max-width: var(--maxw); margin: 0 auto; flex: 1 0 auto; padding: 2.2rem 1.25rem 4rem; animation: rise 0.32s cubic-bezier(0.2, 0.7, 0.3, 1) both; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
section { margin: 1.9rem 0; }
section > h2 { padding-bottom: 0.5rem; border-bottom: 1px solid var(--line); margin: 1.8rem 0 0.9rem; }
section > h2:first-child { margin-top: 0; }
footer { text-align: center; color: var(--muted); padding: 2.5rem 1rem; font-size: 0.85rem; }

/* ---- cards / surfaces ---- */
.card {
  background: linear-gradient(180deg, var(--surface), var(--bg));
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 2rem; max-width: 420px; box-shadow: var(--shadow);
}
.card h1 { font-size: 1.6rem; }
.hero h1 { font-size: clamp(2rem, 1.4rem + 2.4vw, 3rem); }

/* ---- buttons ---- */
.btn {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.52rem 0.95rem; border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--fg); font: 600 0.92rem var(--body); cursor: pointer;
  transition: transform 0.08s ease, border-color 0.15s ease, background 0.15s ease;
}
.btn:hover { text-decoration: none; background: var(--btn-hover); border-color: var(--line-2); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent-btn); border-color: var(--accent-btn); color: #fff; box-shadow: 0 6px 18px rgba(79, 140, 255, 0.28); }
.btn.primary:hover { background: var(--accent-btn-hover); border-color: var(--accent-btn-hover); }
.btn.google { background: #fff; color: #1a1a1a; border-color: #fff; }
.btn.github { background: #1c2128; color: #fff; border-color: #30363d; }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--muted); box-shadow: none; }
.btn.ghost:hover { background: rgba(255, 107, 107, 0.08); border-color: rgba(255, 107, 107, 0.5); color: var(--bad); }
.btn.small { padding: 0.4rem 0.7rem; font-size: 0.82rem; }
button { font-family: var(--body); }

/* ---- forms ---- */
form label { display: block; margin: 0.85rem 0 0.3rem; color: var(--fg-dim); font-size: 0.9rem; font-weight: 500; }
form input, form select, form textarea {
  width: 100%; padding: 0.6rem 0.7rem; font: 400 0.95rem var(--body);
  background: var(--bg); color: var(--fg); border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
form input::placeholder, form textarea::placeholder { color: var(--muted); }
form input:focus, form select:focus, form textarea:focus,
button:focus-visible, a:focus-visible, .rx:focus-visible {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
form textarea { font: 0.84rem/1.5 var(--mono); resize: vertical; }
/* checkbox + its label on one aligned row (overrides the full-width form-input rule
   that would otherwise stretch/centre the checkbox) */
label.check { display: flex; align-items: center; gap: 0.55rem; margin: 0.85rem 0; color: var(--fg); font-size: 0.95rem; font-weight: 400; cursor: pointer; }
label.check input[type="checkbox"] { width: auto; flex: none; margin: 0; accent-color: var(--accent); }
hr { border: 0; border-top: 1px solid var(--line); margin: 1.2rem 0; }
.row { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }
.row input { width: auto; flex: 1; min-width: 8em; }

/* ---- tables (leaderboard / fixtures / scoring) ---- */
table.lb, table.fixtures, table.scoring {
  width: 100%; border-collapse: collapse;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
}
table.lb th, table.fixtures th, table.scoring th {
  text-align: left; padding: 0.6rem 0.8rem; font: 600 0.72rem var(--body);
  text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted);
  background: var(--surface-2); border-bottom: 1px solid var(--line);
}
table.lb td, table.fixtures td, table.scoring td { padding: 0.62rem 0.8rem; border-bottom: 1px solid var(--line); vertical-align: middle; font-variant-numeric: tabular-nums; }
table.lb tbody tr:last-child td, table.fixtures tbody tr:last-child td, table.scoring tbody tr:last-child td { border-bottom: 0; }
table.lb tbody tr, table.fixtures tbody tr, table.scoring tbody tr { transition: background 0.12s ease; }
table.lb tbody tr:hover, table.fixtures tbody tr:hover, table.scoring tbody tr:hover { background: var(--hover); }
/* scoring rules: point columns in mono, first column the sport name */
table.scoring td:not(:first-child) { font-family: var(--mono); text-align: center; }
table.scoring th:not(:first-child) { text-align: center; }
/* global board: highlight the signed-in player's own row */
table.board tbody tr.me-row { background: rgba(79, 140, 255, 0.12); }
table.board tbody tr.me-row td { font-weight: 600; }
table.board tbody tr.me-row:hover { background: rgba(79, 140, 255, 0.16); }

/* pagination control */
.pager { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: 1rem; }

/* avatars (img or generated initials) */
.avatar { display: inline-block; border-radius: 50%; object-fit: cover; vertical-align: middle; flex: none; }
.avatar-initials { display: inline-flex; align-items: center; justify-content: center; color: #fff; font-weight: 600; line-height: 1; }
.avatar-24 { width: 24px; height: 24px; font-size: 11px; }
.avatar-48 { width: 48px; height: 48px; font-size: 20px; }
.avatar-96 { width: 96px; height: 96px; font-size: 38px; }
.avatar-edit { display: flex; gap: 1rem; align-items: flex-start; margin-bottom: 0.5rem; }
.profile-head { display: flex; align-items: center; gap: 0.6rem; }
a.me { display: inline-flex; align-items: center; gap: 0.35rem; }

/* userchip: avatar + name (+ crown for Pro), used wherever a player is listed */
.userchip { display: inline-flex; align-items: center; gap: 0.4rem; min-width: 0; }
.userchip .uc-name { overflow: hidden; text-overflow: ellipsis; }
.crown { width: 0.95em; height: 0.95em; flex: none; color: var(--gold); fill: currentColor; vertical-align: -0.12em; }
.lb-name { display: inline-flex; align-items: center; gap: 0.35rem; } /* keep the owner crown centred with the avatar + name */
a .userchip .uc-name { text-decoration: underline; }

/* billing / tiers */
.plan-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.2rem; margin: 1rem 0 1.4rem; }
/* pricing page: two plan cards side by side */
.plans { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; align-items: start; margin: 1.2rem 0; }
@media (max-width: 640px) { .plans { grid-template-columns: 1fr; } }
.plans .plan-card { margin: 0; }
.plan-price { font-family: var(--mono); color: var(--muted); margin: 0.2rem 0 0.9rem; }
ul.plan-feats { list-style: none; padding: 0; margin: 0 0 1.1rem; display: grid; gap: 0.5rem; }
ul.plan-feats li { padding-left: 1.4rem; position: relative; }
ul.plan-feats li::before { content: "✓"; position: absolute; left: 0; color: var(--good); }
.plan-now { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 0.5rem; }
.plan-name { font-family: var(--display); font-size: 1.4rem; font-weight: 700; }
.note { margin-top: 1.5rem; }
.checkout { max-width: 30rem; }
.checkout-line { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; padding: 0.7rem 0; border-bottom: 1px solid var(--line); font-size: 1.1rem; }
.testmode { background: rgba(245, 196, 90, 0.12); border: 1px solid rgba(245, 196, 90, 0.35); border-radius: 8px; padding: 0.6rem 0.8rem; margin: 1rem 0; font-size: 0.92rem; }
.upgrade-link { color: var(--gold) !important; }
.pro-link { color: var(--gold) !important; font-weight: 600; }

/* language switcher in the header nav */
.langsw { font-size: 0.82rem; letter-spacing: 0.03em; opacity: 0.85; }
.langsw strong { color: var(--text); }
.langsw a { color: var(--muted); }

/* company-branded league: an accent pill with the brand name (the --accent override
   that tints the page lives inline on the .branded wrapper) */
.brand-tag { font-size: 0.6em; font-weight: 600; vertical-align: middle; padding: 0.18em 0.62em; border-radius: 999px; background: var(--accent-btn); color: #fff; letter-spacing: 0.02em; }

/* league match schedule (date-grouped, each row opens the predict+chat room) */
.matches-sub { font: 600 0.74rem var(--body); text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin: 1.3rem 0 0.4rem; }
.match-date { font-size: 0.82rem; font-weight: 600; color: var(--fg-dim); margin: 0.7rem 0 0.3rem; }
ul.matches { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.35rem; }
ul.matches li { margin: 0; }
.match-row {
  display: flex; align-items: center; gap: 0.7rem; padding: 0.6rem 0.85rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  color: var(--fg); transition: border-color 0.12s ease, background 0.12s ease;
}
.match-row:hover { text-decoration: none; background: var(--surface-2); border-color: var(--line-2); }
.match-time { font-family: var(--mono); color: var(--muted); font-size: 0.85rem; flex: none; min-width: 3em; }
.match-teams { flex: 1; min-width: 0; display: flex; align-items: center; flex-wrap: wrap; gap: 0.1rem 0.45rem; }
/* Each team's flag + name is one non-breaking unit, so a long name can never
   wrap away from its flag (the old inline flow orphaned the away flag). */
.team { display: inline-flex; align-items: center; white-space: nowrap; }
/* Wide tables (the round fixtures grid, standings) scroll inside their own box
   on narrow screens instead of pushing the whole page sideways. */
.table-scroll { overflow-x: auto; }
.match-score { font-family: var(--mono); margin: 0 0.15rem; }
/* A result team + its own score. The per-team .sc shows only in the mobile
   scoreboard; on desktop the combined .match-score in the middle is shown instead. */
.side { display: inline-flex; align-items: center; min-width: 0; }
.side .sc { display: none; font-family: var(--mono); font-weight: 700; }
/* In-product company upsell callout (owner of a free league with a work-domain cluster). */
.upsell { margin: 1rem 0; padding: 1rem 1.15rem; border: 1px solid var(--accent); border-radius: 10px; background: var(--surface-2); }
.upsell strong { display: block; color: var(--heading); font-size: 1.02rem; }
.upsell p { margin: 0.35rem 0 0.7rem; color: var(--fg-dim); }
.match-stage { font-size: 0.72rem; color: var(--muted); background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; padding: 0.08rem 0.5rem; white-space: nowrap; }
.match-go { font-size: 0.8rem; color: var(--accent); white-space: nowrap; flex: none; }
.match-pick { font-family: var(--mono); font-size: 0.76rem; color: var(--fg-dim); background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 999px; padding: 0.08rem 0.55rem; white-space: nowrap; flex: none; }
.match-pick--missing { color: var(--bad); border-color: rgba(255, 107, 107, 0.45); background: rgba(255, 107, 107, 0.08); font-weight: 700; min-width: 1.6em; text-align: center; }
@media (max-width: 560px) {
  .match-go { display: none; }
  /* Stack the two teams (home over away) so every row is the same shape regardless
     of name length; the "vs" is implied by the stack. */
  .match-teams { flex-direction: column; align-items: flex-start; gap: 0.15rem; }
  .match-teams .vs { display: none; }
  /* Results become a scoreboard: each team on its own line with its own score on
     the right (aligned), and the combined "H–A" score is hidden. */
  .match-teams--result .side { display: flex; justify-content: space-between; align-items: center; width: 100%; }
  .match-teams--result .side .sc { display: inline-block; margin-left: 0.75rem; }
  .match-teams--result .match-score { display: none; }
}

/* league members panel */
ul.members { list-style: none; padding: 0; margin: 0.6rem 0; display: grid; gap: 0.5rem; max-width: 460px; }
ul.members li {
  display: flex; align-items: center; gap: 0.5rem;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 0.42rem 0.5rem 0.42rem 0.72rem;
}
ul.members form.inline-form { margin: 0 0 0 auto; } /* push the remove button to the right */

/* stats hub */
ul.statfix { list-style: none; padding: 0; margin: 0.5rem 0; display: grid; gap: 0.4rem; }
ul.statfix li {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0.55rem 0.8rem; background: var(--surface); border: 1px solid var(--line); border-radius: 8px;
}
ul.statfix li a { display: inline-flex; align-items: center; gap: 0.4rem; }
.pct-tag { font-family: var(--mono); white-space: nowrap; font-variant-numeric: tabular-nums; }
.stat-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; align-items: start; }
@media (max-width: 640px) { .stat-cols { grid-template-columns: 1fr; } }

/* player profile summary cards */
.profile-summary { display: flex; flex-wrap: wrap; gap: 1rem; }
.stat-card {
  flex: 1 1 8rem; padding: 0.9rem 1.1rem; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius);
}
.stat-card .stat-num { font-family: var(--display); font-size: 1.8rem; font-weight: 700; letter-spacing: -0.01em; }

/* bulk predict */
.bulk-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; margin: 1rem 0; position: sticky; top: 0.5rem; z-index: 2; }
table.fixtures.bulk td.home { text-align: right; }
table.fixtures.bulk td.away { text-align: left; }
table.fixtures.bulk td.pick { text-align: center; white-space: nowrap; }
table.fixtures.bulk td.lock-cell { font-size: 0.85rem; white-space: nowrap; }
.countdown { font-family: var(--mono); }

/* ---- rules / scoring explainer ---- */
.rules { max-width: 46rem; }
.rules h2 { margin-top: 1.6rem; }
.rules ul.bands { list-style: none; padding: 0; margin: 0.6rem 0; display: grid; gap: 0.45rem; }
.rules ul.bands li { padding: 0.5rem 0.7rem; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.rules code { font-family: var(--mono); background: var(--surface-2); padding: 0.04rem 0.32rem; border-radius: 5px; }
/* leaderboard only (.board): rank + numeric columns in mono; leader gets a spark */
table.board td:first-child { font-family: var(--mono); color: var(--muted); width: 2.5rem; }
table.board td:nth-child(n+3) { font-family: var(--mono); }
/* podium medals draw the eye to the standings */
table.board tbody tr:nth-child(1) td:first-child { color: var(--gold); font-weight: 600; }
table.board tbody tr:nth-child(2) td:first-child { color: var(--place2); }
table.board tbody tr:nth-child(3) td:first-child { color: var(--place3); }

/* ---- predictions / pick form ---- */
.pick { display: inline-flex; gap: 0.45rem; align-items: center; white-space: nowrap; }
.pick input { width: 2.9em; text-align: center; font-family: var(--mono); font-size: 1rem; padding: 0.42rem 0.3rem; }
/* drop the cramped native number spinners — the field is small, just type the score */
.pick input[type=number] { -moz-appearance: textfield; appearance: textfield; }
.pick input::-webkit-outer-spin-button,
.pick input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.pick span { color: var(--muted); }
/* keep the kickoff date on one line so rows don't grow taller than they need */
table.fixtures:not(.bulk) td:first-child { white-space: nowrap; }
.locked { font-weight: 600; color: var(--muted); font-family: var(--mono); }
.pts { color: var(--good); background: rgba(55, 211, 154, 0.12); border-radius: 6px; padding: 0.04rem 0.36rem; font-family: var(--mono); font-weight: 500; margin-left: 0.3rem; }
.result-big { font-family: var(--display); font-size: 1.9rem; font-weight: 700; letter-spacing: -0.01em; margin: 0.2rem 0 0.7rem; }
.result-big .muted { font-family: var(--body); font-size: 0.95rem; font-weight: 500; }

/* ---- live (in-play) score indicators ---- */
.live-tag {
  font-family: var(--body); font-size: 0.8rem; font-weight: 600;
  color: var(--live); vertical-align: 0.18em; margin-left: 0.1rem;
  text-transform: uppercase; letter-spacing: 0.04em;
}
.live-tag::before, .live-dot {
  content: ""; display: inline-block; width: 0.5em; height: 0.5em;
  margin-right: 0.32em; border-radius: 50%; background: var(--live);
  animation: livepulse 1.4s ease-in-out infinite;
}
.live-dot { vertical-align: 0.1em; }
@keyframes livepulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }
@media (prefers-reduced-motion: reduce) { .live-tag::before, .live-dot { animation: none; } }
img.badge { height: 1.15em; width: auto; vertical-align: -0.18em; margin-right: 0.25rem; border-radius: 3px; }

/* ---- request / loading feedback ---- */
/* hx-disabled-elt disables the in-flight control; dim it + show a progress cursor. */
button[disabled], .btn[disabled] { opacity: 0.55; cursor: progress; }
.scoreboard { margin: 0.2rem 0 0.7rem; }
.scoreboard.result-big { margin: 0.2rem 0 0.7rem; }

/* ---- inline feedback / banners ---- */
.saved { color: var(--good); margin-left: 0.5rem; font-size: 0.82rem; font-weight: 500; animation: pop 0.3s ease; }
@keyframes pop { from { opacity: 0; transform: scale(0.9); } }
.feedback { display: inline-block; min-width: 4em; }
.ok, .bad { padding: 0.6rem 0.85rem; border-radius: var(--radius-sm); font-size: 0.92rem; border: 1px solid; }
.ok { color: var(--good); background: rgba(55, 211, 154, 0.08); border-color: rgba(55, 211, 154, 0.25); }
.bad { color: var(--bad); background: rgba(255, 107, 107, 0.08); border-color: rgba(255, 107, 107, 0.25); }

/* ---- odds chip ---- */
.odds { white-space: nowrap; }
.odds-chip {
  font-family: var(--mono); font-size: 0.74rem; color: var(--fg-dim);
  background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 999px; padding: 0.16rem 0.55rem;
}

/* ---- onboarding guide ---- */
ol.guide-steps { list-style: none; counter-reset: step; padding: 0; margin: 1rem 0; display: grid; gap: 0.9rem; }
ol.guide-steps > li { counter-increment: step; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 0.9rem 1.1rem 0.9rem 3.2rem; position: relative; }
ol.guide-steps > li::before { content: counter(step); position: absolute; left: 0.9rem; top: 0.95rem; width: 1.7em; height: 1.7em; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 0.95rem; display: flex; align-items: center; justify-content: center; }
ol.guide-steps h2 { font-size: 1.05rem; margin: 0 0 0.3rem; }
ol.guide-steps p { margin: 0.2rem 0; }

/* ---- dashboard tournament cards + section headers ---- */
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap; }
.section-head h2 { margin: 0 0 0.4rem; }
.section-links { font-size: 0.9rem; }
ul.tlist { list-style: none; padding: 0; margin: 0.4rem 0 0; display: grid; gap: 0.6rem; }
.tcard { display: flex; align-items: center; justify-content: space-between; gap: 0.8rem; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 0.75rem 0.9rem; }
.tcard-info { display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; }
.tcard-name { font-size: 1.05rem; }
.tcard-meta { font-size: 0.85rem; }
.tcard-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }
@media (max-width: 560px) {
  .tcard-actions { width: 100%; }
  .tcard-actions .btn { flex: 1; text-align: center; }
}

/* ---- news ---- */
ul.news { list-style: none; padding: 0; margin: 0; }
ul.news li { padding: 0.7rem 0.55rem; border-bottom: 1px solid var(--line-2); border-radius: 6px; transition: background-color 0.15s ease; }
ul.news li:hover { background: var(--hover); }
ul.news li:last-child { border-bottom: 0; }
ul.news a { font-weight: 600; }
.news-sum { font-size: 0.86rem; margin-top: 0.2rem; line-height: 1.45; }

/* ---- prizes ---- */
ul.prizes { list-style: none; padding: 0; margin: 0; }
ul.prizes li { padding: 0.7rem 0.55rem; border-bottom: 1px solid var(--line-2); }
ul.prizes li:last-child { border-bottom: 0; }
ul.prizes strong { color: var(--gold); }
.prize-controls { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin-top: 0.55rem; }
.prize-admin { display: flex; gap: 0.4rem; align-items: center; margin: 0; }
.prize-admin select { width: auto; min-width: 9.5em; padding: 0.45rem 0.55rem; }
.prize-admin .btn { padding: 0.45rem 0.8rem; font-size: 0.86rem; }

/* ---- dashboard lists ---- */
ul.leagues, ul.tlist { list-style: none; padding: 0; margin: 0 0 1rem; display: grid; gap: 0.55rem; }
ul.leagues li, ul.tlist li {
  padding: 0.85rem 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
  transition: border-color 0.15s ease, transform 0.08s ease;
}
ul.leagues li:hover, ul.tlist li:hover { border-color: var(--line-2); transform: translateX(2px); }
ul.leagues a { font-family: var(--display); font-weight: 600; font-size: 1.05rem; }
ul.leagues .code { margin-left: 0.5rem; letter-spacing: 0.05em; }

/* ---- chat ---- */
ul.chat {
  list-style: none; padding: 0.4rem 0; margin: 0 0 0.75rem; max-height: 52vh; overflow-y: auto;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface);
}
ul.chat li { padding: 0.45rem 0.85rem; border-bottom: 1px solid var(--line); }
ul.chat li:last-child { border-bottom: 0; }
ul.chat li.muted { color: var(--muted); }
ul.chat li.msg { display: flex; flex-direction: column; gap: 0.12rem; } /* meta row, then body on its own line */
.msg-meta { display: flex; align-items: center; gap: 0.4rem; font-size: 0.82rem; }
.msg-meta strong { color: var(--accent-bright); font-weight: 600; }
.msg-body { margin-left: 1.65rem; overflow-wrap: anywhere; } /* indent under the name (past the 20px avatar) */
.chat-form { display: flex; gap: 0.5rem; align-items: center; }
.chat-form input { flex: 1; }

/* ---- member predictions + reactions ---- */
ul.preds { list-style: none; padding: 0; margin: 0; }
ul.preds li { display: flex; gap: 0.6rem; align-items: center; padding: 0.6rem 0; border-bottom: 1px solid var(--line); }
ul.preds li:last-child { border-bottom: 0; }
.pred-score { font-family: var(--mono); font-weight: 500; color: var(--fg); }
.reactions { margin-left: auto; display: inline-flex; gap: 0.3rem; flex-wrap: wrap; }
.rx {
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; padding: 0.12rem 0.55rem;
  cursor: pointer; font: 0.85rem var(--body); color: var(--fg); transition: border-color 0.12s ease, background 0.12s ease;
}
.rx:hover { background: var(--btn-hover); }
.rx-on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-bright); }

/* ---- admin ---- */
.admin-t { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem 1.4rem; margin: 1.1rem 0; }
.admin-t h2 { margin-top: 0; border: 0; padding: 0; }
.admin-t .round { margin: 1rem 0 0.5rem; padding-top: 0.85rem; border-top: 1px dashed var(--line-2); }
.admin-t .round h3 { margin: 0 0 0.5rem; font-size: 1rem; }
details.import, details.feeds { margin: 0.6rem 0 1rem; }
details.import summary, details.feeds summary { cursor: pointer; color: var(--muted); font-size: 0.9rem; }
details.import summary:hover, details.feeds summary:hover { color: var(--fg-dim); }
.feed-row { margin: 0.4rem 0; justify-content: space-between; }
.feed-row span { flex: 1; }

/* ---- mobile ---- */
@media (max-width: 560px) {
  /* Plain block so the brand sits on its own line and the nav becomes a normal
     block-level flex container constrained to the viewport (a flex column item
     doesn't reliably honour width, so its items overflowed off-screen). */
  .topbar { display: block; padding: 0.6rem 1rem; }
  .topbar .brand { display: inline-flex; }
  /* Nav has ~9 items — wrap them across the full width instead of overflowing.
     Drop the display-name text (the avatar still links to the profile). */
  .topbar nav { margin-top: 0.5rem; flex-wrap: wrap; gap: 0.55rem 0.9rem; }
  .me-name { display: none; }
  main { padding: 1.5rem 1rem 3rem; }
  .card { padding: 1.4rem; }
  table.fixtures { font-size: 0.9rem; }
  .pick input { width: 2.6em; }
  table.lb th, table.fixtures th, table.lb td, table.fixtures td { padding: 0.5rem 0.55rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
