/* Phone scorer + admin pages. Light theme: easier to read outdoors in sunshine. */
:root {
  --home: #F5B544;
  --away: #5DB4FF;
  --home-ink: #8A5A00;
  --away-ink: #1A5FB4;
  --ink: #0E141B;
  --ink-2: #3B4652;
  --muted: #4A5563;
  --line: #C9D0D8;
  --line-soft: #DDE3E9;
  --bg: #F4F6F8;
  --card: #FFFFFF;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: Inter, system-ui, -apple-system, sans-serif; }
button, input, select { font-family: inherit; font-size: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
a { color: var(--ink); }
[hidden] { display: none !important; }

.home-ink { color: var(--home-ink); }
.away-ink { color: var(--away-ink); }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: .16em; color: var(--muted); }
.stack6 { display: flex; flex-direction: column; gap: 6px; }
.stack10 { display: flex; flex-direction: column; gap: 10px; }
.stack18 { display: flex; flex-direction: column; gap: 18px; }

/* ---------- Scorer ---------- */
.phone { max-width: 480px; margin: 0 auto; min-height: 100vh; padding: 24px 20px calc(28px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 18px; }
.topbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.rinkpill { align-self: flex-start; padding: 6px 12px; border-radius: 999px; background: var(--ink); color: #fff; font-size: 14px; font-weight: 700; letter-spacing: .12em; }
.teams { font-size: 15px; font-weight: 500; color: var(--muted); }
.endinfo { text-align: right; }
.endval { font-family: 'Space Grotesk', Inter, sans-serif; font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; }

.scorecard { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: end; column-gap: 12px; padding: 18px 20px; border-radius: 20px; background: var(--card); border: 1px solid var(--line-soft); }
.sc-side { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.sc-side.right { align-items: flex-end; text-align: right; }
.sc-name { display: flex; align-items: center; gap: 8px; font-size: 18px; font-weight: 600; line-height: 1.2; max-width: 100%; overflow-wrap: anywhere; }
.sc-side.right .sc-name { justify-content: flex-end; }
.sc-dot, .history .dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.home-dot { background: var(--home); }
.away-dot { background: var(--away); }
.sc-num { font-family: 'Space Grotesk', Inter, sans-serif; font-size: 52px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.sc-dash { align-self: center; font-size: 28px; color: #A3ADB8; }

.q { font-size: 15px; font-weight: 600; color: var(--ink-2); }
.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.choice { min-height: 60px; border-radius: 16px; border: 2px solid var(--line); background: var(--card); color: var(--ink); font-size: 18px; font-weight: 700; padding: 8px; line-height: 1.2; overflow-wrap: anywhere; }
#btnHome[aria-pressed="true"] { background: var(--home); border-color: var(--home); }
#btnAway[aria-pressed="true"] { background: var(--away); border-color: var(--away); }
.shots { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.shot { height: 60px; border-radius: 16px; border: 2px solid var(--line); background: var(--card); color: var(--ink); font-family: 'Space Grotesk', Inter, sans-serif; font-size: 26px; font-weight: 700; }
.shot[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }

.primary { min-height: 60px; border-radius: 16px; border: 0; background: var(--ink); color: #fff; font-size: 17px; font-weight: 700; padding: 0 16px; }
.primary:disabled { background: #DCE1E7; color: var(--muted); }
.secondary { min-height: 44px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); color: var(--ink); font-size: 15px; font-weight: 600; }
.secondary:disabled { opacity: .5; }
.secondary.armed { background: #FDE8E8; border-color: #E5A3A3; color: #8A1C1C; }
.danger { min-height: 44px; padding: 0 14px; border-radius: 12px; border: 1px solid #E5A3A3; background: #FFFFFF; color: #8A1C1C; font-size: 15px; font-weight: 600; }
.danger.wide { width: 100%; min-height: 52px; font-size: 16px; }
.danger-solid { min-height: 52px; padding: 0 14px; border-radius: 12px; border: 0; background: #B42318; color: #FFFFFF; font-size: 16px; font-weight: 700; }
.danger-solid:disabled { opacity: .6; }

.result { display: flex; flex-direction: column; gap: 8px; padding: 18px 20px; border-radius: 16px; background: var(--card); border: 1px solid var(--line-soft); text-align: center; align-items: center; }
.result-title { font-family: 'Space Grotesk', Inter, sans-serif; font-size: 24px; font-weight: 700; overflow-wrap: anywhere; }
.result-sub { font-size: 15px; color: var(--muted); }
.early { padding-top: 8px; border-top: 1px solid var(--line-soft); }
.early-confirm { display: flex; flex-direction: column; gap: 12px; padding: 16px; border-radius: 16px; background: #FFF5F5; border: 1px solid #F1C4C4; }
.early-q { font-size: 15px; font-weight: 600; color: #6B1414; line-height: 1.4; }

.notice { padding: 20px; border-radius: 16px; background: var(--card); border: 1px solid var(--line-soft); font-size: 16px; font-weight: 600; text-align: center; }
.status { padding: 12px 16px; border-radius: 14px; font-size: 15px; font-weight: 600; }
.status.ok { background: #E3F4E8; color: #1B5E33; }
.status.error { background: #FDECEC; color: #8A1C1C; }

.recent { display: flex; flex-direction: column; gap: 8px; margin-top: auto; }
.recent-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.recent-head h2 { margin: 0; font-size: 15px; font-weight: 600; color: var(--ink-2); }
.history { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.history li { display: grid; grid-template-columns: 70px minmax(0, 1fr) auto; align-items: center; column-gap: 10px; padding: 12px 14px; border-radius: 12px; background: var(--card); border: 1px solid #E3E8ED; font-size: 15px; }
.history .e { color: var(--muted); font-weight: 600; }
.history .who { display: flex; align-items: center; gap: 8px; min-width: 0; font-weight: 600; }
.history .who span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.history .dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.history .run { font-family: 'Space Grotesk', Inter, sans-serif; font-weight: 700; font-variant-numeric: tabular-nums; }
.history .empty { display: block; color: var(--muted); font-weight: 500; }

/* ---------- Admin ---------- */
.admin { max-width: 760px; margin: 0 auto; padding: 24px 20px 48px; display: flex; flex-direction: column; gap: 20px; }
.admin-top { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.admin h1 { margin: 4px 0 0; font-family: 'Space Grotesk', Inter, sans-serif; font-size: 30px; }
.admin h2 { margin: 0; font-size: 17px; }
.card { display: flex; flex-direction: column; gap: 14px; padding: 18px; border-radius: 20px; background: var(--card); border: 1px solid var(--line-soft); }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label, .label { font-size: 14px; font-weight: 600; color: var(--ink-2); }
.field input[type=text], .field input[type=password], .field input[type=number], .field select { height: 48px; width: 100%; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line); background: #fff; font-size: 16px; color: var(--ink); }
.field input[type=file] { font-size: 14px; }
.hint { font-size: 13px; color: var(--muted); }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.segmented { display: inline-grid; grid-auto-flow: column; gap: 6px; padding: 4px; border-radius: 14px; background: #EEF1F4; }
.segmented label { display: flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 18px; border-radius: 10px; font-weight: 700; color: var(--muted); cursor: pointer; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented input:checked + span { color: var(--ink); }
.segmented label:has(input:checked) { background: #fff; color: var(--ink); }
.segmented label:has(input:focus-visible) { outline: 3px solid var(--ink); outline-offset: 1px; }
.rink-card { display: flex; flex-direction: column; gap: 10px; padding: 14px 16px; border-radius: 16px; background: var(--card); border: 1px solid var(--line-soft); }
.rink-card.off { background: transparent; border-style: dashed; }
.rink-card.off .grid2, .rink-card.off .rink-body { display: none; }
.check.plain { letter-spacing: 0; font-weight: 600; font-size: 15px; }

.type-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.type-card { display: flex; flex-direction: column; gap: 8px; padding: 22px; border-radius: 20px; background: var(--card); border: 2px solid var(--line-soft); text-decoration: none; color: var(--ink); }
.type-card:hover { border-color: var(--ink); }
.type-card strong { font-family: 'Space Grotesk', Inter, sans-serif; font-size: 24px; }
.type-card span { color: var(--muted); line-height: 1.45; }

.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.theme-card { position: relative; display: flex; flex-direction: column; gap: 8px; padding: 12px; border-radius: 14px; border: 2px solid var(--line-soft); background: #fff; cursor: pointer; }
.theme-card input { position: absolute; opacity: 0; pointer-events: none; }
.theme-card:has(input:checked) { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.theme-card:has(input:focus-visible) { outline: 3px solid var(--ink); outline-offset: 2px; }
.swatches { display: flex; height: 28px; border-radius: 8px; overflow: hidden; border: 1px solid var(--line-soft); }
.swatches span { flex: 1; }
.theme-name { font-size: 14px; font-weight: 600; }
.preview { padding: 16px; border-radius: 14px; }
.pv-row { display: grid; grid-template-columns: minmax(0, 1fr) 44px 92px 44px minmax(0, 1fr); align-items: center; gap: 10px; padding: 12px 14px; border-radius: 12px; border: 2px solid; }
.pv-name { font-weight: 600; font-size: 15px; overflow-wrap: anywhere; }
.pv-name.pv-home { text-align: right; }
.pv-score { font-family: 'Space Grotesk', Inter, sans-serif; font-size: 26px; font-weight: 700; text-align: center; }
.pv-meta { text-align: center; font-family: 'Space Grotesk', Inter, sans-serif; }
.pv-meta b { font-size: 20px; }
.pv-label { font-size: 11px; font-weight: 700; letter-spacing: .1em; display: block; }
.pv-meta .pv-label + b + .pv-label { display: inline; }
.colour-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; margin-top: 12px; }
.colour-field input[type=color] { width: 100%; height: 44px; padding: 2px; border-radius: 10px; border: 1px solid var(--line); background: #fff; }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; font-weight: 700; letter-spacing: .1em; font-size: 14px; }
.check input { width: 22px; height: 22px; accent-color: var(--ink); }
.error-box { padding: 12px 14px; border-radius: 12px; background: #FDECEC; color: #8A1C1C; font-size: 14px; font-weight: 600; }
.ok-box { padding: 12px 14px; border-radius: 12px; background: #E3F4E8; color: #1B5E33; font-size: 15px; font-weight: 600; }
.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.list a { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px; border-radius: 16px; background: var(--card); border: 1px solid var(--line-soft); text-decoration: none; }
.list .sub { font-size: 14px; color: var(--muted); }
.chip { flex-shrink: 0; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; letter-spacing: .12em; }
.chip.live { background: #E3F4E8; color: #1B5E33; }
.chip.finished { background: #EEF1F4; color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; gap: 10px; }
.btn-link { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 18px; border-radius: 14px; background: var(--ink); color: #fff; font-weight: 700; text-decoration: none; }
.btn-link.light { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.qr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.qr-card { display: grid; grid-template-columns: 120px minmax(0, 1fr); align-items: center; column-gap: 14px; padding: 14px; border-radius: 16px; background: var(--card); border: 1px solid var(--line-soft); }
.qr { width: 120px; height: 120px; }
.qr svg { width: 100%; height: 100%; display: block; }
.qr-card .who { font-size: 16px; font-weight: 600; overflow-wrap: anywhere; }
.qr-card .score-line { font-family: 'Space Grotesk', Inter, sans-serif; font-weight: 700; font-variant-numeric: tabular-nums; }
.badge-thumb { width: 56px; height: 56px; object-fit: contain; border-radius: 8px; background: #EEF1F4; }
.inline-form { display: inline; }

@media print {
  body { background: #fff; }
  .no-print { display: none !important; }
  .admin { max-width: none; padding: 0; }
  .qr-grid { grid-template-columns: repeat(2, 1fr); gap: 16px; }
  .qr-card { break-inside: avoid; grid-template-columns: 200px 1fr; border: 2px solid #000; }
  .qr { width: 200px; height: 200px; }
  .qr-card .qr-actions { display: none; }
}
