:root {
  --paper: #f3efe4;
  --sheet: #fbf8f1;
  --ink: #1b2430;
  --muted: #5e6a78;
  --line: #243044;
  --dim: #c8bfae;
  --red: #9d2c2c;
  --tube: #1f4e79;
  --wheel: #22282f;
  --body: #d5e0ea;
  --stair: #e4d9c4;
  --gap: #efe2b8;
  --ok: #1d6b45;
  --open: #8a5a12;
  --buy: #1d4e89;
  --hand: #3d5a45;
  --later: #5c6570;
  --chip: #efe8d8;
  --shadow: 0 1px 0 rgba(27, 36, 48, 0.06);
  font-family: "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* { box-sizing: border-box; }
body { margin: 0; }
button, input { font: inherit; color: inherit; }

.page { max-width: 1180px; margin: 0 auto; padding: 28px 22px 64px; }

header.mast {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-end;
  border-bottom: 2px solid var(--ink);
  padding-bottom: 14px;
  margin-bottom: 18px;
}
.mast h1 { font-size: 28px; font-weight: 650; letter-spacing: -0.03em; margin: 0 0 4px; }
.mast p { margin: 0; color: var(--muted); max-width: 46rem; line-height: 1.4; }
.kicker {
  margin: 0 0 2px;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.stamp {
  font-family: ui-monospace, "Cascadia Code", monospace;
  font-size: 12px;
  text-align: right;
  line-height: 1.45;
  white-space: nowrap;
}
nav.pages { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
nav.pages a {
  text-decoration: none;
  color: var(--ink);
  background: #fff;
  border: 1px solid #c3b8a4;
  border-radius: 4px;
  padding: 5px 10px;
  font-size: 14px;
}
nav.pages a[aria-current="page"] { background: var(--ink); color: #fff; border-color: var(--ink); }

.transport {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
  margin-top: 10px;
  padding: 8px 10px;
  background: #fff;
  border: 1px solid #d2c8b6;
}
button.play { min-width: 92px; font-weight: 650; padding: 7px 16px; }
.transport .now {
  font-family: ui-monospace, "Cascadia Code", monospace;
  font-size: 13px;
}
.transport label { display: flex; flex-direction: column; gap: 2px; font-size: 12px; color: var(--muted); }

.stage {
  display: grid;
  grid-template-columns: 8.5rem 1fr;
  gap: 6px 18px;
  padding: 14px 0;
  border-bottom: 1px solid #e4dccb;
}
.stage h3 {
  margin: 2px 0 0;
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.lanes { display: grid; gap: 8px; }
.branch { display: flex; flex-wrap: wrap; gap: 8px; align-items: stretch; }
.modes { display: flex; flex-wrap: wrap; gap: 8px; }
.mode-name {
  background: #fff;
  border: 1px solid #d2c8b6;
  padding: 8px 12px;
  font-family: ui-monospace, "Cascadia Code", monospace;
  font-size: 13px;
}
.table-wrap { overflow-x: auto; background: #fff; border: 1px solid #e4dccb; }
.totals {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 14px;
}
.totals div { background: #fff; border: 1px solid #d2c8b6; padding: 10px 12px; }
.totals strong { display: block; font-size: 22px; letter-spacing: -0.02em; margin-top: 2px; }
.totals span { color: var(--muted); font-size: 12px; letter-spacing: 0.04em; text-transform: uppercase; }
.callout {
  margin-top: 12px;
  padding: 10px 12px;
  background: #f6f1e6;
  border-left: 3px solid var(--open);
  font-size: 14px;
  line-height: 1.4;
}

.views { display: grid; grid-template-columns: 1.25fr 0.9fr; gap: 16px; }
.card {
  background: var(--sheet);
  border: 1px solid #d9d0c0;
  box-shadow: var(--shadow);
  padding: 12px 12px 14px;
}
.card h2 {
  margin: 0 0 2px;
  font-size: 15px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.card .hint { margin: 0 0 8px; color: var(--muted); font-size: 13px; line-height: 1.35; }
svg.sheet { width: 100%; height: auto; display: block; background: #fffdf8; border: 1px solid var(--dim); }

.pair-wrap { margin-top: 16px; }
.pair-controls { display: grid; grid-template-columns: 1fr 1fr 0.8fr; gap: 12px 18px; align-items: end; }
.climb-bar { margin-top: 4px; }
#wheelDrive { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 8px 14px; flex: 1 1 100%; }
#wheelDrive[hidden], #wheelAsk[hidden], #jointAsk[hidden] { display: none; }
#jointAsk, #wheelAsk { display: contents; }
input:disabled { opacity: 0.45; }
.pair-controls h3 { margin: 0 0 6px; font-size: 13px; letter-spacing: 0.03em; text-transform: uppercase; }
.leg-right h3 { color: #1f4e79; }
.leg-left h3 { color: #6d7f90; }
.controls { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: end; margin-top: 10px; }
.controls label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--muted); min-width: 140px; flex: 1; }
.controls label.mode { flex: 0 0 auto; min-width: 0; }
.presets { display: flex; flex-wrap: wrap; gap: 6px; }
button {
  background: #fff;
  border: 1px solid #c3b8a4;
  border-radius: 4px;
  padding: 5px 9px;
  cursor: pointer;
}
button[aria-pressed="true"], button.active { background: var(--ink); color: #fff; border-color: var(--ink); }
input[type="range"] { width: 100%; accent-color: var(--tube); }

.readout {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px 10px;
  margin-top: 10px;
  font-family: ui-monospace, "Cascadia Code", monospace;
  font-size: 12px;
}
.readout div { background: #f6f1e6; padding: 6px 8px; border-left: 3px solid var(--dim); }
.readout strong { display: block; font-weight: 650; color: var(--ink); }
.readout .bad { border-left-color: var(--red); }
.readout .good { border-left-color: var(--ok); }
.readout .open { border-left-color: var(--open); }

section.block { margin-top: 22px; }
section.block h2 {
  font-size: 15px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin: 0 0 8px;
  border-bottom: 1px solid var(--ink);
  padding-bottom: 4px;
}

.flow { display: grid; gap: 8px; }
.flow-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: stretch; }
.node {
  background: #fff;
  border: 1px solid #d2c8b6;
  padding: 8px 10px;
  min-width: 140px;
  flex: 1;
}
.node b { display: block; font-size: 14px; }
.node span { color: var(--muted); font-size: 12px; line-height: 1.35; }
.arrow { align-self: center; color: var(--muted); font-size: 18px; padding: 0 2px; }

table { width: 100%; border-collapse: collapse; font-size: 14px; background: #fff; }
th, td { text-align: left; padding: 7px 8px; border-bottom: 1px solid #e4dccb; vertical-align: top; }
th { font-size: 12px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); font-weight: 650; }
.chip {
  display: inline-block;
  font-size: 11px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 99px;
  background: var(--chip);
  white-space: nowrap;
}
.chip.settled { background: #d9eadf; color: var(--ok); }
.chip.hand { background: #e5efe8; color: var(--hand); }
.chip.buy { background: #d9e4f2; color: var(--buy); }
.chip.open { background: #f8eccf; color: var(--open); }
.chip.later { background: #eceff2; color: var(--later); }
.chip.bench { background: #f3e4d6; color: #7a4b24; }

footer.note { margin-top: 18px; color: var(--muted); font-size: 13px; line-height: 1.45; }

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}
.gallery figure {
  margin: 0;
  background: var(--sheet);
  border: 1px solid #d9d0c0;
  box-shadow: var(--shadow);
}
.gallery a { display: block; }
.gallery img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  display: block;
  background: #e6e1d6;
}
.gallery figcaption {
  padding: 8px 10px 10px;
  font-size: 13px;
  line-height: 1.35;
  color: var(--muted);
}
.gallery figcaption strong {
  display: block;
  color: var(--ink);
  font-weight: 650;
  margin-bottom: 2px;
}
.block .presets { margin-bottom: 8px; }
.mesh-stage {
  position: relative;
  height: min(70vh, 640px);
  min-height: 280px;
  background: #e6e1d6;
  border: 1px solid var(--dim);
  overflow: hidden;
}
.mesh-stage img {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #e6e1d6;
}
.mesh-stage img[hidden] { display: none; }
#mesh-canvas {
  display: block;
  width: 100%;
  height: 100%;
  background: #e6e1d6;
}
model-viewer.mesh { border: 0; }

@media (max-width: 700px) {
  .arrow:not(.word) { display: none; }
}
@media (max-width: 900px) {
  .views, .pair-controls, #wheelDrive { grid-template-columns: 1fr; }
  header.mast { flex-direction: column; align-items: flex-start; }
  .stamp { text-align: left; white-space: normal; }
  .readout { grid-template-columns: 1fr 1fr; }
  .stage { grid-template-columns: 1fr; gap: 4px; }
  .totals { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .page { padding: 16px 12px 40px; }
  .readout { grid-template-columns: 1fr; }
}

/* climb card additions */
.pair-views { display: grid; grid-template-columns: 2fr 1fr; gap: 12px; align-items: start; }
.front-wrap h3 { margin: 2px 0 6px; font-size: 0.95rem; }
.hint.small { font-size: 0.8rem; }
.strip { width: 100%; height: auto; display: block; margin-top: 8px; background: var(--sheet); border: 1px solid var(--dim); }
.strip.tall { margin-top: 4px; }
.knobs-title { margin: 18px 0 4px; }
.knobs { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 8px 14px; }
.knobs .presets { grid-column: 1 / -1; }
@media (max-width: 900px) {
  .pair-views { grid-template-columns: 1fr; }
}
