/*
 * WatchFooty styles: themes (kits), layout, mobile.
 *
 * Version: 1.04
 * Date: 11/23/2026
 */
/* ===== Themes (html[data-theme]) ===== */
:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --border: #e3e6eb;
  --text: #111827;
  --muted: #6b7280;
  --accent: #1f2937;
  --accent-2: #e11d48;
  --on-accent: #ffffff;
  --header-bg: #ffffff;
  --header-text: #111827;
  --header-muted: #6b7280;
  --header-border: #e3e6eb;
  --header-pattern: none;
  --tile-bg: #ffffff;
  --tile-border: #e3e6eb;
  --included: #047857;
  --included-bg: #ecfdf5;
  --free: #1d4ed8;
  --free-bg: #eff6ff;
  --live: #dc2626;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.05), 0 1px 3px rgba(16, 24, 40, 0.07);
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-head: var(--font-body);
  --head-transform: none;
  --head-weight: 700;
  --head-spacing: -0.01em;
}

[data-theme="pitch"] {
  --bg: #eef3ef;
  --surface: #ffffff;
  --surface-2: #e6eee8;
  --border: #d3dfd6;
  --text: #0f1f17;
  --muted: #5b6b62;
  --accent: #146c43;
  --accent-2: #f59e0b;
  --header-bg: #11603a;
  --header-text: #ffffff;
  --header-muted: rgba(255, 255, 255, 0.78);
  --header-border: transparent;
  --header-pattern: repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.05) 0 80px, transparent 80px 160px);
  --tile-bg: rgba(255, 255, 255, 0.96);
  --tile-border: transparent;
  --radius: 12px;
  --font-body: "Avenir Next", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-head: var(--font-body);
}

/* Pitch Dark: Pitch's green header and fonts on a dark, floodlit-night body. */
[data-theme="pitchdark"] {
  color-scheme: dark;
  --bg: #0a130e;
  --surface: #122019;
  --surface-2: #182a20;
  --border: #22382b;
  --text: #e6efe8;
  --muted: #8ea395;
  --accent: #3ccf85;
  --accent-2: #f59e0b;
  --on-accent: #06120c;
  --header-bg: #0c3d25;
  --header-text: #ffffff;
  --header-muted: rgba(255, 255, 255, 0.72);
  --header-border: transparent;
  --header-pattern: repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.04) 0 80px, transparent 80px 160px);
  --tile-bg: rgba(255, 255, 255, 0.06);
  --tile-border: transparent;
  --included: #34d399;
  --included-bg: rgba(52, 211, 153, 0.12);
  --free: #60a5fa;
  --free-bg: rgba(96, 165, 250, 0.12);
  --live: #f87171;
  --radius: 12px;
  --shadow: none;
  --font-body: "Avenir Next", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-head: var(--font-body);
}

/* Apple TV kit: tvOS-style dark UI. Its layout lives in the "Apple TV kit" section at the end. */
[data-theme="appletv"] {
  color-scheme: dark;
  --bg: #000000;
  --surface: #1c1c1e;
  --surface-2: #2c2c2e;
  --border: rgba(255, 255, 255, 0.1);
  --text: #f5f5f7;
  --muted: #98989d;
  --accent: #f5f5f7;
  --accent-2: #0a84ff;
  --on-accent: #000000;
  --header-bg: #000000;
  --header-text: #f5f5f7;
  --header-muted: #98989d;
  --header-border: rgba(255, 255, 255, 0.08);
  --tile-bg: transparent;
  --tile-border: transparent;
  --included: #30d158;
  --included-bg: rgba(48, 209, 88, 0.14);
  --free: #64d2ff;
  --free-bg: rgba(100, 210, 255, 0.14);
  --live: #ff453a;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: none;
  --font-body: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-head: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --head-weight: 700;
  --head-spacing: -0.02em;
  --tint: #1d3fbf;
  --tint-2: #0b7d78;
}

/* ===== League accents (body[data-league]) — layer on top of any theme ===== */
body[data-league="MLS"] { --accent: #1d3fbf; --accent-2: #e4002b; --on-accent: #ffffff; }
body[data-league="NWSL"] { --accent: #0b7d78; --accent-2: #e0457b; --on-accent: #ffffff; }
[data-theme="pitchdark"] body[data-league="MLS"] { --accent: #6b93ff; --on-accent: #0a130e; --header-bg: #0f2747; }
[data-theme="pitchdark"] body[data-league="NWSL"] { --accent: #2dd4bf; --on-accent: #0a130e; --header-bg: #08433f; }
[data-theme="pitch"] body[data-league="MLS"] { --header-bg: #13315c; }
[data-theme="pitch"] body[data-league="NWSL"] { --header-bg: #0b5c58; }
/* Apple TV keeps white controls; the league colour only tints the hero and card artwork. */
[data-theme="appletv"] body[data-league] { --accent: #f5f5f7; --on-accent: #000000; }
[data-theme="appletv"] body[data-league="MLS"] { --tint: #1d3fbf; --tint-2: #e4002b; }
[data-theme="appletv"] body[data-league="NWSL"] { --tint: #0b7d78; --tint-2: #e0457b; }

/* ===== Base ===== */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--bg); }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.3s, color 0.3s;
}
.wrap { max-width: 960px; margin: 0 auto; padding: 0 max(16px, env(safe-area-inset-left)); }
a { color: inherit; }
h2, h3, .brand-name, .hero-title, .day-head span:first-child {
  font-family: var(--font-head);
  text-transform: var(--head-transform);
  letter-spacing: var(--head-spacing);
}

/* ===== Masthead ===== */
.masthead {
  background: var(--header-pattern), var(--header-bg);
  color: var(--header-text);
  border-bottom: 1px solid var(--header-border);
  padding-bottom: 16px;
  transition: background-color 0.3s;
}
.mast-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 16px; padding-bottom: 14px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.brand-name .ball { width: 0.74em; height: 0.74em; vertical-align: -0.07em; margin: 0 0.015em; }
.brand-name .ball:first-of-type { margin-left: 0.03em; }
.brand-name { display: block; font-size: 24px; font-weight: var(--head-weight); line-height: 1.1; }
.tagline { display: block; font-size: 13px; color: var(--header-muted); margin-top: 2px; }
.tagline em { font-style: normal; font-weight: 700; color: var(--header-text); }

/* Kit (theme) switcher */
.kit { position: relative; }
.kit-btn {
  appearance: none; cursor: pointer; display: inline-flex; align-items: center; gap: 10px;
  padding: 6px 12px 6px 8px; border-radius: 999px; font: inherit; color: var(--header-text);
  background: color-mix(in srgb, var(--header-text) 8%, transparent);
  border: 1px solid color-mix(in srgb, var(--header-text) 18%, transparent);
  transition: background 0.2s, transform 0.2s;
}
.kit-btn:hover { background: color-mix(in srgb, var(--header-text) 14%, transparent); }
.kit-btn svg { width: 30px; height: 30px; transition: transform 0.35s cubic-bezier(.3,1.6,.5,1); }
.kit-btn:hover svg, .kit-btn[aria-expanded="true"] svg { transform: rotate(-8deg) scale(1.08); }
.kit-btn .kit-body { fill: var(--accent); stroke: var(--header-text); stroke-width: 1.4; stroke-linejoin: round; }
.kit-btn .kit-trim { fill: none; stroke: var(--accent-2); stroke-width: 2; stroke-linecap: round; }
.kit-label { display: flex; flex-direction: column; line-height: 1.1; text-align: left; }
.kit-kicker { font-size: 10px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--header-muted); }
#kitName { font-size: 13px; font-weight: 700; }
.kit-btn.spin svg { animation: kitspin 0.5s ease; }
@keyframes kitspin { 50% { transform: rotateY(90deg); } }

.popover {
  position: absolute; z-index: 50; top: calc(100% + 8px); right: 0;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: 14px;
  box-shadow: 0 12px 40px rgba(16, 24, 40, 0.18), 0 2px 6px rgba(16, 24, 40, 0.08);
  padding: 14px; animation: pop 0.16s ease-out;
}
@keyframes pop { from { transform: translateY(-4px) scale(0.98); } }
.popover[hidden] { display: none; }
.popover-title { margin: 0 0 10px; font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.popover-hint { margin: 10px 0 0; font-size: 12px; color: var(--muted); }
kbd { font: 600 11px var(--font-body); padding: 1px 6px; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 4px; background: var(--surface-2); }

.kit-menu { width: 340px; }
.kit-options { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.kit-card {
  appearance: none; cursor: pointer; padding: 0; overflow: hidden; text-align: left; font: inherit;
  border-radius: 10px; border: 2px solid var(--border); background: var(--kc-bg); color: var(--text);
  transition: transform 0.15s, border-color 0.15s;
}
.kit-card:hover { transform: translateY(-2px); }
.kit-card[aria-checked="true"] { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 25%, transparent); }
.kc-head { height: 22px; background: var(--kc-head); display: flex; align-items: center; gap: 4px; padding: 0 6px; }
.kc-head i { width: 14px; height: 8px; border-radius: 2px; background: var(--kc-tile); }
.kc-body { padding: 6px; display: grid; gap: 4px; }
.kc-card { height: 18px; border-radius: 4px; background: var(--kc-surface); border-left: 3px solid var(--kc-accent); }
.kc-name { display: block; padding: 4px 8px 7px; font-size: 11px; font-weight: 700; background: var(--surface); border-top: 1px solid var(--border); }

.league-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.league-tile {
  appearance: none; cursor: pointer; font: inherit; color: var(--text);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  min-height: 112px; padding: 14px 10px 12px;
  background: var(--tile-bg); border: 1px solid var(--tile-border); border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: transform 0.15s, box-shadow 0.2s, border-color 0.2s;
}
.league-tile:hover { transform: translateY(-2px); }
.league-tile.active { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent), var(--shadow); }
[data-theme="pitch"] .league-tile.active,
[data-theme="pitchdark"] .league-tile.active { border-color: var(--accent-2); box-shadow: 0 0 0 3px var(--accent-2); }
.tile-logos { display: flex; align-items: center; justify-content: center; gap: 14px; height: 64px; }
.tile-logos img { height: 64px; width: auto; max-width: 110px; object-fit: contain; }
.league-tile[data-league="ALL"] .tile-logos img { height: 48px; }
.tile-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.league-tile.active .tile-label { color: var(--accent); }

/* ===== Hero ===== */
.sample-banner { margin-top: 16px; padding: 10px 14px; border-radius: var(--radius-sm); background: #fef3c7; color: #78350f; font-size: 13px; font-weight: 600; }
.hero {
  display: flex; align-items: center; gap: 22px; flex-wrap: wrap;
  margin-top: 18px; padding: 22px 24px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow);
  border-top: 4px solid var(--accent);
}
.hero-logos { display: flex; gap: 16px; align-items: center; flex: none; }
.hero-logos img { height: 96px; width: auto; max-width: 150px; object-fit: contain; }
.hero-logos .mono { width: 96px; height: 96px; font-size: 32px; }
.hero-body { flex: 1; min-width: 220px; }
.hero-kicker { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.hero-kicker img { height: 18px; }
.hero-title { margin: 4px 0 8px; font-size: 28px; font-weight: var(--head-weight); line-height: 1.15; }
.hero-meta { display: flex; flex-wrap: wrap; gap: 8px; }
.stat { font-size: 13px; padding: 5px 10px; border-radius: 999px; background: var(--surface-2); color: var(--text); }
.stat b { font-variant-numeric: tabular-nums; }
.stat.live { background: color-mix(in srgb, var(--live) 12%, transparent); color: var(--live); font-weight: 600; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

/* ===== Panels & controls ===== */
.panel { margin-top: 14px; padding: 16px 18px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.services-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
h2 { margin: 0; font-size: 13px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); font-weight: 700; }

.pills { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 12px; }
.pill {
  appearance: none; cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px;
  font: 500 13px var(--font-body); color: var(--text);
  padding: 7px 13px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border);
  transition: background 0.2s, border-color 0.2s;
}
.pill:hover { background: var(--surface-2); }
.pill .check { width: 16px; height: 16px; border-radius: 50%; border: 1.5px solid var(--muted); display: grid; place-items: center; }
.pill.on { border-color: var(--included); background: var(--included-bg); }
.pill.on .check { background: var(--included); border-color: var(--included); }
.pill.on .check::after { content: ""; width: 7px; height: 4px; border: 2px solid #fff; border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px, -1px); }
.pill .tag { font-size: 10px; font-weight: 700; color: var(--free); text-transform: uppercase; letter-spacing: 0.06em; }

.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.dot.included { background: var(--included); }
.dot.free { background: var(--free); }
.dot.other { background: var(--muted); }

.switch { display: inline-flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.track { width: 38px; height: 22px; border-radius: 999px; background: var(--border); position: relative; transition: background 0.2s; }
.thumb { position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform 0.2s; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3); }
.switch input:checked + .track { background: var(--included); }
.switch input:checked + .track .thumb { transform: translateX(16px); }
.switch input:focus-visible + .track { outline: 2px solid var(--accent); outline-offset: 2px; }

.toolbar { display: grid; grid-template-columns: minmax(200px, 1.6fr) repeat(3, minmax(120px, 1fr)) auto; gap: 8px; margin-top: 14px; }
.field {
  display: flex; align-items: center; gap: 8px; min-width: 0; height: 42px; padding: 0 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.field:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
.field > span { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); flex: none; }
.field svg, .icon-btn svg, .text-btn svg { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.field svg { color: var(--muted); }
.field input, .field select { flex: 1; min-width: 0; height: 100%; background: transparent; border: 0; outline: 0; color: var(--text); font: 500 14px var(--font-body); }
.field select {
  cursor: pointer; appearance: none; -webkit-appearance: none; padding-right: 16px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right center / 12px;
}
.field select option { background: var(--surface); color: var(--text); }
.field input::placeholder { color: var(--muted); }
.icon-btn { appearance: none; cursor: pointer; width: 42px; height: 42px; display: grid; place-items: center; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.icon-btn:hover { background: var(--surface-2); }
.icon-btn svg { width: 18px; height: 18px; transition: transform 0.25s; }
.icon-btn.desc svg { transform: scaleY(-1); }

.results-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 18px 2px 0; }
.results-bar p { margin: 0; font-size: 13px; color: var(--muted); }
.results-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.cal { position: relative; }
.cal-pop { width: 300px; }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; font-weight: 700; font-family: var(--font-head); }
.icon-btn.sm { width: 32px; height: 32px; min-width: 32px; min-height: 32px; font-size: 18px; line-height: 1; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal-dow { font-size: 10px; font-weight: 700; color: var(--muted); text-align: center; padding: 4px 0; text-transform: uppercase; }
.cal-day {
  appearance: none; position: relative; height: 38px; border: 0; border-radius: 8px; cursor: pointer;
  background: transparent; color: var(--text); font: 500 13px var(--font-body); font-variant-numeric: tabular-nums;
}
.cal-day:hover:not(:disabled) { background: var(--surface-2); }
.cal-day:disabled { color: color-mix(in srgb, var(--muted) 45%, transparent); cursor: default; }
.cal-day.out { visibility: hidden; }
.cal-day.today { font-weight: 800; box-shadow: inset 0 0 0 1.5px var(--accent); }
.cal-day.selected { background: var(--accent); color: var(--on-accent); }
.cal-dots { position: absolute; left: 0; right: 0; bottom: 4px; display: flex; justify-content: center; gap: 3px; }
.cal-dots i { width: 5px; height: 5px; border-radius: 50%; }
.dot.mls, .cal-dots i.mls { background: #1d3fbf; }
.dot.nwsl, .cal-dots i.nwsl { background: #0b9e97; }
.cal-day.selected .cal-dots i { background: var(--on-accent); }
.cal-legend { display: flex; align-items: center; gap: 12px; margin-top: 8px; font-size: 12px; color: var(--muted); }
.cal-legend span { display: inline-flex; align-items: center; gap: 5px; }
.cal-legend .text-btn { margin-left: auto; }

.history-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  margin-top: 16px; padding: 10px 14px; border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--accent) 10%, var(--surface)); border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  font-size: 14px; font-weight: 600;
}
.history-bar[hidden] { display: none; }

.text-btn {
  appearance: none; cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
  font: 600 13px var(--font-body); color: var(--accent); background: none; border: 0; padding: 6px 4px;
}
.text-btn:hover { text-decoration: underline; }

/* ===== Schedule ===== */
.day { margin-top: 22px; }
.day-head { display: flex; align-items: baseline; gap: 10px; margin: 0 2px 10px; font-size: 16px; font-weight: var(--head-weight); }
.day-head .count { color: var(--muted); font-weight: 500; font-size: 13px; font-family: var(--font-body); text-transform: none; letter-spacing: 0; }
.day-head.today::before { content: "Today"; align-self: center; font: 700 11px var(--font-body); text-transform: uppercase; letter-spacing: 0.06em; color: var(--on-accent); background: var(--accent); padding: 3px 8px; border-radius: 999px; }

.card {
  display: grid; grid-template-columns: 96px 1fr auto; gap: 16px; align-items: start;
  padding: 16px 18px; margin-bottom: 10px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow);
  border-left: 4px solid transparent;
}
.card.lg-MLS { border-left-color: #1d3fbf; }
.card.lg-NWSL { border-left-color: #0b7d78; }
.card.live { border-color: var(--live); border-left-color: var(--live); }
.card.post { opacity: 0.75; }

.when { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.time { font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; }
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 700; letter-spacing: 0.04em; color: var(--muted); }
.badge img { height: 20px; width: auto; }
.status { font-size: 12px; color: var(--muted); font-weight: 600; }
.status.live { color: var(--live); display: inline-flex; align-items: center; gap: 6px; }
.status.live::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--live); animation: pulse 1.4s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--live) 60%, transparent); } 100% { box-shadow: 0 0 0 8px transparent; } }

.teams { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.team { display: flex; align-items: center; gap: 10px; min-width: 0; }
.team img, .team .mono { width: 28px; height: 28px; flex: none; object-fit: contain; }
.team .name { font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-decoration: none; }
.team a.name:hover { text-decoration: underline; color: var(--accent); }
.team .score { margin-left: auto; font-weight: 800; font-size: 17px; font-variant-numeric: tabular-nums; }
.team.loser { color: var(--muted); }
.venue { font-size: 12px; color: var(--muted); }
.mono {
  display: grid; place-items: center; border-radius: 50%;
  font: 800 10px var(--font-body); letter-spacing: 0.02em;
  color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--surface));
}
.cal-btn { align-self: start; }

.watch { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; padding-top: 12px; border-top: 1px solid var(--border); }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  font: 600 13px var(--font-body); text-decoration: none; color: var(--text);
  padding: 8px 13px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface);
  transition: background 0.2s, border-color 0.2s;
}
.btn:hover { background: var(--surface-2); }
.btn .hint { font-size: 11px; font-weight: 500; color: var(--muted); }
.btn.included { background: var(--included-bg); border-color: var(--included); color: var(--included); }
.btn.included .hint { color: var(--included); opacity: 0.8; }
.btn.free { background: var(--free-bg); border-color: color-mix(in srgb, var(--free) 50%, transparent); color: var(--free); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { filter: brightness(1.1); background: var(--accent); }
.btn .direct { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; padding: 1px 6px; border-radius: 4px; border: 1px solid currentColor; }
.chip-local {
  display: inline-flex; align-items: center; gap: 8px; text-decoration: none;
  font: 600 13px var(--font-body); color: var(--text);
  padding: 7px 12px; border-radius: var(--radius-sm);
  background: var(--surface-2); border: 1px solid var(--border);
}
a.chip-local:hover { border-color: var(--accent); }
.chip-local .hint { font-size: 11px; font-weight: 500; color: var(--muted); }
.chip-local-tag { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--accent); }
.chip-tv { font-size: 12px; color: var(--muted); padding: 8px 12px; border-radius: var(--radius-sm); border: 1px dashed var(--border); }

.poster, .shelf-nav { display: none; } /* Apple TV kit only */
.when .date { display: block; font-size: 12px; font-weight: 600; color: var(--muted); } /* Recent results cards */

.empty { text-align: center; color: var(--muted); padding: 60px 20px; }
.empty strong { display: block; color: var(--text); font-size: 17px; margin-bottom: 6px; }

.skeleton { height: 120px; border-radius: var(--radius); margin-top: 12px; background: linear-gradient(90deg, var(--surface) 25%, var(--surface-2) 50%, var(--surface) 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

.foot { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 36px 0 28px; font-size: 12px; color: var(--muted); }

/* ===== Controls drawer (collapses on phones) ===== */
.controls-toggle { display: none; }
.controls > summary::-webkit-details-marker { display: none; }
.active-count[hidden] { display: none; }
.active-count { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; display: inline-grid; place-items: center; font-size: 11px; font-weight: 700; background: var(--accent); color: var(--on-accent); }

/* ===== Responsive ===== */
@media (max-width: 640px) {
  .controls-toggle {
    display: flex; align-items: center; gap: 10px; list-style: none; cursor: pointer;
    margin-top: 14px; padding: 0 14px; height: 46px;
    font: 600 14px var(--font-body); color: var(--text);
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  }
  .controls-toggle svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
  .controls-toggle::after { content: ""; margin-left: auto; width: 8px; height: 8px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); transition: transform 0.2s; }
  .controls[open] .controls-toggle::after { transform: rotate(-135deg); }

  /* Compact sticky masthead with logo tabs */
  .masthead { position: sticky; top: 0; z-index: 20; padding-bottom: 10px; }
  .mast-row { padding-top: max(10px, env(safe-area-inset-top)); padding-bottom: 10px; gap: 10px; }
  .brand-name { font-size: 20px; }
  .tagline { font-size: 11.5px; line-height: 1.3; margin-top: 3px; }
  .mast-row { flex-wrap: nowrap; }
  .brand { flex: 1 1 auto; min-width: 0; }
  .kit-label { display: none; }
  .kit-btn { padding: 4px; }
  .kit-btn svg { width: 28px; height: 28px; }
  .kit-menu { width: min(320px, calc(100vw - 32px)); }
  .cal-pop { position: fixed; left: 16px; right: 16px; top: auto; bottom: 16px; width: auto; }
  .league-tiles { gap: 6px; }
  .league-tile { min-height: 0; flex-direction: row; gap: 8px; padding: 8px 6px; }
  .tile-logos, .tile-logos img { height: 34px; }
  .league-tile[data-league="ALL"] .tile-logos img { height: 24px; }
  .tile-logos { gap: 6px; }
  .tile-label { font-size: 11px; }
  .tile-label { display: none; }
  .league-tile:hover { transform: none; }

  .day-head, .card { scroll-margin-top: 130px; }
  .hero { margin-top: 12px; padding: 16px; gap: 14px; border-top-width: 3px; }
  .hero-logos img { height: 56px; }
  .hero-logos .mono { width: 56px; height: 56px; font-size: 20px; }
  .hero-title { font-size: 21px; margin-bottom: 6px; }
  .hero-body { min-width: 0; }
  .hero-actions .btn { flex: 1 1 auto; justify-content: center; }

  .panel { padding: 14px; }
  .toolbar { grid-template-columns: 1fr 1fr; }
  .toolbar .search { grid-column: 1 / -1; }
  .toolbar .icon-btn { width: 100%; }
  .field input, .field select { font-size: 16px; } /* stops iOS zoom on focus */

  .card { grid-template-columns: 1fr auto; gap: 10px; padding: 14px; }
  .when { grid-column: 1 / -1; flex-direction: row; align-items: center; gap: 10px; }
  .team .name { font-size: 16px; }
  .watch { gap: 6px; }
  .watch .btn { flex: 1 1 100%; justify-content: center; min-height: 44px; }
  .chip-tv, .chip-local { flex: 1 1 100%; justify-content: center; text-align: center; min-height: 40px; }
  .results-bar { flex-wrap: wrap; margin-top: 14px; }
  .foot { flex-direction: column; }
}
@media (pointer: coarse) {
  .pill { min-height: 40px; }
  .icon-btn { min-width: 44px; min-height: 44px; }
}
@media (min-width: 641px) and (max-width: 760px) {
  .toolbar { grid-template-columns: 1fr 1fr; }
  .toolbar .search { grid-column: 1 / -1; }
  .toolbar .icon-btn { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ===== Apple TV kit (html[data-theme="appletv"]) =====
   tvOS look: frosted top bar with text tabs, a big "top shelf" hero, one sideways shelf of
   artwork cards per day, focus lift + tilt + sheen. Depth effects are allowed in this kit only. */
[data-theme="appletv"] .wrap { max-width: 1320px; padding: 0 max(32px, env(safe-area-inset-left)); }

/* Frosted top bar: brand | tabs | kit, in one row */
[data-theme="appletv"] .masthead {
  position: sticky; top: 0; z-index: 30;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px;
  padding: 12px max(32px, calc((100vw - 1320px) / 2 + 32px));
  background: rgba(0, 0, 0, 0.62);
  -webkit-backdrop-filter: saturate(180%) blur(28px); backdrop-filter: saturate(180%) blur(28px);
  border-bottom: 1px solid var(--header-border);
}
[data-theme="appletv"] .mast-row { display: contents; }
[data-theme="appletv"] .brand { grid-column: 1; grid-row: 1; }
[data-theme="appletv"] .brand-name { font-size: 22px; letter-spacing: -0.02em; }
[data-theme="appletv"] .tagline { font-size: 12px; letter-spacing: 0.01em; margin-top: 3px; }
[data-theme="appletv"] .tagline em { color: #fff; }
[data-theme="appletv"] .kit { grid-column: 3; grid-row: 1; justify-self: end; }
[data-theme="appletv"] .kit-btn { background: rgba(255, 255, 255, 0.08); border-color: transparent; }
[data-theme="appletv"] .league-tiles {
  grid-column: 2; grid-row: 1; display: flex; gap: 4px; padding: 4px; margin: 0; max-width: none;
  background: rgba(255, 255, 255, 0.06); border-radius: 999px;
}
[data-theme="appletv"] .league-tile {
  min-height: 0; flex-direction: row; padding: 8px 20px; border: 0; border-radius: 999px;
  background: transparent; box-shadow: none; transition: background 0.2s, color 0.2s, transform 0.2s;
}
[data-theme="appletv"] .league-tile .tile-logos { display: none; }
[data-theme="appletv"] .tile-label { display: inline; font: 600 15px var(--font-body); text-transform: none; letter-spacing: 0; color: var(--muted); }
[data-theme="appletv"] .league-tile:hover { transform: none; background: rgba(255, 255, 255, 0.1); }
[data-theme="appletv"] .league-tile:hover .tile-label { color: var(--text); }
[data-theme="appletv"] .league-tile.active { background: #f5f5f7; box-shadow: none; }
[data-theme="appletv"] .league-tile.active .tile-label { color: #000000; }
[data-theme="appletv"] .league-tile:focus-visible { outline: 0; transform: scale(1.08); box-shadow: 0 0 0 2px #f5f5f7; }

/* Frosted pop-ups */
[data-theme="appletv"] .popover {
  background: rgba(30, 30, 32, 0.82);
  -webkit-backdrop-filter: saturate(180%) blur(30px); backdrop-filter: saturate(180%) blur(30px);
  border-color: rgba(255, 255, 255, 0.1); border-radius: 20px;
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.6);
}

/* Top-shelf hero */
[data-theme="appletv"] .hero {
  position: relative; min-height: 320px; margin-top: 28px; padding: 48px 56px; gap: 40px;
  flex-direction: row-reverse; justify-content: space-between;
  border: 0; border-radius: 28px; overflow: hidden;
  background:
    radial-gradient(110% 90% at 88% 10%, color-mix(in srgb, var(--tint) 72%, transparent), transparent 62%),
    radial-gradient(80% 80% at 100% 100%, color-mix(in srgb, var(--tint-2) 45%, transparent), transparent 60%),
    linear-gradient(180deg, #1c1c1e, #0a0a0b);
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.55);
}
[data-theme="appletv"] .hero-logos img { height: 150px; max-width: 220px; filter: drop-shadow(0 14px 30px rgba(0, 0, 0, 0.55)); }
[data-theme="appletv"] .hero-logos .mono { width: 150px; height: 150px; font-size: 46px; color: #fff; background: rgba(255, 255, 255, 0.12); }
[data-theme="appletv"] .hero-kicker { color: rgba(255, 255, 255, 0.72); letter-spacing: 0.1em; }
[data-theme="appletv"] .hero-title { color: #ffffff; font-size: 50px; font-weight: 800; letter-spacing: -0.03em; margin: 8px 0 16px; }
[data-theme="appletv"] .stat { padding: 7px 14px; font-size: 14px; background: rgba(255, 255, 255, 0.12); color: var(--text); }
[data-theme="appletv"] .stat.live { background: rgba(255, 69, 58, 0.22); color: #ff6961; }
[data-theme="appletv"] .hero-actions { margin-top: 20px; }

/* Panels and controls */
[data-theme="appletv"] .panel, [data-theme="appletv"] .field, [data-theme="appletv"] .icon-btn { border-color: transparent; }
[data-theme="appletv"] .pill { background: var(--surface-2); border-color: transparent; }
[data-theme="appletv"] .pill.on { background: #f5f5f7; color: #000000; }
[data-theme="appletv"] .pill.on .tag { color: #0071e3; }
[data-theme="appletv"] .field:focus-within { border-color: transparent; box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.7); }
[data-theme="appletv"] .controls-toggle { border-color: transparent; }

/* Shelves: one sideways row of cards per day */
[data-theme="appletv"] .day { margin-top: 30px; }
[data-theme="appletv"] .day-head { align-items: center; margin: 0 2px; font-size: 24px; letter-spacing: -0.02em; }
[data-theme="appletv"] .shelf-nav { display: flex; gap: 6px; margin-left: auto; }
[data-theme="appletv"] .shelf-nav .icon-btn { border-radius: 50%; background: rgba(255, 255, 255, 0.1); font-size: 20px; }
[data-theme="appletv"] .shelf-nav .icon-btn:hover { background: rgba(255, 255, 255, 0.2); }
[data-theme="appletv"] .shelf {
  display: grid; grid-auto-flow: column; grid-auto-columns: 340px; gap: 28px; align-items: stretch;
  overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x proximity; scroll-padding-inline: 24px;
  /* Room around the cards so the focus lift and shadow aren't clipped by the scroller */
  padding: 22px 24px 42px; margin: 0 -24px -20px; scrollbar-width: none;
}
[data-theme="appletv"] .shelf::-webkit-scrollbar { display: none; }

/* Cards: artwork on top, details below, lift + tilt + sheen on focus */
[data-theme="appletv"] .card {
  position: relative; display: flex; flex-direction: column; gap: 0; margin: 0; padding: 0;
  background: var(--surface); border: 0; border-radius: var(--radius); overflow: hidden;
  scroll-snap-align: start; scroll-margin: 150px 40px 60px; outline: none;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  transform: perspective(1000px) rotateX(var(--ry, 0deg)) rotateY(var(--rx, 0deg)) scale(var(--s, 1));
  transition: transform 0.28s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.28s, opacity 0.2s;
}
[data-theme="appletv"] .card::after {
  content: ""; position: absolute; inset: 0; z-index: 2; pointer-events: none; border-radius: inherit;
  background: linear-gradient(115deg, transparent 35%, rgba(255, 255, 255, 0.16) 48%, transparent 62%) var(--shine, 100%) 0 / 250% 100% no-repeat;
  opacity: 0; transition: opacity 0.28s, background-position 0.5s;
}
[data-theme="appletv"] .card:focus-visible,
[data-theme="appletv"] .card:focus-within { --s: 1.06; z-index: 3; opacity: 1; box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.85), 0 30px 60px rgba(0, 0, 0, 0.7); }
[data-theme="appletv"] .card:focus-visible::after,
[data-theme="appletv"] .card:focus-within::after { opacity: 1; --shine: 0%; }
@media (hover: hover) {
  [data-theme="appletv"] .card:hover { --s: 1.06; z-index: 3; opacity: 1; box-shadow: 0 30px 60px rgba(0, 0, 0, 0.7); }
  [data-theme="appletv"] .card:hover::after { opacity: 1; }
}
[data-theme="appletv"] .card.post:not(:hover):not(:focus-within) { opacity: 0.78; }
[data-theme="appletv"] .card.live:not(:hover):not(:focus-within) { box-shadow: 0 0 0 2px var(--live), 0 8px 24px rgba(0, 0, 0, 0.35); }
[data-theme="appletv"] .card .when { display: none; }
[data-theme="appletv"] .card.lg-MLS { --lg: #1d3fbf; --lg-2: #e4002b; }
[data-theme="appletv"] .card.lg-NWSL { --lg: #0b7d78; --lg-2: #e0457b; }

[data-theme="appletv"] .poster {
  display: grid; grid-template-rows: auto 1fr auto; width: 100%; aspect-ratio: 16 / 9; padding: 12px 14px;
  background:
    radial-gradient(70% 95% at 20% 55%, color-mix(in srgb, var(--lg, #3a3a3c) 60%, transparent), transparent 72%),
    radial-gradient(70% 95% at 80% 55%, color-mix(in srgb, var(--lg-2, #3a3a3c) 42%, transparent), transparent 72%),
    linear-gradient(160deg, #2c2c2e, #0d0d0f);
}
[data-theme="appletv"] .poster-top img { height: 22px; width: auto; opacity: 0.9; }
[data-theme="appletv"] .poster-teams { display: flex; align-items: center; justify-content: center; gap: 20px; }
[data-theme="appletv"] .poster-logo { width: 80px; height: 80px; object-fit: contain; filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.55)); }
[data-theme="appletv"] .mono.poster-logo { font-size: 24px; color: #fff; background: rgba(255, 255, 255, 0.12); }
[data-theme="appletv"] .poster-vs { font-size: 14px; font-weight: 700; letter-spacing: 0.1em; color: rgba(255, 255, 255, 0.7); }
[data-theme="appletv"] .poster-vs.score { font-size: 30px; font-weight: 800; letter-spacing: -0.01em; color: #fff; font-variant-numeric: tabular-nums; }
[data-theme="appletv"] .poster-foot { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; color: rgba(255, 255, 255, 0.9); font-variant-numeric: tabular-nums; }
[data-theme="appletv"] .poster-live { padding: 2px 8px; border-radius: 6px; background: var(--live); color: #fff; font-size: 11px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; }

[data-theme="appletv"] .card .cal-btn {
  position: absolute; top: 10px; right: 10px; z-index: 1; width: 36px; height: 36px; min-width: 0; min-height: 0;
  border-radius: 50%; border: 0; color: #fff; background: rgba(0, 0, 0, 0.45);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  opacity: 0; transition: opacity 0.2s;
}
[data-theme="appletv"] .card:hover .cal-btn, [data-theme="appletv"] .card:focus-within .cal-btn, [data-theme="appletv"] .card:focus-visible .cal-btn { opacity: 1; }
@media (hover: none) { [data-theme="appletv"] .card .cal-btn { opacity: 1; } }

[data-theme="appletv"] .card .teams { padding: 14px 16px 2px; gap: 6px; }
[data-theme="appletv"] .card .team img, [data-theme="appletv"] .card .team .mono { display: none; }
[data-theme="appletv"] .card .team .name { font-size: 16px; }
[data-theme="appletv"] .card .team .score { font-size: 16px; }
[data-theme="appletv"] .card .watch { margin-top: auto; padding: 14px 16px 16px; border-top: 0; gap: 8px; }
[data-theme="appletv"] .card .watch > * { flex: 1 1 100%; }
[data-theme="appletv"] .btn { padding: 10px 14px; border-color: transparent; border-radius: 12px; background: rgba(255, 255, 255, 0.1); color: var(--text); }
[data-theme="appletv"] .btn:hover { background: rgba(255, 255, 255, 0.18); }
[data-theme="appletv"] .btn.included, [data-theme="appletv"] .btn.primary, [data-theme="appletv"] .btn.primary:hover { background: #f5f5f7; color: #000000; filter: none; }
[data-theme="appletv"] .btn.included:hover { background: #ffffff; }
[data-theme="appletv"] .btn.included .hint { color: #3a3a3c; opacity: 1; }
[data-theme="appletv"] .btn.free { background: rgba(100, 210, 255, 0.14); color: #64d2ff; }
[data-theme="appletv"] .btn:focus-visible { outline: 2px solid #f5f5f7; outline-offset: 2px; }
[data-theme="appletv"] .chip-local { background: rgba(255, 255, 255, 0.06); border-color: transparent; }
[data-theme="appletv"] .chip-tv { border-color: rgba(255, 255, 255, 0.16); }

/* Phones: same tvOS look as the iOS TV app — swipeable rows with the next card peeking in */
@media (max-width: 640px) {
  [data-theme="appletv"] .wrap { padding: 0 max(16px, env(safe-area-inset-left)); }
  [data-theme="appletv"] .masthead { grid-template-columns: 1fr auto; gap: 10px; padding: max(10px, env(safe-area-inset-top)) 16px 10px; }
  [data-theme="appletv"] .brand-name { font-size: 21px; }
  [data-theme="appletv"] .kit { grid-column: 2; }
  [data-theme="appletv"] .league-tiles { grid-column: 1 / -1; grid-row: 2; display: grid; grid-template-columns: repeat(3, 1fr); width: 100%; }
  [data-theme="appletv"] .league-tile { justify-content: center; padding: 7px 6px; }
  [data-theme="appletv"] .tile-label { font-size: 14px; white-space: nowrap; }

  [data-theme="appletv"] .hero { min-height: 0; margin-top: 14px; padding: 22px 20px 20px; gap: 12px; flex-direction: column; flex-wrap: nowrap; align-items: stretch; text-align: center; border-radius: 24px; }
  [data-theme="appletv"] .hero > * { min-width: 0; max-width: 100%; }
  [data-theme="appletv"] .hero-logos { justify-content: center; }
  [data-theme="appletv"] .hero-logos img { height: 84px; }
  [data-theme="appletv"] .hero-logos .mono { width: 84px; height: 84px; font-size: 28px; }
  [data-theme="appletv"] .hero-kicker { font-size: 11px; }
  [data-theme="appletv"] .hero-title { font-size: 30px; margin: 6px 0 12px; }
  [data-theme="appletv"] .hero-meta, [data-theme="appletv"] .hero-actions { justify-content: center; }
  [data-theme="appletv"] .stat { font-size: 13px; padding: 6px 12px; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

  [data-theme="appletv"] .day { margin-top: 26px; }
  [data-theme="appletv"] .day-head { font-size: 21px; }
  [data-theme="appletv"] .shelf-nav { display: none; }
  [data-theme="appletv"] .shelf {
    grid-auto-columns: min(82vw, 320px); gap: 14px; scroll-snap-type: x mandatory; scroll-padding-inline: 16px;
    padding: 14px 16px 26px; margin: 0 -16px -10px;
  }
  [data-theme="appletv"] .card { scroll-margin-top: 130px; }
  [data-theme="appletv"] .card:active { --s: 0.97; }
  [data-theme="appletv"] .poster-logo { width: 72px; height: 72px; }
  [data-theme="appletv"] .card .watch .btn { min-height: 44px; justify-content: center; }
}

