:root {
  color-scheme: light;
  --paper: #f2f0ea;
  --paper-raised: #faf9f5;
  --ink: #17201d;
  --muted: #68716d;
  --rule: #d4d5ce;
  --forest: #204c3f;
  --forest-dark: #173b31;
  --forest-soft: #dce7e0;
  --amber: #c58b42;
  --danger: #a34d43;
  --asphalt: #303735;
  --white: #fffef9;
  --radius: 14px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }

html {
  background: var(--paper);
  color: var(--ink);
}

body {
  min-width: 300px;
  margin: 0;
  background: var(--paper);
}

button,
select,
input { font: inherit; }

button,
select { color: inherit; }

button:focus-visible,
select:focus-visible,
input:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(32, 76, 63, 0.25);
  outline-offset: 3px;
}

a { color: inherit; }

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(1480px, calc(100% - 48px));
  height: 68px;
  margin: auto;
  border-bottom: 1px solid var(--rule);
}

.site-header nav {
  display: flex;
  gap: 22px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.site-header nav a { text-decoration: none; }
.site-header nav a:hover { color: var(--forest); }

.wordmark {
  display: inline-flex;
  gap: 11px;
  align-items: center;
  font-size: 14px;
  font-weight: 730;
  text-decoration: none;
}

.wordmark-mark {
  display: grid;
  grid-template-columns: repeat(2, 3px);
  gap: 4px;
  width: 25px;
  height: 25px;
  place-content: center;
  border-radius: 50%;
  background: var(--forest);
}

.wordmark-mark i {
  width: 3px;
  height: 13px;
  border-radius: 4px;
  background: var(--paper-raised);
}

main,
footer {
  width: min(1480px, calc(100% - 48px));
  margin: auto;
}

.intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 0.56fr);
  gap: clamp(40px, 7vw, 120px);
  align-items: end;
  padding: clamp(40px, 5vw, 68px) 0 34px;
}

.eyebrow,
.section-kicker {
  margin: 0 0 13px;
  color: var(--forest);
  font-size: 10px;
  font-weight: 780;
  letter-spacing: 0.11em;
  line-height: 1.5;
  text-transform: uppercase;
}

.eyebrow {
  display: flex;
  align-items: center;
}

.eyebrow span {
  width: 7px;
  height: 7px;
  margin-right: 10px;
  border: 2px solid var(--forest);
  border-radius: 50%;
  background: var(--paper);
  box-shadow: 0 0 0 3px var(--forest-soft);
}

h1,
.truth h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 400;
  letter-spacing: -0.045em;
}

h1 {
  font-size: clamp(43px, 5vw, 76px);
  line-height: 0.98;
}

.intro > p {
  margin: 0 0 3px;
  padding: 2px 0 2px 22px;
  border-left: 2px solid var(--forest);
  color: #42504b;
  font-size: clamp(14px, 1.15vw, 17px);
  line-height: 1.65;
}

.experience {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  overflow: hidden;
  border: 1px solid #bdc4be;
  border-radius: var(--radius);
  background: var(--paper-raised);
  box-shadow: 0 14px 50px rgba(29, 39, 35, 0.08);
}

.road-column {
  min-width: 0;
  border-right: 1px solid var(--rule);
}

.canvas-shell {
  position: relative;
  overflow: hidden;
  min-height: 430px;
  aspect-ratio: 16 / 9.2;
  background: var(--asphalt);
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.canvas-topline {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  display: flex;
  justify-content: space-between;
  padding: 17px 20px;
  color: rgba(255, 254, 249, 0.92);
  font-family: ui-monospace, "Cascadia Code", monospace;
  font-size: 10px;
  font-weight: 680;
  letter-spacing: 0.08em;
  pointer-events: none;
  text-transform: uppercase;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.55);
}

#run-state {
  display: flex;
  gap: 8px;
  align-items: center;
}

#run-state i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #79c8a7;
  box-shadow: 0 0 0 3px rgba(121, 200, 167, 0.14);
}

#run-state.connecting i,
#run-state.paused i { background: #e0b56c; }
#run-state.error i { background: #e57a6e; }

.load-state {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--asphalt);
  color: var(--white);
  transition: opacity 180ms ease, visibility 180ms ease;
}

.load-state[hidden] {
  visibility: hidden;
  display: flex;
  opacity: 0;
}

.load-state strong {
  margin-top: 17px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 22px;
  font-weight: 400;
}

.load-state small {
  margin-top: 7px;
  color: #c4ccc8;
}

.loader {
  width: 27px;
  height: 27px;
  border: 2px solid rgba(255, 255, 255, 0.18);
  border-top-color: #e6bc72;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.outcome-toast {
  position: absolute;
  right: 18px;
  bottom: 18px;
  max-width: min(360px, calc(100% - 36px));
  padding: 13px 15px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: rgba(24, 31, 29, 0.9);
  color: var(--white);
  font-size: 12px;
  line-height: 1.5;
  backdrop-filter: blur(10px);
}

.outcome-toast[data-kind="crash"] {
  top: 50%;
  right: auto;
  bottom: auto;
  left: 50%;
  width: min(430px, calc(100% - 36px));
  max-width: none;
  padding: 18px 20px;
  border-color: rgba(229, 109, 95, 0.72);
  background: rgba(50, 28, 25, 0.94);
  box-shadow: 0 18px 55px rgba(16, 12, 11, 0.36);
  font-size: 14px;
  font-weight: 680;
  text-align: center;
  transform: translate(-50%, -50%);
}

.primary-controls,
.scenario-controls {
  display: flex;
  gap: 10px;
  align-items: center;
  min-height: 68px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--rule);
}

.scenario-controls { border-bottom: 0; }

button {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  height: 39px;
  padding: 0 13px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 680;
  cursor: pointer;
}

button:disabled,
select:disabled,
input:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.primary-button {
  min-width: 96px;
  border: 0;
  background: var(--forest);
  color: white;
}

.primary-button:hover:not(:disabled) { background: var(--forest-dark); }
.primary-button .play-icon,
.primary-button.is-paused .pause-icon { display: none; }
.primary-button.is-paused .play-icon { display: block; }

.quiet-button {
  border: 1px solid var(--rule);
  background: transparent;
  color: #46504c;
}

.quiet-button:hover:not(:disabled),
.quiet-button[aria-pressed="true"] {
  border-color: #aebbb4;
  background: var(--forest-soft);
  color: var(--forest);
}

button svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.primary-button svg { fill: currentColor; stroke: none; }

.run-clock {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-left: auto;
  text-align: right;
}

.run-clock span,
.scenario-controls label > span,
.switch-control > span:last-child {
  color: var(--muted);
  font-size: 9px;
  font-weight: 720;
  letter-spacing: 0.075em;
  text-transform: uppercase;
}

.run-clock strong {
  font-family: ui-monospace, "Cascadia Code", monospace;
  font-size: 14px;
}

.scenario-controls label:not(.switch-control) {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

select {
  height: 32px;
  min-width: 110px;
  padding: 0 28px 0 9px;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: var(--paper-raised);
  font-size: 12px;
  font-weight: 650;
}

.switch-control {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-left: auto;
  cursor: pointer;
}

.switch-control input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.switch {
  position: relative;
  width: 32px;
  height: 18px;
  border-radius: 12px;
  background: #c8cbc6;
  transition: background 160ms ease;
}

.switch::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: white;
  content: "";
  transition: transform 160ms ease;
}

.switch-control input:checked + .switch { background: var(--forest); }
.switch-control input:checked + .switch::after { transform: translateX(14px); }

.telemetry {
  padding: 24px;
  background: #f7f6f1;
}

.telemetry-heading {
  display: flex;
  justify-content: space-between;
  min-height: 71px;
}

.telemetry .section-kicker { margin-bottom: 7px; }

.telemetry h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 25px;
  font-weight: 400;
  letter-spacing: -0.025em;
}

.intent-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid #b8c5be;
  border-radius: 50%;
  color: var(--forest);
  font-size: 18px;
}

.intent-reason {
  min-height: 40px;
  margin: 3px 0 20px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.primary-stat {
  padding: 18px 0 21px;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}

.stat-label,
.decision-block span,
.session-block span {
  color: var(--muted);
  font-size: 9px;
  font-weight: 720;
  letter-spacing: 0.075em;
  text-transform: uppercase;
}

.primary-stat p {
  display: flex;
  gap: 7px;
  align-items: baseline;
  margin: 6px 0 13px;
}

.primary-stat strong {
  font-family: ui-monospace, "Cascadia Code", monospace;
  font-size: 36px;
  font-weight: 500;
  letter-spacing: -0.06em;
}

.primary-stat p span {
  color: var(--muted);
  font-size: 10px;
}

.speed-track {
  position: relative;
  overflow: hidden;
  height: 5px;
  border-radius: 8px;
  background: #dfe1dc;
}

.speed-track i {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  border-radius: inherit;
  background: var(--forest);
  transition: width 80ms linear;
}

.speed-track b {
  position: absolute;
  top: -3px;
  bottom: -3px;
  left: 0;
  width: 2px;
  background: var(--amber);
  transition: left 80ms linear;
}

.speed-caption {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  color: #89918d;
  font-size: 9px;
}

.speed-caption span:nth-child(2) { color: #9c692b; }

.metric-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin: 0;
  padding: 8px 0;
}

.metric-grid div {
  padding: 12px 0;
  border-bottom: 1px solid var(--rule);
}

.metric-grid div:nth-child(odd) { border-right: 1px solid var(--rule); }
.metric-grid div:nth-child(even) { padding-left: 16px; }

.metric-grid dt {
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 9px;
  text-transform: uppercase;
}

.metric-grid dd {
  margin: 0;
  font-family: ui-monospace, "Cascadia Code", monospace;
  font-size: 16px;
}

.decision-block {
  padding: 17px 0;
  border-bottom: 1px solid var(--rule);
}

.decision-block > div,
.session-block > div {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}

.decision-block strong {
  max-width: 160px;
  overflow: hidden;
  color: var(--forest);
  font-size: 9px;
  letter-spacing: 0.045em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.decision-block p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.4;
}

.session-block { padding-top: 18px; }
.session-block .section-kicker { margin-bottom: 9px; }
.session-block > div { padding: 4px 0; }
.session-block strong {
  font-family: ui-monospace, "Cascadia Code", monospace;
  font-size: 10px;
  font-weight: 600;
}

.truth {
  display: grid;
  grid-template-columns: 0.85fr 1fr 0.8fr;
  gap: clamp(30px, 5vw, 80px);
  padding: clamp(62px, 8vw, 105px) 0;
}

.truth h2 {
  max-width: 410px;
  font-size: clamp(28px, 3vw, 43px);
  line-height: 1.05;
}

.truth > p {
  margin: 26px 0 0;
  color: #4e5954;
  font-size: 14px;
  line-height: 1.75;
}

code {
  padding: 1px 4px;
  border-radius: 4px;
  background: #e5e6e0;
  font-family: ui-monospace, "Cascadia Code", monospace;
  font-size: 0.9em;
}

.truth dl {
  margin: 25px 0 0;
  border-top: 1px solid var(--rule);
}

.truth dl div {
  padding: 12px 0;
  border-bottom: 1px solid var(--rule);
}

.truth dt {
  margin-bottom: 4px;
  color: var(--forest);
  font-size: 9px;
  font-weight: 730;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.truth dd {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

footer {
  display: flex;
  justify-content: space-between;
  padding: 23px 0 32px;
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

@media (max-width: 1060px) {
  .experience { grid-template-columns: minmax(0, 1fr) 295px; }
  .telemetry { padding: 21px; }
  .scenario-controls { flex-wrap: wrap; }
}

@media (max-width: 850px) {
  .intro { grid-template-columns: 1fr; gap: 23px; }
  .intro > p { max-width: 650px; }
  .experience { grid-template-columns: 1fr; }
  .road-column { border-right: 0; }
  .telemetry {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 30px;
    border-top: 1px solid var(--rule);
  }
  .telemetry-heading,
  .intent-reason,
  .primary-stat { grid-column: 1; }
  .metric-grid,
  .decision-block,
  .session-block { grid-column: 2; }
  .metric-grid { grid-row: 1 / span 2; padding-top: 0; }
  .decision-block { grid-row: 3; }
  .session-block { grid-row: 4; }
  .truth { grid-template-columns: 1fr 1fr; }
  .truth dl { grid-column: 1 / -1; margin-top: 0; }
}

@media (max-width: 620px) {
  .site-header,
  main,
  footer { width: min(100% - 28px, 1480px); }
  .site-header { height: 62px; }
  .intro { padding: 36px 0 27px; }
  h1 { font-size: clamp(41px, 13vw, 60px); }
  .intro > p { padding-left: 16px; font-size: 14px; }
  .experience {
    width: calc(100% + 28px);
    margin-left: -14px;
    border-right: 0;
    border-left: 0;
    border-radius: 0;
  }
  .canvas-shell { min-height: 360px; aspect-ratio: 4 / 3; }
  .canvas-topline { padding: 13px; font-size: 9px; }
  #canvas-seed { display: none; }
  .primary-controls,
  .scenario-controls { padding: 12px 13px; }
  .primary-controls { display: grid; grid-template-columns: repeat(3, 1fr); }
  .primary-controls button { width: 100%; height: 44px; padding: 0 8px; }
  .run-clock { grid-column: 1 / -1; flex-direction: row; justify-content: space-between; }
  .scenario-controls { display: grid; grid-template-columns: 1fr 1fr; }
  .scenario-controls label:not(.switch-control) { min-width: 0; }
  .scenario-controls select { width: 100%; min-width: 0; height: 38px; }
  .switch-control { margin: 0; min-height: 44px; }
  .scenario-controls button { width: 100%; height: 44px; }
  .telemetry { display: block; padding: 24px 18px 27px; }
  .metric-grid { padding-top: 8px; }
  .truth { grid-template-columns: 1fr; gap: 22px; padding: 66px 0; }
  .truth > p { margin-top: 0; }
  .truth dl { grid-column: auto; }
  footer { flex-direction: column; gap: 7px; }
}

@media (prefers-reduced-motion: reduce) {
  .loader { animation: none; }
  * { transition-duration: 0.01ms !important; }
}
