/* ============================================================
   HSS Companion App — shared stylesheet
   ------------------------------------------------------------
   Every page in the app is a thin index.html shell that loads
   this file + app.js. Tokens mirror the highschoolsports
   extension design system (assets/css/hss.css) so the app and
   the website read as one product. Light/dark follow the OS unless
   the viewer pins one in Settings (html[data-theme], set by app.js).
   ============================================================ */

@import url("https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@600;700&family=DM+Sans:opsz,wght@9..40,400;9..40,500;9..40,600;9..40,700&display=swap");

@view-transition { navigation: auto; }

:root {
  --hss-bg: #f5f6f9;
  --hss-panel: #ffffff;
  --hss-elev: #ffffff;
  --hss-elev-2: #f0f2f6;
  --hss-line: #e3e6ec;
  --hss-line-soft: #ecedf1;
  --hss-text: #0a0c10;
  --hss-text-2: #2b323d;
  --hss-muted: #5b6573;
  --hss-muted-2: #8a94a3;
  --hss-accent: #1a5fd9;
  --hss-accent-hi: #2f7fff;
  --hss-accent-ink: #ffffff;
  --hss-accent-soft: rgba(26, 95, 217, 0.10);
  --hss-win: #16894c;
  --hss-loss: #d0303a;
  --hss-hot: #c97a00;
  --hss-boys: #1a5fd9;
  --hss-girls: #be185d;
  --hss-chip: #eef0f4;
  --hss-chip-hover: #e3e6ec;
  --hss-bar-bg: rgba(245, 246, 249, 0.86);
  --hss-shadow: 0 1px 2px rgba(10, 12, 16, 0.06), 0 1px 1px rgba(10, 12, 16, 0.04);

  --hss-display: "Barlow Condensed", "Helvetica Neue", Arial, sans-serif;
  --hss-body: "DM Sans", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --appbar-h: 56px;
  --tabbar-h: 58px;
  --gutter: 16px;
  --radius: 14px;
  --radius-sm: 10px;

  color-scheme: light dark;
}

/* Dark tokens: the OS scheme unless Settings pins light, or pinned dark. Keep both lists identical. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --hss-bg: #0a0c10;
    --hss-panel: #14181f;
    --hss-elev: #1c2129;
    --hss-elev-2: #232932;
    --hss-line: #232932;
    --hss-line-soft: #1a1f27;
    --hss-text: #eef2f7;
    --hss-text-2: #c7cfdb;
    --hss-muted: #8a94a3;
    --hss-muted-2: #5b6573;
    --hss-accent: #2f7fff;
    --hss-accent-hi: #5a9bff;
    --hss-accent-soft: rgba(47, 127, 255, 0.16);
    --hss-win: #2ecc71;
    --hss-loss: #ff5560;
    --hss-hot: #ffb020;
    --hss-boys: #5a9bff;
    --hss-girls: #f472b6;
    --hss-chip: #1c2129;
    --hss-chip-hover: #252b35;
    --hss-bar-bg: rgba(10, 12, 16, 0.82);
    --hss-shadow: none;
  }
}

:root[data-theme="dark"] {
  --hss-bg: #0a0c10;
  --hss-panel: #14181f;
  --hss-elev: #1c2129;
  --hss-elev-2: #232932;
  --hss-line: #232932;
  --hss-line-soft: #1a1f27;
  --hss-text: #eef2f7;
  --hss-text-2: #c7cfdb;
  --hss-muted: #8a94a3;
  --hss-muted-2: #5b6573;
  --hss-accent: #2f7fff;
  --hss-accent-hi: #5a9bff;
  --hss-accent-soft: rgba(47, 127, 255, 0.16);
  --hss-win: #2ecc71;
  --hss-loss: #ff5560;
  --hss-hot: #ffb020;
  --hss-boys: #5a9bff;
  --hss-girls: #f472b6;
  --hss-chip: #1c2129;
  --hss-chip-hover: #252b35;
  --hss-bar-bg: rgba(10, 12, 16, 0.82);
  --hss-shadow: none;
  color-scheme: dark;
}
:root[data-theme="light"] { color-scheme: light; }

/* =========== Base =========== */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--hss-bg);
  color: var(--hss-text);
  font-family: var(--hss-body);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
body.has-tabbar { padding-bottom: calc(var(--tabbar-h) + var(--safe-bottom)); }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
img { display: block; max-width: 100%; }
:focus-visible { outline: 2px solid var(--hss-accent); outline-offset: 2px; }

.wrap { max-width: 680px; margin: 0 auto; padding: 0 var(--gutter); }
.muted { color: var(--hss-muted); }
.num { font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* =========== App bar =========== */
.appbar {
  position: sticky; top: 0; z-index: 20;
  padding-top: var(--safe-top);
  background: var(--hss-bar-bg);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  backdrop-filter: saturate(180%) blur(18px);
  border-bottom: 1px solid var(--hss-line);
}
.appbar-inner {
  max-width: 680px; margin: 0 auto;
  height: var(--appbar-h);
  display: flex; align-items: center; gap: 4px;
  padding: 0 8px;
}
.appbar-title { flex: 1; min-width: 0; text-align: center; padding: 0 4px; }
.appbar-title strong {
  display: block; font-size: 16px; font-weight: 600; line-height: 1.2;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.appbar-title span {
  display: block; font-size: 12px; color: var(--hss-muted); line-height: 1.3;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.icon-btn {
  flex: none; width: 44px; height: 44px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: 22px; background: transparent; color: var(--hss-accent);
}
.icon-btn:active { background: var(--hss-chip); }
.icon-btn svg { width: 24px; height: 24px; }
.appbar-spacer { flex: none; width: 44px; }
.brandmark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 8px;
  background: var(--hss-accent); color: var(--hss-accent-ink);
  font-family: var(--hss-display); font-weight: 700; font-size: 18px;
}

/* =========== Tab bar =========== */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  padding-bottom: var(--safe-bottom);
  background: var(--hss-bar-bg);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  backdrop-filter: saturate(180%) blur(18px);
  border-top: 1px solid var(--hss-line);
}
.tabbar-inner { max-width: 680px; margin: 0 auto; display: flex; height: var(--tabbar-h); }
.tabbar a, .tabbar button {
  flex: 1; min-width: 0; padding: 0; border: 0; background: transparent; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font-size: 11px; font-weight: 500; color: var(--hss-muted);
}
.tabbar a svg, .tabbar button svg { width: 24px; height: 24px; }
.tabbar a.active { color: var(--hss-accent); }

/* =========== Hero =========== */
.hero { padding: 20px 0 8px; }
.kicker {
  font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--hss-muted);
}
.display {
  margin: 2px 0 0;
  font-family: var(--hss-display); font-weight: 700; font-size: 34px; line-height: 1.05;
  letter-spacing: 0.01em; text-transform: uppercase;
}
.hero p { margin: 6px 0 0; color: var(--hss-muted); font-size: 15px; }
.hero-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }

/* =========== Sections + lists =========== */
.section { margin-top: 24px; }
.section-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  margin: 0 4px 8px;
}
.section-head h2 {
  margin: 0; font-family: var(--hss-display); font-weight: 700; font-size: 20px;
  text-transform: uppercase; letter-spacing: 0.02em;
}
.section-head a, .link-btn { font-size: 14px; font-weight: 500; color: var(--hss-accent); }
.link-btn { min-height: 44px; padding: 0 4px; border: 0; background: transparent; }
.section-head .link-btn { min-height: 0; padding: 0; }

.card {
  background: var(--hss-panel);
  border: 1px solid var(--hss-line);
  border-radius: var(--radius);
  box-shadow: var(--hss-shadow);
  overflow: hidden;
}
.card + .card { margin-top: 12px; }
.card-pad { padding: 14px 16px; }

.list { list-style: none; margin: 0; padding: 0; }
.row {
  display: flex; align-items: center; gap: 12px;
  min-height: 56px; padding: 10px 16px;
  border-top: 1px solid var(--hss-line-soft);
}
.list > li:first-child > .row, .list > .row:first-child { border-top: 0; }
a.row:active, button.row:active { background: var(--hss-chip); }
.row-main { flex: 1; min-width: 0; }
.row-title { font-weight: 600; font-size: 16px; line-height: 1.25; }
.row-sub { font-size: 13px; color: var(--hss-muted); line-height: 1.3; margin-top: 2px; }
.row-title, .row-sub { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-end { flex: none; text-align: right; font-size: 14px; color: var(--hss-muted); }
.row .chev { flex: none; width: 18px; height: 18px; color: var(--hss-muted-2); }
.row.disabled { opacity: 0.55; }
.row.disabled .row-title { font-weight: 500; }
button.row { width: 100%; border: 0; background: transparent; text-align: left; }

.group-label {
  padding: 8px 16px 6px; font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--hss-muted); background: var(--hss-elev-2);
  border-top: 1px solid var(--hss-line-soft);
}
.card > .group-label:first-child { border-top: 0; }

/* =========== Chips, pills, segmented =========== */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  height: 24px; padding: 0 9px; border-radius: 12px;
  background: var(--hss-chip); color: var(--hss-text-2);
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
.badge.accent { background: var(--hss-accent-soft); color: var(--hss-accent); }
.badge.win { color: var(--hss-win); }
.badge.loss { color: var(--hss-loss); }
.badge.hot { color: var(--hss-hot); }
.dot { width: 8px; height: 8px; border-radius: 4px; flex: none; background: var(--hss-muted-2); }
.dot.boys { background: var(--hss-boys); }
.dot.girls { background: var(--hss-girls); }

.scroller {
  display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none;
  margin: 0 calc(var(--gutter) * -1); padding: 2px var(--gutter);
  scroll-snap-type: x proximity; scroll-padding: 0 var(--gutter);
}
.scroller::-webkit-scrollbar { display: none; }
.chip {
  flex: none; scroll-snap-align: start;
  height: 34px; padding: 0 14px; border-radius: 17px;
  border: 1px solid var(--hss-line); background: var(--hss-panel); color: var(--hss-text-2);
  font-size: 14px; font-weight: 500; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 6px;
}
.chip.active { background: var(--hss-text); border-color: var(--hss-text); color: var(--hss-bg); }
.chip svg { width: 16px; height: 16px; flex: none; }
button.chip { cursor: pointer; }

.segmented {
  display: flex; padding: 3px; gap: 2px; border-radius: 11px;
  background: var(--hss-chip);
}
.segmented > * {
  flex: 1; height: 34px; border: 0; border-radius: 9px; background: transparent;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 500; color: var(--hss-muted); white-space: nowrap;
}
.segmented > .active { background: var(--hss-panel); color: var(--hss-text); box-shadow: 0 1px 3px rgba(10, 12, 16, 0.12); font-weight: 600; }

.toolbar { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.toolbar-row { display: flex; gap: 8px; }
.toolbar-row > * { flex: 1; min-width: 0; }

.field {
  position: relative; display: flex; align-items: center;
  height: 44px; border-radius: 12px; background: var(--hss-chip);
}
.field svg { position: absolute; left: 12px; width: 18px; height: 18px; color: var(--hss-muted); pointer-events: none; }
.field input, .field select {
  width: 100%; height: 100%; border: 0; border-radius: 12px; background: transparent;
  padding: 0 12px 0 38px; font-size: 16px; /* 16px stops iOS zoom-on-focus */
  -webkit-appearance: none; appearance: none;
}
.field select { padding-left: 12px; padding-right: 32px; }
.field.select::after {
  content: ""; position: absolute; right: 14px; top: 50%; width: 7px; height: 7px; margin-top: -5px;
  border-right: 2px solid var(--hss-muted); border-bottom: 2px solid var(--hss-muted); transform: rotate(45deg);
  pointer-events: none;
}
.field input:focus, .field select:focus { outline: 2px solid var(--hss-accent); outline-offset: 0; }

/* =========== Team marks =========== */
.mark {
  position: relative; flex: none;
  width: 36px; height: 36px; border-radius: 10px;
  background: var(--hss-elev-2); color: var(--hss-text-2);
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--hss-display); font-weight: 700; font-size: 14px; letter-spacing: 0.02em;
  overflow: hidden;
}
.mark.has-img .ab { visibility: hidden; }
.mark img { position: absolute; inset: 3px; width: calc(100% - 6px); height: calc(100% - 6px); object-fit: contain; }
.mark.sm { width: 26px; height: 26px; border-radius: 7px; font-size: 11px; }
.mark.lg { width: 72px; height: 72px; border-radius: 18px; font-size: 26px; background: var(--hss-panel); border: 1px solid var(--hss-line); }
.mark.xl { width: 64px; height: 64px; border-radius: 16px; font-size: 22px; background: var(--hss-panel); border: 1px solid var(--hss-line); }

/* =========== Game cards =========== */
.game { display: block; padding: 10px 16px 12px; border-top: 1px solid var(--hss-line-soft); }
.list > .game:first-child, .card > .game:first-child { border-top: 0; }
a.game:active { background: var(--hss-chip); }
.game-meta { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--hss-muted); margin-bottom: 6px; }
.game-meta .status { font-weight: 600; color: var(--hss-text-2); }
.game-meta .status.live { color: var(--hss-loss); }
.game-meta .tag { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.game-team { display: flex; align-items: center; gap: 10px; height: 32px; }
.game-team .name { flex: 1; min-width: 0; font-size: 15px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.game-team .score { flex: none; min-width: 28px; text-align: right; font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; }
.game-team.won .name, .game-team.won .score { font-weight: 700; color: var(--hss-text); }
.game-team.lost .name, .game-team.lost .score { color: var(--hss-muted); }
.game-team .caret { width: 0; height: 0; border-top: 5px solid transparent; border-bottom: 5px solid transparent; border-right: 6px solid var(--hss-text); margin-left: -4px; visibility: hidden; }
.game-team.won .caret { visibility: visible; }

.date-head {
  position: sticky; top: calc(var(--safe-top) + var(--appbar-h)); z-index: 5;
  padding: 10px 4px 6px; background: var(--hss-bg);
  font-size: 13px; font-weight: 600; color: var(--hss-muted); letter-spacing: 0.02em;
  display: flex; justify-content: space-between;
}
.date-head.today { color: var(--hss-accent); }

/* Horizontal rail of compact game cards */
.rail { display: flex; gap: 10px; overflow-x: auto; scrollbar-width: none; margin: 0 calc(var(--gutter) * -1); padding: 2px var(--gutter) 4px; scroll-snap-type: x mandatory; scroll-padding: 0 var(--gutter); }
.rail::-webkit-scrollbar { display: none; }
.rail > * { flex: none; width: 78%; max-width: 300px; scroll-snap-align: start; }
.rail .card + .card { margin-top: 0; }

/* =========== Tables =========== */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.data { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; font-variant-numeric: tabular-nums; }
table.data th, table.data td { padding: 10px 8px; text-align: right; white-space: nowrap; border-top: 1px solid var(--hss-line-soft); }
table.data thead th {
  border-top: 0; font-size: 11px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--hss-muted);
  background: var(--hss-elev-2); padding-top: 8px; padding-bottom: 8px;
}
table.data th:first-child, table.data td:first-child { padding-left: 16px; }
table.data th:last-child, table.data td:last-child { padding-right: 16px; }
table.data .sticky { position: sticky; left: 0; z-index: 1; background: var(--hss-panel); text-align: left; }
table.data thead .sticky { background: var(--hss-elev-2); }
table.data .sticky::after { content: ""; position: absolute; top: 0; right: -8px; bottom: 0; width: 8px; background: linear-gradient(to right, rgba(10,12,16,0.06), transparent); pointer-events: none; }
table.data .rank { width: 28px; color: var(--hss-muted); text-align: left; padding-right: 0; }
table.data .team-cell { display: flex; align-items: center; gap: 8px; max-width: 46vw; }
table.data .team-cell .t { overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
table.data .team-cell small { display: block; font-size: 11px; font-weight: 500; color: var(--hss-muted); }
table.data th.sortable { cursor: pointer; }
table.data th.sorted, table.data td.sorted { color: var(--hss-accent); font-weight: 700; }
table.data th.sorted { background: var(--hss-accent-soft); }
table.data tr.link { cursor: pointer; }
table.data tr.link:active td { background: var(--hss-chip); }
table.data tr.dim td { color: var(--hss-muted); }

.athlete-cell { display: block; max-width: 48vw; overflow: hidden; text-overflow: ellipsis; }
.athlete-cell b { font-weight: 600; }
.athlete-cell small { display: block; font-size: 12px; color: var(--hss-muted); font-weight: 400; }

/* =========== Scoreboard (contest) =========== */
.scoreboard { padding: 18px 12px 14px; }
.sb-row { display: grid; grid-template-columns: 1fr auto 1fr; align-items: start; gap: 6px; }
.sb-team { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; min-width: 0; }
.sb-team .name { font-weight: 700; font-size: 15px; line-height: 1.2; }
.sb-team .rec { font-size: 12px; color: var(--hss-muted); }
.sb-team.lost .name { color: var(--hss-muted); }
.sb-center { display: flex; flex-direction: column; align-items: center; padding-top: 10px; }
.sb-score { font-family: var(--hss-display); font-weight: 700; font-size: 46px; line-height: 1; font-variant-numeric: tabular-nums; display: flex; gap: 10px; align-items: center; }
.sb-score .lost { color: var(--hss-muted-2); }
.sb-score .dash { font-size: 26px; color: var(--hss-muted-2); }
.sb-status { margin-top: 6px; font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--hss-text-2); }
.sb-when { margin-top: 14px; text-align: center; font-size: 13px; color: var(--hss-muted); }

.linescore { margin-top: 14px; border-top: 1px solid var(--hss-line-soft); }
.linescore table.data td, .linescore table.data th { padding: 8px 6px; text-align: center; }
.linescore table.data td:first-child, .linescore table.data th:first-child { text-align: left; }
.linescore table.data .total { font-weight: 700; }

/* =========== Bracket =========== */
.bracket { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; margin: 0 calc(var(--gutter) * -1); padding: 0 var(--gutter) 8px; scroll-padding: 0 var(--gutter); gap: 12px; }
.bracket::-webkit-scrollbar { display: none; }
.b-col { flex: none; width: 82%; max-width: 320px; display: flex; flex-direction: column; scroll-snap-align: start; }
.b-col-head {
  position: sticky; top: 0; padding: 4px 4px 10px;
  font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--hss-muted);
  display: flex; justify-content: space-between;
}
.b-slots { flex: none; display: flex; flex-direction: column; }
.b-slot { flex: 1; display: flex; align-items: center; padding: 6px 0; min-height: 0; }
.b-match { width: 100%; background: var(--hss-panel); border: 1px solid var(--hss-line); border-radius: var(--radius-sm); box-shadow: var(--hss-shadow); overflow: hidden; }
a.b-match:active { background: var(--hss-chip); }
.b-team { display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 10px; }
.b-team + .b-team { border-top: 1px solid var(--hss-line-soft); }
.b-team .seed { width: 18px; flex: none; font-size: 12px; color: var(--hss-muted); text-align: center; font-variant-numeric: tabular-nums; }
.b-team .name { flex: 1; min-width: 0; font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.b-team .name.tbd { color: var(--hss-muted-2); font-style: italic; font-weight: 400; }
.b-team .score { flex: none; font-weight: 700; font-variant-numeric: tabular-nums; }
.b-team.won { background: var(--hss-accent-soft); }
.b-team.won .name { font-weight: 700; }
.b-team.lost .name, .b-team.lost .score { color: var(--hss-muted); }
.b-meta { padding: 5px 10px 6px; font-size: 11px; color: var(--hss-muted); background: var(--hss-elev-2); border-top: 1px solid var(--hss-line-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.b-bye { width: 100%; height: 34px; border: 1px dashed var(--hss-line); border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; letter-spacing: 0.08em; color: var(--hss-muted-2); }
.b-champ { width: 100%; padding: 18px 14px; text-align: center; border-radius: var(--radius); background: var(--hss-panel); border: 1px solid var(--hss-line); }
.b-champ .crown { font-size: 28px; line-height: 1; color: var(--hss-hot); }
.b-champ strong { display: block; margin-top: 8px; font-family: var(--hss-display); font-size: 24px; text-transform: uppercase; }
.b-champ span { font-size: 13px; color: var(--hss-muted); }
.b-legend { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 12px; font-size: 12px; color: var(--hss-muted); }
.b-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; background: var(--hss-accent-soft); border: 1px solid var(--hss-accent); }
.b-legend i.out { background: transparent; border-color: var(--hss-muted-2); }

/* =========== Misc components =========== */
.progress { height: 6px; border-radius: 3px; background: var(--hss-chip); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: 3px; background: var(--hss-accent); }

.banner {
  display: flex; align-items: center; gap: 14px; padding: 14px 16px;
  border-radius: var(--radius); background: var(--hss-text); color: var(--hss-bg);
}
.banner .trophy { flex: none; width: 40px; height: 40px; border-radius: 12px; display: flex; align-items: center; justify-content: center; background: rgba(255,255,255,0.12); color: var(--hss-hot); }
.banner .trophy svg { width: 22px; height: 22px; }
.banner strong { display: block; font-family: var(--hss-display); font-size: 22px; line-height: 1.1; text-transform: uppercase; letter-spacing: 0.02em; }
.banner span { font-size: 13px; opacity: 0.75; }
.banner .progress { margin-top: 8px; background: rgba(255,255,255,0.16); }
.banner .chev { flex: none; width: 18px; height: 18px; opacity: 0.6; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .banner .trophy, :root:not([data-theme="light"]) .banner .progress { background: rgba(10,12,16,0.12); } }
:root[data-theme="dark"] .banner .trophy, :root[data-theme="dark"] .banner .progress { background: rgba(10,12,16,0.12); }

.stat-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.tile { padding: 12px; border-radius: var(--radius-sm); background: var(--hss-panel); border: 1px solid var(--hss-line); }
.tile b { display: block; font-family: var(--hss-display); font-size: 26px; line-height: 1; font-variant-numeric: tabular-nums; }
.tile span { display: block; margin-top: 4px; font-size: 12px; color: var(--hss-muted); }

.leader-card { padding: 4px 0; }
.leader-card h3 { margin: 0; padding: 10px 16px 4px; font-size: 13px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--hss-muted); }
.leader { display: flex; align-items: center; gap: 10px; padding: 7px 16px; }
.leader .pos { width: 16px; font-size: 13px; color: var(--hss-muted); text-align: center; }
.leader .who { flex: 1; min-width: 0; }
.leader .who b { display: block; font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.leader .who small { display: block; font-size: 12px; color: var(--hss-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.leader .val { font-family: var(--hss-display); font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.leader:first-of-type .val { color: var(--hss-accent); }
a.leader:active { background: var(--hss-chip); }

.team-hero { display: flex; align-items: center; gap: 16px; padding: 20px 0 6px; }
.team-hero .display { font-size: 30px; }
.record-big { font-family: var(--hss-display); font-weight: 700; font-size: 28px; line-height: 1; font-variant-numeric: tabular-nums; }

.result-pill { flex: none; width: 26px; height: 26px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; background: var(--hss-chip); color: var(--hss-muted); }
.result-pill.W { background: rgba(22, 137, 76, 0.14); color: var(--hss-win); }
.result-pill.L { background: rgba(208, 48, 58, 0.12); color: var(--hss-loss); }

.jersey {
  flex: none; width: 40px; height: 40px; border-radius: 12px; background: var(--hss-elev-2);
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--hss-display); font-weight: 700; font-size: 20px; font-variant-numeric: tabular-nums;
}

.notice { padding: 12px 14px; border-radius: var(--radius-sm); background: var(--hss-accent-soft); color: var(--hss-text-2); font-size: 14px; }
.empty { padding: 36px 20px; text-align: center; color: var(--hss-muted); }
.empty strong { display: block; color: var(--hss-text); font-size: 17px; margin-bottom: 4px; }

.more-btn { display: block; width: 100%; height: 48px; border: 0; border-top: 1px solid var(--hss-line-soft); background: transparent; color: var(--hss-accent); font-weight: 600; font-size: 15px; }
.more-btn:active { background: var(--hss-chip); }

details.disclose { margin-top: 12px; }
details.disclose summary { cursor: pointer; list-style: none; padding: 12px 16px; font-size: 14px; font-weight: 600; color: var(--hss-accent); }
details.disclose summary::-webkit-details-marker { display: none; }
details.disclose .disclose-body { padding: 0 16px 14px; font-size: 13px; color: var(--hss-muted); }
details.disclose ul { margin: 0; padding-left: 18px; }
details.disclose code { font-size: 12px; word-break: break-all; color: var(--hss-text-2); }

.footer-note { margin: 28px 4px 24px; font-size: 12px; color: var(--hss-muted-2); text-align: center; }

/* =========== Footer + settings sheet =========== */
.app-footer { max-width: 680px; margin: 32px auto 0; padding: 0 var(--gutter) 28px; display: flex; justify-content: center; }
main:has(> .footer-note:last-child) + .app-footer { margin-top: -4px; }
.app-footer .chip { color: var(--hss-muted); }

.sheet {
  width: 100%; max-width: 680px; max-height: calc(100dvh - var(--safe-top) - 24px);
  margin: auto auto 0; padding: 0; border: 0; border-radius: 18px 18px 0 0;
  background: var(--hss-bg); color: var(--hss-text);
  overflow-y: auto; overscroll-behavior: contain;
}
.sheet[open] { animation: sheet-up 0.22s ease-out; }
.sheet::backdrop { background: rgba(10, 12, 16, 0.45); }
.sheet-inner { padding: 0 var(--gutter) calc(var(--safe-bottom) + 4px); }
.sheet-head {
  position: sticky; top: 0; z-index: 4; margin: 0 calc(var(--gutter) * -1) 8px; padding: 8px 8px 8px var(--gutter);
  display: flex; align-items: center; justify-content: space-between; background: var(--hss-bg);
}
.sheet-head h2 { margin: 0; font-family: var(--hss-display); font-weight: 700; font-size: 24px; text-transform: uppercase; letter-spacing: 0.02em; }
.sheet-head .link-btn { font-size: 16px; font-weight: 600; }
@keyframes sheet-up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }

/* =========== Following (Follow chip, sortable list) =========== */
.follow-item {
  position: relative; display: flex; align-items: center; padding-right: 6px;
  background: var(--hss-panel); border-top: 1px solid var(--hss-line-soft);
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
.follow-list > .follow-item:first-child { border-top: 0; }
.follow-item > .row { flex: 1; min-width: 0; border-top: 0; padding-right: 4px; }
.follow-item .icon-btn { color: var(--hss-muted); }
.follow-item .icon-btn svg { width: 20px; height: 20px; }
.follow-item .drag-handle { color: var(--hss-muted-2); cursor: grab; touch-action: none; }
.follow-list.sorting { overflow: visible; }
.follow-item.dragging {
  z-index: 3; cursor: grabbing; border-radius: var(--radius-sm); border-top-color: transparent;
  outline: 1px solid var(--hss-line); box-shadow: 0 10px 28px rgba(10, 12, 16, 0.22);
}
.follow-item.dragging + .follow-item { border-top-color: transparent; }
.follow-hint { margin: 8px 4px 0; font-size: 12px; color: var(--hss-muted); }

.jump-fab {
  position: fixed; right: 16px; bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 14px); z-index: 15;
  height: 40px; padding: 0 16px; border: 0; border-radius: 20px;
  background: var(--hss-accent); color: var(--hss-accent-ink); font-weight: 600; font-size: 14px;
  box-shadow: 0 6px 18px rgba(26, 95, 217, 0.35);
}

/* =========== Loading / error =========== */
.skeleton { padding: 24px var(--gutter); max-width: 680px; margin: 0 auto; }
.skeleton i { display: block; height: 14px; margin: 12px 0; border-radius: 7px; background: linear-gradient(90deg, var(--hss-chip) 0%, var(--hss-elev-2) 50%, var(--hss-chip) 100%); background-size: 200% 100%; animation: shimmer 1.2s infinite linear; }
.skeleton i.big { height: 34px; width: 60%; }
.skeleton i.card { height: 120px; border-radius: var(--radius); }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .skeleton i, .sheet[open] { animation: none; } @view-transition { navigation: none; } }

@media (min-width: 700px) {
  .display { font-size: 40px; }
  .rail > * { width: 300px; }
  .b-col { width: 300px; }
}
