:root { --bg:#fff; --fg:#1b1f24; --muted:#6b7280; --line:#e2e5ea; --accent:#2563eb; --on:#2563eb; --card:#f6f7f9; --bad:#b91c1c; }
@media (prefers-color-scheme: dark) {
  :root { --bg:#12151a; --fg:#e8eaee; --muted:#9aa3b0; --line:#2a2f38; --accent:#6ea0ff; --on:#4f86f7; --card:#1b2028; --bad:#f87171; }
}
* { box-sizing: border-box; }
body { margin:0; background:var(--bg); color:var(--fg); font:16px/1.4 system-ui, sans-serif; }
main { max-width: 720px; margin: 0 auto; padding: 16px; }
h1 { font-size: 1.4rem; margin: 0 0 4px; } h2 { font-size: 1.1rem; margin: 24px 0 8px; }
.muted { color: var(--muted); font-size: .9rem; }
.card { background: var(--card); border:1px solid var(--line); border-radius: 8px; padding: 12px; margin: 12px 0; }
input, select, button { font: inherit; padding: 8px 10px; border-radius: 6px; border:1px solid var(--line); background: var(--bg); color: var(--fg); }
button { cursor: pointer; } button.primary { background: var(--accent); color:#fff; border-color: var(--accent); }
.row { display:flex; gap:8px; flex-wrap: wrap; align-items:center; }
.error { color: var(--bad); }
.grid { display:grid; grid-template-columns: 70px 70px 1fr; border:1px solid var(--line); border-radius:6px; overflow:hidden; touch-action: none; user-select:none; }
.grid .h { background: var(--card); font-size:.75rem; font-weight:600; padding:4px 6px; position:sticky; top:0; }
.grid .t { font-size:.75rem; color:var(--muted); padding:0 6px; line-height:22px; border-top:1px solid var(--line); }
.grid .c { height:22px; border-top:1px solid var(--line); border-left:1px solid var(--line); }
.grid .c.on { background: var(--on); }
.grid .t.hour, .grid .c.hour { border-top-color: var(--muted); }
.heat { display:grid; grid-template-columns: 48px 1fr 40px; }
.heat .bar { height:20px; border-top:1px solid var(--line); position:relative; }
.heat .bar i { position:absolute; inset:0; background:var(--on); opacity:var(--o); }
.heat .l { font-size:.75rem; line-height:20px; color:var(--muted); } .heat .n { font-size:.75rem; line-height:20px; text-align:right; }
table { width:100%; border-collapse: collapse; } td, th { padding:6px 4px; border-bottom:1px solid var(--line); text-align:left; }
.pick { padding:8px 0; border-bottom:1px solid var(--line); } .pick b { font-variant-numeric: tabular-nums; }
.pick button { margin-left: 8px; padding: 2px 8px; }
#players { font-size: .9rem; } #players input[type=range] { width: 80px; vertical-align: middle; }
#players tr { display: table-row; }
@media (max-width: 600px) { #players input[type=range] { width: 56px; } }

/* Decorative chase: the group runs across, turns at the edge, and runs back. */
.track { position: relative; height: 44px; margin: 32px 0 8px; overflow: hidden; border-bottom: 2px dashed var(--line); }
.chase { position: absolute; bottom: 2px; left: 0; font-size: 28px; line-height: 1; white-space: nowrap;
         animation: run 9s linear infinite alternate; }
.chase .turn { display: inline-block; animation: face 18s step-end infinite; }
.chase .turn span { display: inline-block; animation: hop .35s ease-in-out infinite alternate; }
.chase .turn span + span { animation-delay: .17s; margin-left: 6px; }
@keyframes run { from { left: 0; } to { left: calc(100% - 78px); } }
/* Emoji face left; mirror the pair while it runs right. */
@keyframes face { 0% { transform: scaleX(-1); } 50% { transform: scaleX(1); } }
@keyframes hop { to { transform: translateY(-6px); } }
@media (prefers-reduced-motion: reduce) { .chase, .chase .turn, .chase .turn span { animation: none; } }
