/* build.html: 3D build guide (shares app.css variables and buttons) */
.build .panel { gap: 12px; overflow: hidden; min-height: 0; }
#view { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.loading { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--muted); pointer-events: none; }
.loading[hidden] { display: none; }

/* what a tapped part does: floats over the model so nothing in the layout moves */
.card {
  position: absolute; left: 12px; bottom: 12px; width: min(340px, calc(100% - 24px));
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: 10px 36px 10px 12px; box-shadow: 0 6px 20px rgba(0, 0, 0, .12); font-size: 14px;
}
.card[hidden] { display: none; }
.card p { margin: 4px 0 6px; }
.card a { color: var(--accent); }
.card .icon { position: absolute; top: 4px; right: 4px; font-size: 20px; padding: 2px 8px; }

.steps { display: grid; grid-template-columns: repeat(11, 1fr); gap: 4px; }
.steps button {
  height: 30px; border-radius: 7px; border: 1px solid var(--line); background: var(--panel);
  cursor: pointer; font-size: 13px; font-weight: 600; padding: 0;
}
.steps button.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

.build .step { flex: 1 1 0; min-height: 0; overflow-y: auto; }
.step h2 { margin-bottom: 2px; }
.step ol { margin: 8px 0 0; padding-left: 20px; }
.step li { margin: 4px 0; }
.parts { list-style: none; padding: 0; margin: 0; }
.parts li {
  display: flex; gap: 8px; align-items: baseline; padding: 5px 6px; margin: 0 -6px;
  border-radius: 6px; cursor: default; font-size: 14px;
}
.parts li.has-model { cursor: pointer; }
.parts li.has-model:hover, .parts li.lit { background: color-mix(in srgb, var(--accent) 10%, var(--panel)); }
.parts .qty { color: var(--muted); min-width: 22px; }
.parts .name { flex: 1; }
.parts a, .links a { color: var(--accent); white-space: nowrap; }
.links { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 14px; }

.nav { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* exact-build extras: check line, print time/grams, tools, tips; Replay over the model */
.step .check { margin: 8px 0 0; padding: 6px 8px; border-radius: 6px; font-size: 14px;
  background: color-mix(in srgb, var(--accent) 8%, var(--panel)); }
.parts small { color: var(--muted); }
.step .tools { margin: 0; font-size: 14px; }
.tips { margin: 0; padding-left: 18px; font-size: 14px; }
.tips li { margin: 3px 0; }
.btn.replay { position: absolute; top: 10px; left: 10px; padding: 6px 12px; }

/* V1 | V2 tabs, and the way to the simulator (build.html and sim.html) */
.vers { display: flex; gap: 8px; align-items: stretch; }
.vers .seg { flex: 1; }
.vers .btn.sm { padding: 6px 14px; text-decoration: none; color: inherit; }

/* simulator (sim.html): the 3D plotter fills the stage; the plan of the drawing sits in a corner */
.sim #view { touch-action: none; }
.inset {
  position: absolute; top: 10px; right: 10px; width: min(34%, 46%, 220px); aspect-ratio: 1;
  max-height: 46%; border: 1px solid var(--line); border-radius: 10px; overflow: hidden;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
}
.inset .placebar { top: 6px; left: 6px; }
/* Draw tool: the plan takes over the stage so there is room to draw, and goes back to its corner on Done */
.stage.sketching .inset { inset: 10px; width: auto; max-height: none; aspect-ratio: auto; background: var(--bg); z-index: 1; }
.stage.sketching .simbar { visibility: hidden; }
.simbar { position: absolute; left: 10px; bottom: 10px; display: flex; gap: 8px; align-items: center; font-size: 14px; color: var(--muted); }
.simbar .seg { background: var(--panel); }
.simbar .seg button { padding: 6px 10px; }
.simbar .btn.sm { padding: 6px 12px; }

@media (max-width: 760px) {
  .app.build { grid-template-columns: 1fr; grid-template-rows: 42dvh minmax(0, 1fr); }
  .build .panel { overflow: hidden; }
  .app.sim { grid-template-rows: 42dvh minmax(0, 1fr); }
  .sim .panel, .sim .panel.connected { max-height: none; overflow-y: auto; }
  .inset { top: 6px; right: 6px; width: 30%; }
  .simbar { left: 6px; bottom: 6px; }
  .btn.replay { top: 6px; left: 6px; }
  .card { left: 6px; bottom: 6px; width: calc(100% - 12px); padding: 6px 32px 4px 10px; font-size: 13px; }
  .card p { margin: 2px 0 4px; }
}
