/* ============================================================================
   ZipScore design system — "Command in the dark, score in the light."

   Ported from the Claude Design handoff (ZipScore Redesign.html).

   Three surfaces, selected per page via the base template's body_class block:

   - (default)          Legacy light surface. Unported screens keep their
                        original styling, under the new dark XGrab topbar.
   - body.dark          XGrab Motion dark shell (#0a0d14 canvas, #6694fa
                        accent, translucent cards, mono tracked labels) for
                        browse/review screens that have been ported.
   - body.sheet-mode    Light, high-contrast score sheet (white surface,
                        AA-safe #1f51c8 accent, oversized mono inputs) for
                        rinkside entry in bright sunlight. `html.sheet-dark`
                        flips the sheet to the dark brand surface.
   ========================================================================= */

:root {
  /* ---- dark shell (XGrab Motion brand) ---- */
  --bg: #0a0d14;
  --glow: rgba(36, 56, 107, 0.7);
  --accent: #6694fa;
  --accent-strong: #4f7ef0;
  --d-text: #ffffff;
  --d-mid: rgba(255, 255, 255, 0.6);
  --d-dim: rgba(255, 255, 255, 0.42);
  --d-faint: rgba(255, 255, 255, 0.3);
  --d-card: rgba(255, 255, 255, 0.04);
  --d-card-2: rgba(255, 255, 255, 0.06);
  --d-field: rgba(255, 255, 255, 0.03);
  --d-stroke: rgba(255, 255, 255, 0.08);
  --d-stroke-soft: rgba(255, 255, 255, 0.05);

  /* status (shared vocabulary, Motion sync pills) */
  --green: #30d158;
  --amber: #ff9f0a;
  --red: #ff453a;
  --blue: #0a84ff;

  /* ---- light score surface (sunlight, max contrast) ---- */
  --paper: #eef1f6;
  --sheet: #ffffff;
  --ink: #0a1020;
  --ink-mid: #44506a;
  --ink-dim: #6b7689;
  --line: #d3dae6;
  --line-strong: #aab4c6;
  --accent-ink: #1f51c8; /* AA on white */
  --good: #15803d;
  --good-bg: #e7f6ec;
  --good-line: #5cb277;
  --bad: #c81e1e;
  --bad-bg: #fdebeb;
  --bad-line: #e88;
  --warn: #8a5a00;
  --warn-bg: #fbf1d4;
  --warn-line: #d8b25a;

  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --rounded: "Nunito", ui-rounded, "SF Pro Rounded", system-ui, sans-serif;
  --sans: system-ui, -apple-system, "Segoe UI", sans-serif;
}

/* ===================== reset & base (legacy light default) ===================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
  font-family: var(--sans);
  background: #f4f6f9;
  color: #1a1a2e;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ===================== shared atoms ===================== */
.mono { font-family: var(--mono); }
.tnum { font-variant-numeric: tabular-nums; }

.logo {
  font-family: var(--rounded);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.015em;
}
.logo .zip { color: var(--accent); }
.logo .score { color: var(--d-text); }

.ulabel {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--d-dim);
}

/* status pill — Motion sync-pill vocabulary, repurposed as scoring status */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid currentColor;
  white-space: nowrap;
}
.pill .d { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.pill.done { color: var(--green); background: rgba(48, 209, 88, 0.12); }
.pill.prog { color: var(--amber); background: rgba(255, 159, 10, 0.13); }
.pill.idle { color: var(--d-dim); background: rgba(255, 255, 255, 0.05); }
.pill.live { color: var(--accent); background: rgba(102, 148, 250, 0.14); }
.pill.fail { color: var(--red); background: rgba(255, 69, 58, 0.13); }

.ping { position: relative; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--green); flex: none; }
.ping.amber { background: var(--amber); }
.ping.rec { background: var(--red); animation: ping-pulse 1.6s ease-in-out infinite; }
@keyframes ping-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 69, 58, 0.5); }
  50% { box-shadow: 0 0 0 5px rgba(255, 69, 58, 0); }
}

.chip {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.06em;
  background: rgba(255, 255, 255, 0.06); border: 1px solid var(--d-stroke);
  border-radius: 999px; padding: 3px 9px; color: var(--d-mid); white-space: nowrap;
  display: inline-flex; align-items: center; gap: 6px;
}

.crumb {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.06em;
  color: var(--accent); text-decoration: none; display: inline-block;
  margin-bottom: 8px; white-space: nowrap;
}
.crumb:hover { text-decoration: underline; }

/* ===================== topbar (dark, on every surface) ===================== */
.topbar {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 8px 22px;
  min-height: 58px;
  border-bottom: 1px solid var(--d-stroke);
  background: rgba(10, 13, 20, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 30;
  flex-wrap: wrap;
}
.topbar .brand { display: flex; align-items: baseline; gap: 10px; text-decoration: none; }
.topbar .logo { font-size: 21px; }
.topbar .tag {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.32em;
  color: var(--d-faint);
  text-transform: uppercase;
}
.topnav { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.topnav a, .topnav .nav-dropdown-toggle {
  font-family: var(--sans);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--d-mid);
  text-decoration: none;
  padding: 7px 12px;
  border-radius: 8px;
  border: none;
  background: transparent;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.topnav a:hover, .topnav .nav-dropdown-toggle:hover { color: var(--d-text); background: rgba(255, 255, 255, 0.05); }
.topnav a.nav-active,
.topnav .nav-dropdown-toggle.nav-active,
.topnav .nav-dropdown-toggle[aria-expanded="true"] { color: var(--d-text); background: rgba(255, 255, 255, 0.09); }
.topbar .right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.topbar .who {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--d-dim);
  display: flex; align-items: center; gap: 7px;
  text-decoration: none;
}
.topbar .who:hover, .topbar .who.nav-active { color: var(--d-text); }
.topbar .signout-btn {
  background: none; border: none; cursor: pointer; padding: 0;
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.08em; color: var(--d-dim);
}
.topbar .signout-btn:hover { color: var(--d-text); }

/* nav dropdown (dark) */
.nav-dropdown { position: relative; }
.nav-dropdown-menu {
  display: none; position: absolute; top: calc(100% + 0.35rem); left: 0;
  background: rgba(16, 20, 30, 0.97); border: 1px solid var(--d-stroke); border-radius: 11px;
  min-width: 210px; padding: 0.35rem 0; z-index: 200; box-shadow: 0 10px 34px rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.nav-dropdown-menu.open { display: block; }
/* Invisible bridge covering the gap between button and menu so the mouse
   can travel diagonally without the menu closing */
.nav-dropdown-menu::before {
  content: ""; position: absolute; top: -0.5rem; left: 0;
  width: 100%; height: 0.5rem;
}
.nav-dropdown-menu a {
  display: block; padding: 0.5rem 1rem; border-radius: 0;
  font-size: 0.88rem; font-weight: 500; color: var(--d-mid); text-decoration: none;
}
.nav-dropdown-menu a:hover, .nav-dropdown-menu a.nav-active { color: var(--d-text); background: rgba(255, 255, 255, 0.06); }
.nav-dropdown-sep { height: 1px; background: var(--d-stroke); margin: 0.3rem 0; }
.nav-dropdown-label {
  font-family: var(--mono); font-size: 0.62rem; font-weight: 500; text-transform: uppercase;
  letter-spacing: 0.16em; color: var(--d-faint); padding: 0.4rem 1rem 0.1rem;
  pointer-events: none; display: block;
}

/* ===================== layout ===================== */
.container { max-width: 1400px; margin: 0 auto; padding: 1.25rem 1.5rem; }

.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; margin-bottom: 22px;
}
.page-head h1 { margin-bottom: 0; }
.sub { color: var(--d-dim); font-size: 13px; margin-top: 7px; display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }

h1 { font-family: var(--rounded); font-weight: 800; font-size: 1.6rem; letter-spacing: -0.01em; margin-bottom: 1rem; }
h2 { font-family: var(--rounded); font-weight: 800; font-size: 1.2rem; margin-bottom: 0.75rem; }
h3 { font-family: var(--rounded); font-weight: 700; font-size: 1rem; margin-bottom: 0.5rem; }

/* ===================== legacy light surface (default) ===================== */
.card {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
}
.card-title { font-size: 1.15rem; font-weight: 700; margin-bottom: 1rem; }

.form-group { margin-bottom: 1rem; }
label { display: block; font-weight: 600; margin-bottom: 0.3rem; font-size: 0.9rem; }
body:not(.sheet-mode) input[type=text], body:not(.sheet-mode) input[type=number],
body:not(.sheet-mode) input[type=date], body:not(.sheet-mode) input[type=time],
body:not(.sheet-mode) input[type=password], body:not(.sheet-mode) input[type=email],
body:not(.sheet-mode) input[type=file], body:not(.sheet-mode) input[type=url],
body:not(.sheet-mode) select, body:not(.sheet-mode) textarea {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border: 1.5px solid #cdd3db;
  border-radius: 7px;
  font-size: 1rem;
  background: #fafbfc;
  transition: border-color 0.15s;
}
body:not(.sheet-mode) input:focus, body:not(.sheet-mode) select:focus, body:not(.sheet-mode) textarea:focus {
  outline: none;
  border-color: #0f3460;
  background: #fff;
}
.checkbox-row { display: flex; align-items: center; gap: 0.5rem; }
.checkbox-row input[type=checkbox] { width: auto; }

.btn {
  display: inline-block;
  padding: 0.55rem 1.1rem;
  border-radius: 7px;
  border: none;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: opacity 0.15s;
}
.btn:hover { opacity: 0.85; }
.btn-primary { background: #0f3460; color: #fff; }
.btn-secondary { background: #e2e8f0; color: #1a1a2e; }
.btn-danger { background: #e53e3e; color: #fff; }
.btn-success { background: #38a169; color: #fff; }
.btn-sm { padding: 0.3rem 0.7rem; font-size: 0.82rem; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.93rem; }
th { background: #f0f4f8; font-weight: 700; padding: 0.6rem 0.75rem; text-align: left; }
td { padding: 0.55rem 0.75rem; border-top: 1px solid #e8ecf0; }
tr:hover td { background: #f8fafc; }

.messages { list-style: none; margin-bottom: 1rem; }
.messages li {
  padding: 0.65rem 1rem;
  border-radius: 7px;
  margin-bottom: 0.4rem;
  font-weight: 500;
}
.messages .success { background: #c6f6d5; color: #22543d; }
.messages .error   { background: #fed7d7; color: #742a2a; }
.messages .warning { background: #fefcbf; color: #744210; }
.messages .info    { background: #bee3f8; color: #2a4365; }

.badge {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
}
.badge-air  { background: #ebf8ff; color: #2b6cb0; }
.badge-turns { background: #f0fff4; color: #276749; }

/* legacy score entry (aerials / park & pipe until their light-sheet port) */
.score-grid { display: grid; gap: 1rem; }
.score-card {
  border: 1.5px solid #e2e8f0;
  border-radius: 9px;
  padding: 1rem;
}
.score-card-header {
  font-weight: 700;
  margin-bottom: 0.75rem;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.score-fields { display: grid; gap: 0.65rem; }
.score-field label { font-size: 0.82rem; margin-bottom: 0.2rem; }
.score-input {
  font-size: 1.5rem;
  font-weight: 700;
  padding: 0.4rem 0.6rem;
  text-align: center;
  border: 2px solid #cbd5e0;
  border-radius: 8px;
  width: 100%;
  background: #fff;
  transition: border-color 0.15s, background 0.15s;
}
.score-input:focus { outline: none; border-color: #0f3460; background: #f0f4ff; }
.score-input.saved { border-color: #38a169; background: #f0fff4; }
.score-input.error-field { border-color: #e53e3e; background: #fff5f5; }
.score-input-sm {
  font-size: 1rem;
  font-weight: 600;
  padding: 0.35rem 0.5rem;
}

.jump-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }

.athlete-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.athlete-nav .athlete-name { font-size: 1.2rem; font-weight: 800; }

#save-indicator {
  font-size: 0.78rem;
  color: #718096;
  text-align: right;
  min-height: 1.2em;
  transition: color 0.3s;
}
#save-indicator.saving { color: #d69e2e; }
#save-indicator.saved  { color: #38a169; }
#save-indicator.err    { color: #e53e3e; }

.formset-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 0.5rem;
  align-items: end;
  margin-bottom: 0.5rem;
}
.delete-check { display: flex; align-items: center; gap: 0.35rem; font-size: 0.82rem; color: #e53e3e; }

.help { font-size: 0.78rem; color: #718096; margin-top: 0.2rem; }

.flex-row { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.5rem; }
.text-muted { color: #718096; }
.text-right { text-align: right; }
.w-full { width: 100%; }

/* =====================================================================
   DARK SHELL — body.dark (ported browse/review screens)
   ===================================================================== */
body.dark {
  background:
    radial-gradient(60% 420px at 50% -6%, var(--glow), transparent 72%),
    var(--bg);
  color: var(--d-text);
}
body.dark .container { max-width: 1180px; padding: 26px 22px 90px; }

body.dark .card {
  background: var(--d-card);
  border: 1px solid var(--d-stroke);
  border-radius: 16px;
  box-shadow: none;
}
body.dark .card-title { font-family: var(--mono); font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--d-mid); font-weight: 500; }

.card-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; border-bottom: 1px solid var(--d-stroke); gap: 12px; flex-wrap: wrap;
}
.card-bar h2 { font-family: var(--mono); font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--d-mid); font-weight: 500; margin: 0; }

body.dark label { color: var(--d-mid); }
body.dark input[type=text], body.dark input[type=number],
body.dark input[type=date], body.dark input[type=time],
body.dark input[type=password], body.dark input[type=email],
body.dark input[type=file], body.dark input[type=url],
body.dark select, body.dark textarea {
  border: 1px solid var(--d-stroke);
  border-radius: 10px;
  font-family: var(--sans);
  background: var(--d-field);
  color: var(--d-text);
  transition: border-color 0.15s, background 0.15s;
}
body.dark input::placeholder, body.dark textarea::placeholder { color: var(--d-faint); }
body.dark input:focus, body.dark select:focus, body.dark textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--d-card-2);
}
body.dark select option { background: #141925; color: var(--d-text); }
body.dark input[type=checkbox], body.dark input[type=radio] { accent-color: var(--accent); }

/* labelled translucent field (login) */
.field {
  display: block; background: var(--d-field); border: 1px solid var(--d-stroke);
  border-radius: 11px; padding: 9px 14px 10px; transition: border-color 0.15s, background 0.15s;
}
.field:focus-within { border-color: var(--accent); background: var(--d-card-2); }
.field .ulabel { display: block; margin-bottom: 3px; font-weight: 500; }
.field input, body.dark .field input {
  width: 100%; border: none; outline: none; background: transparent;
  color: var(--d-text); font-family: var(--sans); font-size: 16px; padding: 0; border-radius: 0;
}
.field input:focus, body.dark .field input:focus { background: transparent; border: none; }

body.dark .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border-radius: 9px;
  border: 1px solid transparent;
  font-family: var(--sans);
  transition: filter 0.15s, background 0.13s, color 0.13s, transform 0.05s;
}
body.dark .btn:hover { opacity: 1; filter: brightness(1.08); }
body.dark .btn:active { transform: translateY(1px); }
body.dark .btn-primary { background: var(--accent); color: #fff; }
body.dark .btn-secondary { background: var(--d-card-2); border-color: var(--d-stroke); color: var(--d-mid); }
body.dark .btn-secondary:hover { background: rgba(255, 255, 255, 0.1); color: var(--d-text); filter: none; }
body.dark .btn-danger { background: rgba(255, 69, 58, 0.14); border-color: rgba(255, 69, 58, 0.35); color: #ff8079; }
body.dark .btn-danger:hover { background: rgba(255, 69, 58, 0.24); filter: none; }
body.dark .btn-success { background: rgba(48, 209, 88, 0.16); border-color: rgba(48, 209, 88, 0.38); color: #6ee094; }
body.dark .btn-success:hover { background: rgba(48, 209, 88, 0.26); filter: none; }

/* compact bar button (design ".mini") */
.mini {
  appearance: none; cursor: pointer; text-decoration: none;
  font-family: var(--sans); font-size: 12px; font-weight: 600;
  padding: 6px 11px; border-radius: 8px;
  border: 1px solid var(--d-stroke); background: var(--d-card-2); color: var(--d-mid);
  display: inline-flex; align-items: center; gap: 6px; transition: background 0.13s, color 0.13s;
}
.mini:hover { background: rgba(255, 255, 255, 0.1); color: var(--d-text); }
.mini.accent { background: var(--accent); border-color: transparent; color: #fff; }
.mini.accent:hover { filter: brightness(1.08); background: var(--accent); }
.mini.danger { background: rgba(255, 69, 58, 0.14); border-color: rgba(255, 69, 58, 0.35); color: #ff8079; }
.mini.danger:hover { background: rgba(255, 69, 58, 0.24); color: #ff8079; }

/* full-width accent submit (login) */
.btn-block {
  appearance: none; border: none; width: 100%;
  background: var(--accent); color: #fff;
  font-family: var(--sans); font-size: 15px; font-weight: 600;
  padding: 13px; border-radius: 11px; cursor: pointer; margin-top: 3px;
  transition: filter 0.15s, transform 0.05s;
}
.btn-block:hover { filter: brightness(1.08); }
.btn-block:active { transform: translateY(1px); }

/* dark data table */
body.dark table { font-size: 0.9rem; }
body.dark th {
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--d-faint);
  font-weight: 500;
  padding: 0.75rem 0.85rem;
  border-bottom: 1px solid var(--d-stroke);
  background: transparent;
}
body.dark td { padding: 0.7rem 0.85rem; border-top: 1px solid var(--d-stroke-soft); font-size: 0.88rem; }
body.dark tbody tr { transition: background 0.12s; }
body.dark tr:hover td { background: rgba(255, 255, 255, 0.025); }
body.dark td a { color: var(--accent); text-decoration: none; font-weight: 600; }
body.dark td a:hover { text-decoration: underline; }

td.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
body.dark td.seed, body.dark td.position-cell { color: var(--d-faint); font-family: var(--mono); }
body.dark td.name { font-weight: 600; }
body.dark td.muted, body.dark .sub-cell { color: var(--d-dim); }
.row-link { color: var(--accent); text-decoration: none; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.row-link:hover { text-decoration: underline; }

body.dark .messages li { border: 1px solid transparent; border-radius: 10px; font-size: 0.92rem; }
body.dark .messages .success { background: rgba(48, 209, 88, 0.12); border-color: rgba(48, 209, 88, 0.35); color: #6ee094; }
body.dark .messages .error   { background: rgba(255, 69, 58, 0.12); border-color: rgba(255, 69, 58, 0.35); color: #ff8079; }
body.dark .messages .warning { background: rgba(255, 159, 10, 0.12); border-color: rgba(255, 159, 10, 0.35); color: #ffc24d; }
body.dark .messages .info    { background: rgba(102, 148, 250, 0.12); border-color: rgba(102, 148, 250, 0.35); color: #8fb4ff; }

body.dark .badge { font-family: var(--mono); font-size: 0.68rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; border-radius: 6px; padding: 2px 8px; }
body.dark .badge-air  { background: rgba(102, 148, 250, 0.14); color: var(--accent); }
body.dark .badge-turns { background: rgba(48, 209, 88, 0.12); color: var(--green); }

body.dark .text-muted { color: var(--d-dim); }
body.dark .help { color: var(--d-dim); }

/* ===================== dark components (ported screens only) ===================== */
.comp-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.comp {
  display: block; text-decoration: none; color: inherit;
  background: var(--d-card); border: 1px solid var(--d-stroke); border-radius: 16px;
  padding: 18px 18px 16px; margin: 0;
  transition: border-color 0.15s, background 0.15s, transform 0.05s;
}
.comp:hover { border-color: rgba(102, 148, 250, 0.4); background: var(--d-card-2); }
.comp .top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 14px; }
.comp .jur { font-family: var(--mono); font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent); }
.comp h3 { font-family: var(--rounded); font-weight: 800; font-size: 18px; letter-spacing: -0.01em; margin-bottom: 5px; }
.comp .meta { font-size: 12.5px; color: var(--d-dim); }
.comp .foot { display: flex; align-items: center; gap: 8px; margin-top: 15px; flex-wrap: wrap; }
.ev-tag {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.04em;
  background: rgba(255, 255, 255, 0.05); border: 1px solid var(--d-stroke);
  border-radius: 6px; padding: 3px 8px; color: var(--d-mid); white-space: nowrap;
}

.layout-2 { display: grid; grid-template-columns: 1fr 300px; gap: 16px; align-items: start; }

.side-card { padding: 16px; }
.side-card .h { font-family: var(--mono); font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--d-faint); margin-bottom: 13px; }
.judge-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--d-stroke-soft); }
.judge-row:last-child { border-bottom: none; }
.judge-row .ord { font-family: var(--mono); font-size: 11px; color: var(--d-faint); width: 26px; flex: none; }
.judge-row .jn { flex: 1; font-size: 13.5px; font-weight: 500; }
.role {
  font-family: var(--mono); font-size: 9px; letter-spacing: 0.1em; text-transform: uppercase;
  padding: 2px 7px; border-radius: 5px;
}
.role.tl { color: var(--green); background: rgba(48, 209, 88, 0.12); }
.role.air { color: var(--accent); background: rgba(102, 148, 250, 0.14); }

.progress { display: flex; flex-direction: column; gap: 10px; }
.progress .row { display: flex; align-items: center; justify-content: space-between; font-size: 13px; }
.progress .row .v { font-family: var(--mono); font-variant-numeric: tabular-nums; color: var(--d-mid); }
.meter { height: 5px; border-radius: 3px; background: rgba(255, 255, 255, 0.09); overflow: hidden; }
.meter > i { display: block; height: 100%; border-radius: 3px; background: var(--accent); }

/* login */
.login-wrap {
  min-height: calc(100vh - 160px);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 24px;
}
.login-card { width: 100%; max-width: 380px; }
.login-brand { text-align: center; margin-bottom: 30px; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.login-brand .logo { font-size: 46px; }
.login-brand .tag { font-family: var(--mono); font-size: 10px; letter-spacing: 0.55em; text-indent: 0.55em; color: var(--d-mid); text-transform: uppercase; }
.login-form { background: var(--d-card); border: 1px solid var(--d-stroke); border-radius: 18px; padding: 22px; display: flex; flex-direction: column; gap: 13px; }
.login-foot { text-align: center; margin-top: 18px; }
.login-foot a { font-family: var(--mono); font-size: 11px; letter-spacing: 0.04em; color: var(--d-dim); text-decoration: none; }
.login-foot a:hover { color: var(--accent); }
.login-error {
  background: rgba(255, 69, 58, 0.12); border: 1px solid rgba(255, 69, 58, 0.35); color: #ff8079;
  border-radius: 10px; padding: 0.7rem 1rem; font-size: 0.88rem;
}

/* results (dark review) */
.tabs { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.tab {
  appearance: none; cursor: pointer; font-family: var(--sans); font-size: 13px; font-weight: 600;
  padding: 8px 18px; border-radius: 999px; border: 1px solid var(--d-stroke); background: var(--d-card); color: var(--d-mid);
  transition: background 0.13s, color 0.13s, border-color 0.13s;
}
.tab[aria-selected="true"], .tab.active { background: var(--accent); border-color: transparent; color: #fff; }
.tab:hover:not(.active) { color: var(--d-text); }
.pills { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.pills .lab { font-family: var(--mono); font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--d-faint); margin-right: 4px; }
.pillf {
  appearance: none; cursor: pointer; font-family: var(--mono); font-size: 11px; letter-spacing: 0.04em;
  padding: 5px 12px; border-radius: 999px; border: 1px solid var(--d-stroke); background: var(--d-field); color: var(--d-mid);
  transition: background 0.13s, color 0.13s, border-color 0.13s;
}
.pillf[aria-selected="true"], .pillf.active { background: rgba(48, 209, 88, 0.16); border-color: rgba(48, 209, 88, 0.4); color: #6ee094; }

.rank-medal { font-family: var(--rounded); font-weight: 800; font-size: 16px; }
.m1 { color: #e3b341; } .m2 { color: #c3ccdb; } .m3 { color: #d08a52; }
.total-cell { font-family: var(--rounded); font-weight: 800; font-size: 17px; color: var(--d-text); }
.scored-row { cursor: pointer; }
body.dark .detail-row > td, body.dark .detail-row:hover > td { padding: 0; background: rgba(102, 148, 250, 0.04); border-top: none; }
.detail-panel { padding: 16px; border-top: 2px solid var(--accent); animation: detail-fade-in 0.15s ease; }
@keyframes detail-fade-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; } }
.detail-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.dcard { background: var(--d-card-2); border: 1px solid var(--d-stroke); border-radius: 12px; padding: 13px 15px; }
.dcard .dt { font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--d-faint); margin-bottom: 10px; }
.dcard.final { border-color: var(--accent); }
.dcard.final .dt { color: var(--accent); }
.dcard .final-score { font-family: var(--rounded); font-weight: 900; font-size: 34px; text-align: center; padding: 8px 0; }
.drow { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; font-size: 13px; padding: 3px 0; }
.drow .l { color: var(--d-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.drow .v { font-family: var(--mono); font-variant-numeric: tabular-nums; color: var(--d-text); white-space: nowrap; flex: none; }
.drow.dtot { border-top: 1px solid var(--d-stroke); margin-top: 6px; padding-top: 8px; font-weight: 700; }
.drow.dtot .v { color: var(--accent); font-size: 15px; }
.jtag { font-family: var(--mono); font-size: 11px; font-weight: 600; background: rgba(102, 148, 250, 0.14); color: #8fb4ff; border-radius: 5px; padding: 2px 7px; margin-right: 4px; }
.jtag.warn { background: rgba(255, 159, 10, 0.16); color: #ffc24d; border: 1px solid rgba(255, 159, 10, 0.4); }
.formula { font-family: var(--mono); font-size: 10.5px; color: var(--d-faint); line-height: 1.7; margin-top: 4px; }
.tb-note { margin-top: 0.65rem; padding: 0.5rem 0.65rem; border-radius: 8px; font-size: 0.8rem; }
.tb-note.ok { background: rgba(48, 209, 88, 0.1); border: 1px solid rgba(48, 209, 88, 0.35); color: #6ee094; }
.tb-note.bad { background: rgba(255, 69, 58, 0.1); border: 1px solid rgba(255, 69, 58, 0.35); color: #ff8079; }
body.dark .trick-warning-banner {
  margin-top: 0.5rem; padding: 0.4rem 0.6rem; border-radius: 7px;
  background: rgba(255, 159, 10, 0.1); border: 1px solid rgba(255, 159, 10, 0.4);
  font-size: 0.78rem; color: #ffc24d;
}

body.dark .live-dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: var(--red); margin-right: 0.35rem; animation: ping-pulse 1.6s ease-in-out infinite;
}
body.dark .status-badge {
  display: inline-block; font-family: var(--mono); padding: 0.2rem 0.55rem; border-radius: 5px;
  font-size: 0.68rem; font-weight: 600; letter-spacing: 0.1em;
  background: rgba(255, 69, 58, 0.13); color: #ff8079; text-transform: uppercase;
}
.hidden-row { display: none; }

/* pdf import / comparison (dark review) */
.import-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.file-ic {
  width: 44px; height: 44px; border-radius: 11px; flex: none; display: grid; place-items: center;
  background: rgba(255, 69, 58, 0.12); color: #ff8079; border: 1px solid rgba(255, 69, 58, 0.25);
  font-family: var(--mono); font-size: 11px; font-weight: 700;
}
.tiles4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 18px 0 0; }
.stat { background: var(--d-card); border: 1px solid var(--d-stroke); border-radius: 14px; padding: 15px; margin: 0; }
.stat .k { font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--d-faint); }
.stat .n { font-family: var(--rounded); font-weight: 800; font-size: 26px; margin-top: 8px; }
.stat .n.warn { color: var(--amber); }
.stat .n.ok { color: var(--green); }
.stat .u { font-family: var(--mono); font-size: 10px; color: var(--d-dim); margin-top: 3px; }
.legend { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; font-family: var(--mono); font-size: 11px; color: var(--d-mid); }
.legend .ic { font-weight: 700; }
.legend .ic.i { color: #6ee094; } .legend .ic.c { color: #8fb4ff; }
.legend .swatch { display: inline-block; width: 22px; height: 13px; border-radius: 3px; background: rgba(255, 159, 10, 0.22); border: 1px solid rgba(255, 159, 10, 0.45); vertical-align: middle; }
body.dark .cmp { width: 100%; border-collapse: collapse; font-family: var(--mono); font-size: 12px; }
body.dark .cmp th { font-size: 9px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--d-faint); font-weight: 500; padding: 9px 10px; border-bottom: 1px solid var(--d-stroke); text-align: right; white-space: nowrap; background: transparent; }
body.dark .cmp th.grp { text-align: center; color: var(--d-mid); border-bottom: 1px solid var(--d-stroke-soft); }
body.dark .cmp th.l, body.dark .cmp td.l { text-align: left; }
body.dark .cmp td { padding: 9px 10px; border-top: none; border-bottom: 1px solid var(--d-stroke-soft); text-align: right; font-variant-numeric: tabular-nums; color: var(--d-mid); font-size: 12px; }
body.dark .cmp td.l { color: var(--d-text); font-family: var(--sans); font-weight: 600; }
body.dark .cmp .ci { color: #6ee094; } body.dark .cmp .cc { color: #8fb4ff; }
body.dark .cmp td.diff { background: rgba(255, 159, 10, 0.16); color: #ffc24d; font-weight: 700; }
body.dark .cmp tbody tr:hover td { background: rgba(255, 255, 255, 0.02); }
body.dark .cmp tbody tr:hover td.diff { background: rgba(255, 159, 10, 0.22); }

/* warn / info notice cards (duals tie-break guidance) */
.notice {
  border-radius: 12px; padding: 1.1rem 1.25rem; margin-bottom: 1.25rem; font-size: 0.9rem;
  border: 1px solid var(--d-stroke); background: var(--d-card);
}
.notice.warn { background: rgba(255, 159, 10, 0.1); border-color: rgba(255, 159, 10, 0.4); }
.notice.warn .nt { color: #ffc24d; font-weight: 800; font-size: 1rem; margin-bottom: 0.6rem; }
.notice.ok { background: rgba(48, 209, 88, 0.1); border-color: rgba(48, 209, 88, 0.4); color: #6ee094; font-weight: 600; }

/* =====================================================================
   AWARDS PODIUM PARTIAL — dual-styled (legacy default + body.dark)
   ===================================================================== */
.awards > summary {
  padding: 0.75rem 1.25rem; font-weight: 600; font-size: 0.95rem; cursor: pointer;
  background: #f7fafc; border-bottom: 1px solid #e2e8f0; list-style: none;
  display: flex; align-items: center; gap: 0.5rem;
}
.awards .award-cite { margin-left: auto; font-size: 0.8rem; color: #718096; font-weight: 400; }
.awards .award-h {
  font-size: 0.85rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em;
  color: #2d3748; margin: 0 0 0.6rem;
}
.awards .award-sub { font-size: 0.78rem; font-weight: 600; color: #718096; margin-bottom: 0.35rem; }
.awards table tr { border-bottom: 1px solid #f0f4f8; }
.awards table td { border-top: none; padding: 0.2rem 0.4rem; }
.awards table tr:hover td { background: transparent; }
.awards .rk { width: 1.6rem; color: #4a5568; }
.awards .rk.r1 { color: #b7791f; font-weight: 700; }
.awards .rk.r2 { color: #718096; font-weight: 700; }
.awards .rk.r3 { color: #7b4f21; font-weight: 700; }
.awards .award-total { text-align: right; font-variant-numeric: tabular-nums; }
.awards .award-grp { color: #718096; font-size: 0.8rem; }

body.dark .awards > summary { background: rgba(255, 255, 255, 0.03); border-bottom: 1px solid var(--d-stroke); }
body.dark .awards .award-cite { color: var(--d-dim); }
body.dark .awards .award-h { font-family: var(--mono); font-size: 10px; letter-spacing: 0.18em; color: var(--d-faint); font-weight: 500; }
body.dark .awards .award-sub { color: var(--d-dim); }
body.dark .awards table tr { border-bottom: 1px solid var(--d-stroke-soft); }
body.dark .awards .rk { color: var(--d-mid); }
body.dark .awards .rk.r1 { color: #e3b341; }
body.dark .awards .rk.r2 { color: #c3ccdb; }
body.dark .awards .rk.r3 { color: #d08a52; }
body.dark .awards .award-grp { color: var(--d-dim); }

/* =====================================================================
   SCORE SHEET — light, high-contrast surface (body.sheet-mode)
   ===================================================================== */
body.sheet-mode {
  background: var(--paper);
  color: var(--ink);
}
body.sheet-mode .container { max-width: 1080px; padding-bottom: 40px; }

/* rationale note strip */
.why {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.03em; color: var(--ink-dim);
  margin-bottom: 14px;
}
.why .dotk { width: 7px; height: 7px; border-radius: 2px; background: var(--accent-ink); flex: none; }

/* athlete nav header (light) */
.ath-nav {
  display: grid; grid-template-columns: minmax(100px, 1fr) auto minmax(100px, 1fr);
  align-items: center; gap: 14px; margin-bottom: 16px;
}
.ath-nav .nav-btn { min-width: 0; }
.nav-btn {
  text-decoration: none; display: inline-flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 600; color: var(--ink-mid);
  background: var(--sheet); border: 1.5px solid var(--line); border-radius: 10px;
  padding: 9px 13px; transition: border-color 0.13s, background 0.13s;
}
.nav-btn:hover { border-color: var(--line-strong); }
.nav-btn.next { justify-self: end; }
.nav-btn.disabled { opacity: 0.4; cursor: default; pointer-events: none; }
.nav-btn .dir { color: var(--ink-dim); font-size: 15px; }
.ath-id { text-align: center; min-width: 230px; }
.ath-id .bibname { font-family: var(--rounded); font-weight: 800; font-size: 23px; letter-spacing: -0.01em; white-space: nowrap; }
.ath-id .bib { color: var(--accent-ink); }
.ath-id .meta { font-family: var(--mono); font-size: 11px; color: var(--ink-dim); margin-top: 4px; letter-spacing: 0.02em; }
.ath-id .meta a { color: var(--accent-ink); text-decoration: none; }
body.sheet-mode #save-indicator {
  text-align: center; font-family: var(--mono); font-size: 11px; letter-spacing: 0.05em; margin-top: 5px;
  min-height: 1.1em; color: var(--good);
}
body.sheet-mode #save-indicator.saving { color: var(--warn); }
body.sheet-mode #save-indicator.saved { color: var(--good); }
body.sheet-mode #save-indicator.err { color: var(--bad); }

/* bib jump (keyboard-first principle) */
.bibjump {
  display: flex; align-items: center; gap: 8px;
  background: var(--sheet); border: 1.5px solid var(--line); border-radius: 10px; padding: 6px 6px 6px 12px;
}
.bibjump label { font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-dim); margin: 0; display: inline; font-weight: 500; }
.bibjump input {
  width: 64px; border: none; outline: none; background: var(--paper); border-radius: 7px;
  font-family: var(--mono); font-weight: 700; font-size: 16px; text-align: center; color: var(--ink);
  padding: 7px 4px;
}

/* status segmented (light) */
.status-bar {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  background: var(--sheet); border: 1.5px solid var(--line); border-radius: 12px;
  padding: 11px 14px; margin-bottom: 14px;
}
.status-bar .lab { font-family: var(--mono); font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-dim); }
.lseg { display: flex; gap: 3px; background: var(--paper); border: 1.5px solid var(--line); border-radius: 9px; padding: 3px; }
.lseg button {
  appearance: none; border: none; background: transparent; cursor: pointer;
  font-family: var(--sans); font-size: 13px; font-weight: 600; color: var(--ink-mid);
  padding: 6px 14px; border-radius: 6px; transition: background 0.13s, color 0.13s;
}
.lseg button[aria-pressed="true"] { background: var(--ink); color: #fff; }
.lseg button.dnf[aria-pressed="true"], .lseg button.dns[aria-pressed="true"] { background: var(--bad); }

/* surface theme toggle */
.seg {
  display: flex; gap: 2px; background: var(--paper);
  border: 1.5px solid var(--line); border-radius: 8px; padding: 2px;
}
.seg button {
  appearance: none; border: none; background: transparent; cursor: pointer;
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--ink-dim); padding: 5px 10px; border-radius: 6px; transition: background 0.13s, color 0.13s;
}
.seg button[aria-pressed="true"] { background: var(--accent-ink); color: #fff; }

/* score layout */
.score-cols { display: grid; grid-template-columns: 1fr 340px; gap: 16px; align-items: start; }

.lsheet-card { background: var(--sheet); border: 1.5px solid var(--line); border-radius: 14px; overflow: hidden; }
.lsheet-card > .hd {
  display: flex; align-items: center; gap: 9px;
  padding: 11px 15px; border-bottom: 1.5px solid var(--line); background: #fafbfd;
}
.lsheet-card > .hd .t { font-family: var(--mono); font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-mid); font-weight: 600; }
.sect-badge {
  font-family: var(--mono); font-size: 9px; letter-spacing: 0.1em; text-transform: uppercase; font-weight: 600;
  padding: 3px 8px; border-radius: 6px;
}
.sect-badge.tl { color: var(--good); background: var(--good-bg); }
.sect-badge.air { color: var(--accent-ink); background: #e6edfc; }
.sect-badge.speed { color: var(--warn); background: var(--warn-bg); }

/* T&L judge grid */
.tl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 0; }
.tl-cell { padding: 14px 15px; border-right: 1.5px solid var(--line); border-bottom: 1.5px solid var(--line); }
.tl-cell .jh { display: flex; align-items: center; justify-content: space-between; margin-bottom: 9px; gap: 6px; }
.tl-cell .jname { font-size: 13px; font-weight: 700; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-cell .jmax { font-family: var(--mono); font-size: 10px; color: var(--ink-dim); flex: none; }

body.sheet-mode .big-input {
  width: 100%;
  font-family: var(--mono); font-weight: 700; font-size: 30px; text-align: center;
  color: var(--ink); background: var(--paper);
  border: 2px solid var(--line-strong); border-radius: 11px;
  padding: 12px 8px; outline: none;
  transition: border-color 0.12s, background 0.12s, box-shadow 0.12s;
  -moz-appearance: textfield;
  appearance: textfield;
}
body.sheet-mode .big-input::-webkit-outer-spin-button,
body.sheet-mode .big-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
body.sheet-mode .big-input:focus { border-color: var(--accent-ink); background: #fff; box-shadow: 0 0 0 4px rgba(31, 81, 200, 0.13); }
body.sheet-mode .big-input.saved { border-color: var(--good-line); background: var(--good-bg); }
body.sheet-mode .big-input.error-field { border-color: var(--bad-line); background: var(--bad-bg); }
body.sheet-mode .big-input.warning-field { border-color: var(--warn-line) !important; background: var(--warn-bg) !important; }
body.sheet-mode .big-input.sm { font-size: 22px; padding: 9px 6px; }
body.sheet-mode .big-input.computed { cursor: default; background: var(--paper); color: var(--ink-mid); }

.ded-row { display: flex; align-items: center; gap: 9px; margin-top: 9px; }
.ded-row label { font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-dim); flex: none; margin: 0; font-weight: 500; }
body.sheet-mode .ded-row input {
  flex: 1; width: auto; font-family: var(--mono); font-weight: 600; font-size: 16px; text-align: center;
  color: var(--ink); background: var(--paper); border: 1.5px solid var(--line); border-radius: 8px; padding: 6px; outline: none;
  transition: border-color 0.12s, background 0.12s;
}
body.sheet-mode .ded-row input:focus { border-color: var(--accent-ink); background: #fff; box-shadow: none; }
body.sheet-mode .ded-row input.saved { border-color: var(--good-line); background: var(--good-bg); }
body.sheet-mode .ded-row input.error-field { border-color: var(--bad-line); background: var(--bad-bg); }
body.sheet-mode .ded-row input.warning-field { border-color: var(--warn-line) !important; background: var(--warn-bg) !important; }
.tl-total { margin-top: 10px; display: flex; align-items: center; justify-content: space-between; font-family: var(--mono); }
.tl-total .l { font-size: 9.5px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-dim); }
.tl-total .v { font-size: 18px; font-weight: 700; color: var(--ink); }

/* field validation messages on the light sheet */
body.sheet-mode .field-error {
  display: block; font-size: 0.75rem; color: var(--bad);
  margin-top: 0.2rem; min-height: 1em; line-height: 1.3;
}
body.sheet-mode .field-warning {
  display: block; font-size: 0.75rem; color: var(--warn);
  margin-top: 0.2rem; line-height: 1.3;
}

/* Air table (light) */
.air-wrap { padding: 4px; overflow-x: auto; }
body.sheet-mode .air-table { width: 100%; border-collapse: separate; border-spacing: 6px; }
body.sheet-mode .air-table th { font-family: var(--mono); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-dim); font-weight: 600; padding: 4px; text-align: center; border: none; background: transparent; }
body.sheet-mode .air-table th:first-child { text-align: left; width: 150px; }
body.sheet-mode .air-table td { padding: 0; border: none; }
body.sheet-mode .air-table td:first-child { font-size: 12.5px; font-weight: 600; color: var(--ink-mid); white-space: nowrap; padding: 4px; }
body.sheet-mode .air-table tr:hover td { background: transparent; }
body.sheet-mode .air-table .computed {
  font-family: var(--mono); font-weight: 700; font-size: 18px; text-align: center;
  border-radius: 9px; padding: 9px; color: var(--ink);
}
body.sheet-mode .air-table .computed.dd { background: var(--paper); color: var(--ink-mid); font-size: 15px; }
body.sheet-mode .air-table .computed.jump { background: #e6edfc; color: var(--accent-ink); }
body.sheet-mode .air-table .code-in {
  width: 100%; font-family: var(--mono); font-weight: 700; font-size: 17px; text-align: center;
  color: var(--ink); background: var(--paper); border: 2px solid var(--line-strong); border-radius: 9px; padding: 9px 6px; outline: none;
  transition: border-color 0.12s, background 0.12s, box-shadow 0.12s;
}
body.sheet-mode .air-table .code-in:focus { border-color: var(--accent-ink); background: #fff; box-shadow: 0 0 0 4px rgba(31, 81, 200, 0.13); }
body.sheet-mode .air-table .code-in.saved { border-color: var(--good-line); background: var(--good-bg); }
body.sheet-mode .air-table .code-in.error-field { border-color: var(--bad-line); background: var(--bad-bg); }
body.sheet-mode .air-table .code-in.warning-field { border-color: var(--warn-line) !important; background: var(--warn-bg) !important; }
.air-total-row td { padding-top: 6px; }
.air-total-box {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--good-bg); border: 1.5px solid var(--good-line); border-radius: 10px;
  padding: 10px 14px;
}
.air-total-box .l { font-family: var(--mono); font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--good); }
.air-total-box .v { font-family: var(--mono); font-weight: 700; font-size: 22px; color: var(--ink); }

/* speed */
.speed-body { padding: 15px; display: flex; gap: 14px; flex-wrap: wrap; align-items: flex-end; }
.speed-field { flex: 1; min-width: 150px; }
.speed-field label { font-family: var(--mono); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-dim); display: block; margin-bottom: 6px; font-weight: 500; }
.speed-field .pace { font-family: var(--mono); font-size: 11px; color: var(--ink-dim); margin-top: 7px; }
.speed-out {
  font-family: var(--mono); font-weight: 700; font-size: 30px; text-align: center;
  background: var(--warn-bg); border: 2px solid var(--warn-line); border-radius: 11px; padding: 12px; color: var(--ink);
}

/* running total panel (sticky review) */
.total-panel { position: sticky; top: 84px; display: flex; flex-direction: column; gap: 12px; }
.total-card { background: var(--ink); border: 1px solid transparent; border-radius: 16px; padding: 18px; color: #fff; }
.total-card .hh { font-family: var(--mono); font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase; color: rgba(255, 255, 255, 0.5); margin-bottom: 14px; }
.tline { display: flex; align-items: baseline; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.1); }
.tline .l { font-size: 13px; color: rgba(255, 255, 255, 0.72); }
.tline .v { font-family: var(--mono); font-weight: 700; font-size: 18px; font-variant-numeric: tabular-nums; }
.tline.tl .v { color: #6ee094; }
.tline.air .v { color: #8fb4ff; }
.tline.speed .v { color: #ffc24d; }
.grand { margin-top: 6px; padding-top: 14px; display: flex; align-items: baseline; justify-content: space-between; }
.grand .l { font-family: var(--mono); font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: rgba(255, 255, 255, 0.6); }
.grand .v { font-family: var(--rounded); font-weight: 900; font-size: 42px; letter-spacing: -0.02em; }
.total-note {
  background: var(--sheet); border: 1.5px solid var(--line); border-radius: 12px; padding: 13px 15px;
  font-family: var(--mono); font-size: 10.5px; line-height: 1.7; color: var(--ink-dim); letter-spacing: 0.02em;
}
.total-note b { color: var(--ink-mid); }

/* notice card on the light sheet (no judges / not applicable) */
.sheet-note {
  background: var(--sheet); border: 1.5px solid var(--line); border-radius: 14px;
  padding: 1.5rem; text-align: center; color: var(--ink-dim); font-size: 0.9rem;
}

/* messages on light sheet */
body.sheet-mode .messages .success { background: var(--good-bg); border: 1px solid var(--good-line); color: var(--good); }
body.sheet-mode .messages .error { background: var(--bad-bg); border: 1px solid var(--bad-line); color: var(--bad); }
body.sheet-mode .messages .warning { background: var(--warn-bg); border: 1px solid var(--warn-line); color: var(--warn); }

/* ---- dark variant of the score sheet (html.sheet-dark) ---- */
html.sheet-dark body.sheet-mode {
  background: radial-gradient(60% 360px at 50% -10%, var(--glow), transparent 72%), var(--bg);
  color: var(--d-text);
}
html.sheet-dark .nav-btn { background: var(--d-card); border-color: var(--d-stroke); color: var(--d-mid); }
html.sheet-dark .ath-id .bib { color: var(--accent); }
html.sheet-dark .ath-id .meta { color: var(--d-dim); }
html.sheet-dark .ath-id .meta a { color: var(--accent); }
html.sheet-dark .bibjump, html.sheet-dark .status-bar, html.sheet-dark .lsheet-card { background: var(--d-card); border-color: var(--d-stroke); }
html.sheet-dark .bibjump input { background: rgba(0, 0, 0, 0.3); color: var(--d-text); }
html.sheet-dark .bibjump label, html.sheet-dark .status-bar .lab { color: var(--d-dim); }
html.sheet-dark .lseg { background: rgba(0, 0, 0, 0.3); border-color: var(--d-stroke); }
html.sheet-dark .lseg button { color: var(--d-mid); }
html.sheet-dark .lseg button[aria-pressed="true"] { background: var(--accent); color: #fff; }
html.sheet-dark .lseg button.dnf[aria-pressed="true"], html.sheet-dark .lseg button.dns[aria-pressed="true"] { background: var(--red); }
html.sheet-dark .seg { background: rgba(255, 255, 255, 0.06); border-color: var(--d-stroke); }
html.sheet-dark .seg button { color: var(--d-dim); }
html.sheet-dark .seg button[aria-pressed="true"] { background: var(--accent); color: #fff; }
html.sheet-dark .lsheet-card > .hd { background: rgba(255, 255, 255, 0.03); border-color: var(--d-stroke); }
html.sheet-dark .lsheet-card > .hd .t { color: var(--d-mid); }
html.sheet-dark .tl-cell { border-color: var(--d-stroke); }
html.sheet-dark .tl-cell .jname { color: var(--d-text); }
html.sheet-dark .tl-cell .jmax, html.sheet-dark .ded-row label, html.sheet-dark .tl-total .l,
html.sheet-dark body.sheet-mode .air-table th, html.sheet-dark body.sheet-mode .air-table td:first-child,
html.sheet-dark .speed-field label, html.sheet-dark .speed-field .pace { color: var(--d-dim); }
html.sheet-dark .tl-total .v { color: var(--d-text); }
html.sheet-dark body.sheet-mode .big-input { background: rgba(0, 0, 0, 0.3); color: var(--d-text); border-color: rgba(255, 255, 255, 0.18); }
html.sheet-dark body.sheet-mode .big-input:focus { border-color: var(--accent); background: rgba(0, 0, 0, 0.4); box-shadow: 0 0 0 4px rgba(102, 148, 250, 0.2); }
html.sheet-dark body.sheet-mode .big-input.saved { border-color: var(--green); background: rgba(48, 209, 88, 0.12); }
html.sheet-dark body.sheet-mode .big-input.error-field { border-color: var(--red); background: rgba(255, 69, 58, 0.12); }
html.sheet-dark body.sheet-mode .big-input.computed { background: rgba(0, 0, 0, 0.3); color: var(--d-mid); }
html.sheet-dark body.sheet-mode .ded-row input,
html.sheet-dark body.sheet-mode .air-table .code-in { background: rgba(0, 0, 0, 0.3); color: var(--d-text); border-color: rgba(255, 255, 255, 0.14); }
html.sheet-dark body.sheet-mode .air-table .computed.dd { background: rgba(0, 0, 0, 0.3); color: var(--d-mid); }
html.sheet-dark body.sheet-mode .air-table .computed.jump { background: rgba(102, 148, 250, 0.15); color: #8fb4ff; }
html.sheet-dark .air-total-box { background: rgba(48, 209, 88, 0.12); border-color: rgba(48, 209, 88, 0.4); }
html.sheet-dark .air-total-box .l { color: #6ee094; }
html.sheet-dark .air-total-box .v { color: var(--d-text); }
html.sheet-dark .speed-out { background: rgba(255, 159, 10, 0.13); border-color: rgba(255, 159, 10, 0.4); color: var(--d-text); }
html.sheet-dark .total-card { background: rgba(255, 255, 255, 0.05); border: 1px solid var(--d-stroke); }
html.sheet-dark .total-note { background: var(--d-card); border-color: var(--d-stroke); color: var(--d-dim); }
html.sheet-dark .total-note b { color: var(--d-mid); }
html.sheet-dark .sheet-note { background: var(--d-card); border-color: var(--d-stroke); color: var(--d-dim); }
html.sheet-dark body.sheet-mode #save-indicator { color: var(--green); }
html.sheet-dark body.sheet-mode #save-indicator.saving { color: var(--amber); }
html.sheet-dark body.sheet-mode #save-indicator.err { color: var(--red); }
html.sheet-dark .why { color: var(--d-dim); }
html.sheet-dark .why .dotk { background: var(--accent); }
html.sheet-dark body.sheet-mode .field-error { color: #ff8079; }
html.sheet-dark body.sheet-mode .field-warning { color: #ffc24d; }
html.sheet-dark body.sheet-mode .messages .success { background: rgba(48, 209, 88, 0.12); border-color: rgba(48, 209, 88, 0.35); color: #6ee094; }
html.sheet-dark body.sheet-mode .messages .error { background: rgba(255, 69, 58, 0.12); border-color: rgba(255, 69, 58, 0.35); color: #ff8079; }
html.sheet-dark body.sheet-mode .messages .warning { background: rgba(255, 159, 10, 0.12); border-color: rgba(255, 159, 10, 0.35); color: #ffc24d; }

/* =====================================================================
   DUALS — light match-entry card (hybrid surface on the dark shell)
   ===================================================================== */
.match-entry { background: var(--sheet); border: 1.5px solid var(--line); border-radius: 16px; padding: 18px; color: var(--ink); }
.match-entry .meh { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; flex-wrap: wrap; gap: 10px; }
.match-entry .meh .t { font-family: var(--mono); font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-mid); }
body.dark .match-entry label { color: var(--ink-mid); }
body.dark .match-entry table th { color: var(--ink-dim); border-bottom: 1.5px solid var(--line); background: transparent; font-family: var(--mono); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; font-weight: 600; }
body.dark .match-entry table td { border-top: 1px solid var(--line); color: var(--ink); }
body.dark .match-entry table tr:hover td { background: transparent; }
body.dark .match-entry input[type=number] {
  width: 5rem; text-align: center;
  font-family: var(--mono); font-weight: 700; font-size: 16px;
  color: var(--ink); background: var(--paper); border: 1.5px solid var(--line-strong); border-radius: 8px; padding: 6px;
}
body.dark .match-entry input[type=number]:focus { border-color: var(--accent-ink); background: #fff; box-shadow: 0 0 0 3px rgba(31, 81, 200, 0.13); }
.vs-head { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 14px; margin-bottom: 16px; }
.vs-head .pl { text-align: center; }
.vs-head .pl .nm { font-family: var(--rounded); font-weight: 800; font-size: 18px; }
.vs-head .pl .sd { font-family: var(--mono); font-size: 11px; color: var(--ink-dim); margin-top: 3px; }
.lane-tag { font-family: var(--mono); font-size: 9px; letter-spacing: 0.1em; text-transform: uppercase; padding: 2px 7px; border-radius: 5px; color: #fff; margin-left: 6px; vertical-align: middle; }
.lane-tag.blue { background: #1565c0; } .lane-tag.red { background: #e53935; }
.vs-head .vs { font-family: var(--rounded); font-weight: 900; font-size: 18px; color: var(--ink-dim); }
.win-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.win-btn {
  appearance: none; cursor: pointer; border: none; color: #fff; border-radius: 12px; padding: 18px;
  font-family: var(--sans); font-size: 16px; font-weight: 800; transition: filter 0.13s, transform 0.05s;
}
.win-btn:hover { filter: brightness(1.07); }
.win-btn:active { transform: translateY(1px); }
.win-btn.blue { background: #1565c0; } .win-btn.red { background: #e53935; }
.me-note { font-family: var(--mono); font-size: 10px; letter-spacing: 0.04em; color: var(--ink-dim); margin-top: 14px; display: flex; align-items: center; gap: 8px; }
.me-note .dotk { width: 7px; height: 7px; border-radius: 2px; background: var(--accent-ink); flex: none; }

/* ===================== responsive ===================== */
@media (max-width: 860px) {
  .comp-grid { grid-template-columns: 1fr; }
  .layout-2 { grid-template-columns: 1fr; }
  .score-cols { grid-template-columns: 1fr; }
  .total-panel { position: static; }
  .tiles4 { grid-template-columns: repeat(2, 1fr); }
  .ath-nav { grid-template-columns: 1fr; justify-items: center; }
  .ath-nav .nav-btn.next { justify-self: center; }
}
@media (max-width: 520px) {
  .formset-row { grid-template-columns: 1fr; }
  .jump-pair { grid-template-columns: 1fr; }
}
