/* =============================================
   RETO GORDOTON — compact editorial dashboard
   ============================================= */

:root {
  color-scheme: dark;

  --bg:           oklch(0.14 0.012 60);
  --bg-2:         oklch(0.17 0.014 60);
  --surface:      oklch(0.20 0.012 60 / 0.62);
  --surface-2:    oklch(0.23 0.014 60 / 0.78);
  --surface-3:    oklch(0.98 0 0 / 0.045);
  --line:         oklch(0.98 0 0 / 0.10);
  --line-strong:  oklch(0.98 0 0 / 0.18);
  --text:         oklch(0.97 0.005 80);
  --text-soft:    oklch(0.97 0.005 80 / 0.70);
  --text-muted:   oklch(0.97 0.005 80 / 0.48);

  --lime:    oklch(0.88 0.20 125);
  --lime-2:  oklch(0.78 0.21 135);
  --coral:   oklch(0.72 0.21 25);
  --coral-2: oklch(0.65 0.24 12);
  --cyan:    oklch(0.80 0.14 215);
  --cyan-2:  oklch(0.72 0.15 245);
  --warn:    oklch(0.78 0.18 65);
  --violet:  oklch(0.74 0.18 300);

  --shadow:        0 30px 80px -20px oklch(0 0 0 / 0.55), 0 4px 20px -4px oklch(0 0 0 / 0.4);
  --shadow-soft:   0 14px 40px -10px oklch(0 0 0 / 0.4);
  --shadow-inset:  inset 0 1px 0 oklch(1 0 0 / 0.06), inset 0 0 0 1px oklch(1 0 0 / 0.025);

  --r-xl: 22px;
  --r-lg: 18px;
  --r-md: 14px;
  --r-sm: 10px;

  --display: "Geist", -apple-system, BlinkMacSystemFont, "SF Pro Display", system-ui, sans-serif;
  --body:    "Geist", -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif;
  --serif:   "Instrument Serif", Georgia, serif;
  --mono:    "Geist Mono", "SF Mono", ui-monospace, Menlo, monospace;

  --ease-out:    cubic-bezier(.22, 1, .36, 1);
  --ease-in-out: cubic-bezier(.65, 0, .35, 1);
  --ease-spring: cubic-bezier(.34, 1.56, .64, 1);
}

[data-theme="light"] {
  color-scheme: light;
  --bg:           oklch(0.985 0.005 70);
  --bg-2:         oklch(0.965 0.006 70);
  --surface:      oklch(1 0 0 / 0.72);
  --surface-2:    oklch(1 0 0 / 0.92);
  --surface-3:    oklch(0.12 0.01 70 / 0.045);
  --line:         oklch(0.12 0.01 70 / 0.10);
  --line-strong:  oklch(0.12 0.01 70 / 0.18);
  --text:         oklch(0.16 0.012 70);
  --text-soft:    oklch(0.16 0.012 70 / 0.7);
  --text-muted:   oklch(0.16 0.012 70 / 0.45);

  --lime:    oklch(0.66 0.20 130);
  --lime-2:  oklch(0.58 0.21 140);
  --coral:   oklch(0.62 0.22 25);
  --coral-2: oklch(0.55 0.24 12);
  --cyan:    oklch(0.58 0.16 230);
  --cyan-2:  oklch(0.50 0.18 250);
  --violet:  oklch(0.55 0.20 300);

  --shadow:      0 20px 60px -16px oklch(0.5 0.05 70 / 0.18), 0 4px 16px -4px oklch(0.5 0.05 70 / 0.1);
  --shadow-soft: 0 10px 30px -10px oklch(0.5 0.05 70 / 0.15);
  --shadow-inset: inset 0 1px 0 oklch(1 0 0 / 0.6), inset 0 0 0 1px oklch(0.12 0.01 70 / 0.04);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: var(--body);
  background: radial-gradient(120% 90% at 50% 0%, var(--bg-2), var(--bg) 60%);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "ss01", "cv05";
  overflow-x: hidden;
}

button { font: inherit; color: inherit; cursor: pointer; background: none; border: none; }
a { color: inherit; }
button:focus-visible, a:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--lime);
  outline-offset: 2px;
  border-radius: 6px;
}

em.serif { font-family: var(--serif); font-style: italic; font-weight: 400; }

.empty {
  padding: 18px; text-align: center;
  color: var(--text-muted); font-size: .84rem;
  border: 1px dashed var(--line); border-radius: var(--r-md);
}

/* ── AMBIENT AURORA + GRAIN ─────────────────── */
.aurora {
  position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden;
}
.aurora-blob {
  position: absolute; border-radius: 50%;
  filter: blur(90px);
  animation: drift 26s var(--ease-in-out) infinite alternate;
}
.a1 { width: 46rem; height: 46rem; left: -14rem; top: -10rem; background: var(--lime); opacity: 0.16; }
.a2 { width: 40rem; height: 40rem; right: -12rem; top: 6rem; background: var(--coral); opacity: 0.18; animation-delay: -8s; }
.a3 { width: 50rem; height: 50rem; left: 30%; top: 40rem; background: var(--cyan); opacity: 0.12; animation-delay: -16s; }
[data-theme="light"] .a1 { opacity: 0.28; }
[data-theme="light"] .a2 { opacity: 0.26; }
[data-theme="light"] .a3 { opacity: 0.20; }

@keyframes drift {
  0%   { transform: translate3d(0,0,0) scale(1); }
  100% { transform: translate3d(4rem,3rem,0) scale(1.12); }
}

.grain {
  position: absolute; inset: 0; width: 100%; height: 100%;
  opacity: 0.16; mix-blend-mode: overlay;
}
[data-theme="light"] .grain { opacity: 0.05; mix-blend-mode: multiply; }

/* ── LAYOUT SHELL ───────────────────────────── */
.shell {
  position: relative; z-index: 1;
  width: min(1380px, calc(100% - 32px));
  margin: 0 auto;
  padding: 14px 0 40px;
}

/* ── TOPBAR ─────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 9px 14px;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  box-shadow: var(--shadow-inset), var(--shadow-soft);
  backdrop-filter: blur(28px) saturate(140%);
  -webkit-backdrop-filter: blur(28px) saturate(140%);
}

.wordmark { display: flex; align-items: center; gap: 9px; text-decoration: none; }
.wm-mark {
  display: grid; place-items: center;
  width: 30px; height: 30px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--lime), var(--lime-2));
  color: oklch(0.16 0.02 130);
}
.wm-text {
  font-family: var(--display);
  font-size: 1.02rem; font-weight: 800; letter-spacing: -0.04em;
}
.wm-text em { font-family: var(--serif); font-style: italic; font-weight: 400; color: var(--lime); }

.control-cluster { display: flex; align-items: center; gap: 8px; }

.sync-status {
  display: flex; align-items: center; gap: 7px;
  padding: 5px 11px;
  border-radius: 999px;
  background: var(--surface-3);
  font-size: 0.72rem; font-weight: 500;
  color: var(--text-soft);
}
.sync-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--lime);
  box-shadow: 0 0 8px var(--lime);
  animation: pulse 2.4s var(--ease-in-out) infinite;
}
.sync-status.is-loading .sync-dot { background: var(--warn); box-shadow: 0 0 8px var(--warn); }
.sync-time { color: var(--text-muted); font-variant-numeric: tabular-nums; }
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .45; transform: scale(.8); }
}

.segmented {
  display: flex; gap: 2px; padding: 2px;
  border-radius: 999px; background: var(--surface-3);
}
.segment {
  padding: 5px 11px; border-radius: 999px;
  font-size: 0.7rem; font-weight: 700; letter-spacing: 0.06em;
  color: var(--text-muted);
  transition: color .2s var(--ease-out), background .2s var(--ease-out);
}
.segment.is-active { color: var(--text); background: var(--surface-2); box-shadow: var(--shadow-inset); }

.theme-toggle {
  position: relative;
  display: grid; place-items: center;
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--surface-3);
  color: var(--text-soft);
  transition: background .2s var(--ease-out), color .2s var(--ease-out);
}
.theme-toggle:hover { background: var(--line); color: var(--text); }
.theme-toggle .ti { position: absolute; transition: opacity .25s var(--ease-out), transform .35s var(--ease-spring); }
.theme-toggle .ti-sun { opacity: 0; transform: rotate(-90deg) scale(0.6); }
[data-theme="light"] .theme-toggle .ti-moon { opacity: 0; transform: rotate(90deg) scale(0.6); }
[data-theme="light"] .theme-toggle .ti-sun { opacity: 1; transform: rotate(0) scale(1); }
.theme-toggle .ti-moon { opacity: 1; }

.admin-chip {
  padding: 6px 13px; border-radius: 999px;
  background: var(--surface-3);
  font-size: 0.72rem; font-weight: 600;
  color: var(--text-soft); text-decoration: none;
  transition: background .2s var(--ease-out), color .2s var(--ease-out);
}
.admin-chip:hover { background: var(--line); color: var(--text); }

/* ── KICKER ─────────────────────────────────── */
.kicker {
  display: flex; align-items: center; gap: 7px;
  font-size: 0.68rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.14em;
  color: var(--text-muted);
}
.kicker-pip {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--lime); box-shadow: 0 0 10px var(--lime);
}
.pip-coral { background: var(--coral); box-shadow: 0 0 10px var(--coral); }
.pip-cyan  { background: var(--cyan);  box-shadow: 0 0 10px var(--cyan); }
.pip-lime  { background: var(--lime);  box-shadow: 0 0 10px var(--lime); }
.pip-warn  { background: var(--warn);  box-shadow: 0 0 10px var(--warn); }

/* ── PANELS ─────────────────────────────────── */
.panel {
  padding: clamp(14px, 1.8vw, 20px);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  background: var(--surface);
  box-shadow: var(--shadow-inset), var(--shadow-soft);
  backdrop-filter: blur(28px) saturate(140%);
  -webkit-backdrop-filter: blur(28px) saturate(140%);
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 14px; flex-wrap: wrap;
}

/* ── COMMAND BAR ────────────────────────────── */
.cmd {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 12px;
  margin-bottom: 14px;
}
.cmd-main { display: flex; flex-direction: column; gap: 14px; }
.cmd-head { display: flex; flex-direction: column; gap: 6px; }
.cmd-title {
  font-family: var(--display);
  font-size: clamp(1.5rem, 3vw, 2.1rem);
  font-weight: 700; letter-spacing: -0.045em; line-height: 1.05;
}
.cmd-title em.serif { font-size: 1.06em; }

/* Day strip */
.day-strip { display: flex; flex-direction: column; gap: 10px; }
.day-strip-meta { display: flex; gap: clamp(16px, 3vw, 34px); flex-wrap: wrap; }
.ds-block { display: flex; flex-direction: column; gap: 2px; }
.ds-lbl {
  font-size: 0.62rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.13em;
  color: var(--text-muted);
}
.ds-val {
  font-family: var(--display);
  font-size: 1.5rem; font-weight: 700; letter-spacing: -0.045em;
  font-variant-numeric: tabular-nums;
  display: flex; align-items: baseline; gap: 4px;
}
.ds-of { font-size: 0.8rem; font-weight: 500; color: var(--text-muted); letter-spacing: 0; }
.ds-val-sm { font-size: 1.15rem; }

.day-track {
  position: relative; height: 7px;
  border-radius: 999px;
  background: oklch(1 0 0 / 0.08);
  overflow: visible;
}
[data-theme="light"] .day-track { background: oklch(0.12 0.01 70 / 0.08); }
.day-track-fill {
  position: absolute; inset: 0 auto 0 0; width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--lime), var(--lime-2));
  box-shadow: 0 0 18px oklch(0.88 0.2 125 / 0.4);
  transition: width 1.4s var(--ease-out);
}
.day-track-ticks span {
  position: absolute; top: -3px;
  width: 1px; height: 13px;
  background: oklch(1 0 0 / 0.18);
}
[data-theme="light"] .day-track-ticks span { background: oklch(0.12 0.01 70 / 0.18); }
.day-track-marker {
  position: absolute; top: 50%; left: 0;
  transform: translate(-50%, -50%);
  opacity: 0;
  transition: left 1.4s var(--ease-out), opacity .4s var(--ease-out);
}
/* Near either end the centred bubble would hang off the track — and off the
   card — so it tucks against the edge instead of straddling it. */
.day-track-marker.at-start { transform: translate(0, -50%); }
.day-track-marker.at-end   { transform: translate(-100%, -50%); }
.dtm-bubble {
  display: block;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--lime);
  color: oklch(0.16 0.02 130);
  font-family: var(--mono);
  font-size: 0.64rem; font-weight: 700;
  white-space: nowrap;
  box-shadow: 0 4px 14px oklch(0 0 0 / 0.35);
}

/* Chip row */
.chip-row {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
}
.chip {
  position: relative;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-3);
  overflow: hidden;
}
.chip::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 2px;
  background: var(--chip-color, var(--lime));
  opacity: .8;
}
.chip-label {
  display: block;
  font-size: 0.6rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--text-muted);
}
.chip-value {
  display: block; margin-top: 3px;
  font-family: var(--display);
  font-size: 1.25rem; font-weight: 700; letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
}
.chip-sub { display: block; margin-top: 1px; font-size: 0.66rem; color: var(--text-muted); }

/* Pot card */
.cmd-pot { display: flex; flex-direction: column; gap: 14px; }
.pot-head { display: flex; flex-direction: column; gap: 3px; }
.pot-total {
  font-family: var(--display);
  font-size: clamp(1.8rem, 3.4vw, 2.4rem);
  font-weight: 800; letter-spacing: -0.05em;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(120deg, var(--lime), var(--cyan));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-top: 4px;
}
.pot-sub { font-size: 0.7rem; color: var(--text-muted); font-variant-numeric: tabular-nums; }

.pot-split { display: grid; gap: 8px; flex: 1; }
.pot-half {
  position: relative;
  padding: 11px 13px 11px 15px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-3);
  display: flex; flex-direction: column; gap: 1px;
}
.ph-bar {
  position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--c1), var(--c2));
}
.ph-lbl {
  font-size: 0.62rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--text-muted);
}
.ph-val {
  font-family: var(--display);
  font-size: 1.3rem; font-weight: 700; letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
}
.ph-meta { font-size: 0.72rem; color: var(--text-soft); }

/* ── TABS ───────────────────────────────────── */
.tabs {
  position: sticky; top: 8px; z-index: 40;
  display: flex; align-items: center; gap: 2px;
  padding: 4px;
  margin-bottom: 12px;
  width: fit-content; max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
  box-shadow: var(--shadow-inset), var(--shadow-soft);
  backdrop-filter: blur(28px) saturate(140%);
  -webkit-backdrop-filter: blur(28px) saturate(140%);
  overflow: hidden;
}
.tab {
  position: relative; z-index: 1;
  padding: 8px 18px;
  border-radius: 999px;
  font-size: 0.82rem; font-weight: 600; letter-spacing: -0.01em;
  color: var(--text-muted);
  white-space: nowrap;
  transition: color .25s var(--ease-out);
}
.tab:hover { color: var(--text-soft); }
.tab.is-active { color: oklch(0.16 0.02 130); }
[data-theme="light"] .tab.is-active { color: oklch(0.99 0 0); }
.tab-ink {
  position: absolute; left: 0; top: 4px; bottom: 4px;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(120deg, var(--lime), var(--lime-2));
  transition: transform .45s var(--ease-spring), width .45s var(--ease-spring);
}

.tabpanel { display: none; }
.tabpanel.is-active { display: block; animation: tabin .35s var(--ease-out); }
@keyframes tabin {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

/* ── LEADERBOARD ────────────────────────────── */
.board-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}
.panel-lb { padding: 14px; }

.lb-tableHead, .lb-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 104px 74px 92px;
  gap: 12px;
  align-items: center;
}
.lb-tableHead {
  padding: 4px 12px 9px;
  font-size: 0.64rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.13em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--line);
  margin-bottom: 4px;
}
.lb-tableHead .num { text-align: right; }

.lb-rows { display: flex; flex-direction: column; gap: 1px; }
.lb-row {
  position: relative;
  padding: 8px 12px;
  border-radius: var(--r-md);
  text-align: left;
}
@media (hover: hover) and (pointer: fine) {
  .lb-row:hover { background: var(--surface-3); transform: translateX(2px); }
}
.lb-row.is-dropped { opacity: .45; }

.lb-rank {
  font-family: var(--mono);
  font-size: 0.82rem; font-weight: 600;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.lb-row.is-top1 .lb-rank { color: var(--lime); }
.lb-row.is-top2 .lb-rank { color: var(--coral); }
.lb-row.is-top3 .lb-rank { color: var(--cyan); }

.lb-athlete { display: flex; align-items: center; gap: 10px; min-width: 0; }
.lb-id { min-width: 0; }
.avatar {
  display: grid; place-items: center;
  width: 30px; height: 30px; flex: none;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--av-c1, var(--lime)), var(--av-c2, var(--lime-2)));
  color: oklch(0.16 0.02 130);
  font-size: 0.7rem; font-weight: 800; letter-spacing: -0.02em;
}
.lb-name {
  display: block; font-weight: 600; font-size: 0.9rem; letter-spacing: -0.015em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.lb-meta {
  display: block; margin-top: 1px;
  font-size: 0.71rem; color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.lb-faltas { display: flex; align-items: center; gap: 8px; justify-content: flex-end; }
.lb-faltas-bar {
  flex: 1; height: 5px; min-width: 20px;
  border-radius: 999px;
  background: oklch(1 0 0 / 0.07);
  overflow: hidden;
}
[data-theme="light"] .lb-faltas-bar { background: oklch(0.12 0.01 70 / 0.07); }
.lb-faltas-bar i {
  display: block; height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--coral), var(--coral-2));
  transition: width 1s var(--ease-out);
}
.lb-faltas b {
  font-family: var(--mono); font-size: 0.86rem; font-weight: 600;
  font-variant-numeric: tabular-nums; min-width: 16px; text-align: right;
}
.lb-num {
  text-align: right;
  font-family: var(--mono); font-size: 0.84rem;
  color: var(--text-soft);
  font-variant-numeric: tabular-nums;
}
.lb-money.is-owed { color: var(--warn); }
.lb-foot {
  margin-top: 10px; padding-top: 10px;
  border-top: 1px solid var(--line);
  font-size: 0.72rem; color: var(--text-muted);
}

/* ── HIGHLIGHTS ─────────────────────────────── */
.panel-ach { display: flex; flex-direction: column; }
.ach-head { margin-bottom: 12px; }
.ach-list { display: flex; flex-direction: column; gap: 7px; }
.ach {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-3);
}
.ach-icon {
  display: grid; place-items: center;
  width: 28px; height: 28px; flex: none;
  border-radius: 9px;
  background: color-mix(in oklab, var(--ach-bg) 22%, transparent);
  color: var(--ach-bg);
  font-size: 0.82rem; font-weight: 700;
}
.ach-body { min-width: 0; }
.ach-body strong {
  display: block; font-size: 0.79rem; font-weight: 600; letter-spacing: -0.01em;
}
.ach-body span {
  display: block; margin-top: 1px;
  font-size: 0.72rem; color: var(--text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ── WEEKS TAB ──────────────────────────────── */
.weeks-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.heatmap-scale {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 9px;
  background: var(--surface-3);
  border-radius: 999px;
  font-size: 0.66rem;
  color: var(--text-muted);
}
.hs-lbl { font-weight: 600; text-transform: uppercase; letter-spacing: 0.1em; }
.hs-cell {
  width: 12px; height: 12px;
  border-radius: 4px;
  background: color-mix(in oklab, var(--lime) calc(var(--v) * 100%), oklch(1 0 0 / 0.08));
  border: 1px solid oklch(1 0 0 / 0.06);
}
[data-theme="light"] .hs-cell {
  background: color-mix(in oklab, var(--lime) calc(var(--v) * 100%), oklch(0.12 0.01 70 / 0.06));
  border-color: oklch(0.12 0.01 70 / 0.06);
}

.heatmap-wrap { overflow-x: auto; margin: 0 -4px; padding: 0 4px 4px; }
.heatmap {
  display: grid;
  grid-template-columns: 116px repeat(var(--weeks, 15), minmax(30px, 1fr));
  gap: 4px;
  min-width: 640px;
}
.heat-colhead {
  display: grid; place-items: center;
  font-family: var(--mono); font-size: 0.62rem;
  color: var(--text-muted); padding-bottom: 2px;
}
.heat-cornercell { grid-column: 1; }
.heat-cell {
  aspect-ratio: 1;
  border-radius: 7px;
  background: color-mix(in oklab, var(--lime) calc(var(--v) * 100%), oklch(1 0 0 / 0.045));
  border: 1px solid oklch(1 0 0 / 0.04);
  display: grid; place-items: center;
  font-family: var(--mono);
  font-size: 0.62rem; font-weight: 600;
  color: oklch(0.12 0 0 / 0.68);
  transition: transform .2s var(--ease-out);
  position: relative;
  cursor: default;
}
[data-theme="light"] .heat-cell {
  background: color-mix(in oklab, var(--lime) calc(var(--v) * 100%), oklch(0.12 0.01 70 / 0.045));
  border-color: oklch(0.12 0.01 70 / 0.04);
}
@media (hover: hover) and (pointer: fine) {
  .heat-cell:hover { transform: scale(1.18); z-index: 2; box-shadow: 0 4px 12px oklch(0 0 0 / 0.3); }
}
.heat-cell.is-miss { border-color: var(--coral); box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--coral) 55%, transparent); }
.heat-cell.is-open { outline: 1px dashed var(--line-strong); outline-offset: 1px; }
.heat-cell.is-void { background: transparent; border: 1px dashed var(--line); color: transparent; }
.heat-cell.has-joker::after {
  content: ""; position: absolute; right: 3px; top: 3px;
  width: 4px; height: 4px; border-radius: 50%;
  background: var(--violet);
}
.heat-cell[style*="--v:0.0"], .heat-cell[style*="--v:0.1"], .heat-cell[style*="--v:0.2"] { color: oklch(0.97 0 0 / 0.45); }
[data-theme="light"] .heat-cell[style*="--v:0.0"],
[data-theme="light"] .heat-cell[style*="--v:0.1"],
[data-theme="light"] .heat-cell[style*="--v:0.2"] { color: oklch(0.16 0 0 / 0.45); }

.heat-name {
  display: flex; align-items: center; gap: 8px;
  font-size: 0.8rem; font-weight: 500;
  color: var(--text-soft);
  white-space: nowrap; overflow: hidden;
  padding-right: 6px;
  text-align: left;
  border-radius: 8px;
}
@media (hover: hover) and (pointer: fine) {
  .heat-name:hover { color: var(--text); }
}
.heat-name span:last-child { overflow: hidden; text-overflow: ellipsis; }
.heat-name .avatar { width: 22px; height: 22px; font-size: 0.6rem; border-radius: 7px; }

/* ── CHART ROWS ─────────────────────────────── */
.chart-total {
  font-family: var(--display);
  font-size: 1.15rem; font-weight: 700; letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
}
.chart-list { display: flex; flex-direction: column; gap: 9px; }
.chart-row {
  display: grid;
  grid-template-columns: 118px minmax(0, 1fr) 74px;
  gap: 10px; align-items: center;
  border-radius: var(--r-sm);
  text-align: left;
}
.chart-name {
  display: flex; align-items: center; gap: 8px;
  font-size: 0.82rem; color: var(--text-soft);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chart-name .avatar { width: 20px; height: 20px; font-size: 0.56rem; border-radius: 6px; }
.track {
  height: 7px; border-radius: 999px;
  background: oklch(1 0 0 / 0.07);
  overflow: hidden;
}
[data-theme="light"] .track { background: oklch(0.12 0.01 70 / 0.05); }
.bar {
  height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, var(--bar-c1, var(--lime)), var(--bar-c2, var(--lime-2)));
  transition: width 1.1s var(--ease-out);
}
.chart-value {
  text-align: right;
  font-family: var(--mono); font-size: 0.8rem; font-weight: 500;
  color: var(--text-soft);
  font-variant-numeric: tabular-nums;
}
.stack-bar {
  display: flex; height: 9px;
  border-radius: 999px; overflow: hidden;
  background: oklch(1 0 0 / 0.07);
}
[data-theme="light"] .stack-bar { background: oklch(0.12 0.01 70 / 0.05); }
.stack-seg { height: 100%; transition: width 1.1s var(--ease-out); }
.stack-seg.s-train { background: var(--coral); }
.stack-seg.s-alc   { background: var(--warn); }
.stack-seg.s-drop  { background: var(--text-muted); }

.fines-legend {
  display: flex; gap: 14px; flex-wrap: wrap;
  margin-top: 12px; padding-top: 10px;
  border-top: 1px solid var(--line);
  font-size: 0.7rem; color: var(--text-muted);
}
.fines-legend span { display: inline-flex; align-items: center; gap: 5px; }
.fines-legend i { width: 8px; height: 8px; border-radius: 3px; }

/* ── TEAM GRID ──────────────────────────────── */
.team-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 10px;
}
.tc {
  position: relative;
  display: flex; flex-direction: column; gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-inset);
  text-align: left;
  overflow: hidden;
}
@media (hover: hover) and (pointer: fine) {
  .tc:hover {
    transform: translateY(-3px);
    border-color: var(--line-strong);
    box-shadow: var(--shadow-soft), var(--shadow-inset);
  }
}
.tc.is-dropped { opacity: .5; }
.tc-head { display: flex; align-items: center; gap: 10px; }
.tc .avatar { width: 36px; height: 36px; font-size: 0.82rem; border-radius: 11px; }
.tc-id { min-width: 0; flex: 1; }
.tc-name {
  display: block; font-size: 0.94rem; font-weight: 700; letter-spacing: -0.025em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tc-role { display: block; margin-top: 1px; font-size: 0.7rem; color: var(--text-muted); }
.tc-rank {
  font-family: var(--mono); font-size: 0.72rem;
  color: var(--text-muted); flex: none;
}
.tc-body { display: flex; align-items: center; gap: 12px; }
.tc-arc { position: relative; width: 58px; height: 58px; flex: none; }
.tc-arc svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.tc-arc .at { fill: none; stroke: oklch(1 0 0 / 0.08); stroke-width: 4.5; }
[data-theme="light"] .tc-arc .at { stroke: oklch(0.12 0.01 70 / 0.08); }
.tc-arc .af {
  fill: none; stroke: var(--lime); stroke-width: 4.5; stroke-linecap: round;
  stroke-dasharray: 0 999;
  transition: stroke-dasharray 1.4s var(--ease-out);
}
/* The value and its "%" are two children. As a grid they became two grid items
   and stacked on separate rows; a centred flex row keeps them on one line. */
.tc-arc-num {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  gap: 1px; line-height: 1; white-space: nowrap;
  font-family: var(--display); font-size: 0.85rem; font-weight: 700;
  letter-spacing: -0.04em; font-variant-numeric: tabular-nums;
}
/* The box fills the whole ring, so any align-self here would fling the glyph to
   the ring's edge. Both items stay centred; a nudge settles the sign optically. */
.tc-arc-num i {
  font-style: normal; font-size: 0.58em; color: var(--text-muted);
  transform: translateY(0.12em);
}
.tc-mini {
  flex: 1;
  display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px;
}
.tc-mini > div { display: flex; flex-direction: column; }
.tc-mini strong {
  font-family: var(--display); font-size: 0.98rem; font-weight: 700;
  letter-spacing: -0.03em; font-variant-numeric: tabular-nums;
}
.tc-mini strong.is-bad { color: var(--coral); }
.tc-mini strong.is-good { color: var(--lime); }
.tc-mini span {
  font-size: 0.6rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--text-muted);
}

/* ── RULES ──────────────────────────────────── */
.rules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 10px;
}
.rule {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-inset);
  position: relative; overflow: hidden;
}
.rule::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--rule-color, var(--lime));
}
.rule-icon { font-size: 1.3rem; flex: none; line-height: 1; }
.rule-body { flex: 1; min-width: 0; }
.rule-body strong { display: block; font-size: 0.9rem; font-weight: 600; letter-spacing: -0.02em; }
.rule-body span { display: block; margin-top: 2px; font-size: 0.74rem; color: var(--text-muted); line-height: 1.35; }
.rule-value {
  font-family: var(--display); font-size: 1.15rem; font-weight: 700;
  letter-spacing: -0.04em; font-variant-numeric: tabular-nums;
  flex: none; color: var(--rule-color, var(--text));
}
.rule-prize {
  grid-column: 1 / -1;
  --rule-color: var(--lime);
  background: linear-gradient(120deg, color-mix(in oklab, var(--lime) 10%, transparent), var(--surface) 60%);
}

/* ── PRESS FEEDBACK ─────────────────────────────
   Everything that opens a participant's detail confirms the tap before the
   modal arrives a beat later. Small on purpose: these are read surfaces. */
.lb-row, .tc, .heat-name, .chart-row[data-athlete-id] {
  transition: transform 120ms var(--ease-out),
              background 200ms var(--ease-out),
              color 200ms var(--ease-out),
              border-color 250ms var(--ease-out),
              box-shadow 250ms var(--ease-out);
}
.lb-row:active,
.tc:active,
.heat-name:active,
.chart-row[data-athlete-id]:active { transform: scale(0.99); }

/* ── MODAL ──────────────────────────────────── */
.modal {
  border: none; padding: 0; background: transparent;
  max-width: min(760px, calc(100vw - 24px));
  width: 100%;
  margin: auto;
  color: var(--text);

  /* Enters and leaves the same way, centred (no transform-origin at the
     trigger — a modal is not a popover). `allow-discrete` lets the exit play
     before `close()` pulls the dialog out of the top layer; where it is not
     supported the entry still runs and the exit is simply instant. */
  opacity: 0;
  transform: scale(0.97) translateY(8px);
  transition:
    opacity 200ms var(--ease-out),
    transform 200ms var(--ease-out),
    overlay 200ms var(--ease-out) allow-discrete,
    display 200ms var(--ease-out) allow-discrete;
}
.modal[open] {
  opacity: 1;
  transform: none;
}
@starting-style {
  .modal[open] {
    opacity: 0;
    transform: scale(0.97) translateY(8px);
  }
}

.modal::backdrop {
  background: oklch(0.08 0.01 60 / 0.72);
  backdrop-filter: blur(8px);
  opacity: 0;
  transition:
    opacity 200ms var(--ease-out),
    overlay 200ms var(--ease-out) allow-discrete,
    display 200ms var(--ease-out) allow-discrete;
}
.modal[open]::backdrop { opacity: 1; }
@starting-style {
  .modal[open]::backdrop { opacity: 0; }
}
.modal-card {
  position: relative;
  padding: clamp(18px, 3vw, 26px);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-xl);
  background: var(--surface-2);
  box-shadow: var(--shadow);
  backdrop-filter: blur(30px) saturate(150%);
  max-height: 86vh; overflow-y: auto;
}
.modal-close {
  position: absolute; top: 14px; right: 14px;
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--text-muted);
  font-size: 1.1rem; line-height: 1;
  transition: color .2s var(--ease-out), border-color .2s var(--ease-out);
}
.modal-close:hover { color: var(--text); border-color: var(--line-strong); }
.modal-hero { display: flex; align-items: center; gap: 14px; padding-right: 44px; margin-bottom: 16px; }
.modal-hero .avatar { width: 48px; height: 48px; font-size: 1.05rem; border-radius: 14px; }
.modal-hero h2 { font-family: var(--display); font-size: 1.5rem; font-weight: 700; letter-spacing: -0.04em; }
.modal-hero p { margin-top: 2px; font-size: 0.82rem; color: var(--text-muted); }
.modal-stats {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px; margin-bottom: 18px;
}
.modal-stat {
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-3);
}
.modal-stat span {
  display: block; font-size: 0.6rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.modal-stat strong {
  display: block; margin-top: 4px;
  font-family: var(--display); font-size: 1.05rem; font-weight: 700;
  letter-spacing: -0.04em; font-variant-numeric: tabular-nums;
}
.modal-section h3 { margin-bottom: 10px; font-size: 0.95rem; font-weight: 600; letter-spacing: -0.02em; }

.wk-list { display: flex; flex-direction: column; gap: 5px; }
.wk-row {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr) 74px 78px 64px;
  gap: 10px; align-items: center;
  padding: 6px 9px;
  border-radius: var(--r-sm);
  background: var(--surface-3);
  font-size: 0.78rem;
}
.wk-row.is-open { outline: 1px dashed var(--line-strong); }
.wk-label {
  font-family: var(--mono); font-size: 0.74rem; font-weight: 600;
  display: flex; flex-direction: column;
}
.wk-label i { font-style: normal; font-size: 0.86em; color: var(--text-muted); }
.wk-count { font-family: var(--mono); font-size: 0.76rem; text-align: right; font-variant-numeric: tabular-nums; }
.wk-count i { font-style: normal; color: var(--violet); }
.wk-count b { color: var(--text-muted); font-weight: 500; }
.wk-status { font-size: 0.72rem; color: var(--text-muted); text-align: right; }
.wk-row.is-met .wk-status { color: var(--lime); }
.wk-fine { font-family: var(--mono); font-size: 0.74rem; text-align: right; color: var(--warn); }

/* ── RESPONSIVE ─────────────────────────────── */
@media (max-width: 1180px) {
  .cmd { grid-template-columns: minmax(0, 1fr); }
  .cmd-pot { flex-direction: row; align-items: center; gap: 18px; }
  .pot-head { flex: 1; }
  .pot-split { grid-template-columns: 1fr 1fr; flex: 2; }
  .board-grid, .weeks-grid { grid-template-columns: minmax(0, 1fr); }
  .chip-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 780px) {
  .shell { width: min(1200px, calc(100% - 20px)); padding: 10px 0 32px; }
  /* Once the bar wraps to two rows a 999px radius carves a stadium curve deep
     enough that the corner content falls outside it. A fixed radius keeps the
     wordmark inside the box. */
  .topbar {
    flex-wrap: wrap;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--r-xl);
  }
  /* The admin bar carries four controls; without wrapping they run off the
     edge on a narrow phone and get clipped by the page's overflow guard. */
  .control-cluster { flex-wrap: wrap; }
  .sync-status { order: 3; }
  .cmd-pot { flex-direction: column; align-items: stretch; gap: 12px; }
  .pot-split { grid-template-columns: minmax(0, 1fr); }
  .tabs { width: 100%; overflow-x: auto; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { padding: 8px 14px; font-size: 0.78rem; }
  .lb-tableHead, .lb-row { grid-template-columns: 26px minmax(0, 1fr) 84px 78px; }
  .lb-tableHead > :nth-child(4), .lb-row > :nth-child(4) { display: none; }
  .chart-row { grid-template-columns: 96px minmax(0, 1fr) 68px; }
  .modal-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .wk-row { grid-template-columns: 60px minmax(0, 1fr) 62px 60px; }
  .wk-row .wk-fine { display: none; }
}

@media (max-width: 480px) {
  .chip-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cmd-title { font-size: 1.4rem; }
  .day-strip-meta { gap: 14px; }
  .ds-val { font-size: 1.25rem; }
  .team-grid { grid-template-columns: minmax(0, 1fr); }
  .rules-grid { grid-template-columns: minmax(0, 1fr); }
  .modal-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lb-tableHead, .lb-row { grid-template-columns: 24px minmax(0, 1fr) 76px; }
  .lb-tableHead > :nth-child(5), .lb-row > :nth-child(5) { display: none; }
}

/* ── REDUCED MOTION ─────────────────────────────
   Gentler, not off. Ambient and looping motion stops completely; everything
   else keeps a short fade but loses its travel, so states still read as
   changing without anything sliding, scaling or drifting. */
@media (prefers-reduced-motion: reduce) {
  /* Decorative, endless, and never load-bearing. */
  .aurora-blob,
  .sync-dot { animation: none; }

  *, *::before, *::after {
    animation-duration: 200ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 150ms !important;
  }

  /* Opacity survives; movement does not. */
  .tabpanel.is-active { animation-name: fade-in; }
  .modal, .modal[open] { transform: none; }
  @starting-style {
    .modal[open] { transform: none; }
  }

  .lb-row:hover, .lb-row:active,
  .tc:hover, .tc:active,
  .heat-cell:hover,
  .chart-row[data-athlete-id]:active, .heat-name:active,
  .theme-toggle .ti { transform: none; }

  /* Long value animations settle almost at once instead of drawing themselves. */
  .day-track-fill, .day-track-marker,
  .tc-arc .af, .bar, .stack-seg,
  .lb-faltas-bar i { transition-duration: 1ms !important; }
}

@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
