/* Path Planning — blueprint theme */

:root {
  color-scheme: dark;
  --bp-950: #041024;
  --bp-900: #061733;
  --bp-850: #08203f;
  --bp-800: #0b2a52;
  --bp-700: #0f3463;
  --bp-600: #164178;
  --grid: rgba(150, 196, 255, 0.055);
  --grid-strong: rgba(150, 196, 255, 0.1);
  --line: rgba(160, 205, 255, 0.16);
  --line-strong: rgba(160, 205, 255, 0.34);
  --ink: #eef5ff;
  --ink-soft: #bfd2ec;
  --muted: #8aa6cb;
  --cyan: #6edcff;
  --cyan-soft: rgba(110, 220, 255, 0.13);
  --orange: #ff7a3d;
  --orange-bright: #ff9563;
  --orange-soft: rgba(255, 122, 61, 0.15);
  --lime: #59f0a6;
  --amber: #ffcc4d;
  --red: #ff8f8f;
  --sans: "IBM Plex Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --max: 1380px;
  --radius: 3px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 64px;
}

body {
  margin: 0;
  background-color: var(--bp-800);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px),
    linear-gradient(var(--grid-strong) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-strong) 1px, transparent 1px);
  background-size: 24px 24px, 24px 24px, 120px 120px, 120px 120px;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
}

button,
input {
  font: inherit;
  color: inherit;
}

code,
pre,
kbd {
  font-family: var(--mono);
}

code {
  font-size: 0.86em;
}

p code,
li code,
dd code,
td code,
h3 code {
  padding: 1px 5px;
  border: 1px solid var(--line);
  background: rgba(4, 16, 36, 0.45);
  border-radius: var(--radius);
  overflow-wrap: anywhere;
}

kbd {
  display: inline-block;
  min-width: 1.5em;
  padding: 0 5px;
  border: 1px solid currentColor;
  border-radius: var(--radius);
  font-size: 0.72em;
  line-height: 1.5;
  text-align: center;
  opacity: 0.75;
}

h1,
h2,
h3,
h4,
p {
  margin-top: 0;
}

[hidden] {
  display: none !important;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
}

.icon {
  width: 16px;
  height: 16px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-fill {
  fill: currentColor;
  stroke: none;
}

.icon-sprite {
  display: none;
}

.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 100;
  padding: 8px 12px;
  background: var(--amber);
  color: var(--bp-950);
  transform: translateY(-160%);
}

.skip-link:focus {
  transform: none;
}

.wrap {
  width: min(calc(100% - 40px), var(--max));
  margin-inline: auto;
}

.label,
.eyebrow {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* Registration marks around a framed element */
.frame {
  position: relative;
}

.frame::before {
  --t: var(--line-strong);
  content: "";
  position: absolute;
  inset: -7px;
  pointer-events: none;
  background:
    linear-gradient(var(--t), var(--t)) top left / 14px 1px no-repeat,
    linear-gradient(var(--t), var(--t)) top left / 1px 14px no-repeat,
    linear-gradient(var(--t), var(--t)) top right / 14px 1px no-repeat,
    linear-gradient(var(--t), var(--t)) top right / 1px 14px no-repeat,
    linear-gradient(var(--t), var(--t)) bottom left / 14px 1px no-repeat,
    linear-gradient(var(--t), var(--t)) bottom left / 1px 14px no-repeat,
    linear-gradient(var(--t), var(--t)) bottom right / 14px 1px no-repeat,
    linear-gradient(var(--t), var(--t)) bottom right / 1px 14px no-repeat;
}

/* Top bar ------------------------------------------------------------------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid var(--line);
  background: rgba(6, 23, 51, 0.86);
  backdrop-filter: blur(10px);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 54px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.brand-mark {
  width: 28px;
  height: 28px;
}

.brand strong {
  font-family: var(--mono);
  font-size: 0.92rem;
  font-weight: 600;
}

.brand small {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.72rem;
}

.topnav {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.86rem;
}

.topnav a {
  padding: 6px 10px;
  border-radius: var(--radius);
  color: var(--ink-soft);
  text-decoration: none;
}

.topnav a:hover {
  background: var(--cyan-soft);
  color: var(--ink);
}

.topnav .gh {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-left: 6px;
  border: 1px solid var(--line-strong);
  color: var(--ink);
}

/* Intro --------------------------------------------------------------------- */

.intro {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px 40px;
  align-items: center;
  padding-block: 20px 18px;
}

.intro h1 {
  margin: 0;
  font-size: clamp(1.45rem, 2.05vw, 1.95rem);
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.12;
}

.intro h1 em {
  color: var(--cyan);
  font-style: normal;
}

.intro p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.95rem;
  line-height: 1.55;
}

.intro p a {
  color: var(--ink);
  text-decoration-color: var(--cyan);
  text-underline-offset: 3px;
}

/* App ----------------------------------------------------------------------- */

.app {
  display: flex;
  flex-direction: column;
  height: clamp(580px, calc(100svh - 140px), 940px);
  border: 1px solid var(--line-strong);
  background: var(--bp-900);
  box-shadow: 0 30px 80px rgba(2, 8, 20, 0.45);
}

.toolbar {
  position: relative;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--bp-850);
}

.seg {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--bp-950);
}

.seg button {
  min-width: 52px;
  min-height: 34px;
  padding: 4px 12px;
  border: 0;
  border-radius: var(--radius);
  background: none;
  color: var(--ink-soft);
  font-family: var(--mono);
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
}

.seg button:hover {
  background: var(--cyan-soft);
  color: var(--ink);
}

.seg button[aria-checked="true"] {
  background: var(--ink);
  color: var(--bp-900);
}

.tool-btn {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 42px;
  padding: 4px 10px 4px 5px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--bp-950);
  cursor: pointer;
  text-align: left;
}

.tool-btn:hover,
.tool-btn[aria-expanded="true"] {
  border-color: var(--line-strong);
  background: var(--bp-800);
}

.tool-btn .icon {
  color: var(--muted);
}

.tool-btn-text {
  display: grid;
  line-height: 1.15;
}

.tool-btn small {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.6rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.tool-btn strong {
  font-family: var(--mono);
  font-size: 0.82rem;
  font-weight: 600;
}

.tool-btn-plain {
  padding-left: 11px;
}

.mini-thumb {
  width: 32px;
  height: 32px;
  border-radius: 2px;
  background: var(--bp-950);
}

.dropdown {
  position: relative;
}

.menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 20;
  width: max-content;
  max-width: min(92vw, 420px);
  padding: 14px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--bp-850);
  box-shadow: 0 24px 60px rgba(2, 8, 20, 0.6);
}

.map-grid {
  display: grid;
  grid-template-columns: repeat(3, 116px);
  gap: 8px;
}

.map-option {
  display: grid;
  gap: 2px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--bp-950);
  cursor: pointer;
  text-align: left;
}

.map-option:hover {
  border-color: var(--line-strong);
}

.map-option[aria-checked="true"] {
  border-color: var(--cyan);
  box-shadow: 0 0 0 1px var(--cyan);
}

.map-option canvas {
  width: 100%;
  aspect-ratio: 1;
  margin-bottom: 4px;
  border-radius: 2px;
}

.map-option strong {
  font-family: var(--mono);
  font-size: 0.74rem;
  font-weight: 600;
}

.map-option small {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.62rem;
}

.menu-note {
  margin: 12px 2px 0;
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.45;
}

.settings-menu {
  width: 340px;
}

.menu-section + .menu-section {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.menu-section h3 {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.66rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.menu-section h3 small {
  letter-spacing: 0.02em;
  text-transform: none;
}

.point-inputs {
  display: grid;
  grid-template-columns: 54px 1fr 1fr;
  gap: 6px;
  align-items: center;
}

.point-name {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--mono);
  font-size: 0.74rem;
}

.field {
  display: flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bp-950);
}

.field:focus-within {
  border-color: var(--cyan);
}

.field > span {
  padding-left: 8px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.7rem;
}

.field input {
  width: 100%;
  min-width: 0;
  padding: 6px 8px;
  border: 0;
  background: transparent;
  font-family: var(--mono);
  font-size: 0.8rem;
}

.field input:focus {
  outline: none;
}

.note {
  min-height: 1.1em;
  margin: 8px 0 0;
  color: var(--amber);
  font-size: 0.72rem;
  line-height: 1.35;
}

.params {
  display: grid;
  gap: 10px;
}

.param {
  display: grid;
  gap: 5px;
}

.param-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.param-head code {
  color: var(--ink);
  font-size: 0.74rem;
}

.param-head output,
.param-head small,
.param-foot {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.66rem;
}

.param-foot {
  display: flex;
  justify-content: space-between;
}

.param-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.seg-small button {
  min-width: 40px;
  min-height: 28px;
  font-size: 0.78rem;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--cyan);
}

.text-btn {
  padding: 2px 0;
  border: 0;
  background: none;
  color: var(--cyan);
  font-size: 0.76rem;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.menu-foot {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
}

.points {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.point-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 4px 11px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--bp-950);
  font-family: var(--mono);
  font-size: 0.78rem;
  cursor: pointer;
  font-variant-numeric: tabular-nums;
}

.point-chip:hover {
  border-color: var(--line-strong);
}

.point-chip[aria-pressed="true"] {
  border-color: var(--ink-soft);
  background: var(--bp-800);
}

.point-chip small {
  color: var(--muted);
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.icon-btn {
  display: inline-grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: none;
  cursor: pointer;
}

.icon-btn:hover:not(:disabled) {
  border-color: var(--line-strong);
  background: var(--cyan-soft);
}

.icon-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  flex: none;
  border: 2px solid var(--bp-950);
  border-radius: 50%;
  box-shadow: 0 0 0 1.5px currentColor;
}

.dot-start {
  color: var(--lime);
  background: var(--lime);
}

.dot-goal {
  color: var(--amber);
  background: var(--amber);
}

.run {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-width: 128px;
  min-height: 42px;
  margin-left: auto;
  padding: 6px 16px;
  border: 0;
  border-radius: 5px;
  background: var(--orange);
  color: #1b0a02;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 0 0 1px rgba(255, 149, 99, 0.5), 0 8px 24px rgba(255, 122, 61, 0.28);
}

.run:hover:not(:disabled) {
  background: var(--orange-bright);
}

.run:disabled {
  opacity: 0.55;
  cursor: progress;
}

.run kbd {
  opacity: 0.6;
}

.app-body {
  display: grid;
  flex: 1;
  grid-template-columns: minmax(0, 1fr) 330px;
  min-height: 0;
}

.stage {
  position: relative;
  min-width: 0;
  min-height: 0;
  background:
    linear-gradient(rgba(150, 196, 255, 0.04) 1px, transparent 1px) 0 0 / 16px 16px,
    linear-gradient(90deg, rgba(150, 196, 255, 0.04) 1px, transparent 1px) 0 0 / 16px 16px,
    var(--bp-950);
}

.canvas-box {
  position: absolute;
  inset: 12px 12px 56px;
  display: grid;
  place-items: center;
}

#map-canvas {
  display: block;
  width: 300px;
  height: 300px;
  cursor: crosshair;
  touch-action: manipulation;
  box-shadow: 0 0 0 1px var(--line-strong);
}

#map-canvas.over-marker {
  cursor: grab;
}

#map-canvas.dragging {
  cursor: grabbing;
}

.hud {
  position: absolute;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: rgba(4, 16, 36, 0.82);
  backdrop-filter: blur(6px);
  font-family: var(--mono);
  font-size: 0.7rem;
  pointer-events: none;
}

.hud-map {
  top: 20px;
  left: 20px;
  color: var(--ink-soft);
}

.hud-map strong {
  color: var(--ink);
  font-weight: 600;
}

.hud-cursor {
  color: var(--cyan);
}

.hud-hint {
  top: 20px;
  right: 20px;
  max-width: 200px;
  color: var(--ink);
  line-height: 1.45;
  text-align: right;
}

.hud-hint.hud-note {
  max-width: 250px;
  border-color: var(--amber);
  color: var(--amber);
  text-align: left;
}

.loading {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(4, 16, 36, 0.9);
  font-family: var(--mono);
  font-size: 0.8rem;
  text-align: center;
}

.loading p {
  max-width: 420px;
  margin: 0;
}

.loading .spinner {
  display: block;
  width: 26px;
  height: 26px;
  margin: 0 auto 14px;
  border: 2px solid var(--line-strong);
  border-top-color: var(--cyan);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

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

.playback {
  position: absolute;
  right: 12px;
  bottom: 10px;
  left: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 38px;
}

.progress {
  position: relative;
  flex: 1;
  height: 6px;
  overflow: hidden;
  border-radius: 3px;
  background: rgba(160, 205, 255, 0.14);
}

.progress-bar {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  background: var(--cyan);
}

.progress-bar.done {
  background: var(--orange);
}

.progress-text {
  min-width: 150px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.7rem;
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

.speed {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  width: 140px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.64rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* Side panel */

.side {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow-y: auto;
  border-left: 1px solid var(--line);
  background: var(--bp-850);
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}

.side-block {
  flex: none;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.side-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.side-head strong {
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 600;
  text-align: right;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 0.72rem;
}

.status i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
}

.status[data-state="ready"] i,
.status[data-state="found"] i {
  background: var(--lime);
  box-shadow: 0 0 0 4px rgba(89, 240, 166, 0.15);
}

.status[data-state="planning"] i,
.status[data-state="replaying"] i,
.status[data-state="loading"] i {
  background: var(--cyan);
  animation: pulse 1s ease-in-out infinite;
}

.status[data-state="paused"] i {
  background: var(--amber);
}

.status[data-state="nopath"] i,
.status[data-state="error"] i {
  background: var(--red);
}

@keyframes pulse {
  50% {
    opacity: 0.3;
  }
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, auto));
  justify-content: space-between;
  gap: 8px;
  margin: 10px 0 0;
}

.stats dt {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.56rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.stats dd {
  margin: 1px 0 0;
  font-family: var(--mono);
  font-size: 0.92rem;
  white-space: nowrap;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1.3;
}

.stats dd small {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 400;
}

.result-line {
  margin: 12px 0 0;
  font-size: 0.86rem;
  font-weight: 600;
}

.result-line.none {
  color: var(--red);
}

.side-output {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 92px;
}

.stdout {
  flex: 1 1 auto;
  min-height: 34px;
  margin: 7px 0 0;
  padding: 9px 11px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bp-950);
  color: var(--lime);
  font-size: 0.7rem;
  line-height: 1.5;
  white-space: pre-wrap;
}

.stdout .quiet {
  color: var(--muted);
}

.cost-chart {
  flex: none;
  margin: 8px 0 0;
}

.cost-chart figcaption {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  white-space: nowrap;
  margin-bottom: 5px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.6rem;
}

.cost-chart svg {
  display: block;
  width: 100%;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bp-950);
}

.compare-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 30px;
  padding: 4px 11px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--bp-950);
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
}

.btn:hover:not(:disabled) {
  border-color: var(--cyan);
}

.btn:disabled {
  opacity: 0.5;
  cursor: default;
}

.compare-table {
  width: 100%;
  margin-top: 6px;
  border-collapse: collapse;
  font-family: var(--mono);
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
}

.compare-table th {
  padding: 4px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.58rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-align: right;
  text-transform: uppercase;
}

.compare-table th:first-child,
.compare-table td:first-child {
  text-align: left;
}

.compare-table td {
  padding: 4px;
  border-bottom: 1px solid rgba(160, 205, 255, 0.08);
  text-align: right;
  white-space: nowrap;
}

.compare-table tr.empty td {
  color: var(--muted);
  font-family: var(--sans);
  font-size: 0.74rem;
  text-align: left;
  white-space: normal;
}

.compare-table td.best {
  color: var(--lime);
}

.compare-table td.none {
  color: var(--red);
}

.row-btn {
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink);
  font-family: var(--mono);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: var(--line-strong);
  text-underline-offset: 3px;
  cursor: pointer;
}

.row-btn:hover {
  color: var(--cyan);
}

.legend {
  display: flex;
  flex: none;
  flex-wrap: wrap;
  gap: 4px 12px;
  margin: 0;
  padding: 9px 14px 10px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.64rem;
  list-style: none;
}

.legend li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.swatch {
  width: 10px;
  height: 10px;
  border-radius: 2px;
}

.sw-free { background: #1d528f; }
.sw-wall { background: #061529; box-shadow: 0 0 0 1px var(--line-strong); }
.sw-visited { background: #4aa3e8; }
.sw-front { background: #c8f1ff; }
.sw-path { background: var(--orange); }

.keys {
  margin: 10px 0 0;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.64rem;
}

.side-foot {
  margin-top: auto;
  border-bottom: 0;
}

.demo-caption {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 0.8rem;
}

/* Sections -------------------------------------------------------------------- */

.section {
  padding-block: clamp(72px, 9vw, 120px);
}

.sheet-head {
  display: grid;
  grid-template-columns: 64px minmax(0, 1.4fr) minmax(0, 1fr);
  gap: 20px 32px;
  align-items: end;
  margin-bottom: 44px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line-strong);
}

.sheet-no {
  align-self: start;
  color: var(--orange);
  font-family: var(--mono);
  font-size: 0.82rem;
  font-weight: 600;
}

.sheet-head h2 {
  margin: 0;
  font-size: clamp(1.9rem, 3.6vw, 3rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.05;
}

.sheet-head p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.95rem;
}

.lead {
  max-width: 820px;
  margin: 0 0 48px;
  color: var(--ink-soft);
  font-size: 1.06rem;
  line-height: 1.65;
}

.family {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: clamp(28px, 4vw, 56px);
  align-items: start;
  margin-bottom: 36px;
}

.family-tag {
  display: inline-block;
  margin-bottom: 10px;
  color: var(--cyan);
  font-family: var(--mono);
  font-size: 0.74rem;
}

.family h3 {
  margin-bottom: 14px;
  font-size: clamp(1.35rem, 2.2vw, 1.8rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.family p {
  color: var(--ink-soft);
}

.code {
  margin: 0;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--bp-950);
}

.code figcaption {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 14px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.66rem;
}

.code pre {
  margin: 0;
  padding: 14px 16px;
  overflow-x: auto;
  color: #d8e6f8;
  font-size: 0.74rem;
  line-height: 1.6;
}

.code .kw {
  color: var(--cyan);
}

.code .cm {
  color: #6f8db5;
}

.code .hl {
  color: var(--orange-bright);
}

.container-map {
  display: grid;
  border-top: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 0.72rem;
}

.container-map div {
  display: grid;
  grid-template-columns: 1fr auto 70px;
  gap: 12px;
  padding: 9px 16px;
}

.container-map div + div {
  border-top: 1px solid var(--line);
}

.container-map b {
  color: var(--orange);
  font-weight: 400;
}

.container-map strong {
  color: var(--ink);
}

.cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
  margin-bottom: 88px;
}

.cards-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--bp-850);
}

.card-visual {
  margin: 0;
  border-bottom: 1px solid var(--line);
  background: var(--bp-950);
}

.card-visual canvas,
.card-visual svg {
  display: block;
  width: 100%;
  height: auto;
}

.card-visual canvas {
  aspect-ratio: 1;
}

.card-visual figcaption {
  padding: 8px 12px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.62rem;
  line-height: 1.45;
}

.card-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  padding: 18px 20px 20px;
}

.card-meta {
  margin-bottom: 6px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.64rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.card h3 {
  margin: 0 0 10px;
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.card p {
  margin-bottom: 12px;
  color: var(--ink-soft);
  font-size: 0.88rem;
}

.card dl {
  display: grid;
  gap: 8px;
  margin: 4px 0 18px;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
  font-size: 0.82rem;
}

.card dl div {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 10px;
}

.how-label {
  margin: 2px 0 4px;
  color: var(--cyan);
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.how {
  margin: 0 0 14px;
  padding: 0;
  list-style: none;
  counter-reset: how;
}

/* Text flows normally inside a step (it may hold <code>); the number sits
   in the left padding. */
.how li {
  position: relative;
  padding: 5px 0 5px 26px;
  border-top: 1px dashed var(--line);
  color: var(--ink-soft);
  font-size: 0.84rem;
  line-height: 1.5;
  counter-increment: how;
}

.how li::before {
  content: counter(how);
  position: absolute;
  top: 5px;
  left: 0;
  color: var(--orange);
  font-family: var(--mono);
  font-size: 0.72rem;
  line-height: 1.75;
}

.card dt {
  color: var(--cyan);
  font-family: var(--mono);
  font-size: 0.62rem;
  line-height: 1.95;
  text-transform: uppercase;
}

.card dd {
  margin: 0;
  color: var(--ink-soft);
  line-height: 1.45;
}

.card-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: auto;
}

.source-link {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.7rem;
  text-underline-offset: 3px;
}

.source-link:hover {
  color: var(--ink);
}

.formula {
  margin: 0 0 12px;
  padding: 9px 12px;
  border-left: 2px solid var(--orange);
  background: var(--orange-soft);
  font-family: var(--mono);
  font-size: 0.82rem;
}

.diagram text {
  font-family: var(--mono);
  font-size: 8px;
}

.glance h3 {
  margin-bottom: 14px;
  font-size: 1.1rem;
  font-weight: 600;
}

.table-wrap {
  position: relative;
  overflow-x: auto;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--bp-850);
}

.glance table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  font-size: 0.84rem;
}

.glance th,
.glance td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.glance th {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.6rem;
  font-weight: 500;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.glance tbody tr:last-child td {
  border-bottom: 0;
}

.glance td {
  color: var(--ink-soft);
}

.glance td:first-child {
  color: var(--ink);
  font-family: var(--mono);
  font-weight: 600;
}

/* Ideas */

.ideas {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}

.idea {
  display: flex;
  flex-direction: column;
  min-width: 0;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--bp-850);
}

.idea > svg {
  display: block;
  width: 100%;
  height: auto;
  border-bottom: 1px solid var(--line);
  background: var(--bp-950);
}

.idea > svg text {
  fill: var(--ink-soft);
  font-family: var(--mono);
  font-size: 8px;
}

.idea-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  padding: 16px 18px 18px;
}

.idea h3 {
  margin: 0 0 8px;
  font-size: 1.06rem;
  font-weight: 600;
}

.idea p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.86rem;
}

.idea-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto;
  padding-top: 14px;
}

/* Run natively */

.native {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(28px, 4vw, 56px);
  align-items: start;
}

.native p {
  color: var(--ink-soft);
}

.native .code pre {
  font-size: 0.76rem;
}

.yaml-key {
  color: var(--cyan);
}

.yaml-value {
  color: var(--orange-bright);
}

.yaml-comment {
  color: #6f8db5;
}

.credits {
  margin-top: 26px;
  padding-top: 18px;
  border-top: 1px dashed var(--line);
  color: var(--muted);
  font-size: 0.84rem;
}

.credits a {
  color: var(--ink-soft);
  text-underline-offset: 3px;
}

.link-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.btn-lg {
  min-height: 42px;
  padding: 8px 16px;
  font-size: 0.86rem;
  text-decoration: none;
}

.btn-orange {
  border-color: var(--orange);
  background: var(--orange);
  color: #1b0a02;
}

.btn-orange:hover:not(:disabled) {
  border-color: var(--orange-bright);
  background: var(--orange-bright);
}

/* Footer */

.footer {
  border-top: 1px solid var(--line);
  background: rgba(4, 16, 36, 0.6);
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 24px;
  min-height: 80px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.74rem;
}

.footer-inner div {
  display: flex;
  gap: 18px;
}

.footer-inner a {
  text-underline-offset: 3px;
}

.footer-inner a:hover {
  color: var(--ink);
}

/* Responsive -------------------------------------------------------------------- */

@media (max-width: 1180px) {
  .app-body {
    grid-template-columns: minmax(0, 1fr) 290px;
  }

  .progress-text {
    min-width: 0;
  }

  .speed {
    width: 110px;
  }

  .ideas {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 1100px) {
  .intro {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 920px) {
  .intro,
  .family,
  .native {
    grid-template-columns: minmax(0, 1fr);
  }

  .app {
    height: auto;
  }

  .app-body {
    grid-template-columns: minmax(0, 1fr);
  }

  .stage {
    display: flex;
    flex-direction: column;
  }

  .canvas-box {
    position: relative;
    inset: auto;
    margin: 10px;
    aspect-ratio: 1;
  }

  .playback {
    position: static;
    margin: 0 10px 10px;
  }

  .side {
    overflow: visible;
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .stdout {
    max-height: 160px;
  }

  .run {
    flex: 1 0 100%;
    order: 10;
  }

  .seg.planners {
    flex: 1 0 100%;
  }

  .seg.planners button {
    flex: 1;
  }

  .cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .sheet-head {
    grid-template-columns: 48px minmax(0, 1fr);
  }

  .sheet-head p {
    grid-column: 2;
  }
}

@media (max-width: 640px) {
  .wrap {
    width: min(calc(100% - 24px), var(--max));
  }

  .brand small,
  .topnav a:not(.gh) {
    display: none;
  }

  .toolbar {
    gap: 8px;
    padding: 8px;
  }

  .seg button {
    min-width: 0;
    padding: 4px 6px;
  }

  .points {
    flex: 1 0 100%;
  }

  .point-chip {
    flex: 1;
    justify-content: center;
  }

  .hud-hint:not(.hud-note) {
    display: none;
  }

  .hud-hint.hud-note {
    left: 20px;
    max-width: none;
  }

  .speed {
    width: 84px;
  }

  .speed span {
    display: none;
  }

  .menu {
    position: fixed;
    top: 120px;
    right: 12px;
    left: 12px;
    width: auto;
    max-width: none;
  }

  .map-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .cards,
  .cards-2,
  .ideas {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .status i,
  .loading .spinner {
    animation: none !important;
  }
}

.compare-table td.wait {
  color: var(--muted);
  text-align: right;
}

@media (max-width: 640px), (hover: none) {
  .run kbd,
  .keys {
    display: none;
  }
}
