/* Padel Points: court blue, glass-wall light, optic-yellow ball. */

/* Fonts are self-hosted (SIL Open Font License): no third-party requests, works offline. */
@font-face {
  font-family: 'Big Shoulders Display';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('../fonts/big-shoulders-display-latin-wght-normal.woff2') format('woff2-variations');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Instrument Sans';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('../fonts/instrument-sans-latin-wght-normal.woff2') format('woff2-variations');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'IBM Plex Sans Arabic';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/ibm-plex-sans-arabic-arabic-400-normal.woff2') format('woff2');
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC;
}

@font-face {
  font-family: 'IBM Plex Sans Arabic';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('../fonts/ibm-plex-sans-arabic-arabic-600-normal.woff2') format('woff2');
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC;
}

@font-face {
  font-family: 'IBM Plex Sans Arabic';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('../fonts/ibm-plex-sans-arabic-arabic-700-normal.woff2') format('woff2');
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC;
}


:root {
  --paper: #eef2f6;
  --paper-contrast: #ffffff;
  --surface: #ffffff;
  --surface-2: #f4f7fa;
  --ink: #0f2340;
  --muted: #56677f;
  --line: #d6dee9;
  --line-strong: #b9c6d6;

  --court: #2a5fb0;
  --court-deep: #214f97;
  --court-line: #f5f8fc;
  --glass: #c9dbea;
  --net: #0f2340;
  --ball: #d6ed36;
  --ball-ink: #1b2400;

  --win: #2a5fb0;
  --loss: #c4424d;
  --race-1: #2a5fb0;
  --race-2: #12907b;
  --race-3: #c4424d;
  --focus: #2a5fb0;

  --r-sm: 6px;
  --r-md: 12px;
  --r-lg: 22px;
  --shadow: 0 1px 0 rgb(15 35 64 / 0.05), 0 14px 32px -20px rgb(15 35 64 / 0.45);

  --font-display: 'Big Shoulders Display', 'Arial Narrow', 'IBM Plex Sans Arabic', sans-serif;
  --font-body: 'Instrument Sans', 'IBM Plex Sans Arabic', system-ui, -apple-system, 'Segoe UI', sans-serif;

  --gutter: clamp(16px, 4vw, 40px);
  --tabbar-h: 64px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --paper: #0a1528;
    --paper-contrast: #f5f8fc;
    --surface: #112140;
    --surface-2: #17294c;
    --ink: #e8eef7;
    --muted: #93a3bc;
    --line: #22375c;
    --line-strong: #31497a;
    --court: #2459a9;
    --court-deep: #1c4b92;
    --glass: #3a5a86;
    --net: #06101f;
    --ball: #ddf247;
    --win: #7fa9ec;
    --loss: #f07c85;
    --race-1: #8fb4f0;
    --race-2: #3fc8b0;
    --race-3: #f07c85;
    --focus: #ddf247;
    --shadow: 0 1px 0 rgb(0 0 0 / 0.2), 0 18px 36px -22px rgb(0 0 0 / 0.8);
    color-scheme: dark;
  }
}

:root[data-theme='dark'] {
  --paper: #0a1528;
  --paper-contrast: #f5f8fc;
  --surface: #112140;
  --surface-2: #17294c;
  --ink: #e8eef7;
  --muted: #93a3bc;
  --line: #22375c;
  --line-strong: #31497a;
  --court: #2459a9;
  --court-deep: #1c4b92;
  --glass: #3a5a86;
  --net: #06101f;
  --ball: #ddf247;
  --win: #7fa9ec;
  --loss: #f07c85;
  --race-1: #8fb4f0;
  --race-2: #3fc8b0;
  --race-3: #f07c85;
  --focus: #ddf247;
  --shadow: 0 1px 0 rgb(0 0 0 / 0.2), 0 18px 36px -22px rgb(0 0 0 / 0.8);
  color-scheme: dark;
}

:root[lang='ar'] {
  --font-body: 'IBM Plex Sans Arabic', 'Instrument Sans', system-ui, sans-serif;
  --font-display: 'Big Shoulders Display', 'IBM Plex Sans Arabic', sans-serif;
}

/* ---------- base ---------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: 80px;
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--paper);
  color: var(--ink);
  font: 400 16px/1.5 var(--font-body);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

h1,
h2,
h3 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0.005em;
}

:root[lang='ar'] h1,
:root[lang='ar'] h2,
:root[lang='ar'] h3 {
  font-weight: 700;
  line-height: 1.25;
}

p {
  margin: 0;
}

button,
input,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  background: none;
  border: 0;
  padding: 0;
}

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

.i {
  width: 1.25em;
  height: 1.25em;
  flex: none;
}

.app {
  min-height: 100dvh;
}

.noscript {
  padding: 40px var(--gutter);
}

/* ---------- top bar ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: max(10px, env(safe-area-inset-top)) var(--gutter) 10px;
  background: color-mix(in srgb, var(--paper) 86%, transparent);
  backdrop-filter: blur(14px) saturate(1.4);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.45rem;
  letter-spacing: 0.01em;
}

a.brand {
  color: inherit;
  text-decoration: none;
}

.logo {
  width: 32px;
  height: 32px;
}

.topbar-tools {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-btn,
.pill-btn {
  display: inline-grid;
  place-items: center;
  min-width: 40px;
  height: 40px;
  border-radius: 999px;
  color: var(--ink);
  transition: background-color 0.15s;
}

.pill-btn {
  padding: 0 12px;
  font-weight: 600;
  font-size: 0.85rem;
  border: 1px solid var(--line-strong);
}

.icon-btn:hover,
.pill-btn:hover {
  background: var(--surface-2);
}

.clock {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 40px;
  padding: 0 14px 0 10px;
  border-radius: 999px;
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.2rem;
  font-variant-numeric: tabular-nums;
}

.clock .i {
  width: 18px;
  height: 18px;
  color: var(--muted);
}

.clock.is-paused {
  color: var(--muted);
  background: transparent;
  box-shadow: inset 0 0 0 1px var(--line-strong);
}

/* ---------- buttons & controls ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 22px;
  border-radius: 999px;
  font-weight: 600;
  text-decoration: none;
  transition:
    transform 0.12s,
    background-color 0.15s,
    box-shadow 0.15s;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: var(--ball);
  color: var(--ball-ink);
  box-shadow:
    inset 0 -3px 0 rgb(0 0 0 / 0.14),
    0 6px 18px -10px rgb(120 140 0 / 0.9);
}

.btn-primary:hover {
  background: color-mix(in srgb, var(--ball) 88%, white);
}

.btn-primary[aria-disabled='true'] {
  background: var(--surface-2);
  color: var(--muted);
  box-shadow: inset 0 0 0 1px var(--line);
  cursor: not-allowed;
}

.btn-ink {
  background: var(--ink);
  color: var(--paper);
}

.btn-quiet {
  min-height: 40px;
  padding: 0 14px;
  color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--line-strong);
}

.btn-quiet:hover {
  background: var(--surface-2);
}

.btn-danger {
  background: var(--loss);
  color: #fff;
}

.is-danger {
  color: var(--loss);
}

.btn-wide {
  width: 100%;
}

.input,
.select,
.add-row input {
  width: 100%;
  min-height: 48px;
  padding: 0 16px;
  border-radius: var(--r-md);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
}

.input::placeholder,
.add-row input::placeholder {
  color: var(--muted);
  opacity: 0.8;
}

.input:focus,
.add-row input:focus,
.select:focus {
  outline: none;
  border-color: var(--court);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--court) 25%, transparent);
}

.select {
  width: auto;
  min-height: 38px;
  padding: 0 10px;
}

.hint {
  font-size: 0.9rem;
  color: var(--muted);
}

.hint.is-warn {
  color: var(--loss);
}

/* segmented control (radio labels or buttons) */
.seg {
  display: inline-flex;
  flex-wrap: wrap;
  padding: 4px;
  gap: 2px;
  border-radius: 999px;
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line);
}

.seg label {
  position: relative;
}

.seg input {
  position: absolute;
  opacity: 0;
  inset: 0;
}

.seg span,
.seg button {
  display: inline-grid;
  place-items: center;
  min-width: 46px;
  height: 40px;
  padding: 0 12px;
  border-radius: 999px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: background-color 0.15s;
}

.seg input:checked + span,
.seg button[aria-checked='true'],
.seg button[aria-pressed='true'] {
  background: var(--ink);
  color: var(--paper);
}

.seg input:focus-visible + span {
  outline: 3px solid var(--focus);
  outline-offset: 1px;
}

.seg-small span,
.seg-small button {
  height: 32px;
  min-width: 0;
  font-size: 0.85rem;
}

.stepper {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line);
  padding: 4px;
}

.stepper button {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 999px;
}

.stepper button:hover:not(:disabled) {
  background: var(--surface-2);
}

.stepper button:disabled {
  opacity: 0.35;
  cursor: default;
}

.stepper output {
  min-width: 40px;
  text-align: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.5rem;
}

.stepper-small button {
  width: 34px;
  height: 34px;
}

.stepper-small output {
  font-size: 1.25rem;
  min-width: 28px;
}

/* ---------- home ---------- */

.home {
  padding: 0 var(--gutter) 64px;
  max-width: 1180px;
  margin: 0 auto;
}

.hero {
  display: grid;
  gap: 28px;
  padding: clamp(24px, 6vw, 72px) 0 clamp(32px, 6vw, 64px);
  align-items: center;
}

.hero-title {
  font-size: clamp(3rem, 10.5vw, 6.4rem);
  font-weight: 900;
  line-height: 0.88;
  letter-spacing: -0.005em;
  max-width: 9ch;
  text-wrap: balance;
}

:root[lang='ar'] .hero-title {
  font-size: clamp(2.4rem, 8vw, 4.6rem);
  line-height: 1.15;
  max-width: 12ch;
}

.hero-lede {
  margin: 20px 0 28px;
  max-width: 46ch;
  font-size: 1.1rem;
  color: var(--muted);
}

.hero-demo {
  max-width: 560px;
  width: 100%;
  justify-self: center;
}

.hero-hint {
  margin-top: 12px;
  font-size: 0.9rem;
  color: var(--muted);
  text-align: center;
}

@media (min-width: 900px) {
  .hero {
    grid-template-columns: 1fr 1.05fr;
    gap: 56px;
  }
  .hero-demo {
    justify-self: end;
  }
}

/* setup */
.setup {
  max-width: 760px;
  padding: clamp(24px, 4vw, 40px);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
  display: grid;
  gap: 28px;
}

.setup h2,
.archive h2 {
  font-size: clamp(2rem, 5vw, 2.6rem);
}

.field {
  border: 0;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 12px;
  min-width: 0;
}

.field legend,
.legend {
  padding: 0;
  margin-bottom: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.field .legend {
  margin-bottom: 0;
}

.count {
  display: inline-grid;
  place-items: center;
  min-width: 26px;
  height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--surface-2);
  box-shadow: inset 0 0 0 1px var(--line);
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
}

.formats {
  display: grid;
  gap: 10px;
}

@media (min-width: 640px) {
  .formats {
    grid-template-columns: repeat(3, 1fr);
  }
}

.format {
  position: relative;
  cursor: pointer;
}

.format input {
  position: absolute;
  opacity: 0;
}

.format-body {
  display: grid;
  gap: 6px;
  height: 100%;
  padding: 16px 16px 18px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  box-shadow: inset 0 0 0 1px var(--line);
  transition:
    box-shadow 0.15s,
    background-color 0.15s;
}

.format-name {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.45rem;
  line-height: 1;
}

.format-desc {
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.4;
}

.format input:checked + .format-body {
  background: color-mix(in srgb, var(--court) 9%, var(--surface));
  box-shadow: inset 0 0 0 2px var(--court);
}

.format input:checked + .format-body .format-name::after {
  content: '';
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-inline-start: 8px;
  vertical-align: middle;
  border-radius: 50%;
  background: var(--ball);
  box-shadow: 0 0 0 2px var(--court);
}

.format input:focus-visible + .format-body {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.add-row {
  display: flex;
  gap: 8px;
}

.add-row .btn {
  flex: none;
}

.chips {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chips:empty {
  display: none;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  height: 38px;
  padding-inline: 14px 4px;
  border-radius: 999px;
  background: var(--surface-2);
  box-shadow: inset 0 0 0 1px var(--line);
  font-weight: 500;
}

.chip button {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  color: var(--muted);
}

.chip button:hover {
  background: var(--line);
  color: var(--ink);
}

.chip-ghost {
  padding-inline: 12px 14px;
  gap: 8px;
  background: transparent;
  box-shadow: inset 0 0 0 1px var(--line-strong);
  border-style: dashed;
}

.field-grid {
  display: grid;
  gap: 28px;
}

@media (min-width: 640px) {
  .field-grid {
    grid-template-columns: auto auto;
    justify-content: start;
    column-gap: 40px;
  }
  .field-grid > :first-child {
    grid-column: 1 / -1;
  }
}

/* archive */
.archive {
  max-width: 760px;
  margin-top: 56px;
}

.archive-list {
  list-style: none;
  margin: 16px 0 0;
  padding: 0;
  border-top: 1px solid var(--line);
}

.archive-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 16px;
  width: 100%;
  padding: 16px 4px;
  text-align: start;
  border-bottom: 1px solid var(--line);
}

.archive-item:hover .archive-title {
  color: var(--court);
}

.archive-title {
  font-weight: 600;
  font-size: 1.05rem;
}

.archive-meta {
  grid-row: 2;
  font-size: 0.88rem;
  color: var(--muted);
}

.archive-winner {
  grid-row: 1 / span 2;
  grid-column: 2;
  align-self: center;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  font-size: 0.9rem;
}

.archive-winner .i {
  color: var(--court);
}

/* ---------- court ---------- */

.court {
  padding: 14px;
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.court-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 4px 10px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.3rem;
  line-height: 1;
}

.court-progress {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.8rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.court-progress .bar {
  display: block;
  width: 64px;
  height: 6px;
  border-radius: 6px;
  background: var(--surface-2);
  box-shadow: inset 0 0 0 1px var(--line);
  overflow: hidden;
}

.court-progress .bar i {
  display: block;
  height: 100%;
  background: var(--court);
  border-radius: inherit;
  transition: width 0.25s ease;
}

.court.is-done .court-progress .bar i {
  background: var(--ball);
}

.court-surface {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  aspect-ratio: 2 / 1.12;
  min-height: 184px;
  border-radius: 6px;
  overflow: hidden;
  /* turf with faint mowing stripes, framed by the glass walls */
  background:
    repeating-linear-gradient(90deg, rgb(255 255 255 / 0.035) 0 10%, transparent 10% 20%),
    var(--court);
  box-shadow:
    0 0 0 5px var(--glass),
    inset 0 0 0 1px rgb(0 0 0 / 0.08);
  margin: 5px;
}

[dir='rtl'] .court-lines {
  transform: scaleX(-1);
}

.court-lines {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  fill: none;
  stroke: var(--court-line);
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
  opacity: 0.85;
  pointer-events: none;
}

.court-lines * {
  vector-effect: non-scaling-stroke;
}

.net {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 6px;
  transform: translateX(-50%);
  background:
    repeating-linear-gradient(0deg, rgb(255 255 255 / 0.55) 0 1px, transparent 1px 5px),
    var(--net);
  box-shadow: 0 0 12px rgb(0 0 0 / 0.35);
  pointer-events: none;
  z-index: 2;
}

.half {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: auto 1fr;
  justify-items: center;
  align-items: center;
  padding: 14px 12px 10px;
  color: #fff;
  overflow: hidden;
  transition: background-color 0.15s;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

button.half:hover {
  background: rgb(255 255 255 / 0.06);
}

button.half:active {
  background: rgb(255 255 255 / 0.12);
}

button.half:focus-visible {
  outline: 3px solid #fff;
  outline-offset: -6px;
  border-radius: 6px;
}

button.half[aria-disabled='true'] {
  cursor: default;
}

.team {
  display: grid;
  gap: 1px;
  justify-items: center;
  max-width: 100%;
  font-weight: 600;
  font-size: clamp(0.82rem, 2.6vw, 0.98rem);
  line-height: 1.25;
  text-shadow: 0 1px 2px rgb(0 0 0 / 0.25);
}

.team span {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.score {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(3.6rem, 15vw, 6rem);
  line-height: 0.9;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 2px 0 rgb(0 0 0 / 0.18);
  transition:
    color 0.2s,
    opacity 0.2s;
}

.half.is-win .score {
  color: var(--ball);
}

.half.is-lose .score {
  opacity: 0.55;
}

.ball-pop {
  position: absolute;
  width: 18px;
  height: 18px;
  margin: -9px 0 0 -9px;
  border-radius: 50%;
  background: var(--ball);
  box-shadow: inset -3px -3px 0 rgb(0 0 0 / 0.12);
  pointer-events: none;
  animation: bounce 0.65s cubic-bezier(0.3, 0.7, 0.4, 1) forwards;
}

@keyframes bounce {
  0% {
    transform: translateY(0) scale(0.4);
    opacity: 1;
  }
  40% {
    transform: translateY(-34px) scale(1);
  }
  75% {
    transform: translateY(0) scale(1, 0.85);
    opacity: 1;
  }
  100% {
    transform: translateY(-8px) scale(0.9);
    opacity: 0;
  }
}

.court-tools {
  display: grid;
  grid-template-columns: 48px 1fr 48px;
  gap: 8px;
  margin-top: 14px;
}

.tool {
  display: grid;
  place-items: center;
  height: 44px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  box-shadow: inset 0 0 0 1px var(--line);
  font-weight: 600;
  font-size: 0.95rem;
}

.tool:hover {
  background: var(--line);
}

/* ---------- live session ---------- */

.session {
  max-width: 1280px;
  margin: 0 auto;
  padding: 20px var(--gutter) calc(var(--tabbar-h) + 48px + env(safe-area-inset-bottom));
  display: grid;
  gap: 24px;
}

.session-head {
  display: grid;
  gap: 6px;
}

.session-title {
  font-size: clamp(1.6rem, 5vw, 2.2rem);
  font-weight: 800;
}

.session-meta {
  font-size: 0.9rem;
  color: var(--muted);
}

.pane {
  display: none;
  min-width: 0;
}

.session[data-tab='courts'] .pane-courts,
.session[data-tab='table'] .pane-table,
.session[data-tab='rounds'] .pane-rounds {
  display: block;
}

@media (min-width: 1040px) {
  .session {
    grid-template-columns: minmax(0, 1.2fr) minmax(380px, 1fr);
    grid-template-areas:
      'head head'
      'courts table'
      'courts rounds';
    align-items: start;
    column-gap: 40px;
    padding-bottom: 64px;
  }
  .session-head {
    grid-area: head;
  }
  .pane {
    display: block;
  }
  .pane-courts {
    grid-area: courts;
    position: sticky;
    top: 84px;
  }
  .pane-table {
    grid-area: table;
  }
  .pane-rounds {
    grid-area: rounds;
  }
  .tabbar {
    display: none !important;
  }
}

.round-head,
.pane-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}

.round-title {
  font-size: clamp(2.6rem, 9vw, 3.6rem);
  font-weight: 900;
  line-height: 0.9;
}

.pane-head h2 {
  font-size: 2rem;
}

.round-timer {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 16px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.5rem;
  font-variant-numeric: tabular-nums;
}

.round-timer .i {
  width: 20px;
  height: 20px;
}

.round-timer.is-paused {
  background: transparent;
  color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--line-strong);
}

.round-timer.is-low {
  background: var(--ball);
  color: var(--ball-ink);
}

.round-timer.is-over {
  background: var(--loss);
  color: #fff;
}

.courts {
  display: grid;
  gap: 16px;
}

.resting {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
  padding: 12px 16px;
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line);
  font-size: 0.95rem;
  color: var(--muted);
}

.resting strong {
  color: var(--ink);
  font-weight: 600;
}

.round-actions {
  display: grid;
  gap: 10px;
  margin-top: 20px;
  text-align: center;
}

.round-actions .btn {
  min-height: 56px;
  font-size: 1.05rem;
}

/* tab bar */
.tabbar {
  position: fixed;
  inset: auto 0 0;
  z-index: 25;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  padding: 6px 8px max(6px, env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(16px) saturate(1.5);
  -webkit-backdrop-filter: blur(16px) saturate(1.5);
  border-top: 1px solid var(--line);
}

.tabbar button {
  display: grid;
  justify-items: center;
  gap: 2px;
  padding: 6px 0 4px;
  border-radius: var(--r-md);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
}

.tabbar .i {
  width: 24px;
  height: 24px;
}

.tabbar button[aria-current='page'] {
  color: var(--court);
}

:root[data-theme='dark'] .tabbar button[aria-current='page'] {
  color: var(--ball);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .tabbar button[aria-current='page'] {
    color: var(--ball);
  }
}

.tabbar button[aria-current='page'] .i {
  stroke-width: 2.3;
}

/* ---------- standings ---------- */

.standings {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
  background: var(--surface);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.standings th {
  white-space: nowrap;
  padding: 12px 6px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  text-align: center;
  border-bottom: 1px solid var(--line);
}

.standings td {
  padding: 10px 6px;
  text-align: center;
  border-bottom: 1px solid var(--line);
}

.standings tbody tr:last-child td {
  border-bottom: 0;
}

.standings .c-rank {
  width: 46px;
  padding-inline: 10px 2px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.15rem;
}

.standings .c-name {
  text-align: start;
  width: 100%;
}

.name-btn {
  display: block;
  max-width: 100%;
  font-weight: 600;
  text-align: start;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.name-btn:hover {
  color: var(--court);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.standings .c-num {
  width: 34px;
  font-size: 0.92rem;
}

.standings .c-pts {
  width: 64px;
  padding-inline-end: 16px;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 1.6rem;
  line-height: 1;
}

.standings th.c-pts {
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 600;
}

.rank {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
}

.is-leader .rank {
  background: var(--ball);
  color: var(--ball-ink);
}

.is-paused td {
  opacity: 0.55;
}

.form {
  display: flex;
  gap: 4px;
  margin-top: 5px;
}

.form i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.form .f-w {
  background: var(--win);
}

.form .f-l {
  background: var(--loss);
}

.form .f-t {
  box-shadow: inset 0 0 0 1.5px var(--muted);
}

.form .f-r {
  width: 8px;
  height: 2px;
  margin: 3px 0;
  border-radius: 1px;
  background: var(--line-strong);
}

@media (max-width: 520px) {
  .standings .c-wide {
    display: none;
  }
  .standings .c-num {
    width: 26px;
    padding-inline: 3px;
  }
}

/* points race */
.race {
  margin: 20px 0 0;
  padding: 16px 16px 8px;
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.race figcaption {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 8px;
}

.race svg {
  display: block;
  width: 100%;
  height: 180px;
  overflow: visible;
}

.race polyline,
.race line {
  vector-effect: non-scaling-stroke;
}

.race polyline {
  fill: none;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.race-top {
  stroke-width: 3;
}

.race-rest {
  stroke: var(--line-strong);
  stroke-width: 1.5;
}

.race-grid {
  stroke: var(--line);
  stroke-dasharray: 3 5;
}

.race-axis {
  stroke: var(--line-strong);
}

.race-ticks {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  font-size: 0.75rem;
  color: var(--muted);
}

.race-legend {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  margin: 10px 0 6px;
  padding: 0;
  font-size: 0.9rem;
  font-weight: 500;
}

.race-legend li {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.race-legend i {
  width: 14px;
  height: 4px;
  border-radius: 2px;
}

.race-legend strong {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.1rem;
}

[dir='rtl'] .race svg {
  transform: scaleX(-1);
}

[dir='rtl'] .race-ticks {
  flex-direction: row;
}

/* ---------- rounds ---------- */

.round-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 12px;
}

.ri {
  padding: 14px 14px 10px;
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line);
}

.ri-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0 4px 6px;
}

.ri-n {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.2rem;
}

.ri-time {
  font-size: 0.8rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.ri-match {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 4px;
  border-radius: var(--r-sm);
  font-size: 0.92rem;
}

button.ri-match:hover {
  background: var(--surface-2);
}

.ri-team {
  text-align: end;
  color: var(--muted);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ri-team-b {
  text-align: start;
}

.ri-team.won {
  color: var(--ink);
  font-weight: 600;
}

.ri-score {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.35rem;
  font-variant-numeric: tabular-nums;
  direction: ltr;
}

.ri-score i {
  font-style: normal;
  color: var(--muted);
  margin: 0 3px;
}

.ri-rest {
  padding: 4px 4px 2px;
  font-size: 0.8rem;
  color: var(--muted);
}

.empty {
  padding: 28px 20px;
  border-radius: var(--r-lg);
  border: 1.5px dashed var(--line-strong);
  color: var(--muted);
  text-align: center;
}

/* ---------- results ---------- */

.results {
  max-width: 880px;
  margin: 0 auto;
  padding: 24px var(--gutter) 72px;
  display: grid;
  gap: 32px;
}

.results-head h1 {
  font-size: clamp(2.6rem, 9vw, 4.4rem);
  font-weight: 900;
}

.results-date {
  color: var(--muted);
  margin-bottom: 8px;
}

.podium {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: end;
  gap: 10px;
  max-width: 620px;
}

.step {
  display: grid;
  justify-items: center;
  text-align: center;
  gap: 2px;
  min-width: 0;
}

.step-name {
  max-width: 100%;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.step-pts {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(2.2rem, 8vw, 3.2rem);
  line-height: 1;
}

.step-sub {
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 8px;
}

.step-block {
  display: grid;
  place-items: start center;
  width: 100%;
  padding-top: 10px;
  border-radius: 10px 10px 0 0;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 2rem;
}

.step-1 .step-block {
  height: 150px;
  background: var(--ball);
  color: var(--ball-ink);
}

.step-2 .step-block {
  height: 108px;
  background: var(--court);
  color: #fff;
}

.step-3 .step-block {
  height: 76px;
  background: var(--ink);
  color: var(--paper);
}

.facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin: 0;
}

.facts div {
  padding: 16px 18px;
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line);
}

.facts dt {
  font-size: 0.85rem;
  color: var(--muted);
}

.facts dd {
  margin: 4px 0 0;
  display: grid;
}

.facts strong {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.7rem;
  line-height: 1.1;
}

.facts span {
  font-size: 0.85rem;
  color: var(--muted);
}

.results-actions,
.results-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.results-actions .btn {
  flex: 1 1 auto;
}

.results-foot {
  justify-content: space-between;
  border-top: 1px solid var(--line);
  padding-top: 20px;
}

.results-section {
  display: grid;
  gap: 16px;
}

.results-section h2 {
  font-size: 2rem;
}

.results-section .pane-head {
  margin-bottom: 0;
}

/* ---------- sheet (dialog) ---------- */

.sheet {
  width: 100%;
  max-width: 520px;
  max-height: min(88dvh, 820px);
  margin: auto auto 0;
  padding: 0;
  border: 0;
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 -20px 60px -20px rgb(0 0 0 / 0.5);
  overflow: auto;
  overscroll-behavior: contain;
}

.sheet[open] {
  animation: sheet-in 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.sheet::backdrop {
  background: rgb(6 14 30 / 0.5);
  backdrop-filter: blur(3px);
}

@keyframes sheet-in {
  from {
    transform: translateY(40px);
    opacity: 0;
  }
}

@media (min-width: 640px) {
  .sheet {
    margin: auto;
    border-radius: var(--r-lg);
  }
}

.sheet-small {
  max-width: 440px;
}

.sheet-inner {
  display: grid;
  gap: 16px;
  padding: 20px 20px max(20px, env(safe-area-inset-bottom));
}

.sheet-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.sheet-head h2 {
  font-size: 1.9rem;
}

.sheet-head p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.9rem;
}

.sheet-text {
  color: var(--muted);
}

.sheet-sub {
  font-size: 1.25rem;
  margin-top: 4px;
}

.sheet-actions {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.sheet-small .sheet-actions {
  justify-content: flex-end;
}

.score-teams {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  text-align: center;
}

.score-teams .vs {
  color: var(--muted);
  font-weight: 400;
  font-size: 0.85rem;
}

.pad {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(58px, 1fr));
  gap: 8px;
}

.pad-key {
  display: grid;
  place-items: center;
  gap: 0;
  height: 62px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  box-shadow: inset 0 0 0 1px var(--line);
  font-variant-numeric: tabular-nums;
}

.pad-key strong {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.6rem;
  line-height: 1;
}

.pad-key span {
  font-size: 0.72rem;
  color: var(--muted);
}

.pad-key:hover {
  box-shadow: inset 0 0 0 2px var(--court);
}

.pad-key.is-on {
  background: var(--ball);
  color: var(--ball-ink);
  box-shadow: none;
}

.pad-key.is-on span {
  color: inherit;
  opacity: 0.7;
}

.open-score {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: end;
  gap: 12px;
}

.open-score label {
  display: grid;
  gap: 6px;
  font-weight: 600;
  font-size: 0.9rem;
  text-align: center;
}

.open-score input {
  height: 72px;
  border-radius: var(--r-md);
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  text-align: center;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 2.6rem;
}

.open-score .vs {
  font-family: var(--font-display);
  font-size: 2rem;
  padding-bottom: 14px;
}

.open-score .btn {
  grid-column: 1 / -1;
}

/* menu */
.menu {
  display: grid;
  border-top: 1px solid var(--line);
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 56px;
  padding: 8px 4px;
  border-bottom: 1px solid var(--line);
  text-align: start;
  font-weight: 500;
}

.menu-item > span {
  flex: 1;
}

.menu-item > .i {
  color: var(--muted);
}

.menu-item em {
  font-style: normal;
  color: var(--muted);
  font-size: 0.9rem;
}

button.menu-item:hover {
  background: var(--surface-2);
}

.switch {
  position: relative;
  width: 44px;
  height: 26px;
  border-radius: 999px;
  background: var(--line-strong);
  transition: background-color 0.2s;
  flex: none;
}

.switch::after {
  content: '';
  position: absolute;
  top: 3px;
  inset-inline-start: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgb(0 0 0 / 0.25);
  transition: transform 0.2s;
}

[aria-pressed='true'] .switch {
  background: var(--court);
}

[aria-pressed='true'] .switch::after {
  transform: translateX(18px);
}

[dir='rtl'] [aria-pressed='true'] .switch::after {
  transform: translateX(-18px);
}

/* players */
.player-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.player-list li {
  display: flex;
  gap: 8px;
}

.player-list li.is-paused .input {
  color: var(--muted);
  text-decoration: line-through;
  text-decoration-color: var(--line-strong);
}

.toggle {
  flex: none;
  min-width: 96px;
  height: 48px;
  padding: 0 14px;
  border-radius: var(--r-md);
  font-weight: 600;
  font-size: 0.9rem;
  box-shadow: inset 0 0 0 1px var(--line-strong);
  color: var(--muted);
}

.toggle.is-on {
  background: color-mix(in srgb, var(--court) 12%, var(--surface));
  box-shadow: inset 0 0 0 1.5px var(--court);
  color: var(--ink);
}

/* player detail */
.kpis {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 0;
}

.kpis div {
  padding: 12px;
  border-radius: var(--r-md);
  background: var(--surface-2);
}

.kpis dt {
  font-size: 0.75rem;
  color: var(--muted);
}

.kpis dd {
  margin: 2px 0 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.6rem;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.spark {
  width: 100%;
  height: 60px;
}

.spark polyline {
  fill: none;
  stroke: var(--court);
  stroke-width: 2.5;
  vector-effect: non-scaling-stroke;
  stroke-linejoin: round;
}

.mini-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.mini-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 2px;
  border-bottom: 1px solid var(--line);
  font-size: 0.92rem;
}

.mini-list li span:last-child {
  color: var(--muted);
}

.mini-list strong {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.15rem;
  direction: ltr;
}

.mini-list li.won strong {
  color: var(--win);
}

.mini-list li.lost strong {
  color: var(--loss);
}

/* ---------- toasts & confetti ---------- */

.toasts {
  position: fixed;
  inset: auto 0 calc(var(--tabbar-h) + 16px + env(safe-area-inset-bottom));
  z-index: 60;
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 0 16px;
  pointer-events: none;
}

.app[data-view='home'] ~ .toasts,
.app[data-view='stats'] ~ .toasts,
.app[data-view='results'] ~ .toasts {
  bottom: max(20px, env(safe-area-inset-bottom));
}

@media (min-width: 1040px) {
  .toasts {
    bottom: 24px;
  }
}

.toast {
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: 480px;
  padding: 12px 12px 12px 18px;
  border-radius: 14px;
  background: var(--ink);
  color: var(--paper);
  box-shadow: 0 12px 32px -12px rgb(0 0 0 / 0.5);
  font-size: 0.93rem;
  pointer-events: auto;
  animation: toast-in 0.25s ease;
  transition:
    opacity 0.3s,
    transform 0.3s;
}

.toast button {
  padding: 6px 12px;
  border-radius: 8px;
  background: var(--ball);
  color: var(--ball-ink);
  font-weight: 700;
  font-size: 0.85rem;
}

.toast.is-leaving {
  opacity: 0;
  transform: translateY(8px);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}

.confetti {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 70;
}

/* ---------- topbar extras ---------- */

.icon-btn.is-on {
  background: var(--ink);
  color: var(--paper);
}

.clock.is-static {
  cursor: default;
}

.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--loss);
  color: #fff;
  font-weight: 700;
  font-size: 0.85rem;
}

.live-badge.is-off {
  background: var(--surface-2);
  color: var(--muted);
}

.pulse {
  position: relative;
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  flex: none;
}

.pulse::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: currentColor;
  animation: pulse 1.8s ease-out infinite;
}

@keyframes pulse {
  from {
    transform: scale(1);
    opacity: 0.7;
  }
  to {
    transform: scale(2.8);
    opacity: 0;
  }
}

/* ---------- live now (home) ---------- */

.live-now {
  margin-top: 20px;
  padding: 16px 18px;
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow), inset 0 0 0 2px color-mix(in srgb, var(--loss) 55%, transparent);
}

.live-now h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.5rem;
  color: var(--loss);
}

.live-now ul {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
}

.live-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.live-item:first-child {
  border-top: 0;
}

.live-item div {
  display: grid;
  min-width: 0;
}

.live-item strong {
  font-weight: 600;
}

.live-item span {
  font-size: 0.85rem;
  color: var(--muted);
}

.live-item .btn {
  min-height: 40px;
  flex: none;
}

/* ---------- viewer ---------- */

.viewer-note {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  font-size: 0.85rem;
  color: var(--muted);
}

.viewer-empty {
  display: grid;
  justify-items: start;
  gap: 14px;
  max-width: 560px;
  margin: 0 auto;
  padding: 64px var(--gutter);
}

.viewer-empty h1 {
  font-size: clamp(2.4rem, 8vw, 3.4rem);
}

.viewer-empty p {
  color: var(--muted);
}

.loading {
  animation: fade 1.2s ease-in-out infinite alternate;
}

@keyframes fade {
  from {
    opacity: 0.4;
  }
}

/* ---------- link sheets ---------- */

.qr-wrap {
  display: grid;
  place-items: center;
}

.qr-slot {
  width: min(240px, 70vw);
  aspect-ratio: 1;
  border-radius: var(--r-md);
  background: var(--surface-2);
}

.qr {
  display: block;
  width: 100%;
  height: 100%;
}

.link-text {
  padding: 10px 14px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
  word-break: break-all;
  text-align: center;
}

.sheet-actions-fill > .btn {
  flex: 1 1 0;
  min-width: 140px;
}

.btn-small {
  min-height: 36px;
  font-size: 0.9rem;
  justify-self: start;
}

/* ---------- settings ---------- */

.settings-block {
  display: grid;
  gap: 12px;
}

.crew-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  box-shadow: inset 0 0 0 1px var(--line);
}

.crew-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--court);
  color: #fff;
  flex: none;
}

.crew-card div {
  display: grid;
}

.crew-card strong {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.4rem;
  line-height: 1.1;
}

.crew-card span:not(.crew-mark) {
  font-size: 0.85rem;
  color: var(--muted);
}

.file-btn {
  position: relative;
  cursor: pointer;
}

.file-btn input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
}

.file-btn:focus-within {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

/* ---------- all-time stats ---------- */

.stats {
  max-width: 900px;
  margin: 0 auto;
  padding: 24px var(--gutter) 72px;
  display: grid;
  gap: 20px;
}

.stats-head h1 {
  font-size: clamp(2.6rem, 9vw, 4.4rem);
  font-weight: 900;
  margin-bottom: 8px;
}

.stats .pane-head {
  margin-bottom: 0;
}

.stats > .btn {
  justify-self: start;
}

.career .c-wtl {
  white-space: nowrap;
  font-size: 0.9rem;
  width: 72px;
}

.career th .i {
  width: 16px;
  height: 16px;
  vertical-align: -3px;
}

.career .c-pts {
  width: 76px;
  font-size: 1.35rem;
  white-space: nowrap;
}

.duos {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
}

.duo {
  display: grid;
  padding: 14px;
  border-radius: var(--r-md);
  background: var(--surface-2);
}

.duo span {
  font-size: 0.8rem;
  color: var(--muted);
}

.duo strong {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.5rem;
  line-height: 1.15;
}

.duo em {
  font-style: normal;
  font-size: 0.82rem;
  color: var(--muted);
}

.h2h li {
  display: grid;
  grid-template-columns: 1fr auto 56px;
  align-items: center;
}

.h2h .h2h-rec {
  font-variant-numeric: tabular-nums;
  font-size: 0.85rem;
}

.h2h strong {
  text-align: end;
  color: var(--ink);
}

/* ---------- motion & print ---------- */

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

@media print {
  .topbar,
  .tabbar,
  .results-actions,
  .results-foot,
  .toasts {
    display: none !important;
  }
  body {
    background: #fff;
  }
}
