/* Build Shape Generators.
 *
 * Every selector is #bsg-scoped. css/tool-theme.css loads AFTER this file and re-skins buttons,
 * inputs, tabs and links across all the ported widgets — see CLAUDE.md — so a plain class rule
 * here would lose the tie. Where tool-theme's answer is the right one it is left alone and this
 * file only positions things.
 */

#bsg { display: block; }

/* Tabs ------------------------------------------------------------------- */
#bsg .bsg-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}
#bsg .bsg-tab {
  padding: 8px 14px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
}

/* Layout ----------------------------------------------------------------- */
#bsg .bsg-layout {
  display: grid;
  grid-template-columns: minmax(0, 280px) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}
@media (max-width: 780px) {
  #bsg .bsg-layout { grid-template-columns: minmax(0, 1fr); }
}

#bsg .bsg-controls {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

#bsg .bsg-field { display: block; }
#bsg .bsg-label {
  display: block;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
  opacity: .72;
  margin-bottom: 5px;
}
#bsg .bsg-field input[type="number"],
#bsg .bsg-field select {
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 15px;
}
#bsg .bsg-hint {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  opacity: .66;
  line-height: 1.4;
}

#bsg .bsg-segs { display: flex; flex-wrap: wrap; gap: 6px; }
#bsg .bsg-seg {
  flex: 1 1 auto;
  min-width: 76px;
  padding: 7px 10px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

#bsg .bsg-presets { display: flex; flex-wrap: wrap; gap: 6px; margin-top: -6px; }
#bsg .bsg-preset {
  flex: 1 1 auto;
  padding: 6px 8px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

#bsg .bsg-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  cursor: pointer;
}
#bsg .bsg-check input { margin: 0; }

/* Preview ---------------------------------------------------------------- */
#bsg .bsg-preview { display: flex; flex-direction: column; gap: 12px; min-width: 0; }

#bsg .bsg-viewhead {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
#bsg .bsg-viewtabs { display: flex; gap: 6px; }
#bsg .bsg-viewbtn {
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

#bsg .bsg-stage {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  /* The stage is the one place with its own ground: the isometric render needs a surface that
   * is neither the page background nor the block colour, in both themes. */
  background: linear-gradient(180deg, rgba(127, 127, 127, .10), rgba(127, 127, 127, .04));
}
#bsg .bsg-stage canvas {
  display: block;
  width: 100%;
  height: auto;
  /* A voxel preview is drawn from block-sized rectangles; smoothing them is the wrong look and
   * also blurs the one-block detail the layer view exists to show. */
  image-rendering: pixelated;
  touch-action: pan-y;
  cursor: grab;
}
#bsg .bsg-stage canvas:active { cursor: grabbing; }
#bsg .bsg-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  font-size: 14px;
  opacity: .7;
}
/* A display rule beats the [hidden] attribute, so anything toggled by `hidden` needs this or
 * it never hides. CLAUDE.md records the same trap in the schematic viewer. */
#bsg [hidden] { display: none !important; }

/* Layer navigation ------------------------------------------------------- */
#bsg .bsg-layernav {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
#bsg .bsg-layernav input[type="range"] { flex: 1 1 160px; min-width: 120px; }
#bsg .bsg-step {
  width: 36px;
  height: 34px;
  border-radius: 8px;
  font-size: 15px;
  cursor: pointer;
}
#bsg .bsg-layerlabel { font-size: 13px; font-weight: 700; opacity: .8; }

/* Stats ------------------------------------------------------------------ */
#bsg .bsg-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
}
#bsg .bsg-stat {
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(127, 127, 127, .10);
}
#bsg .bsg-statlabel {
  display: block;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
  opacity: .68;
}
#bsg .bsg-statvalue { display: block; font-size: 19px; line-height: 1.25; margin-top: 2px; }

/* Actions ---------------------------------------------------------------- */
#bsg .bsg-actions { display: flex; flex-wrap: wrap; gap: 8px; }
#bsg .bsg-btn {
  padding: 9px 14px;
  border-radius: 9px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}
#bsg .bsg-note { margin: 0; font-size: 13px; min-height: 1.2em; opacity: .85; }

#bsg .bsg-help {
  margin-top: 22px;
  font-size: 14.5px;
  line-height: 1.65;
  max-width: 72ch;
}
#bsg .bsg-help p { margin: 0; }
