/* Practice Control Panel (WP09 5.2). Served by the hub box; no internet, no CDN. Matches the plays page. */
:root {
  --bg: #121212; --surface: #1e1e1e; --surface-2: #2a2a2a; --line: rgba(255,255,255,0.10);
  --text: #f2f2f2; --muted: #a7a7a7; --accent: #4caf50; --accent-ink: #0b2e0d; --live: #ef5350;
  --warn-bg: #5c3a06; --warn-text: #ffe0b2; --radius: 12px; --tap: 48px; color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font: 16px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
button, input, a { font: inherit; color: inherit; }
.bar { position: sticky; top: 0; z-index: 5; padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: rgba(18,18,18,0.92); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.bar-inner { max-width: 688px; margin: 0 auto; display: flex; align-items: center; gap: 8px; }
.bar-title { flex: 1; min-width: 0; font-size: 20px; font-weight: 700; }
.bar-sub { display: block; font-size: 13px; font-weight: 500; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.text-button { display: inline-flex; align-items: center; min-height: var(--tap); padding: 0 12px; border-radius: 999px; text-decoration: none; color: var(--accent); font-weight: 650; white-space: nowrap; }
main { max-width: 720px; margin: 0 auto; padding: 16px 16px calc(32px + env(safe-area-inset-bottom)); display: grid; gap: 14px;
  grid-template-columns: minmax(0, 1fr); } /* a wide table scrolls in its card, never the page */
.card { background: var(--surface); border-radius: var(--radius); padding: 14px 16px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.label { color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 4px; }
.big { font-size: 22px; font-weight: 700; }
.sub { color: var(--muted); font-size: 15px; margin-top: 4px; }
.row { display: flex; align-items: center; gap: 10px; }
.dot { width: 12px; height: 12px; border-radius: 50%; background: var(--muted); flex: none; }
.dot.ok { background: var(--accent); }
.dot.rec { background: var(--live); animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.35; } }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
input { flex: 1 1 180px; min-height: var(--tap); padding: 0 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); }
button { min-height: var(--tap); padding: 0 18px; border-radius: 999px; border: 0; background: var(--surface-2); font-weight: 700; cursor: pointer; }
button.primary { background: var(--accent); color: var(--accent-ink); }
button.danger { background: var(--live); color: #fff; }
.button-link { display: inline-flex; align-items: center; min-height: var(--tap); padding: 0 18px; border-radius: 999px;
  background: var(--accent); color: var(--accent-ink); font-weight: 700; text-decoration: none; }
button:disabled { opacity: 0.5; }
.pw { position: relative; display: flex; flex: 1 1 180px; }
.pw input { flex: 1; min-width: 0; padding-right: var(--tap); }
.pw-eye { position: absolute; top: 0; right: 0; width: var(--tap); padding: 0; background: transparent; border-radius: 10px;
  display: flex; align-items: center; justify-content: center; color: var(--muted); }
.pw-eye svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.pw-eye .eye-shut, .pw-eye[aria-pressed="true"] .eye-open { display: none; }
.pw-eye[aria-pressed="true"] .eye-shut { display: block; }
.seg { display: flex; gap: 6px; margin-top: 8px; padding: 4px; border-radius: 999px; background: var(--surface-2); }
.seg { border-radius: 16px; }
.seg button { flex: 1 1 0; min-width: 0; min-height: 52px; padding: 6px 8px; font-size: 15px; border-radius: 12px; background: transparent; color: var(--muted); white-space: normal; line-height: 1.2; }
.seg button + button { flex-grow: 1.6; }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.cloud-state { margin-top: 12px; }
.paired { margin-top: 8px; font-weight: 650; color: var(--accent); }
.paired.not { color: var(--warn-text); }
.check { margin-top: 10px; padding: 10px 12px; border-radius: 10px; font-weight: 650; }
.check.ok { background: rgba(76,175,80,0.16); color: #a5d6a7; }
.check.bad { background: var(--warn-bg); color: var(--warn-text); }
.dot.warn { background: #ffb74d; }
details { margin-top: 12px; }
summary { cursor: pointer; color: var(--accent); font-weight: 650; min-height: 32px; }
/* The team's logo sits on a light tile: school logos are mostly made for white paper. */
.logo-tile { justify-self: center; width: 112px; height: 112px; padding: 12px; border-radius: 24px; background: #f4f1ea; display: flex; align-items: center; justify-content: center; }
.logo-tile img { max-width: 100%; max-height: 100%; object-fit: contain; }
.logo-tile.small { width: 64px; height: 64px; padding: 8px; border-radius: 14px; justify-self: start; }
.file-button { position: relative; overflow: hidden; display: inline-flex; align-items: center; min-height: var(--tap); padding: 0 18px; border-radius: 999px; background: var(--surface-2); font-weight: 700; cursor: pointer; }
.file-button input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.token { margin-top: 8px; padding: 8px 10px; border-radius: 8px; background: rgba(0,0,0,0.25); overflow-wrap: anywhere; font-size: 14px; }
.table td.actions-cell { text-align: right; }
#boxes-table td { white-space: normal; vertical-align: top; }
.table td .text-button { min-height: 36px; padding: 0 8px; }
.confirm { margin-top: 12px; padding: 12px; border-radius: 10px; background: var(--warn-bg); color: var(--warn-text); }
.codes { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); margin-top: 8px; }
figure { margin: 0; text-align: center; }
figure img { width: min(220px, 70vw); aspect-ratio: 1; background: #fff; border-radius: 8px; image-rendering: pixelated; }
figcaption { color: var(--muted); font-size: 15px; margin-top: 6px; }
figcaption b { color: var(--text); }
.mono { font-family: ui-monospace, Menlo, "Roboto Mono", monospace; color: var(--text); }
.note { padding: 12px 14px; border-radius: var(--radius); background: var(--surface); color: var(--muted); font-size: 14px; }
#offline { background: var(--warn-bg); color: var(--warn-text); }
.button-link.quiet { background: var(--surface-2); color: var(--text); }
.link { color: var(--accent); font-weight: 650; text-decoration: none; }
.warn { color: var(--warn-text); }
.warn:empty { display: none; }
.bar button.text-button { background: none; padding: 0 12px; }
/* ---------------------------------------------------------------- Stats page (WP11 Phase 4) */
.select { width: 100%; min-height: var(--tap); margin-top: 4px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface-2); color: var(--text); font: inherit; font-weight: 650; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.tile { background: var(--surface); border-radius: var(--radius); padding: 12px 14px; min-width: 0; }
.tile .value { font-size: 26px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.15; }
.tile .label { margin-bottom: 2px; }
.tile .sub { font-size: 13px; margin-top: 2px; }
#charts { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); }
.chart-box { position: relative; height: 220px; margin-top: 8px; }
.chart-box.short { height: 160px; }
.table-wrap { overflow-x: auto; margin: 6px -4px 0; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
.table th { text-align: left; color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; padding: 6px 4px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 8px 4px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table .num { text-align: right; }
.table tr.rc td:first-child { font-weight: 700; }
.table-note { font-size: 13px; }
