/* Bottom strip (scrubber, controls, ticker), value motion, overlay mode,
   stacked layout below 1024px, and reduced motion. */

.bottom { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 8px; }
.scrubber { display: flex; flex-direction: column; gap: 6px; }
.lead-head { display: flex; align-items: center; gap: 14px; height: 22px; min-width: 0; }
.legend { display: flex; gap: 12px; font-size: 11px; color: var(--ink-2); white-space: nowrap; }
.legend i { display: inline-block; width: 10px; height: 10px; margin-right: 5px; border-radius: 2px; vertical-align: -1px; opacity: 0.8; }
.legend-home { background: var(--home); }
.legend-away { background: var(--away); }
.chips { display: flex; gap: 6px; margin-left: auto; min-width: 0; overflow: hidden; }
.chip-moment { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px; border: 1px solid var(--line); border-radius: 11px; background: var(--panel); color: var(--ink-2); font: inherit; font-size: 11px; white-space: nowrap; cursor: pointer; }
.chip-moment:hover { border-color: var(--line-2); color: var(--ink); }
.chip-moment:focus-visible { outline: 2px solid var(--ink-2); outline-offset: 2px; }
.chip-moment.passed { background: var(--panel-2); color: var(--ink); }
.chip-time { color: var(--ink-3); }
.chip-time:empty { display: none; }

.lead { position: relative; height: 64px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); overflow: hidden; cursor: ew-resize; touch-action: none; }
.lead:focus-visible { outline: 2px solid var(--ink-2); outline-offset: 2px; }
.lead-svg { display: block; width: 100%; height: 100%; }
.area-home { fill: var(--home); opacity: 0.42; }
.area-away { fill: var(--away); opacity: 0.42; }
.lead-line { fill: none; stroke: var(--ink-2); stroke-width: 1.5px; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.lead-mid { stroke: var(--line-2); stroke-width: 1px; vector-effect: non-scaling-stroke; }
.lead-period { stroke: var(--line-2); stroke-width: 1px; stroke-dasharray: 3 3; vector-effect: non-scaling-stroke; }
.lead-plabel { fill: var(--ink-3); font-family: var(--font); font-size: 10px; font-weight: 600; letter-spacing: 0.08em; }
.lead-tick { stroke: var(--ink-3); stroke-width: 2px; vector-effect: non-scaling-stroke; }
.playhead { position: absolute; top: 0; bottom: 0; left: 0; width: 2px; background: var(--ink); pointer-events: none; will-change: transform; }
.playhead-time { position: absolute; top: 5px; left: 6px; padding: 1px 6px; border-radius: 3px; background: var(--frame); font-size: 11px; font-weight: 600; white-space: nowrap; }
.playhead.flip .playhead-time { left: auto; right: 6px; }

.bottom-row { display: grid; grid-template-columns: minmax(0, 1fr) 640px; gap: 14px; align-items: stretch; }
.controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-width: 0; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 32px; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); color: var(--ink); font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--panel-2); border-color: var(--line-2); }
.btn:focus-visible { outline: 2px solid var(--ink-2); outline-offset: 2px; }
.btn.active, .btn[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--frame); }
.btn-play { min-width: 84px; }
.btn-speed { min-width: 54px; }
.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; margin-left: -1px; min-width: 42px; }
.btn-group .btn:first-child { border-radius: var(--radius) 0 0 var(--radius); margin-left: 0; }
.btn-group .btn:last-child { border-radius: 0 var(--radius) var(--radius) 0; }
.select { height: 32px; padding: 0 8px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); color: var(--ink); font: inherit; font-size: 12px; font-weight: 600; }
.select:focus-visible { outline: 2px solid var(--ink-2); outline-offset: 2px; }
.kbd-help { margin-left: auto; font-size: 11px; color: var(--ink-3); white-space: nowrap; }

.ticker { display: flex; flex-direction: column; justify-content: center; gap: 3px; min-height: 64px; padding: 6px 12px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.tk-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.tk-list li { display: grid; grid-template-columns: 3px 68px minmax(0, 1fr) auto; align-items: center; gap: 10px; font-size: 12px; line-height: 16px; white-space: nowrap; }
.tk-list li:nth-child(2) { color: var(--ink-2); }
.tk-list li:nth-child(3) { color: var(--ink-3); }
.tk-bar { height: 12px; border-radius: 1px; background: var(--line-2); }
.tk-bar[data-side="home"] { background: var(--home); }
.tk-bar[data-side="away"] { background: var(--away); }
.tk-clock { color: var(--ink-3); }
.tk-desc { overflow: hidden; text-overflow: ellipsis; }
.tk-score { color: var(--ink-2); }
.tk-list li.new { animation: tk-in 220ms var(--ease); }
@keyframes tk-in { from { opacity: 0; transform: translateY(-6px); } }

.disclaimer { margin: 0; font-size: 11px; color: var(--ink-3); }

/* Value motion */

.tick { animation: tick 300ms var(--ease); }
@keyframes tick { 0% { transform: translateY(-5px); opacity: 0.2; } 100% { transform: none; opacity: 1; } }
.flip { animation: flip 360ms var(--ease); }
@keyframes flip { 0% { transform: translateY(-60%); opacity: 0; } 100% { transform: none; opacity: 1; } }

.card.entering { animation: card-in 280ms var(--ease); }
.card.leaving { animation: card-out 300ms var(--ease) forwards; }
@keyframes card-in { from { opacity: 0; transform: translateX(-18px); } }
@keyframes card-out { to { opacity: 0; transform: translateX(-18px); } }
.rail-home .card.entering { animation-name: card-in-r; }
.rail-home .card.leaving { animation-name: card-out-r; }
@keyframes card-in-r { from { opacity: 0; transform: translateX(18px); } }
@keyframes card-out-r { to { opacity: 0; transform: translateX(18px); } }

/* Overlay mode: transparent page, no court or controls */

html.overlay, html.overlay body, html.overlay .viewport, html.overlay .stage { background: transparent; }
html.overlay .center, html.overlay .scrubber, html.overlay .controls { display: none; }
html.overlay .bottom-row { grid-template-columns: minmax(0, 1fr); }
html.overlay .ticker { width: min(100%, 900px); margin: 0 auto; }
html.overlay .bug, html.overlay .card, html.overlay .bench, html.overlay .ticker, html.overlay .wp, html.overlay .rail-head { background: rgba(11, 13, 17, 0.88); }
html.overlay .wp { height: 26px; padding: 0 12px; border-radius: var(--radius); }
html.overlay .wp-track { background: rgba(27, 32, 39, 0.9); }
html.overlay .rail-head { height: 26px; padding: 0 10px; border-radius: var(--radius); }
html.overlay .bottom { align-items: center; }
html.overlay .disclaimer { padding: 3px 10px; border-radius: 3px; background: rgba(11, 13, 17, 0.88); color: var(--ink-2); }

/* Stacked layout below 1024px */

html.stacked body { overflow: auto; }
html.stacked .viewport { width: 100%; height: auto; }
html.stacked .stage { display: flex; flex-direction: column; gap: 12px; width: 100%; height: auto; padding: 12px; transform: none; }
html.stacked .top { order: 0; }
html.stacked .center { order: 1; }
html.stacked .rail-away { order: 2; }
html.stacked .rail-home { order: 3; }
html.stacked .bottom { order: 4; }
html.stacked .court-wrap { height: min(72vw, 520px); flex: none; }
html.stacked .sq-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
html.stacked .sq { position: static; width: auto; }
html.stacked .court-legend { position: static; margin-bottom: 8px; flex-direction: row; gap: 14px; }
html.stacked .bug { height: auto; padding: 10px 12px; gap: 10px; }
html.stacked .bug-mid { min-width: 0; }
html.stacked .bug-name, html.stacked .bug-series span { display: none; }
html.stacked .bug-score { font-size: 36px; }
html.stacked .bug-clock { font-size: 26px; }
html.stacked .wp { grid-template-columns: auto minmax(0, 1fr) auto; }
html.stacked .wp-label { display: none; }
html.stacked .bench { margin-top: 0; }
html.stacked .bench-list { max-height: none; }
html.stacked .lead-head { flex-wrap: wrap; height: auto; }
html.stacked .chips { flex-wrap: wrap; margin-left: 0; overflow: visible; }
html.stacked .bottom-row { grid-template-columns: minmax(0, 1fr); }
html.stacked .kbd-help { display: none; }

/* Reduced motion: keep values, drop non-essential motion */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
  .pulse { display: none; }
}
