/* Full-screen TV layout (16:9). Everything is sized in rem off a viewport-scaled root,
   so the same page fills a 1080p TV, a 4K TV, or a laptop window proportionally. */

:root {
  --bg: #0a0e15;
  --panel: #121925;
  --panel-2: #182131;
  --line: #243045;
  --ink: #e9eef6;
  --ink-2: #b4bfd0;
  --muted: #7c889c;
  --live: #ff4b55;
  --fav: #f3b42c;
  --fav-line: rgba(243, 180, 44, 0.55);
  --fav-bg: rgba(243, 180, 44, 0.14);
  --accent: #5aa9ff;
  --radius: 0.6rem;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html {
  font-size: clamp(9px, 1.45vh, 32px);
  background: var(--bg);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Segoe UI', system-ui, -apple-system, Roboto, sans-serif;
  font-variant-numeric: tabular-nums;
  overflow: hidden;
  cursor: none; /* signage: no stray pointer on screen */
}

img { display: block; object-fit: contain; }
table { border-collapse: collapse; width: 100%; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.warn { color: var(--fav); }
.empty { color: var(--muted); display: grid; place-items: center; height: 100%; font-size: 1.4rem; }

.screen {
  height: 100vh;
  height: 100dvh; /* the visible area, under or between browser bars */
  /* Keep clear of notches, rounded corners and the home indicator (viewport-fit=cover). */
  --pad: 1rem;
  padding: max(var(--pad), env(safe-area-inset-top)) max(var(--pad), env(safe-area-inset-right))
    max(var(--pad), env(safe-area-inset-bottom)) max(var(--pad), env(safe-area-inset-left));
  display: grid;
  gap: 1rem;
  grid-template-columns: 1.65fr 1fr;
  grid-template-rows: auto minmax(0, 1.25fr) minmax(0, 1fr) auto;
  grid-template-areas:
    'header header'
    'top top'
    'grid standings'
    'ticker ticker';
}

/* ------------------------------------------------------------ header */

.header { grid-area: header; display: flex; align-items: baseline; gap: 1.2rem; padding: 0 0.3rem; }
.header .clock { font-size: 2.3rem; font-weight: 700; letter-spacing: -0.02em; }
.header .date { font-size: 1.2rem; color: var(--ink-2); }
.header .spacer { flex: 1; }

.live { display: inline-flex; align-items: center; gap: 0.35em; color: var(--live); font-weight: 700; letter-spacing: 0.05em; }
.live i { width: 0.55em; height: 0.55em; border-radius: 50%; background: var(--live); animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.25; } }

.tag {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 0.15em 0.5em;
  border-radius: 0.3em;
  background: var(--line);
  color: var(--ink-2);
}
.rank { color: var(--muted); font-weight: 600; margin-right: 0.3em; font-size: 0.75em; }

.debug { margin-top: auto; padding-top: 0.5rem; font: 0.75rem/1.3 ui-monospace, Consolas, monospace; color: var(--fav); }

/* ------------------------------------------------------------ big cards (hero + feature) */

/* Top half: equal columns — hero games share the first (columns − 1), the rotating feature
   card takes the last. Hero cards split their space evenly when fewer games are on. */
.top { grid-area: top; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; min-height: 0; }
.hero { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 1rem; min-height: 0; }
/* Rotating cards fill whatever top columns the live games leave (span set from main.js). */
.feature { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 1rem; min-height: 0; }
:is(.layout-md, .layout-pt) .feature { gap: 0.6rem; }
[hidden] { display: none !important; }

/* Wider hero cards (fewer games on): keep the diagrams at a sensible size. */
.big .field { max-width: 32rem; align-self: center; }
.big .rink-fig { max-width: 30rem; align-self: center; width: 100%; }

.slot { display: grid; min-height: 0; animation: fade-in 0.6s ease; }

.big {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.2rem 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  min-height: 0;
  overflow: hidden;
}
.big.fav { border-color: var(--fav-line); }
@keyframes fade-in { from { opacity: 0; } }

.big > header { display: flex; align-items: center; gap: 0.7rem; min-width: 0; }
/* one line: a long note ("ALDS - Game 1") or network trims rather than wrapping */
.big .note { font-weight: 600; color: var(--ink-2); flex: 0 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.big .meta { margin-left: auto; color: var(--muted); font-size: 0.9rem; flex: 0 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.matchup { display: grid; gap: 0.6rem; }
.team-row {
  display: grid;
  grid-template-columns: 3.6rem 1fr auto;
  align-items: center;
  gap: 1rem;
  padding-left: 0.9rem;
  border-left: 0.35rem solid var(--team);
}
.team-row img { width: 3.6rem; height: 3.6rem; }
.team-name { display: flex; flex-direction: column; min-width: 0; }
.team-name span { font-size: 1.75rem; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.team-name small { color: var(--muted); font-size: 1rem; }
.team-score { font-size: 3.4rem; font-weight: 750; min-width: 2ch; text-align: right; line-height: 1; }
.team-row.lost .team-score, .team-row.lost .team-name span { color: var(--muted); }
.poss { color: var(--fav); font-size: 0.7em; vertical-align: middle; }

.big.compact .team-row img { width: 3rem; height: 3rem; }
.big.compact .team-name span { font-size: 1.4rem; }
.big.compact .team-score { font-size: 2.6rem; }

.status { font-size: 1.25rem; font-weight: 600; color: var(--ink-2); display: flex; gap: 0.8rem; align-items: baseline; }
.status.in { color: var(--ink); }
.status small { color: var(--muted); font-weight: 500; font-size: 0.95rem; }

.extras { display: flex; gap: 1.6rem; align-items: center; flex-wrap: wrap; }

.linescore { width: auto; font-size: 1rem; }
.linescore th, .linescore td { padding: 0.2rem 0.55rem; text-align: center; }
.linescore thead th { color: var(--muted); font-weight: 500; font-size: 0.85rem; }
.linescore tbody th { text-align: left; color: var(--ink-2); }

.diamond { display: flex; align-items: center; gap: 0.9rem; }
.diamond svg { width: 4.5rem; }
.diamond rect { fill: none; stroke: var(--muted); stroke-width: 1.5; }
.diamond rect.on { fill: var(--fav); stroke: var(--fav); }
.count div { display: flex; align-items: center; gap: 0.3rem; font-size: 0.85rem; color: var(--muted); }
.count span { width: 1em; }
.count i { width: 0.7rem; height: 0.7rem; border-radius: 50%; border: 1.5px solid var(--muted); }
.count i.ball { background: #4cc38a; border-color: #4cc38a; }
.count i.strike, .count i.out { background: var(--live); border-color: var(--live); }

.down { font-size: 1.2rem; font-weight: 600; white-space: nowrap; } /* red text = red zone (the field shades it too) */

/* Hockey rink shot map (SVG units: feet from center ice, 200 × 85). */
.rink { display: block; width: 100%; max-width: 34rem; flex-shrink: 0; }
.rink-fig { margin: 0; display: flex; flex-direction: column; gap: 0.3rem; flex: 0 1 auto; min-height: 0; }
.rink-fig .rink { max-width: none; min-height: 0; flex: 0 1 auto; }
.rink-fig figcaption { font-size: 0.8rem; color: var(--muted); display: flex; align-items: center; gap: 0.35rem; }
.rink-fig .lg { width: 0.6rem; height: 0.6rem; border-radius: 50%; display: inline-block; margin-left: 0.5rem; }
.rink-fig .lg:first-child { margin-left: 0; }
.rink .ice { fill: #1a2535; stroke: #3b4c66; stroke-width: 1; }
.rink line, .rink .crease, .rink circle.red, .rink circle.blue { fill: none; stroke-width: 0.5; }
.rink .redline, .rink .goalline, .rink circle.red { stroke: rgba(255, 75, 85, 0.5); }
.rink .redline { stroke-width: 1; }
.rink .blueline { stroke: rgba(90, 169, 255, 0.55); stroke-width: 1.2; }
.rink circle.blue { stroke: rgba(90, 169, 255, 0.45); }
.rink circle.dot { stroke: none; fill: rgba(255, 75, 85, 0.5); }
.rink circle.dot.blue { fill: rgba(90, 169, 255, 0.45); }
.rink .crease { fill: rgba(90, 169, 255, 0.15); stroke: rgba(255, 75, 85, 0.5); }
.rink .net { fill: none; stroke: rgba(255, 255, 255, 0.35); stroke-width: 0.5; }
.rink text.team { fill: var(--ink); font-size: 8px; font-weight: 700; }
.rink text.team tspan { fill: var(--muted); font-weight: 600; }
.rink circle.shot, .rink-fig .lg.shot { fill: #d6deea; }
.rink circle.shot { stroke: #1a2535; stroke-width: 0.5; }
.rink circle.miss { fill: none; stroke: #8a96ab; stroke-width: 0.6; }
.rink-fig .lg.miss { border: 1.5px solid #8a96ab; }
.rink circle.goal, .rink-fig .lg.goal { fill: var(--fav); background: var(--fav); }
.rink circle.goal { stroke: #1a2535; stroke-width: 0.8; }
.rink-fig .lg.shot { background: #d6deea; }

/* Football field (SVG units: 120 × 20, end zones 10 wide). */
.field { display: block; width: 100%; max-width: 30rem; flex-shrink: 0; border-radius: 0.3rem; }
.big .extras { gap: 1rem; }
.field .turf { fill: #1e4a30; }
.field .rz { fill: rgba(255, 75, 85, 0.22); }
.field line { stroke: rgba(255, 255, 255, 0.28); stroke-width: 0.3; }
.field line.mid { stroke: rgba(255, 255, 255, 0.55); }
.field text { fill: rgba(255, 255, 255, 0.5); font-size: 3px; text-anchor: middle; font-weight: 700; }
.field text.ez { font-size: 4.2px; dominant-baseline: central; letter-spacing: 0.3px; }
.field line.los { stroke: var(--accent); stroke-width: 0.7; }
.field line.first { stroke: var(--fav); stroke-width: 0.7; }
.field .ball { fill: #9a5a2c; stroke: #fff; stroke-width: 0.3; }
.field .dir { fill: #fff; }
.down.redzone { color: var(--live); }

.last-play {
  color: var(--ink-2);
  font-size: 1rem;
  line-height: 1.35;
  border-top: 1px solid var(--line);
  padding-top: 0.7rem;
  margin-top: auto;
  flex-shrink: 0;
}


.event-title { margin: 0; font-size: 1.7rem; }

.leaderboard { font-size: 1.05rem; }
.leaderboard th { color: var(--muted); font-weight: 500; font-size: 0.85rem; text-align: left; padding: 0 0.4rem 0.3rem; }
.leaderboard td { padding: 0.28rem 0.4rem; border-top: 1px solid var(--line); }
.leaderboard .num { text-align: right; }
.leaderboard .strong { font-weight: 700; }
.leaderboard .pos { color: var(--muted); width: 3ch; }
.leaderboard .player { display: flex; align-items: center; gap: 0.5rem; }
.leaderboard tr.fav td { background: var(--fav-bg); font-weight: 700; }
.leaderboard .player img { width: 1.3rem; height: 0.9rem; object-fit: cover; border-radius: 2px; }

.sessions { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 0.5rem; }
.sessions li { background: var(--panel-2); border-radius: 0.4rem; padding: 0.4rem 0.7rem; font-size: 0.95rem; color: var(--ink-2); }
.sessions li span { font-weight: 700; margin-right: 0.4rem; color: var(--ink); }
.sessions li.post { opacity: 0.5; }
.sessions li.current { outline: 2px solid var(--accent); }
.big h3 { margin: 0; font-size: 1rem; color: var(--muted); font-weight: 600; }
.results { margin: 0; padding-left: 1.6rem; columns: 2; font-size: 1.05rem; line-height: 1.6; }

/* ------------------------------------------------------------ scoreboard grid */

.grid {
  grid-area: grid;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(11.5rem, 1fr));
  grid-auto-rows: min-content;
  gap: 0.7rem;
  min-height: 0;
  overflow: hidden;
  align-content: start;
}
.mini {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.55rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.mini.fav { border-color: var(--fav-line); }
.mini.post { opacity: 0.75; }
.mini-head { display: flex; justify-content: space-between; align-items: center; font-size: 0.8rem; color: var(--muted); gap: 0.4rem; white-space: nowrap; overflow: hidden; }
.mini-head .live { margin-right: 0.4rem; font-size: 0.75rem; }
.mini-row { display: flex; align-items: center; gap: 0.5rem; font-size: 1.1rem; font-weight: 600; min-width: 0; }
.mini-row img { width: 1.5rem; height: 1.5rem; }
.mini-row span { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-row b { font-size: 1.25rem; }
.mini-row.lost { color: var(--muted); }

/* ------------------------------------------------------------ standings */

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.2rem; min-height: 0; overflow: hidden; }
.standings-panel { grid-area: standings; display: flex; flex-direction: column; gap: 0.6rem; }
.standings-panel header { display: flex; align-items: center; gap: 0.7rem; }
.standings-panel h2 { margin: 0; font-size: 1.25rem; }
.standings { font-size: 1rem; }
.standings th { color: var(--muted); font-weight: 500; font-size: 0.8rem; padding: 0 0.4rem 0.3rem; }
.standings td { padding: 0.3rem 0.4rem; border-top: 1px solid var(--line); }
.standings .num { text-align: right; }
.standings .pos { color: var(--muted); width: 2ch; }
.standings .team { display: flex; align-items: center; gap: 0.5rem; white-space: nowrap; }
.standings .team img { width: 1.4rem; height: 1.4rem; }
.standings tr.fav td { background: var(--fav-bg); font-weight: 700; }

/* ------------------------------------------------------------ ticker */

.ticker {
  grid-area: ticker;
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.6rem 0;
  white-space: nowrap;
}
.ticker-track { display: inline-flex; animation: scroll linear infinite; animation-duration: 120s; }
.tk-run { display: inline-flex; align-items: center; gap: 1.4rem; padding-right: 1.4rem; font-size: 1.15rem; }
@keyframes scroll { to { transform: translateX(-50%); } }
.tk-league { font-weight: 800; color: var(--accent); letter-spacing: 0.05em; }
.tk-game em { color: var(--muted); font-style: normal; font-size: 0.9em; margin-left: 0.3em; }
.tk-game.fav { color: var(--fav); font-weight: 700; }
.tk-news { display: inline-flex; align-items: center; gap: 0.6rem; color: var(--ink-2); }
.tk-sep { color: var(--line); }

/* ------------------------------------------------------------ my teams */

.myteams { font-size: 1rem; }
.myteams td { padding: 0.3rem 0.4rem; border-top: 1px solid var(--line); vertical-align: middle; white-space: nowrap; }
.myteams tr td:first-child { border-left: 0.3rem solid var(--team); }
.myteams .team { display: flex; align-items: center; gap: 0.5rem; font-weight: 650; font-size: 1.1rem; }
.myteams .team img { width: 1.8rem; height: 1.8rem; }
.myteams small { display: block; color: var(--muted); font-size: 0.8rem; }
.myteams .games { color: var(--ink-2); }
.myteams .games small { margin-top: 0.1rem; }
.myteams .res { font-weight: 800; }
.myteams .res.W { color: #4cc38a; }
.myteams .res.L { color: var(--live); }

/* ------------------------------------------------------------ tablet (Fire HD landscape, ~960–1280 CSS px) */

/* Sized from width: a tablet's height shrinks under browser bars, which made text tiny. */
html.layout-md { font-size: clamp(11px, 1.3vw, 15px); }
:is(.layout-md, .layout-pt) .screen { --pad: 0.6rem; gap: 0.6rem; grid-template-columns: 1.45fr 1fr; }
:is(.layout-md, .layout-pt) .header .clock { font-size: 1.9rem; }
:is(.layout-md, .layout-pt) .big { padding: 0.9rem 1rem; gap: 0.6rem; }
:is(.layout-md, .layout-pt) .top { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.6rem; }
:is(.layout-md, .layout-pt) .hero { gap: 0.6rem; }
:is(.layout-md, .layout-pt) .team-row { grid-template-columns: 2.8rem 1fr auto; gap: 0.7rem; }
:is(.layout-md, .layout-pt) .team-row img { width: 2.8rem; height: 2.8rem; }
:is(.layout-md, .layout-pt) .team-name span { font-size: 1.5rem; }
:is(.layout-md, .layout-pt) .team-score { font-size: 2.8rem; }
/* Two lines tall; longer plays scroll through and loop (main.js setupScrolling). */
.last-play .scroll-region { flex: none; max-height: calc(2 * 1.35em); }
:is(.layout-md, .layout-pt) .grid { grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr)); gap: 0.5rem; }
:is(.layout-md, .layout-pt) .myteams td { padding: 0.35rem 0.3rem; }

/* Week schedule: one column per day. */
.week { flex: 1; min-height: 0; display: grid; grid-template-columns: repeat(var(--days), minmax(0, 1fr)); gap: 0.8rem; }
.day { min-height: 0; display: flex; flex-direction: column; gap: 0.5rem; border-top: 3px solid var(--line); padding-top: 0.5rem; }
.day.today { border-top-color: var(--accent); }
.day h3 { margin: 0; font-size: 1.15rem; display: flex; flex-direction: column; }
.day h3 small { color: var(--muted); font-weight: 500; font-size: 0.8rem; }
.day ol { list-style: none; margin: 0; padding: 0; flex: 1; min-height: 0; overflow: hidden; display: flex; flex-direction: column; gap: 0.35rem; }
.day li { background: var(--panel-2); border-radius: 0.4rem; padding: 0.35rem 0.55rem; display: flex; flex-direction: column; gap: 0.15rem; border-left: 3px solid transparent; }
.day li.fav { border-left-color: var(--fav); background: var(--fav-bg); }
.day li.post { opacity: 0.6; }
.day li.none { color: var(--muted); background: none; }
.day .when { display: flex; align-items: center; gap: 0.4rem; font-size: 0.8rem; color: var(--muted); white-space: nowrap; overflow: hidden; }
.day .when .tag { font-size: 0.65rem; }
.day .when .tv { margin-left: auto; overflow: hidden; text-overflow: ellipsis; }
.day .match { display: flex; align-items: center; gap: 0.3rem; font-size: 1rem; white-space: nowrap; }
.day .match img { width: 1.25rem; height: 1.25rem; }
.day .match .at { color: var(--muted); font-size: 0.8rem; margin: 0 0.15rem; }
.day .match .sc { font-weight: 700; margin-left: 0.15rem; }
.day .event { font-size: 0.95rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Playoff bracket: one league per card — Wild Card → Division → LCS, World Series below. */
.bracket { flex: 1; min-height: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.6rem; }
.ws-row { display: flex; flex-direction: column; gap: 0.3rem; max-width: 60%; align-self: center; width: 100%; }
.ws-row h4 { margin: 0; font-size: 0.75rem; color: var(--fav); text-transform: uppercase; letter-spacing: 0.05em; text-align: center; }
.ws-row .series { border-color: var(--fav-line); }
.bcol { display: flex; flex-direction: column; min-height: 0; }
.bcol h4 { margin: 0 0 0.4rem; font-size: 0.8rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; text-align: center; }
.bcol.ws h4 { color: var(--fav); }
.bslots { flex: 1; display: flex; flex-direction: column; justify-content: space-around; gap: 0.6rem; }
.series { background: var(--panel-2); border: 1px solid var(--line); border-radius: 0.5rem; padding: 0.35rem 0.5rem; display: flex; flex-direction: column; gap: 0.15rem; }
.bcol.ws .series { border-color: var(--fav-line); }
.bt { display: grid; grid-template-columns: 1.1rem 1.6rem 1fr auto; align-items: center; gap: 0.35rem; font-size: 1.05rem; font-weight: 650; min-height: 1.8rem; }
.bt img { width: 1.6rem; height: 1.6rem; }
.bt .seed { color: var(--muted); font-size: 0.75rem; text-align: right; }
.bt .wins { font-weight: 800; min-width: 1ch; text-align: right; }
.bt.won .name, .bt.won .wins { color: var(--ink); }
.bt.lost { color: var(--muted); }
.bt.lost img { opacity: 0.45; }
.bt.fav .name { color: var(--fav); }
.bt.tbd { color: var(--muted); font-weight: 500; font-size: 0.9rem; grid-template-columns: 1.1rem 1fr; }
.series .ss { font-size: 0.75rem; color: var(--muted); border-top: 1px solid var(--line); padding-top: 0.2rem; min-height: 1em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

:is(.layout-md, .layout-pt) .week, .layout-sm .week { gap: 0.4rem; }
:is(.layout-md, .layout-pt) .day li, .layout-sm .day li { padding: 0.25rem 0.35rem; }
:is(.layout-md, .layout-pt) .day .match, .layout-sm .day .match { font-size: 0.95rem; gap: 0.25rem; }
:is(.layout-md, .layout-pt) .day .match img, .layout-sm .day .match img { width: 1.15rem; height: 1.15rem; }
:is(.layout-md, .layout-pt, .layout-sm) .day:not(.pinned) .when .tv { display: none; } /* pinned favorites keep theirs */
:is(.layout-md, .layout-pt) .bracket, .layout-sm .bracket { gap: 0.4rem; }
:is(.layout-md, .layout-pt) .bt, .layout-sm .bt { grid-template-columns: 0.8rem 1.2rem 1fr auto; font-size: 0.9rem; gap: 0.25rem; min-height: 1.4rem; }
:is(.layout-md, .layout-pt) .bt img, .layout-sm .bt img { width: 1.2rem; height: 1.2rem; }
:is(.layout-md, .layout-pt) .bcol h4, .layout-sm .bcol h4 { font-size: 0.65rem; }

/* ------------------------------------------------------------ layouts (see layout.js) */

/* Tablet (md): header + three cards across — up to two live games, the rest rotating. No
   scoreboard grid, side panel or ticker; their content rotates through the cards instead. */
:is(.layout-md, .layout-pt) .screen, .layout-sm .screen { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); grid-template-areas: 'header' 'top'; }
:is(.layout-md, .layout-pt) .grid, :is(.layout-md, .layout-pt) .standings-panel, :is(.layout-md, .layout-pt) .ticker,
.layout-sm .grid, .layout-sm .standings-panel, .layout-sm .ticker { display: none; }

/* One card (sm): a single rotating slot fills the screen. */
html.layout-sm { font-size: clamp(11px, min(3.6vw, 2.2vh), 22px); }
.layout-sm .screen { --pad: 0.6rem; gap: 0.6rem; }
.layout-sm .header { gap: 0.6rem; flex-wrap: wrap; }
.layout-sm .header .clock { font-size: 1.8rem; }
.layout-sm .header .small { display: none; }
.layout-sm .top { grid-template-columns: minmax(0, 1fr); }
.layout-sm .big { padding: 1rem; }

/* ------------------------------------------------------------ rotating info cards */

.info-card { gap: 0.7rem; }
.info-card > header { display: flex; align-items: baseline; gap: 0.7rem; }
.info-card > header h2 { margin: 0; font-size: 1.3rem; }
.info-card > header .tag { align-self: center; }
.info-card .standings, .info-card .myteams { font-size: 0.95rem; }
.info-card .myteams td { white-space: normal; }

.news { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.6rem; min-height: 0; overflow: hidden; }
.news li { display: grid; grid-template-columns: 6.5rem minmax(0, 1fr); gap: 0.7rem; align-items: start; }
.news li.fav p { color: var(--ink); }
.news img, .news .noimg { width: 6.5rem; aspect-ratio: 16 / 9; border-radius: 0.35rem; object-fit: cover; background: var(--panel-2); }
.news .meta { display: flex; align-items: center; gap: 0.4rem; font-size: 0.75rem; color: var(--muted); }
.news p { margin: 0.2rem 0 0; font-size: 1rem; line-height: 1.3; color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

.mini-grid { flex: 1; min-height: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr)); grid-auto-rows: min-content; gap: 0.5rem; overflow: hidden; align-content: start; }


/* Slots never grow past their column, whatever their content's natural width. */
.slot { grid-template-columns: minmax(0, 1fr); }
.slot > * { min-width: 0; }

/* ------------------------------------------------------------ Fire tablet (Silk browser) */

/* The page is one browser-bar taller than the visible area: 100vh in Chromium browsers is the
   height with the bar hidden, so a swipe up scrolls the bar away and the dashboard then fits
   exactly. No visible scroll bar. Other devices keep overflow hidden (no scrolling). */
.device-fire body { overflow-y: auto; scrollbar-width: none; }
.device-fire body::-webkit-scrollbar { display: none; }
.device-fire .screen { height: 100vh; height: 100lvh; }
.device-fire.is-fullscreen .screen { height: 100vh; }

.fs-hint { display: none; color: var(--muted); font-size: 0.8rem; border: 1px solid var(--line); border-radius: 1rem; padding: 0.1rem 0.6rem; }
.device-fire:not(.is-fullscreen) .fs-hint { display: block; }

/* ------------------------------------------------------------ pre-game card */

.team-odds { font-size: 1.3rem; font-weight: 700; color: var(--ink-2); min-width: 3.5ch; text-align: right; }
.pregame { flex: 1; min-height: 0; overflow: hidden; display: flex; flex-direction: column; gap: 0.7rem; }
.pg { flex-shrink: 0; }
.pg h4 { margin: 0 0 0.3rem; font-size: 0.75rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; }
.pg.odds { display: flex; align-items: baseline; gap: 1.4rem; padding: 0.5rem 0.7rem; background: var(--panel-2); border-radius: 0.4rem; }
.pg.odds span { display: flex; align-items: baseline; gap: 0.4rem; }
.pg.odds small { color: var(--muted); font-size: 0.8rem; }
.pg.odds b { font-size: 1.1rem; }
.pg.odds .muted { margin-left: auto; font-size: 0.75rem; }
.pg.venue { color: var(--ink-2); font-size: 0.95rem; }
.starter { display: flex; align-items: center; gap: 0.6rem; padding: 0.2rem 0; }
.starter img { width: 2.4rem; height: 2.4rem; border-radius: 50%; object-fit: cover; background: var(--panel-2); }
.starter b { font-size: 1rem; }
.starter small { font-size: 0.8rem; }
.starter .muted { display: block; }
.pg.form > div { display: flex; align-items: center; gap: 0.6rem; font-size: 0.95rem; padding: 0.1rem 0; }
.pg.form b { width: 3.2ch; }
.chips { display: flex; gap: 0.25rem; }
.chips i { font-style: normal; font-size: 0.75rem; font-weight: 700; width: 1.5rem; height: 1.5rem; display: grid; place-items: center; border-radius: 0.3rem; background: var(--panel-2); color: var(--muted); }
.chips i.r-W { background: rgba(76, 195, 138, 0.18); color: #4cc38a; }
.chips i.r-L { background: rgba(255, 75, 85, 0.15); color: var(--live); }
.pg.leaders table { font-size: 0.9rem; }
.pg.leaders th, .pg.leaders td { padding: 0.15rem 0.3rem; text-align: left; vertical-align: top; }
.pg.leaders thead th { color: var(--muted); font-weight: 600; font-size: 0.8rem; }
.pg.leaders tbody th { color: var(--muted); font-weight: 500; font-size: 0.8rem; white-space: nowrap; }
.pg.leaders td b { color: var(--ink); }
.pg.out, .pg.series { font-size: 0.9rem; color: var(--ink-2); }
.pg.out b { color: var(--ink); margin-right: 0.3rem; }

/* Upcoming games have no score yet: tighter team rows leave room for the pre-game detail. */
.big.pre { gap: 0.6rem; }
.big.pre .matchup { gap: 0.4rem; }
.big.pre .team-row { grid-template-columns: 2.8rem 1fr auto; }
.big.pre .team-row img { width: 2.8rem; height: 2.8rem; }
.big.pre .team-name span { font-size: 1.45rem; }
.big.pre .status { font-size: 1.1rem; }
.big.pre .starter img { width: 2rem; height: 2rem; }
.big.pre .starter { padding: 0.1rem 0; }
.big.pre .pregame { gap: 0.55rem; }
.pg.leaders td { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 0; width: 45%; }

/* "Next up" under short standings tables (NFL divisions). */
.next-up { margin-top: 0.4rem; }
.next-up h4 { margin: 0 0 0.3rem; font-size: 0.75rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; }
.next-up ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.25rem; }
.next-up li { display: grid; grid-template-columns: 4.6rem 5.4rem minmax(0, 1fr) auto; align-items: center; gap: 0.5rem; font-size: 0.95rem; padding: 0.25rem 0.4rem; border-radius: 0.35rem; background: var(--panel-2); white-space: nowrap; }
.next-up li.fav { background: var(--fav-bg); }
.next-up img { width: 1.25rem; height: 1.25rem; display: inline-block; vertical-align: middle; margin-right: 0.3rem; }
.next-up .nu-team { font-weight: 700; }
.next-up .nu-opp { color: var(--ink-2); }
.next-up .nu-when { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; }
.next-up .nu-tv { font-size: 0.8rem; }
.next-up li > .muted:nth-child(2) { grid-column: 2 / -1; }

/* ------------------------------------------------------------ golf card */

.event-title .major { font-size: 0.7rem; vertical-align: middle; margin-right: 0.5rem; padding: 0.15em 0.5em; border-radius: 0.3em; background: var(--fav); color: #1a1a1a; letter-spacing: 0.05em; text-transform: uppercase; }
.watch { display: flex; gap: 0.6rem; align-items: baseline; padding: 0.45rem 0.7rem; border-radius: 0.4rem; background: var(--panel-2); border-left: 3px solid var(--accent); font-size: 0.95rem; color: var(--ink); }
.watch b { color: var(--accent); text-transform: uppercase; font-size: 0.75rem; letter-spacing: 0.06em; }
.watch.hot { border-left-color: var(--live); background: rgba(255, 75, 85, 0.12); }
.watch.hot b { color: var(--live); }
.sub-view { flex: 1; min-height: 0; overflow: hidden; display: flex; flex-direction: column; gap: 0.4rem; animation: fade-in 0.5s ease; }
.sub-view h3 { margin: 0; font-size: 0.8rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; display: flex; gap: 0.6rem; align-items: baseline; }
.sub-view h3 small { text-transform: none; letter-spacing: 0; font-weight: 500; }
.dots { display: flex; justify-content: center; gap: 0.35rem; }
.dots i { width: 0.45rem; height: 0.45rem; border-radius: 50%; background: var(--line); }
.dots i.on { background: var(--ink-2); }

.golf-lb td { padding: 0.22rem 0.35rem; }
.golf-lb .mvc { width: 2.4rem; padding: 0; }
.mv { font-size: 0.7rem; font-weight: 700; }
.mv.up { color: #4cc38a; }
.mv.down { color: var(--live); }
.golf-lb .player { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 0; width: 100%; }
:is(.golf-lb, .f1-tower) tr.cutline td { padding: 0.15rem 0; border-top: 2px dashed var(--fav); }
:is(.golf-lb, .f1-tower) tr.cutline span { font-size: 0.7rem; color: var(--fav); text-transform: uppercase; letter-spacing: 0.05em; }

.fav-golfer { padding: 0.35rem 0; border-top: 1px solid var(--line); }
.fg-head { display: flex; align-items: center; gap: 0.5rem; font-size: 0.95rem; white-space: nowrap; overflow: hidden; }
.fg-head img { width: 1.8rem; height: 1.8rem; border-radius: 50%; object-fit: cover; background: var(--panel-2); }
.fg-head .pos { color: var(--muted); margin-left: auto; }
.fg-head .strong { font-weight: 800; }
.strip { display: flex; gap: 0.5rem; margin-top: 0.3rem; }
.strip > span { display: grid; grid-template-columns: repeat(9, 1fr); gap: 2px; flex: 1; }
.strip i { font-style: normal; font-size: 0.7rem; font-weight: 700; height: 1.25rem; display: grid; place-items: center; border-radius: 3px; background: var(--panel-2); color: var(--muted); }
.strip i.birdie { background: rgba(76, 195, 138, 0.25); color: #4cc38a; }
.strip i.eagle { background: var(--fav); color: #1a1a1a; }
.strip i.par { color: var(--ink-2); }
.strip i.bogey { background: rgba(255, 75, 85, 0.15); color: #ff8a90; }
.strip i.double { background: rgba(255, 75, 85, 0.35); color: #fff; }
.strip i.cur { outline: 2px solid var(--accent); outline-offset: -2px; }

.best { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.45rem; }
.best li { display: grid; grid-template-columns: 3.4rem minmax(0, 1fr); align-items: center; gap: 0.6rem; padding: 0.3rem 0.5rem; border-radius: 0.4rem; background: var(--panel-2); }
.best li.fav { background: var(--fav-bg); }
.best .today { font-size: 1.5rem; text-align: center; color: #4cc38a; }
.best .name { font-weight: 700; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.best small { display: block; color: var(--muted); font-size: 0.8rem; }
.best .streak { color: var(--fav); }

.course { display: flex; flex-direction: column; gap: 0.35rem; }
.course .cname { font-weight: 700; font-size: 1.1rem; }
.course .holes { display: grid; grid-template-columns: repeat(9, 1fr); gap: 3px; margin-top: 0.3rem; }
.course .holes i { font-style: normal; display: flex; flex-direction: column; align-items: center; padding: 0.2rem 0; border-radius: 4px; background: var(--panel-2); }
.course .holes i b { font-size: 1rem; }
.course .holes i small { font-size: 0.6rem; color: var(--muted); }
.course .holes i.hard { background: rgba(255, 75, 85, 0.18); }
.course .holes i.easy { background: rgba(76, 195, 138, 0.18); }
.golf-lb td.player { display: table-cell; }
.golf-lb td.num { white-space: nowrap; }

.fg-head .why { font-size: 0.65rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; padding: 0.1em 0.45em; border-radius: 0.3em; background: var(--panel-2); color: var(--muted); }
.fg-head .why.favorite { background: var(--fav-bg); color: var(--fav); }
.fg-head .why.hot { color: #4cc38a; }
.fav-golfer.favorite .fg-head b { color: var(--fav); }
/* Denser golf lists so a top-15 leaderboard and six golfers fit a card. */
.golf-lb { font-size: 0.9rem; }
.golf-lb td { padding: 0.1rem 0.35rem; }
.golf-lb thead th { padding-bottom: 0.15rem; }
.fav-golfer { padding: 0.25rem 0; }
.fg-head { font-size: 0.9rem; }
.fg-head img { width: 1.5rem; height: 1.5rem; }
.strip { margin-top: 0.2rem; }
.strip i { height: 1.05rem; font-size: 0.65rem; }

/* ------------------------------------------------------------ slow-scrolling lists */

/* A list taller than its card scrolls via main.js setupScrolling (Web Animations API). */
.scroll-region { flex: 1 1 auto; min-height: 0; overflow: hidden; }
.day.pinned { flex: none; border-top: none; padding-top: 0; }
.day.pinned ol { overflow: visible; }

/* Day cards: the non-favorite games as two-wide score boxes (scrolling). */
.day-boxes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.45rem; }
.day-boxes .mini { padding: 0.45rem 0.6rem; }
.scroll-content > .news { overflow: visible; }

/* Playoff picture cards */
.playoff-picture td { padding: 0.22rem 0.35rem; }
.playoff-picture .note { text-align: right; white-space: nowrap; color: var(--muted); font-size: 0.8rem; }
.playoff-picture .clinch { font-weight: 800; color: var(--fav); }
.playoff-picture small { color: var(--muted); font-size: 0.75rem; }
.playoff-picture tr.po-divider td { padding: 0.35rem 0 0.15rem; border-top: 2px dashed var(--line); }
.playoff-picture tr.po-divider span { font-size: 0.7rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; }

/* Golf "Field by score" histogram */
.hist { display: flex; flex-direction: column; gap: 2px; }
.h-row { display: grid; grid-template-columns: 2.4rem minmax(0, 1fr) 1.6rem minmax(0, 6.5rem); align-items: center; gap: 0.4rem; font-size: 0.8rem; min-height: 1rem; }
.h-score { text-align: right; color: var(--ink-2); font-weight: 600; }
.h-track { height: 0.75rem; display: flex; gap: 2px; }
.h-track i { display: block; height: 100%; min-width: 3px; }
.h-track i:last-child { border-radius: 0 3px 3px 0; }
/* Round progress, a three-step ramp (validated: adjacent ΔE ≥ 15.9 incl. CVD, ≥ 3:1 vs the card). */
.hist .fin { background: #a3d3ff; }
.hist .back { background: #5b9ff0; }
.hist .front { background: #356bb0; }
.h-legend { display: flex; gap: 0.8rem; justify-content: flex-end; font-size: 0.7rem; color: var(--muted); margin-bottom: 0.2rem; }
.h-legend span { display: inline-flex; align-items: center; gap: 0.3rem; }
.h-legend i { width: 0.65rem; height: 0.65rem; border-radius: 2px; display: inline-block; }
.h-count { color: var(--ink-2); font-weight: 600; }
.h-note { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 0.75rem; }
.h-row.fav .h-note { color: var(--fav); font-weight: 700; }
.h-row.out .h-track { opacity: 0.4; }
.h-row.out .h-score, .h-row.out .h-count { color: var(--muted); }
.h-cut { border-top: 2px dashed var(--fav); margin: 3px 0 1px; display: flex; justify-content: flex-end; }
.h-cut span { font-size: 0.65rem; color: var(--fav); text-transform: uppercase; letter-spacing: 0.05em; margin-top: 1px; }

/* ------------------------------------------------------------ portrait (pt): two stacked cards */

html.layout-pt { font-size: clamp(11px, 3.3vw, 16px); }
.layout-pt .top { grid-template-columns: minmax(0, 1fr); grid-template-rows: repeat(2, minmax(0, 1fr)); }
.layout-pt .hero, .layout-pt .feature { grid-column: 1; grid-auto-flow: row; grid-auto-rows: minmax(0, 1fr); grid-auto-columns: auto; }
.layout-pt .header { flex-wrap: wrap; gap: 0.6rem; }
.layout-pt .header .small { display: none; }
/* A phone already shows the time: drop the clock and date, keep the live count. */
@media (max-width: 499px) {
  .layout-pt .header .clock, .layout-pt .header .date { display: none; }
  .layout-pt .header { font-size: 0.85rem; }
}

/* ------------------------------------------------------------ lg: TV layout, three top cards */
.layout-lg .top { grid-template-columns: repeat(3, minmax(0, 1fr)); }

/* Post-game cards: score on top, the summary scrolls below */
.postgame { display: flex; flex-direction: column; gap: 0.9rem; }
.pg.recap { font-size: 1.05rem; font-weight: 600; color: var(--ink); line-height: 1.3; }
.pg.scoring h4 small { text-transform: none; letter-spacing: 0; margin-left: 0.3rem; }
.sc-period { font-size: 0.75rem; color: var(--muted); font-weight: 600; margin: 0.4rem 0 0.15rem; padding-bottom: 0.1rem; border-bottom: 1px solid var(--line); }
.sc-row { display: grid; grid-template-columns: 1.6rem minmax(0, 1fr) auto; gap: 0.6rem; align-items: center; padding: 0.3rem 0 0.3rem 0.5rem; border-left: 3px solid var(--team); margin: 0.2rem 0; }
.sc-row img { width: 1.6rem; height: 1.6rem; object-fit: contain; }
.sc-who { display: flex; flex-direction: column; min-width: 0; font-size: 0.95rem; line-height: 1.25; }
.sc-who small { color: var(--muted); font-size: 0.8rem; }
.sc-tag { font-style: normal; font-size: 0.7rem; font-weight: 700; color: var(--ink-2); background: var(--panel-2); border-radius: 0.25rem; padding: 0.05rem 0.3rem; margin-left: 0.2rem; }
.sc-meta { display: flex; flex-direction: column; align-items: flex-end; font-variant-numeric: tabular-nums; }
.sc-meta small { color: var(--muted); font-size: 0.8rem; }
.pg.stars table, .pg.team-stats table { width: 100%; font-size: 0.92rem; border-collapse: collapse; }
.pg.stars th { color: var(--muted); font-weight: 500; font-size: 0.8rem; text-align: left; white-space: nowrap; padding: 0.2rem 0.4rem 0.2rem 0; }
.pg.stars td { padding: 0.2rem 0.3rem; }
.pg.stars .st-team { width: 1.6rem; }
.pg.stars img, .pg.team-stats img { width: 1.3rem; height: 1.3rem; object-fit: contain; vertical-align: middle; margin: 0 0.3rem; }
.pg.team-stats td { width: 30%; padding: 0.22rem 0.3rem; font-variant-numeric: tabular-nums; font-weight: 600; }
.pg.team-stats td:first-child { text-align: left; }
.pg.team-stats td:last-child { text-align: right; }
.pg.team-stats th { color: var(--muted); font-weight: 500; font-size: 0.82rem; text-align: center; }
.pg.team-stats thead td { color: var(--muted); font-weight: 600; font-size: 0.82rem; }
.pg.team-stats tbody tr + tr td, .pg.team-stats tbody tr + tr th { border-top: 1px solid var(--line); }
.pg.team-stats .ts-team { display: inline-flex; align-items: center; gap: 0.35rem; white-space: nowrap; }
.pg.team-stats .ts-team img { display: inline-block; margin: 0; }

/* ------------------------------------------------------------ F1 live card */
.f1-tower td { padding: 0.22rem 0.35rem; white-space: nowrap; }
.f1-tower tr.ko td { opacity: 0.5; }
.f1-tower .mvc { width: 2.4ch; padding: 0; }
.drv { display: inline-flex; align-items: baseline; gap: 0.4rem; padding-left: 0.45rem; border-left: 3px solid var(--team); min-width: 0; }
.drv small { color: var(--muted); font-size: 0.78rem; overflow: hidden; text-overflow: ellipsis; }
.tyre { display: inline-grid; place-items: center; width: 1.2rem; height: 1.2rem; border-radius: 50%; border: 2px solid currentColor; font-size: 0.62rem; font-weight: 800; font-style: normal; margin-right: 0.25rem; vertical-align: middle; }
.tyre.t-soft { color: #e8002d; } .tyre.t-medium { color: #ffd12e; } .tyre.t-hard { color: #f0f0ec; }
.tyre.t-intermediate { color: #43b02a; } .tyre.t-wet { color: #2b8be0; }
.f1-fav { display: grid; grid-template-columns: 3.4rem 1fr; gap: 0.7rem; align-items: center; padding: 0.5rem 0.6rem; margin-bottom: 0.5rem; border-left: 4px solid var(--team); background: var(--panel-2); border-radius: 0.35rem; }
.f1-fav .pos { font-size: 1.7rem; }
.f1-fav .name { font-weight: 700; font-size: 1.1rem; }
.f1-fav small { display: block; color: var(--ink-2); font-size: 0.85rem; margin-top: 0.15rem; }
.f1-battles { list-style: none; margin: 0; padding: 0; }
.f1-battles li { display: flex; align-items: baseline; gap: 0.6rem; padding: 0.35rem 0.2rem; border-top: 1px solid var(--line); }
.f1-battles li.fav { background: var(--fav-bg); }
.f1-battles .pos { color: var(--muted); width: 3ch; }
.f1-battles .gap { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--accent); }
.f1-stints { width: 100%; font-size: 0.85rem; }
.f1-stints td { padding: 0.12rem 0.3rem; white-space: nowrap; }
.f1-stints .pos { color: var(--muted); width: 2.5ch; }
.f1-stints tr.fav td { background: var(--fav-bg); }
.f1-stints .bars { width: 100%; }
.f1-stints .bars { display: flex; gap: 2px; }
.f1-stints .bars i { display: block; height: 0.95rem; border-radius: 3px; font-style: normal; font-size: 0.6rem; font-weight: 800; color: #111; text-align: center; line-height: 0.95rem; min-width: 3px; }
.bars .t-soft { background: #e8002d; } .bars .t-medium { background: #ffd12e; } .bars .t-hard { background: #f0f0ec; }
.bars .t-intermediate { background: #43b02a; } .bars .t-wet { background: #2b8be0; }
.f1-map { display: block; width: 100%; max-height: 100%; }
.f1-map .track { fill: none; stroke: #3d4b61; stroke-width: 26; stroke-linejoin: round; }
.f1-map.flag-yellow .track { stroke: #b39200; }
.f1-map.flag-sc .track, .f1-map.flag-vsc .track { stroke: #d58a12; }
.f1-map.flag-red .track { stroke: #c43a42; }
.f1-map .line { fill: #fff; }
.f1-map circle:not(.line) { stroke: #0b0f16; stroke-width: 5; }
.f1-map text { fill: var(--ink); font-size: 44px; font-weight: 700; paint-order: stroke; stroke: #0b0f16; stroke-width: 10px; }
.f1-rc { list-style: none; margin: 0; padding: 0; font-size: 0.9rem; }
.f1-rc li { padding: 0.35rem 0; border-top: 1px solid var(--line); line-height: 1.3; }
.f1-rc small { display: block; color: var(--muted); font-size: 0.75rem; }
.f1-facts { display: grid; grid-template-columns: auto 1fr; gap: 0.45rem 1rem; margin: 0; font-size: 0.95rem; }
.f1-facts dt { color: var(--muted); }
.f1-facts dd { margin: 0; }
.f1-tower { width: 100%; }
.f1-tower .who { width: 100%; }
.f1-tower .pit { font-style: normal; font-size: 0.62rem; font-weight: 800; color: var(--muted); border: 1px solid var(--line); border-radius: 0.2rem; padding: 0 0.25rem; margin-left: 0.4rem; vertical-align: middle; }
:is(.layout-md, .layout-pt, .layout-sm) .f1-tower .drv small { display: none; }
.mini-row .mini-tv { flex: none; max-width: 55%; font-size: 0.72rem; font-weight: 600; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Swiping rotating cards (main.js): horizontal drags are ours, vertical ones the browser's. */
.feature .slot { touch-action: pan-y; }
.top { -webkit-user-select: none; user-select: none; }
.slot.swipe-next { animation: swipe-from-right 0.35s ease-out; }
.slot.swipe-back { animation: swipe-from-left 0.35s ease-out; }
@keyframes swipe-from-right { from { transform: translateX(10%); opacity: 0; } }
@keyframes swipe-from-left { from { transform: translateX(-10%); opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .slot.swipe-next, .slot.swipe-back { animation: fade-in 0.3s ease; }
}
.dots { padding: 0.35rem 0; cursor: pointer; }

/* The pinned carousel card (more pin-worthy games than pinned cards): "1 / 2", swipeable. */
.hero .slot { position: relative; }
.hero .slot:last-child { touch-action: pan-y; }
.pin-count { position: absolute; right: 0.7rem; bottom: 0.55rem; font-size: 0.72rem; font-weight: 700; color: var(--ink-2); background: var(--panel-2); border: 1px solid var(--line); border-radius: 999px; padding: 0.1rem 0.5rem; pointer-events: none; }

/* Football callouts across the field ("ND TOUCHDOWN", "UNC INTERCEPTION") */
.field .callout { animation: callout-in 0.5s ease-out; transform-origin: 60px 10px; }
.field .callout text { font-size: 5px; font-weight: 800; letter-spacing: 0.35px; text-anchor: middle; dominant-baseline: central; }
.field .callout rect { stroke: rgba(255, 255, 255, 0.85); stroke-width: 0.35; }
.field .callout.turnover rect { stroke: var(--fav); stroke-width: 0.6; }
.field .callout.miss rect { opacity: 0.75; }
@keyframes callout-in { from { opacity: 0; transform: scale(0.85); } }
@media (prefers-reduced-motion: reduce) { .field .callout { animation: none; } }

/* Baseball: strike zone + scorebook box for the last at-bat */
/* Sits beside the bases-and-count diamond (same row of .extras), wrapping below it only if there's no room. */
.ab-row { display: flex; gap: 0.8rem; align-items: center; }
.zone-fig, .scorebook { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 0.25rem; }
.zone-fig svg { width: 7rem; }
.zone-fig figcaption, .scorebook figcaption { font-size: 0.7rem; color: var(--muted); text-align: center; max-width: 9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.zone-fig figcaption b { color: var(--ink-2); font-weight: 600; }
.zone-fig .zone { fill: rgba(255, 255, 255, 0.04); stroke: var(--ink-2); stroke-width: 0.8; }
.zone-fig .grid line { stroke: rgba(255, 255, 255, 0.12); stroke-width: 0.5; }
.zone-fig .plate { fill: #c9d1dc; }
.pz circle { stroke: #0b0f16; stroke-width: 0.8; }
.pz.ball circle { fill: #4cc38a; }
.pz.called circle, .pz.swinging circle, .pz.foul circle { fill: var(--live); }
.pz.inplay circle { fill: #4a90e2; }
.pz.hbp circle, .pz.other circle { fill: #b07cd8; }
.pz.last circle { stroke: #fff; stroke-width: 1.2; }
.pz text { fill: #0b0f16; font-size: 6.5px; font-weight: 800; text-anchor: middle; dominant-baseline: central; }
.scorebook svg { width: 4.4rem; }
.scorebook .box { fill: var(--panel-2); stroke: var(--line); stroke-width: 1; }
.scorebook .paths { fill: none; stroke: rgba(255, 255, 255, 0.18); stroke-width: 1; }
.scorebook .ran { stroke: var(--fav); stroke-width: 3; stroke-linecap: round; }
.scorebook .scored { fill: rgba(255, 196, 0, 0.35); }
.scorebook .code { fill: var(--ink); font-weight: 800; text-anchor: middle; dominant-baseline: central; }
.scorebook .code.small { font-size: 9px; text-anchor: end; dominant-baseline: auto; }
.scorebook.k .code { fill: var(--live); }
:is(.layout-md, .layout-pt, .layout-sm) .zone-fig svg { width: 7rem; }
:is(.layout-md, .layout-pt, .layout-sm) .scorebook svg { width: 4.3rem; }
:is(.layout-md, .layout-pt, .layout-sm) .zone-fig figcaption { max-width: 7.5rem; }
:is(.layout-md, .layout-pt, .layout-sm) .big .extras:has(.ab-row) { gap: 0.6rem 0.9rem; }
/* leave room for the "1 / 2" pill under the last play */
.hero .slot:has(.pin-count) .last-play { padding-right: 3.2rem; }

/* Live card body (between the score and the last play): scrolls when it doesn't fit. */
.card-body { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.card-body .scroll-content { display: flex; flex-direction: column; gap: 0.9rem; }
:is(.layout-md, .layout-pt) .card-body .scroll-content { gap: 0.6rem; }
.card-body .field, .card-body .rink-fig { align-self: center; }
/* Phone sideways (short tablet layout): bases, strike zone and scorebook box still share a row. */
@media (max-height: 520px) {
  .layout-md .diamond svg { width: 3.4rem; }
  .layout-md .diamond { gap: 0.5rem; }
  .layout-md .zone-fig svg { width: 5.4rem; }
  .layout-md .scorebook svg { width: 3.4rem; }
  .layout-md .ab-row { gap: 0.5rem; }
  .layout-md .big .extras:has(.ab-row) { gap: 0.5rem 0.6rem; }
}

/* Line score: scrolls sideways when wider than its card */
.scroll-region.hscroll { flex: 0 1 auto; min-width: 0; max-width: 100%; }
.hscroll > .scroll-content { width: max-content; }

/* Day card "Show all" (phones): every game, scrolled by hand */
.expand { margin-left: auto; font: inherit; font-size: 0.75rem; font-weight: 700; color: var(--accent); background: var(--panel-2); border: 1px solid var(--line); border-radius: 999px; padding: 0.25rem 0.7rem; cursor: pointer; white-space: nowrap; }
.idle-head:has(.expand) { display: flex; align-items: baseline; gap: 0.6rem; flex-wrap: nowrap; }
.idle-head:has(.expand) .muted { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.expanded .scroll-region { overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.expanded .scroll-region::-webkit-scrollbar { display: none; }

/* Double-tap to watch */
.big .meta .play { color: var(--accent); font-size: 0.75em; margin-right: 0.3rem; }
.hero .slot { touch-action: manipulation; } /* no double-tap zoom on iPhone */
.hero .slot:last-child { touch-action: pan-y; }
#toast { position: fixed; left: 50%; bottom: calc(1.2rem + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--panel-2); color: var(--ink); border: 1px solid var(--line); border-radius: 999px; padding: 0.5rem 1rem; font-weight: 600; font-size: 0.95rem; opacity: 0; pointer-events: none; z-index: 10; }
#toast.show { animation: toast 2.2s ease forwards; }
@keyframes toast { 0% { opacity: 0; } 10%, 75% { opacity: 1; } 100% { opacity: 0; } }

/* A live card that only just overflowed (main.js setupScrolling): tighter spacing instead of a scroll */
.slot.tight .big { gap: 0.45rem; padding-top: 0.75rem; padding-bottom: 0.6rem; }
.slot.tight .matchup { gap: 0.3rem; }
.slot.tight .card-body .scroll-content { gap: 0.4rem; }
.slot.tight .big .extras { row-gap: 0.4rem; }
.slot.tight .last-play { padding-top: 0.4rem; }
/* My Teams in a narrow side panel (big iPad): standing and next/last game wrap instead of clipping */
.standings-panel .myteams { width: 100%; }
.standings-panel .myteams td:not(.team) { white-space: normal; }
.layout-lg .standings-panel .myteams .team img { width: 1.5rem; height: 1.5rem; }
.layout-lg .standings-panel .myteams .team { gap: 0.4rem; font-size: 1rem; }

/* The home page's site bar over the demo board (index.html): the name, sign-in and policy links,
   centred in the header row. Hidden on personal boards (/b/ → .is-board). */
.site-bar {
  position: fixed; top: 0.45rem; left: 50%; transform: translateX(-50%); z-index: 20;
  display: flex; align-items: center; gap: 0.9rem; white-space: nowrap;
}
.is-board .site-bar { display: none; }
.site-bar h1 { margin: 0; font-size: 1.3rem; font-weight: 800; letter-spacing: -0.01em; }
.site-bar .site-what { margin: 0; color: var(--ink-2); font-size: 0.9rem; }
.site-bar nav { font-size: 0.8rem; color: var(--muted); }
.site-bar nav a { color: var(--muted); }
.site-bar .signin {
  padding: 0.35rem 0.9rem; border-radius: 999px;
  background: var(--accent); color: var(--bg); font-weight: 700; text-decoration: none;
}
.site-bar .signin:hover { filter: brightness(1.1); }
/* Narrow screens: no room beside the clock, so the bar takes its own row above the board. */
@media (max-width: 1100px) {
  .site-bar { position: static; transform: none; justify-content: center; flex-wrap: wrap; gap: 0.4rem 0.8rem; padding: 0.5rem 1rem; white-space: normal; }
  .site-bar .site-what { display: none; }
  /* The board fills what's left, so the page still never scrolls. */
  html:not(.is-board) body { display: flex; flex-direction: column; height: 100dvh; }
  html:not(.is-board) .screen { flex: 1; min-height: 0; height: auto; }
}
