:root {
  color-scheme: light;
  --primary: #111111;
  --primary-active: #242424;
  --brand-accent: #3b82f6;
  --surface-soft: #f8f9fa;
  --surface-card: #f5f5f5;
  --hairline-soft: #f3f4f6;
  --surface-strong: #e5e7eb;
  --success: #10b981;
  --success-ink: #047857;
  --success-surface: #d1fae5;
  --warning-ink: #92400e;
  --warning-surface: #fef3c7;
  --error: #ef4444;
  --error-ink: #b91c1c;
  --error-surface: #fee2e2;
  --photo-ink: #6d28d9;
  --photo-surface: #ede9fe;
  --ink: var(--primary);
  --ink-soft: #374151;
  --muted: #6b7280;
  --paper: var(--white);
  --white: #fff;
  --line: var(--surface-strong);
  --line-strong: #d1d5db;
  --teal: var(--brand-accent);
  --teal-dark: var(--primary);
  --lime: var(--surface-card);
  --coral: #fb923c;
  --gold: #fb923c;
  --font-ui: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-display: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-family: var(--font-ui);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  background: var(--paper);
  color: var(--ink);
}

* { box-sizing: border-box; }

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background-color: var(--paper);
  background-image: none;
}

button, input, select { font: inherit; }
button { color: inherit; }
a { color: inherit; text-decoration: none; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.app-shell { width: min(1200px, 100%); margin: 0 auto; padding: 0 28px 40px; }
.topbar { height: 64px; display: grid; grid-template-columns: 1fr minmax(220px, 420px) 1fr; align-items: center; gap: 24px; border-bottom: 1px solid var(--line-strong); }
.brand { display: inline-flex; align-items: center; gap: 11px; width: fit-content; font-size: 13px; font-weight: 700; letter-spacing: 0.08em; }
.brand-light { color: var(--teal); }
.brand-mark { width: 25px; height: 25px; display: flex; align-items: center; justify-content: center; gap: 3px; transform: skew(-18deg); }
.brand-mark i { display: block; width: 4px; border-radius: 5px; background: var(--teal); }
.brand-mark i:nth-child(1) { height: 14px; }
.brand-mark i:nth-child(2) { height: 22px; background: var(--coral); }
.brand-mark i:nth-child(3) { height: 17px; }
.event-picker { display: flex; justify-content: center; }
.event-picker select { width: 100%; max-width: 360px; padding: 10px 36px 10px 14px; border: 1px solid var(--line); border-radius: 8px; appearance: none; color: var(--ink); background: var(--white) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='m1 1 5 5 5-5' fill='none' stroke='%233b82f6' stroke-width='1.7'/%3E%3C/svg%3E") no-repeat right 13px center; font-size: 14px; font-weight: 500; }
.topbar-right { display: flex; justify-content: flex-end; align-items: center; gap: 17px; }
.live-indicator { display: inline-flex; align-items: center; gap: 8px; color: var(--teal-dark); font-size: 11px; font-weight: 700; letter-spacing: 0.12em; }
.live-indicator i, .sync-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--coral); box-shadow: 0 0 0 4px rgb(251 146 60 / 15%); }
.icon-button { width: 36px; height: 36px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 9999px; background: var(--white); cursor: pointer; transition: border-color 160ms ease, background 160ms ease; }
.icon-button:hover { border-color: var(--teal); background: var(--surface-soft); }
.icon-button svg, .search-field svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.6; }

.event-band { min-height: 0; position: relative; display: flex; align-items: center; justify-content: space-between; margin: 24px 0 20px; padding: 28px 32px; overflow: hidden; border-bottom: 1px solid var(--line); color: var(--ink); background: var(--white); }
.event-band::before { display: none; }
.event-copy { position: relative; z-index: 1; max-width: 760px; }
.kicker { display: flex; align-items: center; gap: 9px; margin: 0 0 12px; color: var(--teal); font-size: 10px; font-weight: 700; letter-spacing: 0.13em; text-transform: uppercase; }
.event-band .kicker { color: var(--muted); }
.kicker-line { width: 18px; height: 2px; display: inline-block; background: var(--coral); }
.event-band h1 { margin: 0; font-family: var(--font-display); font-size: clamp(32px, 4vw, 48px); font-weight: 600; line-height: 1.1; letter-spacing: -0.04em; }
.event-meta { min-height: 21px; margin: 10px 0 0; color: var(--muted); font-size: 14px; line-height: 1.5; }
.event-stamp { position: relative; z-index: 1; width: 120px; min-width: 120px; height: 104px; display: flex; flex-direction: column; align-items: center; justify-content: center; margin-right: 0; border: 1px solid var(--line); border-radius: 16px; transform: none; color: var(--ink); background: var(--surface-card); }
.event-stamp strong { font-family: var(--font-display); font-size: 48px; font-weight: 600; line-height: 1; letter-spacing: -0.04em; }
.stamp-top, .stamp-bottom { font-size: 9px; font-weight: 600; letter-spacing: 0.08em; color: var(--muted); }
.stamp-top { margin-bottom: 7px; }

.event-day-picker:not([hidden]) { width: fit-content; max-width: 100%; display: flex; align-items: center; gap: 4px; margin: 0 0 16px; padding: 5px; overflow-x: auto; border-radius: 9999px; background: var(--surface-soft); }
.event-day-caption { flex-shrink: 0; padding: 0 9px; color: var(--muted); font-size: 11px; font-weight: 500; }
.event-day-button { min-width: 86px; min-height: 42px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; padding: 5px 12px; border: 0; border-radius: 9999px; color: var(--muted); background: transparent; cursor: pointer; white-space: nowrap; }
.event-day-button[aria-pressed="true"] { color: var(--ink); background: var(--white); box-shadow: 0 1px 2px rgb(0 0 0 / 8%); }
.event-day-weekday { font-size: 10px; font-weight: 500; line-height: 1.1; }
.event-day-date { font-size: 13px; font-weight: 600; line-height: 1.2; }

.info-box { margin: 0 0 20px; padding: 18px 22px; border: 1px solid var(--line); border-radius: 12px; color: var(--ink); background: var(--surface-card); }
.info-box[hidden] { display: none; }
.info-box h1, .info-box h2, .info-box h3 { margin: 0 0 6px; font-family: var(--font-display); font-weight: 600; }
.info-box h2 { font-size: 25px; }
.info-box p { margin: 5px 0 0; color: var(--ink-soft); font-size: 13px; line-height: 1.55; }
.info-box a { color: var(--teal); text-decoration: underline; text-underline-offset: 2px; }
.info-box ul, .info-box ol { margin: 8px 0 0; padding-left: 20px; color: var(--ink-soft); font-size: 13px; line-height: 1.55; }

.event-ad-slot { margin: 0 0 14px; }
.event-ad-slot[hidden] { display: none; }
.advertisement { min-width: 0; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-card); }
.advertisement-content { min-width: 0; display: grid; grid-template-columns: 132px minmax(0, 1fr) auto; align-items: center; gap: 16px; padding: 12px 16px; color: var(--ink); }
.advertisement-content.advertisement-no-image { grid-template-columns: minmax(0, 1fr) auto; }
.advertisement a.advertisement-content { text-decoration: none; }
.advertisement-image { width: 132px; height: 72px; display: block; border-radius: 6px; object-fit: cover; background: var(--white); }
.advertisement-copy { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.advertisement-label { width: fit-content; padding: 3px 7px; border-radius: 9999px; color: var(--ink-soft); background: var(--surface-strong); font-size: 8px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.advertisement-title { color: var(--ink); font-size: 13px; font-weight: 700; }
.advertisement-description { color: var(--ink-soft); font-size: 11px; line-height: 1.45; }
.advertisement-action { color: var(--ink); font-size: 10px; font-weight: 700; white-space: nowrap; }
.advertisement-event { overflow: hidden; }
.advertisement-race { grid-column: 1 / -1; }
.advertisement-race .advertisement-content { grid-template-columns: 96px minmax(0, 1fr) auto; }
.advertisement-race .advertisement-image { width: 96px; height: 56px; }
.stamp-bottom { margin-top: 9px; }
.event-stripe { display: none; }

.view-toolbar { min-height: 48px; display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 0 0 12px; }
.view-tabs { display: inline-flex; align-items: stretch; gap: 3px; padding: 5px; border: 0; border-radius: 9999px; background: var(--surface-soft); }
.view-tab { min-height: 40px; padding: 0 16px; border: 0; border-radius: 9999px; color: var(--muted); background: transparent; font-size: 14px; font-weight: 500; cursor: pointer; }
.view-tab[aria-pressed="true"] { color: var(--ink); background: var(--white); box-shadow: 0 1px 2px rgb(0 0 0 / 8%); }
.jump-button { min-height: 40px; display: inline-flex; align-items: center; justify-content: center; gap: 9px; padding: 0 20px; border: 1px solid var(--primary); border-radius: 8px; color: var(--white); background: var(--primary); font-size: 14px; font-weight: 600; cursor: pointer; transition: color 150ms ease, background 150ms ease, border-color 150ms ease; }
.jump-button:hover:not(:disabled) { background: var(--primary-active); border-color: var(--primary-active); }
.jump-button:disabled { border-color: var(--line); color: #6b7280; background: var(--hairline-soft); cursor: not-allowed; }
.jump-button svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.6; }

.workspace { display: grid; grid-template-columns: 315px minmax(0, 1fr); min-height: 610px; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--white); }
.workspace.is-schedule { grid-template-columns: minmax(0, 1fr); }
.workspace.is-schedule .race-sidebar, .workspace.is-schedule .results-panel { display: none; }
.race-sidebar { display: flex; flex-direction: column; min-width: 0; border-right: 1px solid var(--line); background: var(--surface-soft); }
.sidebar-heading { display: flex; align-items: flex-end; justify-content: space-between; padding: 26px 22px 19px; }
.sidebar-heading .kicker { margin-bottom: 5px; }
.sidebar-heading h2, .results-heading h2 { margin: 0; font-family: var(--font-display); font-size: 30px; font-weight: 600; line-height: 1.15; letter-spacing: -0.04em; }
.section-index { color: var(--muted); font-size: 9px; font-weight: 700; letter-spacing: 0.1em; }
.search-field { height: 40px; display: flex; align-items: center; gap: 9px; margin: 0 16px 14px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; color: var(--muted); background: var(--white); }
.search-field input { width: 100%; min-width: 0; padding: 0; border: 0; outline: 0; color: var(--ink); background: transparent; font-size: 14px; }
.search-field input::placeholder { color: #6b7280; }
.search-field kbd { padding: 2px 5px; border: 1px solid var(--line); border-radius: 2px; color: var(--muted); font-size: 10px; }
.race-list { flex: 1; overflow-y: auto; padding: 0 9px 16px; }
.race-item { width: 100%; min-height: 68px; display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; align-items: center; gap: 9px; padding: 9px 10px; border: 0; border-bottom: 1px solid var(--hairline-soft); text-align: left; background: transparent; cursor: pointer; transition: background 140ms ease; }
.race-item:hover { background: var(--surface-soft); }
.race-item.is-selected { background: var(--surface-card); box-shadow: inset 3px 0 0 var(--teal); }
.race-number { width: 35px; height: 35px; display: grid; place-items: center; border-radius: 9999px; color: var(--teal-dark); background: var(--surface-card); font-family: var(--font-display); font-size: 20px; font-weight: 600; }
.race-copy { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.race-copy strong { overflow: hidden; color: var(--ink); font-size: 12px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.race-copy small { color: var(--muted); font-size: 10px; }
.race-status { padding: 5px 8px; border-radius: 9999px; font-size: 8px; font-weight: 700; text-align: center; text-transform: uppercase; }
.race-status-scheduled { color: var(--warning-ink); background: var(--warning-surface); }
.race-status-live { color: var(--success-ink); background: var(--success-surface); }
.race-status-official { color: var(--success-ink); background: var(--success-surface); }
.race-status-unofficial { color: var(--warning-ink); background: var(--warning-surface); }
.race-status-photofinish { color: var(--photo-ink); background: var(--photo-surface); }
.race-status-cancelled { color: var(--error-ink); background: var(--error-surface); }
.crew-change-badge { width: fit-content; padding: 3px 6px; color: var(--error-ink); background: #fae5df; font-size: 8px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }
.sidebar-empty { padding: 16px; color: var(--muted); font-size: 12px; }
.sidebar-foot { display: flex; align-items: center; gap: 9px; padding: 15px 17px; border-top: 1px solid var(--line); color: var(--muted); font-size: 10px; }
.route-symbol { width: 19px; height: 8px; display: inline-block; border-top: 1px solid var(--coral); border-bottom: 1px solid var(--teal); transform: skew(-25deg); }

.results-panel { min-width: 0; display: flex; flex-direction: column; padding: 0 28px; }
.results-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; padding: 27px 0 23px; border-bottom: 1px solid var(--line); }
.results-heading .kicker { margin-bottom: 9px; }
.results-heading h2 { max-width: 750px; font-size: 34px; }
.results-meta { margin: 8px 0 0; color: var(--ink-soft); font-size: 12px; }
.sync-status { display: inline-flex; align-items: center; gap: 9px; flex-shrink: 0; padding-top: 8px; color: var(--muted); font-size: 11px; }
.sync-status[data-tone="good"] { color: var(--success-ink); }
.sync-status[data-tone="bad"] { max-width: 240px; color: var(--error); }
.sync-status[data-tone="bad"] .sync-dot { background: var(--coral); }
.sync-status[data-tone="good"] .sync-dot { background: var(--success); box-shadow: 0 0 0 4px rgb(16 185 129 / 14%); }
.result-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-content: start; gap: 15px; padding: 20px 0; }
.heat { min-width: 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--white); animation: arrive 320ms ease both; }
.heat-heading { min-height: 74px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 15px; border-bottom: 1px solid var(--hairline-soft); }
.heat-copy { min-width: 0; }
.eyebrow { display: block; margin-bottom: 4px; color: var(--teal); font-size: 9px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; }
.heat-copy h3 { overflow: hidden; margin: 0; font-family: var(--font-display); font-size: 21px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.heat-meta { flex-shrink: 0; display: flex; align-items: center; gap: 11px; }
.heat-start-time { display: flex; align-items: center; gap: 6px; color: var(--teal-dark); }
.heat-start-time svg { width: 17px; height: 17px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.7; }
.heat-start-copy { display: flex; flex-direction: column; gap: 1px; }
.heat-start-label { color: var(--muted); font-size: 8px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.heat-start-value { color: var(--teal-dark); font-size: 12px; font-weight: 700; white-space: nowrap; }
.status { flex-shrink: 0; padding: 5px 9px; border-radius: 9999px; font-size: 9px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }
.status-scheduled { color: var(--warning-ink); background: var(--warning-surface); }
.status-live { color: var(--success-ink); background: var(--success-surface); }
.status-official { color: var(--success-ink); background: var(--success-surface); }
.status-unofficial { color: var(--warning-ink); background: var(--warning-surface); }
.status-photofinish { color: var(--photo-ink); background: var(--photo-surface); }
.status-cancelled { color: var(--error-ink); background: var(--error-surface); }
.lane-list { min-height: 72px; }
.lane-row { min-height: 68px; display: grid; grid-template-columns: 34px minmax(0, 1fr) minmax(70px, auto); align-items: center; gap: 10px; padding: 9px 14px; border-bottom: 1px solid var(--hairline-soft); }
.lane-row:last-child { border-bottom: 0; }
.lane-row[role="button"] { cursor: pointer; transition: background 130ms ease; }
.lane-row[role="button"]:hover, .lane-row[role="button"]:focus-visible { outline: 0; background: var(--surface-soft); }
.lane-row[role="button"]:focus-visible { box-shadow: inset 0 0 0 2px var(--teal); }
.lane-row.is-withdrawn .lane-identity { opacity: 0.55; }
.lane-number { width: 30px; height: 30px; display: grid; place-items: center; border: 1px solid var(--surface-strong); color: var(--teal-dark); background: var(--surface-card); font-family: var(--font-display); font-size: 17px; font-weight: 600; }
.lane-identity { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.lane-identity strong { overflow: hidden; color: var(--ink); font-size: 11px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.lane-identity small { overflow: hidden; color: var(--muted); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.lane-result { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.lane-result strong { color: var(--teal-dark); font-family: var(--font-display); font-size: 23px; font-weight: 600; line-height: 1; }
.lane-result small { color: var(--muted); font-size: 9px; }
.heat-empty, .no-heats { padding: 18px; color: var(--muted); font-size: 12px; }
.heat-footer { min-height: 34px; display: flex; align-items: center; justify-content: space-between; padding: 7px 14px; border-top: 1px solid var(--hairline-soft); color: var(--muted); background: var(--surface-soft); font-size: 9px; }
.heat-footer span:only-child { margin-left: auto; }
.panel-footer { display: flex; justify-content: space-between; gap: 12px; margin-top: auto; padding: 13px 0 15px; border-top: 1px solid var(--line); color: #898989; font-size: 8px; font-weight: 700; letter-spacing: 0.12em; }
.panel-footer b { color: var(--coral); }
.empty-state { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 300px; text-align: center; }
.empty-state[hidden] { display: none; }
.empty-mark { height: 45px; display: flex; align-items: center; gap: 6px; margin-bottom: 17px; transform: skew(-16deg); }
.empty-mark span { width: 6px; height: 28px; background: var(--teal); }
.empty-mark span:nth-child(2) { height: 43px; background: var(--coral); }
.empty-mark span:nth-child(3) { height: 34px; background: var(--lime); }
.empty-state h3 { margin: 0; font-family: var(--font-display); font-size: 28px; font-weight: 600; }
.empty-state p { margin: 8px 0 0; color: var(--muted); font-size: 12px; }
.no-heats { grid-column: 1 / -1; padding: 35px 20px; border: 1px dashed var(--line-strong); text-align: center; }

.schedule-panel { min-width: 0; display: flex; flex-direction: column; padding: 0 28px; }
.schedule-panel[hidden] { display: none; }
.schedule-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; padding: 26px 0 21px; border-bottom: 1px solid var(--line); }
.schedule-heading .kicker { margin-bottom: 8px; }
.schedule-heading h2 { margin: 0; font-family: var(--font-display); font-size: 34px; font-weight: 600; line-height: 1.15; letter-spacing: -0.04em; }
.schedule-list { display: flex; flex-direction: column; padding: 7px 0 22px; }
.schedule-row { width: 100%; min-height: 72px; display: grid; grid-template-columns: 94px 50px minmax(0, 1fr) auto; align-items: center; gap: 16px; padding: 10px 14px; border: 0; border-bottom: 1px solid var(--hairline-soft); text-align: left; background: transparent; cursor: pointer; transition: background 140ms ease; }
.schedule-row:hover { background: var(--surface-soft); }
.schedule-time { color: var(--teal); font-family: var(--font-display); font-size: 23px; font-weight: 600; }
.schedule-number { width: 38px; height: 38px; display: grid; place-items: center; color: var(--teal-dark); background: var(--surface-card); font-family: var(--font-display); font-size: 21px; font-weight: 600; }
.schedule-description { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.schedule-description strong { overflow: hidden; color: var(--ink); font-size: 12px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.schedule-description small { color: var(--muted); font-size: 10px; }
.schedule-empty { margin: 18px 0; padding: 28px; border: 1px dashed var(--line-strong); color: var(--muted); text-align: center; font-size: 12px; }
.heat.is-jump-target { border-color: var(--coral); box-shadow: 0 0 0 3px rgb(251 146 60 / 17%); }

.workspace.is-directory { grid-template-columns: minmax(0, 1fr); }
.workspace.is-directory .race-sidebar,
.workspace.is-directory .results-panel,
.workspace.is-directory .schedule-panel { display: none; }
.directory-panel { min-width: 0; display: flex; flex-direction: column; padding: 0 28px; }
.directory-panel[hidden] { display: none; }
.directory-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; padding: 26px 0 21px; border-bottom: 1px solid var(--line); }
.directory-heading .kicker { margin-bottom: 8px; }
.directory-heading h2 { margin: 0; font-family: var(--font-display); font-size: 34px; font-weight: 600; line-height: 1.15; letter-spacing: -0.04em; }
.directory-search-field { max-width: 470px; margin: 17px 0; }
.directory-actions { display: flex; align-items: center; justify-content: flex-end; gap: 9px; flex-wrap: wrap; }
.directory-action { min-height: 40px; display: inline-flex; align-items: center; justify-content: center; padding: 0 14px; border: 1px solid var(--line); border-radius: 8px; color: var(--teal-dark); background: var(--white); font-size: 14px; font-weight: 600; cursor: pointer; }
.directory-action:hover { border-color: var(--teal); background: var(--surface-soft); }
.directory-action[hidden] { display: none; }
.directory-copy-status { color: var(--teal-dark); font-size: 10px; }
.directory-results { min-width: 0; padding: 0 0 24px; }
.directory-table-wrap { max-height: min(70vh, 760px); overflow: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--white); }
.directory-table { width: 100%; border-collapse: separate; border-spacing: 0; color: var(--ink); background: var(--white); font-size: 11px; }
.directory-table th, .directory-table td { padding: 10px 12px; border-bottom: 1px solid var(--hairline-soft); text-align: left; vertical-align: top; }
.directory-table th { position: sticky; z-index: 1; top: 0; color: var(--ink-soft); background: var(--surface-soft); font-size: 9px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; white-space: nowrap; }
.directory-table tbody tr:nth-child(even) { background: var(--surface-soft); }
.directory-table tbody tr:hover { background: var(--surface-soft); }
.directory-club-link { padding: 0; border: 0; color: var(--teal-dark); background: transparent; font: inherit; font-weight: 700; text-align: left; text-decoration: underline; text-decoration-color: transparent; text-underline-offset: 3px; cursor: pointer; }
.directory-club-link:hover, .directory-club-link:focus-visible { color: var(--teal); text-decoration-color: currentColor; }
.directory-club-link:focus-visible { outline: 2px solid var(--teal); outline-offset: 3px; }
.directory-empty { margin: 0; padding: 30px 18px; border: 1px dashed var(--line-strong); color: var(--muted); text-align: center; font-size: 12px; }

.boat-dialog { width: min(540px, calc(100% - 28px)); max-height: min(86vh, 760px); position: fixed; inset: 0; overflow: auto; padding: 27px; border: 1px solid var(--line); border-radius: 16px; color: var(--ink); background: var(--white); box-shadow: 0 4px 20px rgb(0 0 0 / 12%); }
.boat-dialog::backdrop { background: rgb(17 17 17 / 45%); }
.boat-dialog-close { position: sticky; top: 0; float: right; z-index: 1; margin: -12px -12px 0 12px; }
.boat-details { clear: both; }
.boat-detail-heading { padding: 7px 0 20px; border-bottom: 1px solid var(--line); }
.boat-detail-heading .kicker { margin-bottom: 8px; }
.boat-detail-heading h2 { margin: 0; font-family: var(--font-display); font-size: 34px; font-weight: 600; line-height: 1.15; letter-spacing: -0.04em; }
.boat-detail-club { margin: 8px 0 0; color: var(--ink-soft); font-size: 12px; line-height: 1.5; }
.boat-detail-summary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.boat-detail-field { display: flex; flex-direction: column; gap: 5px; }
.boat-detail-field span { color: var(--muted); font-size: 9px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; }
.boat-detail-field strong { font-size: 12px; }
.boat-section-title { margin: 19px 0 8px; font-family: var(--font-display); font-size: 22px; font-weight: 600; }
.crew-list, .boat-result-list { margin: 0; padding: 0; list-style: none; }
.crew-list li { min-height: 55px; display: grid; grid-template-columns: 40px minmax(0, 1fr); align-items: center; gap: 10px; border-bottom: 1px solid var(--hairline-soft); }
.crew-position { width: 32px; height: 32px; display: grid; place-items: center; color: var(--teal-dark); background: var(--surface-card); font-size: 10px; font-weight: 700; }
.crew-person { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.crew-person strong { font-size: 12px; }
.crew-person .crew-change-badge { margin-top: 2px; }
.crew-person small { color: var(--muted); font-size: 10px; }
.crew-list .crew-empty { display: block; padding: 13px 0; color: var(--muted); font-size: 12px; }
.crew-change-list { display: grid; gap: 7px; margin: 0; padding: 0; list-style: none; }
.crew-change-list li { display: grid; grid-template-columns: 90px minmax(0, 1fr); align-items: center; gap: 5px 10px; padding: 9px 10px; border-left: 3px solid var(--line-strong); background: var(--surface-soft); }
.crew-change-list .crew-change-added { border-left-color: var(--teal); }
.crew-change-list .crew-change-removed { border-left-color: var(--coral); }
.crew-change-list li > span { grid-row: span 2; color: var(--ink-soft); font-size: 10px; font-weight: 700; }
.crew-change-list li > strong { font-size: 11px; }
.crew-change-list li > small { color: var(--muted); font-size: 9px; }
.boat-result-list li { min-height: 40px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--hairline-soft); font-size: 11px; }
.boat-result-list li span { color: var(--ink-soft); }
.boat-result-list li strong { color: var(--teal-dark); font-family: var(--font-display); font-size: 20px; }

@keyframes arrive { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 900px) {
  .app-shell { padding: 0 20px 30px; }
  .workspace { grid-template-columns: 270px minmax(0, 1fr); }
  .results-panel { padding: 0 20px; }
  .result-list { grid-template-columns: 1fr; }
  .event-stamp { margin-right: 3%; }
  .schedule-panel { padding: 0 20px; }
  .directory-panel { padding: 0 20px; }
  .directory-table-wrap { max-height: 72vh; }
}

@media (max-width: 650px) {
  .app-shell { padding: 0 12px 20px; }
  .topbar { height: auto; min-height: 64px; grid-template-columns: 1fr auto; gap: 10px; padding: 10px 0; }
  .event-picker { grid-row: 2; grid-column: 1 / -1; justify-content: stretch; }
  .event-picker select { max-width: none; }
  .topbar-right { grid-column: 2; grid-row: 1; }
  .view-toolbar { align-items: stretch; flex-direction: column; gap: 8px; }
  .view-tabs { width: 100%; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .view-tab { min-width: 0; padding: 0 4px; font-size: 11px; }
  .jump-button { width: 100%; max-width: none; padding: 0 9px; font-size: 13px; }
  .jump-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .event-band { min-height: 0; margin: 15px 0; padding: 22px 18px; }
  .event-day-picker:not([hidden]) { width: 100%; justify-content: flex-start; margin-bottom: 12px; }
  .event-day-caption { padding: 0 7px; }
  .event-day-button { min-width: 76px; padding: 5px 9px; }
  .info-box { margin-bottom: 14px; padding: 14px 16px; }
  .info-box h2 { font-size: 22px; }
  .advertisement-content, .advertisement-race .advertisement-content { grid-template-columns: 72px minmax(0, 1fr); gap: 10px; padding: 10px; }
  .advertisement-content.advertisement-no-image { grid-template-columns: minmax(0, 1fr) auto; }
  .advertisement-image, .advertisement-race .advertisement-image { width: 72px; height: 56px; }
  .advertisement-action { grid-column: 2; }
  .event-band h1 { max-width: 75%; font-size: clamp(28px, 8vw, 36px); }
  .event-meta { max-width: 80%; font-size: 12px; line-height: 1.5; }
  .event-stamp { width: 76px; min-width: 76px; height: 76px; margin: 0 0 0 10px; border-radius: 12px; }
  .event-stamp strong { font-size: 45px; }
  .stamp-top, .stamp-bottom { font-size: 6px; letter-spacing: 0.04em; }
  .workspace { display: flex; flex-direction: column; }
  .race-sidebar { border-right: 0; border-bottom: 1px solid var(--line); }
  .sidebar-heading { padding: 18px 16px 14px; }
  .race-list { max-height: 218px; display: grid; grid-auto-columns: minmax(255px, 88%); grid-auto-flow: column; gap: 0; overflow-x: auto; overflow-y: hidden; padding: 0 9px 8px; }
  .race-item { height: 64px; border-right: 1px solid var(--hairline-soft); border-bottom: 0; }
  .sidebar-foot { display: none; }
  .results-panel { min-height: 430px; padding: 0 15px; }
  .results-heading { flex-direction: column; gap: 6px; padding: 21px 0 16px; }
  .results-heading h2 { font-size: 29px; }
  .sync-status { padding-top: 0; }
  .result-list { gap: 11px; padding: 13px 0; }
  .panel-footer { font-size: 7px; }
  .schedule-panel { padding: 0 15px; }
  .directory-panel { padding: 0 15px; }
  .directory-heading { align-items: flex-start; flex-direction: column; padding: 21px 0 16px; }
  .directory-actions { justify-content: flex-start; }
  .directory-heading h2 { font-size: 29px; }
  .directory-search-field { max-width: none; }
  .directory-table-wrap { max-height: 68vh; }
  .directory-table th, .directory-table td { padding: 8px 9px; }
  .boat-dialog { padding: 21px; }
  .boat-detail-heading h2 { font-size: 29px; }
  .schedule-heading { align-items: flex-start; padding: 21px 0 16px; }
  .schedule-heading h2 { font-size: 29px; }
  .schedule-row { grid-template-columns: 58px 34px minmax(0, 1fr); gap: 9px; padding: 10px 4px; }
  .schedule-time { font-size: 18px; }
  .schedule-number { width: 30px; height: 30px; font-size: 17px; }
  .schedule-row .status { grid-column: 3; justify-self: start; margin-top: -3px; }
}

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