/* ============================================================
   IWR 2028 — Design System
   Dark, refined, race-day focused.
   ============================================================ */

:root {
  /* Surfaces */
  --bg-0: #070d18;
  --bg-1: #0b1424;
  --surface: #101b30;
  --surface-2: #16233c;
  --surface-glass: rgba(16, 27, 48, 0.82);
  --input-bg: rgba(7, 13, 24, 0.55);

  /* Lines */
  --border: rgba(148, 163, 184, 0.13);
  --border-strong: rgba(148, 163, 184, 0.26);

  /* Accent + status */
  --accent: #22d3ee;
  --accent-strong: #67e8f9;
  --accent-dim: rgba(34, 211, 238, 0.12);
  --red: #f87171;
  --red-dim: rgba(248, 113, 113, 0.12);
  --amber: #fbbf24;
  --amber-dim: rgba(251, 191, 36, 0.12);
  --green: #34d399;
  --green-dim: rgba(52, 211, 153, 0.12);
  --purple: #a78bfa;
  --purple-dim: rgba(167, 139, 250, 0.12);
  --gold: #fbbf24;
  --silver: #cbd5e1;
  --bronze: #d97706;

  /* Text */
  --text: #e8eef7;
  --text-2: #9fb0c7;
  --text-3: #64748b;

  /* Type */
  --font-display: 'Space Grotesk', 'Inter', sans-serif;
  --font-body: 'Inter', system-ui, sans-serif;
  --font-mono: ui-monospace, 'Cascadia Mono', 'SF Mono', Menlo, Consolas, monospace;

  /* Layout */
  --header-h: 54px;
  --banner-h: 104px;
  --nav-h: 62px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 18px;
  --shadow: 0 10px 40px rgba(2, 6, 14, 0.45);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 15px;
  -webkit-tap-highlight-color: transparent;
  background: var(--bg-0);
  scrollbar-color: rgba(148,163,184,.25) transparent;
}

body {
  font-family: var(--font-body);
  background: var(--bg-0);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}
/* Background gradient lives on its own fixed, composited layer:
   painted once, never repainted while scrolling (mobile perf). */
body::before {
  content: ''; position: fixed; inset: 0; z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(1100px 500px at 85% -10%, rgba(34, 211, 238, 0.07), transparent 60%),
    radial-gradient(900px 600px at -10% 30%, rgba(56, 116, 255, 0.05), transparent 55%),
    linear-gradient(160deg, var(--bg-0), var(--bg-1));
}

input, select, button, textarea { font-family: inherit; font-size: inherit; }
button { cursor: pointer; border: none; background: none; color: inherit; }
a { color: var(--accent); text-decoration: none; }
img { max-width: 100%; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

::selection { background: rgba(34, 211, 238, 0.25); }

#app { min-height: 100vh; display: flex; flex-direction: column; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ===== HEADER ===== */
#header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: var(--header-h);
  background: #0c1626;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px;
}
#header .logo {
  font-family: var(--font-display);
  font-size: 1.05rem; font-weight: 700; letter-spacing: .04em;
  color: var(--text); cursor: default; user-select: none;
}
#header .logo span { color: var(--accent); }
#header .logo-img { height: 34px; max-width: 130px; object-fit: contain; display: block; }
#header .clock {
  font-family: var(--font-mono); font-size: .82rem;
  color: var(--text-2); font-variant-numeric: tabular-nums;
  background: rgba(148,163,184,0.07);
  border: 1px solid var(--border);
  padding: 4px 10px; border-radius: 999px;
}
#save-status {
  display: none; align-items: center; gap: 6px;
  font-size: .68rem; font-weight: 600; letter-spacing: .04em;
  padding: 4px 10px; border-radius: 999px; border: 1px solid transparent;
  white-space: nowrap;
}
#save-status::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
#save-status.pending { display: inline-flex; color: var(--amber); background: var(--amber-dim); border-color: rgba(251,191,36,.3); }
#save-status.error { display: inline-flex; color: var(--red); background: var(--red-dim); border-color: rgba(248,113,113,.4); }
#save-status.error::before { animation: livePulse 1.6s ease-in-out infinite; }
#save-status.ok { display: inline-flex; color: var(--green); background: var(--green-dim); border-color: rgba(52,211,153,.3); }

/* ===== LIVE BANNER ===== */
#live-banner {
  position: fixed; top: var(--header-h); left: 0; right: 0; z-index: 99;
  display: grid; grid-template-columns: 1fr 1fr 1fr;
  height: var(--banner-h);
  background: #0c1626;
  border-bottom: 1px solid var(--border);
}
.banner-col { padding: 12px 14px; border-right: 1px solid var(--border); min-width: 0; overflow: hidden; }
.banner-col:last-child { border-right: none; }
.banner-label {
  font-family: var(--font-display);
  font-size: .62rem; letter-spacing: .16em; font-weight: 600;
  margin-bottom: 7px; display: flex; align-items: center; gap: 6px;
  text-transform: uppercase;
}
.banner-label.live-lbl { color: var(--red); }
.banner-label.next-lbl { color: var(--accent); }
.banner-label.ready-lbl { color: var(--amber); }
.banner-content { font-size: .88rem; line-height: 1.35; }
.banner-content .bboats { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.banner-content .bboats.mass { white-space: normal; overflow: visible; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.banner-content .bvs { font-size: .72rem; color: var(--text-3); }
.banner-content .bmeta { color: var(--text-3); font-size: .72rem; margin-top: 2px; }
.live-dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: var(--red); flex-shrink: 0;
  animation: livePulse 1.6s ease-in-out infinite;
}
@keyframes livePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(248, 113, 113, 0.45); }
  50% { box-shadow: 0 0 0 6px rgba(248, 113, 113, 0); }
}

/* ===== BOTTOM NAV ===== */
#nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 100;
  height: calc(var(--nav-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  background: #0c1626;
  border-top: 1px solid var(--border);
  display: flex; align-items: stretch;
}
.nav-btn {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 4px;
  color: var(--text-3); transition: color .18s;
  font-size: .62rem; font-weight: 500; letter-spacing: .02em;
}
.nav-btn .nav-icon { width: 21px; height: 21px; }
.nav-btn.active { color: var(--accent); }
.nav-btn:active { transform: scale(.94); }

/* ===== PAGES ===== */
.page {
  display: none;
  padding: calc(var(--header-h) + var(--banner-h) + 16px) 14px calc(var(--nav-h) + var(--safe-b) + 20px);
  min-height: 100vh;
  animation: pageIn .22s ease;
}
.page.active { display: block; }
@keyframes pageIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }

.page-title {
  font-family: var(--font-display); font-size: 1.35rem; font-weight: 700;
  letter-spacing: .01em; margin-bottom: 16px;
}

/* ===== CARDS ===== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
}
.card-header {
  font-size: .68rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: .14em; margin-bottom: 12px; color: var(--text-2);
  display: flex; align-items: center; gap: 8px;
}
.card-header svg { width: 14px; height: 14px; color: var(--accent); }

.section-heading {
  font-size: .68rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: .16em; color: var(--text-2);
  display: flex; align-items: center; gap: 8px;
  margin: 24px 0 12px; padding: 0 2px;
}
.section-heading:first-child { margin-top: 0; }
.section-heading svg { width: 14px; height: 14px; color: var(--accent); flex-shrink: 0; }
.section-heading::after {
  content: ''; flex: 1; height: 1px;
  background: linear-gradient(90deg, var(--border), transparent);
}

/* ===== COUNTDOWN ===== */
.countdown-card { position: relative; overflow: hidden; }
.countdown-card::before {
  content: ''; position: absolute; inset: 0 0 auto 0; height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: .6;
}
.countdown-time {
  font-family: var(--font-display); font-size: 2.4rem; font-weight: 700;
  font-variant-numeric: tabular-nums; letter-spacing: .02em;
  color: var(--accent); line-height: 1.1; margin-bottom: 6px;
}
.countdown-match { font-size: .95rem; font-weight: 600; }
.countdown-meta { font-size: .8rem; color: var(--text-2); margin-top: 2px; }

/* ===== STATUS PILLS ===== */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 999px;
  font-size: .62rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .07em;
  border: 1px solid transparent;
}
.pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.live { background: var(--red-dim); color: var(--red); border-color: rgba(248,113,113,.3); }
.pill.live::before { animation: livePulse 1.6s ease-in-out infinite; }
.pill.ready { background: var(--amber-dim); color: var(--amber); border-color: rgba(251,191,36,.3); }
.pill.scheduled { background: var(--accent-dim); color: var(--accent); border-color: rgba(34,211,238,.28); }
.pill.finished { background: var(--green-dim); color: var(--green); border-color: rgba(52,211,153,.3); }
.pill.info { background: var(--purple-dim); color: var(--purple); border-color: rgba(167,139,250,.3); }

/* ===== TODAY'S RACES — horizontal strip ===== */
.today-scroll {
  display: flex; gap: 12px; overflow-x: auto; padding: 2px 2px 10px;
  scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.today-scroll::-webkit-scrollbar { display: none; }
.race-card-today {
  flex: 0 0 205px; min-width: 205px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 14px;
  scroll-snap-align: start;
  position: relative; overflow: hidden;
  cursor: pointer;
  transition: transform .18s ease, border-color .18s ease;
}
.race-card-today:active { transform: scale(.97); }
.race-card-today:hover { border-color: var(--border-strong); transform: translateY(-2px); }
.race-card-today::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: var(--card-accent, var(--accent));
}
.rct-status-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.rct-time { font-family: var(--font-mono); font-size: .8rem; color: var(--text-2); font-variant-numeric: tabular-nums; }
.rct-comp {
  font-size: .64rem; font-weight: 700; text-transform: uppercase; letter-spacing: .1em;
  color: var(--card-accent, var(--accent)); margin-bottom: 5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.rct-teams {
  font-size: .9rem; font-weight: 600; line-height: 1.35; margin-bottom: 8px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  line-clamp: 2; overflow: hidden;
}
.rct-meta { font-size: .68rem; color: var(--text-3); display: flex; gap: 10px; flex-wrap: wrap; }

.thats-it-card {
  display: flex; flex-direction: column; align-items: center;
  gap: 5px; padding: 30px 16px; text-align: center;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg);
}
.thats-it-icon { font-size: 1.8rem; line-height: 1; }
.thats-it-text { font-family: var(--font-display); font-size: 1.1rem; font-weight: 700; }
.thats-it-sub { font-size: .78rem; color: var(--text-3); }

/* ===== UPCOMING — accordion list ===== */
.upcoming-list { display: flex; flex-direction: column; gap: 8px; }
.upcoming-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden; cursor: pointer;
  transition: border-color .18s;
}
.upcoming-item:hover { border-color: var(--border-strong); }
.upcoming-head { display: flex; align-items: center; gap: 12px; padding: 12px 14px; }
.upcoming-head::before {
  content: ''; width: 3px; align-self: stretch; border-radius: 2px;
  background: var(--item-accent, var(--accent)); flex-shrink: 0;
}
.upcoming-date-block { display: flex; flex-direction: column; align-items: center; min-width: 44px; }
.upcoming-hhmm {
  font-family: var(--font-mono); font-size: .9rem; font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--item-accent, var(--accent)); line-height: 1.2;
}
.upcoming-day { font-size: .58rem; color: var(--text-3); text-transform: uppercase; letter-spacing: .05em; margin-top: 2px; text-align: center; }
.upcoming-info { flex: 1; min-width: 0; }
.upcoming-comp {
  font-size: .6rem; font-weight: 700; text-transform: uppercase; letter-spacing: .1em;
  color: var(--item-accent, var(--accent));
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.upcoming-teams {
  font-size: .88rem; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px;
}
.upcoming-meta { font-size: .66rem; color: var(--text-3); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.upcoming-chevron { color: var(--text-3); flex-shrink: 0; width: 16px; height: 16px; transition: transform .22s ease; }
.upcoming-item.open .upcoming-chevron { transform: rotate(180deg); }
.upcoming-detail { display: none; padding: 0 14px 14px; border-top: 1px solid var(--border); }
.upcoming-item.open .upcoming-detail { display: block; animation: pageIn .18s ease; }
.upcoming-detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.udet-cell { background: rgba(148,163,184,.05); border-radius: var(--r-sm); padding: 8px 10px; }
.udet-label { font-size: .56rem; color: var(--text-3); text-transform: uppercase; letter-spacing: .08em; display: block; margin-bottom: 2px; }
.udet-value { font-size: .82rem; font-weight: 600; }

/* ===== SCHEDULE ===== */
.day-tabs { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.day-tab {
  padding: 7px 15px; border-radius: 999px; font-size: .78rem; font-weight: 600;
  background: var(--surface); border: 1px solid var(--border); color: var(--text-2);
  transition: all .15s;
}
.day-tab:hover { border-color: var(--border-strong); color: var(--text); }
.day-tab.active { background: var(--accent); border-color: var(--accent); color: #06202a; }

.sched-filter-wrap { margin-bottom: 16px; display: flex; flex-direction: column; gap: 10px; }
.sched-search-wrap { position: relative; display: flex; align-items: center; }
.sched-search-icon { position: absolute; left: 12px; width: 15px; height: 15px; color: var(--text-3); pointer-events: none; }
.sched-search {
  width: 100%; background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 10px 38px 10px 36px;
  color: var(--text); font-size: .85rem; outline: none;
  transition: border-color .18s, box-shadow .18s;
}
.sched-search::placeholder { color: var(--text-3); }
.sched-search:focus { border-color: rgba(34,211,238,.5); box-shadow: 0 0 0 3px rgba(34,211,238,.1); }
.sched-search-clear {
  position: absolute; right: 10px; font-size: .72rem;
  width: 22px; height: 22px; border-radius: 50%;
  background: rgba(148,163,184,.12);
  color: var(--text-2); display: none; align-items: center; justify-content: center;
}
.sched-search-clear.visible { display: flex; }
.sched-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.sched-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 13px; border-radius: 999px; font-size: .72rem; font-weight: 600;
  border: 1px solid var(--border);
  background: var(--surface); color: var(--text-2);
  transition: all .16s; white-space: nowrap;
}
.sched-chip:active { transform: scale(.94); }
.sched-chip.active { color: var(--accent); background: var(--accent-dim); border-color: rgba(34,211,238,.4); }
.sched-no-results { text-align: center; padding: 44px 20px; color: var(--text-3); font-size: .88rem; }

/* Match cards */
@keyframes liveBlink { 0%,100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.25); opacity: .7; } }
.sched-list { display: flex; flex-direction: column; gap: 10px; }
.match-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 14px 16px 15px;
  position: relative; overflow: hidden;
}
.match-card::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--mc-accent, var(--accent));
}
.mc-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.mc-comp-name { font-family: var(--font-display); font-weight: 700; font-size: .98rem; letter-spacing: .01em; }
.mc-round {
  font-size: .58rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
  color: var(--text-2); border: 1px solid var(--border-strong);
  border-radius: 999px; padding: 2px 8px; white-space: nowrap;
}
.mc-top .pill { margin-left: auto; }
.mc-meta {
  display: flex; align-items: center; gap: 7px; flex-wrap: wrap;
  font-size: .72rem; color: var(--text-3); margin: 5px 0 12px;
  font-variant-numeric: tabular-nums;
}
.mc-meta svg { width: 12px; height: 12px; flex-shrink: 0; }
.mc-time { font-family: var(--font-mono); font-weight: 700; font-size: .86rem; color: var(--text); }
.mc-teams { display: flex; flex-direction: column; gap: 6px; }
.mc-team {
  display: flex; align-items: center; gap: 10px;
  background: rgba(148,163,184,.04); border: 1px solid var(--border);
  border-radius: var(--r-sm); padding: 8px 12px; min-height: 40px;
  transition: opacity .2s;
}
.mc-team.winner { background: var(--green-dim); border-color: rgba(52,211,153,.35); }
.mc-team.dim { opacity: .55; }
.mc-lane {
  flex-shrink: 0; min-width: 32px; height: 22px; padding: 0 6px;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: .62rem; font-weight: 700; letter-spacing: .03em;
  color: var(--text-3); background: rgba(148,163,184,.09); border-radius: 6px;
}
.mc-lane.r1 { color: #06202a; background: var(--gold); }
.mc-lane.r2 { color: #06202a; background: var(--silver); }
.mc-lane.r3 { color: #fff; background: var(--bronze); }
.mc-name {
  flex: 1; min-width: 0; font-weight: 600; font-size: .88rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mc-win {
  display: inline-flex; align-items: center; gap: 4px; flex-shrink: 0;
  color: var(--green); font-size: .6rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .07em;
}
.mc-win svg { width: 12px; height: 12px; }
.mc-result {
  flex-shrink: 0; font-family: var(--font-mono); font-weight: 700;
  font-size: .84rem; color: var(--text-2); font-variant-numeric: tabular-nums;
}
.mc-team.winner .mc-result { color: var(--green); }
.mc-dnf { flex-shrink: 0; color: var(--red); font-size: .7rem; font-weight: 700; letter-spacing: .07em; }
.mc-comment {
  margin-top: 10px; padding: 8px 11px; border-radius: var(--r-sm);
  background: rgba(148,163,184,.05); border: 1px solid var(--border);
  font-size: .78rem; color: var(--text-2); white-space: pre-wrap;
}

/* Slim cards for breaks & info entries */
.slim-card {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 11px 16px;
  position: relative; overflow: hidden;
}
.slim-card::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--mc-accent, var(--amber));
}
.slim-card .sc-icon {
  width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); color: var(--mc-accent, var(--amber));
  background: rgba(148,163,184,.05);
}
.slim-card .sc-icon svg { width: 15px; height: 15px; }
.slim-card .sc-body { flex: 1; min-width: 0; }
.slim-card .sc-title { font-weight: 600; font-size: .88rem; }
.slim-card .sc-meta { font-size: .7rem; color: var(--text-3); margin-top: 1px; font-variant-numeric: tabular-nums; }
.slim-card .sc-comment { font-size: .76rem; color: var(--text-2); margin-top: 4px; white-space: pre-wrap; }
.slim-card .sc-time {
  flex-shrink: 0; font-family: var(--font-mono); font-weight: 700; font-size: .8rem;
  color: var(--mc-accent, var(--amber)); font-variant-numeric: tabular-nums; text-align: right;
}

/* ===== LEADERBOARD ===== */
.lb-wrap { overflow-x: auto; border-radius: var(--r-lg); }
.lb-table { width: 100%; border-collapse: separate; border-spacing: 0 6px; }
.lb-table th {
  font-size: .62rem; letter-spacing: .12em; font-weight: 600;
  color: var(--text-3); padding: 8px 12px; text-align: left; text-transform: uppercase;
}
.lb-table th:first-child { padding-left: 16px; }
.lb-table td {
  padding: 11px 12px; vertical-align: middle;
  background: var(--surface); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
}
.lb-table td:first-child { border-left: 1px solid var(--border); border-radius: var(--r-md) 0 0 var(--r-md); padding-left: 16px; }
.lb-table td:last-child { border-right: 1px solid var(--border); border-radius: 0 var(--r-md) var(--r-md) 0; }
.lb-row { animation: rowIn .35s ease both; }
@keyframes rowIn { from { opacity: 0; transform: translateX(-10px); } to { opacity: 1; transform: none; } }
.rank-cell {
  font-family: var(--font-display); font-weight: 700; font-size: 1rem;
  min-width: 40px; color: var(--text-2);
}
.rank-cell.r1 { color: var(--gold); }
.rank-cell.r2 { color: var(--silver); }
.rank-cell.r3 { color: var(--bronze); }
.team-cell { font-weight: 600; font-size: .9rem; }
.pts-cell { font-family: var(--font-display); font-weight: 700; color: var(--accent); font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.sub-pts { color: var(--text-2); font-variant-numeric: tabular-nums; }

.scoring-card { margin-top: 20px; }
.scoring-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 8px; }
.scoring-cell { background: rgba(148,163,184,.05); border: 1px solid var(--border); padding: 11px 13px; border-radius: var(--r-md); }
.scoring-cell .sc-label { font-size: .68rem; color: var(--text-2); margin-bottom: 4px; display: flex; align-items: center; gap: 6px; }
.scoring-cell .sc-label svg { width: 13px; height: 13px; }
.scoring-cell .sc-value { font-weight: 700; font-size: .92rem; }
.scoring-cell .sc-tag { font-size: .62rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; margin-bottom: 4px; }
.scoring-cell .sc-list { font-size: .82rem; color: var(--text); }

/* ===== INFO PAGE ===== */
/* The coloured 3px left stripe duplicated what the badge above already says
   in both text and colour, and it is the one pattern on this page that reads
   as generic template work. The badge keeps the priority encoding. */
.announcement-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 14px 16px; margin-bottom: 10px;
}
.announcement-badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: .58rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
  padding: 3px 9px; border-radius: 999px; margin-bottom: 8px;
}
.badge-high { background: var(--red-dim); color: var(--red); }
.badge-medium { background: var(--amber-dim); color: var(--amber); }
.badge-low { background: var(--accent-dim); color: var(--accent); }
.announcement-title { font-weight: 600; font-size: .95rem; margin-bottom: 4px; line-height: 1.35; }
.announcement-text { font-size: .82rem; color: var(--text-2); line-height: 1.55; white-space: pre-wrap; }
.announcement-date { font-size: .68rem; color: var(--text-3); margin-top: 8px; font-variant-numeric: tabular-nums; }

.contact-group { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; margin-bottom: 12px; }
.contact-group-header {
  padding: 9px 16px; display: flex; align-items: center; gap: 7px;
  font-size: .62rem; font-weight: 700; text-transform: uppercase; letter-spacing: .12em;
  border-bottom: 1px solid var(--border);
}
.contact-group-header.emergency { background: var(--red-dim); color: var(--red); }
.contact-group-header.regular { background: rgba(148,163,184,.05); color: var(--text-2); }
.contact-group-header svg { width: 13px; height: 13px; }
.contact-row { padding: 13px 16px; display: flex; align-items: center; gap: 13px; }
.contact-row + .contact-row { border-top: 1px solid var(--border); }
.contact-row.emergency { background: rgba(248,113,113,.04); }
.contact-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  background: rgba(148,163,184,.08); border: 1px solid var(--border); color: var(--text-2);
}
.contact-avatar svg { width: 18px; height: 18px; }
.contact-avatar.emergency { background: var(--red-dim); border-color: rgba(248,113,113,.4); color: var(--red); }
.contact-info { flex: 1; min-width: 0; }
.contact-name { font-weight: 600; font-size: .9rem; }
.contact-role { font-size: .74rem; color: var(--text-3); margin-bottom: 5px; }
.contact-phone-big {
  display: inline-block; font-size: .98rem; font-weight: 700; color: var(--red);
  font-variant-numeric: tabular-nums; margin-bottom: 6px;
}
.contact-phone { font-size: .8rem; color: var(--text-3); margin-bottom: 5px; font-variant-numeric: tabular-nums; }
.contact-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.contact-btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 11px; border-radius: var(--r-sm); font-size: .72rem; font-weight: 600;
  border: 1px solid var(--border); color: var(--text);
  transition: all .15s;
}
.contact-btn svg { width: 12px; height: 12px; }
.contact-btn.call { border-color: rgba(52,211,153,.4); color: var(--green); background: var(--green-dim); }
.contact-btn.msg { border-color: rgba(34,211,238,.4); color: var(--accent); background: var(--accent-dim); }

/* Maps */
.sitemap-wrap {
  position: relative; background: #050a12;
  border-radius: var(--r-lg); overflow: hidden; margin-bottom: 12px;
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center; min-height: 140px;
}
@media (min-width: 768px) { .sitemap-wrap { max-width: 520px; margin-left: auto; margin-right: auto; min-height: unset; } }
.sitemap-img { width: 100%; display: block; object-fit: cover; cursor: pointer; }
.sitemap-expand-btn {
  position: absolute; bottom: 10px; right: 10px;
  background: rgba(5,10,18,.85); border: 1px solid rgba(148,163,184,.3);
  border-radius: var(--r-sm); padding: 6px 12px; color: #fff; font-size: .72rem; font-weight: 600;
  display: flex; align-items: center; gap: 5px;
}
.sitemap-expand-btn svg { width: 12px; height: 12px; }

#map-fullscreen {
  display: none; position: fixed; inset: 0; z-index: 800;
  background: #000; overflow: hidden; touch-action: none; user-select: none;
}
#map-fullscreen.open { display: block; }
#map-fs-img-wrap { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
#map-fullscreen img {
  max-width: 100vw; max-height: 100vh; object-fit: contain;
  transform-origin: center center; will-change: transform; pointer-events: none;
}
#map-fs-close {
  position: absolute; top: 14px; right: 14px; z-index: 10;
  background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.22);
  border-radius: var(--r-sm); padding: 8px 14px; color: #fff; font-size: .78rem; font-weight: 700;
}
#map-fs-hint {
  position: absolute; bottom: 24px; left: 50%; transform: translateX(-50%);
  font-size: .68rem; color: rgba(255,255,255,.35); pointer-events: none; white-space: nowrap;
}

/* Shuttle */
.shuttle-day { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; margin-bottom: 10px; }
.shuttle-day-header {
  padding: 10px 16px; background: rgba(148,163,184,.05); border-bottom: 1px solid var(--border);
  display: flex; align-items: baseline; gap: 8px;
}
.shuttle-day-header .sd-name { font-family: var(--font-display); font-weight: 700; font-size: .92rem; }
.shuttle-day-header .sd-date { font-size: .72rem; color: var(--text-3); }
.shuttle-dir-header {
  padding: 7px 16px; display: flex; align-items: center; gap: 6px;
  font-size: .58rem; font-weight: 700; text-transform: uppercase; letter-spacing: .12em;
  border-bottom: 1px solid var(--border);
}
.shuttle-dir-header.morning { background: var(--accent-dim); color: var(--accent); }
.shuttle-dir-header.evening { background: var(--purple-dim); color: var(--purple); border-top: 1px solid var(--border); }
.shuttle-row { display: flex; align-items: center; gap: 13px; padding: 11px 16px; }
.shuttle-row + .shuttle-row { border-top: 1px solid var(--border); }
.shuttle-icon {
  width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border);
}
.shuttle-icon svg { width: 16px; height: 16px; }
.shuttle-icon.morning { background: var(--accent-dim); color: var(--accent); }
.shuttle-icon.evening { background: var(--purple-dim); color: var(--purple); }
.shuttle-time { font-family: var(--font-mono); font-size: 1.02rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.shuttle-time.morning { color: var(--accent); }
.shuttle-time.evening { color: var(--purple); }
.shuttle-sub { font-size: .68rem; color: var(--text-3); margin-top: 2px; }
.shuttle-note-hint { margin-top: 10px; font-size: .72rem; color: var(--text-3); display: flex; align-items: center; gap: 6px; }
.shuttle-note-hint svg { width: 13px; height: 13px; flex-shrink: 0; }

/* ===== ADMIN ===== */
.admin-topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.admin-section {
  margin-bottom: 12px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--r-lg);
  overflow: hidden;
}
.admin-section-header {
  padding: 13px 16px; font-size: .85rem; font-weight: 600;
  display: flex; justify-content: space-between; align-items: center;
  cursor: pointer; user-select: none;
}
.admin-section-header .chev { width: 15px; height: 15px; color: var(--text-3); transition: transform .2s; }
.admin-section.open .admin-section-header .chev { transform: rotate(180deg); }
.admin-section-body { display: none; padding: 4px 16px 14px; }
.admin-section.open .admin-section-body { display: block; }
.admin-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.admin-item:last-of-type { border-bottom: none; }
.admin-item .ai-main { flex: 1; min-width: 0; }
.admin-item .ai-title { font-weight: 600; font-size: .88rem; }
.admin-item .ai-sub { font-size: .72rem; color: var(--text-3); margin-top: 1px; }
.admin-item .ai-actions { display: flex; gap: 4px; flex-shrink: 0; }
/* Member rows with several actions (verify/captain/vice-captain/remove):
   actions always drop to their own line, centred, so they never fight the
   name/badges/status-chip for width on narrow screens. Tight gaps throughout
   keep the whole row compact instead of feeling spaced-out. */
.admin-item.member-row { flex-wrap: wrap; gap: 4px 10px; padding: 8px 0; }
/* The action row itself NEVER wraps — a wrapped Remove button on a second
   line breaks the compact look. Buttons shrink to fit instead: the icon keeps
   its size, only the label is ellipsised on very narrow screens. */
.admin-item.member-row .ai-actions {
  flex-basis: 100%; flex-wrap: nowrap; justify-content: center;
  margin-top: 2px; gap: 6px; min-width: 0;
}
.member-row .ai-actions .btn { flex: 0 1 auto; min-width: 0; padding: 5px 9px; gap: 5px; }
.member-row .ai-actions .btn svg { flex-shrink: 0; }
.member-row .ai-actions .btn-lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Toggle-style button in its "on" state (e.g. member is vice-captain). */
.btn.btn-on { background: var(--accent-dim); border-color: rgba(34,211,238,.5); color: var(--accent); }
.btn.btn-on:hover { border-color: var(--accent); }
.drag-handle {
  cursor: grab; color: var(--text-3); padding: 4px;
  touch-action: none; user-select: none; flex-shrink: 0;
}
.drag-handle svg { width: 15px; height: 15px; display: block; }
.drag-handle:active { cursor: grabbing; }
.admin-match-row {
  background: rgba(7,13,24,.45); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 11px; margin-bottom: 8px;
}
.match-ctrl-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.match-ctrl-row .input-time { width: 96px; flex-shrink: 0; }
.match-ctrl-row .select-status, .match-ctrl-row .select-round { flex: 1; min-width: 92px; }
.match-ctrl-row .input-lane { width: 58px; flex-shrink: 0; }
.match-ctrl-row .match-actions { display: flex; gap: 4px; flex-shrink: 0; margin-left: auto; }
.upload-zone {
  border: 2px dashed var(--border-strong); border-radius: var(--r-md);
  padding: 24px 16px; text-align: center; cursor: pointer; display: block;
  transition: border-color .15s, background .15s;
}
.upload-zone:hover { border-color: var(--accent); background: var(--accent-dim); }
.upload-zone input[type="file"] { display: none; }
.upload-zone .uz-icon { color: var(--text-2); margin-bottom: 8px; }
.upload-zone .uz-icon svg { width: 26px; height: 26px; }
.upload-zone .uz-title { font-weight: 600; font-size: .88rem; margin-bottom: 3px; }
.upload-zone .uz-sub { font-size: .72rem; color: var(--text-3); }
.img-preview {
  width: 100%; border-radius: var(--r-md); margin-top: 10px;
  object-fit: contain; max-height: 150px; display: block; background: #050a12;
  border: 1px solid var(--border);
}
.admin-divider {
  font-size: .6rem; font-weight: 700; text-transform: uppercase; letter-spacing: .12em;
  margin: 14px 0 10px; display: flex; align-items: center; gap: 8px;
}
.admin-divider::before, .admin-divider::after { content: ''; flex: 1; border-bottom: 1px solid var(--border); }
.device-row { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.device-row:last-child { border-bottom: none; }
.device-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.device-label { font-size: .82rem; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.device-me {
  font-size: .62rem; background: var(--accent-dim); color: var(--accent);
  border-radius: 4px; padding: 1px 6px; font-weight: 600;
}
.device-ago { font-size: .7rem; color: var(--text-3); white-space: nowrap; }

/* ===== MODAL ===== */
.modal-overlay {
  display: none; position: fixed; inset: 0; z-index: 1000;
  background: rgba(3, 7, 14, 0.72); backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  align-items: center; justify-content: center; padding: 20px;
}
.modal-overlay.active { display: flex; }
.modal {
  background: var(--surface-2); border: 1px solid var(--border-strong);
  border-radius: var(--r-lg); padding: 22px; width: 100%; max-width: 480px;
  box-shadow: var(--shadow);
  max-height: 85vh; overflow-y: auto;
  animation: modalIn .2s ease;
}
@keyframes modalIn { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.modal-head h3 { font-family: var(--font-display); font-size: 1.1rem; font-weight: 700; }
.modal-group { margin-bottom: 10px; }
/* Nested groups (a dropdown or phone field sitting inside a flex row that is
   itself a .modal-group) must not add a second gap — only the outer row's
   margin counts, so every field is separated by the same minimal spacing. */
.modal-group .modal-group { margin-bottom: 0; }
.modal-group label {
  display: block; margin-bottom: 6px; color: var(--text-2);
  font-size: .68rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
}
.modal-group .check-label {
  display: flex; align-items: center; gap: 8px; cursor: pointer;
  font-size: .85rem; text-transform: none; letter-spacing: 0; color: var(--text); font-weight: 500;
}
.modal-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; margin-top: 18px; }
.pw-wrap { position: relative; }
.pw-wrap .input { padding-right: 42px; }
.pw-toggle {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 40px; height: 40px; display: flex; align-items: center; justify-content: center;
  color: var(--text-2); border-radius: 8px;
}
.pw-toggle svg { width: 16px; height: 16px; }
.pw-toggle:hover { color: var(--text); }

/* ===== BUTTONS & INPUTS ===== */
/* min-height fixes the touch target once, here, rather than at every call
   site. Padding alone rendered .btn at 33px tall. */
.btn {
  padding: 8px 16px; border-radius: var(--r-sm); font-size: .8rem; font-weight: 600;
  transition: all .15s; display: inline-flex; align-items: center; gap: 6px;
  background: rgba(148,163,184,.08); border: 1px solid var(--border); color: var(--text);
  min-height: 44px; justify-content: center;
}
.btn:hover { border-color: var(--border-strong); }
.btn svg { width: 13px; height: 13px; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #06202a; }
.btn-primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
/* Dense secondary controls (Call/SMS chips, admin tables) stay compact on
   purpose: 36px clears WCAG 2.2 AA target size (24px) without blowing up
   the row rhythm. Primary actions keep the full 44px above. */
.btn-sm { padding: 5px 10px; font-size: .72rem; min-height: 36px; }
.btn-danger { background: var(--red-dim); border-color: rgba(248,113,113,.4); color: var(--red); }
.btn-danger:hover { border-color: var(--red); }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* Form fields rendered at 35-37px. The registration form is the one screen
   every participant has to get through on a phone, so its fields carry the
   same 44px floor as buttons. textarea keeps its own height. */
.input, .select, textarea.input {
  background: var(--input-bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm); padding: 9px 12px; color: var(--text);
  font-size: .85rem; width: 100%;
  transition: border-color .15s, box-shadow .15s;
}
.input:not(textarea), .select { min-height: 44px; }
.input:focus, .select:focus, textarea.input:focus {
  outline: none; border-color: rgba(34,211,238,.55);
  box-shadow: 0 0 0 3px rgba(34,211,238,.1);
}
.select { -webkit-appearance: none; -moz-appearance: none; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%2364748b' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center; padding-right: 30px;
}
.select option { background: var(--surface-2); color: var(--text); }
input[type="checkbox"] { accent-color: var(--accent); width: 15px; height: 15px; }

/* ===== COUNTRY / NATIONALITY PICKER ===== */
.cpick { position: relative; }
.cpick-toggle {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  cursor: pointer; text-align: left; font-size: .85rem; line-height: 1.3;
}
.cpick-toggle:hover { border-color: var(--border-strong); }
.cpick-cur { display: inline-flex; align-items: center; gap: 6px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cpick-ph { color: var(--text-3); }
.cpick-chev { color: var(--text-3); flex-shrink: 0; transition: transform .18s; }
.cpick-toggle[aria-expanded="true"] .cpick-chev { transform: rotate(180deg); }
.cpick-panel {
  position: absolute; z-index: 60; left: 0; right: 0; top: calc(100% + 6px);
  background: var(--surface-2); border: 1px solid var(--border-strong);
  border-radius: var(--r-md, 12px); box-shadow: 0 18px 40px rgba(0,0,0,.5);
  overflow: hidden; animation: cpick-in .14s ease;
}
@keyframes cpick-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.cpick-search-wrap { padding: 8px; border-bottom: 1px solid var(--border); }
.cpick-search { font-size: .85rem; }
.cpick-list { max-height: 240px; overflow-y: auto; padding: 5px; -webkit-overflow-scrolling: touch; }
.cpick-opt {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  padding: 8px 10px; border-radius: 8px; color: var(--text); font-size: .85rem; cursor: pointer;
}
.cpick-opt[hidden] { display: none; }
.cpick-opt:hover { background: var(--accent-dim); }
.cpick-opt.sel { background: var(--accent-dim); color: var(--accent); }
.cpick-flag { font-size: 1.15rem; line-height: 1; flex-shrink: 0; }
.cpick-name { display: flex; flex-direction: column; min-width: 0; }
.cpick-sub { font-size: .68rem; color: var(--text-3); }
.cpick-empty { padding: 14px; text-align: center; color: var(--text-3); font-size: .82rem; }
.cpick-dial { margin-left: auto; padding-left: 10px; color: var(--text-3); font-size: .8rem; font-variant-numeric: tabular-nums; flex-shrink: 0; }
.cpick-opt.sel .cpick-dial { color: var(--accent); }

/* ===== PHONE FIELD (dial picker + number) ===== */
.phone-field { display: flex; align-items: stretch; }
.phone-dial { position: relative; flex-shrink: 0; }
.phone-dial-toggle {
  height: 100%; gap: 5px; white-space: nowrap;
  border-top-right-radius: 0; border-bottom-right-radius: 0; border-right: none;
}
.phone-dial-toggle .cpick-cur { font-variant-numeric: tabular-nums; }
.phone-dial-panel { min-width: 300px; }
.phone-num {
  flex: 1; min-width: 0;
  border-top-left-radius: 0; border-bottom-left-radius: 0;
}
/* Keep the seam clean when either side is focused. */
.phone-dial-toggle:focus, .phone-num:focus { position: relative; z-index: 1; }

.mt-8 { margin-top: 8px; }
.text-muted { color: var(--text-3); }
.empty-note { color: var(--text-3); font-size: .82rem; padding: 8px 15px; }

/* ===== SKELETON LOADING ===== */
/* Load progress. Replaces the bare profile skeleton: a skeleton looks the
   same whether the app is working or dead, a moving number does not. */
.prof-progress {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 18px 18px 20px; margin-bottom: 12px;
}
.prof-progress-top {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; margin-bottom: 12px;
}
.prof-progress-label { font-size: .88rem; color: var(--text); font-weight: 600; }
.prof-progress-pct {
  font-family: var(--font-mono); font-size: 1.05rem; font-weight: 700;
  color: var(--accent); font-variant-numeric: tabular-nums;
}
.prof-progress-track {
  height: 6px; border-radius: 999px; overflow: hidden;
  background: rgba(148, 163, 184, .12);
}
.prof-progress-fill {
  height: 100%; border-radius: 999px; width: 0;
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent-strong) 100%);
  transition: width .28s ease-out;
}
/* The bar is information, not decoration, so it stays — only the easing goes. */
@media (prefers-reduced-motion: reduce) {
  .prof-progress-fill { transition: none; }
}

.skeleton { display: flex; flex-direction: column; gap: 12px; }
.skel-block {
  border-radius: var(--r-lg);
  background: linear-gradient(100deg, var(--surface) 40%, var(--surface-2) 50%, var(--surface) 60%);
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
}
@keyframes shimmer { from { background-position: 130% 0; } to { background-position: -30% 0; } }

/* ===== TOUR ===== */
#tut-overlay { display: none; position: fixed; inset: 0; z-index: 9000; pointer-events: none; }
#tut-overlay.active { display: block; }
#tut-welcome.show, #tut-done.show, #tut-card { pointer-events: auto; }
#tut-spotlight {
  position: fixed; border-radius: 14px;
  border: 2px solid rgba(34,211,238,.8);
  box-shadow: 0 0 0 9999px rgba(4, 8, 16, .86), 0 0 32px rgba(34,211,238,.35);
  pointer-events: none; z-index: 9001; opacity: 0;
  transition: opacity .3s ease,
    left .5s cubic-bezier(.34,1.4,.64,1), top .5s cubic-bezier(.34,1.4,.64,1),
    width .5s cubic-bezier(.34,1.4,.64,1), height .5s cubic-bezier(.34,1.4,.64,1);
}
#tut-spotlight.on { opacity: 1; }
#tut-card {
  position: fixed; width: 300px;
  background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: var(--r-lg);
  padding: 18px 20px; box-shadow: var(--shadow);
  z-index: 9002; display: none;
}
#tut-card::after {
  content: ''; position: absolute; width: 12px; height: 12px;
  background: var(--surface-2); border: 1px solid var(--border-strong); transform: rotate(45deg);
}
#tut-card.arr-top::after { top: -7px; left: 26px; border-bottom: none; border-right: none; }
#tut-card.arr-bottom::after { bottom: -7px; left: 26px; border-top: none; border-left: none; }
#tut-card.arr-none::after { display: none; }
.tut-step-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.tut-step-lbl { font-family: var(--font-mono); font-size: .6rem; color: var(--accent); letter-spacing: .12em; }
.tut-dots { display: flex; gap: 4px; align-items: center; }
.tut-dot { width: 5px; height: 5px; border-radius: 50%; background: rgba(148,163,184,.25); transition: all .3s; }
.tut-dot.on { background: var(--accent); width: 14px; border-radius: 3px; }
.tut-title { font-family: var(--font-display); font-size: 1.02rem; font-weight: 700; margin-bottom: 6px; }
.tut-desc { font-size: .8rem; color: var(--text-2); line-height: 1.6; margin-bottom: 16px; }
.tut-actions { display: flex; align-items: center; justify-content: space-between; }
.tut-nav { display: flex; gap: 6px; }
/* The way out of a blocking dialog must not be the least visible thing on
   screen. --text-3 at .7rem measured 10.5px / 3.55:1 against the card, below
   the 4.5:1 WCAG AA floor. --text-2 gives 7.1:1. */
.tut-skip {
  font-size: .82rem; color: var(--text-2); padding: 6px 10px; border-radius: 8px;
  min-height: 36px; display: inline-flex; align-items: center;
}
.tut-skip:hover { color: var(--text); }
.tut-prev {
  font-size: .75rem; color: var(--text-2); padding: 8px 13px; border-radius: var(--r-sm);
  border: 1px solid var(--border); background: rgba(148,163,184,.06);
}
.tut-next {
  font-size: .8rem; font-weight: 700; color: #06202a; padding: 8px 16px; border-radius: var(--r-sm);
  background: var(--accent);
}
.tut-next:hover { background: var(--accent-strong); }
#tut-welcome, #tut-done {
  position: fixed; inset: 0; display: none; align-items: center; justify-content: center;
  padding: 24px; z-index: 9005;
  background: rgba(4, 8, 16, .88); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
#tut-welcome.show, #tut-done.show { display: flex; }
.tut-big-card {
  background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: 24px;
  padding: 34px 28px 28px; max-width: 360px; width: 100%; text-align: center;
  box-shadow: var(--shadow);
  animation: modalIn .35s cubic-bezier(.34,1.3,.64,1) both;
}
.tut-big-badge {
  display: inline-block; font-family: var(--font-mono); font-size: .62rem;
  letter-spacing: .18em; text-transform: uppercase; color: var(--accent);
  background: var(--accent-dim); border: 1px solid rgba(34,211,238,.3);
  padding: 4px 12px; border-radius: 999px; margin-bottom: 14px;
}
.tut-big-title { font-family: var(--font-display); font-size: 1.7rem; font-weight: 700; margin-bottom: 10px; line-height: 1.15; }
.tut-big-sub { font-size: .84rem; color: var(--text-2); line-height: 1.65; margin-bottom: 24px; }
.tut-big-btn {
  display: block; width: 100%; padding: 13px; border-radius: var(--r-md);
  background: var(--accent); color: #06202a;
  font-weight: 700; font-size: .92rem; font-family: var(--font-display);
  transition: all .2s; letter-spacing: .02em; margin-bottom: 10px;
}
.tut-big-btn:hover { background: var(--accent-strong); transform: translateY(-1px); }
/* Same reasoning as .tut-skip, plus a real 44px touch target: this was a
   302x25 hit area on the one control that dismisses a full-screen modal. */
.tut-skip-link {
  display: flex; align-items: center; justify-content: center;
  font-size: .88rem; color: var(--text-2); padding: 10px; width: 100%;
  min-height: 44px; border-radius: var(--r-sm); text-decoration: underline;
  text-underline-offset: 3px; text-decoration-color: rgba(159,176,199,.4);
}
.tut-skip-link:hover { color: var(--text); text-decoration-color: currentColor; }
#tut-help-btn {
  position: fixed; right: 16px; bottom: calc(var(--nav-h) + var(--safe-b) + 14px); z-index: 500;
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--surface-2); border: 1px solid var(--border-strong);
  color: var(--accent); font-size: .92rem; font-weight: 700; font-family: var(--font-display);
  display: flex; align-items: center; justify-content: center;
  transition: all .2s; box-shadow: var(--shadow);
}
#tut-help-btn:hover { border-color: var(--accent); transform: scale(1.08); }

/* ===== SECRET PAGE ===== */
#secret-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(3, 7, 14, .88);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  display: none; align-items: center; justify-content: center; padding: 20px;
}
#secret-overlay.open { display: flex; }
#secret-modal {
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: 24px; padding: 30px 24px;
  width: 100%; max-width: 380px; position: relative; overflow: hidden;
  box-shadow: var(--shadow); text-align: center;
}
#secret-modal::before {
  content: ''; position: absolute; top: -1px; left: 12%; right: 12%; height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), var(--purple), transparent);
}
.secret-close-btn {
  position: absolute; top: 14px; right: 16px; width: 30px; height: 30px;
  border-radius: 50%; background: rgba(148,163,184,.08); border: 1px solid var(--border);
  color: var(--text-3); font-size: .8rem;
  display: flex; align-items: center; justify-content: center; transition: all .2s;
}
.secret-close-btn:hover { background: var(--red-dim); color: var(--red); }
.sp-lock { font-size: 2.6rem; margin-bottom: 10px; }
.sp-title {
  font-family: var(--font-display); font-size: 1.9rem; letter-spacing: .12em;
  background: linear-gradient(135deg, var(--accent), var(--purple));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
  margin-bottom: 10px;
}
.sp-desc { color: var(--text-2); font-size: .86rem; line-height: 1.6; }

/* ===== UPDATE BANNER ===== */
#update-banner {
  position: fixed; left: 12px; right: 12px; bottom: calc(var(--nav-h) + var(--safe-b) + 12px);
  z-index: 4000; margin: 0 auto; max-width: 420px;
  background: var(--surface-2); border: 1px solid rgba(34,211,238,.4);
  border-radius: var(--r-md); padding: 12px 14px;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  box-shadow: var(--shadow);
  font-size: .82rem; color: var(--text);
  animation: modalIn .25s ease;
}
#update-banner button {
  flex-shrink: 0; padding: 7px 14px; border-radius: var(--r-sm);
  background: var(--accent); color: #06202a; font-weight: 700; font-size: .78rem;
}
#update-banner button:hover { background: var(--accent-strong); }
@media (min-width: 700px) { #update-banner { bottom: 20px; left: auto; right: 20px; } }

/* ===== TOAST ===== */
#toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + var(--safe-b) + 20px);
  transform: translateX(-50%) translateY(12px);
  z-index: 5000; pointer-events: none;
  background: var(--surface-2); border: 1px solid var(--border-strong);
  border-radius: 999px; padding: 9px 18px;
  font-size: .8rem; font-weight: 600; color: var(--text);
  box-shadow: var(--shadow); opacity: 0;
  transition: opacity .2s ease, transform .2s ease;
  max-width: min(90vw, 420px); text-align: center;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.error { border-color: rgba(248,113,113,.5); color: var(--red); }
#toast.success { border-color: rgba(52,211,153,.5); color: var(--green); }

/* ===== DESKTOP ===== */
@media (min-width: 700px) {
  :root { --nav-h: 0px; --header-h: 58px; --banner-h: 112px; }
  #nav {
    position: fixed; top: 0; bottom: auto; left: 0; right: 0;
    height: var(--header-h); padding-bottom: 0;
    border-top: none; border-bottom: 1px solid var(--border);
    justify-content: center; gap: 6px; padding-left: 230px;
  }
  #header {
    width: 218px; border-bottom: none; border-right: 1px solid var(--border);
    z-index: 101; background: transparent;
    backdrop-filter: none; -webkit-backdrop-filter: none;
  }
  #header .clock { display: none; }
  .nav-btn { flex: 0; padding: 0 18px; flex-direction: row; gap: 8px; font-size: .8rem; }
  .nav-btn .nav-icon { width: 17px; height: 17px; }
  .page { max-width: 1100px; margin: 0 auto; padding-left: 30px; padding-right: 30px; }
  #tut-help-btn { bottom: 20px; }
}

/* ===== PROFILE TAB ===== */
.btn-block { display: flex; width: 100%; justify-content: center; align-items: center; gap: 8px; padding: 11px 14px; margin-top: 4px; }
.prof-intro { font-size: .84rem; color: var(--text-2); line-height: 1.5; margin-bottom: 12px; }
.prof-auth-tabs { display: flex; gap: 6px; margin-bottom: 16px; background: var(--bg-0); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 4px; }
/* Sign in / Create account are the first controls anyone touches. --text-3
   on the inactive tab was 3.55:1, so the choice you are NOT on was barely
   legible; --text-2 reads at 7:1 and still sits behind the active tab. */
.prof-auth-tab {
  flex: 1; padding: 8px 4px; border-radius: calc(var(--r-sm) - 3px);
  font-size: .82rem; font-weight: 600; color: var(--text-2); transition: all .15s;
  min-height: 44px;
}
.prof-auth-tab.active { background: var(--surface-2); color: var(--text); box-shadow: 0 1px 4px rgba(0,0,0,.35); }
.prof-link { display: block; margin: 10px auto 0; font-size: .78rem; color: var(--accent); text-decoration: underline; }
.prof-divider { display: flex; align-items: center; gap: 12px; margin: 14px 0; color: var(--text-3); font-size: .72rem; }
.prof-divider::before, .prof-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.btn-google { background: #fff; color: #1f1f1f; border-color: #fff; font-weight: 600; }
.btn-google:hover { background: #f1f3f4; }

.prof-team-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.prof-team-name { font-family: var(--font-display); font-size: 1.15rem; font-weight: 700; }
.prof-team-sub { font-size: .78rem; color: var(--text-3); margin-top: 2px; }
.prof-code-box {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-top: 14px; padding: 10px 14px;
  background: var(--accent-dim); border: 1px dashed rgba(34,211,238,.45); border-radius: var(--r-sm);
}
.prof-code-lbl { font-size: .68rem; color: var(--text-3); text-transform: uppercase; letter-spacing: .08em; }
.prof-code-val { font-family: var(--font-display); font-size: 1.5rem; font-weight: 700; letter-spacing: .25em; color: var(--accent); }
.prof-code-input { text-transform: uppercase; letter-spacing: .3em; font-size: 1.1rem; text-align: center; font-family: var(--font-display); }

/* 6-box code entry (join a team): one character per box, auto-advances. */
.code-boxes { display: flex; gap: 8px; justify-content: center; margin: 4px 0 2px; }
.code-box {
  width: 15%; max-width: 48px; aspect-ratio: 1 / 1.06;
  background: var(--input-bg); border: 1px solid var(--border-strong); border-radius: var(--r-sm);
  color: var(--text); font-family: var(--font-display); font-size: 1.3rem; font-weight: 700;
  text-align: center; text-transform: uppercase; padding: 0;
  transition: border-color .15s, box-shadow .15s;
}
.code-box:focus {
  outline: none; border-color: rgba(34,211,238,.6);
  box-shadow: 0 0 0 3px rgba(34,211,238,.15);
}

/* Progress stepper: label above the dot, date below, dots + connector lines
   turn green with each completed step. */
.prof-steps { display: flex; align-items: flex-start; overflow-x: auto; padding-bottom: 2px; }
.prof-step { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 52px; flex: 0 0 auto; }
.prof-step-lbl {
  font-size: .6rem; font-weight: 600; color: var(--text-3); text-align: center;
  height: 14px; line-height: 14px; white-space: nowrap; letter-spacing: .02em;
}
.prof-step-dot {
  width: 26px; height: 26px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: .72rem; font-weight: 700; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-3);
  transition: background .25s, border-color .25s;
}
.prof-step-date { font-size: .58rem; color: var(--text-3); height: 12px; line-height: 12px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.prof-step.done .prof-step-lbl { color: var(--text-2); }
.prof-step.done .prof-step-dot { background: var(--green); border-color: var(--green); color: #06202a; }
.prof-step.done .prof-step-date { color: var(--green); }
.prof-step.next .prof-step-dot { border-color: var(--accent); color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }
.prof-step.next .prof-step-lbl { color: var(--accent); }
.prof-step-line {
  flex: 1; height: 2px; border-radius: 2px; background: var(--border);
  margin-top: 30px; min-width: 8px; transition: background .25s;
}
.prof-step-line.done { background: var(--green); }

.prof-avatar {
  width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent-dim); border: 1px solid rgba(34,211,238,.35);
  color: var(--accent); font-family: var(--font-display); font-weight: 700; font-size: .85rem;
  letter-spacing: .04em;
}

.prof-notice { display: flex; gap: 10px; align-items: flex-start; font-size: .82rem; color: var(--text-2); line-height: 1.5; }
.prof-notice svg { flex-shrink: 0; margin-top: 2px; color: var(--amber); }
.prof-confirm-card { border-color: rgba(34,211,238,.4); }
.prof-checkedin { display: flex; gap: 12px; align-items: center; font-size: .86rem; color: var(--text-2); border-color: rgba(52,211,153,.45); }
.prof-checkedin svg { color: var(--green); flex-shrink: 0; }

.prof-qr-wrap { display: flex; justify-content: center; }
#prof-qr { background: #fff; padding: 14px; border-radius: 10px; width: min(240px, 70vw); }
#prof-qr svg { display: block; width: 100%; height: auto; }

.prof-cap-tag {
  font-size: .58rem; color: var(--accent); border: 1px solid rgba(34,211,238,.35);
  border-radius: 4px; padding: 1px 5px; vertical-align: middle; text-transform: uppercase; letter-spacing: .06em;
}
.prof-pending-badge { margin-left: auto; background: rgba(251,191,36,.15); color: var(--amber); border-radius: 12px; padding: 1px 9px; font-size: .68rem; font-weight: 600; }

.status-chip {
  flex-shrink: 0; font-size: .64rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  border-radius: 999px; padding: 3px 9px; border: 1px solid;
}
.st-joined { color: var(--text-3); border-color: var(--border-strong); background: var(--surface-2); }
.st-verified { color: var(--accent); border-color: rgba(34,211,238,.4); background: var(--accent-dim); }
.st-registered { color: #a78bfa; border-color: rgba(167,139,250,.4); background: rgba(167,139,250,.12); }
.st-confirmed { color: var(--green); border-color: rgba(52,211,153,.4); background: rgba(52,211,153,.12); }
.st-checkedin { color: #06202a; border-color: var(--green); background: var(--green); }

/* ===== ADMIN: TEAM REGISTRATION ===== */
.reg-totals { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }
.reg-total {
  background: var(--bg-0); border: 1px solid var(--border); border-radius: var(--r-sm);
  padding: 8px 6px; text-align: center; font-size: .62rem; color: var(--text-3);
  text-transform: uppercase; letter-spacing: .06em;
}
.reg-total span { display: block; font-family: var(--font-display); font-size: 1.25rem; font-weight: 700; color: var(--text); }
.reg-total.hl span { color: var(--green); }
.reg-total.hl2 { border-color: rgba(52,211,153,.4); }
.reg-total.hl2 span { color: var(--green); }
.reg-team { margin-bottom: 8px; }
.reg-team-members { margin: 4px 0 10px 12px; padding-left: 10px; border-left: 2px solid var(--border); }

/* ===== CHECK-IN SCANNER ===== */
#scan-overlay {
  position: fixed; inset: 0; z-index: 6000; background: var(--bg-0);
  display: flex; flex-direction: column;
}
.scan-top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
#qr-reader { width: min(94vw, 480px); margin: 12px auto 0; border-radius: var(--r-lg); overflow: hidden; flex-shrink: 0; }
#qr-reader video { border-radius: var(--r-lg); }
.scan-result { padding: 14px 16px; overflow-y: auto; }
.scan-card {
  max-width: 480px; margin: 0 auto; background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--r-lg); padding: 16px; display: flex; flex-direction: column; gap: 10px;
}
.scan-name { font-family: var(--font-display); font-size: 1.25rem; font-weight: 700; }
.scan-team { font-size: .82rem; color: var(--text-2); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.scan-warn {
  background: rgba(251,191,36,.12); border: 1px solid rgba(251,191,36,.4); color: var(--amber);
  border-radius: var(--r-sm); padding: 9px 12px; font-size: .82rem; font-weight: 600; text-align: center;
}

/* ===== PRE-EVENT CONTENT LOCK ===== */
.locked-wrap { position: relative; min-height: 380px; }
.locked-blur { filter: blur(7px); opacity: .55; pointer-events: none; user-select: none; }
.locked-overlay {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center; padding: 24px;
}
.locked-icon {
  width: 56px; height: 56px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: var(--surface-2); border: 1px solid var(--border-strong); color: var(--accent);
  margin-bottom: 14px; box-shadow: var(--shadow);
}
.locked-title { font-family: var(--font-display); font-size: 1.2rem; font-weight: 700; margin-bottom: 8px; }
.locked-sub { font-size: .84rem; color: var(--text-2); line-height: 1.55; max-width: 420px; }

/* Pre-event hero. Before the race plan is public the dashboard used to be a
   single empty card in a large void; this gives the page an anchor and one
   true statement (how long until day one) without inventing content. */
.pre-hero {
  display: flex; align-items: center; gap: 22px; flex-wrap: wrap;
  background: linear-gradient(135deg, var(--surface) 0%, var(--surface-2) 100%);
  border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: 22px 24px; margin-bottom: 16px;
}
.pre-hero-count { display: flex; align-items: baseline; gap: 8px; }
.pre-count {
  font-family: var(--font-display); font-size: 3.2rem; font-weight: 700;
  line-height: 1; color: var(--accent); font-variant-numeric: tabular-nums;
}
.pre-count-unit,
.pre-count-word {
  font-family: var(--font-mono); font-size: .7rem; letter-spacing: .16em;
  text-transform: uppercase; color: var(--text-2);
}
.pre-count-word { font-size: 1.4rem; letter-spacing: .08em; color: var(--accent); font-family: var(--font-display); }
.pre-hero-meta { margin-left: auto; text-align: right; }
.pre-event-name { font-family: var(--font-display); font-size: .95rem; font-weight: 600; margin-bottom: 4px; }
.pre-dates { font-size: .8rem; color: var(--text-2); font-variant-numeric: tabular-nums; }
.locked-wrap-compact { min-height: 260px; }

@media (max-width: 560px) {
  .pre-hero { gap: 14px; padding: 18px; }
  .pre-count { font-size: 2.6rem; }
  .pre-hero-meta { margin-left: 0; text-align: left; width: 100%; }
}

.prof-step-hint { color: var(--amber); font-weight: 600; }

.reg-hide-row {
  display: flex; align-items: center; gap: 12px; justify-content: space-between;
  background: var(--bg-0); border: 1px solid var(--border); border-radius: var(--r-sm);
  padding: 10px 12px; margin-bottom: 14px;
}
.reg-hide-row .check-label { flex: 1; align-items: flex-start; }
.reg-hide-row input[type="checkbox"] { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--accent); }

/* ===== STYLED CONFIRM DIALOG ===== */
.confirm-head { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.confirm-head h3 { font-family: var(--font-display); font-size: 1.1rem; font-weight: 700; }
.confirm-icon {
  width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent-dim); color: var(--accent); border: 1px solid rgba(34,211,238,.3);
}
.confirm-icon.danger { background: rgba(248,113,113,.12); color: var(--red); border-color: rgba(248,113,113,.35); }
.confirm-msg { font-size: .88rem; color: var(--text-2); line-height: 1.55; margin: 4px 0 20px; }

/* ===== PROGRESS STEP ANIMATION ===== */
@keyframes stepPop {
  0%   { transform: scale(.6); background: var(--surface-2); border-color: var(--border); }
  55%  { transform: scale(1.28); }
  100% { transform: scale(1); }
}
@keyframes stepRing {
  0%   { box-shadow: 0 0 0 0 rgba(52,211,153,.55); }
  100% { box-shadow: 0 0 0 12px rgba(52,211,153,0); }
}
.prof-step.pop .prof-step-dot {
  animation: stepPop .55s cubic-bezier(.34,1.56,.64,1), stepRing .7s ease-out .1s;
}
.prof-step.pop .prof-step-date { animation: fadeInUp .5s ease .2s both; }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* connector fill sweep left→right when a step completes */
.prof-step-line.fill {
  background: linear-gradient(90deg, var(--green) 50%, var(--border) 50%);
  background-size: 200% 100%;
  background-position: 100% 0;
  animation: lineFill .5s ease forwards;
}
@keyframes lineFill { to { background-position: 0 0; } }

/* ===== CONSENT CHECKBOXES ===== */
.prof-consent-box {
  margin: 16px 0 6px; padding: 14px; border-radius: var(--r-sm);
  background: var(--bg-0); border: 1px solid var(--border);
}
.prof-consent-title {
  font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-3); margin-bottom: 10px;
}
.prof-consent {
  display: flex; gap: 10px; align-items: flex-start; padding: 7px 0; cursor: pointer;
  font-size: .84rem; line-height: 1.45; color: var(--text-2);
}
.prof-consent + .prof-consent { border-top: 1px solid var(--border); }
.prof-consent input[type="checkbox"] { width: 18px; height: 18px; margin-top: 1px; flex-shrink: 0; accent-color: var(--accent); }
.prof-consent a { color: var(--accent); text-decoration: underline; }

/* ===== PARTICIPANT DECLARATIONS ===== */
/* One card per declaration: the full text collapsed inline, its own checkbox
   underneath. Each point is acknowledged separately — there is no "accept all". */
.prof-decl {
  border: 1px solid var(--border); border-radius: var(--r-sm);
  background: var(--surface-2); margin-bottom: 8px; overflow: hidden;
  transition: border-color .15s ease, background .15s ease;
}
.prof-decl:last-of-type { margin-bottom: 0; }
.prof-decl:has(input[type="checkbox"]:checked) {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
}
.prof-decl-text > summary {
  display: flex; align-items: center; gap: 9px; padding: 10px 12px;
  cursor: pointer; list-style: none; user-select: none;
}
.prof-decl-text > summary::-webkit-details-marker { display: none; }
.prof-decl-text > summary:hover { background: var(--bg-0); }
.prof-decl-num {
  flex-shrink: 0; width: 20px; height: 20px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: .68rem; font-weight: 700; color: var(--accent);
  background: color-mix(in srgb, var(--accent) 16%, transparent);
}
.prof-decl-title {
  flex: 1; font-size: .8rem; font-weight: 600; line-height: 1.35; color: var(--text);
}
.prof-decl-more {
  flex-shrink: 0; font-size: .68rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: .05em; color: var(--accent);
}
.prof-decl-more::after { content: 'Read'; }
.prof-decl-text[open] .prof-decl-more::after { content: 'Hide'; }
.prof-decl-body {
  padding: 2px 12px 12px; border-top: 1px solid var(--border);
  max-height: 320px; overflow-y: auto;
}
.prof-decl-body p {
  font-size: .78rem; line-height: 1.6; color: var(--text-2); margin: 9px 0 0;
}
.prof-decl-body strong { color: var(--text); }
.prof-decl .prof-consent {
  padding: 10px 12px; border-top: 1px solid var(--border); background: var(--bg-0);
  font-weight: 500; color: var(--text);
}
.prof-decl-foot { margin-top: 10px; font-size: .75rem; text-align: center; }
.prof-decl-foot a { color: var(--accent); text-decoration: underline; }
.legal-list { margin: 8px 0 0; padding-left: 18px; }
.legal-list li {
  font-size: .78rem; line-height: 1.55; color: var(--text-2); margin-bottom: 5px;
}

.prof-decl-group {
  display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap;
  padding: 11px 12px 9px; border-bottom: 1px solid var(--border);
}
.prof-decl-group-title { font-size: .82rem; font-weight: 700; color: var(--text); }
.prof-decl-group-hint { font-size: .7rem; color: var(--text-3); }
.prof-decl .prof-decl-text + .prof-decl-text > summary { border-top: 1px solid var(--border); }
.prof-decl-hint {
  padding: 0 12px 10px 40px; margin-top: -6px;
  font-size: .72rem; color: var(--text-3); background: var(--bg-0);
}
.prof-decl-sep { color: var(--text-3); margin: 0 6px; }
.prof-guardian {
  margin: 0 0 14px; border: 1px solid var(--amber); border-radius: var(--r-sm);
  background: var(--surface-2); overflow: hidden;
}
.prof-guardian[hidden] { display: none; }
.prof-guardian .prof-notice-inline { margin: 0; border: 0; border-radius: 0; }
.prof-guardian .prof-consent {
  padding: 10px 12px; border-top: 1px solid var(--border); background: var(--bg-0);
  color: var(--text);
}
.prof-auth-legal {
  margin: -4px 0 14px; font-size: .74rem; color: var(--text-3); line-height: 1.5;
}
.prof-auth-legal a { color: var(--accent); text-decoration: underline; }

/* ===== LEGAL LINKS (Info tab) ===== */
.legal-links { padding: 4px 0; }
.legal-link {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  width: 100%; padding: 12px 14px; background: none; border: 0; text-align: left;
  font-size: .86rem; font-weight: 500; color: var(--text); text-decoration: none;
  cursor: pointer;
}
.legal-link + .legal-link { border-top: 1px solid var(--border); }
.legal-link:hover { background: var(--surface-2); }
.legal-link > span:first-child { display: flex; align-items: center; gap: 10px; }
.legal-link svg { color: var(--accent); flex-shrink: 0; }
.legal-link-ext { color: var(--text-3); font-size: .9rem; }

/* ===== LEGAL MODAL ===== */
.legal-nav { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.legal-nav-btn {
  font-size: .72rem; font-weight: 600; padding: 5px 10px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2);
}
.legal-nav-btn:hover { border-color: var(--accent); color: var(--accent); }
.legal-body { max-height: 55vh; overflow-y: auto; padding-right: 6px; }
.legal-meta { font-size: .74rem; color: var(--text-3); margin-bottom: 12px; }
.legal-section { margin-bottom: 22px; scroll-margin-top: 8px; }
.legal-section h4 {
  font-family: var(--font-display); font-size: 1rem; font-weight: 700; color: var(--text);
  margin-bottom: 8px; padding-bottom: 6px; border-bottom: 1px solid var(--border);
}
.legal-section p { font-size: .82rem; line-height: 1.6; color: var(--text-2); margin-bottom: 9px; }
.legal-section .legal-list li { font-size: .82rem; line-height: 1.6; }
.legal-section strong { color: var(--text); }

/* ===== ADMIN: T-SHIRT SUMMARY ===== */
/* One row that never wraps: every size cell shrinks equally to fit the width,
   so XXL/none can't drop onto a second line on narrow phones. */
.tshirt-grid { display: flex; gap: 5px; margin-bottom: 12px; }
.tshirt-cell {
  flex: 1 1 0; min-width: 0;
  background: var(--bg-0); border: 1px solid var(--border); border-radius: var(--r-sm);
  padding: 7px 2px; text-align: center; font-size: .6rem; color: var(--text-3);
  text-transform: uppercase; letter-spacing: .02em; font-weight: 600;
}
.tshirt-cell span { display: block; font-family: var(--font-display); font-size: 1.05rem; font-weight: 700; color: var(--accent); }
.tshirt-cell.muted span { color: var(--text-3); }

/* ===== ADMIN: PARTICIPANT DETAIL ===== */
.mdetail { max-height: 60vh; overflow-y: auto; }
.mdetail-row { display: flex; gap: 12px; padding: 8px 2px; border-bottom: 1px solid var(--border); font-size: .84rem; }
.mdetail-row:last-child { border-bottom: none; }
.mdetail-lbl { flex: 0 0 42%; color: var(--text-3); }
.mdetail-val { flex: 1; color: var(--text); word-break: break-word; }

/* ===== PROFILE: COLLAPSIBLE SECTIONS (accordion) ===== */
.prof-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  margin-bottom: 10px;
  overflow: hidden;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
  transition: border-color .2s;
}
.prof-section.open { border-color: var(--border-strong); }
.prof-section-head {
  width: 100%; display: flex; align-items: center; gap: 10px;
  padding: 14px 16px; text-align: left; cursor: pointer;
  font-size: .9rem; font-weight: 600; color: var(--text);
}
.prof-section-head:active { background: var(--surface-2); }
.prof-section-icon { display: flex; color: var(--text-3); flex-shrink: 0; }
.prof-section.open .prof-section-icon { color: var(--accent); }
.prof-section-title { flex: 1; min-width: 0; }
.prof-section-chev {
  display: flex; color: var(--text-3); flex-shrink: 0;
  transition: transform .28s ease;
}
.prof-section.open .prof-section-chev { transform: rotate(180deg); color: var(--accent); }

/* Collapse animation: max-height is generous enough for the tallest section
   (the registration form) so nothing is ever clipped. */
.prof-section-body {
  max-height: 0; overflow: hidden;
  transition: max-height .32s cubic-bezier(.4,0,.2,1);
}
.prof-section.open .prof-section-body { max-height: 2600px; }
.prof-section-inner { padding: 0 16px 16px; }

.prof-section-todo {
  flex-shrink: 0; font-size: .62rem; font-weight: 700; letter-spacing: .05em;
  text-transform: uppercase; border-radius: 999px; padding: 3px 9px;
  background: rgba(251,191,36,.15); color: var(--amber); border: 1px solid rgba(251,191,36,.4);
}

/* Notice blocks used INSIDE a section body (no own card chrome) */
.prof-notice-inline, .prof-checkedin-inline {
  display: flex; gap: 10px; align-items: flex-start;
  font-size: .84rem; color: var(--text-2); line-height: 1.5;
}
.prof-notice-inline svg { flex-shrink: 0; margin-top: 2px; color: var(--amber); }
.prof-checkedin-inline { align-items: center; }
.prof-checkedin-inline svg { color: var(--green); flex-shrink: 0; }

/* ===== ROLES · TEAM CHIPS ===== */
.role-badge {
  display: inline-block; font-size: .62rem; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; padding: 2px 7px; border-radius: 999px; vertical-align: middle;
  background: var(--amber-dim, rgba(251,191,36,.15)); color: var(--amber); border: 1px solid rgba(251,191,36,.4);
}
.tiny-chip {
  display: inline-block; font-size: .6rem; font-weight: 700; letter-spacing: .03em;
  text-transform: uppercase; padding: 1px 6px; border-radius: 5px; vertical-align: middle;
}
.tiny-chip.reg { background: var(--accent-dim); color: var(--accent); border: 1px solid rgba(34,211,238,.35); }
.tiny-chip.withdrawn { background: var(--red-dim); color: var(--red); border: 1px solid rgba(248,113,113,.4); }

/* ===== CURRENT-RACE CARD (admin) ===== */
#admin-liverace.admin-section { border-color: rgba(34,211,238,.35); }
.live-race-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.live-race-title { font-family: var(--font-display); font-weight: 700; font-size: 1rem; }
.live-race-meta { font-size: .76rem; color: var(--text-3); font-variant-numeric: tabular-nums; }

/* ===== RESULT CHANGE LOG (admin) ===== */
.result-log { display: flex; flex-direction: column; gap: 0; }
.log-row { padding: 8px 0; border-bottom: 1px solid var(--border); }
.log-row:last-child { border-bottom: none; }
.log-line { display: flex; gap: 8px; flex-wrap: wrap; align-items: baseline; }
.log-match { font-weight: 600; font-size: .82rem; }
.log-field { font-size: .72rem; color: var(--text-3); }
.log-change { font-size: .82rem; margin-top: 2px; font-variant-numeric: tabular-nums; }
.log-arrow { color: var(--text-3); margin: 0 2px; }
.log-change strong { color: var(--accent); }
.log-meta { font-size: .68rem; color: var(--text-3); margin-top: 2px; }

/* ===== "MY TEAM" HIGHLIGHTS (schedule + leaderboard) ===== */
.mc-team.me { background: var(--accent-dim); border-radius: 8px; }
.mc-you, .lb-you {
  display: inline-block; font-size: .58rem; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; padding: 1px 6px; border-radius: 999px; margin-left: 6px;
  background: var(--accent); color: #06202a; vertical-align: middle;
}
.lb-row.me td { background: var(--accent-dim); }
.lb-row.me .team-cell { font-weight: 700; }
