/* Colours come from /windrose.css; the local names are kept so the rules
   below did not have to be rewritten one at a time. */
:root {
  color-scheme:light;
  --ink:var(--wr-ink);
  --muted:var(--wr-ink-muted);
  --line:var(--wr-rule);
  --blue:var(--wr-accent);
  --hot:var(--wr-hot);
  --paper:var(--wr-card);
  --bg:var(--wr-page)
}
* {
  box-sizing:border-box
}
body {
  margin:0;
  background:var(--bg);
  color:var(--ink);
  font:14px/1.5 system-ui,-apple-system,sans-serif
}
body.embed {
  background:var(--paper)
}
button,input,select {
  font:inherit;
  color:inherit
}
button,select {
  cursor:pointer
}
button,input,select {
  border:1px solid #bac9d4;
  border-radius:6px;
  background:#fff;
  color:#1a2330;
  padding:8px
}
button:hover {
  background:#edf5fa
}
button:disabled {
  opacity:.4;
  cursor:default
}
a {
  color:var(--blue)
}
button:focus-visible,input:focus-visible,select:focus-visible,a:focus-visible,summary:focus-visible {
  outline:3px solid var(--wr-accent);
  outline-offset:2px
}
header {
  background:var(--wr-mast);
  color:var(--wr-mast-ink);
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:20px;
  padding:18px 24px
}
body.embed header {
  display:none
}
header .eyebrow {
  font-size:10px;
  letter-spacing:.13em;
  color:#b7d7ed;
  text-decoration:none
}
h1 {
  font-size:26px;
  line-height:1.2;
  margin:5px 0 8px;
  font-weight:600;
  letter-spacing:-.03em
}
header p {
  font-size:12px;
  margin:0;
  color:#c3d3df
}
header label {
  font-size:11px;
  min-width:150px
}
header .flow-link {
  color:var(--wr-mast-ink);
  white-space:nowrap;
  font-size:12px;
}
header select {
  display:block;
  width:100%;
  margin-top:4px
}
h2 {
  font-size:16px;
  margin:3px 0 6px;
  line-height:1.4
}
h3 {
  font-size:13px;
  margin:20px 0 8px
}
small,.note {
  color:var(--muted);
  font-size:11px;
  line-height:1.6
}
main {
  display:grid;
  grid-template-columns:260px minmax(300px,1fr) 340px;
  gap:12px;
  padding:12px;
  height:calc(100dvh - 120px);
  min-height:560px
}
body.embed main {
  grid-template-columns:minmax(0,1fr);
  height:100dvh;
  min-height:0;
  padding:10px
}
.panel {
  background:var(--paper);
  border:1px solid var(--line);
  border-radius:9px;
  min-height:0;
  min-width:0;
  overflow:hidden
}
.panel-head {
  padding:14px;
  border-bottom:1px solid var(--line)
}
.panel-head small {
  display:block
}
.panel-head a {
  font-size:12px
}
.navigator {
  display:flex;
  flex-direction:column
}
body.embed .navigator,
body.embed .references {
  display:none
}
.navigator label {
  font-size:11px;
  font-weight:650;
  display:block;
  margin-bottom:5px
}
.navigator input,.navigator select {
  width:100%;
  font-size:12px
}
.navigator input {
  margin-bottom:12px
}
#stationMeta {
  margin-top:8px
}
#operationList {
  overflow:auto;
  flex:1;
  min-height:0
}
.operation {
  display:block;
  border:0;
  border-bottom:1px solid var(--line);
  border-radius:0;
  background:#fff;
  text-align:left;
  padding:12px 14px;
  width:100%
}
.operation strong {
  display:block;
  font-size:12px;
  font-weight:550;
  line-height:1.5
}
.operation small {
  font-size:10px
}
.operation.active {
  background:#fff1e9;
  box-shadow:inset 3px 0 var(--hot)
}
.operation.active strong {
  color:#8a3519
}
.op-code {
  font-size:10px;
  color:var(--blue);
  font-weight:700;
  letter-spacing:.04em
}
.workarea {
  min-width:0;
  min-height:0;
  display:grid;
  grid-template-rows:minmax(240px,1fr) minmax(200px,.75fr);
  gap:12px
}
body.embed .workarea {
  height:100%;
  grid-template-rows:minmax(320px,1.2fr) minmax(220px,.8fr)
}
.stage {
  position:relative;
  overflow:hidden;
  border:1px solid #cbd9e2;
  border-radius:9px;
  background:radial-gradient(ellipse at 50% 40%,#fff,#e1eaf1)
}
body.embed .stage {
  min-height:0
}
canvas {
  display:block;
  width:100%;
  height:100%
}
.hud {
  position:absolute;
  left:14px;
  top:12px;
  right:14px;
  pointer-events:none
}
.hud strong {
  font-size:12px;
  display:block
}
.hud span {
  display:block;
  font-size:11px;
  color:var(--wr-ink-muted);
  max-width:450px;
  white-space:pre-line
}
.stage-tools {
  position:absolute;
  bottom:12px;
  left:12px;
  display:flex;
  gap:6px;
  align-items:center
}
.stage-tools button,.stage-tools label {
  background:#ffffffef;
  padding:6px 8px;
  font-size:10px;
  border:1px solid #c4d2dc;
  border-radius:5px
}
.stage-tools input {
  vertical-align:middle;
  margin:0 3px 0 0
}
.gesture {
  position:absolute;
  bottom:49px;
  left:14px;
  font-size:9px;
  color:var(--muted)
}
.instructions {
  overflow:auto
}
body.embed .instructions {
  max-height:none
}
.instruction-body {
  padding:14px
}
.step-controls {
  display:flex;
  gap:8px
}
.step-controls select {
  flex:1;
  width:0;
  min-width:0;
  font-size:12px
}
.step-controls button {
  padding:7px 13px
}
#instructionText {
  font-size:14px;
  line-height:1.8;
  margin:13px 0
}
.note {
  margin:10px 0
}
details {
  border-top:1px solid var(--line);
  margin-top:12px;
  padding-top:10px;
  font-size:12px
}
summary {
  cursor:pointer;
  color:var(--blue)
}
#fullText {
  white-space:pre-line;
  font-size:12px;
  line-height:1.8;
  padding:10px 0
}
.references {
  overflow:auto
}
body.embed .references {
  overflow:visible
}
.reference-body {
  padding:12px
}
.part-stage {
  height:215px;
  border:1px solid var(--line);
  border-radius:7px;
  position:relative;
  background:#f1f5f8;
  overflow:hidden
}
#partStatus {
  position:absolute;
  bottom:7px;
  left:8px;
  right:8px;
  font-size:10px;
  background:#ffffffed;
  padding:5px 7px;
  border-radius:4px;
  color:var(--wr-ink)
}
#partInfo {
  font-size:11px;
  overflow-wrap:anywhere;
  margin:8px 0
}
.part {
  width:100%;
  text-align:left;
  display:block;
  border-color:var(--line);
  margin-top:6px;
  padding:8px 10px
}
.part strong {
  font-size:12px;
  font-weight:550;
  display:block
}
.part small {
  display:block;
  font-size:10px
}
.part.active {
  background:#fff1e9;
  border-color:#d99276
}
.part.unavailable {
  background:#f8f9fa;
  color:var(--wr-ink-muted)
}
#unresolvedList {
  padding-left:18px;
  line-height:1.8;
  color:var(--muted)
}
.gallery,#gallery {
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:7px
}
.gallery img,#gallery img {
  width:100%;
  height:110px;
  object-fit:contain;
  background:#f6f8fa;
  border:1px solid var(--line);
  border-radius:5px
}
.empty {
  padding:18px;
  color:var(--muted);
  font-size:12px
}
.sr-only {
  position:absolute;
  width:1px;
  height:1px;
  padding:0;
  margin:-1px;
  overflow:hidden;
  clip:rect(0,0,0,0);
  white-space:nowrap;
  border:0
}
header select {
  color:var(--ink)
}
.hud {
  background:#f5f8fae8;
  border-radius:5px;
  padding:7px 9px
}
@media(min-width:1600px) {
  main {
    grid-template-columns:290px minmax(300px,1fr) 390px
  }
  .part-stage {
    height:260px
  }
}
@media(max-width:1100px) {
  main {
    grid-template-columns:220px minmax(300px,1fr);
    height:auto;
    min-height:0
  }
  .navigator {
    grid-row:1/3;
    max-height:calc(100dvh - 145px);
    position:sticky;
    top:12px
  }
  .workarea {
    height:780px
  }
  .references {
    grid-column:2
  }
  .reference-body {
    display:flow-root
  }
  .part-stage {
    height:260px
  }
  .gallery img,#gallery img {
    height:150px
  }
}
@media(max-width:650px) {
  header {
    padding:15px;
    align-items:flex-start;
    flex-wrap:wrap;
    gap:12px
  }
  h1 {
    font-size:23px
  }
  header label {
    display:flex;
    align-items:center;
    gap:12px
  }
  header select {
    width:auto;
    margin:0
  }
  main {
    display:flex;
    flex-direction:column;
    padding:8px;
    gap:8px
  }
  .navigator {
    position:static;
    max-height:none
  }
  .panel-head {
    padding:12px
  }
  #operationList {
    max-height:230px;
    flex:auto
  }
  .workarea {
    display:flex;
    flex-direction:column;
    height:auto;
    gap:8px
  }
  .stage {
    height:360px;
    flex:none
  }
  .instructions {
    max-height:none
  }
  .references {
    overflow:visible
  }
  .part-stage {
    height:270px
  }
  .hud {
    left:12px;
    right:12px
  }
  .gesture {
    font-size:9px
  }
}
body.embed .navigator,
body.embed .references {
  display:none
}
body.embed .workarea {
  grid-template-rows:minmax(280px,1.1fr) minmax(220px,.9fr)
}

/* Build-up scrubber: reveal the vehicle station by station. Hidden until the
   mode is on, so it never competes with the normal isolate view. */
.build-bar{
  position:absolute; left:16px; right:16px; bottom:52px;
  display:flex; align-items:center; gap:12px;
  padding:8px 12px; border-radius:8px;
  background:rgba(255,255,255,.92); border:1px solid var(--line);
}
.build-bar:has(#buildStep:disabled){display:none}
.build-bar input[type=range]{flex:1; accent-color:var(--blue)}
#buildLabel{font-family:var(--wr-mono, ui-monospace, Menlo, monospace); font-size:12px; color:var(--muted); white-space:nowrap}

/* Instructions page: light card, dark type, one size. Ignores the site dark theme. */
html.inpage body{background:#e7eef2}
html.inpage header,
html.inpage .navigator,
html.inpage .references,
html.inpage .hud,
html.inpage .gesture,
html.inpage .stage-tools,
html.inpage .panel-head a,
html.inpage .panel-head small,
html.inpage .note,
html.inpage details,
html.inpage #instruction{display:none !important}
html.inpage main{display:block; position:relative; height:100dvh; min-height:0; padding:0}
html.inpage .workarea{position:relative; display:block; height:100dvh}
html.inpage .stage{height:100%; border:0; border-radius:0}
html.inpage .instructions{
  position:absolute; z-index:3; left:20px; right:20px; bottom:20px;
  max-height:none; overflow:visible; border-radius:12px; text-align:left;
  background:#fff; color:#1a2330; color-scheme:light;
  box-shadow:0 8px 28px rgba(16,32,48,.12)
}
html.inpage .instructions,
html.inpage .instructions *{
  font-size:14px !important;
  font-family:system-ui,-apple-system,sans-serif !important;
  letter-spacing:0 !important;
  color:#1a2330 !important;
}
html.inpage .panel-head{
  display:flex; align-items:center; justify-content:space-between; gap:16px;
  padding:14px 16px 0; border:0; background:#fff
}
html.inpage .panel-head label{
  display:flex; align-items:center; gap:8px; margin:0; font-weight:600; white-space:nowrap
}
html.inpage .panel-head select{margin:0; width:auto; background:#fff; color:#1a2330}
html.inpage h2{margin:0; text-align:left; font-weight:650; line-height:1.3}
html.inpage .instruction-body{
  display:grid; grid-template-columns:auto minmax(0,1fr) auto;
  grid-template-areas:"text text text" "prev bar next";
  gap:10px 12px; align-items:center; padding:8px 16px 14px; background:#fff
}
html.inpage .step-controls{display:contents}
html.inpage #instructionText{
  grid-area:text; margin:0; text-align:left; font-weight:400; line-height:1.4;
  display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden
}
html.inpage #previous{grid-area:prev}
html.inpage #next{grid-area:next}
html.inpage .instructions button,
html.inpage .instructions select{
  background:#fff; color:#1a2330; border:1px solid #c5d0d8
}
html.inpage .step-controls button{padding:6px 12px}
html.inpage .build-bar{
  grid-area:bar; position:static; margin:0; padding:0;
  background:transparent; border:0; box-shadow:none
}
html.inpage #xray{
  display:none; position:absolute; z-index:5; top:0; right:0; bottom:0; width:320px;
  box-sizing:border-box; padding:16px; overflow:auto;
  background:#fff; color:#1a2330; border-left:1px solid #d5e0e6;
  font-size:14px; text-align:left
}
html.inpage.xray-open #xray{display:block}
html.inpage.xray-open .instructions{right:340px}
html.inpage #xray h2{margin:4px 0 8px; font-size:14px !important; font-weight:650; color:#1a2330}
html.inpage #xray p, html.inpage #xray button, html.inpage #xray a{
  margin:0 0 10px; font-size:14px !important; line-height:1.4; color:#1a2330
}
html.inpage #xray .xray-photos{display:grid; gap:8px; margin:8px 0 12px}
html.inpage #xray img{width:100%; height:auto; display:block; background:#e7eef2}
