/* My Hockey Stats — design tokens and components
   Palette: deep navy, ice white, goal-line red. Type: Barlow + Barlow Condensed (self-hosted, OFL). */

@font-face { font-family: "Barlow"; src: url("../fonts/Barlow-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Barlow"; src: url("../fonts/Barlow-Medium.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Barlow"; src: url("../fonts/Barlow-SemiBold.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Barlow Condensed"; src: url("../fonts/BarlowCondensed-SemiBold.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Barlow Condensed"; src: url("../fonts/BarlowCondensed-Bold.woff2") format("woff2"); font-weight: 700; font-display: swap; }

:root {
  --navy: #0F2342;
  --navy-deep: #0A1930;
  --navy-soft: #1C3560;
  --ice: #F4F8FB;
  --surface: #FFFFFF;
  --frost: #E6EEF5;
  --line: #D3DEE9;
  --text: #0F2342;
  --muted: #4A5B73;
  --red: #D3263C;
  --red-dark: #B01C30;
  --blue-line: #2B6CD4;
  --ok: #1E7A4C;
  --ok-bg: #E4F3EB;
  --warn: #8A5A00;
  --warn-bg: #FFF4DC;
  --err-bg: #FCE8EB;

  --font-body: "Barlow", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Barlow Condensed", "Arial Narrow", "Roboto Condensed", system-ui, sans-serif;

  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 16px;
  --tap: 48px;
  --wrap: 1080px;
  --header-h: 60px;
  --tabbar-h: 64px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + var(--safe-top) + 12px); }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.5;
  color: var(--text);
  background: var(--ice);
  min-height: 100vh;
  min-height: 100dvh;
}
img, svg { max-width: 100%; height: auto; }
a { color: var(--blue-line); text-underline-offset: 2px; }
a:hover { color: var(--navy); }

:focus-visible {
  outline: 3px solid var(--blue-line);
  outline-offset: 2px;
  border-radius: 4px;
}

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; margin: -1px; padding: 0; border: 0;
}

.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 100;
  background: var(--surface); color: var(--navy); padding: 10px 14px; border-radius: var(--r-sm);
  font-weight: 600;
}
.skip-link:focus { top: calc(12px + var(--safe-top)); }

/* ---------- Type ---------- */
h1, h2, h3 { font-family: var(--font-display); font-weight: 700; line-height: 1.1; margin: 0 0 .5rem; letter-spacing: .005em; }
h1 { font-size: clamp(1.9rem, 1.4rem + 2vw, 2.6rem); }
h2 { font-size: 1.55rem; }
h3 { font-size: 1.2rem; font-weight: 600; }
p { margin: 0 0 1rem; max-width: 68ch; }
.muted { color: var(--muted); }
.small { font-size: .9rem; }
.num { font-family: var(--font-display); font-variant-numeric: tabular-nums; font-weight: 700; }

/* ---------- App header ---------- */
.app-header {
  position: sticky; top: 0; z-index: 30;
  background: var(--navy);
  color: #fff;
  padding-top: var(--safe-top);
  border-bottom: 3px solid var(--red);
}
.app-header .wrap {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  min-height: var(--header-h);
}
.brand { display: inline-flex; align-items: center; }
.brand img { height: 30px; width: auto; display: block; }
.top-nav { display: none; gap: 4px; align-items: center; }
.top-nav a, .top-nav button {
  color: #DCE6F2; text-decoration: none; font-weight: 500;
  padding: 10px 14px; border-radius: var(--r-sm); background: none; border: 0; font: inherit; cursor: pointer;
  min-height: 44px; display: inline-flex; align-items: center;
}
.top-nav a:hover, .top-nav button:hover { color: #fff; background: var(--navy-soft); }
.top-nav a[aria-current="page"] { color: #fff; box-shadow: inset 0 -3px 0 var(--red); border-radius: 0; }
.header-actions { display: flex; align-items: center; gap: 8px; }

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin: 0 auto;
  padding-left: max(16px, var(--safe-left));
  padding-right: max(16px, var(--safe-right));
}

main.app-main {
  padding-top: 24px;
  padding-bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 32px);
}

/* ---------- Bottom tab bar (mobile) ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding-bottom: var(--safe-bottom);
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
}
.tabbar a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: var(--tabbar-h);
  color: var(--muted); text-decoration: none; font-size: .78rem; font-weight: 600;
}
.tabbar svg { width: 24px; height: 24px; }
.tabbar a[aria-current="page"] { color: var(--navy); }
.tabbar a[aria-current="page"] svg { color: var(--red); }

@media (min-width: 900px) {
  .top-nav { display: flex; }
  .tabbar { display: none; }
  main.app-main { padding-bottom: 56px; }
}

/* ---------- Flash messages ---------- */
.flashes { display: grid; gap: 8px; margin-bottom: 20px; }
.flash {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 14px; border-radius: var(--r-sm); border: 1px solid transparent; font-weight: 500;
}
.flash::before { font-weight: 700; flex: none; }
.flash-success { background: var(--ok-bg); border-color: #B7DEC8; color: #145336; }
.flash-success::before { content: "✓"; }
.flash-error { background: var(--err-bg); border-color: #F2B8C1; color: #8E1526; }
.flash-error::before { content: "!"; }
.flash-info { background: var(--frost); border-color: var(--line); color: var(--navy); }
.flash-info::before { content: "i"; font-style: italic; font-family: Georgia, serif; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap); padding: 0 20px;
  font: 600 1rem/1 var(--font-body);
  border-radius: var(--r-sm); border: 2px solid transparent;
  text-decoration: none; cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease;
}
.btn-primary { background: var(--red); color: #fff; }
.btn-primary:hover { background: var(--red-dark); color: #fff; }
.btn-secondary { background: var(--surface); color: var(--navy); border-color: var(--navy); }
.btn-secondary:hover { background: var(--frost); color: var(--navy); }
.btn-ghost { background: transparent; color: var(--navy); border-color: var(--line); }
.btn-ghost:hover { background: var(--frost); color: var(--navy); }
.btn-danger { background: var(--surface); color: var(--red-dark); border-color: var(--red); }
.btn-danger:hover { background: var(--err-bg); color: var(--red-dark); }
.btn-on-dark { background: transparent; color: #fff; border-color: rgba(255,255,255,.5); }
.btn-on-dark:hover { background: var(--navy-soft); color: #fff; }
.btn-small { min-height: 40px; padding: 0 14px; font-size: .92rem; }
.btn-block { width: 100%; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
.link-button { background: none; border: 0; padding: 0; font: inherit; color: var(--blue-line); text-decoration: underline; cursor: pointer; }

/* ---------- Page header ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 24px; margin-bottom: 24px; }
.page-head p { margin: 0; }
.back-link { display: inline-block; margin-bottom: 8px; font-weight: 600; text-decoration: none; }
.back-link::before { content: "‹ "; }

/* ---------- Panels ---------- */
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 20px;
}
.panel + .panel, .panel + section, section + .panel { margin-top: 20px; }
.panel h2 { font-size: 1.35rem; }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 12px; }
.panel-head h2 { margin: 0; }
.panel-danger { border-color: #F2B8C1; }

/* ---------- Forms ---------- */
.form { display: grid; gap: 20px; }
.form-section { display: grid; gap: 16px; }
.form-section > h2 { margin: 0; }
.field { display: grid; gap: 6px; }
.field label, .field legend, .label {
  font-weight: 600; font-size: .98rem;
}
.field .optional { font-weight: 400; color: var(--muted); }
.help { font-size: .9rem; color: var(--muted); margin: 0; }
.input, .select, .textarea {
  width: 100%;
  min-height: var(--tap);
  padding: 10px 12px;
  font: 400 16px/1.4 var(--font-body);   /* 16px prevents iOS zoom on focus */
  color: var(--text);
  background: var(--surface);
  border: 1.5px solid #AFC0D3;
  border-radius: var(--r-sm);
}
.textarea { min-height: 110px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--blue-line); outline: 3px solid rgba(43,108,212,.25); outline-offset: 0; }
.input[aria-invalid="true"], .select[aria-invalid="true"], .textarea[aria-invalid="true"] { border-color: var(--red); }
.error-text { color: #A3192C; font-size: .92rem; font-weight: 600; margin: 0; display: flex; gap: 6px; }
.error-text::before { content: "⚠"; }
.row { display: grid; gap: 16px; }
@media (min-width: 640px) {
  .row-2 { grid-template-columns: 1fr 1fr; }
  .row-3 { grid-template-columns: repeat(3, 1fr); }
}
.input-unit { display: grid; grid-template-columns: 1fr 96px; gap: 8px; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.form-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }

/* Large toggle chips for checkbox/radio groups (thumb-friendly at the rink) */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.chip span {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: var(--tap); padding: 0 18px;
  border: 1.5px solid #AFC0D3; border-radius: 999px;
  background: var(--surface); font-weight: 600;
}
.chip span::before {
  content: ""; width: 16px; height: 16px; border-radius: 4px; border: 2px solid #8DA2BA; flex: none;
}
.chip input[type="radio"] + span::before { border-radius: 50%; }
.chip input:checked + span { background: var(--navy); border-color: var(--navy); color: #fff; }
.chip input:checked + span::before {
  border-color: #fff; background: var(--red);
  box-shadow: inset 0 0 0 2px var(--navy);
}
.chip input:focus-visible + span { outline: 3px solid var(--blue-line); outline-offset: 2px; }

.check { display: flex; gap: 10px; align-items: flex-start; }
.check input { width: 22px; height: 22px; margin-top: 2px; accent-color: var(--navy); flex: none; }

/* ---------- Badges (status never by color alone: always text) ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 999px;
  font-size: .82rem; font-weight: 600; line-height: 1.4;
  border: 1px solid var(--line); background: var(--frost); color: var(--navy);
}
.badge-private::before { content: "🔒"; font-size: .8em; }
.badge-manual { background: var(--warn-bg); border-color: #EBCB85; color: var(--warn); }
.badge-games { background: var(--ok-bg); border-color: #B7DEC8; color: #145336; }

/* ---------- Player hero (the one bold element) ---------- */
.player-hero {
  position: relative; overflow: hidden;
  background: var(--navy);
  color: #fff;
  border-radius: var(--r-lg);
  padding: 24px;
  isolation: isolate;
}
.player-hero .jersey {
  position: absolute; right: -8px; bottom: -42px; z-index: -1;
  font: 700 clamp(10rem, 30vw, 16rem)/1 var(--font-display);
  color: transparent;
  -webkit-text-stroke: 2px rgba(255,255,255,.16);
  letter-spacing: -.02em;
  user-select: none;
}
.player-hero-top { display: flex; gap: 16px; align-items: center; }
.avatar {
  width: 72px; height: 72px; border-radius: 50%; flex: none; object-fit: cover;
  background: var(--navy-soft); color: #fff;
  display: grid; place-items: center;
  font: 700 1.6rem/1 var(--font-display);
  border: 3px solid #fff;
}
.player-hero h1 { margin: 0; font-size: clamp(2rem, 1.5rem + 2.5vw, 3rem); }
.player-meta { color: #C7D4E4; margin: 4px 0 0; }
.player-facts { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 18px 0 0; padding: 0; list-style: none; color: #DCE6F2; font-size: .95rem; }
.player-facts strong { color: #fff; font-weight: 600; }
.player-hero .hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }

/* Stat line, scoreboard-style. Markup: <dl><div><dt class="abbr"/><dd class="num"/></div></dl> */
.statline { display: grid; grid-template-columns: repeat(auto-fit, minmax(68px, 1fr)); border-top: 1px solid var(--line); margin: 0; }
.statline div { display: flex; flex-direction: column-reverse; align-items: center; justify-content: flex-end; padding: 12px 6px 6px; text-align: center; border-right: 1px solid var(--line); }
.statline div:last-child { border-right: 0; }
.statline dd { margin: 0; }
.statline .num { display: block; font-size: 2.2rem; line-height: 1; }
.statline .abbr { display: block; font-size: .8rem; font-weight: 600; color: var(--muted); margin-top: 6px; }
.statline abbr { text-decoration: none; }
.stat-note { display: block; font: 500 .72rem/1.2 var(--font-body); color: var(--muted); margin-top: 4px; letter-spacing: 0; }
.more-stats { margin-top: 12px; }
.more-stats summary { cursor: pointer; font-weight: 600; color: var(--blue-line); min-height: 44px; display: flex; align-items: center; }

/* ---------- Lists ---------- */
.profile-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.profile-row {
  display: flex; align-items: center; gap: 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 14px 16px;
}
.profile-row.is-active { border-color: var(--navy); box-shadow: inset 4px 0 0 var(--red); }
.profile-row .avatar { width: 52px; height: 52px; font-size: 1.15rem; border: 0; }
.profile-row .grow { flex: 1; min-width: 0; }
.profile-row h2 { font-size: 1.3rem; margin: 0; }
.profile-row p { margin: 2px 0 0; color: var(--muted); font-size: .94rem; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

.checklist { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.checklist li { display: flex; gap: 12px; align-items: flex-start; }
.checklist .mark {
  flex: none; width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center; font-weight: 700; font-size: .85rem;
  border: 2px solid var(--line); color: var(--muted);
}
.checklist .done .mark { background: var(--ok); border-color: var(--ok); color: #fff; }
.checklist .soon { color: var(--muted); }

.empty {
  text-align: center; padding: 36px 20px;
  border: 2px dashed var(--line); border-radius: var(--r-md); background: var(--surface);
}
.empty p { margin-left: auto; margin-right: auto; }

.dl { display: grid; grid-template-columns: max-content 1fr; gap: 8px 20px; margin: 0; }
.dl dt { font-weight: 600; color: var(--muted); }
.dl dd { margin: 0; }

/* ---------- Auth / setup layout ---------- */
body.is-auth {
  background-color: var(--navy);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 400'%3E%3Ccircle cx='200' cy='200' r='170' fill='none' stroke='%23D3263C' stroke-opacity='.35' stroke-width='4'/%3E%3Ccircle cx='200' cy='200' r='9' fill='%23D3263C' fill-opacity='.45'/%3E%3Cpath d='M175 120v-30M225 120v-30M175 280v30M225 280v30' stroke='%23D3263C' stroke-opacity='.35' stroke-width='4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-size: min(120vw, 820px);
  background-position: 115% 110%;
  background-attachment: fixed;
}
.auth-shell {
  min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: calc(32px + var(--safe-top)) 16px calc(32px + var(--safe-bottom));
  gap: 24px;
}
.auth-brand img { width: min(300px, 80vw); height: auto; display: block; }
.auth-card {
  width: 100%; max-width: 440px;
  background: var(--surface); border-radius: var(--r-lg); padding: 28px 24px;
}
.auth-card.wide { max-width: 620px; }
.auth-card h1 { font-size: 2rem; }
.auth-footer { color: #C7D4E4; text-align: center; font-size: .95rem; }
.auth-footer a { color: #fff; font-weight: 600; }

/* ---------- Landing ---------- */
.landing-hero {
  background: var(--navy); color: #fff;
  padding: calc(20px + var(--safe-top)) 0 56px;
  position: relative; overflow: hidden; isolation: isolate;
}
.landing-hero::after {
  content: ""; position: absolute; z-index: -1; right: -180px; top: 40px; width: 560px; height: 560px;
  border-radius: 50%; border: 4px solid rgba(211,38,60,.35);
}
.landing-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 56px; }
.landing-top img { height: 30px; width: auto; }
.landing-top nav { display: flex; gap: 8px; }
.landing-grid { display: grid; gap: 36px; margin-top: 44px; align-items: center; }
@media (min-width: 900px) { .landing-grid { grid-template-columns: 1.05fr .95fr; margin-top: 72px; } }
.landing-hero h1 { font-size: clamp(2.6rem, 1.6rem + 4.5vw, 4.6rem); line-height: .98; margin-bottom: 18px; }
.landing-hero .lede { font-size: 1.15rem; color: #DCE6F2; max-width: 46ch; }
.landing-cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; }

.sample-card { background: var(--surface); color: var(--text); border-radius: var(--r-lg); padding: 20px 20px 16px; }
.sample-card + .sample-card { margin-top: 12px; }
.sample-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 4px; flex-wrap: wrap; }
.sample-head h2 { font-size: 1.35rem; margin: 0; }
.sample-note { font-size: .88rem; color: var(--muted); margin: 10px 0 0; }

.landing-points { padding: 56px 0 72px; }
.points { display: grid; gap: 28px; }
@media (min-width: 800px) { .points { grid-template-columns: repeat(3, 1fr); gap: 36px; } }
.points h2 { font-size: 1.5rem; padding-top: 14px; border-top: 3px solid var(--navy); }
.landing-foot { border-top: 1px solid var(--line); padding: 24px 0 calc(24px + var(--safe-bottom)); color: var(--muted); font-size: .92rem; }

/* ---------- Install hint ---------- */
.install-hint {
  display: flex; gap: 12px; align-items: center; flex-wrap: wrap;
  background: var(--frost); border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 12px 14px; margin-bottom: 20px;
}
.install-hint[hidden] { display: none; }
.install-hint img { width: 40px; height: 40px; border-radius: 9px; flex: none; }
.install-hint p { margin: 0; flex: 1; min-width: 200px; }

/* ---------- Setup checks ---------- */
.checks { list-style: none; padding: 0; margin: 0 0 20px; display: grid; gap: 8px; }
.checks li { display: flex; gap: 10px; align-items: flex-start; }
.checks .state { flex: none; font-weight: 700; min-width: 64px; }
.checks .pass { color: var(--ok); }
.checks .fail { color: #A3192C; }
.checks .warn { color: var(--warn); }

/* ---------- Motion & print ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

@media print {
  .app-header, .tabbar, .install-hint, .hero-actions, .form-actions, .flashes { display: none !important; }
  body { background: #fff; }
  .player-hero { background: #fff; color: #000; border: 2px solid #000; }
  .player-hero .jersey { display: none; }
  .player-meta, .player-facts, .player-facts strong { color: #000; }
}

/* Player switcher (multi-player accounts) */
.switcher { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.switcher form { margin: 0; }
.switcher-item {
  display: inline-flex; align-items: center; min-height: var(--tap); padding: 0 18px;
  border-radius: 999px; border: 1.5px solid #AFC0D3; background: var(--surface);
  font: 600 1rem/1 var(--font-body); color: var(--navy); cursor: pointer;
}
.switcher-item:hover { background: var(--frost); }
.switcher-item.is-current { background: var(--navy); border-color: var(--navy); color: #fff; cursor: default; }

/* ---------- Phase 2: seasons & games ---------- */
.center { justify-content: center; }
.wrap-head { flex-wrap: wrap; }
.badge-mixed { background: #EEE8FB; border-color: #CFC2EF; color: #4B2E8A; }
.note-box { background: var(--frost); border-left: 4px solid var(--blue-line); border-radius: var(--r-sm); padding: 14px 16px; margin-bottom: 20px; }
.note-box p:last-child { margin-bottom: 0; }
.note-inline { margin: 12px 0 0; padding: 10px 12px; background: var(--warn-bg); border-radius: var(--r-sm); color: var(--warn); font-weight: 500; }
.note-inline a { color: inherit; font-weight: 700; }
.panel-attention { border-color: #EBCB85; box-shadow: inset 4px 0 0 #E0A82E; }

.stat-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.stat-field label { display: flex; gap: 8px; align-items: baseline; font-weight: 500; }
.stat-abbr { font: 700 1.05rem/1 var(--font-display); color: var(--navy); min-width: 2.4em; }
.num-input { font-family: var(--font-display); font-size: 1.35rem; font-weight: 700; font-variant-numeric: tabular-nums; text-align: center; }

/* Stepper: [−][ input ][+] built by app.js */
.stepper { display: grid; grid-template-columns: var(--tap) 1fr var(--tap); }
.stepper .input { border-radius: 0; border-left: 0; border-right: 0; min-width: 0; }
.stepper button {
  min-height: var(--tap); border: 1.5px solid #AFC0D3; background: var(--frost); color: var(--navy);
  font: 700 1.4rem/1 var(--font-display); cursor: pointer;
}
.stepper button:first-child { border-radius: var(--r-sm) 0 0 var(--r-sm); }
.stepper button:last-child { border-radius: 0 var(--r-sm) var(--r-sm) 0; }
.stepper button:active { background: var(--line); }

.options { display: grid; gap: 10px; }
.option { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border: 1.5px solid var(--line); border-radius: var(--r-md); background: var(--surface); cursor: pointer; }
.option input { width: 22px; height: 22px; margin-top: 2px; accent-color: var(--navy); flex: none; }
.option strong { display: block; }
.option:has(input:checked) { border-color: var(--navy); box-shadow: inset 4px 0 0 var(--red); }

.table-wrap { overflow-x: auto; margin: 0 -4px 12px; padding: 0 4px; }
.stats-table { border-collapse: collapse; width: 100%; min-width: 520px; }
.stats-table th, .stats-table td { padding: 10px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.stats-table thead th { font-size: .82rem; color: var(--muted); font-weight: 600; white-space: nowrap; }
.stats-table thead abbr { text-decoration: none; }
.stats-table .n { text-align: right; }
.stats-table td.num { font-size: 1.15rem; }
.stats-table tbody th { font-weight: 600; }
.stats-table tbody th a { font: 700 1.1rem/1.2 var(--font-display); }
.stats-table .sub { display: block; font-size: .82rem; color: var(--muted); font-weight: 400; margin-top: 2px; }
.stats-table tbody th:first-child { position: sticky; left: 0; background: var(--surface); }

.game-list { list-style: none; margin: 0; padding: 0; }
.game-row { display: flex; gap: 14px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.game-row:last-child { border-bottom: 0; }
.game-row:target { background: var(--frost); }
.game-date { width: 48px; flex: none; text-align: center; color: var(--muted); font-size: .78rem; font-weight: 600; text-transform: uppercase; line-height: 1.1; }
.game-date .num { display: block; font-size: 1.6rem; color: var(--navy); }
.game-title { margin: 0; font-weight: 600; }
.game-sub { margin: 2px 0 0; color: var(--muted); font-size: .94rem; }

.filters { display: grid; gap: 12px; margin-bottom: 12px; }
@media (min-width: 720px) { .filters { grid-template-columns: repeat(4, 1fr); align-items: end; } .filters .form-actions { grid-column: 1 / -1; } }
.pager { display: flex; gap: 12px; align-items: center; justify-content: center; margin-top: 16px; }
.season-picker { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.season-picker label { font-weight: 600; }
.season-picker .select { width: auto; min-width: 160px; }
.js .season-picker button { display: none; }

.js [data-for-position][hidden], .js [data-played-only][hidden] { display: none; }
.sticky-actions { position: sticky; bottom: calc(var(--tabbar-h) + var(--safe-bottom)); background: var(--ice); padding: 12px 0; z-index: 5; border-top: 1px solid var(--line); }
@media (min-width: 900px) { .sticky-actions { bottom: 0; } }

/* Center "Record" tab */
.tab-record .record-dot {
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  background: var(--red); color: #fff; margin-top: -14px; border: 3px solid var(--surface);
}
.tab-record .record-dot svg { width: 20px; height: 20px; }
.tabbar a.tab-record[aria-current="page"] svg { color: #fff; }
.top-nav a.btn-primary { color: #fff; margin-left: 6px; }
.top-nav a.btn-primary:hover { background: var(--red-dark); }
.top-nav a.btn-primary[aria-current="page"] { box-shadow: none; border-radius: var(--r-sm); }

/* ---------- Phase 3: discipline & charts ---------- */
[hidden] { display: none !important; }
.badge-disc { background: var(--err-bg); border-color: #F2B8C1; color: #8E1526; }
.suspension-note { margin: 0 0 16px; }
.plain-list { margin: 0; padding-left: 1.2em; }
.plain-list li + li { margin-top: 6px; }
.filters-2 { }
@media (min-width: 720px) { .filters-2 { grid-template-columns: 1fr 1fr; } }

.pen-row { display: flex; gap: 14px; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.pen-row:last-child { border-bottom: 0; }
.pen-row .grow { flex: 1; min-width: 180px; }
.pen-min { width: 48px; flex: none; text-align: center; color: var(--muted); font-size: .72rem; font-weight: 600; text-transform: uppercase; line-height: 1.1; }
.pen-min .num { display: block; font-size: 1.6rem; color: var(--red-dark); }

.pen-list { display: grid; gap: 14px; }
.pen-edit { border: 1.5px solid var(--line); border-radius: var(--r-md); padding: 14px; display: grid; gap: 14px; background: var(--ice); }
.pen-edit legend { font: 700 1.05rem/1 var(--font-display); padding: 0 6px; }

.chart-grid { display: grid; gap: 24px; }
@media (min-width: 900px) { .chart-grid { grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); } }
.chart-fig { margin: 0; }
.chart-title { font: 700 1.15rem/1.2 var(--font-display); margin-bottom: 6px; }
.chart-box { max-width: 640px; }
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart text { font-family: var(--font-body); }
.c-grid { stroke: var(--line); stroke-width: 1; }
.c-base { stroke: var(--navy); stroke-width: 1.5; }
.c-axis { font-size: 10px; fill: var(--muted); font-variant-numeric: tabular-nums; }
.c-sub { font-size: 9px; fill: var(--muted); font-style: italic; }
.c-val { font-size: 10px; font-weight: 600; fill: var(--navy); font-variant-numeric: tabular-nums; }
.c-na { font-size: 12px; fill: var(--muted); }
.c-solid { fill: var(--navy); }
.c-light { fill: #6E89AE; }
.c-hatch { stroke: var(--red); stroke-width: 1; }
.c-hatch-bg { fill: #FBE3E7; }
.c-hatch-line { stroke: var(--red); stroke-width: 3; }
.c-line { fill: none; stroke: var(--navy); stroke-width: 2.5; stroke-linejoin: round; }
.c-dot { fill: var(--surface); stroke: var(--red); stroke-width: 2.5; }
.c-avg { stroke: var(--red); stroke-width: 1.5; stroke-dasharray: 5 4; }
.chart-legend { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 16px; padding: 0; margin: 0 0 6px; font-size: .88rem; color: var(--muted); }
.chart-legend li { display: flex; gap: 6px; align-items: center; }
.swatch { width: 14px; height: 14px; border-radius: 3px; display: inline-block; }
.sw-solid { background: var(--navy); }
.sw-light { background: #6E89AE; }
.sw-hatch { background: repeating-linear-gradient(45deg, var(--red) 0 2px, #FBE3E7 2px 5px); border: 1px solid var(--red); }
.chart-data { margin-top: 8px; }
.chart-data summary { cursor: pointer; font-weight: 600; color: var(--blue-line); min-height: 44px; display: flex; align-items: center; }
.chart-data .stats-table { min-width: 0; }
.chart-empty { padding: 16px; border: 2px dashed var(--line); border-radius: var(--r-md); }
.chart-empty p { margin: 0; }
@media print { .chart-data { display: block; } .chart-data > summary { display: none; } }

/* ---------- Phase 4: sharing ---------- */
.copy-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.copy-row .input { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 14px; }
.share-buttons { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 4px; }
.check-list { display: grid; gap: 10px; }
@media (min-width: 720px) { .check-list { grid-template-columns: 1fr 1fr; } }
.help.block { display: block; }
.option.is-disabled { opacity: .6; cursor: not-allowed; }

body.is-public { background: var(--ice); }
.public-header { background: var(--navy); border-bottom: 3px solid var(--red); padding-top: var(--safe-top); }
.public-header .wrap { min-height: 56px; display: flex; align-items: center; }
.public-header img { height: 28px; width: auto; display: block; }
.public-main { padding: 24px 0 40px; }
.public-main .panel { margin-top: 20px; }
.public-foot { border-top: 1px solid var(--line); padding: 20px 0 calc(20px + var(--safe-bottom)); color: var(--muted); font-size: .92rem; }
.public-foot p { margin: 0 0 6px; }
.preview-bar { position: sticky; top: 0; z-index: 40; background: var(--warn-bg); border-bottom: 2px solid #E0A82E; padding-top: var(--safe-top); }
.preview-bar .wrap { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; min-height: 56px; }
.preview-bar p { margin: 0; color: var(--warn); }

@media print {
  .public-header, .preview-bar, .public-foot p:last-child { display: none !important; }
  .public-main .panel { break-inside: avoid; border-color: #999; }
  .stats-table th, .stats-table td { border-color: #999; }
}
