/* the build guide: the same dark studio as Mini's page. the steps sit in a panel beside the robot
   (under it on narrow screens), so nothing ever covers the parts you're looking at. */
.bg-stage {
  --g-ink: #eef2f7;
  --g-muted: rgba(226, 232, 240, .64);
  --g-line: rgba(255, 255, 255, .1);
  --g-fill: rgba(255, 255, 255, .06);
  --g-fill-2: rgba(255, 255, 255, .11);
  --g-teal: #5eead4;
  --g-amber: #fbbf5a;
  --ease: cubic-bezier(.2, .8, .2, 1);
  position: relative; isolation: isolate; overflow: clip;
  display: grid; grid-template-columns: minmax(330px, 400px) minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr);
  grid-template-areas: "intro canvas" "panel canvas";
  height: clamp(620px, 86vh, 880px);
  border-radius: 28px; color: var(--g-ink);
  background:
    radial-gradient(50% 55% at 66% 46%, #24344a 0%, transparent 70%),
    radial-gradient(120% 70% at 50% 110%, #1b2531 0%, transparent 60%),
    linear-gradient(180deg, #121820 0%, #0c1118 100%);
}
.bg-stage button, .bg-stage select { font: inherit; color: inherit; -webkit-tap-highlight-color: transparent; }
.bg-stage :focus-visible { outline: 2px solid var(--g-teal); outline-offset: 2px; }
.bg-stage > canvas { grid-area: canvas; width: 100% !important; height: 100% !important; display: block; cursor: grab; touch-action: none; min-height: 0; }
.bg-stage > canvas:active { cursor: grabbing; }
/* the loading line and the round buttons share the picture's grid cell, so they sit on it in every layout */
.bg-stage [role="status"] { grid-area: canvas; align-self: center; justify-self: center; z-index: 2; color: var(--g-muted); font-size: .92rem; pointer-events: none; }
.bg-stage [role="status"]:empty { display: none; }

/* the page's title, top left */
.bg-intro { grid-area: intro; padding: 28px 28px 0 30px; }
.bg-intro h1 { margin: 0; font-size: clamp(1.9rem, 2.6vw, 2.5rem); font-weight: 750; letter-spacing: -.03em; line-height: 1.04; color: #fff; }
.bg-intro p { margin: 10px 0 0; color: var(--g-muted); font-size: .98rem; line-height: 1.5; }

/* the step panel */
.bg-panel { grid-area: panel; min-height: 0; display: flex; flex-direction: column; gap: 14px; padding: 18px 26px 22px 30px; }
.bg-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.bg-chapter { margin: 0; color: var(--g-teal); font-size: .8rem; font-weight: 600; letter-spacing: .01em; }
.bg-count { margin: 0; color: var(--g-ink); font-size: .84rem; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bg-count span { color: var(--g-muted); font-weight: 500; }
.bg-body { flex: 1; min-height: 0; overflow-y: auto; }
.bg-title { margin: 0 0 8px; font-size: 1.5rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.15; color: #fff; outline: none; }
.bg-text { margin: 0; color: rgba(226, 232, 240, .86); font-size: 1rem; line-height: 1.6; }
.bg-needs { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0 0; padding: 0; }
.bg-needs[hidden] { display: none; }
.bg-needs li { padding: 5px 11px; border-radius: 999px; font-size: .8rem; font-weight: 500; color: rgba(226, 232, 240, .86); background: var(--g-fill); border: 1px solid var(--g-line); }
.bg-off { display: flex; align-items: center; gap: 8px; margin: 12px 0 0; color: var(--g-amber); font-size: .84rem; }
.bg-off[hidden] { display: none; }
.bg-off svg { width: 17px; height: 17px; flex: none; }

/* the way through: a track you can drag, chapters, back and next */
.bg-way { display: flex; flex-direction: column; gap: 12px; }
.bg-track { position: relative; height: 22px; }
.bg-ticks { position: absolute; left: 0; right: 0; top: 9px; display: flex; gap: 3px; pointer-events: none; }
.bg-ticks i { height: 4px; border-radius: 2px; background: rgba(255, 255, 255, .12); }
.bg-slider { --p: 0%; position: absolute; inset: 0; width: 100%; margin: 0; background: transparent; -webkit-appearance: none; appearance: none; cursor: pointer; }
.bg-slider::-webkit-slider-runnable-track { height: 22px; background: linear-gradient(90deg, var(--g-teal) 0 var(--p), transparent var(--p)) 0 9px / 100% 4px no-repeat; border-radius: 2px; }
.bg-slider::-moz-range-track { height: 4px; background: transparent; }
.bg-slider::-moz-range-progress { height: 4px; background: var(--g-teal); border-radius: 2px; }
.bg-slider::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; margin-top: 2px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 4px rgba(94, 234, 212, .25); }
.bg-slider::-moz-range-thumb { width: 18px; height: 18px; border: 0; border-radius: 50%; background: #fff; box-shadow: 0 0 0 4px rgba(94, 234, 212, .25); }
.bg-nav { display: flex; align-items: center; gap: 8px; }
.bg-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-width: 44px; height: 44px; padding: 0 12px; border-radius: 14px; border: 1px solid var(--g-line); background: var(--g-fill); cursor: pointer; transition: background .2s, transform .12s var(--ease); }
.bg-btn:hover { background: var(--g-fill-2); }
.bg-btn:active { transform: scale(.96); }
.bg-btn:disabled { opacity: .35; cursor: default; transform: none; }
.bg-btn svg { width: 20px; height: 20px; }
.bg-stage .bg-next { margin-left: auto; padding: 0 16px 0 18px; background: #fff; color: #0f172a; border-color: #fff; font-weight: 600; }
.bg-stage .bg-next:hover { background: #e7eef6; }
.bg-chapters { flex: 1; min-width: 0; height: 44px; padding: 0 30px 0 12px; border-radius: 14px; border: 1px solid var(--g-line); background: var(--g-fill) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m7 10 5 5 5-5' fill='none' stroke='%23cbd5e1' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") right 8px center / 18px no-repeat; -webkit-appearance: none; appearance: none; font-size: .86rem; text-overflow: ellipsis; cursor: pointer; }
.bg-chapters option { color: #0f172a; }
.bg-credit { margin: 0; color: var(--g-muted); font-size: .78rem; line-height: 1.45; }
.bg-credit a { color: inherit; }

/* top right of the picture */
.bg-tools { grid-area: canvas; align-self: start; justify-self: end; margin: 20px; z-index: 3; display: flex; gap: 8px; }
.bg-round { width: 42px; height: 42px; display: grid; place-items: center; padding: 0; border-radius: 50%; cursor: pointer; background: var(--g-fill); border: 1px solid var(--g-line); color: var(--g-ink); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); transition: background .2s, color .2s; }
.bg-round:hover { background: var(--g-fill-2); }
.bg-round svg { width: 20px; height: 20px; }
.bg-round[aria-pressed="false"] { color: var(--g-muted); }
.bg-round[aria-pressed="true"] { color: var(--g-teal); }

/* the last step: a little celebration */
.bg-stage.is-done .bg-title { color: var(--g-teal); }

/* tablets, phones, short windows: title, robot, then the step */
@media (max-width: 899px), (max-height: 600px) and (orientation: portrait) {
  .bg-stage { height: auto; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto auto; grid-template-areas: "intro" "canvas" "panel"; }
  .bg-stage > canvas { height: clamp(280px, 50svh, 560px) !important; }
  .bg-intro { padding: 22px 20px 0; }
  .bg-panel { padding: 6px 20px 20px; }
  .bg-body { overflow: visible; }
}
@media (max-width: 720px) {
  .bg-stage { border-radius: 22px; }
  .bg-intro { padding: 16px 18px 0; }
  .bg-intro h1 { font-size: 1.6rem; }
  .bg-intro p { display: none; }
  .bg-stage > canvas { height: clamp(250px, 42svh, 420px) !important; }
  .bg-panel { padding: 4px 16px 16px; gap: 12px; }
  .bg-title { font-size: 1.28rem; }
  .bg-text { font-size: .95rem; }
  .bg-tools { margin: 12px; gap: 6px; }
  .bg-round { width: 40px; height: 40px; }
  /* back / next right under the robot, so you can step through while watching it */
  .bg-way { order: -1; }
}
/* phones held sideways: robot on the left, the step on the right */
@media (orientation: landscape) and (max-height: 560px) {
  .bg-stage { height: auto; grid-template-columns: minmax(0, 1fr) minmax(300px, 46%); grid-template-rows: auto minmax(0, 1fr); grid-template-areas: "canvas intro" "canvas panel"; }
  .bg-stage > canvas { position: sticky; top: 6px; height: max(240px, calc(100svh - 84px)) !important; }
  .bg-intro { padding: 14px 16px 0 6px; }
  .bg-intro h1 { font-size: 1.35rem; }
  .bg-intro p { display: none; }
  .bg-panel { padding: 8px 16px 16px 6px; gap: 10px; }
  .bg-title { font-size: 1.2rem; }
  .bg-tools { justify-self: start; margin: 12px; position: sticky; top: 12px; }
  .bg-way { order: -1; }
  .bg-intro h1 { font-size: 1.2rem; }
  .lab-tabs { margin-bottom: 8px !important; }
}
@media (prefers-reduced-motion: reduce) {
  .bg-stage * { transition: none !important; }
}

/* ---------- the product: the whole robot, its parts list, its files, on paper ---------- */
.bg-more { display: flex; flex-wrap: wrap; gap: 6px; }
.bg-chip { min-height: 34px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--g-line); background: var(--g-fill); font-size: .82rem; cursor: pointer; transition: background .2s, color .2s; }
.bg-chip:hover { background: var(--g-fill-2); }
.bg-chip[aria-pressed="true"] { background: var(--g-teal); color: #0b1218; border-color: transparent; }
.bg-printed { display: flex; flex-wrap: wrap; gap: 6px; }
.bg-file { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px 5px 8px; border-radius: 10px; border: 1px solid color-mix(in srgb, var(--g-teal) 40%, transparent); background: color-mix(in srgb, var(--g-teal) 10%, transparent); font-size: .8rem; cursor: pointer; }
.bg-file:hover { background: color-mix(in srgb, var(--g-teal) 18%, transparent); }
.bg-file svg { width: 15px; height: 15px; color: var(--g-teal); }
.bg-file small { color: var(--g-muted); font-size: .7rem; }
/* labels on the exploded robot */
.bg-tags { grid-area: canvas; position: relative; z-index: 2; pointer-events: none; opacity: 0; transition: opacity .35s; min-height: 0; overflow: hidden; }
.bg-tags.show { opacity: 1; }
.bg-tags span { position: absolute; left: 0; top: 0; padding: 3px 8px; border-radius: 999px; background: rgba(12, 17, 24, .74); border: 1px solid var(--g-line); color: var(--g-ink); font-size: .72rem; white-space: nowrap; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
@media (max-width: 720px) { .bg-tags span { font-size: .62rem; padding: 2px 6px; } }
/* a sheet over the page (parts list, files) */
.bg-sheet-back { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; padding: 16px; background: rgba(5, 8, 12, .62); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); animation: bg-fade .2s; }
@keyframes bg-fade { from { opacity: 0; } }
.bg-sheet { --g-ink: #eef2f7; --g-muted: rgba(226, 232, 240, .64); --g-line: rgba(255, 255, 255, .1); --g-fill: rgba(255, 255, 255, .06); --g-fill-2: rgba(255, 255, 255, .11); --g-teal: #5eead4;
  width: min(760px, 100%); max-height: min(86vh, 900px); display: flex; flex-direction: column; border-radius: 22px; background: #121820; color: var(--g-ink); border: 1px solid var(--g-line); box-shadow: 0 30px 80px rgba(0, 0, 0, .5); overflow: hidden; }
.bg-sheet button { font: inherit; color: inherit; }
.bg-sheet :focus-visible { outline: 2px solid var(--g-teal); outline-offset: 2px; }
.bg-sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 16px 12px 24px; border-bottom: 1px solid var(--g-line); }
.bg-sheet-head h2 { margin: 0; font-size: 1.2rem; letter-spacing: -.01em; }
.bg-sheet-body { overflow-y: auto; padding: 16px 24px 24px; }
.bg-sheet-body h3 { margin: 20px 0 6px; font-size: .74rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--g-muted); }
.bg-sheet-lead { margin: 0 0 12px; color: var(--g-muted); font-size: .88rem; line-height: 1.55; }
.bg-sheet-lead a { color: var(--g-teal); }
.bg-table { width: 100%; border-collapse: collapse; font-size: .86rem; }
.bg-table th { text-align: left; font-weight: 600; color: var(--g-muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; padding: 6px 8px; }
.bg-table td { padding: 8px; border-top: 1px solid var(--g-line); vertical-align: middle; }
.bg-table td:first-child, .bg-table th:first-child { padding-left: 0; }
.bg-table:not(.bg-files) td:first-child { width: 3.5em; font-variant-numeric: tabular-nums; }
.bg-table td:last-child, .bg-table th:last-child { text-align: right; padding-right: 0; }
.bg-table td small { display: block; color: var(--g-muted); font-size: .74rem; margin-top: 2px; }
.bg-files td:nth-child(2), .bg-files td:nth-child(3) { white-space: nowrap; font-variant-numeric: tabular-nums; }
.bg-link { padding: 0; border: 0; background: none; text-decoration: underline; text-decoration-color: rgba(255, 255, 255, .3); text-underline-offset: 3px; cursor: pointer; text-align: left; }
.bg-link:hover { color: var(--g-teal); }
.bg-act { min-height: 40px; padding: 8px 16px; margin: 4px 0 12px; border-radius: 999px; border: 0; background: #fff; color: #0f172a !important; font-weight: 600; cursor: pointer; }
.bg-act:disabled { opacity: .7; cursor: progress; }
.bg-round.small { width: 34px; height: 34px; margin-left: auto; }
.bg-round.small svg { width: 17px; height: 17px; }
@media (max-width: 560px) {
  .bg-sheet-back { padding: 0; place-items: end stretch; }
  .bg-sheet { width: 100%; max-height: 92svh; border-radius: 22px 22px 0 0; }
  .bg-sheet-body { padding: 12px 16px 24px; }
  .bg-sheet-head { padding: 12px 12px 10px 16px; }
  .bg-files th:nth-child(2), .bg-files td:nth-child(2) { display: none; }
}
.bg-printing { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 1001; padding: 10px 18px; border-radius: 999px; background: #121820; color: #eef2f7; border: 1px solid rgba(255, 255, 255, .12); font-size: .9rem; }
/* on paper: only the guide */
.bg-print { display: none; }
@media print {
  body > *:not(.bg-print) { display: none !important; }
  .bg-print { display: block; color: #111; font: 10.5pt/1.45 system-ui, -apple-system, 'Segoe UI', sans-serif; }
  .bg-print h1 { font-size: 26pt; margin: 0 0 6pt; letter-spacing: -.02em; }
  .bg-print h2 { font-size: 13pt; margin: 0 0 4pt; }
  .bg-print h3 { font-size: 9pt; text-transform: uppercase; letter-spacing: .08em; color: #555; margin: 10pt 0 2pt; }
  .bg-print-cover { break-after: page; }
  .bg-print-cover ul { margin: 0; padding-left: 14pt; columns: 2; font-size: 9.5pt; }
  .bg-print-credit { color: #555; font-size: 9pt; }
  .bg-print-step { display: grid; grid-template-columns: 58% 1fr; gap: 14pt; align-items: start; break-inside: avoid; padding: 10pt 0; border-top: 1px solid #ddd; }
  .bg-print-step img { width: 100%; border-radius: 6pt; background: #111820; }
  .bg-print-ch { color: #0f766e; font-size: 8.5pt; font-weight: 600; margin: 0 0 2pt; }
  .bg-print-step p { margin: 0 0 4pt; }
  .bg-print-needs { font-size: 9pt; color: #333; }
  .bg-print-off { font-size: 8.5pt; color: #777; }
  @page { margin: 14mm; }
}
