/* RinkScore Teams — phone-only layout. Structure from DESIGN.md; the team's
   primary/accent colours are set at unlock from the encrypted team data. */

@font-face { font-family: Outfit; src: url(fonts/outfit-latin-wght-normal.woff2) format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Plus Jakarta Sans"; src: url(fonts/plus-jakarta-sans-latin-wght-normal.woff2) format("woff2"); font-weight: 200 800; font-display: swap; }

:root {
  --primary: #0d253f;   /* team colour, replaced at unlock */
  --accent: #ff7a00;    /* team colour, replaced at unlock */
  --canvas: #f4f7fb;
  --card: #ffffff;
  --ink: #181c1f;
  --ink-2: #43474d;
  --muted: #74777e;
  --line: rgba(13, 37, 63, 0.06);
  --pim: #5e6e82;
  --shadow-1: 0 4px 16px rgba(13, 37, 63, 0.05);
  --shadow-2: 0 8px 24px rgba(13, 37, 63, 0.08);
  --r: 8px; --r-lg: 16px; --r-xl: 24px;
  --display: Outfit, system-ui, sans-serif;
  --body: "Plus Jakarta Sans", system-ui, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: #dfe4ea; color: var(--ink); font: 400 14px/20px var(--body); }
.frame { max-width: 480px; min-height: 100dvh; margin: 0 auto; background: var(--canvas); position: relative; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
button { font: inherit; color: inherit; }
.num { font-family: var(--display); font-variant-numeric: tabular-nums; }

/* ---------- lock ---------- */
.lock { min-height: 100dvh; display: flex; flex-direction: column; justify-content: center; padding: 24px 16px; gap: 24px; }
.lock-card { background: var(--card); border-radius: var(--r-xl); box-shadow: var(--shadow-2); border: 1px solid var(--line); padding: 28px 22px; }
.brand { margin: 0 0 18px; font: 800 13px/16px var(--display); letter-spacing: 0.06em; text-transform: uppercase; color: var(--primary); }
.brand span { color: var(--accent); }
.lock h1 { margin: 0 0 6px; font: 700 26px/34px var(--display); letter-spacing: -0.01em; color: var(--primary); }
.muted { color: var(--ink-2); margin: 0 0 20px; }
.lock input[type=password], .lock input[type=text] {
  width: 100%; height: 52px; border-radius: var(--r); border: 1.5px solid rgba(13, 37, 63, 0.15);
  padding: 0 14px; font: 500 16px var(--body); color: var(--ink); background: #fff;
}
.lock input:focus { outline: 2px solid var(--primary); outline-offset: 1px; }
.show { display: flex; align-items: center; gap: 8px; margin: 12px 0 18px; color: var(--ink-2); min-height: 32px; }
.show input { width: 20px; height: 20px; accent-color: var(--primary); }
.btn {
  width: 100%; height: 52px; border: 0; border-radius: var(--r-lg); cursor: pointer;
  background: var(--primary); color: #fff; font: 700 15px/18px var(--display); letter-spacing: 0.04em;
}
.btn:disabled { opacity: 0.6; }
.lock-msg { min-height: 20px; margin: 12px 0 0; color: #ba1a1a; font-weight: 500; }
.lock-msg.ok { color: var(--ink-2); }
.powered { text-align: center; margin: 0; color: var(--muted); font-size: 12px; }
.powered a { color: var(--ink-2); }

/* ---------- app shell ---------- */
#app { padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
.top {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 12px;
  padding: calc(12px + env(safe-area-inset-top)) 16px 12px; background: var(--primary); color: #fff;
}
.top img { width: 44px; height: 44px; object-fit: contain; flex: none; }
/* Team name with the division beside it; the division wraps below only when the line is full. */
.top-text { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; }
.team-name { margin: 0; font: 700 22px/28px var(--display); letter-spacing: -0.01em; }
.team-sub { margin: 0; font: 700 12px/16px var(--display); letter-spacing: 0.05em; text-transform: uppercase; opacity: 0.75; }
/* Centred variant: "True North [logo] Calgary"; the division (if any) sits under it, the lock button stays at the right edge. */
.top.split { display: grid; grid-template-columns: 1fr auto 1fr; column-gap: 12px; position: sticky; }
.top.split .split-l, .top.split .split-r { font: 700 22px/28px var(--display); letter-spacing: -0.01em; }
.top.split .split-l { text-align: right; }
.top.split .top-text { grid-column: 1 / -1; align-items: center; }
.top.split .top-text:not(:has(.team-sub:not(:empty))) { display: none; }
.top.split .icon-btn { position: absolute; right: 16px; }
.icon-btn { width: 44px; height: 44px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, 0.12); display: grid; place-items: center; cursor: pointer; }
.icon-btn svg { width: 20px; height: 20px; fill: #fff; }

.tab { padding: 16px; display: flex; flex-direction: column; gap: 16px; }
/* A block inside a tab that holds several sections keeps the tab's spacing. */
.stack { display: flex; flex-direction: column; gap: 16px; }
.tabbar {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 480px; z-index: 6;
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--card);
  border-top: 1px solid var(--line); box-shadow: 0 -4px 16px rgba(13, 37, 63, 0.05);
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
}
.tabbar button {
  height: 60px; border: 0; background: none; border-radius: var(--r-lg); cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--muted); font: 700 11px/14px var(--display); letter-spacing: 0.04em;
}
.tabbar svg { width: 24px; height: 24px; fill: currentColor; }
.tabbar button[aria-current=page] { color: var(--primary); background: rgba(13, 37, 63, 0.06); }

/* ---------- shared pieces ---------- */
.card { background: var(--card); border-radius: var(--r-lg); border: 1px solid var(--line); box-shadow: var(--shadow-1); padding: 16px; }
.h { margin: 4px 2px -4px; font: 700 18px/24px var(--display); color: var(--primary); display: flex; justify-content: space-between; align-items: baseline; }
.h small { font: 700 11px/14px var(--display); letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); }
.eyebrow { margin: 0 0 4px; font: 800 10px/12px var(--display); letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.empty { color: var(--ink-2); text-align: center; padding: 28px 16px; }
.jersey {
  flex: none; min-width: 40px; height: 40px; padding: 0 6px; border-radius: 999px; display: grid; place-items: center;
  background: var(--primary); color: #fff; font: 800 15px/1 var(--display); font-variant-numeric: tabular-nums;
}
.jersey.sm { width: 32px; min-width: 32px; height: 32px; padding: 0; font-size: 13px; }
.jersey.xs { width: 28px; min-width: 28px; height: 28px; padding: 0; font-size: 12px; }

/* stat tiles */
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.tile { background: var(--canvas); border-radius: var(--r); padding: 10px 4px; text-align: center; }
.tile b { display: block; font: 800 24px/28px var(--display); font-variant-numeric: tabular-nums; color: var(--primary); }
.tile span { font: 800 10px/12px var(--display); letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }

/* leaders */
.leaders { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.leader { border-radius: var(--r); padding: 10px 12px; background: var(--canvas); }
.leader .v { font: 800 24px/28px var(--display); font-variant-numeric: tabular-nums; }
.leader .who { font-weight: 600; font-size: 13px; line-height: 17px; color: var(--ink); }
.leader.g .v { color: var(--accent); }
.leader.a .v { color: color-mix(in srgb, var(--primary) 70%, #4d8fd6); }
.leader.p .v { color: var(--primary); }
.leader.pim .v { color: var(--pim); }

/* stat table */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px; }
.chip {
  height: 36px; padding: 0 14px; border-radius: 999px; border: 0; cursor: pointer; white-space: nowrap;
  background: rgba(13, 37, 63, 0.05); color: var(--ink-2); font: 700 12px/16px var(--display); letter-spacing: 0.05em;
}
.chip[aria-pressed=true] { background: var(--primary); color: #fff; }
.table { width: 100%; border-collapse: collapse; }
.table th { font: 800 10px/12px var(--display); letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); padding: 0 0 8px; text-align: center; }
.table th:nth-child(2) { text-align: left; }
.table td { padding: 8px 0; border-top: 1px solid var(--line); text-align: center; font: 700 15px/20px var(--display); font-variant-numeric: tabular-nums; }
.table td.name { text-align: left; font: 600 14px/18px var(--body); padding-left: 10px; }
.pos-tag { margin-left: 6px; font: 800 10px/12px var(--display); letter-spacing: 0.06em; color: var(--muted); white-space: nowrap; }
.table td:first-child { width: 40px; }
.table .c { width: 30px; white-space: nowrap; }
.table td.sorted { color: var(--primary); }
.table td.g { color: var(--accent); }
.table td.pim { color: var(--pim); }
.table td.zero { color: #b8bec6; }
/* Standings: narrow rank column, our row tinted; the Updated line lines up with the table's left edge. */
.st-note { padding-left: 15px; }
.table.st th:first-child { width: 34px; padding-right: 4px; }
.table.st td:first-child { color: var(--muted); }
.table.st .c { width: 26px; }
.table.st td.name { padding-left: 4px; }
.table.st tr.us td { background: rgba(13, 37, 63, 0.07); color: var(--primary); font-weight: 800; }
.table.st tr.us td:first-child { border-radius: 8px 0 0 8px; }
.table.st tr.us td:last-child { border-radius: 0 8px 8px 0; }
/* Goalies: wider labels (Shots, Saves), so each column gets a gap. */
.table.gk .c { padding-left: 8px; }
.pts-pill { display: inline-block; min-width: 30px; padding: 2px 6px; border-radius: 999px; background: var(--primary); color: #fff; }

/* roster */
.team-photo { display: block; width: 100%; height: auto; border-radius: var(--r-lg); box-shadow: var(--shadow-1); }
.plist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.plist li { display: flex; align-items: center; gap: 12px; }
.plist .nm { font: 600 15px/20px var(--body); }
.avatar { flex: none; width: 48px; height: 48px; border-radius: 50%; overflow: hidden; display: block;
  background: linear-gradient(160deg, color-mix(in srgb, var(--primary) 10%, #fff), color-mix(in srgb, var(--primary) 20%, #fff)); }
.avatar.sm { width: 36px; height: 36px; }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar svg { width: 100%; height: 100%; display: block; fill: color-mix(in srgb, var(--primary) 38%, #fff); }
.meta { font-weight: 500; color: var(--ink-2); }
.nm-line { display: block; }
.meta-line { display: block; margin-top: 1px; font: 500 12px/16px var(--body); color: var(--ink-2); }

/* section labels inside a game */
.line-label { font: 700 12px/16px var(--display); letter-spacing: 0.05em; text-transform: uppercase; color: var(--accent); margin-top: 14px; }

/* games */
.game { padding: 0; overflow: hidden; }
.game-head { padding: 14px 16px; display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center; }
.period-box { border-top: 1px solid var(--line); padding: 0 16px 6px; }
.more {
  width: 100%; min-height: 48px; border: 0; border-top: 1px solid var(--line); background: none; cursor: pointer;
  display: flex; align-items: center; justify-content: space-between; padding: 0 16px;
  font: 700 12px/16px var(--display); letter-spacing: 0.05em; text-transform: uppercase; color: var(--primary);
}
.stage-toggle {
  display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 44px; margin-top: 12px;
  border: 0; border-radius: 999px; background: var(--canvas); color: var(--primary); cursor: pointer;
  font: 700 14px/18px var(--display);
}
.stage-toggle::after { content: ""; width: 7px; height: 7px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); margin-top: -4px; transition: transform 0.15s; }
.stage-toggle[aria-expanded=true]::after { transform: rotate(-135deg); margin-top: 4px; }
.stage-games { display: flex; flex-direction: column; gap: 16px; }
.more::after { content: ""; width: 8px; height: 8px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); margin: -4px 4px 0 0; transition: transform 0.15s; }
.more[aria-expanded=true]::after { transform: rotate(-135deg); margin-top: 4px; }
.game .when { font: 700 11px/14px var(--display); letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); }
.game .opp { font: 700 17px/22px var(--display); color: var(--ink); }
.score { grid-row: 1 / span 2; grid-column: 2; display: flex; align-items: center; gap: 10px; }
.score b { font: 800 26px/30px var(--display); font-variant-numeric: tabular-nums; color: var(--primary); }
.res { width: 30px; height: 30px; border-radius: 999px; display: grid; place-items: center; font: 800 13px/1 var(--display); color: #fff; }
.res.W { background: var(--accent); }
.res.L { background: var(--pim); }
.res.T { background: #fff; color: var(--primary); box-shadow: inset 0 0 0 2px var(--primary); }
.detail { border-top: 1px solid var(--line); padding: 4px 16px 16px; }
.periods { width: 100%; border-collapse: collapse; margin-top: 8px; }
.periods th, .periods td { text-align: center; padding: 6px 0; font: 700 13px/16px var(--display); font-variant-numeric: tabular-nums; }
.periods th { font-size: 10px; letter-spacing: 0.06em; color: var(--muted); }
.periods td:first-child, .periods th:first-child { text-align: left; }
.periods .tot { color: var(--primary); font-weight: 800; }
.periods .sog { color: var(--muted); }
.note { margin: -10px 2px 0; color: var(--muted); font-size: 12px; }
.evt { list-style: none; margin: 6px 0 0; padding: 0; }
.evt li { display: grid; grid-template-columns: 76px 1fr; gap: 8px; padding: 7px 0; border-top: 1px solid var(--line); }
.evt.scoring li { grid-template-columns: 76px 1fr auto; }
.evt .run { font: 700 13px/18px var(--display); font-variant-numeric: tabular-nums; color: var(--primary); }
.evt .t { white-space: nowrap; font: 700 12px/18px var(--display); font-variant-numeric: tabular-nums; color: var(--muted); }
.evt .who { font-weight: 600; }
.evt .who small { font-weight: 400; color: var(--ink-2); }
.evt .them { color: var(--ink-2); font-weight: 500; }
.arena { color: var(--muted); font-size: 12px; margin: 12px 0 0; }

@media (min-width: 481px) {
  .frame { box-shadow: 0 0 40px rgba(13, 37, 63, 0.12); }
}
