/* Nosca project page prototype. Tokens follow site/src/styles/global.css ("Blueprint" direction). */

:root {
  --ink: #0d0f14;
  --ink-2: #3b3f4a;
  --muted: #5b5f6b;
  --line: #c9ccd8;
  --line-soft: #e1e3ec;
  --grid: #e7e9f3;
  --paper: #fbfbf8;
  --white: #ffffff;
  --hover: #f3f4fa;
  --accent: #2335ff;
  --accent-strong: #1a26c2;
  --tint: #e9ecff;
  --tint-2: #dce1ff;

  --font-sans: "Inter Tight Variable", "Inter Tight", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;

  --wrap: 1440px;
  --gutter: clamp(16px, 3vw, 40px);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }

/* Each phrase is in the page in English and 中文; <html lang> picks one. On the site,
   site/src/components/LangInit.astro sets it; opened from disk, the page stays English. */
:root[lang|="zh"] body [data-lang="en"],
:root:not([lang|="zh"]) body [data-lang="zh"] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

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

h1, h2, h3, p, figure, ol, ul, dl, dd { margin: 0; }
h1, h2, h3 { font-weight: 600; text-wrap: balance; }
p { text-wrap: pretty; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
a:hover { color: var(--accent-strong); }
button { font: inherit; color: inherit; }
img, svg { display: block; max-width: 100%; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
code { font-family: var(--font-mono); font-size: 0.95em; }

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

.wrap {
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.label {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
}

.ui { font-size: 14px; color: var(--muted); }

.sheet {
  border: 1.5px solid var(--ink);
  background: var(--white);
}

/* Buttons */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 22px;
  border: 1.5px solid var(--accent);
  border-radius: 0;
  background: var(--accent);
  color: var(--white);
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}
.button:hover { border-color: var(--accent-strong); background: var(--accent-strong); color: var(--white); }
.button-ghost { border-color: var(--ink); background: var(--paper); color: var(--ink); }
.button-ghost:hover { border-color: var(--ink); background: var(--white); color: var(--ink); }
.button-small { min-height: 40px; padding: 0 16px; font-size: 14px; }
.button-block { width: 100%; }

.text-button,
.inline-link {
  border: 0;
  background: none;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}
.text-button {
  margin-left: auto;
  padding: 0 6px;
  min-height: 36px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.text-button:hover, .inline-link:hover { color: var(--accent-strong); }

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  background: var(--white);
  cursor: pointer;
}
.icon-button svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.icon-button:hover { border-color: var(--ink); }

/* Segmented controls */
.seg {
  display: inline-flex;
  border: 1.5px solid var(--ink);
  background: var(--white);
}
.seg button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 12px;
  border: 0;
  background: none;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-2);
  cursor: pointer;
}
.seg button + button { border-left: 1px solid var(--line); }
.seg button:hover { background: var(--hover); color: var(--ink); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--white); }
.seg button[aria-pressed="true"] + button { border-left-color: var(--ink); }

/* Status dots: filled = published, half = partial, dashed = not published */
.status-dot {
  flex: none;
  display: inline-block;
  width: 10px;
  height: 10px;
  border: 1.5px solid var(--accent);
  border-radius: 50%;
}
.status-dot.is-ok { background: var(--accent); }
.status-dot.is-partial { background: linear-gradient(90deg, var(--accent) 50%, transparent 50%); }
.status-dot.is-missing { border-color: var(--muted); border-style: dashed; }
.status-dot.is-display { border-color: var(--muted); background: var(--line-soft); }

/* Top bar */
.topbar {
  border-bottom: 1.5px solid var(--accent);
  background: var(--paper);
}
.topbar-inner {
  display: flex;
  align-items: center;
  gap: 28px;
  min-height: 64px;
}
.brand { display: inline-flex; align-items: center; min-height: 44px; }
.brand img { width: auto; height: 21px; }
.crumbs ol {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  padding: 0;
  list-style: none;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.crumbs li + li::before { content: "/"; margin-right: 10px; color: var(--line); }
.crumbs [aria-current] { color: var(--ink); }
.proto-chip {
  margin-left: auto;
  padding: 4px 8px;
  border: 1px dashed var(--ink-2);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-2);
  white-space: nowrap;
}

.picker { position: relative; }
.chevron { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 1.5; transition: transform 0.15s ease; }
.swatches { display: inline-flex; border: 1px solid var(--line); }
.swatches i { display: block; width: 12px; height: 18px; }

.menu {
  position: absolute;
  z-index: 60;
  top: calc(100% + 6px);
  left: -1.5px;
  width: min(420px, calc(100vw - 2 * var(--gutter)));
  padding: 6px;
  border: 1.5px solid var(--ink);
  background: var(--white);
  box-shadow: 0 16px 40px rgb(13 15 20 / 0.14);
}
.menu-head {
  padding: 8px 10px 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.menu-list { padding: 0; list-style: none; }
.menu-option {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 2px 12px;
  width: 100%;
  padding: 10px;
  border: 0;
  background: none;
  text-align: left;
  cursor: pointer;
}
button.menu-option:hover { background: var(--hover); }
.menu-option[aria-current="true"] { background: var(--tint); }
.menu-option.is-unavailable { cursor: default; color: var(--muted); }
.menu-option small { display: block; font-size: 13px; color: var(--muted); }
.menu-option .menu-side {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.menu-option a.menu-side { text-transform: none; letter-spacing: 0; }
.menu-foot { margin: 4px 10px 6px; padding-top: 8px; border-top: 1px solid var(--line-soft); font-size: 13px; color: var(--muted); }
.viewer {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background-color: var(--white);
  background-image:
    radial-gradient(ellipse 55% 45% at 50% 62%, rgb(255 255 255 / 0.95), rgb(255 255 255 / 0) 70%),
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 100% 100%, 24px 24px, 24px 24px;
}
.viewer canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: grab;
}
.viewer canvas:active { cursor: grabbing; }
.viewer.is-pointing canvas { cursor: pointer; }
.viewer-status {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  pointer-events: none;
}
.viewer-status.is-error { color: #b42318; text-transform: none; letter-spacing: 0; padding: 24px; text-align: center; }
.hover-tip {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 2;
  padding: 6px 9px;
  background: var(--ink);
  color: var(--white);
  font-size: 13px;
  line-height: 1.3;
  white-space: nowrap;
  pointer-events: none;
}
.hover-tip small { display: block; font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase; opacity: 0.7; }
.viewer-hint {
  position: absolute;
  left: 14px;
  bottom: 12px;
  right: 14px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--muted);
  pointer-events: none;
}

/* Title blocks (captions) */
.title-block {
  display: flex;
  border-top: 1.5px solid var(--ink);
  background: var(--white);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.title-block > span { padding: 10px 14px; }
.title-block-id { border-right: 1px solid var(--line); color: var(--accent); white-space: nowrap; }
.title-block-name { flex: 1; }
.facts div {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 12px;
  padding: 10px 16px;
}
.facts div + div { border-top: 1px solid var(--line-soft); }
.facts dt {
  padding-top: 3px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.facts dd { font-size: 15px; }
.source-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 12px;
  padding: 0;
  list-style: none;
}
.source-card { display: flex; flex-direction: column; height: 100%; }
.source-card .source-body { flex: 1; padding: 14px 16px 16px; }
.source-card h3 { font-size: 17px; }
.source-card h3 a { text-decoration: none; }
.source-card h3 a:hover { text-decoration: underline; }
.source-card p { margin-top: 4px; font-size: 14px; color: var(--ink-2); }
.chip-list { display: flex; flex-wrap: wrap; gap: 6px; padding: 0; list-style: none; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 3px 9px;
  border: 1px solid var(--line);
  background: var(--paper);
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}
.chip:hover { border-color: var(--ink); background: var(--white); }
.chip.is-current { border-color: var(--accent); background: var(--tint); }
.chip small { font-family: var(--font-mono); font-size: 11px; color: var(--muted); }

.model-chip {
  display: inline-block;
  padding: 1px 6px;
  border: 1px solid var(--line);
  background: var(--paper);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--ink);
  white-space: nowrap;
}
.thumb {
  display: block;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line-soft);
  background: var(--paper);
  object-fit: contain;
}
.thumb:not([src]) { visibility: hidden; }
.play-button {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1.5px solid var(--ink);
  background: var(--white);
  cursor: pointer;
}
.play-button svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linejoin: round; }
.play-button:hover { border-color: var(--accent); color: var(--accent); }
input[type="range"] { display: block; width: 100%; margin: 0; accent-color: var(--accent); }

.page-foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 24px;
  padding-top: 18px;
  padding-bottom: 28px;
  border-top: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.page-foot code { text-transform: none; letter-spacing: 0; }

/* Narrower screens */

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

@media (max-width: 760px) {
  .topbar-inner { gap: 16px; }
  .crumbs li:not([aria-current]) { display: none; }
  .crumbs li + li::before { content: none; }
  .viewer-hint { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}

/* ---------- Community: robots and builds, results first ---------- */
.home-hero { padding: 44px 0 8px; }
.home-hero h1 {
  font-size: clamp(40px, 3.4vw + 18px, 72px);
  line-height: 0.98;
  letter-spacing: -0.03em;
}
.ranking, .builds { padding: 28px 0 56px; }
.ranking-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px 24px;
  padding-bottom: 12px;
  border-bottom: 1.5px solid var(--ink);
}
.ranking-head h2 { font-size: clamp(22px, 0.8vw + 17px, 28px); letter-spacing: -0.01em; }
.ranking-head p { font-size: 14px; color: var(--muted); }

.robot-rank { display: grid; gap: 20px; margin-top: 20px; padding: 0; list-style: none; }
.robot-card-link {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(300px, 1fr);
  border: 1.5px solid var(--ink);
  background: var(--white);
  color: inherit;
  text-decoration: none;
}
.robot-card-link:hover { border-color: var(--accent); }
.robot-card-link:hover .robot-card-cta { color: var(--accent); }
.robot-card-visual {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 420px;
  border-right: 1px solid var(--line);
  background-color: var(--paper);
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 24px 24px;
}
.robot-card-visual img { width: min(100%, 520px); height: auto; }
.robot-rank-number {
  position: absolute;
  top: 14px;
  left: 18px;
  font-family: var(--font-mono);
  font-size: 44px;
  font-weight: 500;
  line-height: 1;
  color: var(--accent);
}
.robot-card-body { display: flex; flex-direction: column; gap: 6px; padding: 28px 28px 24px; }
.robot-card-body h3 { font-size: clamp(34px, 2vw + 20px, 52px); line-height: 1; letter-spacing: -0.025em; }
.robot-maker { font-size: 17px; color: var(--ink-2); }
.robot-spec { font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.robot-heat { margin-top: 8px; font-size: 15px; color: var(--ink-2); }
.robot-heat strong { font-weight: 600; color: var(--accent); }
.robot-builds { margin-top: auto; padding-top: 20px; font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.robot-card-cta { margin-top: 18px; font-weight: 600; }

@media (max-width: 860px) {
  .robot-card-link { grid-template-columns: minmax(0, 1fr); }
  .robot-card-visual { min-height: 0; border-right: 0; border-bottom: 1px solid var(--line); }
  .robot-card-visual img { width: min(86%, 420px); }
  .robot-card-body { padding: 20px 18px; }
  .robot-rank-number { font-size: 32px; }

}

/* ---------- Robot page: the model stays on screen, one step at a time beside it ---------- */
.robot-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(360px, 1fr);
  align-items: start;
  gap: 40px;
  padding-top: 24px;
  padding-bottom: 56px;
}
.stage-col { position: sticky; top: 16px; z-index: 5; }
.stage { display: flex; flex-direction: column; height: min(calc(100vh - 112px), 820px); min-height: 480px; }
.stage-canvas { position: relative; flex: 1; min-height: 0; overflow: hidden; }
.stage-bar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  padding: 8px 14px;
  border-top: 1px solid var(--line);
  background: var(--white);
}
.spread-control { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px; min-width: 0; }
.spread-end { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }

.switch { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; font-size: 14px; font-weight: 500; white-space: nowrap; cursor: pointer; }
.switch input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.switch-track { position: relative; flex: none; width: 36px; height: 20px; border: 1.5px solid var(--ink); background: var(--white); transition: background 0.15s ease; }
.switch-track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 13px; height: 13px; background: var(--ink); transition: transform 0.15s ease; }
.switch input:checked + .switch-track { border-color: var(--accent); background: var(--accent); }
.switch input:checked + .switch-track::after { transform: translateX(16px); background: var(--white); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--accent); outline-offset: 2px; }

.stage-reset {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 3;
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line);
  background: rgb(255 255 255 / 0.92);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-2);
  cursor: pointer;
}
.stage-reset:hover { border-color: var(--ink); color: var(--ink); }

.pick-tag {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 3;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  max-width: calc(100% - 96px);
  padding: 5px 2px 5px 5px;
  border: 1.5px solid var(--accent);
  background: var(--white);
}
.pick-tag .thumb { width: 36px; height: 36px; border: 0; }
.pick-tag .line-swatch { width: 28px; height: 28px; margin: 4px; }
.pick-text { min-width: 0; }
.pick-text strong { display: block; font-size: 15px; font-weight: 600; line-height: 1.2; }
.pick-text small { display: block; margin-top: 2px; font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.pick-close { width: 36px; height: 36px; border: 0; background: none; font-size: 22px; line-height: 1; color: var(--muted); cursor: pointer; }
.pick-close:hover { color: var(--ink); }

/* Steps */
.panel-col { min-width: 0; }
.steps ol { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 0; padding: 0; list-style: none; }
.steps button {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 48px;
  padding: 0 0 4px;
  border: 0;
  border-bottom: 3px solid var(--line-soft);
  background: none;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  text-align: left;
  cursor: pointer;
}
.steps button:hover { color: var(--ink); }
.steps button[aria-current="step"] { border-bottom-color: var(--accent); color: var(--ink); }
.steps button.is-done { border-bottom-color: var(--tint-2); color: var(--ink-2); }
.step-num { display: inline-grid; place-items: center; flex: none; width: 22px; height: 22px; border: 1.5px solid currentColor; font-family: var(--font-mono); font-size: 12px; }
.steps [aria-current="step"] .step-num { border-color: var(--accent); background: var(--accent); color: var(--white); }
.steps .is-done .step-num { border-color: var(--accent); color: var(--accent); }

.step { padding-top: 28px; }
.step h1 { margin-top: 8px; font-size: clamp(40px, 2.4vw + 22px, 60px); line-height: 1; letter-spacing: -0.025em; }
.step h2 { font-size: clamp(28px, 1vw + 20px, 36px); line-height: 1.1; letter-spacing: -0.02em; }
.step-lede { max-width: 46ch; margin-top: 14px; font-size: clamp(18px, 0.4vw + 15px, 20px); line-height: 1.45; color: var(--ink-2); }
.step-copy { max-width: 46ch; margin: 22px 0 12px; font-size: 16px; color: var(--ink-2); }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 28px; border-top: 1.5px solid var(--ink); border-bottom: 1px solid var(--line); }
.stats div { display: flex; flex-direction: column-reverse; padding: 14px 0 12px; }
.stats div + div { padding-left: 16px; border-left: 1px solid var(--line); }
.stats dt { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.stats dd { white-space: nowrap; font-size: 30px; font-weight: 600; line-height: 1.1; letter-spacing: -0.02em; }
.credit { margin-top: 16px; font-size: 14px; color: var(--muted); }
.step-nav { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 32px; }
.step-nav .button { margin-left: auto; }
.step-nav .text-button { margin-left: 0; font-size: 15px; }

details.tech { margin-top: 40px; border-top: 1px solid var(--line); }
details.tech > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  cursor: pointer;
  list-style: none;
}
details.tech > summary::-webkit-details-marker { display: none; }
details.tech > summary::before { content: "+"; width: 12px; color: var(--accent); }
details.tech[open] > summary::before { content: "−"; }
details.tech .facts { border: 1px solid var(--line); background: var(--white); }
.tech-label { margin: 18px 0 10px; }
details.tech .source-list { grid-template-columns: minmax(0, 1fr); gap: 10px; margin-top: 0; }

/* Get the parts */
.block { margin-top: 28px; }
.block-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; padding-bottom: 8px; border-bottom: 1.5px solid var(--ink); }
.block-head h3 { font-size: 20px; }
.block-link { font-size: 14px; }
.block-note { margin-top: 10px; font-size: 14px; color: var(--muted); }

.route-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin-top: 12px; font-size: 15px; color: var(--ink-2); }
.route-line strong { font-weight: 600; color: var(--ink); }
.version-label { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.play-button svg { pointer-events: none; }
.picker-button[aria-expanded="true"] .chevron { transform: rotate(180deg); }

.line-list { margin: 0; padding: 0; list-style: none; }
.line { border-bottom: 1px solid var(--line-soft); scroll-margin: 16px 0; }
.line.is-open { background: var(--white); box-shadow: inset 3px 0 0 var(--accent); }
.line-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; padding-right: 8px; }
.line-main {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto 12px;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 60px;
  padding: 8px 10px;
  border: 0;
  background: none;
  text-align: left;
  cursor: pointer;
}
.line-main .thumb { width: 40px; height: 40px; }
.line-swatch { display: block; width: 28px; height: 28px; margin-inline: 6px; border: 1px solid var(--line); }
.line-text { display: grid; min-width: 0; }
.line-title { font-size: 16px; font-weight: 500; }
.line-text small { font-family: var(--font-mono); font-size: 12px; color: var(--muted); }
.line-main:hover .line-title { color: var(--accent-strong); }
.line-qty { font-family: var(--font-mono); font-size: 14px; color: var(--ink-2); }
.line-main > svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 1.5; color: var(--muted); transition: transform 0.15s ease; }
.line-main[aria-expanded="true"] > svg { transform: rotate(180deg); }
.line-more { display: grid; gap: 12px; padding: 0 14px 16px 62px; }
.line-note { font-size: 14px; color: var(--ink-2); }
.line-note strong { font-weight: 600; color: var(--ink); }
.line-size { font-family: var(--font-mono); font-size: 12px; color: var(--muted); }


.options { display: flex; flex-wrap: wrap; gap: 8px; }
.option { display: grid; gap: 1px; min-height: 44px; padding: 6px 12px; border: 1.5px solid var(--line); background: var(--paper); text-align: left; cursor: pointer; }
.option strong { font-size: 14px; font-weight: 600; }
.option small { font-size: 12px; color: var(--muted); }
.option:hover { border-color: var(--ink); }
.option[aria-pressed="true"] { border-color: var(--accent); background: var(--tint); }

.colour-choice { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 6px; }
.colour-option { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 12px 0 8px; border: 1px solid var(--line); background: var(--white); font-size: 14px; cursor: pointer; }
.colour-option:hover { border-color: var(--ink); }
.colour-option[aria-pressed="true"] { border-color: var(--accent); background: var(--tint); }

/* Phones and narrow windows: the model sticks to the top, the step scrolls under it. */
@media (max-width: 960px) {
  .robot-layout { grid-template-columns: minmax(0, 1fr); gap: 0; padding-top: 0; }
  .stage-col { top: 0; margin-inline: calc(-1 * var(--gutter)); }
  .stage { height: auto; min-height: 0; border-top: 0; border-inline: 0; }
  .stage-canvas { flex: none; height: 40vh; height: 40svh; min-height: 240px; max-height: 480px; }
  .stage-bar { gap: 12px; padding: 4px 12px; }
  .panel-col { padding-top: 16px; }
  .step { padding-top: 20px; }
  .block, .line { scroll-margin-top: calc(40svh + 72px); }
}

@media (max-width: 760px) {
  .spread-end { display: none; }
  .spread-control { grid-template-columns: minmax(0, 1fr); }
  .stats dd { font-size: 24px; }
  .line-more { padding-left: 14px; }
  .steps button { font-size: 13px; }
}

/* The real parts list: lines not on the model, the cost line, small parts folded */
.thumb-none { display: block; width: 40px; height: 40px; border: 1px dashed var(--line); background: var(--paper); }
.small-parts { border-bottom: 1px solid var(--line-soft); }
.small-parts > summary {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 0 18px 0 10px;
  font-size: 15px;
  font-weight: 500;
  color: var(--ink-2);
  cursor: pointer;
  list-style: none;
}
.small-parts > summary::-webkit-details-marker { display: none; }
.small-parts > summary::before { content: "+"; width: 40px; text-align: center; font-family: var(--font-mono); color: var(--accent); }
.small-parts[open] > summary::before { content: "−"; }
.small-parts > summary .line-qty { margin-left: auto; }
.small-parts .line:last-child { border-bottom: 0; }

.build-path { display: grid; gap: 14px; margin: 24px 0 8px; padding: 0; list-style: none; counter-reset: stage; }
.build-path li { display: grid; gap: 6px; padding: 16px 18px; border: 1.5px solid var(--ink); background: var(--white); }
.build-path strong { font-size: 18px; font-weight: 600; }
.build-path strong::before { counter-increment: stage; content: counter(stage) "  "; font-family: var(--font-mono); font-size: 13px; color: var(--accent); }
.build-path span { font-size: 15px; color: var(--ink-2); }
.build-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }

.panel-col { position: relative; }


/* Connections in See inside: the list under the model and the labels at a wire's ends */
.wires { flex: none; max-height: 210px; overflow-y: auto; border-top: 1px solid var(--line); background: var(--white); }
.wires-head { position: sticky; top: 0; z-index: 1; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; padding: 10px 14px 8px; background: var(--white); border-bottom: 1px solid var(--line-soft); }
.wires-head strong { font-size: 15px; font-weight: 600; }
.wires-head span:not([data-lang]) { flex: 1; min-width: 0; font-size: 13px; color: var(--muted); }
.wires-head a { font-size: 13px; }
.wires-list { margin: 0; padding: 4px 6px 8px; list-style: none; }
.wire-kind { padding: 10px 8px 4px; font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.wire-note { margin: 6px 8px; padding: 8px 10px; border-left: 3px solid var(--accent); background: var(--tint); font-size: 13px; color: var(--ink-2); }
.wire-row { display: grid; grid-template-columns: 12px minmax(0, 1fr); align-items: center; gap: 10px; width: 100%; min-height: 40px; padding: 4px 8px; border: 0; background: none; text-align: left; cursor: pointer; }
.wire-row:hover { background: var(--hover); }
.wire-row[aria-pressed="true"] { background: var(--tint); box-shadow: inset 3px 0 0 var(--accent); }
.wire-swatch { width: 12px; height: 4px; }
.wire-text strong { display: block; font-size: 14px; font-weight: 500; }
.wire-text small { display: block; font-size: 12px; color: var(--muted); }
.wire-end {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 2;
  margin: 0 0 0 10px;
  padding: 3px 7px;
  background: var(--ink);
  color: var(--white);
  font-size: 12px;
  white-space: nowrap;
  pointer-events: none;
}
#step-build [data-show-wiring] { margin-top: 4px; }
@media (max-width: 960px) {
  .wires { max-height: 140px; }
}

/* One project site: the top bar carries the parts inquiry */
.topbar-cta { margin-left: auto; }

/* Like and download, MakerWorld style: counts come from the site once signed in or not */
.project-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.action-like {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 14px;
  border: 1.5px solid var(--ink);
  background: var(--white);
  color: var(--ink);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
}
.action-like:hover { border-color: var(--accent); }
.action-like svg, .action-download svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.action-like[aria-pressed="true"] { border-color: var(--accent); background: var(--tint); color: var(--accent-strong); }
.action-like[aria-pressed="true"] svg { fill: currentColor; }
.action-download { gap: 8px; min-height: 40px; }
.action-count { font-family: var(--font-mono); font-size: 13px; font-weight: 400; }
.action-download .action-count { padding-left: 8px; border-left: 1px solid rgb(255 255 255 / 0.4); }
.project-actions:not(.has-stats) .action-count { display: none; }

/* Active purchase cards */
.packages { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 22px; }
.package[data-package="servos"] { grid-column: 1 / -1; }
.package { display: flex; flex-direction: column; gap: 6px; padding: 16px; border: 1.5px solid var(--ink); background: var(--white); }
.package h3 { font-size: 20px; }
.package-what { flex: 1; font-size: 14px; color: var(--ink-2); }
.package-unit-price { font-family: var(--font-mono); font-size: 13px; color: var(--ink-2); }
.package-foot { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 10px; margin-top: 8px; }
.package-price { justify-self: end; font-family: var(--font-mono); font-size: 15px; }
.package-buy { grid-column: 1 / -1; width: 100%; }
.checkout-dialog { width: min(420px, calc(100vw - 32px)); padding: 24px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); color: var(--ink); box-shadow: 0 24px 80px #0004; }
.checkout-dialog::backdrop { background: #0008; }
.checkout-dialog h3 { margin: 0 0 20px; }
.checkout-dialog label { display: block; margin-bottom: 8px; font-size: 14px; }
.checkout-dialog select { width: 100%; min-height: 44px; padding: 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--paper); color: var(--ink); font: inherit; }
.checkout-dialog .block-note { margin: 16px 0 20px; }
.checkout-dialog-actions { display: flex; gap: 8px; justify-content: flex-end; }
.qty { display: inline-flex; align-items: stretch; height: 40px; border: 1px solid var(--line); background: var(--paper); }
.qty-step { width: 36px; border: 0; background: none; font-size: 18px; color: var(--ink); cursor: pointer; }
.qty-step:hover { background: var(--hover); }
.qty-input { width: 44px; border: 0; border-inline: 1px solid var(--line-soft); background: var(--white); font: inherit; font-family: var(--font-mono); font-size: 15px; text-align: center; -moz-appearance: textfield; }
.qty-input::-webkit-inner-spin-button, .qty-input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.package-foot .line-qty { display: inline-flex; align-items: center; height: 40px; }
@media (max-width: 520px) {
  .packages { grid-template-columns: minmax(0, 1fr); }
}

/* Build it: the guide, one step open at a time */
.guide { display: grid; gap: 32px; margin-top: 22px; }
.guide-intro { margin-top: 10px; font-size: 15px; color: var(--ink-2); }
.guide-steps { margin-top: 6px; padding: 0; list-style: none; }
.guide-step { border-bottom: 1px solid var(--line-soft); }
.guide-step.is-open { background: var(--white); box-shadow: inset 3px 0 0 var(--accent); }
.guide-head { display: grid; grid-template-columns: 28px minmax(0, 1fr) 12px; align-items: center; gap: 10px; width: 100%; min-height: 50px; padding: 8px 12px; border: 0; background: none; font: inherit; font-size: 16px; font-weight: 500; color: var(--ink); text-align: left; cursor: pointer; }
.guide-head:hover .guide-title { color: var(--accent-strong); }
.guide-num { font-family: var(--font-mono); font-size: 13px; color: var(--accent); }
.guide-head svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 1.5; color: var(--muted); transition: transform 0.15s ease; }
.guide-step.is-open .guide-head svg { transform: rotate(180deg); }
.guide-body { display: grid; gap: 12px; padding: 0 12px 18px 50px; font-size: 15px; color: var(--ink-2); }
.guide-label { display: block; margin-bottom: 2px; font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.guide-do { display: grid; gap: 6px; margin: 0; padding-left: 18px; }
.guide-do li::marker { color: var(--accent); }
.guide-done { padding: 10px 12px; background: var(--tint); color: var(--ink); }
.guide-route { width: 100%; border-collapse: collapse; }
.guide-route th, .guide-route td { padding: 6px 8px 6px 0; border-bottom: 1px solid var(--line-soft); text-align: left; vertical-align: top; }
.guide-route th { width: 26%; font-size: 14px; font-weight: 500; color: var(--ink); }
.guide-route td { font-family: var(--font-mono); font-size: 13px; }
.guide-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.guide-source { margin-top: 10px; font-size: 13px; color: var(--muted); }
@media (max-width: 520px) {
  .guide-body { padding-left: 12px; }
}
