/* Harness Racer landing page — built on tokens.css (Catppuccin Mocha + neu depth). */

.app-shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  position: relative;
  overflow-x: clip;
}
.app-shell::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .42;
  background: linear-gradient(90deg, color-mix(in srgb, var(--mauve) 8%, transparent) 1px, transparent 1px) 0 0 / 72px 100%;
  mask-image: linear-gradient(90deg, transparent, #000 15% 85%, transparent);
}

main { width: min(1240px, calc(100% - 40px)); min-width: 0; margin: 0 auto; position: relative; z-index: 1; }

/* ── Topbar ───────────────────────────────────────────────────────────────── */

.topbar {
  min-height: 68px;
  padding: 10px clamp(16px, 3vw, 42px);
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  background: color-mix(in srgb, var(--base) 91%, transparent);
  border-bottom: 1px solid color-mix(in srgb, var(--surface-1) 45%, transparent);
  backdrop-filter: blur(14px);
  box-shadow: 0 5px 12px var(--neu-dark-soft), inset 0 1px color-mix(in srgb, var(--surface-1) 30%, transparent);
}
.brand { display: flex; align-items: center; gap: 9px; color: inherit; text-decoration: none; font-size: 15px; font-weight: 750; letter-spacing: -.02em; }
.brand b { color: var(--mauve); }
.brand-icon {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  color: var(--crust);
  background: var(--mauve);
  border-radius: 10px 10px 10px 3px;
  box-shadow: 4px 4px 0 color-mix(in srgb, var(--mauve) 25%, var(--surface-0));
}
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.ghost-link {
  min-height: 32px;
  padding: 0 12px;
  display: flex; align-items: center;
  color: var(--subtext-0);
  text-decoration: none;
  border: 1px solid color-mix(in srgb, var(--surface-2) 42%, transparent);
  border-radius: 8px;
  background: var(--base);
  box-shadow: var(--neu-raised-soft);
  font: 650 10px/1 var(--mono);
  letter-spacing: .04em;
  transition: color .18s, border-color .18s, transform .18s;
}
.ghost-link:hover { color: var(--mauve); border-color: color-mix(in srgb, var(--mauve) 55%, transparent); transform: translateY(-1px); }
.ghost-link:active { transform: translateY(1px); box-shadow: var(--neu-inset-soft); }

/* ── Hero ─────────────────────────────────────────────────────────────────── */

.hero { padding: clamp(44px, 7vw, 78px) 0 clamp(34px, 5vw, 54px); }
.eyebrow { display: flex; align-items: center; gap: 8px; margin-bottom: 13px; color: var(--mauve); font: 700 11px/1 var(--mono); letter-spacing: .08em; }
.hero h1 { margin: 0; font-size: clamp(34px, 4.6vw, 54px); line-height: .98; letter-spacing: -.05em; font-weight: 820; }
.hero h1 em { color: var(--mauve); font-style: normal; }
.hero > p { max-width: 560px; margin: 16px 0 24px; color: var(--subtext-1); font-size: 15px; line-height: 1.6; }

.command {
  max-width: 100%;
  min-height: 48px;
  padding: 0 11px 0 16px;
  display: inline-flex; align-items: center; gap: 18px;
  color: var(--text);
  border: 1px solid color-mix(in srgb, var(--surface-2) 40%, transparent);
  border-radius: 13px;
  background: color-mix(in srgb, var(--crust) 38%, var(--mantle));
  box-shadow: var(--neu-inset);
  cursor: pointer;
  transition: border-color .18s, transform .18s;
}
.command:hover { border-color: color-mix(in srgb, var(--mauve) 45%, transparent); }
.command:active { transform: translateY(1px); }
.command code { font: 650 13px/1 var(--mono); letter-spacing: -.01em; white-space: nowrap; }
.command .prompt { margin-right: 10px; color: var(--mauve); }
.copy-hint {
  padding: 6px 9px;
  color: var(--overlay-1);
  border: 1px solid color-mix(in srgb, var(--surface-2) 42%, transparent);
  border-radius: 7px;
  background: var(--base);
  box-shadow: var(--neu-raised-soft);
  font: 750 9px/1 var(--mono);
  letter-spacing: .06em;
}
.command:hover .copy-hint { color: var(--mauve); border-color: color-mix(in srgb, var(--mauve) 45%, transparent); }
.command.copied .copy-hint { color: var(--green); border-color: color-mix(in srgb, var(--green) 45%, transparent); }

.hero-stats { margin-top: 22px; display: flex; flex-wrap: wrap; gap: 9px; }
.hero-stats span {
  padding: 7px 11px;
  display: inline-flex; align-items: center; gap: 7px;
  color: var(--overlay-1);
  border: 1px solid color-mix(in srgb, var(--surface-2) 42%, transparent);
  border-radius: 999px;
  background: var(--base);
  box-shadow: var(--neu-raised-soft);
  font: 600 11px/1 var(--mono);
}

/* ── Race ─────────────────────────────────────────────────────────────────── */

.race-view { padding: 0 0 clamp(56px, 8vw, 96px); }
.race-header { margin-bottom: 22px; display: flex; justify-content: space-between; align-items: end; gap: 30px; }
.race-header h2 { margin: 0; font-size: clamp(26px, 3.2vw, 40px); line-height: .98; letter-spacing: -.055em; font-weight: 820; }
.sim-tag {
  padding: 3px 5px;
  color: var(--overlay-1);
  border: 1px solid color-mix(in srgb, var(--surface-2) 45%, transparent);
  border-radius: 4px;
  background: color-mix(in srgb, var(--surface-0) 30%, transparent);
  font: 750 8px/1 var(--mono);
  font-style: normal;
  letter-spacing: .06em;
}

.heat-switcher { display: flex; align-items: center; gap: 9px; color: var(--overlay-0); font: 650 11px var(--mono); }
.heat-switcher > span { display: flex; align-items: center; gap: 7px; transition: color .2s; }
.heat-switcher > span span {
  width: 28px; height: 28px;
  display: grid; place-items: center;
  border: 1px solid currentColor;
  border-radius: 8px;
}
.heat-switcher > span.active { color: var(--mauve); }
.heat-switcher > span.done { color: var(--green); }
.heat-switcher i { width: 24px; height: 1px; background: var(--surface-1); }

.overall-progress {
  margin-bottom: 14px;
  padding: 12px 14px;
  border: 1px solid color-mix(in srgb, var(--surface-2) 40%, transparent);
  border-radius: 11px;
  background: var(--base);
  box-shadow: var(--neu-raised-soft), inset 1px 1px color-mix(in srgb, var(--surface-2) 30%, transparent);
}
.overall-progress > div:first-child { margin-bottom: 8px; display: flex; justify-content: space-between; color: var(--subtext-0); font: 650 11px var(--mono); font-variant-numeric: tabular-nums; }
.progress-track { height: 7px; overflow: hidden; border-radius: 999px; background: var(--crust); box-shadow: var(--neu-inset-soft); }
.progress-track span { height: 100%; display: block; border-radius: inherit; background: linear-gradient(90deg, var(--mauve), var(--pink), var(--peach)); transition: width .35s; }

/* Stacked by default; the split layout below widens this to a 2x2 grid. */
.race-lanes { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }

.race-lane {
  min-width: 0;
  position: relative;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--lane-color) 22%, var(--surface-1));
  border-radius: 14px;
  background: linear-gradient(145deg, color-mix(in srgb, var(--lane-color) 7%, var(--base)), var(--base) 58%);
  box-shadow: var(--neu-raised-soft), inset 1px 1px color-mix(in srgb, var(--lane-color) 12%, var(--surface-2));
  transition: border-color .2s, transform .2s, box-shadow .2s;
}
.race-lane.status-running {
  border-color: color-mix(in srgb, var(--lane-color) 62%, var(--surface-0));
  transform: translateY(-2px);
  box-shadow: var(--neu-raised), inset 1px 1px color-mix(in srgb, var(--lane-color) 13%, transparent);
}
.lane-stripe { height: 5px; background: var(--lane-color); }
.status-running .lane-stripe { animation: lanePulse 1.2s ease-in-out infinite; }

.lane-head { min-height: 70px; padding: 10px 14px; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid color-mix(in srgb, var(--surface-2) 34%, transparent); }
.lane-position {
  width: 30px; height: 30px;
  display: grid; place-items: center;
  flex: 0 0 auto;
  color: var(--crust);
  border-radius: 9px;
  background: var(--lane-color);
  box-shadow: 2px 2px 5px var(--neu-dark-soft), inset 0 1px rgb(255 255 255 / .1);
  font: 800 11px/1 var(--mono);
}
.harness-mark {
  width: 26px; height: 26px;
  display: inline-grid; place-items: center;
  flex: 0 0 auto;
  color: var(--lavender);
  border: 1px solid color-mix(in srgb, currentColor 42%, var(--surface-0));
  border-radius: 8px;
  background: color-mix(in srgb, currentColor 10%, var(--base));
  box-shadow: var(--neu-raised-soft);
}
.harness-mark svg { width: 15px; height: 15px; }
.lane-identity { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 4px; }
.lane-identity strong { font: 700 14px var(--sans); }
.lane-identity span { color: var(--overlay-2); font: 500 10px var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lane-status { display: flex; align-items: center; gap: 6px; color: var(--overlay-1); font: 700 9px var(--mono); letter-spacing: .04em; white-space: nowrap; }
.status-running .lane-status { color: var(--lane-color); }
.status-complete .lane-status { color: var(--green); }
.lane-status svg { width: 13px; height: 13px; }
.lane-status .spin { animation: spin 1s linear infinite; }

.lane-metrics {
  display: grid;
  grid-template-columns: .85fr 1fr 1.25fr;
  border-bottom: 1px solid color-mix(in srgb, var(--surface-2) 34%, transparent);
  background: color-mix(in srgb, var(--crust) 30%, var(--mantle));
  box-shadow: var(--neu-inset-soft);
}
.metric { min-width: 0; padding: 12px 13px; display: flex; flex-direction: column; gap: 6px; border-right: 1px solid color-mix(in srgb, var(--surface-2) 26%, transparent); }
.metric:last-child { border-right: 0; }
.metric span { color: var(--overlay-1); font: 650 9px var(--mono); }
.metric strong { font: 650 21px/1 var(--mono); font-variant-numeric: tabular-nums; }
.metric:nth-child(3) strong { font-size: 28px; }
.metric-accent strong { color: var(--lane-color); }

.stream-window {
  height: 258px;
  margin: 11px;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--surface-0);
  border-radius: 10px;
  background: var(--crust);
  box-shadow: var(--neu-inset);
}
.stream-toolbar {
  flex: 0 0 36px;
  padding: 0 11px;
  display: flex; align-items: center; justify-content: space-between;
  color: var(--overlay-1);
  border-bottom: 1px solid color-mix(in srgb, var(--surface-2) 32%, transparent);
  font: 650 9px var(--mono);
  letter-spacing: .04em;
}
.stream-toolbar span { display: flex; align-items: center; gap: 6px; }
.stream-toolbar svg { width: 13px; height: 13px; }
.stream-window pre {
  flex: 1;
  overflow: auto;
  margin: 0;
  padding: 14px;
  color: var(--subtext-1);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font: 500 11px/1.65 var(--mono);
  scrollbar-color: var(--surface-1) transparent;
}
.stream-window pre.idle { color: var(--overlay-0); }
.cursor { width: 6px; height: 14px; display: inline-block; margin-left: 3px; vertical-align: -2px; background: var(--lane-color); animation: blink .75s steps(2) infinite; }
.cursor.hidden { opacity: 0; animation: none; }
.lane-progress { height: 5px; background: var(--crust); box-shadow: var(--neu-inset-soft); }
.lane-progress span { height: 100%; display: block; background: var(--lane-color); transition: width .35s; }

/* ── Footer ───────────────────────────────────────────────────────────────── */

footer {
  width: min(1240px, calc(100% - 40px));
  min-height: 72px;
  margin: 0 auto;
  padding: 16px 0;
  display: flex; align-items: center; justify-content: space-between; gap: 18px;
  border-top: 1px solid color-mix(in srgb, var(--surface-1) 40%, transparent);
  color: var(--overlay-1);
  font: 600 11px var(--mono);
}
.footer-brand { display: flex; align-items: center; gap: 10px; }
.footer-brand strong { color: var(--text); font: 750 13px var(--sans); letter-spacing: -.02em; }
.footer-brand b { color: var(--mauve); }

@keyframes lanePulse { 50% { filter: brightness(1.35); } }

/* ── Desktop: split the viewport, copy beside the race, no page scroll ────── */

@media (min-width: 1120px) and (min-height: 560px) {
  .app-shell { height: 100dvh; overflow: hidden; }
  main {
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(340px, .82fr) minmax(0, 1.55fr);
    column-gap: clamp(30px, 4vw, 68px);
    align-items: center;
  }

  .hero { padding: 0; align-self: center; }
  .hero h1 { font-size: clamp(34px, min(3.1vw, 5.6vh), 46px); }
  .hero > p { max-width: 440px; }

  .race-view {
    min-height: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: clamp(12px, 1.8vh, 22px) 0;
  }
  .topbar { min-height: 60px; }
  footer { min-height: 54px; padding: 10px 0; }
  /* The hero headline carries the page; the race just needs a label. */
  .race-header { margin-bottom: 12px; align-items: center; }
  .race-header h2 { display: none; }
  .race-header .eyebrow { margin-bottom: 0; }
  .overall-progress { margin-bottom: 10px; padding: 9px 12px; }
  .overall-progress > div:first-child { margin-bottom: 6px; }

  /* Two lanes side by side; the taller viewport below stacks a second row. */
  .race-lanes {
    flex: 1;
    min-height: 0;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: minmax(0, 1fr);
  }
  .race-lane { display: flex; flex-direction: column; min-height: 0; }
  .lane-head { min-height: 60px; padding: 8px 12px; gap: 9px; }
  .metric { padding: 10px 12px; gap: 5px; }
  .metric strong { font-size: 18px; }
  .metric:nth-child(3) strong { font-size: 23px; }
  .stream-window { flex: 1; height: auto; min-height: 110px; margin: 9px; }
}

/* Tall enough for the full four-lane field. Must match FULL_FIELD in race.js. */
@media (min-width: 1120px) and (min-height: 720px) {
  .race-lanes { grid-template-rows: repeat(2, minmax(0, 1fr)); }
}

/* ── Responsive ───────────────────────────────────────────────────────────── */

@media (max-width: 900px) {
  .race-header { flex-direction: column; align-items: flex-start; }
  .race-header-right { width: 100%; }
}

@media (max-width: 640px) {
  main { width: calc(100% - 28px); }
  footer { width: calc(100% - 28px); flex-direction: column; align-items: flex-start; gap: 10px; }
  .hero { padding-top: 44px; }
  .command { width: 100%; justify-content: space-between; gap: 12px; padding-inline: 16px 12px; }
  .command code { font-size: 13px; }
  .heat-switcher { flex-direction: column; align-items: flex-start; gap: 7px; }
  .heat-switcher i { display: none; }
  .metric { padding-inline: 10px; }
  .metric strong { font-size: 18px; }
  .metric:nth-child(3) strong { font-size: 22px; }
  .stream-window { height: 218px; }
}
