/* Pickle2 v10 app layer: turns the Rally design components (rally.css) into a real, responsive page. */

/* Design tokens (release 1.8). Values are unchanged from the literals they replace,
   so the page looks identical; later work references these instead of raw hex. */
:root {
  /* Neutrals */
  --ink: #111111;
  --surface: #FFFFFF;
  --canvas: #F9F9F9;
  /* Brand */
  --accent: #FF5500;
  --accent-ink: #C24100;
  --accent-ink-hover: #8E1A0C;
  --lime: #C6F51F;
  /* Text */
  --muted: #646464;
  --muted-faint: #A3A3A3;
  --muted-dark: #BDB8B2;
  /* Status */
  --success: #15803D;
  --info: #2563EB;
  --warning: #F59E0B;
  --danger: #DC2626;
  /* Lines & soft surfaces */
  --line: #ECE8E3;
  --line-soft: #E8E5E0;
  --surface-2: #F6F3EF;
  --surface-3: #F1EEEA;
  --surface-hover: #FBFAF8;
  --tint-orange: #FFE9DE;
  --tint-green: #E7F8E0;
  /* Spacing (8-point) */
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-6: 24px; --s-8: 32px;
  /* Radius */
  --r-sm: 12px; --r-md: 16px; --r-lg: 22px; --r-xl: 28px; --r-pill: 999px;
  /* Type */
  --font-body: 'Barlow', -apple-system, 'Segoe UI', sans-serif;
  --font-cond: 'Barlow Condensed', 'Barlow', sans-serif;
  --font-display: 'Anton', Impact, sans-serif;
}

html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(120% 340px at 50% 0%, #F1ECE6 0%, rgba(241,236,230,0) 100%), var(--canvas);
  background-attachment: fixed;
  font-family: var(--font-body);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.4;
}
a { color: var(--accent-ink); }
a:hover { color: var(--accent-ink-hover); }
.app { max-width: 560px; margin: 0 auto; min-height: 100vh; position: relative; }
.scroll {
  padding: 18px 16px calc(120px + env(safe-area-inset-bottom));
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
}
.area-bare .scroll { padding-bottom: calc(40px + env(safe-area-inset-bottom)); }

/* Top nav: sticky, under the notch */
.topnav { position: sticky; top: 0; z-index: 20; margin-top: calc(-18px - env(safe-area-inset-top)); padding-top: env(safe-area-inset-top); height: calc(60px + env(safe-area-inset-top)); }
.tn-links { display: none; }
.tn-chip { text-decoration: none; }
.tn-chip-ink { background: var(--ink); color: var(--surface); }
.tn-chip-lime { background: var(--lime); color: var(--ink); }
.tn-avatar { display: inline-flex; text-decoration: none; }
.inline { display: inline-flex; margin: 0; gap: 6px; }
button.tn-btn { cursor: pointer; padding: 0; }

/* Floating bottom nav, fixed to the viewport */
.nav { position: fixed; bottom: calc(18px + env(safe-area-inset-bottom)); z-index: 30; }
.nav a:focus-visible, .btn:focus-visible, .tn-btn:focus-visible, .input:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* Buttons and forms */
.btn:hover { filter: brightness(1.15); color: var(--surface); }
.btn-white:hover, .btn-ghost:hover { filter: brightness(0.97); color: var(--ink); }
.btn-lg { height: 54px; font-size: 18px; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.danger-text { color: var(--danger) !important; }
.input:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(255,85,0,0.25); }
select.input { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23111' stroke-width='2.2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 16px center; padding-right: 44px; }
.pin input:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(255,85,0,0.25); }
.check { display: flex; align-items: center; gap: 10px; font-size: 14px; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--ink); }
.form-card { display: flex; flex-direction: column; gap: 18px; padding: 22px 20px; }
.strong { font-weight: 700; }
.block { display: block; }
.center { text-align: center; align-items: center; }
.quiet { color: var(--muted-faint); display: inline-flex; }
.grow { flex: 1; min-width: 0; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Toggle switch built on a real checkbox */
.switch { position: relative; display: inline-flex; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch input:checked + .toggle { background: var(--ink); }
.switch input:checked + .toggle::after { left: 21px; }
.switch input:focus-visible + .toggle { outline: 3px solid var(--accent); outline-offset: 2px; }
.toggle::after { transition: left 0.15s; }

/* Flash messages */
.flash { border-radius: 18px; padding: 12px 16px; font-size: 14px; font-weight: 600; }
.flash-success { background: var(--tint-green); color: #14532D; }
.flash-error { background: #FFE6E2; color: #991B1B; }
.flash-info { background: var(--tint-orange); color: #5A2A0E; }

/* Sign-in screens */
.auth { display: flex; flex-direction: column; gap: 22px; padding-top: max(20px, env(safe-area-inset-top)); max-width: 420px; margin: 0 auto; width: 100%; }
.auth-head { gap: 12px; align-items: flex-start; }
.auth-head.center { align-items: center; }
.auth-logo { height: 96px; width: auto; display: block; margin: 0 0 4px -6px; }
.auth-head.center .auth-logo { margin: 0; }
.auth-foot { align-items: center; gap: 10px; text-align: center; }
.chip-round { width: 44px; height: 44px; padding: 0; justify-content: center; }
.steps-labels .on { color: var(--accent-ink); font-weight: 700; }
.grid5 { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.big-icon { width: 64px; height: 64px; border-radius: 50%; background: var(--tint-orange); color: var(--accent-ink); display: inline-flex; align-items: center; justify-content: center; }
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; padding: 28px 20px; }

/* Today hero */
.hero { display: flex; flex-direction: column; gap: 10px; padding: 20px; background: radial-gradient(120% 90% at 100% 0%, rgba(198,245,31,0.18), transparent 55%), radial-gradient(90% 80% at 0% 100%, rgba(255,85,0,0.28), transparent 60%), var(--ink); }
.hero-title { font-family: var(--font-display); font-weight: 400; font-size: 52px; line-height: 1; margin: 0; color: var(--surface); }
.hero-sub { color: var(--line-soft); font-size: 15px; }
.hero-date { color: var(--muted-dark); font-size: 13px; font-weight: 600; }
.hero-stats { margin-top: 6px; }
.hero-num { font-size: 26px; color: var(--surface); line-height: 1.05; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hero-lbl { font-size: 11px; color: var(--muted-dark); }
.pill-lime { background: var(--lime); color: var(--ink); }
.pill-live { background: var(--accent); color: var(--ink); }
.pill-live .dot-live { background: var(--ink); }

/* Link cards and rows */
.link-card { display: flex; align-items: center; gap: 14px; text-decoration: none; color: var(--ink); }
.link-card:hover { color: var(--ink); }
.round-ic { width: 48px; height: 48px; border-radius: 50%; background: var(--tint-orange); color: var(--accent-ink); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.round-ink { background: var(--ink); color: var(--lime); }
.link-row { text-decoration: none; color: var(--ink); }
.link-row:hover { color: var(--ink); background: var(--surface-hover); }
.name-sm { font-size: 15px; }
.sq-ic { width: 40px; height: 40px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.sq-orange { background: #FFE7D9; color: var(--accent-ink); }
.sq-green { background: var(--tint-green); color: var(--success); }
.sq-violet { background: #EFE7FF; color: #6D28D9; }
.sq-ink { background: var(--ink); color: var(--lime); }
.sq-ga { background: #FFF4E5; color: #E37400; }
.tile-white { background: var(--surface); box-shadow: 0 10px 30px rgba(40,24,10,0.08); }
.me-hero { display: flex; flex-direction: column; gap: 14px; }

/* Super admin */
.league-card { display: flex; flex-direction: column; gap: 14px; padding: 18px; background: radial-gradient(120% 90% at 100% 0%, rgba(198,245,31,0.22), transparent 55%), radial-gradient(90% 80% at 0% 100%, rgba(255,85,0,0.25), transparent 60%), var(--ink); }
.league-name { font-family: var(--font-display); font-size: 28px; line-height: 1.05; color: var(--surface); }
.role-cards { gap: 8px; }
.role-card { background: var(--surface); color: var(--ink); border-radius: 22px; padding: 12px; display: flex; flex-direction: column; gap: 6px; min-width: 0; box-shadow: 0 10px 30px rgba(40,24,10,0.08); }
.role-card .pill { align-self: flex-start; }
.role-card-ink { background: var(--ink); color: var(--surface); }
.role-n { font-size: 28px; line-height: 1; }
.role-d { font-size: 11px; line-height: 1.25; color: var(--muted); }
.role-card-ink .role-d { color: var(--muted-dark); }
.matrix { display: flex; flex-direction: column; padding: 14px 16px; }
.mx-row { display: grid; grid-template-columns: minmax(0, 1fr) 54px 72px 52px; align-items: center; gap: 4px; padding: 9px 0; border-bottom: 1px solid rgba(0,0,0,0.06); }
.mx-row > span:not(.mx-label) { display: flex; justify-content: center; }
.mx-head { border-bottom: 2px solid var(--ink); padding-top: 0; font-size: 12px; font-weight: 700; color: var(--muted); }
.mx-head > span:first-child { justify-content: flex-start; }
.mx-label { font-size: 14px; font-weight: 600; }
.mx-group { font-size: 12px; font-weight: 700; color: var(--accent-ink); letter-spacing: 0.05em; padding-top: 12px; }
.mx-yes { width: 24px; height: 24px; border-radius: 50%; background: var(--ink); color: var(--lime); display: inline-flex; align-items: center; justify-content: center; }
.mx-no { width: 24px; height: 24px; border-radius: 50%; background: var(--surface-3); color: var(--muted-faint); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; }
.mx-always { font-size: 12px; font-weight: 700; }
.mx-own { font-size: 11px; font-weight: 700; color: var(--success); }

/* Toast and consent banner */
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(96px + env(safe-area-inset-bottom)); z-index: 50; background: var(--ink); color: var(--surface); border-radius: 999px; padding: 10px 14px 10px 18px; display: flex; align-items: center; gap: 12px; font-weight: 600; font-size: 14px; box-shadow: 0 14px 40px rgba(0,0,0,0.25); max-width: calc(100% - 32px); }
.toast button { background: var(--lime); color: var(--ink); border: none; border-radius: 999px; height: 32px; padding: 0 14px; font-weight: 700; cursor: pointer; font-family: inherit; }
.toast[hidden], .consent[hidden] { display: none; }
.consent { position: fixed; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 60; max-width: 536px; margin: 0 auto; background: var(--surface); border-radius: 22px; padding: 14px 16px; box-shadow: 0 14px 40px rgba(40,24,10,0.2); display: flex; flex-direction: column; gap: 10px; font-size: 14px; }

/* Tablet: two columns where it helps */
@media (min-width: 640px) {
  .app { max-width: 760px; }
  .scroll { padding-left: 24px; padding-right: 24px; }
  .topnav { margin-left: -24px; margin-right: -24px; padding-left: 24px; padding-right: 24px; }
}

/* Desktop: top nav gets text links, bottom nav hides */
@media (min-width: 1024px) {
  .app { max-width: 1200px; }
  .scroll { padding: 18px 32px 48px; }
  .topnav { margin: -18px -32px 8px; padding-left: 32px; padding-right: 32px; border-radius: 0 0 28px 28px; }
  .tn-links { display: flex; gap: 4px; margin-right: auto; margin-left: 24px; }
  .tn-links a { height: 38px; padding: 0 14px; border-radius: 999px; display: inline-flex; align-items: center; font-family: var(--font-cond); font-weight: 700; font-size: 16px; color: var(--muted); text-decoration: none; }
  .tn-links a:hover { background: var(--surface-2); color: var(--ink); }
  .tn-links a.on { background: var(--ink); color: var(--surface); }
  .nav { display: none; }
  .scroll > :not(.topnav) { max-width: 720px; width: 100%; margin-left: auto; margin-right: auto; box-sizing: border-box; }
  .area-bare .scroll > * { max-width: 420px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- Season picker ---------- */
.chips-scroll { display: flex; gap: 8px; overflow-x: auto; margin: 0 -16px; padding: 2px 16px 8px; scrollbar-width: none; }
.chips-scroll::-webkit-scrollbar { display: none; }
.chip-link { text-decoration: none; height: 36px; padding: 0 14px; flex-shrink: 0; }
.chip-link.pill-white { color: var(--ink); }
.chip-link.pill-black { color: var(--surface); }
.chip-link .dot-live { margin-left: 2px; }
.archive-note { display: flex; align-items: center; gap: 8px; margin-top: -6px; font-size: 13px; font-weight: 600; color: #5A2A0E; background: var(--tint-orange); border-radius: 999px; padding: 6px 12px; align-self: flex-start; }

/* ---------- Ladder ---------- */
.podium { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; align-items: end; }
.podium-col { display: flex; flex-direction: column; align-items: center; gap: 4px; text-decoration: none; color: var(--ink); min-width: 0; }
.podium-col .name { max-width: 100%; }
.podium-num { font-size: 24px; line-height: 1; }
.podium-step { width: 100%; border-radius: 18px 18px 6px 6px; display: flex; justify-content: center; padding-top: 8px; font-family: var(--font-display); font-size: 22px; color: var(--surface); margin-top: 4px; }
.podium-1 .podium-step { height: 64px; background: var(--accent); }
.podium-2 .podium-step { height: 44px; background: var(--ink); }
.podium-3 .podium-step { height: 32px; background: var(--muted); }
.ladder { padding: 8px 12px; }
.lad-row { display: grid; grid-template-columns: 28px minmax(0, 1fr) 48px 52px 42px; align-items: center; gap: 6px; padding: 9px 4px; border-bottom: 1px solid rgba(0,0,0,0.06); text-decoration: none; color: var(--ink); }
.lad-row:last-child { border-bottom: none; }
.lad-head { font-size: 12px; font-weight: 700; color: var(--muted); padding-top: 4px; }
.lad-head span:nth-child(n+3), .lad-val, .lad-wl, .lad-pct { text-align: right; }
.lad-rank { font-size: 18px; color: var(--muted); text-align: center; }
.lad-player { display: flex; align-items: center; gap: 8px; min-width: 0; }
.lad-val { font-family: var(--font-display); font-size: 18px; }
.lad-wl, .lad-pct { font-size: 13px; color: var(--muted); font-weight: 600; }
.lad-me { background: #FFF4EE; border-radius: 14px; }
a.lad-row:hover { background: var(--surface-hover); }

/* ---------- Matches ---------- */
.md-strip { display: flex; gap: 8px; overflow-x: auto; margin: 0 -16px; padding: 2px 16px 10px; scrollbar-width: none; }
.md-strip::-webkit-scrollbar { display: none; }
.md-chip { flex: 0 0 62px; height: 76px; border-radius: 20px; background: var(--surface); box-shadow: 0 10px 30px rgba(40,24,10,0.08); display: flex; flex-direction: column; align-items: center; justify-content: center; text-decoration: none; color: var(--ink); }
.md-chip.on { background: var(--ink); color: var(--surface); }
.md-chip.on .tiny { color: #D6D2CC; }
.md-l { font-weight: 700; }
.md-n { font-size: 24px; line-height: 1.05; }
.recap { display: flex; flex-direction: column; gap: 12px; }
.gp-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.gp-chip { display: inline-flex; align-items: center; gap: 6px; background: var(--surface-2); border-radius: 999px; padding: 4px 8px 4px 4px; font-family: var(--font-cond); font-weight: 700; font-size: 15px; text-decoration: none; color: var(--ink); }
.gp-chip.me { background: var(--tint-orange); }
.game { display: flex; flex-direction: column; gap: 12px; }
.game-me { box-shadow: 0 0 0 2px var(--accent), 0 10px 30px rgba(40,24,10,0.08); }
.game-grid { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 8px; }
.game-grid a.name { text-decoration: none; color: var(--ink); }
.game-grid a.name-quiet { color: var(--muted); }
.game-foot { border-top: 1px solid rgba(0,0,0,0.07); padding-top: 10px; }
.recap-link { display: flex; flex-direction: column; gap: 12px; text-decoration: none; color: var(--ink); }

/* ---------- Players ---------- */
.search-wrap { position: relative; color: var(--muted); }
.search-wrap svg { position: absolute; left: 18px; top: 50%; transform: translateY(-50%); }
.search { border: none; border-radius: 999px; padding-left: 46px; box-shadow: 0 10px 30px rgba(40,24,10,0.08); }
.seg-link { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.profile-hero { display: flex; flex-direction: column; gap: 14px; padding: 18px; background: radial-gradient(120% 90% at 100% 0%, rgba(198,245,31,0.18), transparent 55%), radial-gradient(90% 80% at 0% 100%, rgba(255,85,0,0.28), transparent 60%), var(--ink); }
.profile-name { font-family: var(--font-display); font-size: 30px; line-height: 1.05; color: var(--surface); }
.pairs { gap: 10px; align-items: start; }
.pair-h { display: block; font-weight: 700; letter-spacing: 0.05em; color: var(--accent-ink); padding-top: 10px; }
.rm-row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; }
.rm-score { font-size: 22px; }
.fv { background: var(--surface-3); color: var(--muted); }

/* ---------- Settings forms ---------- */
.settings-form { gap: 16px; }
.list-col { flex-direction: column; align-items: stretch; gap: 10px; }
.input-num { width: 84px; height: 44px; text-align: center; padding: 0 8px; flex-shrink: 0; }
.input-sel { width: auto; max-width: 52%; height: 44px; flex-shrink: 0; }
.input-time { width: 140px; height: 44px; flex-shrink: 0; }
.input-text { height: 44px; }
.input-file { height: auto; padding: 12px; }
.days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.day { position: relative; }
.day input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.day span { display: flex; align-items: center; justify-content: center; height: 36px; border-radius: 999px; background: var(--surface-3); font-family: var(--font-cond); font-weight: 700; font-size: 14px; }
.day input:checked + span { background: var(--ink); color: var(--surface); }
.day input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 2px; }
.ga-status { display: flex; align-items: center; gap: 12px; }
.ok-text { color: var(--success); font-weight: 700; }
.warn-text { color: var(--accent-ink); font-weight: 700; }
.strong-ink { color: var(--ink); font-weight: 700; }
.wrap { flex-wrap: wrap; }
.form-tight { gap: 12px; padding: 16px; }

/* ---------- Seasons ---------- */
.season-card { display: flex; flex-direction: column; gap: 12px; padding: 18px; }
.season-name { font-family: var(--font-display); font-size: 32px; line-height: 1; }
.md-bar { display: flex; gap: 3px; }
.md-bar span { flex: 1; height: 10px; border-radius: 3px; background: var(--line); }
.md-bar span.on { background: var(--accent); }
.md-num { width: 32px; height: 32px; border-radius: 10px; background: var(--surface-2); display: inline-flex; align-items: center; justify-content: center; font-size: 15px; flex-shrink: 0; }
.court-row { gap: 8px; }
.court-row .input { flex: 1; min-width: 0; }
.court-row .toggle { cursor: pointer; }
.logo-preview { background: var(--surface-2); border-radius: 18px; padding: 16px; display: flex; justify-content: center; }
.logo-preview img { max-height: 88px; max-width: 100%; }

/* ---------- User form ---------- */
.role-pick { display: flex; flex-direction: column; gap: 8px; }
.role-opt { display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; border-radius: 16px; border: 1.5px solid var(--line); cursor: pointer; }
.role-opt input { width: 20px; height: 20px; accent-color: var(--ink); margin-top: 2px; flex-shrink: 0; }
.role-opt:has(input:checked) { border-color: var(--ink); background: var(--surface-hover); }
.admin-creds { display: flex; flex-direction: column; gap: 14px; padding: 14px; border-radius: 18px; background: var(--surface-2); }
[hidden] { display: none !important; }

/* ---------- Gallery ---------- */
.potw { position: relative; display: block; border-radius: 28px; overflow: hidden; height: 300px; box-shadow: 0 14px 40px rgba(40,24,10,0.16); }
.potw img { width: 100%; height: 100%; object-fit: cover; display: block; }
.potw-fade { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(17,17,17,0) 45%, rgba(17,17,17,0.85) 100%); }
.potw-text { position: absolute; left: 18px; right: 18px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; color: var(--surface); }
.potw-text .pill { align-self: flex-start; }
.potw-title { font-size: 26px; line-height: 1.1; }
.potw-by { gap: 6px; font-size: 13px; color: var(--line-soft); }
.masonry { columns: 2; column-gap: 12px; }
.ph { display: block; break-inside: avoid; margin-bottom: 12px; border-radius: 22px; overflow: hidden; background: var(--surface); box-shadow: 0 10px 30px rgba(40,24,10,0.08); text-decoration: none; color: var(--ink); }
.ph img { width: 100%; height: auto; display: block; background: var(--surface-3); }
.ph-cap { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; }
.ph-title { font-size: 13px; font-weight: 600; line-height: 1.3; }
.ph-by { gap: 6px; }
.photo-full { position: relative; margin: 0; border-radius: 24px; overflow: hidden; background: var(--ink); }
.photo-full img { width: 100%; height: auto; display: block; max-height: 78vh; object-fit: contain; }
.ph-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 40px; height: 40px; border-radius: 50%; background: rgba(255,255,255,0.9); color: var(--ink); display: inline-flex; align-items: center; justify-content: center; }
.ph-prev { left: 10px; } .ph-next { right: 10px; }
.photo-meta { display: flex; flex-direction: column; gap: 12px; }
.report-row { gap: 8px; }
.report-row .input-sel { max-width: none; flex: 1; }
.dropzone { border: 2px dashed #D6D2CC; background: var(--surface); border-radius: 28px; padding: 28px 16px; display: flex; flex-direction: column; align-items: center; gap: 10px; cursor: pointer; text-align: center; position: relative; }
.dropzone input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dropzone:focus-within { border-color: var(--ink); }
.previews { display: flex; flex-direction: column; gap: 12px; }
.pv { display: flex; flex-direction: column; gap: 10px; padding: 12px; }
.pv-img { background: var(--ink); border-radius: 16px; overflow: hidden; display: flex; justify-content: center; }
.pv-canvas { max-width: 100%; max-height: 340px; height: auto; display: block; }
.pv-tools { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pv-aspects { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.pv-aspects .pill { border: none; cursor: pointer; }
.shrink-note { display: flex; flex-direction: column; gap: 6px; }
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; max-height: 220px; overflow: auto; padding: 2px; }
.tag-opt { position: relative; }
.tag-opt input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.tag-opt span { display: inline-flex; padding: 6px 12px; border-radius: 999px; background: var(--surface-2); font-family: var(--font-cond); font-weight: 700; font-size: 15px; }
.tag-opt input:checked + span { background: var(--ink); color: var(--surface); }
.tag-opt input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 2px; }
.album-row { gap: 10px; }
.album-cover { width: 52px; height: 52px; border-radius: 14px; object-fit: cover; flex-shrink: 0; display: block; }
.album-empty { background: var(--surface-3); color: var(--muted-faint); display: inline-flex; align-items: center; justify-content: center; }
.seg-flat { box-shadow: none; background: var(--surface-3); }
.seg-radio { position: relative; display: inline-flex; align-items: center; justify-content: center; }
.seg-radio input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg-radio:has(input:checked) { background: #000000; color: var(--surface); }
details.card summary { cursor: pointer; }
.moments { display: flex; gap: 10px; overflow-x: auto; margin: 0 -16px; padding: 2px 16px 8px; scrollbar-width: none; }
.moments::-webkit-scrollbar { display: none; }
.moment { flex: 0 0 132px; height: 168px; border-radius: 20px; overflow: hidden; position: relative; display: block; }
.moment img { width: 100%; height: 100%; object-fit: cover; display: block; }
.moment .av { position: absolute; left: 8px; bottom: 8px; }
@media (min-width: 640px) { .masonry { columns: 3; } }

/* ---------- Matchday (organiser) ---------- */
.pill-btn { border: none; height: 34px; padding: 0 12px; cursor: pointer; font-family: inherit; }
.pick-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.pick { position: relative; display: flex; align-items: center; gap: 8px; padding: 8px 10px 8px 8px; border-radius: 16px; background: var(--surface); border: 2px solid var(--line); cursor: pointer; min-width: 0; }
.pick input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.pick .name { font-size: 15px; }
.pick.on { background: var(--ink); border-color: var(--ink); color: var(--surface); }
.pick.on .tiny { color: var(--muted-dark); }
.pick-mark { margin-left: auto; width: 20px; height: 20px; border-radius: 50%; border: 2px solid #CFC9C2; flex-shrink: 0; box-sizing: border-box; display: inline-flex; align-items: center; justify-content: center; color: transparent; }
.pick.on .pick-mark { background: #7ED957; border-color: #7ED957; color: var(--ink); }
.pick:has(input:focus-visible) { outline: 3px solid var(--accent); outline-offset: 2px; }
.sticky-bar { position: sticky; bottom: calc(86px + env(safe-area-inset-bottom)); z-index: 15; background: var(--surface); border-radius: 24px; padding: 10px 10px 10px 18px; display: flex; align-items: center; gap: 12px; box-shadow: 0 14px 40px rgba(40,24,10,0.16); }
.avail { display: flex; flex-direction: column; gap: 14px; }
.bubbles { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px 4px; }
.bubbles form { display: contents; }
.bubble { display: flex; flex-direction: column; align-items: center; gap: 4px; background: none; border: none; padding: 0; cursor: pointer; min-width: 0; font-family: inherit; color: var(--ink); }
.bubble-av { position: relative; display: inline-flex; }
.bubble-av .av { border-width: 3px; }
.bubble-n { position: absolute; right: -3px; bottom: -2px; min-width: 20px; height: 20px; padding: 0 4px; box-sizing: border-box; border-radius: 999px; background: var(--ink); color: var(--surface); font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; border: 2px solid var(--surface); }
.name-xs { font-size: 13px; max-width: 100%; }
.divider { height: 1px; background: rgba(0,0,0,0.06); }
.late-chip { display: flex; align-items: center; gap: 8px; padding: 4px 12px 4px 4px; border-radius: 999px; background: var(--surface); border: 2px dashed #CFC9C2; cursor: pointer; font-family: inherit; color: var(--ink); }
.late-chip .av { filter: grayscale(1); opacity: 0.7; }
.court-mini { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 16px; background: var(--surface-2); }
.court-mini .tiny { margin-left: auto; text-align: right; }
.done-bar { display: flex; align-items: center; gap: 10px; padding: 8px 12px 8px 8px; border-radius: 16px; background: var(--ink); }
.btn-orange { background: var(--accent); color: var(--ink); box-shadow: 0 10px 24px rgba(255,85,0,0.35); }
.btn-orange:hover { color: var(--ink); }
.drawcard { display: flex; flex-direction: column; gap: 14px; padding: 18px; border-radius: 28px; color: var(--surface); background: radial-gradient(120% 90% at 100% 0%, rgba(198,245,31,0.18), transparent 55%), radial-gradient(90% 80% at 0% 100%, rgba(255,85,0,0.3), transparent 60%), var(--ink); }
.draw-teams { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 8px; align-items: center; }
.team-panel { display: flex; flex-direction: column; gap: 10px; padding: 12px; border-radius: 20px; background: rgba(255,255,255,0.07); min-width: 0; }
.team-l { color: var(--lime); font-weight: 700; letter-spacing: 0.05em; }
.vs { width: 44px; height: 44px; border-radius: 50%; background: var(--accent); color: var(--ink); display: inline-flex; align-items: center; justify-content: center; font-size: 16px; }
.chance { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; }
.chance .bar { background: rgba(255,255,255,0.15); }
.step-input { width: 110px; border: none; background: transparent; text-align: center; color: var(--ink); -moz-appearance: textfield; }
.step-input::-webkit-outer-spin-button, .step-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.step-plus { background: var(--ink); color: var(--surface); }
.oncourt { display: flex; flex-direction: column; gap: 10px; }
@media (min-width: 640px) { .pick-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* ---------- Me ---------- */
.rsvp-card { display: flex; flex-direction: column; gap: 12px; }
.oncourt-me { display: flex; flex-direction: column; gap: 10px; }
.steps-list { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; font-size: 15px; }
.field label.role-opt, .role-opt .name, .role-opt .tiny { text-transform: none; letter-spacing: normal; }
.role-opt .name { color: var(--ink); font-size: 15px; }
.role-opt .tiny { font-weight: 500; color: var(--muted); font-size: 12px; }

/* ---------- Phone type scale ----------
   The Rally sizes were drawn on 390 px artboards viewed zoomed out; on a phone in the hand they read large.
   Under 640 px everything steps down ~10-15%. Inputs stay at 16 px so iOS doesn't zoom when typing. */
@media (max-width: 639px) {
  body { font-size: 14px; }
  .muted { font-size: 12.5px; }
  .tiny { font-size: 11.5px; }
  .title { font-size: 28px; }
  .h2 { font-size: 20px; }
  .h3 { font-size: 16.5px; }
  .name { font-size: 15px; }
  .name-sm, .pick .name, .role-opt .name { font-size: 14px; }
  .btn { font-size: 15.5px; height: 44px; padding: 0 18px; }
  .btn-lg { font-size: 16.5px; height: 50px; }
  .btn-sm { font-size: 14px; height: 36px; padding: 0 14px; }
  .input { font-size: 16px; height: 48px; }
  .input-num, .input-sel, .input-time, .input-text { height: 42px; }
  .pin input { font-size: 24px; height: 54px; }
  .pill { font-size: 13px; }
  .pill-sm { font-size: 11.5px; }
  .chip { font-size: 14px; }
  .chip-link { height: 34px; padding: 0 12px; }
  .seg-btn { font-size: 15px; height: 36px; }
  .tn-chip { font-size: 13px; height: 30px; }
  .topnav { height: calc(56px + env(safe-area-inset-top)); }
  .topnav-logo img { height: 40px; }
  .field label { font-size: 11.5px; }
  .tile-num { font-size: 24px; }
  .tile { padding: 10px 12px; }
  .hero-title { font-size: 42px; }
  .hero-num { font-size: 22px; }
  .hero-sub { font-size: 14px; }
  .profile-name { font-size: 25px !important; }
  .league-name { font-size: 24px; }
  .season-name { font-size: 27px; }
  .potw-title { font-size: 22px; }
  .role-n { font-size: 24px; }
  .score { width: 46px; height: 46px; font-size: 22px; }
  .step-val { font-size: 54px; }
  .podium-num { font-size: 21px; }
  .podium-step { font-size: 19px; }
  .md-chip { flex-basis: 56px; height: 68px; }
  .md-n { font-size: 21px; }
  .lad-val, .lad-rank { font-size: 16px; }
  .lad-row { grid-template-columns: 26px minmax(0, 1fr) 44px 48px 40px; }
  .gp-chip { font-size: 14px; }
  .rm-score { font-size: 19px; }
  .card { padding: 14px; }
  .card-tight { padding: 4px 14px; }
  .form-card { padding: 18px 16px; gap: 16px; }
  .list-row { padding: 10px 0; }
  .nav a { height: 44px; min-width: 44px; }
  .nav a.on { font-size: 14px; }
  .nav svg { width: 21px; height: 21px; }
  .flash { font-size: 13px; }
  .scroll { gap: 14px; }
  .num[style*="font-size: 2"], .num[style*="font-size: 18px"] { font-size: 18px !important; }
  .title[style*="font-size"] { font-size: 26px !important; }
}

/* Player photo picker (1.6) */
.photo-picker { display: flex; flex-direction: column; gap: 12px; }
.pp-current { display: flex; align-items: center; gap: 14px; }
.pp-preview .av { width: 96px; height: 96px; }
.pp-file { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.pp-choose { align-self: flex-start; gap: 6px; cursor: pointer; }
.pp-crop { display: flex; flex-direction: column; gap: 10px; }
.pp-crop[hidden] { display: none; }
.pp-stage { position: relative; width: 100%; max-width: 320px; aspect-ratio: 1; margin: 0 auto; border-radius: 16px; overflow: hidden; background: var(--ink); touch-action: none; }
.pp-stage canvas { width: 100%; height: 100%; display: block; cursor: grab; }
.pp-ring { position: absolute; inset: 0; border-radius: 50%; box-shadow: 0 0 0 999px rgba(0,0,0,.45); border: 2px solid rgba(255,255,255,.85); pointer-events: none; }
.pp-zoom { flex: 1; accent-color: var(--ink); }

/* ---------- Ladder header: title + season dropdown + scope tabs (1.9) ---------- */
.lad-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.lad-sub { display: block; margin-top: 2px; }
.season-dd { margin: 0; display: inline-flex; gap: 8px; }
.season-dd-sel {
  appearance: none; -webkit-appearance: none; border: none; cursor: pointer;
  background: var(--ink); color: var(--surface); font-family: inherit; font-weight: 700; font-size: 14px;
  height: 40px; padding: 0 38px 0 16px; border-radius: 999px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='2.4'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center;
}
.season-dd-sel:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.lad-scope { display: flex; gap: 6px; background: var(--surface-3); border-radius: 999px; padding: 4px; margin: 10px 0 2px; }
.lad-scope .seg-item { flex: 1; text-align: center; text-decoration: none; color: var(--muted); font-weight: 700; font-size: 14px; height: 38px; display: inline-flex; align-items: center; justify-content: center; border-radius: 999px; }
.lad-scope .seg-item.on { background: var(--ink); color: var(--surface); }
.lad-scope .seg-item:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ---------- Install banner (1.9) ---------- */
.install-banner {
  position: fixed; left: 12px; right: 12px; bottom: calc(96px + env(safe-area-inset-bottom)); z-index: 55;
  max-width: 536px; margin: 0 auto; background: var(--ink); color: var(--surface);
  border-radius: 20px; padding: 12px 12px 12px 14px; display: flex; align-items: center; gap: 12px;
  box-shadow: 0 14px 40px rgba(0,0,0,0.28);
}
.install-banner[hidden] { display: none; }
.ib-icon { width: 36px; height: 36px; border-radius: 10px; background: var(--lime); color: var(--ink); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.ib-text { display: flex; flex-direction: column; gap: 1px; flex: 1; min-width: 0; }
.ib-title { font-weight: 700; font-size: 14px; }
.ib-sub { font-size: 12px; color: var(--muted-dark); }
.install-banner .btn { background: var(--lime); color: var(--ink); flex-shrink: 0; }
.install-banner .btn:hover { color: var(--ink); }
.ib-close { background: none; border: none; color: var(--muted-dark); cursor: pointer; padding: 6px; display: inline-flex; flex-shrink: 0; }

/* ---------- Ambient background illustration (1.9) ----------
   Critical positioning is inline on the SVG (bg_art.php) so stale/missing CSS can never
   push content; these rules only refine it. z-index:-1 keeps it behind content on its own. */
main.scroll { position: relative; z-index: 0; }
@media (max-height: 560px) { .bg-art { display: none; } }

/* ---------- Top-nav profile menu (1.12) ---------- */
.pm { position: relative; }
.pm-trigger { list-style: none; cursor: pointer; display: inline-flex; border-radius: 50%; }
.pm-trigger::-webkit-details-marker { display: none; }
.pm-trigger::marker { content: ""; }
.pm-trigger:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.pm[open] .pm-trigger .av { box-shadow: 0 0 0 3px var(--accent); }
.pm-pop { position: absolute; right: 0; top: calc(100% + 8px); min-width: 212px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 16px 44px rgba(40,24,10,0.18); padding: 8px; z-index: 60; display: flex; flex-direction: column; gap: 2px; }
.pm-head { display: flex; align-items: center; gap: 10px; padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.pm-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; text-decoration: none; color: var(--ink); font-weight: 600; font-size: 14px; background: none; border: none; width: 100%; cursor: pointer; font-family: inherit; text-align: left; }
.pm-item:hover { background: var(--surface-3); color: var(--ink); }
.pm-item svg { flex-shrink: 0; color: var(--muted); }
.pm-form { margin: 4px 0 0; padding-top: 4px; border-top: 1px solid var(--line); }
.pm-danger { color: var(--danger); }
.pm-danger svg { color: var(--danger); }
.pm-danger:hover { background: #FFE6E2; color: var(--danger); }

/* ---------- First-login onboarding (1.14) ---------- */
.ob { position: fixed; inset: 0; z-index: 200; background: rgba(17,17,17,0.55); display: flex; align-items: flex-end; justify-content: center; padding: 16px; }
@media (min-width: 640px) { .ob { align-items: center; } }
.ob-card { background: var(--surface); border-radius: 26px; width: 100%; max-width: 420px; padding: 20px; position: relative; box-shadow: 0 24px 60px rgba(0,0,0,0.3); }
.ob-skip { position: absolute; top: 14px; right: 14px; background: none; border: none; color: var(--muted); font-family: inherit; font-weight: 600; font-size: 14px; cursor: pointer; padding: 6px; }
.ob-slide { display: none; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 20px 6px 4px; }
.ob-slide.on { display: flex; }
.ob-art { width: 150px; height: 140px; background: var(--surface-3); border-radius: 24px; display: flex; align-items: center; justify-content: center; margin-bottom: 8px; }
.ob-art svg { width: 120px; height: 112px; }
.ob-title { font-size: 23px; line-height: 1.15; margin: 4px 0 0; }
.ob-body { color: var(--muted); font-size: 15px; margin: 0; line-height: 1.5; }
.ob-dots { display: flex; gap: 6px; justify-content: center; margin: 16px 0; }
.ob-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--line); transition: width 0.2s; }
.ob-dot.on { background: var(--accent); width: 20px; border-radius: 4px; }
.ob-actions { display: flex; gap: 10px; margin: 0; }
