:root {
  --red: #c43e3b; --red-dark: #a8312f; --navy: #172d44; --navy-2: #22405f; --ink: #1b2430; --muted: #5b6b7c;
  --line: #d9dee5; --bg: #f3f5f8; --card: #ffffff; --ok: #2b8a4b; --warn: #b7791f;
  --font: "Satoshi", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 16px; -webkit-tap-highlight-color: transparent; }
button, input, select { font: inherit; }
button { cursor: pointer; }
.top { position: sticky; top: 0; z-index: 5; background: var(--navy); color: #fff; display: flex; align-items: center; justify-content: space-between; padding: calc(env(safe-area-inset-top, 0px) + 10px) 14px 10px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: .01em; }
.brand img { border-radius: 7px; }
.brand small { font-weight: 500; opacity: .75; margin-left: 4px; }
.pill { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 6px 10px; font-size: 13px; font-weight: 700; background: rgba(255,255,255,.14); }
.pill.off { background: var(--warn); color: #fff; }
.pill.busy { background: rgba(255,255,255,.3); }
.app { max-width: 640px; margin: 0 auto; padding: 14px 14px calc(24px + var(--safe-b)); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 16px; margin-bottom: 12px; }
h1 { font-size: 22px; margin: 0 0 6px; }
h2 { font-size: 15px; margin: 0 0 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
p { margin: 0 0 10px; line-height: 1.45; }
.muted { color: var(--muted); font-size: 14px; }
label.field { display: block; margin-bottom: 12px; font-weight: 500; }
label.field span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
input[type=text], input[type=password], select { width: 100%; min-height: 48px; border: 1px solid var(--line); border-radius: 10px; padding: 0 12px; background: #fff; color: var(--ink); }
input[type=text]:focus, input[type=password]:focus, select:focus { outline: 3px solid rgba(23,45,68,.25); border-color: var(--navy); }
input[type=password] { font-size: 22px; letter-spacing: .3em; }
input[type=password]::placeholder { font-size: 15px; letter-spacing: normal; color: var(--muted); opacity: 1; }
.btn { min-height: 48px; min-width: 44px; border-radius: 12px; border: 1px solid var(--line); background: #fff; color: var(--ink); padding: 0 16px; font-weight: 700; }
.btn:disabled { opacity: .45; cursor: default; }
.btn.primary { background: var(--red); border-color: var(--red); color: #fff; }
.btn.primary:active { background: var(--red-dark); }
.btn.navy { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn.ghost { background: transparent; }
.btn.wide { width: 100%; }
.row { display: flex; gap: 10px; align-items: center; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }
.checks label { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 4px 6px; border-radius: 10px; }
.checks label.taken { opacity: .55; }
.checks input { width: 24px; height: 24px; accent-color: var(--red); }
.checks small { color: var(--muted); margin-left: auto; font-size: 13px; }
.lines { display: flex; flex-direction: column; gap: 12px; }
.line-group h3 { margin: 0 0 6px; font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.line-fw .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.line-d .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 67%; }
.line-g .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 67%; }
@media (max-width: 340px) { .line-d .grid, .line-g .grid { max-width: none; } }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; }
.player { position: relative; min-height: 72px; border-radius: 12px; border: 1px solid var(--line); background: #fff; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; padding: 8px 10px; text-align: left; }
.player b { font-size: 24px; line-height: 1; font-weight: 900; }
.player span { font-size: 13px; color: var(--muted); margin-top: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.player i { position: absolute; top: 8px; right: 8px; font-style: normal; font-size: 13px; font-weight: 700; background: var(--bg); color: var(--navy); border-radius: 999px; min-width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center; padding: 0 6px; }
.player[aria-pressed=true] { border-color: var(--red); box-shadow: inset 0 0 0 2px var(--red); }
.player:active { background: var(--bg); }
.player:disabled { opacity: .45; }
.bigbtns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.actions .bigbtns + .bigbtns { margin-top: 10px; }
.actions .save-row { margin-top: 14px; }
.bigbtns .btn { min-height: 64px; font-size: 17px; }
.bigbtns .btn.span { grid-column: 1 / -1; }
.recent { list-style: none; margin: 0; padding: 0; }
.recent li { display: flex; align-items: center; gap: 10px; min-height: 48px; border-top: 1px solid var(--line); padding: 6px 0; font-size: 15px; }
.recent li:first-child { border-top: none; }
.recent .what { flex: 1; }
.recent .state { font-size: 12px; color: var(--muted); }
.recent .state.sent { color: var(--ok); }
.recent .state.rejected { color: var(--red); }
.recent .undo { min-height: 44px; padding: 0 12px; }
.note { border-left: 4px solid var(--warn); background: #fff8e8; padding: 10px 12px; border-radius: 8px; margin-bottom: 12px; font-size: 14px; }
.note.bad { border-color: var(--red); background: #fdeeee; }
.sheet { position: fixed; inset: 0; background: rgba(23,45,68,.55); display: flex; align-items: flex-end; justify-content: center; z-index: 10; }
.sheet > div { width: 100%; max-width: 640px; background: #fff; border-radius: 18px 18px 0 0; padding: 16px 16px calc(16px + var(--safe-b)); max-height: 92vh; overflow: auto; }
.sheet h1 { font-size: 19px; }
.strengths .btn[aria-pressed=true], .in-net-pick .btn[aria-pressed=true] { background: var(--navy); color: #fff; border-color: var(--navy); }
.units { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.unit { min-height: 56px; border: 1px solid var(--line); border-radius: 12px; background: #fff; color: var(--ink); padding: 8px 6px; display: grid; gap: 2px; text-align: center; }
.unit b { font-size: 14px; }
.unit span { font-size: 12px; color: var(--muted); }
.unit[aria-pressed=true] { background: var(--navy); border-color: var(--navy); color: #fff; }
.unit[aria-pressed=true] span { color: rgba(255,255,255,.8); }
.player em.mark { position: absolute; top: 8px; right: 8px; font-style: normal; font-size: 11px; font-weight: 700; color: var(--red); }
label.check { display: flex; gap: 10px; align-items: flex-start; margin: 12px 0; font-size: 14px; color: var(--muted); min-height: 44px; }
label.check input { width: 22px; height: 22px; margin: 0; flex: none; accent-color: var(--navy); }
.in-net { margin-top: 12px; display: grid; gap: 8px; }
.in-net-pick { display: flex; flex-wrap: wrap; gap: 8px; }
.in-net-pick .btn { min-height: 44px; }
.footer-actions { display: flex; gap: 10px; margin-top: 14px; }
.footer-actions .btn { flex: 1; }
.tag { display: inline-block; font-size: 12px; font-weight: 700; border-radius: 6px; padding: 2px 6px; background: var(--bg); color: var(--navy); margin-right: 4px; }
.toast { position: fixed; left: 50%; top: calc(64px + var(--safe-t, 0px)); transform: translateX(-50%); background: var(--navy); color: #fff; padding: 12px 16px; border-radius: 12px; font-weight: 500; max-width: calc(100% - 28px); z-index: 20; box-shadow: 0 8px 24px rgba(0,0,0,.25); }
.center { text-align: center; }
.summary { display: flex; gap: 14px; flex-wrap: wrap; font-size: 14px; color: var(--muted); }
.summary b { color: var(--ink); }

/* Live follow-along page */
.picker { display: grid; gap: 10px; }
.picker-actions { display: flex; gap: 8px; }
.picker-actions .btn { flex: 1; min-height: 44px; }
.score-card { text-align: center; padding: 18px 16px; }
.score-row { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; }
.score-row .team { font-size: 14px; font-weight: 700; color: var(--muted); overflow-wrap: anywhere; line-height: 1.2; min-height: 2.4em; display: flex; align-items: flex-end; justify-content: center; }
.score-row .num { font-size: clamp(48px, 15vw, 64px); font-weight: 900; line-height: 1.05; letter-spacing: -.02em; margin-top: 2px; }
.score-row .dash { font-size: 28px; color: var(--line); align-self: end; padding-bottom: 14px; }
.phase { display: inline-flex; align-items: center; gap: 8px; margin-top: 8px; font-weight: 700; font-size: 14px; color: var(--muted); }
.phase .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--line); }
.phase.live .dot { background: var(--red); box-shadow: 0 0 0 4px rgba(196,62,59,.18); }
.phase.final .dot, .phase.ended .dot { background: var(--navy); }
.phase .elapsed { font-variant-numeric: tabular-nums; color: var(--ink); }
.tag { display: inline-block; margin-left: 8px; padding: 2px 8px; border-radius: 999px; background: var(--navy); color: #fff; font-size: 11px; font-weight: 700; vertical-align: middle; letter-spacing: .02em; }
ul.plain, ol.timeline { list-style: none; margin: 0; padding: 0; }
.rows .row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.rows .row:first-child { border-top: 0; padding-top: 0; }
.rows .row:last-child { padding-bottom: 0; }
.rows .who { white-space: nowrap; }
.rows .val { color: var(--muted); font-size: 14px; text-align: right; }
.rows .val b { color: var(--ink); font-variant-numeric: tabular-nums; }
.rows .who.stack { display: grid; gap: 2px; white-space: normal; }
.rows .small { font-size: 13px; }
.rows .val.big { color: var(--ink); font-weight: 700; font-size: 17px; font-variant-numeric: tabular-nums; align-self: center; white-space: nowrap; }
.timeline li { display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; gap: 10px; align-items: baseline; padding: 10px 0; border-top: 1px solid var(--line); }
.timeline li:first-child { border-top: 0; padding-top: 0; }
.timeline li:last-child { padding-bottom: 0; }
.timeline .when { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 14px; }
.timeline .what { line-height: 1.35; display: grid; gap: 2px; min-width: 0; }
.timeline .line2 { font-size: 13px; }
.timeline .line3 { font-size: 12px; }
.timeline li.goal .line1 b { color: var(--ink); }
.timeline .running { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--muted); }
.timeline li.goal .running { color: var(--red); }
table.stats { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 15px; }
table.stats col.n { width: 27px; }
table.stats col.pim { width: 34px; }
table.stats col.pm { width: 36px; }
table.stats td.pos { color: var(--ok); }
table.stats td.neg { color: var(--red); }
table.stats th { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; padding: 0 2px 8px; text-align: right; }
table.stats td { padding: 9px 2px; text-align: right; border-top: 1px solid var(--line); font-variant-numeric: tabular-nums; color: var(--muted); }
table.stats .l { text-align: left; padding-left: 0; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
table.stats .num { display: inline-block; font-weight: 700; min-width: 22px; text-align: right; margin-right: 8px; font-variant-numeric: tabular-nums; }
table.stats tr.has-points td { font-weight: 700; color: var(--ink); }
table.stats td:last-child { padding-right: 0; }
.foot { font-size: 13px; text-align: center; margin: 4px 0 0; line-height: 1.45; }

/* Live page: one column on phones, two side by side from tablets up. */
.app.live-grid { display: flex; flex-direction: column; }
.app.live-grid .col { display: contents; }
.app.live-grid .g-foot { order: 11; }
@media (min-width: 900px) {
  .app.live-grid { max-width: 1100px; display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 0 16px; align-items: start; padding-top: 18px; }
  .app.live-grid .picker { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 12px; }
  .app.live-grid .picker-actions .btn { flex: none; padding: 0 18px; }
  .app.live-grid .col { display: block; }
  .app.live-grid .col-a { grid-column: 1; grid-row: 2; }
  .app.live-grid .col-b { grid-column: 2; grid-row: 2; }
  .app.live-grid .g-foot { grid-column: 1 / -1; }
  .score-row .num { font-size: 80px; }
  .app.live-grid .score-card { padding: 28px 16px; }
}
@media (min-width: 1300px) {
  .app.live-grid { max-width: 1280px; }
  .score-row .num { font-size: 104px; }
  .timeline li { font-size: 17px; }
}

/* Puck drop card: one big button, dimmer once the clock is running. */
.puckdrop-btn { min-height: 72px; font-size: 22px; width: 100%; }
.puckdrop-btn.armed { background: var(--navy, #172d44); border-color: var(--navy, #172d44); }
.card.puckdrop.done h2 { margin-bottom: 4px; }

/* Notes tracker */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.chip { min-height: 44px; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line); background: #fff; color: var(--ink); font-weight: 600; font-size: 15px; }
.chip[aria-pressed=true] { background: var(--red); border-color: var(--red); color: #fff; }
.fav-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.fav-head h3 { margin: 0; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.btn.small { min-height: 36px; padding: 0 12px; font-size: 14px; }
.note-compose { margin: 0 0 12px; padding: 14px; border-radius: 12px; background: var(--bg); display: grid; gap: 10px; }
.note-compose label { font-size: 14px; }
.note-compose textarea { width: 100%; min-height: 64px; max-height: 320px; resize: none; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; background: #fff; color: var(--ink); font: inherit; font-size: 17px; line-height: 1.35; }
.note-compose textarea:focus { outline: 3px solid rgba(23,45,68,.25); border-color: var(--navy); }
.note-compose .preview { margin: 0; font-weight: 700; font-size: 17px; }
.last-note { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 0 14px; padding: 10px 12px; border-radius: 10px; background: #eef5ee; font-size: 14px; color: var(--ink); }
.last-note .btn { flex: none; }
/* Live page notes: soft tags under the text */
.timeline.notes .tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.timeline.notes .tag.soft { margin: 0; background: var(--bg); color: var(--navy); letter-spacing: 0; text-transform: none; }

/* Coach's dashboard: a third column for the skater table and lines on wide screens. */
.lineup { display: grid; gap: 8px; }
.unit-row { display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 8px; align-items: start; }
.unit-row.d .unit-label { color: var(--muted); }
.unit-label { font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--navy); padding-top: 5px; }
.unit-players { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-sm { display: inline-block; padding: 4px 9px; border-radius: 999px; background: var(--bg); color: var(--ink); font-size: 13px; font-weight: 600; }
.facts .who { color: var(--muted); }
.facts .val { text-align: right; }
.val.small { font-size: 13px; color: var(--muted); font-weight: 500; }
@media (min-width: 900px) and (max-width: 1299px) {
  .app.coach-grid .col-c { grid-column: 1 / -1; grid-row: 3; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 16px; align-items: start; }
}
@media (min-width: 1300px) {
  .app.coach-grid { max-width: 1500px; grid-template-columns: minmax(0, 4fr) minmax(0, 5fr) minmax(0, 5fr); }
  .app.coach-grid .col-c { grid-column: 3; grid-row: 2; display: block; }
}

/* Completed-game warning on the tracking view */
.card.warn { border: 2px solid var(--red); background: #fff6f5; }
.card.warn h2 { color: var(--red); }

/* Accounts page */
.form { display: grid; gap: 10px; }
.form label { display: grid; gap: 4px; font-weight: 600; font-size: 14px; }
.account { padding: 12px 0; border-top: 1px solid var(--line); }
.account:first-of-type { border-top: 0; }
.account-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 17px; }
.chip-sm.off { background: var(--red); color: #fff; }
.row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.small { font-size: 14px; }
.team-line { margin: 6px 0; }
a.pill { text-decoration: none; }
