/* Rally HQ Blueprint Prototype — Shared CSS
 *
 * Ports Midnight & Indigo tokens from Rally HQ DESIGN.md into a
 * standalone stylesheet so prototype HTML renders without the SvelteKit app.
 * (System renamed from "Midnight & Copper" 2026-05-26 — there is no copper
 * hue in the palette.)
 *
 * Deviations from shipped (per blueprint/DESIGN-PRINCIPLES.md):
 *   - Space Grotesk as display font (was: Sora-for-everything)
 *   - JetBrains Mono for data atoms (court numbers, times, seeds)
 *   - --tournament-accent CSS variable per-tournament override
 *   - LIVE pulse component (new)
 *   - Action-overlay pattern (new)
 */

/* ─────────────── tokens ─────────────── */

:root {
  /* Brand — Electric Indigo */
  --brand-50:  hsl(235, 95%, 97%);
  --brand-100: hsl(235, 95%, 92%);
  --brand-300: hsl(235, 95%, 75%);
  --brand-500: hsl(235, 80%, 60%);
  --brand-600: hsl(235, 75%, 50%);
  --brand-700: hsl(235, 80%, 40%);
  --brand-900: hsl(235, 90%, 20%);

  /* Arena — Navy-based neutral */
  --arena-50:  hsl(220, 25%, 98%);
  --arena-100: hsl(220, 20%, 96%);
  --arena-200: hsl(220, 18%, 90%);
  --arena-300: hsl(220, 15%, 81%);
  --arena-400: hsl(220, 12%, 69%);
  --arena-500: hsl(220, 10%, 54%);
  --arena-600: hsl(220, 15%, 40%);
  --arena-700: hsl(220, 20%, 27%);
  --arena-800: hsl(220, 25%, 18%);
  --arena-900: hsl(220, 30%, 12%);
  --arena-950: hsl(220, 30%, 6%);

  /* Victory — Gold */
  --victory-300: hsl(45, 85%, 65%);
  --victory-500: hsl(45, 85%, 45%);
  --victory-600: hsl(45, 85%, 35%);

  /* Live — Coral */
  --live-500: hsl(12, 85%, 52%);
  --live-600: hsl(12, 85%, 45%);

  /* Semantic */
  --success-500: hsl(142, 60%, 50%);
  --error-500:   hsl(0, 85%, 55%);

  /* Surfaces — Midnight & Indigo (warm light + navy dark) */
  --bg:        hsl(35, 25%, 98%);
  --surface-1: hsl(35, 20%, 99%);
  --surface-2: hsl(35, 15%, 96%);
  --card:      #ffffff;
  --card-border: var(--arena-200);
  --cta-bg:    hsl(220, 30%, 12%);
  --header-bg: hsl(220, 30%, 8%);

  /* Text */
  --text-primary: var(--arena-900);
  --text-secondary: hsl(220, 15%, 45%);
  --text-muted: hsl(220, 10%, 55%);
  --text-on-dark: hsl(0, 0%, 98%);
  --text-on-dark-muted: hsl(0, 0%, 70%);

  /* PROPOSED — per-tournament accent (R4) */
  --tournament-accent: var(--brand-600);
  --tournament-accent-soft: var(--brand-100);

  /* Type — Athletic identity (2026-05-23)
     - --font-hero: Anton (condensed uppercase). Tournament names, hero
       headlines only. Anton at small sizes is unreadable.
     - --font-display: Inter — general headings (lean on 700/800 weights).
     - --font-body: Inter — body copy.
     - --font-mono: JetBrains Mono — data atoms (scores, courts, times). */
  --font-hero:    'Anton', 'Impact', 'Oswald', 'Arial Narrow', sans-serif;
  --font-display: 'Inter', ui-sans-serif, system-ui, sans-serif;
  --font-body:    'Inter', ui-sans-serif, system-ui, sans-serif;
  --font-mono:    'JetBrains Mono', ui-monospace, 'SF Mono', monospace;

  /* Fluid scale */
  --text-xs:   clamp(0.75rem, 0.7rem + 0.25vw, 0.875rem);
  --text-sm:   clamp(0.875rem, 0.8rem + 0.375vw, 1rem);
  --text-base: clamp(1rem, 0.925rem + 0.375vw, 1.125rem);
  --text-lg:   clamp(1.125rem, 1rem + 0.625vw, 1.25rem);
  --text-xl:   clamp(1.25rem, 1.1rem + 0.75vw, 1.5rem);
  --text-2xl:  clamp(1.5rem, 1.25rem + 1.25vw, 2rem);
  --text-3xl:  clamp(1.875rem, 1.5rem + 1.875vw, 2.5rem);
  --text-4xl:  clamp(2.25rem, 1.75rem + 2.5vw, 3rem);
  --text-5xl:  clamp(3rem, 2.25rem + 3.75vw, 4rem);

  /* Spacing — 4pt grid */
  --space-1: 0.25rem; --space-2: 0.5rem; --space-3: 0.75rem; --space-4: 1rem;
  --space-5: 1.25rem; --space-6: 1.5rem; --space-8: 2rem; --space-10: 2.5rem;
  --space-12: 3rem; --space-16: 4rem; --space-20: 5rem; --space-24: 6rem;

  /* Radius */
  --radius-sm: 0.25rem; --radius-md: 0.5rem; --radius-lg: 0.75rem;
  --radius-xl: 1rem; --radius-2xl: 1.5rem; --radius-full: 9999px;

  /* Elevation */
  --shadow-sm: 0 2px 6px rgb(10 14 20 / 0.06);
  --shadow-md: 0 6px 16px rgb(10 14 20 / 0.08);
  --shadow-lg: 0 12px 30px rgb(10 14 20 / 0.12);
  --shadow-focus: 0 0 0 4px hsl(235 80% 60% / 0.25);

  /* Motion — distinctive curves, NOT Material's "decelerate" defaults.
   * Drawer settle uses an iOS-inspired ease-out for a "snap-then-settle"
   * feel rather than the linear-looking 0.4,0,0.2,1 Material standard. */
  --transition-snap:  80ms  cubic-bezier(0.2, 0, 0.1, 1);
  --transition-fast:  150ms cubic-bezier(0.32, 0.72, 0, 1);
  --transition-base:  200ms cubic-bezier(0.32, 0.72, 0, 1);
  --transition-slow:  280ms cubic-bezier(0.32, 0.72, 0, 1);

  /* Focus — accessible outline, NOT the shadcn ring-2 ring-offset-2 pattern */
  --focus-outline: 2px solid var(--brand-500);
  --focus-outline-offset: 2px;
  --focus-outline-on-dark: 2px solid var(--brand-300);
}

/* ─────────────── motion preferences ─────────────── */

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

/* ─────────────── reset & base ─────────────── */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.5;
  color: var(--text-primary);
  background: var(--bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; border: none; background: none; color: inherit; }
img { max-width: 100%; display: block; }

h1, h2, h3, h4 {
  color: var(--text-primary);
  letter-spacing: -0.01em;
}
h1 {
  font-family: var(--font-hero);
  font-size: var(--text-5xl);
  font-weight: 400;
  line-height: 0.95;
  letter-spacing: -0.005em;
  text-transform: uppercase;
}
h2 { font-family: var(--font-display); font-size: var(--text-2xl); font-weight: 700; line-height: 1.2; }
h3 { font-family: var(--font-display); font-size: var(--text-xl);  font-weight: 600; line-height: 1.2; }
h4 { font-family: var(--font-display); font-size: var(--text-lg);  font-weight: 600; line-height: 1.3; }

p { color: var(--text-secondary); }

/* Mono for data atoms */
.mono, time, .court, .seed, .score {
  font-family: var(--font-mono);
  font-feature-settings: 'tnum' 1;
}

/* ─────────────── layout primitives ─────────────── */

.container { max-width: 1200px; margin-inline: auto; padding-inline: var(--space-4); }
@media (min-width: 768px) { .container { padding-inline: var(--space-6); } }

.stack > * + * { margin-top: var(--space-4); }
.row { display: flex; gap: var(--space-3); align-items: center; }
.row-between { display: flex; gap: var(--space-3); align-items: center; justify-content: space-between; }

/* ─────────────── components ─────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: var(--text-sm);
  transition:
    background var(--transition-fast),
    color var(--transition-fast),
    box-shadow var(--transition-snap),
    transform var(--transition-snap);
  min-height: 44px;
}
.btn:focus-visible {
  outline: var(--focus-outline);
  outline-offset: var(--focus-outline-offset);
}
.btn:active {
  transform: translateY(1px);
  transition-duration: var(--transition-snap);
}
.btn-primary { background: var(--brand-600); color: white; }
.btn-primary:hover { background: var(--brand-700); }
.btn-primary:active { box-shadow: inset 0 1px 2px hsl(235 50% 18% / 0.4); }

.btn-secondary { background: var(--card); color: var(--text-primary); border: 1px solid var(--card-border); }
.btn-secondary:hover { background: var(--surface-2); border-color: hsl(220 18% 80%); }
.btn-secondary:active { box-shadow: inset 0 1px 2px rgb(0 0 0 / 0.06); }

.btn-ghost { color: var(--text-secondary); padding: var(--space-2) var(--space-3); }
.btn-ghost:hover { color: var(--text-primary); background: var(--surface-2); }
.btn-ghost:active { box-shadow: inset 0 1px 2px rgb(0 0 0 / 0.05); }

.btn-lg { padding: var(--space-4) var(--space-6); font-size: var(--text-base); }

.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  transition: box-shadow var(--transition-fast), border-color var(--transition-fast);
}
/* Cards in interactive containers get a brand left-edge on hover — reuses
 * the citation chip / sidebar active-rule vocabulary as a consistent
 * "this thing is being pointed at" signal across surfaces. */
a:hover > .card,
button:hover > .card,
.card[role="button"]:hover,
.card[tabindex]:hover {
  box-shadow: inset 2px 0 0 var(--brand-300);
  border-color: hsl(220 18% 80%);
}
.card[role="button"]:focus-visible,
.card[tabindex]:focus-visible {
  outline: var(--focus-outline);
  outline-offset: var(--focus-outline-offset);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
  background: var(--arena-100);
  color: var(--arena-700);
}
.badge-brand { background: var(--brand-100); color: var(--brand-700); }
.badge-victory { background: hsl(45 85% 95%); color: var(--victory-600); }
.badge-live {
  background: var(--live-500);
  color: white;
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
}
.badge-accent {
  background: color-mix(in srgb, var(--tournament-accent) 12%, transparent);
  color: var(--tournament-accent);
}

/* PROPOSED — LIVE pulse */
.live-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--live-500);
  margin-right: var(--space-2);
  animation: live-pulse 1.4s ease-in-out infinite;
}
@keyframes live-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(1.4); }
}

/* PROPOSED — proposed-vs-shipped tag */
.proposed-tag {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 2px 6px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  background: var(--victory-500);
  color: var(--arena-900);
  border-radius: var(--radius-sm);
  vertical-align: middle;
}

/* ─────────────── portal shell (Front Door / Prototype / Docs) ───────────────
   Canonical meta-page shell. Single source of truth for the three blueprint
   meta-pages so they can't drift visually. Injected by _portal-shell.js.
   See `_portal-shell.js` and blueprint/template/portal/_portal-shell.js. */
.portal-shell {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--card);
  border-bottom: 1px solid var(--card-border);
  padding: 0 var(--space-4);
  height: 56px;
  display: flex;
  align-items: center;
}
.portal-shell-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-6);
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
}
.portal-shell .brand-mark {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: -0.01em;
  color: var(--text-primary);
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  line-height: 1;
  text-decoration: none;
}
.portal-shell .brand-mark-tag {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 500;
}
.portal-shell-nav {
  display: flex;
  gap: 14px;
  align-items: center;
}
.portal-shell-nav a {
  position: relative;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  padding: 2px 0;
  line-height: 1;
  transition: color var(--transition-fast);
  text-decoration: none;
}
.portal-shell-nav a::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: -2px;
  height: 1px;
  background: currentColor;
  opacity: 0;
  transform: scaleX(0.6);
  transform-origin: left center;
  transition: opacity var(--transition-fast), transform var(--transition-fast);
}
.portal-shell-nav a:hover { color: var(--text-primary); }
.portal-shell-nav a.active { color: var(--text-primary); }
.portal-shell-nav a:hover::after,
.portal-shell-nav a.active::after {
  opacity: 1;
  transform: scaleX(1);
}

/* ─────────────── header (shared across pages) ─────────────── */

.header {
  background: var(--header-bg);
  color: var(--text-on-dark);
  padding: var(--space-4) 0;
  border-bottom: 1px solid hsl(220 30% 15%);
}
.header .container { display: flex; align-items: center; justify-content: space-between; }
.header .logo {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--text-lg);
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}
.header .logo-accent { color: var(--brand-300); }
.header nav { display: flex; gap: var(--space-5); }
.header nav a { color: var(--text-on-dark-muted); font-size: var(--text-sm); }
.header nav a:hover, .header nav a.active { color: var(--text-on-dark); }

/* ─────────────── app-header (Authenticated chrome) ───────────────
   Shared component pattern for the Authenticated mode dark brand bar.
   Same markup across operator-game-day + captain (and future authenticated
   pages); differs only in nav items per surface. Per docs/chrome-system.md.

   Variants:
   - `.app-header` — full organizer nav (Tournaments, Series, Settings)
   - `.app-header.app-header-reduced` — magic-link captain nav (no Series/Settings) */
.app-header {
  background: var(--header-bg);
  color: var(--text-on-dark);
  padding: 0 var(--space-5);
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid hsl(220 30% 15%);
  gap: var(--space-5);
}
.app-header .app-header-lead {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  min-width: 0;
}
.app-header .logo {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--text-lg);
  color: var(--text-on-dark);
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  white-space: nowrap;
}
.app-header .logo-accent { color: var(--brand-300); }
.app-header nav {
  display: flex;
  gap: var(--space-5);
  align-items: center;
}
.app-header nav a {
  color: var(--text-on-dark-muted);
  font-size: var(--text-sm);
  font-weight: 500;
  padding: var(--space-2) 0;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}
.app-header nav a:hover { color: var(--text-on-dark); }
.app-header nav a.active {
  color: var(--text-on-dark);
  border-bottom-color: var(--brand-400, var(--brand-500));
}
.app-header .app-header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.app-header .app-cmdk {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-on-dark-muted);
  padding: var(--space-1) var(--space-2);
  border: 1px solid hsl(220 30% 22%);
  border-radius: var(--radius-sm);
  letter-spacing: 0.04em;
  background: transparent;
  cursor: pointer;
}
.app-header .app-cmdk:hover { color: var(--text-on-dark); border-color: hsl(220 30% 30%); }
.app-header .app-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--brand-500);
  color: white;
  font-weight: 700;
  font-size: var(--text-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  cursor: pointer;
}
.app-header.app-header-reduced nav { display: none; }
.app-header.app-header-reduced .app-header-lead { gap: var(--space-3); }
.app-header.app-header-reduced .app-magic-tag {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-on-dark-muted);
  padding: 2px var(--space-2);
  border: 1px solid hsl(220 30% 22%);
  border-radius: var(--radius-sm);
}

/* Per-event sub-chrome strip — appears below .app-header on pages scoped to
   a specific tournament. Carries the tournament's name, date, and LIVE
   indicator. The per-event accent applies as a leading rule + LIVE dot. */
.app-event-strip {
  background: linear-gradient(90deg,
    color-mix(in srgb, var(--tournament-accent) 28%, var(--cta-bg)) 0%,
    var(--cta-bg) 40%,
    var(--cta-bg) 100%);
  color: var(--text-on-dark);
  padding: var(--space-3) var(--space-5);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  border-bottom: 1px solid hsl(220 30% 15%);
  position: sticky;
  top: 0;
  z-index: 10;
}
.app-event-strip .app-event-meta {
  display: flex;
  align-items: baseline;
  gap: var(--space-3);
  min-width: 0;
}
.app-event-strip .app-event-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--text-lg);
  letter-spacing: -0.005em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.app-event-strip .app-event-date {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-on-dark-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
}
.app-event-strip .app-event-state {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-on-dark-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.app-event-strip .app-event-state .live-dot {
  width: 8px;
  height: 8px;
  background: var(--live-500);
  border-radius: 50%;
  animation: live-pulse 2s infinite;
}

/* ─────────────── proto-nav (footer) + panel triggers ─────────────── */

/* Legacy v1 footer nav — kept in DOM for keyboard shortcuts but visually
 * hidden because top brand bar + slice header + sidebar do the same job
 * with better positioning. Removable in a future cleanup. */
.proto-footer-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--arena-900);
  color: var(--text-on-dark);
  border-top: 1px solid hsl(220 30% 20%);
  padding: var(--space-3) var(--space-4);
  display: none; /* HIDDEN — replaced by top brand bar + slice header */
  align-items: center;
  justify-content: space-between;
  z-index: 40;
  font-size: var(--text-sm);
}
.proto-footer-nav .nav-pages select {
  background: hsl(220 30% 18%);
  color: var(--text-on-dark);
  border: 1px solid hsl(220 30% 25%);
  border-radius: var(--radius-md);
  padding: var(--space-2) var(--space-3);
  font: inherit;
}
.proto-footer-nav .nav-actions { display: flex; gap: var(--space-2); }
.proto-footer-nav button {
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  color: var(--text-on-dark-muted);
  border: 1px solid hsl(220 30% 20%);
}
.proto-footer-nav button:hover, .proto-footer-nav button.active {
  background: hsl(220 30% 18%);
  color: var(--text-on-dark);
}

/* Bottom reserve no longer needed — footer nav is hidden */
/* body { padding-bottom: 80px; } */

/* ─────────────── strategy panel (right drawer) ─────────────── */

.strategy-panel, .current-state-panel {
  position: fixed;
  top: 0;
  height: 100vh;
  width: min(420px, 100%);
  background: var(--card);
  box-shadow: var(--shadow-lg);
  padding: var(--space-6);
  overflow-y: auto;
  transition: transform var(--transition-slow);
  z-index: 50;
}
.strategy-panel { right: 0; transform: translateX(100%); border-left: 1px solid var(--card-border); }
.current-state-panel { left: 0; transform: translateX(-100%); border-right: 1px solid var(--card-border); }
.strategy-panel.open, .current-state-panel.open { transform: translateX(0); }

.panel-close {
  position: absolute;
  top: var(--space-3);
  right: var(--space-3);
  font-size: var(--text-2xl);
  color: var(--text-muted);
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  transition: color var(--transition-fast), background var(--transition-fast);
}
.panel-close:hover {
  color: var(--text-primary);
  background: var(--surface-2);
}
.panel-close:focus-visible {
  outline: var(--focus-outline);
  outline-offset: 0;
}
.current-state-panel .panel-close { right: auto; left: var(--space-3); }

.panel-section { margin-top: var(--space-5); }
.panel-section h4 {
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: var(--space-2);
}
.panel-section p { font-size: var(--text-sm); }
.panel-section code, .panel-section pre {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  background: var(--surface-2);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
}

/* ─────────────── view switch (was: comparison toggle) ───────────────
 *
 * Three view modes — Proposed / Compare / Shipped — rendered as a
 * tab-style switch: sentence-case labels, hairline vertical separators
 * between segments, brand-color underline marking the active mode.
 * No container fill, no pill, no UPPERCASE MONO — escapes the iOS / shadcn
 * segmented-control idiom while keeping the segmented affordance legible.
 */

.compare-toggle {
  display: inline-flex;
  align-items: stretch;
  height: 30px;
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
  flex-shrink: 0;
  font-family: var(--font-body);
}
.compare-toggle button {
  position: relative;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  color: var(--text-muted);
  border-radius: 0;
  min-height: 0;
  white-space: nowrap;
  cursor: pointer;
  transition: color 150ms ease-out, border-color 200ms ease-out;
}
.compare-toggle button + button::before {
  content: '';
  position: absolute;
  left: -1px;
  top: 8px;
  bottom: 8px;
  width: 1px;
  background: hsl(220 10% 35% / 0.35);
  pointer-events: none;
}
.compare-toggle button:hover {
  color: var(--text-secondary);
  border-bottom-color: hsl(220 10% 30%);
}
.compare-toggle button.active {
  color: var(--text-primary);
  border-bottom-color: var(--brand-500);
}
.compare-toggle button:focus-visible {
  outline: none;
  border-bottom-color: var(--brand-500);
  color: var(--text-primary);
  box-shadow: inset 0 0 0 1px hsl(235 80% 60% / 0.4);
}

/* Dark-bar context: stronger active state — the compare toggle is the
   primary interactive control on every prototype page; active should read
   as filled, not just underlined. Height matches the chip pair (24px outer,
   20px inner buttons) so the three controls share one baseline. */
.proto-top-bar .compare-toggle {
  background: hsl(220 30% 16%);
  border: 1px solid hsl(220 30% 24%);
  border-radius: 999px;
  padding: 2px;
  height: 24px !important;
  display: inline-flex;
  align-items: center;
}
.proto-top-bar .compare-toggle button {
  color: hsl(220 10% 65%);
  padding: 0 10px;
  height: 18px;
  font-size: 11px;
  border-radius: 999px;
  font-weight: 500;
  border-bottom: none !important;
  transition: background var(--transition-fast), color var(--transition-fast);
  display: inline-flex;
  align-items: center;
  line-height: 1;
}
.proto-top-bar .compare-toggle button + button::before {
  display: none;
}
.proto-top-bar .compare-toggle button:hover {
  color: var(--text-on-dark);
  background: hsl(220 30% 22%);
}
.proto-top-bar .compare-toggle button.active {
  color: var(--text-on-dark);
  background: var(--brand-600);
  font-weight: 600;
}
.proto-top-bar .compare-toggle button.active:hover {
  background: var(--brand-600);
}
.proto-top-bar .compare-toggle button:focus-visible {
  outline: var(--focus-outline-on-dark);
  outline-offset: 2px;
}
/* Light-shell variant */
body.proto-shell-light .proto-top-bar .compare-toggle {
  background: var(--surface-2);
  border-color: var(--card-border);
}
body.proto-shell-light .proto-top-bar .compare-toggle button {
  color: var(--text-secondary);
}
body.proto-shell-light .proto-top-bar .compare-toggle button:hover {
  color: var(--text-primary);
  background: var(--surface-1);
}
body.proto-shell-light .proto-top-bar .compare-toggle button.active {
  color: white;
  background: var(--brand-600);
}

/* Floating fallback (pages without a top bar) — bottom-right hairline panel,
 * no pill, sits above page content. Sharp corners, dark surface. */
.compare-toggle-floating {
  position: fixed;
  top: var(--space-3);
  right: var(--space-3);
  z-index: 35;
  background: hsl(220 30% 10% / 0.92);
  backdrop-filter: blur(8px);
  border: 1px solid hsl(220 30% 22%);
  border-radius: 2px;
  padding: 0 4px;
}
.compare-toggle-floating .compare-toggle button {
  color: hsl(220 10% 65%);
}
.compare-toggle-floating .compare-toggle button.active {
  color: var(--text-on-dark);
  border-bottom-color: var(--brand-300);
}

.proposed-view, .shipped-view {
  transition: opacity var(--transition-base);
}
[data-view="proposed"] .shipped-view { display: none; }
[data-view="shipped"] .proposed-view  { display: none; }
[data-view="split"] {
  display: grid;
  /* start, not stretch: when the container ends up taller than its tracks
     (fixed-position drawers, min-height), stretch distributes the surplus
     into the auto rows — measured +256px each on the lifecycle strip and
     page-header rows (create-tournament, 2026-06-11). */
  align-content: start;
  /* minmax(0, …): plain 1fr bottoms out at the content's min-width, so a
     wide panel pushed its sibling past the viewport edge and clipped it
     (cognitive audit 2026-06-11). */
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--space-4);
}
/* The compare root is usually <body>; in-flow chrome (lifecycle strip,
   footer) must span both columns or auto-placement pairs it with a view
   panel and the 50/50 split breaks (cognitive audit 2026-06-11). */
[data-view="split"] > *:not(.proposed-view):not(.shipped-view) {
  grid-column: 1 / -1;
}
[data-view="split"] .proposed-view { grid-column: 1; }
[data-view="split"] .shipped-view { grid-column: 2; }
[data-view="split"] .proposed-view, [data-view="split"] .shipped-view {
  display: block;
  min-width: 0;
  /* Grid gap owns the spacing in split mode; page-level utility margins
     (e.g. mt-8 on a view) would knock the two panels out of alignment. */
  margin: 0;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  position: relative;
  /* Both panels fit the viewport and scroll internally instead of forcing
     page-level overflow that drifts them out of sync; 140px clears the
     fixed top bar + lifecycle strip (cognitive audit 2026-06-11). */
  max-height: calc(100vh - 140px);
  overflow: auto;
}
[data-view="split"] .proposed-view::before {
  content: "PROPOSED";
  /* sticky, not absolute: the panels are scroll containers now, and an
     absolute badge at top:-10px gets clipped (cognitive audit 2026-06-11). */
  position: sticky;
  top: 0;
  z-index: 2;
  display: table;
  margin-bottom: var(--space-2);
  background: var(--victory-500);
  color: var(--arena-900);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
}
[data-view="split"] .shipped-view::before {
  content: "SHIPPED";
  position: sticky;
  top: 0;
  z-index: 2;
  display: table;
  margin-bottom: var(--space-2);
  background: var(--arena-700);
  color: white;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
}

/* ─────────────── mock frame (canvas rule, 2026-06-11) ───────────────
   The canvas belongs to the portal; the theme belongs to the mock.
   proto-nav.js reads meta.mock_frame ("desktop" | "phone" | "none",
   default desktop) and frames each view section so themed mocks —
   including fully dark product surfaces — read as windows onto the
   product instead of restyling the portal canvas. The frame bar is
   portal-owned and stays light regardless of the mock's theme. Split
   mode's panel rules above carry higher specificity and override the
   container styles (border, margin, overflow, padding) by design. */
.mock-frame-desktop, .mock-frame-phone {
  background: var(--card);
  border: 1px solid var(--card-border);
  box-shadow: var(--shadow-md);
  /* clip, not hidden: clip rounds the corners without creating a scroll
     container, so position:sticky inside the mock keeps working against
     the viewport (mock-frame wave, 2026-06-11). */
  overflow: clip;
  margin: var(--space-6) auto;
}
.mock-frame-desktop {
  border-radius: var(--radius-lg);
  max-width: 1200px;
  width: calc(100% - 2 * var(--space-4));
}
.mock-frame-phone {
  max-width: 420px;
  border: 10px solid hsl(220 15% 12%);
  border-radius: 36px;
  box-shadow: 0 20px 60px rgb(0 0 0 / 0.35);
  /* centers the bezel inside its grid column in split mode (margin
     auto-centering is zeroed by the split panel rules). */
  justify-self: center;
}
.mock-frame-bar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 8px 14px;
  background: var(--surface-1);
  border-bottom: 1px solid var(--card-border);
}
.mock-frame-bar .frame-dots {
  display: inline-flex;
  gap: 5px;
  flex: none;
}
.mock-frame-bar .frame-dots span {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--card-border);
}
.mock-frame-bar .frame-route {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ─────────────── tournament-page specifics ─────────────── */

.tournament-hero {
  background: linear-gradient(135deg,
    color-mix(in srgb, var(--tournament-accent) 18%, var(--cta-bg)) 0%,
    var(--cta-bg) 100%);
  color: var(--text-on-dark);
  padding: var(--space-12) 0 var(--space-10);
}
.tournament-hero h1 {
  color: var(--text-on-dark);
  font-size: var(--text-5xl);
  text-transform: uppercase;
  letter-spacing: -0.02em;
}
.tournament-hero .subtitle { color: var(--text-on-dark-muted); margin-top: var(--space-2); }

.match-card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  transition: box-shadow var(--transition-fast), border-color var(--transition-fast);
}
.match-card:hover {
  border-color: hsl(220 18% 80%);
  box-shadow: inset 2px 0 0 var(--brand-300);
}
.match-card.live { border-color: var(--live-500); box-shadow: 0 0 0 1px var(--live-500); }
.match-card.live:hover {
  border-color: var(--live-500);
  box-shadow: 0 0 0 1px var(--live-500), inset 2px 0 0 var(--live-500);
}
.match-card .court {
  font-size: var(--text-xs);
  color: var(--text-muted);
  text-transform: uppercase;
}
.match-card .teams { display: flex; flex-direction: column; gap: var(--space-2); margin-top: var(--space-2); }
.match-card .team { display: flex; justify-content: space-between; align-items: center; padding: var(--space-2) 0; }
.match-card .team.winner { font-weight: 700; }
.match-card .team .score { font-size: var(--text-xl); color: var(--text-primary); }

/* Action-overlay primitive (PROPOSED) */
.action-overlay {
  position: sticky;
  bottom: var(--space-4);
  display: flex;
  gap: var(--space-2);
  background: color-mix(in srgb, var(--cta-bg) 85%, transparent);
  backdrop-filter: blur(12px);
  border-radius: var(--radius-xl);
  padding: var(--space-3);
  margin-top: var(--space-6);
  box-shadow: var(--shadow-lg);
  z-index: 30;
}
.action-overlay .btn { color: var(--text-on-dark); border-color: hsl(220 30% 25%); }

/* ─────────────── utility ─────────────── */

.muted { color: var(--text-muted); }
.small { font-size: var(--text-sm); }
.tiny  { font-size: var(--text-xs); }
.hidden { display: none; }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mt-8 { margin-top: var(--space-8); }

/* ─────────────── flow breadcrumb (proto-nav.js) ─────────────── */

.proto-flow-breadcrumb {
  position: fixed;
  top: 56px; left: 0; right: 0;
  z-index: 34;
  background: color-mix(in srgb, var(--cta-bg) 95%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid hsl(220 30% 22%);
  color: var(--text-on-dark);
  padding: var(--space-2) var(--space-4);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  font-size: var(--text-sm);
}

.proto-flow-breadcrumb .flow-meta {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 0;
}
.proto-flow-breadcrumb .flow-label {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-on-dark-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.proto-flow-breadcrumb .flow-name {
  font-family: var(--font-display);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.proto-flow-breadcrumb .flow-step {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-on-dark-muted);
  padding: 2px 8px;
  background: hsl(220 30% 18%);
  border-radius: var(--radius-full);
}

.proto-flow-breadcrumb .flow-actions {
  display: flex;
  gap: var(--space-2);
  align-items: center;
}
.proto-flow-breadcrumb .flow-nav-btn {
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-sm);
  color: var(--text-on-dark-muted);
  border-radius: var(--radius-md);
  border: 1px solid hsl(220 30% 22%);
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
}
.proto-flow-breadcrumb .flow-nav-btn:hover {
  background: hsl(220 30% 18%);
  color: var(--text-on-dark);
}
.proto-flow-breadcrumb .flow-nav-btn.primary {
  background: var(--brand-600);
  color: white;
  border-color: var(--brand-600);
}
.proto-flow-breadcrumb .flow-nav-btn.primary:hover {
  background: var(--brand-700);
}
.proto-flow-breadcrumb .flow-nav-btn.disabled {
  opacity: 0.4;
  pointer-events: none;
}
.proto-flow-breadcrumb .flow-page-name {
  display: inline-block;
  max-width: 12ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
}

/* Reserve combined top space when flow is active (top bar 56 + breadcrumb ~40) */
body:has(.proto-top-bar):has(.proto-flow-breadcrumb) { padding-top: 96px; }
body:has(.proto-flow-breadcrumb):not(:has(.proto-top-bar)) { padding-top: 40px; }

/* ─────────────── annotation overlay (proto-annotate.js) ─────────────── */

.anno-fab {
  position: fixed;
  bottom: 90px;
  left: 16px;
  width: 48px;
  height: 48px;
  border-radius: 24px;
  background: var(--victory-500);
  color: var(--arena-900);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
  z-index: 45;
  cursor: pointer;
  transition: transform 200ms;
}
.anno-fab:hover { transform: scale(1.05); }
.anno-fab .badge-count {
  position: absolute;
  top: -4px; right: -4px;
  background: var(--live-500);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}

.anno-mode-active * {
  cursor: crosshair !important;
}
.anno-mode-active .proto-footer-nav,
.anno-mode-active .strategy-panel,
.anno-mode-active .current-state-panel,
.anno-mode-active .chat-window,
.anno-mode-active .chat-fab,
.anno-mode-active .anno-fab,
.anno-mode-active .anno-popover,
.anno-mode-active .anno-marker {
  cursor: default !important;
}

.anno-marker {
  position: absolute;
  width: 24px;
  height: 24px;
  border-radius: 12px;
  background: var(--victory-500);
  color: var(--arena-900);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  border: 2px solid var(--card);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  z-index: 38;
  cursor: pointer;
  font-family: var(--font-mono);
}
.anno-marker.resolved {
  background: var(--success-500);
  color: white;
  opacity: 0.65;
}

.anno-popover {
  position: fixed;
  width: min(360px, calc(100vw - 32px));
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: var(--space-4);
  z-index: 46;
  font-size: var(--text-sm);
}
.anno-popover h4 {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: var(--space-2);
}
.anno-popover textarea {
  width: 100%;
  min-height: 80px;
  padding: var(--space-2);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  font: inherit;
  font-size: var(--text-sm);
  resize: vertical;
  margin-bottom: var(--space-3);
  background: var(--surface-1);
}
.anno-popover .anno-actions {
  display: flex;
  gap: var(--space-2);
  justify-content: flex-end;
}
.anno-popover .anno-actions button {
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-sm);
  font-weight: 600;
  border-radius: var(--radius-md);
}
.anno-popover .btn-primary {
  background: var(--brand-600);
  color: white;
}
.anno-popover .btn-secondary {
  background: var(--surface-2);
  color: var(--text-secondary);
}
.anno-popover .anno-meta {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-bottom: var(--space-2);
}
.anno-popover .anno-body {
  margin-bottom: var(--space-3);
  white-space: pre-wrap;
  line-height: 1.5;
}

.anno-list-panel {
  position: fixed;
  bottom: 90px;
  left: 16px;
  width: min(380px, calc(100vw - 32px));
  max-height: 70vh;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 45;
  display: none;
  flex-direction: column;
  overflow: hidden;
}
.anno-list-panel.open { display: flex; }
.anno-list-panel .anno-list-header {
  padding: var(--space-3) var(--space-4);
  background: var(--surface-2);
  border-bottom: 1px solid var(--card-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.anno-list-panel .anno-list-header h3 {
  font-size: var(--text-base);
  margin: 0;
}
.anno-list-panel .anno-list-body {
  overflow-y: auto;
  padding: var(--space-2);
  flex: 1;
}
.anno-list-panel .anno-list-empty {
  padding: var(--space-6);
  text-align: center;
  color: var(--text-muted);
  font-size: var(--text-sm);
}
.anno-list-panel .anno-item {
  padding: var(--space-3);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-2);
  cursor: pointer;
  font-size: var(--text-sm);
}
.anno-list-panel .anno-item:hover {
  background: var(--surface-2);
}
.anno-list-panel .anno-item .anno-item-meta {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-bottom: var(--space-1);
  display: flex;
  justify-content: space-between;
}
.anno-list-panel .anno-item .anno-item-body {
  line-height: 1.4;
  color: var(--text-secondary);
}

/* ─────────────── unified top bar (proto-nav.js, on every prototype page) ───────────────
 *
 * Single 56px region: brand + breadcrumb on the left, compare + trace badges +
 * global nav on the right. Replaces the earlier 36px brand bar + 44px slice
 * header stack — same affordances, ~30% less vertical chrome.
 */

.proto-top-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 35;
  background: var(--arena-900);
  color: var(--text-on-dark);
  height: 56px;
  border-bottom: 1px solid hsl(220 30% 16%);
  box-shadow: 0 1px 0 rgb(0 0 0 / 0.25);
}

/* Light variant — used on the front door + docs viewer, where the chrome
   should recede (these pages ARE the blueprint product, not mock surfaces
   that need a clear shell/content separation). */
body.proto-shell-light .proto-top-bar {
  background: var(--card);
  color: var(--text-primary);
  border-bottom-color: var(--card-border);
  box-shadow: 0 1px 0 rgb(0 0 0 / 0.03);
}
body.proto-shell-light .proto-top-bar .brand-mark { color: var(--text-primary); }
body.proto-shell-light .proto-top-bar .brand-mark-tag { color: var(--text-muted); }
body.proto-shell-light .proto-top-bar .top-bar-crumb a,
body.proto-shell-light .proto-top-bar .top-bar-crumb .slice-label,
body.proto-shell-light .proto-top-bar .top-bar-crumb .page-label {
  color: var(--text-secondary);
}
body.proto-shell-light .proto-top-bar .top-bar-crumb .slice-label { color: var(--text-primary); }
body.proto-shell-light .proto-top-bar .top-bar-crumb a:hover { color: var(--text-primary); }
body.proto-shell-light .proto-top-bar .top-bar-crumb .sep { color: var(--text-muted); opacity: 0.5; }
body.proto-shell-light .proto-top-bar .top-bar-nav { border-left-color: var(--card-border); }
body.proto-shell-light .proto-top-bar .top-bar-nav a { color: var(--text-muted); }
body.proto-shell-light .proto-top-bar .top-bar-nav a:hover,
body.proto-shell-light .proto-top-bar .top-bar-nav a.is-active,
body.proto-shell-light .proto-top-bar .top-bar-nav a.active { color: var(--text-primary); }
body.proto-shell-light .proto-top-bar .chrome-toggle { border-color: var(--card-border); color: var(--text-secondary); }
body.proto-shell-light .proto-top-bar .chrome-toggle:hover { background: var(--surface-2); color: var(--text-primary); }
.proto-top-bar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  padding: 0 var(--space-4);
  gap: var(--space-4);
}
.proto-top-bar .top-bar-lead {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 0;
  flex: 1 1 auto;
}
.proto-top-bar .brand-mark {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: -0.01em;
  color: var(--text-on-dark);
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  flex-shrink: 0;
  line-height: 1;
}
.proto-top-bar .brand-mark-tag {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: hsl(220 10% 58%);
  font-weight: 500;
}
/* Breadcrumb — hard-pixel sizing (12px) so it lives on the same rhythm
   as the compare toggle + nav links + chips. Was previously fluid text-sm
   which scaled to 16px on wide viewports, making the crumb the *largest*
   element in the bar. */
.proto-top-bar .top-bar-crumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  line-height: 1;
  min-width: 0;
  overflow: hidden;
}
.proto-top-bar .top-bar-crumb a,
.proto-top-bar .top-bar-crumb .slice-label,
.proto-top-bar .top-bar-crumb .page-label {
  font-size: 12px;
  color: hsl(220 10% 68%);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 400;
}
.proto-top-bar .top-bar-crumb a:hover { color: var(--text-on-dark); }
.proto-top-bar .top-bar-crumb .slice-label {
  color: var(--text-on-dark);
  font-weight: 500;
}
.proto-top-bar .top-bar-crumb .page-label {
  color: hsl(220 10% 75%);
}
.proto-top-bar .top-bar-crumb .sep {
  color: hsl(220 10% 32%);
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 300;
  flex-shrink: 0;
  margin: 0 -1px;
}
.proto-top-bar .top-bar-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
}
.proto-top-bar .top-bar-badges {
  display: flex;
  gap: 4px;
  flex-wrap: nowrap;
}
.proto-top-bar .top-bar-nav {
  display: flex;
  gap: 14px;
  align-items: center;
  padding-left: 14px;
  margin-left: 2px;
  border-left: 1px solid hsl(220 30% 18%);
  height: 20px;
}
.proto-top-bar .top-bar-nav a {
  position: relative;
  color: hsl(220 10% 70%);
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
  padding: 2px 0;
  transition: color var(--transition-fast);
}
.proto-top-bar .top-bar-nav a::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -2px;
  height: 1px;
  background: currentColor;
  opacity: 0;
  transform: scaleX(0.6);
  transform-origin: left center;
  transition: opacity var(--transition-fast), transform var(--transition-fast);
}
.proto-top-bar .top-bar-nav a:hover,
.proto-top-bar .top-bar-nav a.active,
.proto-top-bar .top-bar-nav a.is-active { color: var(--text-on-dark); }
.proto-top-bar .top-bar-nav a:hover::after,
.proto-top-bar .top-bar-nav a.active::after,
.proto-top-bar .top-bar-nav a.is-active::after {
  opacity: 1;
  transform: scaleX(1);
}
.proto-top-bar .top-bar-nav a:focus-visible {
  outline: var(--focus-outline-on-dark);
  outline-offset: 4px;
}
.proto-top-bar .brand-mark { transition: color var(--transition-fast); }
.proto-top-bar .brand-mark:hover .brand-mark-tag { color: hsl(220 10% 78%); }
.proto-top-bar .brand-mark:focus-visible {
  outline: var(--focus-outline-on-dark);
  outline-offset: 4px;
}
.proto-top-bar .top-bar-crumb a { transition: color var(--transition-fast); }
.proto-top-bar .top-bar-crumb a:focus-visible {
  outline: var(--focus-outline-on-dark);
  outline-offset: 2px;
}

/* Reserve space below the top bar */
body:has(.proto-top-bar) { padding-top: 56px; }

/* ─────────────── citation chip + overlay (replaces .badge-trace) ───────────────
 *
 * The chip is intentionally NOT a pill: a 2px vertical brand-rule + mono IDs
 * + a hairline chevron. Reads as a margin annotation, not a status badge.
 * Click expands an overlay anchored below the chip with full citation titles,
 * each row gated by its own colored rule (gold = finding, indigo = rule).
 */

/* Citation chip — sibling of .chrome-toggle. Same height, same hairline
   style, same dot-leader rhythm. Reads as one of two reviewer-affordance
   chips, not a one-off treatment. */
.citation-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 24px;
  padding: 0 9px 0 9px;
  background: hsl(220 30% 18%);
  border: 1px solid hsl(220 30% 24%);
  color: hsl(220 10% 78%);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
  line-height: 1;
  cursor: pointer;
  min-height: 0;
  border-radius: 999px;
  transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
  position: relative;
}
.citation-chip::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--brand-400, var(--brand-500));
  flex-shrink: 0;
}
.citation-chip:hover,
.citation-chip[aria-expanded="true"] {
  background: hsl(220 30% 22%);
  border-color: hsl(220 30% 30%);
  color: var(--text-on-dark);
}
.citation-chip[aria-expanded="true"] {
  border-color: var(--brand-500);
}
.citation-chip .citation-codes { display: inline-flex; align-items: baseline; gap: 4px; }
.citation-chip .citation-sep { color: hsl(220 10% 42%); }
.citation-chip .citation-overflow {
  color: hsl(220 10% 60%);
  font-size: 10px;
  padding-left: 2px;
}
.citation-chip .citation-chevron {
  font-family: var(--font-body);
  font-size: 9px;
  color: hsl(220 10% 60%);
  transition: transform var(--transition-fast);
}
.citation-chip[aria-expanded="true"] .citation-chevron {
  transform: rotate(180deg);
  color: var(--text-on-dark-muted);
}
/* Light-shell variant */
body.proto-shell-light .citation-chip {
  background: var(--surface-2);
  border-color: var(--card-border);
  color: var(--text-secondary);
}
body.proto-shell-light .citation-chip:hover,
body.proto-shell-light .citation-chip[aria-expanded="true"] {
  background: var(--surface-1);
  border-color: var(--text-muted);
  color: var(--text-primary);
}
body.proto-shell-light .citation-chip[aria-expanded="true"] {
  border-color: var(--brand-500);
}
body.proto-shell-light .citation-chip .citation-sep { color: var(--card-border); }
body.proto-shell-light .citation-chip .citation-overflow,
body.proto-shell-light .citation-chip .citation-chevron { color: var(--text-muted); }

.citation-overlay {
  position: fixed;
  top: 56px;
  width: min(420px, calc(100vw - 32px));
  background: var(--card);
  border: 1px solid var(--card-border);
  border-top: 2px solid var(--brand-500);
  box-shadow: var(--shadow-lg);
  padding: var(--space-3) 0 var(--space-2);
  z-index: 36;
  font-family: var(--font-body);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
  transition: opacity 160ms ease-out, transform 160ms ease-out;
}
.citation-overlay.open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}
.citation-overlay-heading {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  padding: 0 var(--space-4) var(--space-2);
  border-bottom: 1px solid var(--card-border);
  margin-bottom: var(--space-2);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.citation-overlay-heading .source-path {
  text-transform: none;
  letter-spacing: 0;
  font-size: 10px;
  color: var(--text-muted);
}
.citation-row {
  display: grid;
  grid-template-columns: 3px 36px 1fr;
  align-items: start;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-4);
}
.citation-row + .citation-row { padding-top: var(--space-1); }
.citation-row .rule {
  align-self: stretch;
  background: var(--brand-500);
  border-radius: 0;
}
.citation-row.is-finding .rule { background: var(--victory-500); }
.citation-row .short {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.02em;
  padding-top: 2px;
}
.citation-row .title {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.4;
}
.citation-row.unknown .title {
  color: var(--text-muted);
  font-style: italic;
}

@media (prefers-reduced-motion: reduce) {
  .citation-overlay { transition: none; }
  .citation-chip .citation-chevron { transition: none; }
}

/* ─────────────── slice sidebar: REMOVED (nav paradigm wave, 2026-06-11) ───────────────
   The persistent left rail (.proto-slice-sidebar) is retired: full-bleed
   mockups are the content; the rail cost ~210px permanently for slice-scoped
   wayfinding (cognitive audit + operator decision 2026-06-11). Its jobs moved
   into the breadcrumb switchers, the strategy drawer's slice-context block,
   and the Cmd/Ctrl+K command palette below. */

/* ─────────────── breadcrumb switchers (nav paradigm wave, 2026-06-11) ───────────────
   The slice + page crumb segments are dropdown buttons, manifest-driven.
   Prototype surfaces only — the front door / docs top bar is unchanged. */

.proto-top-bar .crumb-switch-wrap { position: relative; display: inline-flex; }
.proto-top-bar .crumb-switch {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 6px; margin: -3px -2px;
  font-family: var(--font-mono); font-size: 11px; line-height: 1.2;
  color: inherit; background: none; border: none;
  border-radius: var(--radius-sm); cursor: pointer; white-space: nowrap;
  transition: background var(--transition-fast), color var(--transition-fast);
}
.proto-top-bar .crumb-switch:hover,
.proto-top-bar .crumb-switch[aria-expanded="true"] { background: hsl(220 25% 18%); }
.proto-top-bar .crumb-switch:focus-visible {
  outline: 2px solid var(--brand-300); outline-offset: 1px;
}
.proto-top-bar .crumb-switch .crumb-chevron { font-size: 8px; opacity: 0.55; }
.proto-top-bar .crumb-switch[aria-expanded="true"] .crumb-chevron { opacity: 1; }

.proto-top-bar .crumb-menu {
  /* fixed, JS-positioned from the button rect: absolute menus get clipped by
     consumer top-bar rules (overflow:hidden ellipsis) — nav paradigm wave,
     2026-06-11 verify finding. */
  position: fixed;
  min-width: 240px; max-width: 340px; max-height: min(60vh, 480px);
  overflow-y: auto;
  background: var(--card); color: var(--text-primary);
  border: 1px solid var(--card-border); border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: var(--space-1);
  display: none; z-index: 60;
}
.proto-top-bar .crumb-menu.open { display: block; }
.crumb-menu .crumb-menu-item {
  display: block; padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  font-family: var(--font-body); font-size: var(--text-sm); line-height: 1.35;
  color: var(--text-secondary);
  text-decoration: none;
}
.crumb-menu .crumb-menu-item:hover,
.crumb-menu .crumb-menu-item:focus-visible {
  background: var(--surface-2); color: var(--text-primary); outline: none;
}
.crumb-menu .crumb-menu-item.is-current {
  color: var(--text-primary); font-weight: 600;
  box-shadow: inset 3px 0 0 var(--brand-500);
}
.crumb-menu .item-label { display: block; }
.crumb-menu .item-summary {
  display: block; max-width: 300px;
  font-size: var(--text-xs); font-weight: 400; color: var(--text-muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.crumb-menu .crumb-menu-divider {
  height: 1px; background: var(--card-border);
  margin: var(--space-1) var(--space-2);
}
.crumb-menu .crumb-menu-flow .item-label {
  font-family: var(--font-mono); font-size: var(--text-xs);
}

/* ⌘K hint — same dark-bar chip vocabulary as the chrome toggle */
.proto-top-bar .palette-hint {
  display: inline-flex; align-items: center;
  padding: 3px 8px;
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.04em;
  color: hsl(220 10% 70%);
  background: transparent; border: 1px solid hsl(220 25% 25%);
  border-radius: var(--radius-sm); cursor: pointer; white-space: nowrap;
  transition: color var(--transition-fast), border-color var(--transition-fast);
}
.proto-top-bar .palette-hint:hover {
  color: var(--text-on-dark); border-color: hsl(220 25% 35%);
}

/* ─────────────── command palette (Cmd/Ctrl+K — nav paradigm wave, 2026-06-11) ─────────────── */

.cmd-palette-overlay {
  position: fixed; inset: 0; z-index: 90;
  background: hsl(220 30% 8% / 0.55);
  display: none;
  align-items: flex-start; justify-content: center;
  padding: 12vh var(--space-4) var(--space-4);
}
.cmd-palette-overlay.open { display: flex; }
.cmd-palette {
  width: min(560px, 100%);
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.cmd-palette-input {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  font: inherit; font-size: var(--text-sm);
  color: var(--text-primary);
  background: var(--surface-1);
  border: none; border-bottom: 1px solid var(--card-border);
  outline: none;
}
.cmd-palette-list {
  max-height: min(50vh, 420px); overflow-y: auto; padding: var(--space-1);
}
.cmd-palette-item {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  color: var(--text-secondary); font-size: var(--text-sm);
  text-decoration: none;
}
.cmd-palette-item.is-active {
  background: var(--surface-2); color: var(--text-primary);
  box-shadow: inset 3px 0 0 var(--brand-500);
}
.cmd-palette-item .item-label {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cmd-palette-item .item-hint {
  font-family: var(--font-mono); font-size: 10px; color: var(--text-muted);
  text-transform: lowercase; white-space: nowrap; flex-shrink: 0;
}
.cmd-palette-empty {
  padding: var(--space-4); font-size: var(--text-sm);
  color: var(--text-muted); text-align: center;
}

/* ─────────────── strategy drawer slice-context (nav paradigm wave, 2026-06-11) ───────────────
   Replaces the retired slice rail's framing block — quiet, token-based. */

.strategy-panel .panel-slice-context {
  margin-top: var(--space-4);
  padding: var(--space-3);
  background: var(--surface-1);
  border-radius: var(--radius-md);
}
.strategy-panel .slice-context-label {
  display: block;
  font-family: var(--font-mono); font-size: 10px; font-weight: 600;
  letter-spacing: 0.05em; text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: var(--space-1);
}
.strategy-panel .slice-context-summary {
  font-size: var(--text-sm); color: var(--text-secondary); line-height: 1.45;
}

/* ─────────────── flow step dots (nav paradigm wave, 2026-06-11) ───────────────
   The 'Step N of M' pill is now M clickable dots — in-flow navigation. */

.proto-flow-breadcrumb .flow-step-dots {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 4px 2px;
}
.proto-flow-breadcrumb .flow-step-dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: hsl(220 15% 40%);
  flex-shrink: 0;
  transition: background var(--transition-fast), transform var(--transition-fast);
}
.proto-flow-breadcrumb a.flow-step-dot:hover {
  background: var(--text-on-dark-muted); transform: scale(1.25);
}
.proto-flow-breadcrumb a.flow-step-dot:focus-visible {
  outline: 2px solid var(--brand-300); outline-offset: 2px;
}
.proto-flow-breadcrumb .flow-step-dot.is-current {
  background: var(--brand-300); transform: scale(1.2);
}

/* Mobile top bar (nav paradigm wave, 2026-06-11 verify finding): the crumb
   collapsed to zero width and the palette hint sat off-viewport at 390px;
   switchers measured ~20px tall vs the 40px touch floor. The crumb takes its
   own full-width row and scrolls horizontally; targets get real height. */
@media (max-width: 640px) {
  .proto-top-bar-inner { flex-wrap: wrap; row-gap: 2px; }
  .proto-top-bar .top-bar-crumb {
    flex: 1 1 100%; order: 3; min-width: 0;
    overflow-x: auto; -webkit-overflow-scrolling: touch;
  }
  .proto-top-bar .crumb-switch { min-height: 40px; padding: 8px 10px; font-size: 12px; }
  /* No keyboard on touch — the switchers are the mobile nav; the hint sat
     off-viewport anyway (the right-side toggle group doesn't wrap). */
  .proto-top-bar .palette-hint { display: none; }
}


/* ─────────────── proto footer (version surface, proto-nav.js) ───────────────
 *
 * Static document-flow footer at the bottom of every prototype page (skipped
 * on the portal index). Anchors the prototype in time: product name + version
 * + build date + a lowercase context tag. Mono throughout, display-font only
 * on the product name — the asymmetry escapes the centered "© year · v1.0"
 * SaaS-footer idiom.
 */

.proto-footer {
  margin-top: var(--space-12);
  padding: var(--space-5) var(--space-5);
  border-top: 1px solid var(--card-border);
  background: var(--surface-1);
  color: var(--text-muted);
}
.proto-footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.02em;
}
.proto-footer-mark {
  display: inline-flex;
  align-items: baseline;
  gap: var(--space-2);
  min-width: 0;
}
.proto-footer-product {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 12px;
  color: var(--text-secondary);
  letter-spacing: -0.005em;
}
.proto-footer-version {
  color: var(--text-muted);
}
.proto-footer-meta {
  display: inline-flex;
  align-items: center;
  gap: var(--space-4);
  color: var(--text-muted);
}
.proto-footer-meta .sep {
  color: hsl(220 10% 75%);
}
.proto-footer-context {
  text-transform: lowercase;
  color: hsl(220 10% 55%);
}

@media (max-width: 640px) {
  .proto-footer-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-2);
  }
}

/* Chrome suppression — page-level production chrome (marketing / authenticated
   headers on landing, create-tournament, leagues, partner) is suppressed by
   default in blueprint mode so the unified shell isn't doubled up. Reviewers
   toggle "show production chrome" in the top bar to restore it for fidelity
   review. See docs/chrome-system.md. */
[data-page-chrome] {
  display: none !important;
}
body.show-production-chrome [data-page-chrome] {
  display: block !important;
}

/* Chrome-preview toggle — sibling of .citation-chip. Same 24px height,
   same hairline + radius, same dot-leader position. The pair reads as one
   visual family on the right side of the bar. */
.proto-top-bar .chrome-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 24px;
  padding: 0 9px;
  background: transparent;
  border: 1px solid hsl(220 30% 22%);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: lowercase;
  line-height: 1;
  color: hsl(220 10% 70%);
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
}
.proto-top-bar .chrome-toggle:hover {
  background: hsl(220 30% 16%);
  border-color: hsl(220 30% 30%);
  color: var(--text-on-dark);
}
body.show-production-chrome .proto-top-bar .chrome-toggle {
  background: color-mix(in srgb, var(--brand-500) 18%, hsl(220 30% 16%));
  color: var(--text-on-dark);
  border-color: var(--brand-500);
}
.proto-top-bar .chrome-toggle .toggle-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.55;
  flex-shrink: 0;
}
body.show-production-chrome .proto-top-bar .chrome-toggle .toggle-dot {
  opacity: 1;
  background: var(--brand-400, var(--brand-500));
}

/* Strategy-panel systems block (lifecycle phase + chrome mode) — surfaced
   per docs/tournament-lifecycle.md + docs/chrome-system.md. */
.strategy-panel .panel-systems {
  background: var(--surface-1);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  font-size: var(--text-sm);
}
.strategy-panel .panel-systems strong {
  color: var(--text-primary);
  font-weight: 600;
}
.strategy-panel .panel-systems-link {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--card-border);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: text-decoration-color 0.15s;
}
.strategy-panel .panel-systems-link:hover {
  text-decoration-color: var(--brand-500);
}

/* Tournament lifecycle strip — injected by proto-nav.js after the top bar
   on tournament-state pages. Suppressed for cross-phase pages (marketing,
   billing, partner, channel-partners). See docs/tournament-lifecycle.md. */
.proto-lifecycle-strip {
  background: var(--surface-1);
  border-bottom: 1px solid var(--card-border);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.02em;
}
.proto-lifecycle-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 8px var(--space-6);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  overflow-x: auto;
}
.proto-lifecycle-inner .lifecycle-leader {
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-right: var(--space-3);
  white-space: nowrap;
}
.proto-lifecycle-strip .lifecycle-cell {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  border-radius: 4px;
  color: var(--text-muted);
  white-space: nowrap;
}
.proto-lifecycle-strip .lifecycle-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.4;
}
.proto-lifecycle-strip .lifecycle-cell.is-adapt {
  color: var(--text-secondary);
}
.proto-lifecycle-strip .lifecycle-cell.is-adapt .lifecycle-dot {
  opacity: 0.6;
  background: var(--brand-300);
}
.proto-lifecycle-strip .lifecycle-cell.is-current {
  color: var(--brand-700);
  background: color-mix(in srgb, var(--brand-500) 12%, transparent);
  font-weight: 600;
}
.proto-lifecycle-strip .lifecycle-cell.is-current .lifecycle-dot {
  opacity: 1;
  background: var(--brand-600);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-500) 18%, transparent);
}
.proto-lifecycle-strip .lifecycle-sep {
  color: hsl(220 10% 75%);
  margin: 0 2px;
}

/* Inline SVG icon convention — used for in-content marks that replaced emoji.
   Pages embed <svg class="icon-svg">…</svg> directly; this class handles sizing
   and baseline alignment so they sit in text and buttons consistently. */
.icon-svg {
  display: inline-block;
  width: 1em;
  height: 1em;
  vertical-align: -0.125em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}
.icon-svg.filled { fill: currentColor; stroke: none; }
.icon-svg.lg { width: 1.5em; height: 1.5em; }
.icon-svg.xl { width: 2.25em; height: 2.25em; }
