/*!
 * Dr. Moon Pie's Stats Index — shared theme (cfb-stats.com + cbk-stats.com).
 *
 * Layered over ./liquid-glass.css. The file is byte-identical in both apps:
 * the sport is picked by <html data-sport="cfb|cbk">, the appearance by
 * <html data-theme="light|dark"> (set from the system setting before first
 * paint by the inline boot script in each page's <head>; ./ui.js keeps it in
 * sync if the system appearance changes). There is deliberately no in-app
 * appearance switch — the system setting decides, as on Apple platforms.
 *
 * Layer discipline (Apple HIG, Materials / Liquid Glass):
 *   functional layer  nav bar, tab bar, toolbar, sheets, menus → liquid glass
 *   content layer     cards, tables, panels → a translucent standard material
 *                     (no refraction, no backdrop-filter: the only thing
 *                     behind them is the already-soft ambient mesh)
 *
 * Pages keep their legacy token names (--layer0..5, --offWhiteText, ...);
 * they are re-pointed here at semantic, theme-aware values so every page
 * picks up both appearances without rewriting its own rules.
 *
 * Contrast (WCAG, composited over the brightest point of the mesh):
 *   label 15:1+, label-2 >= 4.7:1, label-3 >= 4.3:1 (muted captions only),
 *   accent text >= 5.1:1 on cards and tiles, white on accent fill >= 5:1.
 */

/* ─────────────────────────────────────────────────────────
   Theme-independent tokens
   ───────────────────────────────────────────────────────── */
:root {
  --font-text: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;

  --radius-xs: 8px;
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --radius-full: 9999px;

  --bar-h: 52px;          /* top nav bar height */
  --control-h: 36px;      /* desktop control height (HIG desktop default 28pt min 20pt) */
  --tabbar-h: 62px;

  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --dur: 180ms;

  font-family: var(--font-text);
}

/* ─────────────────────────────────────────────────────────
   LIGHT (default)
   ───────────────────────────────────────────────────────── */
:root,
html[data-theme='light'] {
  --bg: #eef0f6;
  --label: #1d1d1f;
  --label-2: rgba(60, 60, 67, 0.82);
  --label-3: rgba(60, 60, 67, 0.76);
  --separator: rgba(60, 60, 67, 0.18);
  --fill-1: rgba(118, 118, 128, 0.10);
  --fill-2: rgba(118, 118, 128, 0.16);
  --fill-3: rgba(118, 118, 128, 0.24);

  /* Content material: cards, tables, panels. */
  --material: rgba(255, 255, 255, 0.70);
  --material-strong: rgba(255, 255, 255, 0.86);
  --material-border: rgba(30, 33, 45, 0.08);
  --material-rim: rgba(255, 255, 255, 0.9);
  --material-shadow: 0 1px 2px rgba(30, 33, 45, 0.05), 0 8px 24px rgba(30, 33, 45, 0.07);
  --material-shadow-hover: 0 2px 4px rgba(30, 33, 45, 0.06), 0 16px 36px rgba(30, 33, 45, 0.12);
  /* Outline that keeps card titles readable over the team-logo art. */
  --title-halo: rgba(255, 255, 255, 0.92);

  --green: #1f7a35;
  --green-fill: #34c759;
  --red: #d70015;
  --red-fill: #ff3b30;
  --blue: #0040dd;
  --blue-fill: #007aff;
  --gold: #a05a00;
  --gold-fill: #ff9f0a;
  --live: #d70015;

  --focus-ring: 0 0 0 3px color-mix(in srgb, var(--accent-fill) 45%, transparent);
}

/* ─────────────────────────────────────────────────────────
   DARK
   ───────────────────────────────────────────────────────── */
html[data-theme='dark'] {
  --bg: #08080f;
  --label: #f5f5f7;
  --label-2: rgba(235, 235, 245, 0.74);
  --label-3: rgba(235, 235, 245, 0.62);
  --separator: rgba(235, 235, 245, 0.12);
  --fill-1: rgba(120, 120, 128, 0.20);
  --fill-2: rgba(120, 120, 128, 0.30);
  --fill-3: rgba(120, 120, 128, 0.40);

  --material: rgba(28, 28, 38, 0.74);
  --material-strong: rgba(28, 28, 38, 0.90);
  --material-border: rgba(255, 255, 255, 0.07);
  --material-rim: rgba(255, 255, 255, 0.10);
  --material-shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 10px 28px rgba(0, 0, 0, 0.28);
  --material-shadow-hover: 0 2px 4px rgba(0, 0, 0, 0.35), 0 18px 40px rgba(0, 0, 0, 0.4);
  --title-halo: rgba(20, 20, 28, 0.92);

  --green: #30d158;
  --green-fill: #30d158;
  --red: #ff453a;
  --red-fill: #ff453a;
  --blue: #409cff;
  --blue-fill: #0a84ff;
  --gold: #ffb340;
  --gold-fill: #ff9f0a;
  --live: #ff453a;
}

/* ─────────────────────────────────────────────────────────
   Sport accents + ambient mesh. The glass is colorless; the sport's color
   arrives from behind it. CFB: a moonlit night over turf — Dr. Moon Pie's
   gold moon glow top-left, violet sky, a low field-green wash. CBK: the
   same night sky over a hardwood glow — gold moon, ember orange, amber.
   (The mesh variable names come from liquid-glass.css; only hues change.)
   ───────────────────────────────────────────────────────── */
html[data-sport='cfb'] {
  --accent: #4b48c6;          /* text/links on light */
  --accent-fill: #5856d6;     /* prominent button / selection, white label 5.6:1 */
  --accent-soft: rgba(88, 86, 214, 0.14);
}
html[data-sport='cfb'][data-theme='dark'] {
  --accent: #a9a7ff;
  --accent-fill: #5e5ce6;     /* white label 5.1:1 */
  --accent-soft: rgba(94, 92, 230, 0.26);
}
html[data-sport='cbk'] {
  --accent: #a3360f;
  --accent-fill: #c2410c;     /* white label 5.2:1 */
  --accent-soft: rgba(194, 65, 12, 0.13);
}
html[data-sport='cbk'][data-theme='dark'] {
  --accent: #ff9f70;
  --accent-fill: #c2410c;
  --accent-soft: rgba(255, 122, 61, 0.22);
}

html[data-sport='cfb'],
html[data-sport='cfb'][data-theme='light'] {
  --glass-page-bg: var(--bg);
  --glass-page-fg: var(--label);
  --glass-mesh-violet: rgba(124, 108, 255, 0.20);   /* night sky */
  --glass-mesh-pink: rgba(242, 181, 68, 0.22);      /* the moon */
  --glass-mesh-cyan: rgba(52, 170, 100, 0.13);      /* the turf */
  --glass-mesh-corner-top: rgba(242, 181, 68, 0.10);
  --glass-mesh-corner-bottom: rgba(88, 86, 214, 0.12);
}
html[data-sport='cfb'][data-theme='dark'] {
  --glass-mesh-violet: rgba(118, 100, 255, 0.36);
  --glass-mesh-pink: rgba(242, 181, 68, 0.20);
  --glass-mesh-cyan: rgba(34, 160, 95, 0.24);
  --glass-mesh-corner-top: rgba(120, 104, 255, 0.14);
  --glass-mesh-corner-bottom: rgba(79, 70, 229, 0.34);
}
html[data-sport='cbk'],
html[data-sport='cbk'][data-theme='light'] {
  --glass-page-bg: var(--bg);
  --glass-page-fg: var(--label);
  --glass-mesh-violet: rgba(124, 108, 255, 0.16);   /* night sky */
  --glass-mesh-pink: rgba(255, 122, 61, 0.20);      /* ember */
  --glass-mesh-cyan: rgba(222, 160, 80, 0.20);      /* hardwood */
  --glass-mesh-corner-top: rgba(242, 181, 68, 0.12);
  --glass-mesh-corner-bottom: rgba(194, 65, 12, 0.10);
}
html[data-sport='cbk'][data-theme='dark'] {
  --glass-mesh-violet: rgba(110, 96, 255, 0.30);
  --glass-mesh-pink: rgba(255, 140, 60, 0.22);
  --glass-mesh-cyan: rgba(230, 110, 40, 0.24);
  --glass-mesh-corner-top: rgba(120, 104, 255, 0.12);
  --glass-mesh-corner-bottom: rgba(194, 65, 12, 0.32);
}

/* Spread the glows across the page instead of the skill's centered cluster:
   moon behind the brand (top-left), sky top-right, field/court low. */
.liquid-glass-backdrop::before {
  background:
    radial-gradient(max(36rem, 52vmax) max(30rem, 40vmax) at 4% 0%, var(--glass-mesh-pink), transparent 64%),
    radial-gradient(max(44rem, 60vmax) max(34rem, 46vmax) at 88% 22%, var(--glass-mesh-violet), transparent 64%),
    radial-gradient(max(52rem, 70vmax) max(30rem, 40vmax) at 26% 100%, var(--glass-mesh-cyan), transparent 66%),
    radial-gradient(max(60rem, 80vmax) max(40rem, 50vmax) at 50% -24%, var(--glass-mesh-corner-top), transparent 62%),
    radial-gradient(max(50rem, 64vmax) max(36rem, 48vmax) at 104% 106%, var(--glass-mesh-corner-bottom), transparent 62%);
}

/* ─────────────────────────────────────────────────────────
   Legacy page tokens → semantic tokens. Every page used the same names, so
   re-pointing them here themes all of their existing rules at once.
     --layer0        page                --layer1  content material
     --layer2..5     fills, weakest → strongest (they stack inside surfaces)
     --offWhiteText  label               --accent-color    secondary label
     --secondary-color accent text       --primary-color   accent fill
   ───────────────────────────────────────────────────────── */
:root {
  --layer0: var(--bg);
  --layer1: var(--material);
  --layer2: var(--fill-1);
  --layer3: var(--fill-2);
  --layer4: var(--fill-2);
  --layer5: var(--fill-3);
  --offWhiteText: var(--label);
  --text-color: var(--label);
  --accent-color: var(--label-2);
  --muted: var(--label-3);
  --secondary-color: var(--accent);
  --primary-color: var(--accent-fill);
  --shadow-color: var(--separator);
  --hit-green: var(--green-fill);
  --winner-blue: var(--blue-fill);
  --live-red: var(--live);
  --up: var(--green);
  --down: var(--red);
  --threshold0: var(--red-fill);
  --threshold1: var(--red-fill);
  --threshold5: var(--green-fill);
  --outlineIndigo: var(--accent-soft);
  --public-bg: var(--fill-2);
  --sharp: #f2b544;
}

/* ─────────────────────────────────────────────────────────
   Base
   ───────────────────────────────────────────────────────── */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  font-family: var(--font-text);
  background-color: var(--bg);
  color: var(--label);
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  padding: 12px 20px 24px;
  min-height: 100vh;
}

button,
input,
select,
textarea {
  font-family: inherit;
}

a {
  color: var(--accent);
}

:focus-visible {
  outline: 2px solid var(--accent-fill);
  outline-offset: 2px;
}

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

/* ─────────────────────────────────────────────────────────
   Scroll edge: content softens as it slides under the bar instead of
   colliding with it (HIG Layout › Visual hierarchy). ui.js inserts it.
   ───────────────────────────────────────────────────────── */
.scroll-edge {
  position: fixed;
  inset: 0 0 auto 0;
  height: calc(var(--bar-h) + 28px);
  z-index: 490;
  pointer-events: none;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  background: linear-gradient(to bottom, color-mix(in srgb, var(--bg) 70%, transparent), transparent);
  -webkit-mask-image: linear-gradient(to bottom, #000 40%, transparent);
  mask-image: linear-gradient(to bottom, #000 40%, transparent);
}

/* ─────────────────────────────────────────────────────────
   Bar variant — for glass that content scrolls beneath (nav bar, tab bar,
   sheets). The base tint is 6%, which is right over the calm mesh but leaves
   labels unreadable over a sliding list of cards (liquid-glass recipes ›
   "A glass panel that scrolls with content behind it"). So bars frost the
   backdrop first and carry a wash of the menu surface — HIG "regular"
   variant — while the refraction still bends the frosted result at the rim.
   ───────────────────────────────────────────────────────── */
.glass-bar {
  --glass-backdrop-pre: blur(18px) saturate(160%);
  background:
    linear-gradient(180deg, var(--glass-tint-top), var(--glass-tint-bottom)),
    color-mix(in srgb, var(--glass-menu-surface) 58%, transparent);
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
}

/* Sheets hold dense text and tables, so the frost is close to opaque
   (~90% combined); the rim and refraction still read as glass. */
.liquid-glass--modal.glass-bar {
  --glass-backdrop-pre: blur(28px) saturate(150%);
  background:
    linear-gradient(180deg, var(--glass-modal-tint), var(--glass-modal-tint)),
    color-mix(in srgb, var(--glass-menu-surface) 80%, transparent);
  backdrop-filter: blur(24px) saturate(150%);
  -webkit-backdrop-filter: blur(24px) saturate(150%);
}

/* ─────────────────────────────────────────────────────────
   Top navigation bar — floating liquid glass (functional layer)
   <nav class="top-nav liquid-glass" data-liquid-glass>
   ───────────────────────────────────────────────────────── */
.top-nav {
  position: sticky;
  top: 12px;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: var(--bar-h);
  max-width: 1280px;
  margin: 0 auto 8px;
  padding: 6px 8px 6px 12px;
  border-radius: var(--radius-full);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.0625rem;
  letter-spacing: -0.01em;
  color: var(--label);
  text-decoration: none;
  white-space: nowrap;
  border-radius: var(--radius-full);
  padding: 4px 6px;
}

.nav-brand img {
  height: 30px;
  width: auto;
  display: block;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-wrap: wrap;
}

.nav-links a {
  color: var(--label-2);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.9375rem;
  padding: 0 16px;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  border-radius: var(--radius-full);
  transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease);
}

.nav-links a:hover {
  background-color: var(--fill-1);
  color: var(--label);
}

/* Selected: monochrome control with an accent label (HIG Liquid Glass ›
   Color — brand color only on the selection, not across the bar). */
.nav-links a.active,
.nav-links a[aria-current='page'] {
  background-color: var(--fill-2);
  color: var(--accent);
  font-weight: 600;
}

/* The hamburger is replaced by the bottom tab bar on phones. */
.nav-toggle {
  display: none !important;
}

/* ─────────────────────────────────────────────────────────
   Bottom tab bar — phones only (HIG Tab bars: top-level navigation on
   mobile). Built by ui.js from .nav-links, so the no-JS page keeps its top
   links and nothing is ever unreachable.
   ───────────────────────────────────────────────────────── */
.tab-bar {
  display: none;
}

@media (max-width: 700px) {
  body {
    padding: 8px 12px calc(var(--tabbar-h) + 28px + env(safe-area-inset-bottom));
  }

  .top-nav {
    top: 8px;
    padding: 6px 12px;
  }

  html.has-tabbar .nav-links {
    display: none;
  }

  html.has-tabbar .top-nav {
    justify-content: center;
  }

  .tab-bar {
    position: fixed;
    z-index: 600;
    left: 50%;
    transform: translateX(-50%);
    bottom: calc(10px + env(safe-area-inset-bottom));
    display: flex;
    align-items: stretch;
    gap: 2px;
    width: min(calc(100% - 24px), 440px);
    height: var(--tabbar-h);
    padding: 5px;
    border-radius: var(--radius-full);
  }

  .tab-bar a {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    border-radius: var(--radius-full);
    color: var(--label-2);
    text-decoration: none;
    font-size: 0.6875rem;       /* 11pt — HIG minimum on mobile */
    font-weight: 600;
    letter-spacing: 0.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    -webkit-tap-highlight-color: transparent;
  }

  .tab-bar a svg {
    width: 24px;
    height: 24px;
    flex: none;
  }

  .tab-bar a.active {
    color: var(--accent);
    background-color: var(--fill-2);
  }

  .tab-bar a span {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

/* ─────────────────────────────────────────────────────────
   Page header — a large title on the backdrop, no panel
   ───────────────────────────────────────────────────────── */
.header {
  text-align: center;
  margin: 0 auto 22px;
  padding: 30px 12px 4px;
  background: none;
  border-radius: 0;
  box-shadow: none;
  max-width: 1100px;
}

.header h1 {
  font-family: var(--font-display);
  font-size: clamp(1.875rem, 1.15rem + 2.6vw, 3rem);
  line-height: 1.08;
  font-weight: 800;
  letter-spacing: -0.025em;
  margin-bottom: 8px;
  color: var(--label);
  text-wrap: balance;
}

.header p {
  font-size: 1.0625rem;
  color: var(--label-2);
  text-wrap: balance;
}

/* ─────────────────────────────────────────────────────────
   Toolbar of controls — liquid glass capsule
   <div class="controls liquid-glass" data-liquid-glass>
   ───────────────────────────────────────────────────────── */
.controls.liquid-glass {
  width: fit-content;
  max-width: 100%;
  margin: 0 auto 28px;
  padding: 8px 8px 8px 18px;
  border-radius: var(--radius-full);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px 18px;
}

.control-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.control-group label {
  font-weight: 500;
  font-size: 0.875rem;
  color: var(--label-2);
}

/* Text fields and pop-up buttons: filled, borderless, HIG-sized. */
.control-group input,
.control-group select,
.filter-group select,
.filter-group input,
input.field,
select.field {
  appearance: none;
  -webkit-appearance: none;
  height: var(--control-h);
  padding: 0 12px;
  border: 0;
  border-radius: var(--radius-sm);
  background-color: var(--fill-1);
  color: var(--label);
  font-size: 0.9375rem;
  font-variant-numeric: tabular-nums;
  transition: background-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}

.control-group select,
.filter-group select,
select.field {
  padding-right: 32px;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--label-2) 50%),
    linear-gradient(135deg, var(--label-2) 50%, transparent 50%);
  background-position: calc(100% - 17px) 54%, calc(100% - 12px) 54%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

.control-group input[type='number'] {
  width: 84px;
}

.control-group input:hover,
.control-group select:hover,
.filter-group select:hover {
  background-color: var(--fill-2);
}

.control-group input:focus-visible,
.control-group select:focus-visible,
.filter-group select:focus-visible,
input.field:focus-visible,
select.field:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

select option {
  background-color: var(--bg);
  color: var(--label);
}

/* Prominent button — one per view (HIG Buttons). */
.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: var(--control-h);
  padding: 0 18px;
  border: 0;
  border-radius: var(--radius-full);
  background-color: var(--accent-fill);
  color: #fff;
  font-weight: 600;
  font-size: 0.9375rem;
  cursor: pointer;
  transition: filter var(--dur) var(--ease), transform var(--dur) var(--ease), background-color var(--dur) var(--ease);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 4px 14px color-mix(in srgb, var(--accent-fill) 35%, transparent);
}

.btn:hover {
  background-color: var(--accent-fill);
  filter: brightness(1.08);
}

.btn:active {
  transform: scale(0.97);
}

.btn:disabled {
  background-color: var(--fill-2);
  color: var(--label-3);
  box-shadow: none;
  cursor: not-allowed;
  filter: none;
  transform: none;
}

/* Secondary (gray) button for non-primary actions such as Close. */
.btn.btn-secondary {
  background-color: var(--fill-2);
  color: var(--label);
  box-shadow: none;
}

.btn.btn-secondary:hover {
  background-color: var(--fill-3);
  filter: none;
}

/* ─────────────────────────────────────────────────────────
   Content material — cards, panels, tables (content layer)
   ───────────────────────────────────────────────────────── */
.material {
  background-color: var(--material);
  border: 1px solid var(--material-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--material-shadow), inset 0 1px 0 var(--material-rim);
}

/* Filter toolbar (Stats, Rankings): the page's glass toolbar.
   <div class="filters liquid-glass" data-liquid-glass role="toolbar"> */
.filters.liquid-glass {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px 18px;
  flex-wrap: wrap;
  width: fit-content;
  max-width: 100%;
  margin: 0 auto 22px;
  padding: 8px 16px;
  border-radius: var(--radius-full);
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.filter-group label {
  font-weight: 500;
  font-size: 0.875rem;
  color: var(--label-2);
}

input[type='search'] {
  appearance: none;
  -webkit-appearance: none;
  height: var(--control-h);
  min-width: 220px;
  padding: 0 14px;
  border: 0;
  border-radius: var(--radius-full);
  background-color: var(--fill-1);
  color: var(--label);
  font-size: 0.9375rem;
}

input[type='search']:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.updated {
  font-size: 0.8rem;
  color: var(--label-3);
}

/* Content panel: standard material (content layer, not glass) */
.panel {
  background-color: var(--material);
  border: 1px solid var(--material-border);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--material-shadow), inset 0 1px 0 var(--material-rim);
}

.panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.panel-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.015em;
}

.panel-sub {
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--label-3);
}

/* Status tag: one prominent color per meaning */
.tag {
  display: inline-block;
  width: fit-content;
  padding: 3px 11px;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  background-color: var(--accent-fill);
  color: #fff;
}

.tag.week {
  background-color: #137a6b; /* white label 5.0:1 */
}

/* Filter chips — liquid-glass chip tier (small, repeated: no refraction) */
.chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.chip {
  appearance: none;
  min-height: 32px;
  padding: 0 14px;
  border: 0;
  border-radius: var(--radius-full);
  background-color: var(--fill-1);
  color: var(--label);
  font-size: 0.875rem;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color var(--dur) var(--ease);
}

.chip:hover {
  background-color: var(--fill-2);
}

.chip.active {
  background-color: var(--accent-fill);
  color: #fff;
  font-weight: 600;
}

.empty {
  text-align: center;
  padding: 30px;
  color: var(--label-2);
}

/* Small repeated pills — liquid-glass chip tier, no refraction. */
.liquid-glass-chip {
  color: var(--label);
}

/* Loading / empty / error states */
.loading {
  color: var(--label-2);
}

.spinner {
  border-color: var(--fill-2) !important;
  border-top-color: var(--accent-fill) !important;
}

.error {
  background-color: color-mix(in srgb, var(--red-fill) 16%, var(--material-strong)) !important;
  color: var(--label) !important;
  border: 1px solid color-mix(in srgb, var(--red-fill) 40%, transparent);
  border-radius: var(--radius-md) !important;
}

/* ─────────────────────────────────────────────────────────
   Sheets / modals — liquid glass modal tier
   ───────────────────────────────────────────────────────── */
.liquid-glass--modal {
  color: var(--label);
}

/* ─────────────────────────────────────────────────────────
   Footer — sits on the backdrop, no panel
   ───────────────────────────────────────────────────────── */
.site-footer {
  text-align: center;
  margin: 48px auto 0;
  padding: 8px 20px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.site-footer span {
  color: var(--label-2);
  font-size: 0.8125rem;
  font-weight: 500;
  position: relative;
  z-index: 2;
  margin-bottom: -18px;
}

.site-footer img {
  height: 96px;
  width: auto;
  position: relative;
  z-index: 1;
}

/* ─────────────────────────────────────────────────────────
   Touch: HIG mobile control size (44pt default)
   ───────────────────────────────────────────────────────── */
@media (pointer: coarse) {
  :root {
    --control-h: 44px;
  }
  .nav-links a {
    min-height: 44px;
  }
}

@media (max-width: 700px) {
  .filters.liquid-glass {
    border-radius: var(--radius-xl);
    width: 100%;
  }

  /* Compact two-column form: labels above fields, button full width */
  .controls.liquid-glass {
    border-radius: var(--radius-xl);
    padding: 12px 14px 14px;
    width: 100%;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 10px 12px;
    align-items: end;
  }
  .controls.liquid-glass .control-group {
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    min-width: 0;
  }
  .controls.liquid-glass .control-group label {
    font-size: 0.8125rem;
    padding-left: 4px;
  }
  .controls.liquid-glass .control-group input,
  .controls.liquid-glass .control-group select {
    width: 100%;
    min-width: 0;
  }
  .controls.liquid-glass > .btn {
    grid-column: 1 / -1;
  }
  .header {
    padding-top: 18px;
  }
}

/* ─────────────────────────────────────────────────────────
   Stepper — a pop-up button with an arrow on each side that moves
   one option back / forward (season and week pickers)
   <div class="stepper">
     <button type="button" class="step-btn" data-step="-1" aria-label="Previous week">…</button>
     <select id="weekNum"></select>
     <button type="button" class="step-btn" data-step="1" aria-label="Next week">…</button>
   </div>
   ───────────────────────────────────────────────────────── */
.stepper {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.stepper select {
  flex: 1 1 auto;
  min-width: 0;
}

.step-btn {
  appearance: none;
  -webkit-appearance: none;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--control-h);
  height: var(--control-h);
  padding: 0;
  border: 0;
  border-radius: var(--radius-full);
  background-color: var(--fill-1);
  color: var(--label);
  cursor: pointer;
  transition: background-color var(--dur) var(--ease), opacity var(--dur) var(--ease);
  -webkit-tap-highlight-color: transparent;
}

.step-btn svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.step-btn:hover:not(:disabled) { background-color: var(--fill-2); }
.step-btn:active:not(:disabled) { background-color: var(--fill-3); }

.step-btn:focus-visible {
  outline: 2px solid var(--accent-fill);
  outline-offset: 2px;
}

.step-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

/* ─────────────────────────────────────────────────────────
   Accessibility states (HIG Liquid Glass checklist #5)
   ───────────────────────────────────────────────────────── */
@media (prefers-reduced-transparency: reduce) {
  :root {
    --material: var(--material-strong);
    --glass-tint-top: var(--material-strong);
    --glass-tint-bottom: var(--material-strong);
  }
  html[data-theme='dark'] {
    --material: #1c1c26;
  }
  html[data-theme='light'] {
    --material: #ffffff;
  }
  .liquid-glass,
  .liquid-glass-chip,
  .liquid-glass-menu,
  .scroll-edge {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }
  .liquid-glass,
  .liquid-glass-menu {
    background: var(--material) !important;
  }
  .scroll-edge {
    background: var(--bg);
    height: calc(var(--bar-h) + 16px);
  }
}

@media (prefers-contrast: more) {
  :root,
  html[data-theme='light'] {
    --label-2: rgba(60, 60, 67, 0.95);
    --label-3: rgba(60, 60, 67, 0.88);
    --material-border: rgba(30, 33, 45, 0.35);
    --glass-border: rgba(30, 33, 45, 0.35);
    --separator: rgba(60, 60, 67, 0.4);
  }
  html[data-theme='dark'] {
    --label-2: rgba(235, 235, 245, 0.9);
    --label-3: rgba(235, 235, 245, 0.82);
    --material-border: rgba(255, 255, 255, 0.35);
    --glass-border: rgba(255, 255, 255, 0.35);
    --separator: rgba(235, 235, 245, 0.35);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
