/* Fourth & Dice /live. Sizes, colours and timings arrive as custom properties from /live/tokens.css (data/ui.yaml);
   the theme's colours too. The team colours of each game are set per panel as --home / --away. */

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { font: 15px/1.35 system-ui, -apple-system, "Segoe UI", sans-serif; min-height: 100vh; overflow-x: hidden; }
button { font: inherit; color: inherit; }

.bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 8px 16px; border-bottom: 1px solid var(--line); }
.brand { font-size: 18px; margin: 0; letter-spacing: .02em; }
.live-tag { font-size: 12px; font-weight: 700; color: var(--bg); background: var(--c-snake); padding: 2px 6px; border-radius: 3px; }
.pace { display: flex; align-items: center; gap: 6px; }
.pace-label { color: var(--ink-dim); font-size: 13px; }
.pace-buttons { display: flex; gap: 4px; }
.nav-host { margin-left: auto; }
.btn {
  min-height: var(--tap-min); min-width: var(--tap-min); padding: 0 12px; border-radius: 6px;
  background: var(--panel-2); border: 1px solid var(--line); cursor: pointer;
}
.btn[aria-pressed="true"] { border-color: var(--gold); color: var(--gold); }
.btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

main { padding: 8px 16px 24px; }
.tagline { color: var(--ink-dim); margin: 4px 0 10px; max-width: 70ch; }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--panel-gap); }
.grid.four-across { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.has-full { grid-template-columns: minmax(0, 1fr); }
.grid.has-full .panel:not(.full) { display: none; }
.grid.one-up { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; gap: var(--panel-gap); scrollbar-width: none; }
.grid.one-up::-webkit-scrollbar { display: none; }
.grid.one-up .panel { flex: 0 0 100%; scroll-snap-align: start; }
.grid.embed { grid-template-columns: minmax(0, 1fr); }
.dots { display: none; justify-content: center; gap: 4px; margin-top: 8px; }
.dots.on { display: flex; }
.dot { min-height: var(--tap-min); min-width: var(--tap-min); background: none; border: 0; cursor: pointer; }
.dot::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--line); }
.dot[aria-current="true"]::before { background: var(--gold); }

.panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 10px;
  display: flex; flex-direction: column; gap: 8px; min-width: 0;
}
.score { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; }
.team { display: flex; align-items: center; gap: 8px; min-width: 0; }
.team.home { justify-content: flex-end; flex-direction: row-reverse; }
.chip { width: 14px; height: 28px; border-radius: 3px; flex: none; border: 2px solid; }
.team.away .chip { background: var(--away); border-color: var(--away-2); }
.team.home .chip { background: var(--home); border-color: var(--home-2); }
.words { display: flex; flex-direction: column; min-width: 0; }
.team.home .words { align-items: flex-end; }
.team-name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.team-name .full-name { display: none; font-weight: 400; color: var(--ink-dim); margin-left: 6px; }
.panel.full .team-name .full-name { display: inline; }
.pts { font-size: 26px; font-weight: 800; font-variant-numeric: tabular-nums; min-width: 2ch; text-align: center; }
.team.has-ball .team-name { text-decoration: underline; text-decoration-color: var(--gold); text-underline-offset: 4px; }
.to { color: var(--ink-dim); font-size: 12px; }
.clock { text-align: center; font-variant-numeric: tabular-nums; }
.clock .q { display: block; font-size: 12px; color: var(--ink-dim); }
.clock .t { font-size: 18px; font-weight: 700; }
.situation { display: flex; justify-content: space-between; gap: 8px; color: var(--ink-dim); font-size: 13px; }
.situation .down { color: var(--ink); font-weight: 600; }
.field { width: 100%; height: var(--field-height); display: block; border-radius: 4px; }
.panel.full .field { height: var(--field-height-full); }

.roll { display: flex; flex-direction: column; gap: 6px; background: var(--panel-2); border-radius: 6px; padding: 8px; }
.roll-dice { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; }
.side { display: flex; gap: 4px; padding: 4px; border-radius: 6px; border: 2px solid var(--side, var(--line)); }
.vs { color: var(--ink-dim); font-size: 12px; }
.die { width: var(--die-size); height: var(--die-size); display: block; }
.panel.full .die { width: var(--die-size-full); height: var(--die-size-full); }
.die .body { fill: var(--c-die-face); stroke: var(--c-die-pip); stroke-width: 2; }
.die.unit .body { fill: var(--side, var(--panel)); stroke: var(--c-die-face); }
.die .pip { fill: var(--c-die-pip); }
.die text { font-weight: 800; font-size: 40px; text-anchor: middle; dominant-baseline: central; fill: var(--c-die-face); }
.roll[data-state="tumbling"] .die { animation: tumble calc(var(--tumble) * 1ms) linear; }
@keyframes tumble { 0% { transform: rotate(0); } 50% { transform: rotate(14deg); } 100% { transform: rotate(0); } }
.die.snake .body { animation: flash-snake var(--flash-ms) ease-out 2; }
.die.box .body { animation: flash-box var(--flash-ms) ease-out 2; }
@keyframes flash-snake { 50% { fill: var(--c-snake); } }
@keyframes flash-box { 50% { fill: var(--c-boxcars); } }
.roll-result { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; font-variant-numeric: tabular-nums; }
.margin { color: var(--ink-dim); }
.grade { font-weight: 800; padding: 2px 8px; border-radius: 4px; color: var(--c-die-face); background: var(--line); }
.grade[data-grade="stuffed"] { background: var(--c-grade-stuffed); }
.grade[data-grade="held"] { background: var(--c-grade-held); }
.grade[data-grade="won"] { background: var(--c-grade-won); }
.grade[data-grade="broken"] { background: var(--c-grade-broken); }
.gain { display: flex; align-items: center; gap: 4px; font-weight: 700; }
.gain .die { width: calc(var(--die-size) * 3 / 4); height: calc(var(--die-size) * 3 / 4); }
.icon { font-size: 11px; font-weight: 800; padding: 1px 5px; border-radius: 3px; background: var(--c-boxcars); color: var(--c-die-pip); }
.target { position: relative; height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; }
.target .got { position: absolute; inset: 0 auto 0 0; width: calc(var(--got) * 1%); background: var(--side, var(--gold)); }
.target .need { position: absolute; top: 0; bottom: 0; left: calc(var(--need) * 1%); width: 2px; background: var(--ink); }
.target-text, .line, .phase-note { font-size: 12px; color: var(--ink-dim); text-align: center; margin: 0; }
.line { color: var(--ink); }
.empty { color: var(--ink-dim); text-align: center; font-size: 13px; }

.feed { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; font-size: 13px;
        max-height: calc(var(--feed-rows) * 20px); overflow: hidden; }
.panel.full .feed { max-height: none; }
.feed li { display: flex; gap: 8px; }
.feed .when { color: var(--ink-dim); flex: none; font-variant-numeric: tabular-nums; min-width: 7ch; }
.feed li.score-play { color: var(--gold); font-weight: 600; }
.controls { display: flex; gap: 6px; justify-content: flex-end; align-items: center; }
.controls .note { margin-right: auto; color: var(--ink-dim); font-size: 12px; }
.status { text-align: center; color: var(--gold); font-weight: 700; }

.how { margin-top: 16px; max-width: 75ch; color: var(--ink-dim); }
.how summary { cursor: pointer; min-height: var(--tap-min); display: flex; align-items: center; color: var(--ink); }

