/* Jumbo Bricks — Builder (full-screen configurator).
   Toybox chrome over a bright studio stage. Client-side: no server. */

html, body { height: 100%; }
body { display: flex; flex-direction: column; overflow: hidden; }

/* ---------- top bar ---------- */

.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 20px;
  border-bottom: 3px solid var(--ink);
  background: var(--card);
  flex: none;
}

.home-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  font-family: var(--display);
  font-weight: 800;
  font-size: 17px;
  letter-spacing: -0.01em;
  padding: 6px 12px 6px 8px;
  border-radius: var(--pill);
  transition: background 120ms ease;
}
.home-link:hover { background: var(--pink-tint); }
.home-link .back { font-size: 15px; color: var(--pink); }
.home-link .dot {
  width: 15px; height: 15px; border-radius: 50%;
  background: var(--pink); border: 2.5px solid var(--ink);
  display: inline-block;
}

.jobcard {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin-left: 4px;
  padding-left: 16px;
  border-left: 2px dashed var(--line);
  min-width: 0;
  flex: 1;
}
.partno {
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.03em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.status {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--ink-soft);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.status.error { color: var(--pink-ink); font-weight: 700; }

.export {
  border: 3px solid var(--ink);
  border-radius: var(--pill);
  background: var(--pink);
  color: #fff;
  font-family: var(--display);
  font-weight: 800;
  font-size: 15px;
  padding: 10px 22px;
  box-shadow: var(--pop);
  transition: transform 70ms ease, box-shadow 70ms ease, background 120ms ease;
  flex: none;
}
.export:hover:enabled { background: #ff6198; }
.export:active:enabled { transform: translate(4px, 4px); box-shadow: 0 0 0 var(--ink); }
.export:disabled { background: var(--line); color: var(--ink-soft); box-shadow: var(--pop); opacity: 0.7; cursor: default; }

/* ---------- layout ---------- */

.app { flex: 1; display: flex; min-height: 0; }

.panel {
  width: 336px;
  flex: none;
  overflow-y: auto;
  background: var(--card);
  border-right: 3px solid var(--ink);
  padding: 4px 20px 24px;
}

.stage {
  position: relative;
  flex: 1;
  min-width: 0;
  background:
    radial-gradient(70% 55% at 50% 22%, #fff 0%, var(--paper) 55%, var(--paper-2) 100%);
}
/* faint stud dots on the stage */
.stage::before {
  content: "";
  position: absolute; inset: 0;
  background-image: radial-gradient(circle, rgba(24,19,33,0.05) 3px, transparent 4px);
  background-size: 46px 46px;
  background-position: 8px 8px;
  pointer-events: none;
}
#viewport { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

/* ---------- panel groups ---------- */

.group { padding: 16px 0 14px; border-bottom: 2px dashed var(--line); }
.group:last-of-type { border-bottom: none; }

.eyebrow {
  margin: 0 0 11px;
  font-family: var(--display);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: var(--ink);
}
.eyebrow::before {
  content: ""; display: inline-block;
  width: 10px; height: 10px; margin-right: 8px; vertical-align: 1px;
  border-radius: 50%; background: var(--yellow); border: 2px solid var(--ink);
}

.hint, .footnote { font-size: 11.5px; line-height: 1.5; color: var(--ink-soft); margin: 10px 0 0; }
.footnote { padding: 14px 0 0; }
.build-stamp { margin: 12px 0 0; font-size: 11px; letter-spacing: 0.05em; color: var(--ink-soft); opacity: 0.7; font-variant-numeric: tabular-nums; }

/* chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 2.5px solid var(--ink);
  background: var(--card);
  border-radius: var(--pill);
  padding: 7px 13px;
  font-size: 12.5px;
  font-weight: 700;
  box-shadow: var(--pop-sm);
  transition: transform 70ms ease, box-shadow 70ms ease, background 120ms ease;
}
.chip:hover { background: var(--yellow); }
.chip:active { transform: translate(3px, 3px); box-shadow: 0 0 0 var(--ink); }

/* segmented */
.segmented {
  display: flex; gap: 4px;
  background: var(--paper-2);
  border: 2.5px solid var(--ink);
  border-radius: var(--pill);
  padding: 4px;
}
.seg {
  flex: 1; border: none; border-radius: var(--pill);
  background: transparent; padding: 9px 4px;
  font-family: var(--display); font-weight: 800; font-size: 13px;
  color: var(--ink-soft);
  transition: background 120ms ease, color 120ms ease;
}
.seg.on { background: var(--pink); color: #fff; }

/* steppers */
.steppers { display: flex; gap: 12px; }
.stepper { flex: 1; }
.steplabel { display: block; font-size: 11.5px; font-weight: 600; color: var(--ink-soft); margin-bottom: 6px; }
.stepctl {
  display: flex; align-items: stretch;
  border: 2.5px solid var(--ink);
  border-radius: var(--radius-sm);
  background: var(--card);
  box-shadow: var(--pop-sm);
  overflow: hidden;
}
.stepctl button {
  border: none; background: transparent; width: 36px;
  font-size: 20px; font-weight: 800; color: var(--ink);
  transition: background 100ms ease;
}
.stepctl button:hover { background: var(--blue); color: #fff; }
.stepctl output {
  flex: 1; text-align: center;
  font-family: var(--mono); font-size: 17px; font-weight: 700;
  padding: 9px 0; border-left: 2px solid var(--line); border-right: 2px solid var(--line);
}

/* custom height */
.custom-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; font-size: 12.5px; font-weight: 600; }
.custom-h[hidden] { display: none; }
.custom-h input { width: 92px; }

input[type="number"] {
  font-family: var(--mono); font-size: 13px;
  padding: 8px 10px;
  border: 2.5px solid var(--ink);
  border-radius: 10px;
  background: var(--card); color: var(--ink);
}
input[type="number"]:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-soft); }

/* roof slope: the front-edge input sits beside the sloped-rows stepper */
.stepper > input[type="number"] { width: 100%; box-sizing: border-box; padding: 10px; }

/* ---------- stud map ---------- */

.studmap-wrap { display: flex; justify-content: center; }
.studmap {
  display: grid; gap: 7px; padding: 13px;
  border: 3px solid var(--ink);
  border-radius: var(--radius);
  background: var(--pink-tint);
  box-shadow: var(--pop);
}
.stud {
  width: var(--cell); height: var(--cell);
  border-radius: 50%;
  border: 2.5px dashed var(--pink-soft);
  background: transparent; padding: 0;
  transition: background 90ms ease, border-color 90ms ease, transform 90ms ease;
}
.stud:hover { transform: scale(1.1); border-color: var(--pink); }
/* cells on a slope's inclined face can't carry studs */
.stud:disabled { border-style: dotted; opacity: 0.35; cursor: default; }
.stud:disabled:hover { transform: none; border-color: var(--pink-soft); }
.stud.on {
  border: 2.5px solid var(--ink);
  background: radial-gradient(circle at 50% 38%, #ffe1ec 0%, var(--pink) 62%, var(--pink-ink) 100%);
}
.studmap-actions { display: flex; gap: 16px; justify-content: center; margin-top: 12px; }

/* ---------- height: bricks-tall + custom toggle ---------- */
.sublabel { font-weight: 700; color: var(--pink-ink); font-size: 11px; }
.custom-toggle {
  display: flex; align-items: center; gap: 8px; margin-top: 11px;
  font-size: 12.5px; font-weight: 700; color: var(--ink-soft); cursor: pointer;
}
.custom-toggle input { width: 15px; height: 15px; accent-color: var(--pink); }
#levels-wrap[hidden], #height-presets[hidden], #brick-custom-toggle[hidden],
#studmap-section[hidden], #cells-section[hidden] { display: none; }

/* ---------- brick shape editor (openings + per-cell studs) ---------- */
.cells { display: flex; flex-direction: column; gap: 11px; align-items: center; }
.level { display: flex; flex-direction: column; align-items: center; gap: 5px; }
.level-label {
  font-size: 10px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--pink-ink); font-family: var(--display);
}
.cellgrid {
  display: grid; gap: 5px; padding: 9px;
  border: 3px solid var(--ink); border-radius: var(--radius-sm);
  background: var(--pink-tint); box-shadow: var(--pop-sm);
}
.cell {
  width: var(--cell); height: var(--cell); padding: 0; position: relative;
  border-radius: 5px; border: 2.5px dashed var(--pink-soft); background: transparent;
  transition: background 90ms ease, border-color 90ms ease, transform 90ms ease;
}
.cell:hover { transform: scale(1.08); border-color: var(--pink); }
.cell.solid, .cell.stud { border: 2.5px solid var(--ink); background: var(--pink-soft); }
.cell.stud::after {
  content: ""; position: absolute; inset: 21%; border-radius: 50%;
  border: 1.5px solid var(--ink);
  background: radial-gradient(circle at 50% 38%, #ffe1ec 0%, var(--pink) 62%, var(--pink-ink) 100%);
}
.cell-legend {
  display: flex; gap: 14px; justify-content: center; margin-top: 11px;
  font-size: 11px; font-weight: 700; color: var(--ink-soft);
}
.cell-legend .lg { display: flex; align-items: center; gap: 5px; }
.cell-legend .sw { width: 14px; height: 14px; border-radius: 4px; display: inline-block; position: relative; }
.cell-legend .sw.empty { border: 2px dashed var(--pink-soft); }
.cell-legend .sw.solid, .cell-legend .sw.stud { border: 2px solid var(--ink); background: var(--pink-soft); }
.cell-legend .sw.stud::after {
  content: ""; position: absolute; inset: 20%; border-radius: 50%;
  background: radial-gradient(circle at 50% 38%, #ffe1ec 0%, var(--pink) 62%, var(--pink-ink) 100%);
}

.link {
  border: none; background: none; padding: 2px 0;
  font-size: 12.5px; font-weight: 800; font-family: var(--display);
  color: var(--blue); text-decoration: underline; text-underline-offset: 3px;
  text-decoration-thickness: 2px;
}
.link:hover { color: var(--pink); }

/* ---------- advanced ---------- */
.advanced summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 6px; }
.advanced summary::before { content: "▸"; font-size: 11px; color: var(--pink); transition: transform 120ms ease; }
.advanced[open] summary::before { transform: rotate(90deg); }
.advanced summary::-webkit-details-marker { display: none; }
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 9px 11px; margin-top: 12px; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field span { font-size: 11px; color: var(--ink-soft); line-height: 1.25; font-weight: 600; }
.field input { width: 100%; }
.advanced .link { margin-top: 12px; }

/* ---------- stage overlays ---------- */
.readout {
  position: absolute; left: 18px; bottom: 16px;
  display: flex; flex-direction: column; gap: 3px;
  padding: 10px 15px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.92);
  border: 2.5px solid var(--ink);
  box-shadow: var(--pop);
  pointer-events: none;
}
.dims { font-family: var(--mono); font-size: 15px; font-weight: 700; }
.tris { font-family: var(--mono); font-size: 10.5px; color: var(--ink-soft); }

.warnings {
  position: absolute; right: 18px; bottom: 16px; max-width: 320px;
  padding: 11px 15px;
  border-radius: var(--radius);
  background: var(--yellow);
  border: 2.5px solid var(--ink);
  box-shadow: var(--pop);
  font-size: 12px; font-weight: 600; line-height: 1.45;
}

.stage-error {
  position: absolute; left: 50%; top: 18px; transform: translateX(-50%);
  max-width: min(520px, 90%);
  padding: 11px 17px;
  border-radius: var(--radius);
  background: var(--pink);
  border: 2.5px solid var(--ink);
  box-shadow: var(--pop);
  color: #fff; font-size: 12.5px; font-weight: 600; line-height: 1.45;
}

/* ---------- responsive ---------- */
@media (max-width: 920px) {
  body { overflow: auto; }
  .app { flex-direction: column; }
  .panel { width: 100%; border-right: none; border-bottom: 3px solid var(--ink); max-height: none; }
  .stage { min-height: 62vh; }
}
