/* ==========================================================================
   Chicago Beer Die — site styles
   Colours come from the Chicago flag: light blue stripes, red stars.
   ========================================================================== */

:root {
  --font-display: "Oswald", "Arial Narrow", "Helvetica Neue", Arial, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  --navy-950: #061224;
  --navy-900: #0a1c36;
  --navy-800: #0f2747;
  --navy-700: #183a63;
  --sky-500: #41b6e6;
  --sky-400: #6cc7ee;
  --sky-200: #b3ddf2;
  --sky-100: #e4f4fc;
  --red-600: #e4002b;
  --red-700: #bf0024;
  --gold-500: #f2b01e;

  --bg: #eef2f7;
  --surface: #ffffff;
  --surface-2: #f5f7fb;
  --surface-3: #e9eef5;
  --text: #0e1a2b;
  --text-muted: #56677e;
  --text-faint: #8796ab;
  --border: #d8e0eb;
  --border-strong: #c3cfdf;
  --link: #0b6aa2;
  --win: #157a3a;
  --win-bg: #e5f5ea;
  --win-strong: #1f9d4c;
  --loss: #c21d3a;
  --loss-bg: #fdecef;
  --accent: var(--red-600);
  --focus: #41b6e6;
  --shadow-sm: 0 1px 2px rgba(10, 28, 54, .06);
  --shadow: 0 1px 2px rgba(10, 28, 54, .05), 0 6px 20px rgba(10, 28, 54, .07);
  --radius: 16px;
  --radius-sm: 10px;
  --container: 1320px;
  --gutter: clamp(16px, 3vw, 32px);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #07111f;
    --surface: #0d1b2e;
    --surface-2: #112339;
    --surface-3: #172d47;
    --text: #e6edf6;
    --text-muted: #9aabc2;
    --text-faint: #6f819b;
    --border: #1f3450;
    --border-strong: #2b4566;
    --link: #7fcdf0;
    --win: #5fd78a;
    --win-bg: rgba(52, 199, 105, .13);
    --win-strong: #34c769;
    --loss: #ff7f93;
    --loss-bg: rgba(255, 92, 120, .12);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
  }
}

/* --- Base ---------------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }

[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main { flex: 1; }

a { color: var(--link); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { text-decoration: underline; }

img { max-width: 100%; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: .01em;
  line-height: 1.15;
  margin: 0 0 .5em;
  text-transform: uppercase;
}
h1 { font-size: clamp(2.1rem, 4.6vw, 3.6rem); }
h2 { font-size: clamp(1.45rem, 2.4vw, 1.9rem); }
h3 { font-size: 1.3rem; }

p { margin: 0 0 1em; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }

.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 var(--gutter); }

.muted { color: var(--text-muted); }
.faint { color: var(--text-faint); }
.nowrap { white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.skip-link { position: absolute; left: -999px; top: 8px; z-index: 100; background: #fff; color: var(--navy-900); padding: .5rem 1rem; border-radius: 8px; }
.skip-link:focus { left: 8px; }

.icon { width: 1.15em; height: 1.15em; flex: none; vertical-align: -.2em; }

/* --- Header -------------------------------------------------------------- */

.site-header { background: var(--navy-900); color: #fff; position: relative; z-index: 20; }

.site-header__inner { display: flex; align-items: center; gap: 1.5rem; min-height: 84px; }

.brand { display: flex; align-items: center; gap: .85rem; color: #fff; text-decoration: none; flex: none; }
.brand:hover { text-decoration: none; }
.brand__logo { height: 56px; width: auto; display: block; filter: drop-shadow(0 3px 8px rgba(0,0,0,.35)); }
.brand__text { display: flex; flex-direction: column; font-family: var(--font-display); text-transform: uppercase; line-height: 1; }
.brand__city { color: var(--sky-400); font-size: .95rem; letter-spacing: .32em; font-weight: 600; }
.brand__name { font-size: 2rem; font-weight: 700; letter-spacing: .03em; }

.site-nav { display: flex; align-items: center; gap: .25rem; flex: 1; }
.site-nav__links { display: flex; align-items: center; gap: .15rem; flex: 1; justify-content: center; }
.site-nav__links a {
  color: #d4e3f5; text-decoration: none; font-family: var(--font-display); font-size: 1.12rem;
  font-weight: 500; letter-spacing: .06em; text-transform: uppercase; padding: .55rem .8rem; border-radius: 8px;
  position: relative;
}
.site-nav__links a:hover { color: #fff; background: rgba(255,255,255,.07); }
.site-nav__links a.is-active { color: #fff; }
.site-nav__links a.is-active::after {
  content: ""; position: absolute; left: .8rem; right: .8rem; bottom: .15rem; height: 3px; border-radius: 3px; background: var(--red-600);
}

.site-nav__account { display: flex; align-items: center; gap: .6rem; }
.site-nav__account .link-plain { color: #d4e3f5; text-decoration: none; font-weight: 600; padding: .5rem .6rem; }
.site-nav__account .link-plain:hover { color: #fff; }

.nav-toggle {
  display: none; margin-left: auto; background: transparent; border: 2px solid rgba(255,255,255,.25); color: #fff;
  border-radius: 10px; padding: .5rem .8rem; font: 600 1rem var(--font-body); cursor: pointer; align-items: center; gap: .4rem;
}

.user-menu { position: relative; }
.user-menu > summary {
  list-style: none; display: flex; align-items: center; gap: .55rem; cursor: pointer; padding: .3rem .6rem .3rem .3rem;
  border-radius: 999px; color: #fff; font-weight: 600; background: rgba(255,255,255,.08);
}
.user-menu > summary::-webkit-details-marker { display: none; }
.user-menu__name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 11rem; }
.site-nav__account { flex-wrap: nowrap; }
.site-nav__account .btn, .site-nav__account .link-plain { white-space: nowrap; }
.user-menu > summary:hover { background: rgba(255,255,255,.14); }
.user-menu__panel {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 230px; background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow); padding: .5rem; z-index: 30;
}
.user-menu__panel a, .user-menu__panel button {
  display: flex; width: 100%; align-items: center; gap: .6rem; padding: .65rem .8rem; border-radius: 9px; color: var(--text);
  text-decoration: none; font: 500 1rem var(--font-body); background: none; border: 0; cursor: pointer; text-align: left;
}
.user-menu__panel a:hover, .user-menu__panel button:hover { background: var(--surface-2); }
.user-menu__panel hr { border: 0; border-top: 1px solid var(--border); margin: .4rem 0; }

/* Thin Chicago-flag stripe under the header */
.flag-stripe {
  height: 12px;
  background: linear-gradient(to bottom, var(--sky-500) 0 33%, #fff 33% 67%, var(--sky-500) 67% 100%);
}

/* Mid-size screens: tighten the header so everything fits on one line */
@media (max-width: 1400px) {
  .site-header__inner { gap: 1rem; }
  .site-nav__links a { padding: .5rem .55rem; font-size: 1.04rem; letter-spacing: .04em; }
  .site-nav__links a.is-active::after { left: .55rem; right: .55rem; }
  .user-menu__name { max-width: 7.5rem; }
  .brand__name { font-size: 1.8rem; }
}

@media (max-width: 1180px) {
  .nav-toggle { display: inline-flex; }
  .site-nav {
    display: none; position: absolute; left: 0; right: 0; top: 100%; background: var(--navy-900);
    flex-direction: column; align-items: stretch; padding: .5rem var(--gutter) 1.25rem; gap: .75rem;
    border-top: 1px solid rgba(255,255,255,.08); box-shadow: 0 16px 30px rgba(0,0,0,.3);
  }
  .site-nav.is-open { display: flex; }
  .site-nav__links { flex-direction: column; align-items: stretch; }
  .site-nav__links a { padding: .8rem .75rem; font-size: 1.25rem; }
  .site-nav__links a.is-active::after { left: 0; right: auto; top: .7rem; bottom: .7rem; width: 4px; height: auto; }
  .site-nav__account { flex-wrap: wrap; }
  .user-menu__panel { left: 0; right: auto; }
}

@media (max-width: 560px) {
  .site-header__inner { min-height: 70px; gap: .75rem; }
  .brand__logo { height: 44px; }
  .brand__name { font-size: 1.55rem; }
  .brand__city { font-size: .78rem; }
}

/* --- Hero ---------------------------------------------------------------- */

.hero {
  background:
    radial-gradient(1200px 400px at 85% -20%, rgba(65,182,230,.28), transparent 60%),
    radial-gradient(800px 300px at 0% 120%, rgba(228,0,43,.22), transparent 60%),
    linear-gradient(180deg, var(--navy-800), var(--navy-900));
  color: #fff;
  padding: clamp(2rem, 5vw, 3.5rem) 0 clamp(4.5rem, 8vw, 6rem);
  position: relative;
  overflow: hidden;
}
.hero::before {
  /* faint six-pointed stars */
  content: ""; position: absolute; top: 0; right: 0; bottom: 0; left: 0; opacity: .07; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120'%3E%3Cpath fill='%23fff' d='M60 30l7.5 17 18.5-2-11 15 11 15-18.5-2L60 90l-7.5-17-18.5 2 11-15-11-15 18.5 2z'/%3E%3C/svg%3E");
  background-size: 120px 120px;
}
.hero .container { position: relative; }
.hero__kicker {
  display: inline-flex; align-items: center; gap: .5rem; font-family: var(--font-display); text-transform: uppercase;
  letter-spacing: .18em; font-size: .95rem; color: var(--sky-400); font-weight: 600; margin-bottom: .6rem;
}
.hero__kicker .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--red-600); box-shadow: 0 0 0 4px rgba(228,0,43,.25); }
.hero h1 { margin-bottom: .25em; }
.hero__sub { color: #c4d5ea; font-size: 1.15rem; max-width: 52rem; margin: 0; }
.hero__row { display: flex; flex-wrap: wrap; gap: 1.5rem 2rem; align-items: flex-end; justify-content: space-between; }
.hero__stats { display: flex; flex-wrap: wrap; gap: .75rem; }
.hero-stat {
  background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.12); border-radius: 14px;
  padding: .7rem 1.1rem; min-width: 120px;
}
.hero-stat__value { font-family: var(--font-display); font-size: 2rem; font-weight: 600; line-height: 1.1; }
.hero-stat__label { color: #a9bdd6; font-size: .85rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 600; }

.hero--compact { padding-bottom: clamp(4rem, 7vw, 5rem); }
.hero--flush { padding-bottom: clamp(2rem, 4vw, 2.75rem); }
.hero .player-link { color: #fff; }

/* Page body overlaps the hero a little */
.page { margin-top: clamp(-3.5rem, -5vw, -2.5rem); position: relative; padding-bottom: 4rem; }
.page--flat { margin-top: 2rem; }

/* --- Layout helpers ------------------------------------------------------ */

.stack > * + * { margin-top: clamp(1.25rem, 2.5vw, 2rem); }
.grid { display: grid; gap: clamp(1rem, 2vw, 1.75rem); }
.grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid--main-side { grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); align-items: start; }
@media (max-width: 1000px) { .grid--3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid--main-side { grid-template-columns: 1fr; } }
@media (max-width: 720px) { .grid--2, .grid--3 { grid-template-columns: 1fr; } }

/* --- Cards --------------------------------------------------------------- */

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
  overflow: hidden;
}
.card__header {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  padding: 1.1rem 1.4rem; border-bottom: 1px solid var(--border);
}
.card__title { margin: 0; font-size: 1.45rem; display: flex; align-items: center; gap: .6rem; }
.card__title .icon { color: var(--red-600); }
.card__subtitle { margin: .15rem 0 0; color: var(--text-muted); font-size: .95rem; }
.card__body { padding: 1.25rem 1.4rem; }
.card__body--flush { padding: 0; }
.card__footer { padding: .9rem 1.4rem; border-top: 1px solid var(--border); background: var(--surface-2); font-size: .95rem; }
.card__action { font-weight: 600; text-decoration: none; display: inline-flex; align-items: center; gap: .3rem; white-space: nowrap; }
.card__action:hover { text-decoration: underline; }

.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.section-title h2 { margin: 0; }

/* --- Buttons ------------------------------------------------------------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem; min-height: 46px; padding: .6rem 1.15rem;
  border-radius: 11px; border: 2px solid transparent; font: 600 1.02rem var(--font-body); text-decoration: none; cursor: pointer;
  background: var(--surface-3); color: var(--text); transition: background-color .15s, border-color .15s, transform .05s;
  white-space: nowrap;
}
.btn:hover { text-decoration: none; filter: brightness(1.04); }
.btn:active { transform: translateY(1px); }
.btn--primary, .btn--red { background: var(--red-600); color: #fff; }
.btn--primary:hover, .btn--red:hover { background: var(--red-700); }
.btn--navy { background: var(--navy-800); color: #fff; }
@media (prefers-color-scheme: dark) { .btn--navy { background: #24508a; } .pill.is-active, .pagination .is-current { background: #24508a; border-color: #24508a; } }
.btn--outline { background: transparent; border-color: var(--border-strong); color: var(--text); }
.btn--outline:hover { border-color: var(--text-muted); }
.btn--ghost-light { background: rgba(255,255,255,.1); color: #fff; border-color: rgba(255,255,255,.2); }
.btn--danger { background: var(--loss); color: #fff; }
.btn--lg { min-height: 56px; padding: .8rem 1.6rem; font-size: 1.12rem; border-radius: 13px; }
.btn--sm { min-height: 36px; padding: .35rem .8rem; font-size: .92rem; border-radius: 9px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

/* --- Pills / tabs -------------------------------------------------------- */

.pills { display: flex; flex-wrap: wrap; gap: .5rem; }
.pill {
  display: inline-flex; align-items: center; gap: .45rem; padding: .45rem .95rem; border-radius: 999px; text-decoration: none;
  font-weight: 600; font-size: .98rem; color: var(--text); background: var(--surface); border: 1px solid var(--border);
  white-space: nowrap;
}
.pill:hover { border-color: var(--border-strong); text-decoration: none; }
.pill.is-active { background: var(--navy-800); color: #fff; border-color: var(--navy-800); }
.pill .avatar { margin: -.2rem -.1rem -.2rem -.55rem; }
.pill__badge { font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--red-600); }
.pill.is-active .pill__badge { color: var(--sky-400); }

.hero .pill { background: rgba(255,255,255,.08); color: #e2ecf7; border-color: rgba(255,255,255,.14); }
.hero .pill:hover { background: rgba(255,255,255,.14); }
.hero .pill.is-active { background: #fff; color: var(--navy-900); border-color: #fff; }
.hero .pill.is-active .pill__badge { color: var(--red-600); }

.segmented {
  display: inline-flex; background: var(--surface-3); border-radius: 12px; padding: 4px; gap: 2px; flex-wrap: wrap;
}
.segmented a {
  padding: .45rem .95rem; border-radius: 9px; text-decoration: none; color: var(--text-muted); font-weight: 600; font-size: .95rem;
}
.segmented a:hover { color: var(--text); text-decoration: none; }
.segmented a.is-active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

.season-picker { display: grid; gap: .75rem; margin-top: 1.6rem; }
.season-picker__row { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.season-picker__label { font-family: var(--font-display); text-transform: uppercase; letter-spacing: .12em; font-size: .85rem; color: #93abc8; min-width: 5.5rem; }

/* --- Avatars & player links --------------------------------------------- */

.avatar {
  display: inline-grid; place-items: center; flex: none; border-radius: 50%; object-fit: cover; background: var(--surface-3);
  border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--border);
}
.avatar--xs { width: 26px; height: 26px; font-size: .62rem; }
.avatar--sm { width: 36px; height: 36px; font-size: .78rem; }
.avatar--md { width: 46px; height: 46px; font-size: .95rem; }
.avatar--lg { width: 72px; height: 72px; font-size: 1.35rem; }
.avatar--xl { width: 132px; height: 132px; font-size: 2.6rem; border-width: 4px; }
.avatar--initials {
  font-family: var(--font-display); font-weight: 600; letter-spacing: .02em; color: #fff;
  background: linear-gradient(135deg, hsl(var(--hue) 55% 42%), hsl(calc(var(--hue) + 40) 60% 32%));
}

.player-link { display: inline-flex; align-items: center; gap: .65rem; color: var(--text); text-decoration: none; min-width: 0; }
.player-link:hover .player-link__nick { text-decoration: underline; color: var(--link); }
.player-link__text { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.player-link__nick { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player-link__full { font-size: .82rem; color: var(--text-muted); white-space: nowrap; }

/* --- Stats tables -------------------------------------------------------- */

.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-scroll:focus-visible { outline-offset: -3px; }

.stats-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 1rem; font-variant-numeric: tabular-nums; }
.stats-table th, .stats-table td { padding: .7rem .75rem; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--border); }
.stats-table thead th {
  font-family: var(--font-display); font-weight: 500; font-size: .92rem; letter-spacing: .07em; text-transform: uppercase;
  color: var(--text-muted); background: var(--surface-2); border-bottom: 1px solid var(--border-strong); position: relative;
  vertical-align: bottom;
}
.stats-table thead th[data-sort] { cursor: pointer; user-select: none; }
.stats-table thead th[data-sort]:hover { color: var(--text); }
.stats-table thead th.is-sorted { color: var(--text); }
.stats-table thead th.is-sorted::after { content: " ▾"; font-size: .8em; }
.stats-table thead th.is-sorted.is-asc::after { content: " ▴"; }
.stats-table tbody tr:hover td { background: var(--surface-2); }
.stats-table tbody tr:last-child td { border-bottom: 0; }
.stats-table .col-rank { width: 3.2rem; min-width: 3.2rem; max-width: 3.2rem; text-align: center; font-family: var(--font-display); font-weight: 600; font-size: 1.15rem; color: var(--text-muted); }
.stats-table .col-player, .stats-table .col-left { text-align: left; }
.stats-table .col-player { min-width: 13rem; }
.stats-table .col-key { font-weight: 700; color: var(--text); }
.stats-table .col-strong { font-weight: 600; }
.stats-table td.pos { color: var(--win); }
.stats-table td.neg { color: var(--loss); }
.stats-table .group-start { border-left: 1px solid var(--border); }
.stats-table td { background: var(--surface); }

/* Sticky rank + player columns while scrolling sideways */
.stats-table .sticky-1, .stats-table .sticky-2 { position: sticky; z-index: 1; }
.stats-table .sticky-1 { left: 0; }
.stats-table .sticky-2 { left: 3.2rem; box-shadow: 8px 0 8px -8px rgba(10,28,54,.18); }
.stats-table .sticky-2.no-rank { left: 0; }

.stats-table tr.is-ineligible td { color: var(--text-faint); }
.stats-table tr.is-ineligible .player-link { opacity: .7; }
.stats-table tr.is-ineligible td.pos, .stats-table tr.is-ineligible td.neg { color: var(--text-faint); }
.stats-table tr.rank-1 .col-rank { color: var(--gold-500); }
.stats-table tr.playoff-line td { border-bottom: 2px dashed var(--red-600); }
.stats-table tr.is-total td { background: var(--surface-2); font-weight: 700; border-top: 2px solid var(--border-strong); }
.stats-table tr.is-win td:first-child { box-shadow: inset 4px 0 0 var(--win-strong); }
.stats-table tr.is-loss td:first-child { box-shadow: inset 4px 0 0 var(--loss); }

@media (max-width: 640px) {
  .stats-table { font-size: .95rem; }
  .stats-table th, .stats-table td { padding: .6rem .5rem; }
  .stats-table .col-rank { width: 2.5rem; min-width: 2.5rem; max-width: 2.5rem; font-size: 1rem; padding-left: .25rem; padding-right: .25rem; }
  .stats-table .sticky-2 { left: 2.5rem; }
  .stats-table .col-player { min-width: 0; max-width: 10.5rem; }
  .stats-table .player-link__full { display: none; }
  .stats-table .player-link__nick { white-space: normal; }
  .card__header, .card__body { padding-left: 1rem; padding-right: 1rem; }
}

.table-note { display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; padding: .85rem 1.4rem; font-size: .92rem; color: var(--text-muted); border-top: 1px solid var(--border); background: var(--surface-2); }
.legend-swatch { display: inline-block; width: 22px; height: 0; border-top: 2px dashed var(--red-600); vertical-align: middle; margin-right: .35rem; }

.record-cell { font-weight: 700; padding: .15rem .55rem; border-radius: 7px; display: inline-block; min-width: 3.6rem; text-align: center; }
.record-cell.is-up { background: var(--win-bg); color: var(--win); }
.record-cell.is-down { background: var(--loss-bg); color: var(--loss); }
.record-cell.is-even { background: var(--surface-3); color: var(--text-muted); }

.glossary { font-size: .92rem; color: var(--text-muted); }
.glossary summary { cursor: pointer; font-weight: 600; color: var(--text); padding: .85rem 1.4rem; }
.glossary dl { display: grid; grid-template-columns: max-content 1fr; gap: .3rem 1rem; margin: 0; padding: 0 1.4rem 1rem; }
.glossary dt { font-weight: 700; color: var(--text); font-family: var(--font-display); letter-spacing: .05em; text-transform: uppercase; }
.glossary dd { margin: 0; }

/* --- Badges -------------------------------------------------------------- */

.badge {
  display: inline-flex; align-items: center; gap: .3rem; font-size: .78rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  padding: .22rem .6rem; border-radius: 999px; background: var(--surface-3); color: var(--text-muted); white-space: nowrap;
}
.badge--league { background: rgba(65,182,230,.16); color: #0b6aa2; }
.badge--playoff { background: rgba(242,176,30,.18); color: #9a6600; }
.badge--one { background: rgba(124,92,255,.14); color: #5b3fd6; }
.badge--red { background: rgba(228,0,43,.1); color: var(--red-600); }
.badge--win { background: var(--win-bg); color: var(--win); }
.badge--loss { background: var(--loss-bg); color: var(--loss); }
@media (prefers-color-scheme: dark) {
  .badge--league { color: var(--sky-400); }
  .badge--playoff { color: #f5c75b; }
  .badge--one { color: #b3a1ff; }
  .badge--red { color: #ff7f93; }
}

.wl {
  display: inline-grid; place-items: center; width: 1.9rem; height: 1.9rem; border-radius: 8px; font-family: var(--font-display);
  font-weight: 700; font-size: 1rem;
}
.wl--w { background: var(--win-bg); color: var(--win); }
.wl--l { background: var(--loss-bg); color: var(--loss); }

/* --- Scoreboard / game cards -------------------------------------------- */

.games-list { display: grid; gap: .9rem; }
.game-card {
  display: block; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-sm);
  color: var(--text); text-decoration: none; overflow: hidden; transition: border-color .15s, box-shadow .15s;
}
a.game-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow); text-decoration: none; }
.game-card__meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .75rem; padding: .6rem 1rem; font-size: .88rem; color: var(--text-muted);
  background: var(--surface-2); border-bottom: 1px solid var(--border);
}
.game-card__meta .sep { opacity: .5; }
.game-card__team { display: flex; align-items: center; gap: .9rem; padding: .7rem 1rem; }
.game-card__team + .game-card__team { border-top: 1px dashed var(--border); }
.game-card__players { display: flex; flex-wrap: wrap; gap: .3rem 1rem; flex: 1; min-width: 0; }
.game-card__players .player-link__nick { font-size: 1.02rem; }
.game-card__score { font-family: var(--font-display); font-size: 2rem; font-weight: 600; line-height: 1; min-width: 2.6ch; text-align: right; }
.game-card__team.is-winner .game-card__score { color: var(--text); }
.game-card__team.is-winner .player-link__nick { font-weight: 700; }
.game-card__team.is-loser .game-card__score { color: var(--text-faint); }
.game-card__team.is-loser .player-link__nick { color: var(--text-muted); }
.game-card__win-tag { color: var(--win-strong); font-size: 1rem; width: 1rem; }
.game-card__team.is-loser .game-card__win-tag { visibility: hidden; }

/* Results table (dense list on /games) */
.results-table td { vertical-align: middle; }
.results-table .team-cell { text-align: left; white-space: normal; min-width: 14rem; }
.results-table .team-cell .player-link { display: flex; margin: .2rem 0; }
.results-table .score-cell { font-family: var(--font-display); font-size: 1.6rem; font-weight: 600; text-align: center; width: 3.5rem; }
.results-table .score-cell.is-winner { color: var(--win); }
.results-table .score-cell.is-loser { color: var(--text-faint); }
.results-table .vs-cell { color: var(--text-faint); font-size: .85rem; text-align: center; padding-left: 0; padding-right: 0; }

/* --- Box score ----------------------------------------------------------- */

.scoreboard { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 1.5rem; }
.scoreboard__team { display: flex; flex-direction: column; gap: .7rem; }
.scoreboard__team--right { align-items: flex-end; text-align: right; }
.scoreboard__team--right .player-link { flex-direction: row-reverse; }
.scoreboard__score { font-family: var(--font-display); font-weight: 700; font-size: clamp(3.5rem, 9vw, 6rem); line-height: .9; color: #fff; }
.scoreboard__score.is-loser { color: rgba(255,255,255,.45); }
.scoreboard__divider { display: flex; align-items: center; gap: clamp(.75rem, 3vw, 2rem); }
.scoreboard__dash { font-family: var(--font-display); font-size: 2rem; color: rgba(255,255,255,.35); }
.scoreboard__label { font-family: var(--font-display); text-transform: uppercase; letter-spacing: .14em; font-size: .9rem; color: var(--sky-400); }
.scoreboard__label.is-winner { color: #7ff0a6; }
.scoreboard .player-link__nick { font-size: 1.2rem; }
@media (max-width: 640px) {
  .scoreboard { grid-template-columns: 1fr; text-align: center; }
  .scoreboard__team, .scoreboard__team--right { align-items: center; text-align: center; }
  .scoreboard__team--right .player-link { flex-direction: row; }
  .scoreboard__divider { justify-content: center; order: 3; }
}

.meta-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 1rem 1.5rem; margin: 0; }
.meta-list dt { font-family: var(--font-display); text-transform: uppercase; letter-spacing: .1em; font-size: .82rem; color: var(--text-muted); }
.meta-list dd { margin: .15rem 0 0; font-weight: 600; }

/* --- Leaders ------------------------------------------------------------- */

.leader-list { list-style: none; margin: 0; padding: 0; }
.leader-list li { display: flex; align-items: center; gap: .9rem; padding: .7rem 1.4rem; border-bottom: 1px solid var(--border); }
.leader-list li:last-child { border-bottom: 0; }
.leader-list__rank { font-family: var(--font-display); font-weight: 600; color: var(--text-faint); width: 1.6rem; text-align: center; font-size: 1.1rem; }
.leader-list li:first-child .leader-list__rank { color: var(--gold-500); }
.leader-list__who { flex: 1; min-width: 0; }
.leader-list__sub { font-size: .85rem; color: var(--text-muted); margin-top: .1rem; }
.leader-list__sub a { color: inherit; }
.leader-list__value { font-family: var(--font-display); font-weight: 600; font-size: 1.6rem; line-height: 1; text-align: right; }
.leader-list__value small { display: block; font-family: var(--font-body); font-size: .72rem; color: var(--text-muted); font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }

/* --- Bracket ------------------------------------------------------------- */

.bracket { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(280px, 1fr); gap: 2rem; overflow-x: auto; padding: .25rem .25rem 1rem; }
.bracket__round { display: flex; flex-direction: column; gap: .5rem; }
.bracket__series { flex: 1; display: flex; flex-direction: column; justify-content: space-around; gap: 1.25rem; }
.bracket__round-title { font-family: var(--font-display); text-transform: uppercase; letter-spacing: .12em; color: var(--text-muted); font-size: .9rem; margin-bottom: .25rem; }
.series { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-sm); overflow: hidden; }
.series__name { display: flex; justify-content: space-between; align-items: center; padding: .5rem .9rem; font-size: .82rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); background: var(--surface-2); border-bottom: 1px solid var(--border); }
.series__row { display: flex; align-items: center; gap: .7rem; padding: .65rem .9rem; }
.series__row + .series__row { border-top: 1px solid var(--border); }
.series__seed { font-family: var(--font-display); color: var(--text-faint); width: 1.6rem; font-size: .95rem; }
.series__who { flex: 1; min-width: 0; }
.series__wins { font-family: var(--font-display); font-weight: 600; font-size: 1.6rem; width: 2rem; text-align: right; }
.series__row.is-winner { background: var(--win-bg); }
.series__row.is-winner .series__wins { color: var(--win); }
.series__row.is-loser .series__wins, .series__row.is-loser .player-link__nick { color: var(--text-faint); }
.series__tbd { color: var(--text-faint); font-style: italic; }
.champion {
  display: flex; align-items: center; gap: 1rem; padding: 1rem 1.25rem; border-radius: 14px;
  background: linear-gradient(135deg, rgba(242,176,30,.18), rgba(242,176,30,.04)); border: 1px solid rgba(242,176,30,.45);
}
.champion__title { font-family: var(--font-display); text-transform: uppercase; letter-spacing: .1em; color: #a06d00; font-size: .9rem; }
@media (prefers-color-scheme: dark) { .champion__title { color: var(--gold-500); } }
.champion .icon { width: 2.2rem; height: 2.2rem; color: var(--gold-500); }

/* --- Player directory & profile ----------------------------------------- */

.player-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 1rem; }
.player-card {
  display: flex; align-items: center; gap: 1rem; padding: 1rem 1.1rem; background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; text-decoration: none; color: var(--text); box-shadow: var(--shadow-sm); transition: border-color .15s, box-shadow .15s;
}
.player-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow); text-decoration: none; }
.player-card__nick { font-weight: 700; font-size: 1.1rem; line-height: 1.2; }
.player-card__name { color: var(--text-muted); font-size: .9rem; }
/* Records stacked one per line: the star line is the league record, the die is all games */
.player-card__records { display: grid; gap: .1rem; margin-top: .3rem; }
.player-card__record { display: flex; align-items: center; gap: .45rem; font-size: .9rem; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.player-card__record .icon { width: 1rem; height: 1rem; vertical-align: 0; }
.player-card__all { color: var(--text-faint); }
.player-legend { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem 1.4rem; margin: 0; font-size: .92rem; }
.player-legend > span { display: inline-flex; align-items: center; gap: .4rem; }
.players-heading { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.players-heading .status-star { width: .85em; height: .85em; }

/* League status stars: league players get the Chicago flag's red star; league
   approved get an open star in the flag's light blue (close, but not quite) */
.status-star--league { color: var(--red-600); }
.status-star--approved { color: #1f93c1; }
.badge--approved { background: transparent; color: #0f6f9e; box-shadow: inset 0 0 0 1.5px rgba(31,147,193,.55); }
@media (prefers-color-scheme: dark) {
  .status-star--approved { color: var(--sky-400); }
  .badge--approved { color: var(--sky-400); }
}

.profile { display: flex; gap: clamp(1.25rem, 3vw, 2.25rem); align-items: center; flex-wrap: wrap; }
.profile__main { flex: 1; min-width: 260px; }
.profile__name { color: #c4d5ea; font-size: 1.2rem; margin: -.1rem 0 .7rem; }
.profile__badges { display: flex; flex-wrap: wrap; gap: .45rem; margin-bottom: 1rem; }
.profile__badges .badge { background: rgba(255,255,255,.1); color: #dbe8f6; }
.profile__badges .badge--red { background: rgba(228,0,43,.25); color: #fff; }
.profile__badges .badge--red .status-star { color: #ff4d6a; }
.profile__badges .badge--approved { background: rgba(65,182,230,.1); color: #fff; box-shadow: inset 0 0 0 1.5px rgba(108,199,238,.7); }
.profile__badges .badge--approved .status-star { color: var(--sky-400); }
.profile__records { display: flex; flex-wrap: wrap; gap: .75rem; }
.profile .avatar--xl { box-shadow: 0 10px 30px rgba(0,0,0,.35); border-color: rgba(255,255,255,.9); }
.bio { white-space: pre-line; }

/* --- Forms --------------------------------------------------------------- */

.form-grid { display: grid; gap: 1.1rem; }
.form-grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 640px) { .form-grid--2 { grid-template-columns: 1fr; } }
.field { display: grid; gap: .4rem; align-content: start; }
.field > label, .field__label { font-weight: 600; font-size: .98rem; }
.field__hint { font-size: .88rem; color: var(--text-muted); }
.input, .select, .textarea {
  width: 100%; font: 400 1.0625rem var(--font-body); color: var(--text); background: var(--surface); border: 1.5px solid var(--border-strong);
  border-radius: 11px; padding: .7rem .85rem; min-height: 50px; transition: border-color .15s, box-shadow .15s;
}
.textarea { min-height: 110px; resize: vertical; line-height: 1.5; }
.select {
  appearance: none; -webkit-appearance: none; padding-right: 2.4rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9' viewBox='0 0 14 9'%3E%3Cpath d='M1 1l6 6 6-6' stroke='%2356677e' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right .9rem center;
}
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--sky-500); box-shadow: 0 0 0 4px rgba(65,182,230,.22); }
.input--error { border-color: var(--loss); }
.checkbox { display: flex; align-items: center; gap: .65rem; font-weight: 600; cursor: pointer; min-height: 44px; }
.checkbox input { width: 22px; height: 22px; accent-color: var(--red-600); flex: none; }
.form-actions { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; }

.alert { border-radius: 12px; padding: .9rem 1.1rem; border: 1px solid; display: flex; gap: .75rem; align-items: flex-start; }
.alert .icon { margin-top: .15rem; }
.alert ul { margin: .3rem 0 0; padding-left: 1.2rem; }
.alert--error { background: var(--loss-bg); border-color: rgba(194,29,58,.35); color: var(--loss); }
.alert--error strong, .alert--error li { color: var(--text); }
.alert--success { background: var(--win-bg); border-color: rgba(21,122,58,.3); }
.alert--success .icon { color: var(--win); }
.alert--info { background: var(--sky-100); border-color: var(--sky-200); color: var(--text); }
.alert--warning { background: rgba(242,176,30,.13); border-color: rgba(242,176,30,.5); }
.alert--warning .icon { color: #b07800; }
@media (prefers-color-scheme: dark) { .alert--info { background: rgba(65,182,230,.12); border-color: rgba(65,182,230,.3); } }

.flashes { display: grid; gap: .75rem; margin: 1.25rem 0 0; }
.flashes .alert { box-shadow: var(--shadow-sm); }

.auth-card { max-width: 560px; margin: 0 auto; }

/* --- Game entry form ----------------------------------------------------- */

.entry-teams { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.5rem; }
@media (max-width: 920px) { .entry-teams { grid-template-columns: 1fr; } }
.team-panel { border: 2px solid var(--border); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.team-panel__header { display: flex; align-items: center; justify-content: space-between; padding: .85rem 1.2rem; background: var(--navy-800); color: #fff; }
.team-panel--2 .team-panel__header { background: var(--navy-700); }
.team-panel__title { margin: 0; font-size: 1.4rem; color: #fff; }
.team-panel__score { text-align: right; line-height: 1; }
.team-panel__score-value { font-family: var(--font-display); font-weight: 700; font-size: 3rem; display: block; }
.team-panel__score-label { font-size: .75rem; text-transform: uppercase; letter-spacing: .12em; color: #a9bdd6; font-weight: 600; }
/* Live game setup: each team in its scoreboard color (team 1 blue, team 2 red) */
.team-panel--live.team-panel--1 { border-color: rgba(65,182,230,.6); }
.team-panel--live.team-panel--1 .team-panel__header { background: linear-gradient(90deg, #1f93c1, var(--sky-500)); }
.team-panel--live.team-panel--2 { border-color: rgba(228,0,43,.45); }
.team-panel--live.team-panel--2 .team-panel__header { background: linear-gradient(90deg, var(--red-700), var(--red-600)); }
.team-panel__side { font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: rgba(255,255,255,.85); }
.team-panel.is-winning { border-color: var(--win-strong); }
.team-panel.is-winning .team-panel__score-value { color: #7ff0a6; }

.player-entry { padding: 1.1rem 1.2rem; display: grid; gap: .85rem; }
.player-entry + .player-entry { border-top: 1px solid var(--border); }
.player-entry__label { font-family: var(--font-display); text-transform: uppercase; letter-spacing: .1em; font-size: .85rem; color: var(--text-muted); }
.stat-inputs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .75rem; }
.stepper { display: grid; gap: .3rem; }
.stepper__label { font-size: .85rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); text-align: center; }
.stepper__control { display: grid; grid-template-columns: 44px 1fr 44px; border: 1.5px solid var(--border-strong); border-radius: 11px; overflow: hidden; background: var(--surface); }
.stepper__control:focus-within { border-color: var(--sky-500); box-shadow: 0 0 0 4px rgba(65,182,230,.22); }
.stepper button {
  border: 0; background: var(--surface-2); color: var(--text); font: 600 1.4rem var(--font-body); cursor: pointer; min-height: 52px;
  touch-action: manipulation;
}
.stepper button:hover { background: var(--surface-3); }
.stepper input {
  width: 100%; border: 0; text-align: center; font: 600 1.35rem var(--font-display); color: var(--text); background: transparent;
  min-width: 0; -moz-appearance: textfield; appearance: textfield;
}
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.stepper input:focus { outline: none; }
.player-entry.is-empty .stat-inputs { opacity: .45; }
@media (max-width: 560px) {
  .stat-inputs { grid-template-columns: 1fr; gap: .5rem; }
  .stepper { grid-template-columns: 1fr minmax(150px, 190px); align-items: center; gap: .75rem; }
  .stepper__label { text-align: left; font-size: .95rem; }
  .stepper__control { grid-template-columns: 52px 1fr 52px; }
}

.team-panel__footer { padding: .75rem 1.2rem; background: var(--surface-2); border-top: 1px solid var(--border); font-size: .92rem; color: var(--text-muted); display: flex; gap: 1.25rem; flex-wrap: wrap; }
.team-panel__footer strong { color: var(--text); }

.checks { list-style: none; margin: 0; padding: 0; display: grid; gap: .55rem; }
.checks li { display: flex; gap: .65rem; align-items: flex-start; }
.checks .icon { margin-top: .2rem; }
.checks .is-ok { color: var(--text-muted); }
.checks .is-ok .icon { color: var(--win-strong); }
.checks .is-bad { color: var(--text); font-weight: 600; }
.checks .is-bad .icon { color: var(--loss); }
.checks .is-pending { color: var(--text-faint); }

.submit-bar { position: sticky; bottom: 0; z-index: 5; background: var(--surface); border-top: 1px solid var(--border); box-shadow: 0 -8px 24px rgba(10,28,54,.08); }
.submit-bar__inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding-top: .9rem; padding-bottom: .9rem; }
@media (max-width: 640px) {
  .submit-bar__inner { gap: .5rem; padding-top: .6rem; padding-bottom: .6rem; }
  .submit-bar__inner > div:first-child { width: 100%; }
  .submit-bar__score { font-size: 1.15rem; white-space: nowrap; }
  .submit-bar__status { font-size: .85rem; }
  .submit-bar .form-actions { width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
  .submit-bar .form-actions .btn--outline { display: none; }
  .submit-bar .btn--lg { min-height: 48px; font-size: 1rem; padding: .5rem .75rem; }
}
.submit-bar__score { font-family: var(--font-display); font-size: 1.5rem; font-weight: 600; text-transform: uppercase; }
.submit-bar__status { font-size: .95rem; }

/* --- Rules / prose ------------------------------------------------------- */

.prose { max-width: 50rem; font-size: 1.08rem; }
.prose h2 { margin-top: 2rem; padding-top: 1.25rem; border-top: 1px solid var(--border); font-size: 1.55rem; display: flex; gap: .75rem; align-items: baseline; }
.prose h2:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.prose h2 .num-badge { font-size: 1rem; background: var(--red-600); color: #fff; border-radius: 8px; padding: .1rem .5rem; }
.prose h3 { font-size: 1.15rem; margin-top: 1.5rem; }
.prose ol, .prose ul { padding-left: 1.4rem; margin: 0 0 1em; }
.prose li { margin: .35rem 0; }
.prose .callout { background: var(--sky-100); border-left: 4px solid var(--sky-500); padding: .9rem 1.1rem; border-radius: 0 10px 10px 0; margin: 1rem 0; }
@media (prefers-color-scheme: dark) { .prose .callout { background: rgba(65,182,230,.1); } }
.rules-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 2rem; align-items: start; }
.rules-toc { position: sticky; top: 1.25rem; }
.rules-toc a { display: block; padding: .4rem .75rem; border-radius: 8px; color: var(--text-muted); text-decoration: none; font-weight: 500; }
.rules-toc a:hover { background: var(--surface-2); color: var(--text); }
@media (max-width: 900px) { .rules-layout { grid-template-columns: 1fr; } .rules-toc { position: static; } }
.diagram { max-width: 360px; margin: 1rem auto; display: block; }

/* --- Pagination ---------------------------------------------------------- */

.pagination { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; justify-content: center; padding: 1rem; }
.pagination a, .pagination span {
  min-width: 44px; height: 44px; display: inline-grid; place-items: center; padding: 0 .75rem; border-radius: 10px;
  text-decoration: none; font-weight: 600; border: 1px solid var(--border); color: var(--text); background: var(--surface);
}
.pagination .is-current { background: var(--navy-800); color: #fff; border-color: var(--navy-800); }
.pagination .is-gap { border: 0; background: none; min-width: 1.5rem; }

/* --- Filters bar --------------------------------------------------------- */

.filters { display: flex; flex-wrap: wrap; gap: .75rem; align-items: flex-end; }
.filters .field { min-width: 200px; flex: 1; }
.filters .select { min-height: 46px; }

/* --- Event list ---------------------------------------------------------- */

.event-list { list-style: none; margin: 0; padding: 0; }
.event-list li { border-bottom: 1px solid var(--border); }
.event-list li:last-child { border-bottom: 0; }
.event-list a { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .85rem 1.4rem; text-decoration: none; color: var(--text); }
.event-list a:hover { background: var(--surface-2); text-decoration: none; }
.event-list__name { font-weight: 600; }
.event-list__date { font-size: .9rem; color: var(--text-muted); }
.event-list__count { font-family: var(--font-display); font-size: 1.1rem; color: var(--text-muted); white-space: nowrap; }

/* --- Offline banner, footer, misc --------------------------------------- */

.offline-banner { background: #fff4d6; color: #5c4300; border-bottom: 1px solid #f0d58a; padding: .7rem 0; font-weight: 500; }
@media (prefers-color-scheme: dark) { .offline-banner { background: #3a2e0c; color: #ffe08a; border-color: #5e4a12; } }

.site-footer { background: var(--navy-950); color: #9fb3cc; padding: 2.5rem 0; margin-top: 2rem; font-size: .95rem; }
.site-footer__inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1.5rem; align-items: center; }
.site-footer a { color: #d4e3f5; text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }
.site-footer__links { display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; }
.site-footer__brand { font-family: var(--font-display); text-transform: uppercase; letter-spacing: .14em; color: #fff; font-size: 1.05rem; }

.empty { text-align: center; padding: 2.5rem 1.5rem; color: var(--text-muted); }
.error-code { font-family: var(--font-display); font-size: clamp(4rem, 12vw, 7rem); line-height: 1; color: var(--red-600); }

hr.divider { border: 0; border-top: 1px solid var(--border); margin: 1.5rem 0; }

@media print {
  .site-header, .flag-stripe, .site-footer, .submit-bar, .nav-toggle { display: none !important; }
  .hero { background: none; color: #000; padding: 0; }
  .page { margin-top: 0; }
  .card { box-shadow: none; }
}

.subhead { padding: .7rem 1.4rem; background: var(--surface-2); border-bottom: 1px solid var(--border); font-size: .95rem; }
.card__more { padding: .55rem 1.4rem .8rem; text-align: right; font-size: .92rem; font-weight: 600; border-bottom: 1px solid var(--border); }
.card__more:last-child { border-bottom: 0; }
.card__more a { text-decoration: none; }
.card__more a:hover { text-decoration: underline; }
table.is-resorted tr.playoff-line td { border-bottom: 1px solid var(--border); }

.boxscore .boxscore__team { vertical-align: middle; width: 6rem; }
.boxscore .boxscore__team.is-w { box-shadow: inset 4px 0 0 var(--win-strong); }
.boxscore .boxscore__team.is-l { box-shadow: inset 4px 0 0 var(--loss); }
.boxscore .boxscore__score { font-family: var(--font-display); font-size: 1.6rem; margin-left: .5rem; vertical-align: middle; }
.boxscore tr.team-2 td { border-top: 0; }
.boxscore tbody tr.team-1 + tr.team-2 td { border-top: 2px solid var(--border-strong); }

/* --- Game form: player picker with face, live rating, admin override ---- */

.player-pick { display: flex; align-items: center; gap: .85rem; }
.player-pick .select { flex: 1; min-width: 0; }
.player-pick__face { flex: none; display: inline-flex; }
.avatar--empty { color: var(--text-faint); background: var(--surface-3); }
.avatar--empty .icon { width: 45%; height: 45%; }

.rating-meter { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: .85rem; padding-top: .15rem; }
.rating-meter__label { font-size: .85rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); }
.rating-meter__track { height: 12px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.rating-meter__fill {
  display: block; height: 100%; width: 0; border-radius: 999px; transition: width .2s ease, background-color .2s ease;
  background: hsl(var(--meter-hue, 0) 70% 45%);
}
.rating-meter__value { font-family: var(--font-display); font-weight: 600; font-size: 1.5rem; min-width: 4.6rem; text-align: right; font-variant-numeric: tabular-nums; }
.rating-meter.is-perfect .rating-meter__value { color: var(--win-strong); }
.rating-meter.is-perfect .rating-meter__fill { box-shadow: 0 0 8px hsla(120, 75%, 45%, .7); }
.rating-meter.is-zero .rating-meter__value { color: var(--loss); }
.rating-meter__value { display: inline-flex; align-items: center; justify-content: flex-end; gap: .35rem; }
.rating-meter__icon { width: 24px; height: 24px; display: inline-grid; flex: none; }
.rating-meter__icon svg { width: 100%; height: 100%; }
.rating-meter.is-perfect .rating-meter__icon { color: hsl(120 70% 40%); }
.rating-meter.is-zero .rating-meter__icon { color: var(--loss); }
.player-entry.is-empty .rating-meter { opacity: .45; }

/* Player page events: date under the event name; a trophy for first place */
.event-cell__date { font-size: .82rem; color: var(--text-muted); }
.finish { white-space: nowrap; }
.finish .icon { color: var(--gold-500); margin-right: .3rem; }
.finish--1 strong { color: #9a6600; }
.finish__format { font-size: .72rem; font-weight: 700; letter-spacing: .06em; color: var(--text-faint); margin-right: .35rem; }
@media (prefers-color-scheme: dark) { .finish--1 strong { color: var(--gold-500); } }

/* Standings: average rating with a red (0) to green (158.3) bar under it */
.rating-cell { display: inline-grid; justify-items: end; gap: .3rem; min-width: 4.5rem; vertical-align: middle; }
.rating-cell__value { display: inline-flex; align-items: center; gap: .3rem; }
.rating-cell__icon { display: inline-grid; width: 1.15em; height: 1.15em; }
.rating-cell__icon svg { width: 100%; height: 100%; }
.rating-cell__bar { width: 100%; height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.rating-cell__fill { display: block; height: 100%; border-radius: inherit; background: hsl(var(--meter-hue, 0) 70% 45%); }
.rating-cell.is-perfect .rating-cell__icon { color: hsl(120 70% 40%); }
.rating-cell.is-perfect .rating-cell__fill { box-shadow: 0 0 6px hsla(120, 75%, 45%, .6); }
.rating-cell.is-zero .rating-cell__icon { color: var(--loss); }
@media (prefers-color-scheme: dark) {
  .rating-cell__fill { background: hsl(var(--meter-hue, 0) 70% 50%); }
}

.override { border: 2px solid rgba(242,176,30,.6); background: rgba(242,176,30,.1); border-radius: 12px; padding: .9rem 1.1rem; }
.override__title { display: flex; align-items: center; gap: .5rem; font-family: var(--font-display); text-transform: uppercase; letter-spacing: .08em; font-size: 1rem; color: #9a6600; }
@media (prefers-color-scheme: dark) { .override__title { color: var(--gold-500); } }
.override__hint { margin: .25rem 0 0; font-size: .9rem; color: var(--text-muted); }
.override:has(input:checked) { border-color: var(--gold-500); background: rgba(242,176,30,.2); }

/* --- Table & cups icons ---------------------------------------------------- */

/* Square, transparent icons, a little bigger than the text beside them */
.setup { display: inline-flex; flex-wrap: wrap; align-items: center; gap: .3rem .9rem; vertical-align: middle; }
.setup__item { display: inline-flex; flex-shrink: 0; align-items: center; gap: .45rem; white-space: nowrap; }
.setup--icons { gap: .4rem; }
.setup--stack { flex-direction: column; align-items: flex-start; gap: .35rem; }
.setup-icon { flex: none; width: 1.6em; height: 1.6em; }
/* Picker: the chosen type's picture in a tile beside the list */
.setup-pick { display: flex; align-items: stretch; gap: .6rem; }
.setup-pick .select { flex: 1; min-width: 0; }
.setup-pick__icon { flex: none; width: 3.25rem; display: grid; place-items: center; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.setup-pick__icon .setup-icon { width: 2.1rem; height: 2.1rem; }

/* --- Events page: featured events with their games ---------------------- */

.event-card__header {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap;
  padding: 1.25rem 1.4rem; border-bottom: 1px solid var(--border); box-shadow: inset 5px 0 0 var(--red-600);
}
.event-card__kicker { font-family: var(--font-display); text-transform: uppercase; letter-spacing: .12em; font-size: .85rem; color: var(--text-muted); }
.event-card__name { font-size: clamp(1.5rem, 2.6vw, 2.1rem); margin: .1rem 0 0; }
.event-card__name a { color: inherit; text-decoration: none; }
.event-card__name a:hover { color: var(--link); }
.event-card__chips { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .7rem; }
.home-events > * + * { margin-top: 1rem; }
/* With no live games the heading is the first thing on the page, sitting on the
   bottom of the dark hero (the page overlaps it), so it goes white like the hero text */
.page > .home-events:first-child .section-title h2,
.page > [hidden]:first-child + .home-events .section-title h2 { color: #fff; }
/* Under the "Latest Event" heading the event name steps down a size so the heading leads */
.home-events .event-card__name { font-size: clamp(1.2rem, 1.7vw, 1.45rem); }
.home-events__all { display: flex; justify-content: center; }
.chip {
  display: inline-flex; align-items: center; gap: .4rem; padding: .3rem .8rem; border-radius: 999px; font-size: .92rem; font-weight: 600;
  background: var(--surface-2); border: 1px solid var(--border); white-space: nowrap;
}
.chip .icon { color: var(--text-muted); }
.chip--gold { background: rgba(242,176,30,.13); border-color: rgba(242,176,30,.45); }
.chip--gold .icon { color: var(--gold-500); }

/* The games hang off a timeline line so it's clear they belong to the event */
.event-games { list-style: none; margin: 0; padding: .6rem 1.4rem 1rem; position: relative; }
.event-games::before {
  content: ""; position: absolute; left: calc(1.4rem + .5rem + 1.15rem - 1px); top: 1.1rem; bottom: 1.6rem; width: 2px; background: var(--border-strong);
}
.event-game {
  display: grid; align-items: center; gap: .4rem .85rem; padding: .55rem .5rem; border-radius: 10px; color: var(--text); text-decoration: none;
  grid-template-columns: 2.3rem minmax(0, 1fr) 2.4rem .8rem 2.4rem minmax(0, 1fr) auto;
  grid-template-areas: "num t1 s1 dash s2 t2 meta";
}
.event-game:hover { background: var(--surface-2); text-decoration: none; }
.event-game__num {
  grid-area: num; position: relative; z-index: 1; width: 2.3rem; height: 2.3rem; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface); border: 2px solid var(--border-strong); font-family: var(--font-display); font-size: .85rem; color: var(--text-muted);
}
.event-game__team { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem 1rem; min-width: 0; }
.event-game__team--1 { grid-area: t1; justify-content: flex-end; }
.event-game__team--2 { grid-area: t2; }
.event-game__score { font-family: var(--font-display); font-size: 1.6rem; font-weight: 600; text-align: center; line-height: 1; }
.event-game__score--1 { grid-area: s1; }
.event-game__score--2 { grid-area: s2; }
.event-game__dash { grid-area: dash; text-align: center; color: var(--text-faint); }
.event-game__meta { grid-area: meta; display: flex; align-items: center; gap: .5rem; justify-content: flex-end; }
.event-game__chevron { color: var(--text-faint); }
.event-game .is-winner { color: var(--text); }
.event-game .is-winner .face__nick { font-weight: 700; }
.event-game__score.is-winner { color: var(--win); }
.event-game .is-loser { color: var(--text-muted); }
.event-game__score.is-loser { color: var(--text-faint); }
.face { display: inline-flex; align-items: center; gap: .45rem; white-space: nowrap; font-weight: 500; }
.face .avatar { flex: none; }

@media (max-width: 760px) {
  .event-games { padding-left: 1rem; padding-right: 1rem; }
  .event-games::before { left: calc(1rem + .5rem + 1.15rem - 1px); }
  .event-game {
    grid-template-columns: 2.3rem minmax(0, 1fr) 2.4rem;
    grid-template-areas: "num t1 s1" "num t2 s2" "num meta meta";
  }
  .event-game__team--1 { justify-content: flex-start; }
  .event-game__team { display: block; line-height: 1.3; }
  .event-game__team .avatar { display: none; }
  .event-game__team .face { display: inline; white-space: normal; }
  .event-game__team .face + .face::before { content: " & "; font-weight: 400; color: var(--text-faint); }
  .event-game__score { font-size: 1.4rem; }
  .event-game__dash { display: none; }
  .event-game__meta { justify-content: flex-start; }
  .event-game__chevron { display: none; }
  .event-card__header { padding: 1rem; }
}

/* Header: live indicator + Add Game menu */
.nav-live-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--red-600); margin-left: .25rem; vertical-align: .1em; animation: nav-live 1.6s infinite; }
@keyframes nav-live { 0% { box-shadow: 0 0 0 0 rgba(228,0,43,.6); } 70% { box-shadow: 0 0 0 7px rgba(228,0,43,0); } 100% { box-shadow: 0 0 0 0 rgba(228,0,43,0); } }
.add-menu > summary.btn { border-radius: 11px; padding: .6rem 1.15rem; background: var(--red-600); color: #fff; }
.add-menu > summary.btn:hover { background: var(--red-700); }
.add-menu .user-menu__panel { min-width: 280px; }
.add-menu .user-menu__panel a { align-items: flex-start; line-height: 1.3; }
.add-menu .user-menu__panel .icon { margin-top: .15rem; color: var(--red-600); }
