/* AutoRotationManager v2 — design language from docs/user-journey.drawio ("Mobile screens")
   Setup = light, list-based. Live = dark focus mode. Burgundy is the only accent. */

:root {
  --accent: #741E40;
  --accent-strong: #5A1730;
  --accent-soft: #F6E9EE;
  --ink: #111114;
  --muted: #8E8E93;
  --line: #ECECEF;
  --canvas: #F7F7F8;
  --surface: #FFFFFF;
  --future: #C7C7CC;   /* dotted later fixtures on the Home timeline */
  --surface-2: #F1F1F3;
  --in: #16A34A;
  --out: #DC2626;
  --win: #16A34A; --win-soft: #E8F6EE;
  --loss: #DC2626; --loss-soft: #FDECEC;
  --draw: #D97706; --draw-soft: #FEF3E2;
  --radius-card: 20px;
  --radius-tile: 16px;
  --gutter: 20px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color-scheme: light;
}

body.live {
  --accent: #E0457B;
  --accent-strong: #741E40;
  --accent-soft: #3A1220;
  --ink: #FAFAFA;
  --muted: #8E8E93;
  --line: #26262B;
  --canvas: #0B0B0D;
  --surface: #18181B;
  --surface-2: #26262B;
  --in: #34D399;
  --out: #F87171;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  background: var(--canvas);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  transition: background-color .25s ease;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
button:disabled { opacity: .45; cursor: default; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; }

#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100dvh;
  position: relative;
  display: flex;
  flex-direction: column;
}

.screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: calc(env(safe-area-inset-top) + 16px) var(--gutter) calc(env(safe-area-inset-bottom) + 96px);
  gap: 16px;
}
.screen.enter { animation: enter .22s ease; }
@keyframes enter { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.tnum { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.label { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.row { display: flex; align-items: center; gap: 12px; }
.spacer { flex: 1; }
.hidden { display: none !important; }

/* ---------------------------------------------------------------- nav + titles */
.nav { display: flex; align-items: center; min-height: 36px; gap: 8px; }
.nav .back { font-size: 32px; line-height: 1; color: var(--accent); width: 36px; height: 36px; margin-left: -8px; }
.nav .action { margin-left: auto; color: var(--accent); font-weight: 600; font-size: 14px; padding: 6px 0; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; color: var(--muted); }
.brand img { width: 26px; height: 26px; }
.large-title { font-size: 28px; font-weight: 700; letter-spacing: -.02em; margin: 0; }
.subtitle { font-size: 13px; color: var(--muted); margin-top: -10px; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; font-size: 16px; font-weight: 700; margin: 8px 0 -4px; }
.section-title button { font-size: 13px; color: var(--accent); font-weight: 600; }

/* ---------------------------------------------------------------- surfaces */
.card { background: var(--surface); border-radius: var(--radius-card); padding: 16px; }
.hero {
  background: var(--accent); color: #fff; border-radius: 24px; padding: 20px;
  display: flex; flex-direction: column; gap: 6px;
}
.hero .eyebrow { font-size: 11px; font-weight: 700; letter-spacing: .06em; color: #E9C6D3; text-transform: uppercase; }
.hero .title { font-size: 22px; font-weight: 700; }
.hero .meta { font-size: 13px; color: #E9C6D3; }
.hero .btn-light { margin-top: 12px; align-self: flex-start; }

.pill {
  display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 5px 12px;
  font-size: 12px; font-weight: 600; background: var(--accent-soft); color: var(--accent);
}
.pill.neutral { background: var(--surface-2); color: var(--muted); }
.pill.warn { background: var(--draw-soft); color: var(--draw); }

/* ---------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 52px; border-radius: 999px; padding: 0 24px; font-weight: 700; font-size: 16px;
  transition: transform .08s ease, filter .15s ease;
}
.btn:active:not(:disabled) { transform: scale(.98); }
.btn-primary { background: var(--accent); color: #fff; width: 100%; }
.btn-light { background: #fff; color: var(--accent); height: 40px; font-size: 14px; padding: 0 18px; }
.btn-secondary { background: var(--surface); color: var(--accent); width: 100%; border: 1.5px solid var(--accent-soft); }
.btn-ghost { background: var(--surface-2); color: var(--ink); width: 100%; }
.btn-white { background: #fff; color: var(--accent-strong); width: 100%; }
.footer {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 0;
  width: 100%; max-width: 480px; padding: 24px var(--gutter) calc(env(safe-area-inset-bottom) + 16px);
  background: linear-gradient(to bottom, transparent, var(--canvas) 40%);
  z-index: 5;
}
.icon-btn {
  width: 36px; height: 36px; border-radius: 50%; display: inline-grid; place-items: center;
  background: var(--surface); color: var(--ink); font-size: 14px; flex: none;
}

/* ---------------------------------------------------------------- lists */
.list { display: flex; flex-direction: column; gap: 8px; }
.list-row {
  display: flex; align-items: center; gap: 12px; background: var(--surface);
  border-radius: var(--radius-tile); padding: 10px 12px; min-height: 56px;
}
.list-row .grow { flex: 1; min-width: 0; }
.list-row .title { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-row .meta { font-size: 12px; color: var(--muted); }
.result-badge {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: none;
}
.result-badge.W { background: var(--win-soft); color: var(--win); }
.result-badge.L { background: var(--loss-soft); color: var(--loss); }
.result-badge.D { background: var(--draw-soft); color: var(--draw); }
.score { font-weight: 700; font-size: 15px; }

/* fixtures */
.fixture {
  display: flex; align-items: center; gap: 14px; text-align: left; width: 100%;
  background: var(--surface); border-radius: 18px; padding: 12px 14px; border: 2px solid transparent;
}
.fixture[aria-pressed="true"] { border-color: var(--accent); }
.date-block {
  width: 50px; height: 50px; border-radius: 14px; background: var(--canvas); flex: none;
  display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.05;
}
.date-block b { font-size: 18px; }
.date-block span { font-size: 10px; font-weight: 600; text-transform: uppercase; color: var(--muted); }
.fixture[aria-pressed="true"] .date-block { background: var(--accent-soft); color: var(--accent); }
.radio { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--line); flex: none; display: grid; place-items: center; font-size: 12px; font-weight: 700; }
.fixture[aria-pressed="true"] .radio { background: var(--accent); border-color: var(--accent); color: #fff; }
.practice-block b { font-size: 13px; letter-spacing: .04em; }
.practice-card { margin-top: 2px; }
.practice-card .period-card { align-items: center; }

/* players grid */
.player-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.player-tile {
  display: flex; align-items: center; gap: 10px; text-align: left; min-height: 56px;
  background: var(--surface); border-radius: var(--radius-tile); padding: 10px; border: 2px solid transparent;
}
.player-tile[aria-pressed="true"] { border-color: var(--accent); }
.player-tile .name { font-weight: 600; font-size: 14px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-tile .num { font-size: 11px; color: var(--muted); }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; background: var(--canvas); color: var(--muted);
  display: grid; place-items: center; font-size: 11px; font-weight: 700; flex: none;
}
.player-tile[aria-pressed="true"] .avatar { background: var(--accent); color: #fff; }
.player-tile.keeper .num { color: var(--accent); font-weight: 600; }
.icon { width: 18px; height: 18px; display: block; }
.avatar.small { width: 30px; height: 30px; }
.avatar.small .icon { width: 16px; height: 16px; }
.keeper-row {
  display: flex; align-items: center; gap: 12px; text-align: left; width: 100%;
  background: var(--surface); border-radius: var(--radius-tile); padding: 10px 14px; font-size: 13px; line-height: 1.35;
}
.keeper-row .grow { flex: 1; min-width: 0; }
.keeper-row .link { color: var(--accent); font-weight: 600; white-space: nowrap; }
.check-list { display: flex; flex-direction: column; gap: 4px; max-height: 52dvh; overflow: auto; margin: 0 -4px; }
.check-row { display: flex; align-items: center; gap: 12px; padding: 8px; border-radius: 14px; text-align: left; font-size: 15px; font-weight: 500; }
.check-row .grow { flex: 1; }
.check-row[aria-pressed="true"] { background: var(--accent-soft); }
.check-row[aria-pressed="true"] .avatar { background: var(--accent); color: #fff; }
.check-row .tick { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; font-size: 12px; font-weight: 700; }
.check-row[aria-pressed="true"] .tick { background: var(--accent); border-color: var(--accent); color: #fff; }
body:not(.live) .bottom-sheet .grab { background: var(--line); }

/* calculating */
.calc { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; text-align: center; }
.ring { width: 140px; height: 140px; position: relative; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring .pct { position: absolute; inset: 0; display: grid; place-items: center; font-size: 30px; font-weight: 700; }
.steps { display: flex; flex-direction: column; gap: 14px; text-align: left; margin-top: 8px; }
.step { display: flex; align-items: center; gap: 12px; font-size: 14px; color: var(--muted); }
.step .dot { width: 22px; height: 22px; border-radius: 50%; border: 2px dashed var(--accent); display: grid; place-items: center; font-size: 11px; color: #fff; }
.step.done { color: var(--ink); font-weight: 600; }
.step.done .dot { background: var(--accent); border: 0; }

/* plan */
.period-card { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.period-value { font-size: 46px; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; }
.stepper { display: flex; align-items: center; gap: 4px; background: var(--canvas); border-radius: 999px; padding: 4px; }
.stepper button { width: 32px; height: 32px; border-radius: 50%; background: var(--surface); font-weight: 700; font-size: 18px; }
.stepper button.plus { background: var(--accent); color: #fff; }
.stepper output { min-width: 46px; text-align: center; font-weight: 700; font-size: 14px; }
.queue-row { display: flex; align-items: center; gap: 12px; background: var(--surface); border-radius: 14px; padding: 10px 12px; font-size: 13px; }
.time-pill { background: var(--canvas); border-radius: 999px; padding: 4px 10px; font-weight: 700; font-size: 12px; flex: none; }
.queue-row.first .time-pill { background: var(--accent-soft); color: var(--accent); }
button.queue-row { width: 100%; color: var(--ink); text-align: left; font: inherit; }
.queue-row .start-names { flex: 1; min-width: 0; }
.queue-row .edit-start { color: var(--accent); font-size: 12px; font-weight: 700; }
.io-in { color: var(--in); font-weight: 700; }
.io-out { color: var(--out); font-weight: 700; }
.busy { opacity: .5; pointer-events: none; }

/* ---------------------------------------------------------------- live (dark) */
.live-top { display: flex; align-items: center; gap: 8px; }
.live-top .who { flex: 1; min-width: 0; }
.live-top .who .label { font-size: 11px; }
.live-top .who .opp { font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.live-pill { background: #3A1220; color: var(--out); font-size: 11px; font-weight: 700; border-radius: 999px; padding: 5px 10px; }
.live-pill.paused { background: var(--surface-2); color: var(--muted); }

.focus { flex: 1; display: flex; flex-direction: column; justify-content: space-between; gap: 16px; }
.big-timer { text-align: center; margin-top: 4vh; }
.big-timer .t { font-size: clamp(76px, 25vw, 120px); font-weight: 700; letter-spacing: -.04em; line-height: 1; font-variant-numeric: tabular-nums; }
.big-timer .of { color: var(--muted); font-size: 14px; margin-top: 6px; }
.big-timer .break-watch { color: var(--draw); font-size: 15px; font-weight: 600; margin-top: 8px; }
/* half-time break stopwatch */
.break-timer { text-align: center; }
.break-timer .label { color: var(--muted); }
.break-timer .t { font-size: 64px; font-weight: 700; letter-spacing: -.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.next-rot { text-align: center; padding: 8px 0; border-radius: 20px; }
.next-rot:active { background: var(--surface); }
.next-rot .in { font-size: 38px; font-weight: 700; color: var(--accent); margin: 2px 0 8px; font-variant-numeric: tabular-nums; }
.next-rot .names { font-size: 16px; font-weight: 600; line-height: 1.6; }

.timeline { position: relative; height: 60px; margin: 0 6px; }
.timeline .track, .timeline .fill { position: absolute; top: 26px; height: 4px; border-radius: 2px; left: 0; }
.timeline .track { right: 0; background: var(--surface-2); }
.timeline .fill { background: var(--accent); }
.timeline .ev { position: absolute; top: 23px; width: 10px; height: 10px; margin-left: -5px; border-radius: 50%; background: var(--surface-2); }
.timeline .ev.done { background: var(--accent); }
.timeline .ev.next { top: 19px; width: 18px; height: 18px; margin-left: -9px; background: var(--canvas); border: 3px solid var(--accent); }
.timeline .ev.end { width: 12px; height: 12px; margin-left: -6px; top: 22px; background: var(--canvas); border: 2px solid var(--muted); }
.timeline .now { position: absolute; top: 12px; width: 2px; height: 32px; margin-left: -1px; background: var(--ink); border-radius: 1px; }
.timeline .now-label { position: absolute; top: -6px; transform: translateX(-50%); font-size: 11px; font-weight: 700; }
.timeline .tick-label { position: absolute; top: 42px; font-size: 10px; color: var(--muted); }
.timeline .next-label { position: absolute; top: 42px; transform: translateX(-50%); font-size: 11px; font-weight: 700; color: var(--accent); white-space: nowrap; }

.handle { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 8px 0 4px; color: var(--muted); font-weight: 600; font-size: 13px; width: 100%; }
.handle::before { content: ''; width: 40px; height: 5px; border-radius: 3px; background: #3A3A40; }

/* folded timer + sheet */
.folded { background: var(--surface); border-radius: 20px; padding: 12px 16px 10px; display: grid; grid-template-columns: 1fr auto auto; gap: 4px 12px; align-items: center; }
.folded .t { font-size: 30px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1; }
.folded .sub { font-size: 11px; color: var(--muted); }
.folded .nr { text-align: right; }
.folded .nr .v { color: var(--accent); font-weight: 700; font-size: 18px; font-variant-numeric: tabular-nums; }
.folded .bar { grid-column: 1 / -1; height: 3px; border-radius: 2px; background: var(--surface-2); overflow: hidden; margin-top: 6px; }
.folded .bar i { display: block; height: 100%; background: var(--accent); }

.segmented { display: flex; background: var(--surface); border-radius: 999px; padding: 4px; gap: 2px; }
.segmented button { flex: 1; height: 30px; border-radius: 999px; font-size: 13px; font-weight: 600; color: var(--muted); }
.segmented button[aria-pressed="true"] { background: var(--surface-2); color: var(--ink); }
.segmented.small button { height: 24px; font-size: 11px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { height: 28px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--surface-2); font-size: 12px; font-weight: 600; color: var(--muted); }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--canvas); border-color: var(--ink); }

.sheet-body { display: flex; flex-direction: column; gap: 14px; }
/* Stats: Timeline, Play time and Goals stacked on one scrolling page (design S8 / S8b / S8c) */
.stats-head { font-size: 16px; font-weight: 700; margin: 0; }
.stats-head:not(:first-child) { margin-top: 18px; }

/* stats: timeline chart */
.tl-chart { position: relative; display: grid; grid-template-columns: 72px 1fr; row-gap: 8px; column-gap: 6px; }
.tl-axis { grid-column: 2; position: relative; height: 14px; font-size: 9px; color: var(--muted); }
.tl-axis span { position: absolute; transform: translateX(-50%); }
.tl-name { font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; align-self: center; }
.tl-track { position: relative; height: 18px; }
.tl-grid { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--surface-2); }
.tl-seg { position: absolute; top: 3px; height: 12px; border-radius: 4px; }
.tl-seg.played { background: var(--in); }
.tl-seg.planned { border: 1.5px dashed #4A4A52; }
.tl-mark { position: absolute; top: -1px; transform: translateX(-50%); font-size: 12px; line-height: 20px; }
.tl-mark.assist { width: 14px; height: 14px; top: 2px; border-radius: 50%; border: 1.5px solid var(--ink); background: var(--canvas); font-size: 8px; font-weight: 700; line-height: 11px; text-align: center; }
.tl-overlay { position: absolute; top: 0; bottom: 0; left: 78px; right: 0; pointer-events: none; }
.tl-now { position: absolute; top: 10px; bottom: -4px; width: 2px; margin-left: -1px; background: var(--accent); }
.tl-now::after { content: 'now'; position: absolute; bottom: -18px; left: 50%; transform: translateX(-50%); background: var(--accent); color: #fff; font-size: 9px; font-weight: 700; border-radius: 999px; padding: 1px 6px; }
.tl-conceded { position: absolute; top: 2px; transform: translateX(-50%); width: 0; height: 0; border-left: 6px solid transparent; border-right: 6px solid transparent; border-top: 9px solid var(--out); }
.legend { font-size: 11px; color: var(--muted); text-align: center; display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 12px; margin-top: 14px; }
.legend .sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; vertical-align: -1px; margin-right: 4px; }

/* stats: play time */
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.tile { background: var(--surface); border-radius: 16px; padding: 10px; text-align: center; }
.tile b { display: block; font-size: 18px; font-variant-numeric: tabular-nums; }
.tile span { font-size: 11px; color: var(--muted); }
.pt-list { position: relative; display: flex; flex-direction: column; gap: 10px; }
.pt-row { display: grid; grid-template-columns: 72px 1fr 44px 52px; align-items: center; gap: 8px; font-size: 12px; }
.pt-row .n { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pt-row .v { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.bar { position: relative; height: 7px; border-radius: 4px; background: var(--surface-2); }
.bar i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 4px; background: var(--accent); }
.bar i.below { background: #6A6A72; }
.bar i.green { background: var(--in); }
.delta { font-size: 10px; font-weight: 700; border-radius: 999px; padding: 2px 0; text-align: center; font-variant-numeric: tabular-nums; }
.delta.pos { background: #14321F; color: var(--in); }
.delta.neg { background: #3A1A1C; color: var(--out); }
.fair-line { position: absolute; top: -4px; bottom: -4px; border-left: 1.5px dashed var(--ink); opacity: .8; pointer-events: none; }
.fair-line span { position: absolute; bottom: -18px; transform: translateX(-50%); font-size: 10px; font-weight: 700; white-space: nowrap; }

/* stats: goals */
.scoreboard { background: var(--surface); border-radius: 20px; padding: 12px 16px; }
.scoreboard .teams { display: flex; justify-content: space-between; font-size: 10px; font-weight: 700; letter-spacing: .05em; color: var(--muted); text-transform: uppercase; gap: 12px; }
.scoreboard .teams span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 48%; }
.scoreboard .big { text-align: center; font-size: 40px; font-weight: 700; font-variant-numeric: tabular-nums; }
.scoreboard .big i { font-style: normal; color: #55555c; margin: 0 6px; }
.ga-table { display: flex; flex-direction: column; gap: 8px; }
.ga-row { display: grid; grid-template-columns: 28px 1fr auto 32px 32px; align-items: center; gap: 8px; font-size: 13px; }
.ga-row .avatar { width: 26px; height: 26px; font-size: 9px; background: var(--surface-2); color: var(--ink); }
.ga-row b, .ga-row .h { text-align: center; }
.ga-row .h { font-size: 11px; color: var(--muted); font-weight: 700; }
.ga-row .zero { color: #55555c; }
.feed-row { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.feed-row .time-pill { background: var(--surface); color: var(--muted); }
.feed-row .x { margin-left: auto; color: var(--muted); width: 28px; height: 28px; border-radius: 50%; }

/* queue (live) */
.vq { position: relative; display: flex; flex-direction: column; gap: 6px; padding-left: 28px; }
.vq::before { content: ''; position: absolute; left: 7px; top: 12px; bottom: 12px; width: 2px; background: var(--surface-2); }
.vq-item { position: relative; padding: 8px 12px; border-radius: 16px; }
.vq-item::before { content: ''; position: absolute; left: -27px; top: 14px; width: 14px; height: 14px; border-radius: 50%; background: var(--canvas); border: 2px solid #3A3A40; box-sizing: border-box; }
.vq-item.done { color: var(--muted); }
.vq-item.done::before { background: var(--muted); border: 0; }
.vq-item.next { background: var(--surface); outline: 1.5px solid var(--accent); }
.vq-item.next::before { border: 3px solid var(--accent); }
.vq-item .when { font-size: 11px; font-weight: 700; color: var(--muted); display: flex; justify-content: space-between; }
.vq-item.next .when { color: var(--accent); }
.vq-item .what { font-size: 13px; margin-top: 2px; }
.vq-head { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin: 8px 0 2px -28px; }

/* field tab */
.field-group { display: flex; flex-direction: column; gap: 8px; }
.roster-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.roster-actions .btn { font-size: 13px; padding: 10px 8px; }
.pchip-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.pchip { min-width: 0; border-radius: 14px; padding: 10px 6px; text-align: center; font-weight: 700; font-size: 13px; background: var(--surface-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
body:not(.live) .pchip:not(.on) { background: var(--surface); }
.pchip small { display: block; font-weight: 500; font-size: 10px; color: var(--muted); margin-top: 2px; font-variant-numeric: tabular-nums; }
.pchip.on { background: #10B981; color: #fff; }
.pchip.on small { color: #D1FAE5; }
button.pchip:active { transform: scale(.97); }

/* overlays */
.overlay { position: fixed; inset: 0; z-index: 20; display: flex; flex-direction: column; justify-content: flex-end; animation: fade .15s ease; }
.overlay::before { content: ''; position: absolute; inset: 0; background: rgba(0, 0, 0, .6); }
.overlay.center { justify-content: center; padding: 16px; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.overlay > * { position: relative; width: 100%; max-width: 480px; margin: 0 auto; }
.rotate-card { background: #741E40; border-radius: 28px; padding: 22px 20px; color: #fff; display: flex; flex-direction: column; gap: 12px; animation: pop .2s ease; }
@keyframes pop { from { transform: scale(.94); opacity: 0; } to { transform: none; opacity: 1; } }
.rotate-card .head { text-align: center; font-size: 12px; font-weight: 700; letter-spacing: .08em; color: #F3CDDB; }
.rotate-card .clock { text-align: center; font-size: 15px; color: #F3CDDB; font-variant-numeric: tabular-nums; }
.pair { display: grid; grid-template-columns: 1fr 28px 1fr; align-items: center; }
.pair > div { border-radius: 16px; padding: 10px; text-align: center; font-weight: 700; font-size: 17px; }
.pair small { display: block; font-size: 9px; letter-spacing: .08em; }
.pair .o { background: #5A1730; }
.pair .o small { color: #F87171; }
.pair .i { background: #fff; color: #111114; }
.pair .i small { color: #059669; }
.pair .arrow { text-align: center; color: #F3CDDB; }
.rotate-card .later { color: #F3CDDB; font-size: 13px; font-weight: 600; padding: 6px; }
.rotate-card .auto-apply { text-align: center; font-size: 12px; color: #F3CDDB; }

.bottom-sheet { background: var(--surface); border-radius: 32px 32px 0 0; padding: 10px var(--gutter) calc(env(safe-area-inset-bottom) + 20px); display: flex; flex-direction: column; gap: 14px; animation: rise .22s ease; max-height: 88dvh; overflow: auto; }
.overlay.still, .overlay.still * { animation: none !important; }
@keyframes rise { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.bottom-sheet .grab { width: 40px; height: 5px; border-radius: 3px; background: #3A3A40; margin: 0 auto 4px; }
.bottom-sheet h2 { margin: 0; font-size: 20px; }
.choice-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.choice { height: 40px; border-radius: 999px; background: var(--surface-2); font-weight: 600; font-size: 13px; padding: 0 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.choice[aria-pressed="true"] { background: var(--ink); color: var(--canvas); }
.choice.outline[aria-pressed="true"] { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 2px var(--ink); }

/* halftime / fulltime */
.center-head { text-align: center; display: flex; flex-direction: column; gap: 4px; margin-top: 3vh; }
.center-head h1 { margin: 0; font-size: 32px; }
.center-head .badge { width: 64px; height: 64px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; font-size: 28px; margin: 0 auto 8px; }
.mini-list { display: flex; flex-direction: column; gap: 8px; }
.mini-row { display: grid; grid-template-columns: 70px 1fr 46px; align-items: center; gap: 8px; font-size: 12px; }
.mini-row .n { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-row .v { text-align: right; font-variant-numeric: tabular-nums; }
.mini-row .bar { height: 4px; }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 92px); transform: translateX(-50%);
  background: #111114; color: #fff; padding: 10px 16px; border-radius: 999px; font-size: 13px; font-weight: 600;
  z-index: 50; max-width: calc(100% - 32px); box-shadow: 0 6px 24px rgba(0, 0, 0, .2);
  pointer-events: none;
}
/* live mode: keep the bottom handle and buttons free */
body.live .toast { background: #FAFAFA; color: #111114; bottom: auto; top: calc(env(safe-area-inset-top) + 64px); }

.empty { text-align: center; color: var(--muted); font-size: 14px; padding: 24px 8px; }
.skeleton { background: linear-gradient(90deg, var(--surface) 0%, var(--surface-2) 50%, var(--surface) 100%); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 18px; height: 74px; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

.inline-icon { display: inline-block; vertical-align: -3px; margin-right: 4px; }
.inline-icon .icon { width: 14px; height: 14px; }

/* ---------------------------------------------------------------- accounts */
.form { display: flex; flex-direction: column; gap: 14px; }
.form label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
.form input {
  font: inherit; font-size: 16px; color: var(--ink); background: var(--surface);
  border: 1.5px solid var(--line); border-radius: 14px; padding: 13px 14px; outline: none;
}
.form input:focus { border-color: var(--accent); }
.form .hint { font-weight: 400; font-size: 12px; }
.form-error { background: var(--loss-soft); color: var(--loss); border-radius: 12px; padding: 10px 12px; font-size: 13px; font-weight: 600; }
.link-btn { color: var(--accent); font-weight: 600; text-decoration: underline; }
.choice-cards { display: flex; flex-direction: column; gap: 10px; }
.choice-card {
  display: flex; align-items: center; gap: 14px; text-align: left; font-size: 14px; line-height: 1.4;
  background: var(--surface); border-radius: 18px; padding: 14px; border: 2px solid transparent;
}
.choice-card[aria-pressed="true"] { border-color: var(--accent); }
.choice-card[aria-pressed="true"] .avatar { background: var(--accent); color: #fff; }
.player-tile:disabled { opacity: .45; }
.profile-head { display: flex; align-items: center; gap: 14px; }
.avatar.big { width: 56px; height: 56px; font-size: 18px; background: var(--accent); color: #fff; }
.member { display: flex; align-items: center; gap: 12px; background: var(--surface); border-radius: var(--radius-tile); padding: 10px 12px; }
.member .grow { flex: 1; min-width: 0; }
.member .title { font-weight: 600; font-size: 14px; }
.member .meta { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member.pending { border: 2px solid var(--draw); }
body:not(.live) .icon-btn { background: var(--canvas); }
body:not(.live) .chip { border-color: var(--line); }
.chip.on, body:not(.live) .chip.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.temp-pw { font-size: 22px; font-weight: 700; letter-spacing: .04em; margin: 4px 0; user-select: all; }
.live-hero .live-score { font-size: 54px; font-weight: 700; line-height: 1; margin: 6px 0; }
.live-hero .live-score i { font-style: normal; opacity: .5; margin: 0 8px; }
.header-avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 700; margin-left: auto; }
.viewer-pill { background: var(--surface-2); color: var(--muted); font-size: 11px; font-weight: 700; border-radius: 999px; padding: 5px 10px; }
.notice { background: var(--draw-soft); color: #92400e; border-radius: 14px; padding: 10px 14px; font-size: 13px; }
.notice.team-list { background: var(--accent-soft); color: var(--accent); line-height: 1.45; }   /* sign-up: player proposed from the team list */

/* ---------------------------------------------------------------- autopilot live design (S6–S11) */
.live-top .home-btn { font-size: 24px; font-weight: 700; line-height: 1; padding-bottom: 3px; }
.mode-row { display: flex; justify-content: center; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.mode-pill { background: #2A1520; color: var(--accent); font-size: 11px; font-weight: 700; border-radius: 999px; padding: 5px 12px; }
.mode-pill.manual { background: var(--surface-2); color: var(--muted); }
.mode-pill.paused { background: #33240E; color: var(--draw); }
div.next-rot { cursor: default; }
/* data shelf: a big, unmistakable close at the top, then the folded clock with goal logging */
.shelf-close { align-self: center; display: inline-flex; align-items: center; gap: 4px; height: 34px; padding: 0 20px;
  border-radius: 999px; background: var(--surface-2); color: var(--ink); font-weight: 700; font-size: 14px; }
.folded.with-goal { grid-template-columns: 1fr auto auto; }
.folded { grid-template-columns: 1fr auto; }
.folded .goal-btn { height: 36px; padding: 0 14px; border-radius: 999px; background: var(--accent); color: #fff; font-weight: 700; font-size: 13px; }
/* settings tab */
.set-card { background: var(--surface); border-radius: 20px; padding: 14px 16px; }
.set-row { display: flex; align-items: center; gap: 12px; }
.set-row .grow { flex: 1; min-width: 0; }
.set-row b { font-size: 15px; }
.set-row .muted { font-size: 12px; margin-top: 4px; line-height: 1.35; }
.switch { width: 52px; height: 30px; border-radius: 999px; background: var(--surface-2); position: relative; flex: none; transition: background .15s; }
.switch i { position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch[aria-checked="true"] { background: var(--accent); }
.switch[aria-checked="true"] i { transform: translateX(22px); }
.stepper.dark { background: var(--surface-2); flex: none; }
.stepper.dark button { background: var(--surface); color: var(--ink); }
.stepper.dark button.plus { background: var(--accent); color: #fff; }
.btn-surface { background: var(--surface-2); color: var(--ink); width: 100%; }
.btn-ghost.danger { background: transparent; color: var(--out); height: 40px; font-size: 14px; }
/* rotation notification */
.rotate-card.soon .head, .rotate-card.done .head { font-size: 13px; }
.rotate-card .auto-apply { font-size: 13px; font-weight: 600; padding: 6px 0 2px; }
/* goal shortcut on the match screen (S6) */
.goal-fab-row { display: flex; justify-content: center; gap: 8px; margin-bottom: 22px; }
.field-edit-fab { height: 44px; padding: 0 18px; border-radius: 999px; background: var(--surface-2); color: var(--ink); font-weight: 700; font-size: 14px; }
.goal-fab { height: 44px; padding: 0 20px; border-radius: 999px; background: var(--accent); color: #fff; font-weight: 700; font-size: 15px; }
.goal-fab:active { transform: scale(.97); }

/* home: link to the LZV team page */
/* small muted links at the bottom of a screen: the user guide and the LZV team page */
.foot-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 0 14px; margin: 20px 0 4px; }
.foot-link { display: flex; align-items: center; gap: 6px; padding: 8px 4px; color: var(--muted); font-size: 13px;
  text-decoration: none; }
.foot-link:active { opacity: .6; }
.foot-link img { width: 16px; height: 16px; border-radius: 4px; opacity: .85; }
.help-dot { display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 50%;
  border: 1.5px solid currentColor; font-size: 10px; font-weight: 700; line-height: 1; }
/* goal badges: Can Opener / Pea Crusher / Pari Blast */
.badge-ico { width: 30px; height: 30px; flex: none; object-fit: contain; }
.badge-ico.sm { width: 18px; height: 18px; }
.badge-card { display: flex; flex-direction: column; gap: 10px; background: var(--surface); border-radius: 16px; padding: 12px 14px; margin-bottom: 14px; }
.badge-row { display: flex; align-items: center; gap: 12px; font-size: 13px; }
.ga-row .badges { display: flex; gap: 2px; justify-content: flex-end; }
.badge-count { position: relative; display: inline-flex; }
.badge-count i { position: absolute; right: -4px; bottom: -4px; font-style: normal; font-size: 9px; font-weight: 700; background: var(--ink); color: var(--surface); border-radius: 8px; padding: 0 3px; line-height: 13px; }

/* ---------------------------------------------------------------- Home timeline (S1, S1b, S1c) */
/* one vertical rail: later fixtures above, the next match, Today, played matches below (newest first) */
.home-nav {
  position: sticky; top: 0; z-index: 5; background: var(--canvas);
  margin: calc(-1 * (env(safe-area-inset-top) + 16px)) calc(-1 * var(--gutter)) 0;
  padding: calc(env(safe-area-inset-top) + 16px) var(--gutter) 8px;
}
.home-rest { display: flex; flex-direction: column; gap: 16px; min-height: calc(100dvh - 72px - env(safe-area-inset-top)); }
.tl { position: relative; display: flex; flex-direction: column; gap: 10px; padding-left: 32px; }
.tl > * { position: relative; }
.tl > *::after {                                         /* the rail, per item: solid; dotted for the future */
  content: ""; position: absolute; left: -21px; top: 0; bottom: -10px; width: 2px; background: var(--line); z-index: -1;
}
.tl > :last-child::after { bottom: 0; }
.tl > .future::after { background: repeating-linear-gradient(to bottom, var(--future) 0 3px, transparent 3px 7px); }
.tl-item::before {                                       /* plain grey dot on the rail */
  content: ""; position: absolute; left: -26px; top: 50%; width: 10px; height: 10px; margin-top: -5px;
  border-radius: 50%; background: var(--muted);
}
.tl-item.tl-next::before {                               /* the only coloured dot: where Home opens */
  left: -29px; top: 14px; margin-top: 0; width: 18px; height: 18px;
  background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft);
}
.tl-marker { position: relative; font-size: 11px; font-weight: 700; color: var(--muted); line-height: 18px; }
.tl-marker::before { content: ""; position: absolute; left: -24px; top: 5px; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.tl-today { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 32px; }
.tl-today::before { top: 12px; }
.tl-practice {                                           /* starts a practice match (S2) */
  height: 32px; padding: 0 14px; border-radius: 50px; background: var(--surface); flex: none;
  border: 1.5px solid var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 700;
}
.tl-practice:active { opacity: .7; }
.tl-more { align-self: flex-start; font-size: 11px; font-weight: 700; color: var(--muted); line-height: 18px; }
.tl-card {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; color: var(--ink); border-radius: 16px;
}
.tl-card.later { flex-direction: column; align-items: flex-start; gap: 0; min-height: 62px; padding: 9px 14px;
  background: var(--canvas); border: 1.5px dashed var(--future); }
.tl-item.future::before { background: var(--canvas); border: 2px solid var(--future); }
.tl-card.past { min-height: 70px; padding: 12px 16px; background: var(--surface); }
button.tl-card.past:active { opacity: .7; }
.tl-text { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.tl-date { font-size: 10px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.tl-opp { font-size: 15px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.tl-card.later .tl-opp { font-size: 14px; }
.tl-meta { font-size: 11px; color: var(--muted); }
.tl-score { font-size: 20px; font-weight: 700; flex: none; }
.tl-empty { font-size: 13px; }
.leaders { background: var(--surface); border-radius: 20px; padding: 16px; }
.leaders-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.leaders-head h2 { font-size: 18px; margin: 0; }
.leaders-head > span { font-size: 10px; color: var(--muted); }
.leader-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 14px 0 6px; }
.leader-tab { min-height: 34px; border-radius: 999px; color: var(--muted); font-size: 12px; font-weight: 700; }
.leader-tab.active { background: var(--accent-soft); color: var(--accent); }
.leader-row { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; align-items: center; gap: 8px; min-height: 48px; }
.leader-row + .leader-row { border-top: 1px solid var(--line); }
.leader-rank { color: var(--muted); font-size: 12px; font-weight: 700; text-align: center; }
.leader-name { font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.leader-value { font-size: 12px; white-space: nowrap; }
.leader-empty { padding: 18px 0 8px; font-size: 13px; text-align: center; }
.tl-jump {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 28px); transform: translateX(-50%); z-index: 6;
  height: 36px; padding: 0 22px; border-radius: 50px; background: var(--ink); color: var(--surface);
  font-size: 13px; font-weight: 700; box-shadow: 0 6px 20px rgba(0, 0, 0, .18);
}
.tl-jump[hidden] { display: none; }

/* ---------------------------------------------------------------- past match (S12) */
.past-score { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.past-score .big { font-size: 40px; font-weight: 700; letter-spacing: -.02em; }
.pill.result.W { background: var(--win-soft); color: var(--win); }
.pill.result.L { background: var(--loss-soft); color: var(--loss); }
.pill.result.D { background: var(--draw-soft); color: var(--draw); }
.badge-list { display: flex; flex-direction: column; gap: 4px; }
.past-match .card > .label { margin-bottom: 10px; }
.past-feed { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }

/* ---------------------------------------------------------------- live plan changes (S9b, S9c, S13, S14) */
button.vq-item { display: block; width: 100%; text-align: left; color: inherit; font: inherit; }
button.vq-item:not(.next):active { background: var(--surface); }
.vq-item .vq-go { position: absolute; right: 10px; top: 50%; transform: translateY(-20%); font-size: 18px; font-weight: 700; color: var(--muted); }
button.vq-item .what { padding-right: 18px; }
.pin-tag { background: var(--accent-soft); color: var(--accent); border-radius: 999px; padding: 1px 8px; font-size: 10px; font-weight: 700; }
.vq-changes { background: var(--accent-soft); color: var(--accent); border-radius: 999px; padding: 4px 12px; font-size: 11px; font-weight: 700; text-align: center; margin-bottom: 8px; }
.vq-hint { color: var(--muted); font-size: 11px; text-align: center; margin-top: 12px; }
button.pchip { color: inherit; font: inherit; font-weight: 700; font-size: 13px; }
button.pchip.on { color: #fff; }
.set-card.rhythm { display: flex; flex-direction: column; gap: 8px; }
.set-card.rhythm > .muted { font-size: 11px; line-height: 1.35; }
.rhythm-stepper { display: flex; align-items: center; gap: 2px; flex: none; }
.rhythm-stepper .rstep { width: 32px; height: 32px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--surface-2); color: var(--ink); font-size: 18px; font-weight: 700; line-height: 1; }
.rhythm-stepper .rstep:disabled { opacity: .35; }
.rhythm-stepper .v { width: 56px; text-align: center; font-size: 17px; font-weight: 700; }
.rhythm-stepper .v.changed { color: var(--accent); }
.btn.small { height: 34px; font-size: 13px; padding: 0 16px; }
.edit-time { display: flex; align-items: center; gap: 8px; }
.edit-time .muted { font-size: 13px; font-weight: 700; }
.edit-time b { font-size: 22px; }
.choice.small { height: 30px; width: 60px; flex: none; font-size: 12px; }
.choice.small:disabled { opacity: .35; }
.choice.pick-out { background: #5A1730; color: #fff; box-shadow: inset 0 0 0 2px var(--out); }
.choice.pick-in { background: #0F3B2C; color: #fff; box-shadow: inset 0 0 0 2px var(--in); }
.sheet-note { font-size: 11px; line-height: 1.35; text-align: center; }
.bottom-sheet .label .io-in, .bottom-sheet .label .io-out { font-size: inherit; }
