/* Skin Statue Generator.
 *
 * Every selector starts `#tool-root #sst` — two ids — because css/tool-theme.css loads after this
 * file and re-skins with one-id rules, and the embedded schematic viewer's own stylesheet
 * (tools/schematic-3d-viewer/schematic-3d-viewer.css, loaded before this) is one-id too. Two ids
 * win both without !important. Buttons use the site's .btn, which the generic
 * `button:not(.btn)` rule in tool-theme.css leaves alone.
 */

#tool-root #sst { display: block; }
#tool-root #sst [hidden] { display: none !important; }

#tool-root #sst .sst-grid {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
@media (max-width: 980px) {
  #tool-root #sst .sst-grid { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- controls ---------- */
#tool-root #sst .sst-controls { display: grid; gap: 18px; padding: 16px; }
#tool-root #sst .sst-group { display: grid; gap: 7px; }
#tool-root #sst .sst-group > .eyebrow-sm { margin: 0 0 2px; color: var(--grass-bright); }
#tool-root #sst .sst-label { display: block; margin: 6px 0 0; font-size: 12.5px; font-weight: 600; color: var(--fg-muted); }
#tool-root #sst .sst-row { display: flex; gap: 6px; }
#tool-root #sst .sst-row input { flex: 1 1 auto; min-width: 0; }
#tool-root #sst .sst-userform { display: grid; gap: 5px; margin: 0; }
#tool-root #sst input[type="file"] { width: 100%; }
#tool-root #sst select { width: 100%; }
#tool-root #sst .sst-hint { margin: 0; font-size: 12px; line-height: 1.5; color: var(--fg-muted); }
#tool-root #sst .sst-privacy { margin: 0; font-size: 11.5px; line-height: 1.5; color: var(--fg-dim); }
#tool-root #sst .sst-check { display: flex; align-items: center; gap: 8px; font-size: 13.5px; margin-top: 4px; }

/* Segmented choices. aria-pressed IS the state; no class to keep in step with it. */
#tool-root #sst .sst-seg { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; }
#tool-root #sst .sst-seg4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
#tool-root #sst .sst-segbtn { padding: 7px 4px; font-size: 12.5px; letter-spacing: 0; line-height: 1.25; }
#tool-root #sst .sst-segbtn[aria-pressed="true"] {
  background: var(--grass-deep);
  border-color: var(--grass);
  color: var(--grass-bright);
}
#tool-root #sst .sst-segbtn:disabled { opacity: 0.45; cursor: not-allowed; }

/* Default-skin buttons: the face and the hat drawn straight from the skin PNG, 4x, unsmoothed. */
#tool-root #sst .sst-presets { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; }
#tool-root #sst .sst-preset {
  display: flex; align-items: center; gap: 7px;
  padding: 5px 6px; font-size: 12px; letter-spacing: 0; text-align: left; min-width: 0;
}
#tool-root #sst .sst-preset[aria-pressed="true"] { border-color: var(--grass); color: var(--grass-bright); }
#tool-root #sst .sst-face { position: relative; flex: 0 0 24px; width: 24px; height: 24px; overflow: hidden; }
#tool-root #sst .sst-face i {
  position: absolute; inset: 0;
  background-repeat: no-repeat;
  background-size: 192px 192px;       /* 64 × 3 */
  image-rendering: pixelated;
}
#tool-root #sst .sst-face i:first-child { background-position: -24px -24px; }   /* face  8,8  */
#tool-root #sst .sst-face i:last-child { background-position: -120px -24px; }   /* hat  40,8  */
#tool-root #sst .sst-presetname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- main column ---------- */
#tool-root #sst .sst-main { display: grid; gap: 14px; min-width: 0; }
#tool-root #sst .sst-status { margin: 0; font-size: 13.5px; color: var(--fg-muted); }
#tool-root #sst .sst-error {
  margin: 0; padding: 9px 12px; font-size: 13.5px;
  color: var(--redstone, #e5484d); border: 1px solid currentColor; border-radius: var(--radius);
}

#tool-root #sst .sst-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
  gap: 8px;
}
#tool-root #sst .sst-stat { padding: 9px 11px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--line); }
#tool-root #sst .sst-statlabel { display: block; font-size: 10px; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase; color: var(--fg-dim); }
#tool-root #sst .sst-statvalue { display: block; margin-top: 2px; font-size: 17px; font-weight: 650; color: var(--fg); font-variant-numeric: tabular-nums; }

/* The viewer, restacked: its stage full width with its view controls underneath, instead of a
 * 300px sidebar that would make a third column beside this tool's own. */
#tool-root #sst .sc-app { grid-template-columns: minmax(0, 1fr); }
#tool-root #sst .sc-stage { height: min(62vh, 560px); min-height: 340px; }
#tool-root #sst .sc-side { grid-template-columns: minmax(0, 1fr); }
#tool-root #sst .sc-panel { padding: 10px; }

/* ---------- layer plan ---------- */
#tool-root #sst .sst-plan,
#tool-root #sst .sst-export,
#tool-root #sst .sst-matpanel { display: grid; gap: 10px; padding: 14px; }
#tool-root #sst .sst-planhead { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
#tool-root #sst .sst-planhead .eyebrow-sm { margin: 0; color: var(--grass-bright); }
#tool-root #sst .sst-layerlabel { font-size: 13px; font-weight: 650; font-variant-numeric: tabular-nums; }
#tool-root #sst .sst-layernav { display: flex; align-items: center; gap: 8px; }
/* range inputs carry a 2px UA margin per side, so width:100% overflows by 4px (see CLAUDE.md) */
#tool-root #sst .sst-layernav input[type="range"] { flex: 1 1 auto; min-width: 0; margin: 0; }
#tool-root #sst .sst-step { padding: 6px 12px; }
#tool-root #sst .sst-planbody {
  display: grid;
  grid-template-columns: minmax(0, auto) minmax(180px, 1fr);
  gap: 14px;
  align-items: start;
}
@media (max-width: 640px) {
  #tool-root #sst .sst-planbody { grid-template-columns: minmax(0, 1fr); }
}
#tool-root #sst .sst-planstage { min-width: 0; }
#tool-root #sst .sst-planstage canvas {
  display: block;
  max-width: 100%;
  height: auto;
  image-rendering: pixelated;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: crosshair;
}
#tool-root #sst .sst-hover { margin: 6px 0 0; min-height: 1.4em; font-size: 12.5px; color: var(--fg-muted); font-variant-numeric: tabular-nums; }
#tool-root #sst .sst-layerlist { display: grid; gap: 8px; min-width: 0; align-content: start; }
#tool-root #sst .sst-actions { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------- materials ---------- */
#tool-root #sst .sst-mats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 4px 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}
#tool-root #sst .sst-mats-layer { grid-template-columns: minmax(0, 1fr); max-height: 300px; overflow-y: auto; }
#tool-root #sst .sst-mat {
  display: flex; align-items: center; gap: 8px;
  min-width: 0; padding: 5px 8px;
  border-radius: var(--radius); background: var(--surface-2);
  font-size: 13px;
}
#tool-root #sst .sst-swatch {
  flex: 0 0 14px; width: 14px; height: 14px;
  border-radius: 2px; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.35);
}
#tool-root #sst .sst-matname { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--fg); }
#tool-root #sst .sst-matcount { flex: 0 0 auto; font-family: var(--font-mono); font-variant-numeric: tabular-nums; color: var(--grass); }
#tool-root #sst .sst-matstacks { flex: 0 0 auto; font-family: var(--font-mono); font-size: 11.5px; color: var(--fg-dim); }
/* --grass is tuned for the dark page; on the light theme --grass-bright is the dark ink. */
:root[data-theme="light"] #tool-root #sst .sst-matcount { color: var(--grass-bright); }
#tool-root #sst .sst-matactions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------- export ---------- */
#tool-root #sst .sst-exportrow { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
#tool-root #sst .sst-edition { min-width: 64px; font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--fg-muted); }
#tool-root #sst .sst-fmt { font-family: var(--font-mono); letter-spacing: 0; }
#tool-root #sst .sst-notes { margin: 0; padding-left: 18px; display: grid; gap: 5px; font-size: 13px; line-height: 1.55; color: var(--fg-muted); }
#tool-root #sst .sst-notes code { font-size: 12px; }
#tool-root #sst .sst-notes .sst-warn { color: var(--fg); }

/* ---------- help ---------- */
#tool-root #sst .sst-help { margin-top: 22px; max-width: 78ch; }
#tool-root #sst .sst-help h2 { margin: 18px 0 6px; font-size: 17px; }
#tool-root #sst .sst-help p { margin: 0 0 10px; font-size: 14px; line-height: 1.65; color: var(--fg-muted); }
#tool-root #sst .sst-help b { color: var(--fg); }
#tool-root #sst .sst-helplist { margin: 0 0 10px; padding-left: 20px; display: grid; gap: 4px; }
#tool-root #sst .sst-helplist li { font-size: 14px; line-height: 1.6; color: var(--fg-muted); }

#tool-root #sst.is-dropping .sst-main { outline: 2px dashed var(--grass); outline-offset: 4px; }
