/* ── gen_panel.css ──────────────────────────────────────────────────
   Modern control-panel layout for the generator pages (June 2026).
   Replaces the 2017 <br>/absolute-positioning layout INSIDE the panels;
   panel placement on the page and all input ids/handlers are unchanged.
   Scoped per panel root (#ctrlPanel = SymbolGen, #params = HMV) so other
   pages are unaffected. Colors follow gen_skin.css (deep space nova). */

/* ===== shared row primitives ===== */
#ctrlPanel .ctl,
#params .ctl {
  margin: 0 0 14px 0;
}
#ctrlPanel .ctl-label,
#params .ctl-label {
  display: block;
  margin: 0 0 4px 1px;
  font-size: 0.92em;
  letter-spacing: 0.02em;
  color: #d4dae6;
}
#ctrlPanel form.ctl-row,
#params form.ctl-row,
#params div.ctl-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
}

/* ===== SymbolGen (#ctrlPanel) ===== */
#ctrlPanel {
  display: block;
  /* clear the banner gradient that overlaps the panel top (the 2017
     layout relied on leading <br><br> for this) */
  padding-top: 36px;
}
#ctrlPanel .ctl-row input[type="number"],
#ctrlPanel .ctl-row input[type="text"] {
  width: 64px;
  flex: 0 0 auto;
  margin: 0;
}
#ctrlPanel .ctl-row input[type="range"] {
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
  margin: 0;
}
#ctrlPanel .ctl-row .resetButtons {
  flex: 0 0 auto;
  margin: 0;
}
#ctrlPanel .ctl-checks {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 10px;
  margin-top: 2px;
}
#ctrlPanel label.ctl-check {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.92em;
  color: #d4dae6;
  cursor: pointer;
}
#ctrlPanel label.ctl-check input[type="checkbox"] {
  margin: 0;
  accent-color: #4fdad5;
}
#ctrlPanel .genButton {
  width: 100%;
  margin: 6px 0 0 0;
}
/* seed row keeps its slot when hidden (original used visibility, and the
   JS toggles it via style.cssText) so the button never jumps */
#ctrlPanel #seedForm {
  margin-top: 8px;
}
#ctrlPanel #seedForm input[type="text"] {
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
}

/* ===== Height Map Viewer (#params) ===== */
/* the 2017 sheet caps #params at 250px and overflowed buttons past it
   with absolute offsets; the rebuilt panel uses the sidebar's width */
#params {
  width: 480px;
}
#params .ctl-grid {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-top: 10px;
}
#params .ctl-col {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 9px;
}
#params .ctl-actions {
  flex: 0 0 132px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
/* neutralize the 2017 float/offset rules on #params button */
#params .ctl-actions button {
  position: static;
  float: none;
  top: auto;
  margin: 0;
  width: 100%;
  min-height: 36px;
}
#params .ctl-row label.inline {
  flex: 0 0 72px;
  font-size: 1em;
  color: #d4dae6;
}
#params .ctl-row input[type="range"] {
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
  margin: 0;
}
/* replaces the dark theming the old inline styles carried */
#params .ctl-row input[type="text"] {
  flex: 0 0 52px;
  width: 52px;
  margin: 0;
  background: #0d1426;
  color: #d4dae6;
  border: 1px solid rgba(212, 218, 230, 0.25);
  border-radius: 5px;
}
/* hmv_style.css pins #seaType at absolute top:210/left:70 — bring it back
   into its row (visual styling from that rule is kept) */
#params .ctl-row select {
  position: static;
  top: auto;
  left: auto;
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
  margin: 0;
}
#params label.ctl-check {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 1em;
  color: #d4dae6;
  cursor: pointer;
}
#params label.ctl-check input[type="checkbox"] {
  margin: 0;
  accent-color: #4fdad5;
}
/* bring the gradient widget and preview area into the flow (they were
   absolutely positioned against the OLD panel height) */
#params #gradPicker {
  position: static;
  top: auto;
  left: auto;
  margin: 16px 0 0 0;
}
#sidebar #PreviewCanv {
  position: static;
  display: block;
  margin: 16px auto 8px auto;
}
#sidebar #downloadTexture {
  position: static;
  display: block;
  top: auto;
  left: auto;
  width: auto;
  height: auto;
  margin: 0 auto 16px auto;
  padding: 5px 14px;
}

/* ===== shared labeled-field primitive (TileGen, LanguageGen modal) ===== */
.ctl-fields {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 10px 16px;
  margin: 4px 0 14px 0;
}
label.ctl-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
label.ctl-field .ctl-label {
  margin: 0 0 0 1px;
}
label.ctl-field input,
label.ctl-field select {
  width: auto;
  min-width: 0;
  margin: 0;
}
.ctl-stack {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: stretch;
}
.ctl-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.ctl-generate {
  display: block;
  width: 100%;
  min-height: 43px;
  margin: 8px 0 0 0;
}
.ctl-group-label {
  display: block;
  margin-bottom: 6px;
}
.ctl-indent {
  margin-left: 14px;
}

/* ===== PerlinGen (#buttons) ===== */
#buttons .ctl-stack .displayButtons {
  width: 200px;
  margin: 0;
}
#buttons .ctl-check {
  display: flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
}
#buttons .ctl-check input[type="checkbox"] {
  margin: 0;
  accent-color: #4fdad5;
}
#buttons .ctl-generate {
  width: 200px;
}

/* ===== TileGen (#DisplayButtons.tg-panel) =====
   (WorldGen shares the #DisplayButtons id; the .tg-panel class — set only
   in tilegen.html — keeps these rules TileGen-only. A :has() guard worked
   in Chrome but not this Firefox.) */
#DisplayButtons.tg-panel {
  width: 440px;
  padding: 14px;
  box-sizing: border-box;
}
#DisplayButtons .ctl {
  margin-bottom: 14px;
}
#DisplayButtons .ctl-wrap .dispButtons {
  width: auto;
  padding: 4px 10px;
  margin: 0;
}
#DisplayButtons .ctl-fields .dispButtons {
  width: auto;
  margin: 0;
}
#DisplayButtons label.ctl-check {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-right: 18px;
  cursor: pointer;
}
#DisplayButtons label.ctl-check input[type="checkbox"] {
  margin: 0;
  accent-color: #4fdad5;
}
#DisplayButtons .ctl-generate {
  max-width: 420px;
}

/* ===== LanguageGen custom-language modal ===== */
#customLangOptions .ctl-fields {
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}
#customLangOptions #exitCustomLangOptions {
  float: right;
  margin: 0 0 8px 8px;
}
#customLangOptions #genCustom {
  display: block;
  width: 100%;
  min-height: 36px;
  margin-top: 12px;
}

/* ===== WorldGen sidebar polish (CSS-only: the panel markup lives in
   minified HTML and main.min.js positions the panel itself, so only the
   rows inside the folders are modernized; ids here are unique to
   worldgen.html, keeping TileGen's #DisplayButtons unaffected) ===== */
#genParams form,
#normalParams form,
#DisplayButtons > form {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 2px 0 10px 0;
}
#genParams form input.controlButtons {
  width: 80px;
  flex: 0 0 auto;
  margin: 0;
}
#normalParams form input.controlButtons[type="number"] {
  width: 80px;
  flex: 0 0 auto;
  margin: 0;
}
#normalParams form input[type="range"] {
  flex: 1 1 auto;
  min-width: 0;
  width: auto !important;
  margin: 0 !important;
}
#DisplayButtons > form input.controlButtons {
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
  margin: 0;
}
#genParams form .resetButtons,
#normalParams form .resetButtons,
#DisplayButtons > form .resetButtons {
  flex: 0 0 auto;
  margin: 0;
}
