/* Level Config + Preview (Stage 1)
   Linked later from index.html. */

.levelcfg, .levelprev {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.levelcfg__header {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 14px;
}

.levelcfg__title, .levelprev__title {
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.01em;
}

/* Current-file status chip sitting beside the page name. */
.levelcfg__filestate {
  font-size: 12px;
  color: var(--muted);
  padding: 4px 12px;
  line-height: 1.4;
  white-space: nowrap;
}

.levelcfg__actions, .levelprev__actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  /* Keep actions (and an empty actions slot) pinned to the right edge so the
   * page name + file chip stay grouped together on the left. */
  margin-left: auto;
}

.levelcfg__body {
  /* Resizable columns controlled by JS (splitters) */
  --levelcfgLeftW: 260px;
  --levelcfgRightW: 360px;
  --levelcfgSplitterW: 10px;

  display: grid;
  grid-template-columns:
    var(--levelcfgLeftW)
    var(--levelcfgSplitterW)
    1fr
    var(--levelcfgSplitterW)
    var(--levelcfgRightW);
  gap: 0;
  min-height: 520px;
}

/* Draggable splitters between panels */
.levelcfg__splitter {
  cursor: col-resize;
  background: rgba(255,255,255,0.04);
  border-left: 1px solid rgba(255,255,255,0.10);
  border-right: 1px solid rgba(0,0,0,0.35);
}

.levelcfg__splitter:hover {
  background: rgba(255,255,255,0.07);
}

.levelcfg__splitter.is-dragging {
  background: rgba(255,255,255,0.10);
}

.levelcfg__left, .levelcfg__center, .levelcfg__right,
.levelprev__body {
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 10px;
  padding: 12px;
}

.levelcfg__right {
  display: grid;
  grid-template-rows: auto auto; /* pages + tips both fit content */
  gap: 12px; /* no space between Pages and Tips */
  min-height: 0;
  padding: 12px;

  /* IMPORTANT: prevent grid rows from stretching when the panel is tall */
  align-content: start;
  align-items: start;
}

.levelcfg__rightupper, .levelcfg__rightlower {
  border: 1px dashed rgba(255,255,255,0.12);
  border-radius: 10px;
  padding: 12px;
}

/* If Pages group is collapsed, don't let the upper container reserve space */
.levelcfg__rightupper:has(.lcg:not([open])) {
  padding-bottom: 12px;   /* reduce empty bottom */
}

.levelcfg__rightupper:has(.lcg:not([open])) .lcg__body {
  margin-top: 0;         /* remove the body spacing when closed */
  padding-top: 0;
}



.levelcfg__rightlower {
  max-height: 220px;
  overflow: auto;
}



.levelcfg__rightupper {
  align-self: start; /* do not stretch to fill */
}


.panel__title {
  font-weight: 700;
  margin-bottom: 6px;
}

.panel__hint {
  opacity: 0.85;
  font-size: 13px;
  line-height: 1.35;
}

/* Left controls bar (two rows of icon buttons) */
.levelcfg__viewbar {
  margin: 0 0 12px 0;
  padding: 10px;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 12px;
  background: rgba(255,255,255,0.04);
}
.levelcfg__viewbar .levelcfg__toptoolbtn,
.levelcfg__viewbar .levelcfg__toolbtn {
  min-width: 40px;
  min-height: 40px;
  padding: 6px;
  gap: 0;
  justify-content: center;
}
.levelcfg__viewbar .toolbtn__icon { font-size: 16px; }
.levelcfg__controlbar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.levelcfg__controlrow {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.levelcfg__controlbar .levelcfg__toptoolbtn,
.levelcfg__controlbar .levelcfg__toolbtn {
  min-width: 40px;
  min-height: 40px;
  padding: 6px;
  gap: 0;
  justify-content: center;
}

.levelcfg__controlbar .toolbtn__icon {
  font-size: 16px;
}

.levelcfg__rightupper__body {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.levelcfg__rightupper__empty {
  opacity: 0.85;
  font-size: 13px;
  line-height: 1.35;
}
/* Stage 3: Maze Render dropdown (right sidebar) */
.levelcfg__renderdrop > summary { list-style: none; }
.levelcfg__renderdrop > summary::-webkit-details-marker { display: none; }
.levelcfg__renderdrop > summary::marker { content: ""; }

.levelcfg__renderdrop__summary {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}

.levelcfg__renderdrop__title {
  font-weight: 700;
}

.levelcfg__renderdrop__caret {
  margin-left: auto;
  opacity: 0.85;
  font-size: 12px;
  transition: transform 140ms ease;
}

.levelcfg__renderdrop[open] .levelcfg__renderdrop__caret {
  transform: rotate(180deg);
}

.levelcfg__renderdrop__body {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.levelcfg__renderrow {
  display: grid;
  grid-template-columns: 1fr 130px;
  gap: 8px;
  align-items: center;
}
.levelcfg__renderrow .levelcfg__help {
  grid-column: 1 / -1;
  margin-top: -2px;
}

/* Right Upper: Setup boxes (Ghost/Fruit) */
.levelcfg__setupbox {
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 10px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.levelcfg__setupbox__title {
  font-weight: 700;
}

.levelcfg__setupbox__meta {
  opacity: 0.85;
  font-size: 13px;
}

.levelcfg__setupactions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.levelcfg__setupinline {
  display: grid;
  grid-template-columns: 1fr 110px;
  gap: 8px;
  align-items: center;
}

/* Fruits page: keep trigger controls (type + value) on one horizontal line */
.levelcfg__setuptrig {
  display: flex;
  gap: 8px;
  align-items: center;
  min-width: 0;
}

.levelcfg__setuptrig .levelcfg__select {
  flex: 1 1 auto;
  min-width: 0;
}

.levelcfg__setuptrig .levelcfg__input {
  flex: 0 0 90px; /* fixed compact width for trigger value */
  width: 90px;
}


.levelcfg__setuplist {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.levelcfg__setuplabels {
  display: grid;
  gap: 8px;
  align-items: end;
  font-size: 12px;
  opacity: 0.75;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0 0 2px;
}

.levelcfg__setuplabel {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}


.levelcfg__setupline {
  display: grid;

  /* Make the "House" column wider to avoid truncation */
  grid-template-columns: 90px 1fr 1.7fr 1fr 140px 90px;

  gap: 8px;
  align-items: center;
}

/* Prevent grid children from forcing overflow */
.levelcfg__setupline > * {
  min-width: 0;
}


.levelcfg__setupline--fruit {
  grid-template-columns: 90px 1fr 70px 70px 1fr 90px;
}

.levelcfg__setupremove {
  width: 100%;
}

.levelcfg__setupid {
  opacity: 0.9;
  font-size: 12.5px;
}

.levelcfg__winEditor {
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 10px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.levelcfg__winEditor__title {
  font-weight: 700;
}

.levelcfg__winEditor__meta {
  opacity: 0.85;
  font-size: 13px;
}

.levelcfg__formrow {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 10px;
  align-items: center;
}

.levelcfg__row {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 10px;
  align-items: center;
}

/* Stacked row: label فوق control (used for Ghost House Size in Brushes) */
.levelcfg__row--stack {
  grid-template-columns: 1fr;
  align-items: stretch;
}

.levelcfg__row--stack .levelcfg__label {
  margin-bottom: 6px;
}

/* Larger select (bigger click/scroll target) */
.levelcfg__select--lg {
  width: 100%;
  min-height: 44px;
  font-size: 14px;
  padding: 10px 12px;
}


.levelcfg__control {
  display: block;
}


.levelcfg__label {
  opacity: 0.9;
  font-size: 13px;
}

.levelcfg__input,
.levelcfg__select,
.levelcfg__setupTriggerVal,
.levelcfg__textarea {
  width: 100%;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.06);
  color: inherit;
  border-radius: 10px;
  padding: 8px 10px;
  box-sizing: border-box;
}

/* Textareas: keep readable + allow vertical resize only */
.levelcfg__textarea {
  resize: vertical;
  font: inherit;
  line-height: 1.4;
}

.levelcfg__help {
  opacity: 0.85;
  font-size: 12.5px;
  line-height: 1.35;
}

/* Center editor grouping */
.levelcfg__group {
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 10px;
  padding: 10px;
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.levelcfg__btns {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}


/* Read-only value display */
.levelcfg__readonly {
  width: 100%;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.04);
  border-radius: 10px;
  padding: 8px 10px;
  opacity: 0.9;
}

/* --- Stage 6: Grid Preview --- */
.levelcfg__gridhost{
  /* The gridhost is the ONLY place that should scroll (and only when needed). */
  flex: 1 1 auto;
  min-height: 0;

  width: 100%;

  /* Remove forced full height, which can cause phantom scrollbars. */
  height: auto;

  overflow: auto;

  /* Center the shrink-wrapped grid in the available space */
  display: flex;
  justify-content: center;
  align-items: flex-start;

  padding: 10px;
  box-sizing: border-box;
}



.levelcfg__gridpreview {
  margin-top: 6px;
  display: grid;

  /* Do NOT use gap+background for grid lines (it fills behind transparent cells).
     We'll draw lines on each cell instead. */
  gap: 0;
  padding: 0;
  background: transparent;

  /* Outer frame when grid is ON (can be hidden when OFF below) */
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;

  /* key: size to actual grid, do not stretch */
  width: max-content;
  height: max-content;
  align-content: start;
  justify-content: start;
}

/* Stage 1: surface-based Maze Viewer */
.levelcfg__mazestage{
  display: block;
  width: max-content;
  height: max-content;

  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  background: transparent;
}

.levelcfg__mazestage.levelcfg__mazestage--nogrid{
  border-color: transparent;
}

/* Embedded PlayView inside Level Config center page */
.levelcfg__playhost {
  width: 100%;
  height: 100%;       /* fill the center page height */
  min-height: 0;
  display: block;
}

/* Hide PlayView side controls when embedded as a preview */
.levelcfg__playhost .play__side {
  display: none !important;
}

/* When PlayView is embedded in Level Config: make the maze/surface take full width */
.levelcfg__playhost .play__body{
  grid-template-columns: 1fr;   /* remove the reserved 360px side column */
}

/* Embedded PlayView: fill height and center maze */
.levelcfg__playhost .play__body{
  height: 100%;
  align-items: stretch; /* let the main area take full height */
}

/* Center the maze/surface area inside the available space */
.levelcfg__playhost .play__main{
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 0;
}

/* If your surface wrapper exists, make it shrink-to-fit and stay centered */
.levelcfg__playhost .play__stagewrap{
  width: auto;
  height: auto;
  max-width: 100%;
}

.play__stagewrap{
  justify-content: center;
}

/* Level Config center panels should be allowed to stretch vertically */
.levelcfg__center{
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.levelcfg__centerpage{
  flex: 1 1 auto;
  min-height: 0;
}

/* Embedded PlayView: wrapper fills available height and centers the surface */
.levelcfg__playhost .play__stagewrap{
  width: 100%;
  height: 100%;
  min-height: 0;

  /* Make centering work */
  display: flex;
  align-items: center;
  justify-content: center;

  /* Keep scroll if the maze is bigger than the viewport */
  overflow: auto;
}

/* Embedded PlayView: keep the surface centered and not stretched */
.levelcfg__playhost .play__stage{
  display: block;
  max-width: 100%;
  max-height: 100%;
}

.levelcfg__cell{
  width: 100%;
  height: 100%;

  /* keep tight hitbox + no default button styles */
  padding: 0;
  margin: 0;
  border: 0;
  border-radius: 0;
  box-sizing: border-box;

  position: relative; /* needed for ::after overlay */

  /* transparent cells so grid lines show through */
  background: transparent;

  /* optional: center any glyph nicely */
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  font-size: 11px;
  cursor: crosshair;
}

/* Improve visibility for text-glyph tiles on dark grid */
.levelcfg__cell.cell--pellet,
.levelcfg__cell.cell--power,
.levelcfg__cell.cell--oneway {
  font-size: 14px;
  font-weight: 700;
  color: rgba(255,255,255,0.92);
  text-shadow: 0 1px 0 rgba(0,0,0,0.35);
}

.levelcfg__cell.cell--pellet::before,
.levelcfg__cell.cell--power::before,
.levelcfg__cell.cell--oneway::before {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 6px;
  background: rgba(0,0,0,0.30);
  pointer-events: none;
}



/* Grid lines ON: draw light lines via cell inset stroke, keep cell fill transparent */
.levelcfg__gridpreview:not(.levelcfg__gridpreview--nogrid) .levelcfg__cell {
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

/* View toggles */
.levelcfg__gridpreview.levelcfg__gridpreview--nogrid {
  gap: 0;
  padding: 0;
  background: transparent;

  /* no outer frame when grid lines are off */
  border-color: transparent;
}

/* Grid lines OFF: remove per-cell strokes */
.levelcfg__gridpreview.levelcfg__gridpreview--nogrid .levelcfg__cell {
  box-shadow: none;
}

/* When grid lines are ON, force tile fills to be transparent (keep only the lines).
   We exclude .cell--unknown so warnings still show. */
.levelcfg__gridpreview:not(.levelcfg__gridpreview--nogrid) .levelcfg__cell:not(.cell--unknown) {
  background: transparent !important;
  border-color: transparent !important;
}


.levelcfg__gridpreview--nogrid{
  box-shadow: none;
}


/* Center line highlight (view only) - tint only (no borders) */
.levelcfg__cell.cell--centerline::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.04);
  pointer-events: none;
}

.levelcfg__cell * { background: transparent !important; }


.levelcfg__gh-editor {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.levelcfg__gh-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.levelcfg__gh-slots {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.levelcfg__gh-slot {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
}

/* Tile fills: ONLY when grid lines are OFF (nogrid) */
.levelcfg__gridpreview--nogrid .levelcfg__cell.cell--wall {
  background: rgba(255,255,255,0.12);
}

.levelcfg__gridpreview--nogrid .levelcfg__cell.cell--void {
  background: rgba(0,0,0,0.45);
}

.levelcfg__gridpreview--nogrid .levelcfg__cell.cell--pellet,
.levelcfg__gridpreview--nogrid .levelcfg__cell.cell--power,
.levelcfg__gridpreview--nogrid .levelcfg__cell.cell--tunnel,
.levelcfg__gridpreview--nogrid .levelcfg__cell.cell--house,
.levelcfg__gridpreview--nogrid .levelcfg__cell.cell--fruit,
.levelcfg__gridpreview--nogrid .levelcfg__cell.cell--oneway {
  background: rgba(255,255,255,0.06);
}

.levelcfg__cell.cell--pacman {
  background: rgba(255, 230, 120, 0.18);
}

/* Grid rectangle drag + selection (Stage 6) */
.levelcfg__cell.cell--dragrect {
  outline: 2px solid rgba(255,255,255,0.30);
  outline-offset: -2px;
}

.levelcfg__cell.cell--selected {
  outline: 2px solid rgba(255,255,255,0.70);
  outline-offset: -2px;
}

.levelcfg__cell.cell--unknown {
  background: rgba(255, 120, 0, 0.18);
}


.levelcfg__gridpreview--nogrid .levelcfg__cell.cell--floor {
  background: rgba(255,255,255,0.02);
}

.levelcfg__gridpreview--nogrid .levelcfg__cell.cell--tunnel {
  background: rgba(120, 200, 255, 0.08);
  border-color: rgba(120, 200, 255, 0.18);
}

.levelcfg__cell.cell--house {
  background: rgba(200, 160, 255, 0.10);
  border-color: rgba(200, 160, 255, 0.20);
}

.levelcfg__cell.cell--gate {
  background: rgba(255, 230, 120, 0.10);
  border-color: rgba(255, 230, 120, 0.22);
}

.levelcfg__cell.cell--spawn {
  background: rgba(120, 255, 180, 0.10);
  border-color: rgba(120, 255, 180, 0.22);
}


.levelcfg__cell.cell--fruit {
  background: rgba(255, 180, 120, 0.10);
  border-color: rgba(255, 180, 120, 0.20);
}

.levelcfg__cell.cell--oneway {
  background: rgba(120, 255, 180, 0.08);
  border-color: rgba(120, 255, 180, 0.18);
}

/* Left controls (Stage 2: Expandable Groups) */
.levelcfg__leftbody {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
}

.lcg {
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 10px;
  padding: 8px;
}

.lcg__summary {
  cursor: pointer;
  font-weight: 700;
  user-select: none;
}

.lcg__body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
}

.levelcfg__toptools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* Left sidebar tabs (File / Tools / Brushes) */
.levelcfg__tabsroot {
  margin: 10px 0 12px 0;
  padding: 8px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.02);
}

/* Tab header = segmented control (visibly different from buttons) */
.levelcfg__tablist {
  display: flex;
  gap: 6px;
  padding: 6px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(0,0,0,0.14);
  margin-bottom: 10px; /* clear separation from page frame */
}

.levelcfg__tabbtn {
  min-width: 40px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  border-radius: 10px;

  /* NOT like .btn */
  border: 1px solid transparent;
  background: transparent;
  color: inherit;
  cursor: pointer;
}

.levelcfg__tabbtn:hover {
  border-color: rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.06);
}

.levelcfg__tabbtn[aria-selected="true"] {
  border-color: rgba(255,255,255,0.22);
  background: rgba(255,255,255,0.10);
}

/* Page frame: makes it obvious these are "pages" */
.levelcfg__tabframe {
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(0,0,0,0.18); /* different bg from sidebar + header */
  padding: 10px;
}

.levelcfg__tabpage[hidden] {
  display: none;
}

.levelcfg__tabpage {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Page content rows */
.levelcfg__tabbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.levelcfg__sep {
  width: 1px;
  height: 22px;
  background: rgba(255,255,255,0.18);
  margin: 0 4px;
  align-self: center;
}

/* Icon-only inside tabs */
.levelcfg__tabsroot .toolbtn__label {
  display: none;
}

/* Normalize sizes inside the tab pages (fix "too large" buttons) */
.levelcfg__tabsroot .levelcfg__toptools {
  padding: 0;
  margin: 0;
  border: 0;
  background: transparent;
  gap: 8px;
}

.levelcfg__tabsroot .levelcfg__toptoolbtn,
.levelcfg__tabsroot .levelcfg__toolbtn {
  min-width: 40px;
  min-height: 40px;
  padding: 6px;
  gap: 0;
  justify-content: center;
}

.levelcfg__tabsroot .toolbtn__icon {
  font-size: 16px;

  /* make text icons (., o, arrows) readable on dark UI */
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: rgba(0,0,0,0.30);
  color: rgba(255,255,255,0.92);
}


.levelcfg__toptoolbtn {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
  justify-content: center;
  min-height: 56px;
  padding: 10px 8px;
  text-align: center;
}

.levelcfg__toptoolbtn[aria-pressed="true"] {
  border-color: rgba(255,255,255,0.35);
  background: rgba(230, 16, 16, 0.12);
}


.levelcfg__toolgrid {
  display: grid;

  /* fixed-size cells so buttons don't look huge */
  grid-template-columns: repeat(4, 42px);
  justify-content: start;

  gap: 8px;
}

.levelcfg__toolgrid .toolbtn__icon { font-size: 22px; }
.levelcfg__toolgrid .toolbtn__label { display: none; }


.levelcfg__toolbtn[aria-pressed="true"] {
  border-color: rgba(255,255,255,0.35);
  background: rgba(224, 9, 9, 0.12);
}

/* Center focus highlight (history + tree navigation) */
.levelcfg__row--active {
  outline: 2px solid rgba(255,255,255,0.25);
  border-radius: 10px;
  padding: 6px;
}

/* Tips box */
.levelcfg__tips {
  opacity: 0.9;
  font-size: 13px;
  line-height: 1.4;
}

/* Tips warning state (used for non-blocking validation hints) */
.levelcfg__tips--warn {
  opacity: 1;
  border-left: 4px solid rgba(255, 193, 7, 0.9);
  padding-left: 10px;
}

.levelcfg__tips__warnTitle {
  margin-top: 10px;
  font-weight: 700;
  color: rgba(255, 193, 7, 0.95);
}

.levelcfg__tips__warnList {
  margin: 6px 0 0 18px;
  padding: 0;
}

.levelcfg__tips__warnItem {
  color: rgba(255, 193, 7, 0.95);
}

/* Reusable "hide without removing from DOM" helper */
.is-hidden {
  display: none !important;
}


/* Generic buttons (fallback if your main.css doesn't define them) */
.btn {
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.06);
  color: inherit;
  padding: 8px 10px;
  border-radius: 10px;
  cursor: pointer;
}

.btn--primary {
  border-color: rgba(255,255,255,0.32);
  background: rgba(255,255,255,0.12);
}

/* ---- Form controls (select / option) ---- */
/* Force readable select in Firefox/system themes (prevents white select with white text). */
.levelcfg__select,
.levelcfg__input,
.levelcfg__setupTriggerVal {
  border: 1px solid rgba(255,255,255,0.18);
  padding: 8px 10px;
  border-radius: 10px;

  /* Force colors explicitly (system UI sometimes overrides background only) */
  background-color: #151515;
  color: #f2f2f2;

  /* Reduce OS theming interference */
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
}

/* Runner: make trigger value compact + aligned */
.levelcfg__setupline--runner .levelcfg__setupTriggerVal {
  text-align: center;
  font-variant-numeric: tabular-nums;
}

/* Disabled trigger value (On Level Start) should look intentional */
.levelcfg__setupTriggerVal:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}


/* Dropdown options: also force dark background + light text */
.levelcfg__select option {
  background-color: #151515;
  color: #f2f2f2;
}


/* Win conditions list */
.levelcfg__winconds__actions {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.levelcfg__list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.levelcfg__listitem {
  text-align: left;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.04);
  cursor: pointer;
}

.levelcfg__listitem.is-active {
  outline: 2px solid rgba(255,255,255,0.35);
}

/* ----------------------------
   UI polish: buttons, tools, accordion
---------------------------- */

.btn:hover {
  border-color: rgba(255,255,255,0.30);
  background: rgba(255,255,255,0.10);
}

.btn:focus-visible {
  outline: 2px solid rgba(255,255,255,0.35);
  outline-offset: 2px;
}

.btn--danger {
  border-color: rgba(255, 120, 120, 0.35);
  background: rgba(255, 120, 120, 0.10);
}

.btn--danger:hover {
  border-color: rgba(255, 120, 120, 0.55);
  background: rgba(255, 120, 120, 0.16);
}

/* Accordion summary: make it look clickable + show a caret */
.lcg__summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-radius: 10px;
}

.lcg__summary::after {
  content: "▸";
  opacity: 0.75;
}

.lcg[open] > .lcg__summary::after {
  content: "▾";
}

/* Top tools bar (tools, not brushes) */
.levelcfg__toptools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px;
  margin: 10px 0 12px 0;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 12px;
  background: rgba(255,255,255,0.04);
}

.levelcfg__toptoolbtn {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
  justify-content: center;
  min-width: 84px;
  padding: 8px 10px;
}

.levelcfg__toptoolbtn[aria-pressed="true"] {
  border-color: rgba(255,255,255,0.35);
  background: rgba(161, 226, 9, 0.301);
}

/* Tool buttons: icon + label */
.levelcfg__toolbtn {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 10px 8px;
  text-align: center;
}

.toolbtn__icon {
  font-size: 18px;
  line-height: 1;
}

.toolbtn__label {
  font-size: 14px;
  opacity: 0.92;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.levelcfg__toolbtn[aria-pressed="true"] {
  border-color: rgba(255,255,255,0.35);
  background: rgba(161, 226, 9, 0.301);
}


/* ---------------- Level Config Layout v2 overrides ---------------- */
.levelcfg__body {
  /* IMPORTANT: do NOT override columns here.
     Columns are controlled by the resizable splitter vars earlier in this file. */
  align-items: stretch;
  min-height: calc(100vh - 260px);
}

.levelcfg__center {
  overflow: hidden;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.levelcfg__centerhost {
  flex: 1;
  min-height: 0;

  /* Let the page decide; do not force a scrollbar at the centerhost level. */
  overflow: hidden;
}

.levelcfg__page { height: 100%; }

/* ----------------------------
   Center Pages: Card-Based Design
   Applies ONLY to non-surface pages:
   (settings + entities). Excludes grid/maze/play.
---------------------------- */

/* Card pages scroll internally (centerhost stays overflow:hidden) */
.levelcfg__page--cards {
  height: 100%;
  min-height: 0;

  /* scroll vertically, but prevent accidental horizontal scroll */
  overflow: auto;
  overflow-x: hidden;

  padding: 14px;
  box-sizing: border-box;

  /* layout */
  display: grid;
  gap: 12px;
  align-content: start;

  /* allow grid children to shrink within the page */
  width: 100%;
  max-width: 100%;
}

/* Story should be full-width and appear at the bottom */
.levelcfg__page--cards[data-page="settings"] .lcg:has(.levelcfg__group[data-leaf-id="story"]) {
  grid-column: 1 / -1;
  order: 999;
}

/* Story text row: label above textarea, textarea takes full page width */
.levelcfg__page--cards[data-page="settings"] .levelcfg__row[data-leaf-id="storyline.body"] {
  grid-template-columns: 1fr;
  align-items: stretch;
}

.levelcfg__page--cards[data-page="settings"] .levelcfg__row[data-leaf-id="storyline.body"] .levelcfg__label {
  margin-bottom: 6px;
}

.levelcfg__page--cards[data-page="settings"] .levelcfg__row[data-leaf-id="storyline.body"] .levelcfg__control {
  width: 100%;
}


/* Prevent any card/content from forcing overflow in card pages */
.levelcfg__page--cards > * {
  min-width: 0;
  max-width: 100%;
}

.levelcfg__page--cards * {
  box-sizing: border-box;
}

.levelcfg__page--cards img,
.levelcfg__page--cards svg,
.levelcfg__page--cards video {
  max-width: 100%;
  height: auto;
}

/* Settings page: responsive cards grid */
.levelcfg__page--cards[data-page="settings"] {
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

/* Responsive: collapse to one column + stack label/control rows */
@media (max-width: 860px) {
  .levelcfg__page--cards {
    padding: 10px;
  }

  .levelcfg__page--cards[data-page="settings"] {
    grid-template-columns: 1fr;
  }

  .levelcfg__page--cards[data-page="settings"] .levelcfg__row,
  .levelcfg__page--cards[data-page="settings"] .levelcfg__formrow {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .levelcfg__page--cards[data-page="settings"] .levelcfg__label {
    margin-bottom: 6px;
  }
}


/* Story: full-width and forced to bottom on Settings page */
.levelcfg__page--cards[data-page="settings"] .levelcfg__group[data-leaf-id="story"] {
  grid-column: 1 / -1;  /* span both columns */
  order: 999;           /* push to bottom */
}

/* Small screens: collapse to one column */
@media (max-width: 900px) {
  .levelcfg__page--cards[data-page="settings"] {
    grid-template-columns: 1fr;
  }
}

/* If Story is wrapped in a container that is the actual grid item, also push that wrapper */
.levelcfg__page--cards[data-page="settings"] :is(.lcg, .levelcfg__group)[data-leaf-id="story"] {
  order: 999;
}


/* Entity pages: single column, centered and readable */
.levelcfg__page--cards[data-page^="ent."] {
  grid-template-columns: 1fr;
  max-width: 920px;
  margin: 0 auto;
}

/* Turn existing groups into “cards” (but only inside card pages) */
.levelcfg__page--cards .levelcfg__group,
.levelcfg__page--cards .levelcfg__setupbox,
.levelcfg__page--cards .levelcfg__winEditor {
  margin-top: 0; /* override old spacing */
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 14px;
  padding: 14px;
  background: rgba(255,255,255,0.04);
  box-shadow: 0 14px 36px rgba(0,0,0,0.28);
}

/* Card titles for groups that provide dataset.cardTitle */
.levelcfg__page--cards .levelcfg__group[data-card-title]::before {
  content: attr(data-card-title);
  display: block;
  font-weight: 800;
  font-size: 14px;
  margin-bottom: 10px;
  color: rgba(255,255,255,0.92);
}

/* Slightly improve form row spacing inside cards */
.levelcfg__page--cards .levelcfg__row,
.levelcfg__page--cards .levelcfg__formrow {
  padding: 6px 0;
}

/* Keep helper text readable in cards */
.levelcfg__page--cards .levelcfg__help,
.levelcfg__page--cards .levelcfg__setupbox__meta {
  opacity: 0.88;
}


/* Force center pages to truly disappear when hidden (protect against global CSS resets). */
.levelcfg__page[hidden] { display: none !important; }

/* Map resize: show the "Current: WxH" status under the Apply button */
.levelcfg__resizecontrols {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.levelcfg__resizeStatus {
  margin-top: 10px;
}


.levelcfg__gridtoolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  padding-bottom: 10px;
  position: relative;
  min-height: 44px;
}


/* Grid page zoom controls (center of toolbar) */
.levelcfg__zoom{
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  margin-left: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}


.levelcfg__zoomLabel{
  min-width: 56px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  opacity: 0.92;
}

.levelcfg__zoomBtn{
  padding: 6px 10px;
  min-height: 34px;
}

/* Auto-generate dropdown (grid page toolbar) — keep at the far right */
.levelcfg__gridtoolbar > .levelcfg__autodrop {
  margin-left: auto;
}

/* Grid toolbar: keep Auto Generate dropdown panel inside the viewport (no style reset) */
.levelcfg__gridtoolbar .levelcfg__autodrop__panel {
  left: auto;
  right: 0;
  max-width: min(520px, calc(100vw - 24px));
  box-sizing: border-box;
}
/* Auto-generate dropdown (grid page toolbar) */
.levelcfg__autodrop { position: relative; }
.levelcfg__autodrop > summary { list-style: none; }
.levelcfg__autodrop > summary::-webkit-details-marker { display: none; }
.levelcfg__autodrop > summary::marker { content: ""; }

.levelcfg__autodrop__summary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.levelcfg__autodrop__caret {
  opacity: 0.85;
  font-size: 12px;
  transition: transform 140ms ease;
}

.levelcfg__autodrop[open] .levelcfg__autodrop__caret { transform: rotate(180deg); }

.levelcfg__autodrop__panel {
  position: absolute;
  z-index: 20;
  left: 0;
  top: calc(100% + 6px);
  min-width: 220px;
  padding: 10px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(10,12,16,0.92);
  box-shadow: 0 16px 40px rgba(0,0,0,0.45);

  display: flex;
  flex-direction: column;
  gap: 10px;
}

.levelcfg__autodrop__row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.levelcfg__autodrop__meta {
  margin-left: auto;
  opacity: 0.9;
  font-variant-numeric: tabular-nums;
}

.levelcfg__autodrop__check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  user-select: none;
}

.levelcfg__autodrop__selectrow{
  display: flex;
  align-items: center;
  gap: 10px;
}

.levelcfg__autodrop__select{
  flex: 1;
  min-height: 34px;
  padding: 6px 10px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.14);

  /* Force readable closed-state on all browsers */
  background: rgba(10,12,16,0.92);
  color: #ffffff;
}

/* Auto Generate when mounted in the RIGHT sidebar */
.levelcfg__rightupper .levelcfg__autodrop {
  width: 100%;
}

.levelcfg__rightupper .levelcfg__autodrop__summary {
  width: 100%;
  justify-content: space-between;
}

/* Let the dropdown panel use the sidebar width */
.levelcfg__rightupper .levelcfg__autodrop__panel {
  left: 0;
  right: 0;
  width: 100%;
  min-width: 0;
}



.levelcfg__page[data-page="grid"] {
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.levelcfg__page[data-page="grid"] .levelcfg__gridpreview {
  flex: 0 0 auto;
  max-height: none;
}




.levelcfg__gridpreview {
  border-radius: 0;
  max-height: none;
}

.levelcfg__cell { border-radius: 0; }

/* Page buttons (used for Settings + any right-side nav buttons) */
.levelcfg__pagesnav {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* If this container is used on the RIGHT sidebar, add space below it so it
   doesn't touch the Entities group (or anything that follows). */
.levelcfg__rightnav {
  margin-top: 0;
  margin-bottom: 12px;
}

.levelcfg__pagebtn {
  display: flex;
  gap: 10px;
  align-items: center;
  text-align: left;

  /* Bigger button */
  min-height: 44px;
  padding: 12px 12px;

  /* Make sure it looks like a full-width “card button” */
  width: 100%;
  box-sizing: border-box;

  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.04);
  color: inherit;
  cursor: pointer;
}

.levelcfg__pagebtn:hover { border-color: rgba(255,255,255,0.26); }

.levelcfg__pagebtn__label {
  font-size: 14px;
  color: rgba(255,255,255,0.92);
}

/* Entities dropdown inside Pages */
.levelcfg__pagedrop > summary { list-style: none; }
.levelcfg__pagedrop > summary::-webkit-details-marker { display: none; }
.levelcfg__pagedrop > summary::marker { content: ""; }

.levelcfg__pagedrop__caret {
  margin-left: auto;
  opacity: 0.85;
  font-size: 12px;
  transition: transform 140ms ease;
}

.levelcfg__pagedrop[open] .levelcfg__pagedrop__caret { transform: rotate(180deg); }

.levelcfg__pagedrop__items {
  margin-left: 14px;
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.levelcfg__pagebtn.levelcfg__pagebtn--sub {
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(255,255,255,0.03);
}
.levelcfg__pagebtn.levelcfg__pagebtn--sub .levelcfg__pagebtn__label {
  font-size: 12px;
}

/* Render dropdown (right sidebar) */
.levelcfg__renderdrop__items {
  margin-left: 14px;
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.levelcfg__input--color {
  padding: 6px 8px;
  height: 44px;
}


/* Grid Text modal */
.levelcfg__modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(0,0,0,0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

.levelcfg__modal[hidden] { display: none; }

.levelcfg__modalcard {
  /* Default stays the same, but JS can override with --levelcfgModalW/H */
  width: var(--levelcfgModalW, min(980px, 96vw));
  height: var(--levelcfgModalH, auto);

  max-width: 96vw;
  max-height: 92vh;

  overflow: hidden;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.14);
  background: #0b0d14;
  display: flex;
  flex-direction: column;
}


.levelcfg__modalheader {
  padding: 12px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255,255,255,0.12);
}

.levelcfg__modaltitle {
  font-size: 14px;
  color: rgba(255,255,255,0.92);
}

.levelcfg__modalcard textarea.levelcfg__textarea {
  /* We size this textarea precisely from JS to match the grid */
  flex: 0 0 auto;
  width: auto;
  height: auto;
  min-height: 0;

  /* Remove “mystery gaps” */
  padding: 0;
  margin: 0;
  border: 0;
  border-radius: 0;
  box-sizing: content-box;

  /* Prevent wrapping and keep exact grid lines */
  white-space: pre;
  overflow: hidden;
  resize: none;

  /* Make rows/cols square via JS-controlled variables */
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: var(--gt_cell, 18px);
  line-height: var(--gt_cell, 18px);
  letter-spacing: var(--gt_ls, 0px);
}

/* ===================================================================== *
 * Neon container layer — Level editor
 * Applies the same glowing-glass container look as the rest of the app
 * (tokens defined in main.css :root). VISUAL ONLY: only border / background /
 * box-shadow / radius are set, so the editor's layout, sizing, splitters,
 * grid host, maze stage and play host are left exactly as they were.
 * ===================================================================== */
.levelcfg__header,
.levelcfg__filestate,
.levelcfg__rightupper,
.levelcfg__rightlower,
.levelcfg__renderdrop__body,
.levelcfg__setupbox,
.levelcfg__winEditor,
.levelcfg__group,
.levelcfg__gh-editor,
.levelcfg__gridpreview,
.levelcfg__readonly {
  border: 1px solid var(--edge-soft) !important;
  background: var(--surface) !important;
  border-radius: var(--ctn-radius) !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 0 0 1px rgba(61, 123, 255, 0.05),
    0 16px 44px -24px rgba(0, 0, 0, 0.85),
    0 0 28px -18px var(--neon) !important;
}

/* Hairline neon dividers on the editor's section heads */
.levelcfg__setupbox__title,
.levelcfg__winEditor__title,
.levelcfg__renderdrop__summary {
  border-bottom: 1px solid var(--edge-soft);
}

/* ===================================================================== *
 * Level editor — LEFT SIDEBAR redesign
 * Gradient panel + eyebrow header, grouped/labeled control buttons, and a
 * clean Brushes palette with neon active states (cyan view toggles, green
 * latched brush). Matches the global-config sidebar/Tips language.
 * ===================================================================== */
.levelcfg__left{
  border:1px solid var(--edge-soft);
  border-radius:16px;
  background:linear-gradient(180deg, rgba(255,255,255,.028), rgba(0,0,0,.20));
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.05),
    0 18px 48px -30px rgba(0,0,0,.95);
  padding:11px 10px;
}

/* Eyebrow header */
.levelcfg__lefthead{
  display:flex; align-items:center; gap:9px;
  padding:3px 6px 11px; margin-bottom:11px;
  border-bottom:1px solid var(--edge-soft);
}
.levelcfg__lefthead-dot{
  width:8px; height:8px; border-radius:50%;
  background:var(--neon); box-shadow:0 0 10px -1px var(--neon), 0 0 3px var(--neon);
}
.levelcfg__lefthead-title{
  font-size:11px; font-weight:800; letter-spacing:.16em; text-transform:uppercase;
  color:var(--text); opacity:.8;
}

/* Control bar: transparent, grouped + labeled (no glass box) */
.levelcfg__controlbar{
  display:flex; flex-direction:column; gap:12px;
  margin-bottom:12px; padding:0;
  border:0; background:transparent; box-shadow:none;
}
.levelcfg__ctrlgroup{ display:flex; flex-direction:column; gap:6px; }
.levelcfg__ctrllabel{
  font-size:10px; font-weight:800; letter-spacing:.12em; text-transform:uppercase;
  color:var(--muted); opacity:.75; padding-left:2px;
}
.levelcfg__controlrow{ display:flex; flex-wrap:wrap; gap:6px; align-items:center; }

/* Square neon icon buttons (control bar + view toggles) */
.levelcfg__controlbar .levelcfg__toptoolbtn,
.levelcfg__viewbar .levelcfg__toptoolbtn{
  min-width:38px; min-height:38px; width:38px; height:38px;
  padding:0; gap:0; align-items:center; justify-content:center;
  border-radius:9px; border:1px solid var(--edge-soft);
  background:rgba(0,0,0,.24); box-shadow:none;
  transition:background .12s ease, border-color .12s ease, box-shadow .12s ease;
}
.levelcfg__controlbar .levelcfg__toptoolbtn:hover,
.levelcfg__viewbar .levelcfg__toptoolbtn:hover{
  border-color:var(--neon); background:rgba(61, 123, 255,.08); box-shadow:0 0 12px -5px var(--neon);
}
.levelcfg__controlbar .toolbtn__icon,
.levelcfg__viewbar .toolbtn__icon{ font-size:15px; }

/* Brushes accordion */
.lcg{
  border:1px solid var(--edge-soft); border-radius:12px; padding:9px 10px;
  background:rgba(0,0,0,.14);
}
.lcg__summary{
  font-size:11px; font-weight:800; letter-spacing:.1em; text-transform:uppercase;
  color:var(--text); opacity:.85; padding:5px 4px;
}
.lcg__body{ gap:12px; margin-top:11px; }

/* View-mode toggle bar (mirror / grid / center) */
.levelcfg__viewbar{
  margin:0; padding:8px;
  border:1px solid var(--edge-soft); border-radius:10px;
  background:rgba(0,0,0,.20); box-shadow:none;
}
.levelcfg__viewbar .levelcfg__controlrow{ gap:6px; }
.levelcfg__viewbar .levelcfg__toptoolbtn{ width:auto; flex:1 1 0; min-width:42px; }
.levelcfg__viewbar .levelcfg__toptoolbtn[aria-pressed="true"]{
  border-color:var(--neon);
  background:rgba(61, 123, 255,.16);
  box-shadow:inset 0 0 0 1px rgba(61, 123, 255,.28);
  color:#eafcff;
}

/* Brush tile grid */
.levelcfg__toolgrid{ grid-template-columns:repeat(4, 1fr); gap:7px; justify-content:stretch; }
.levelcfg__toolgrid .levelcfg__toolbtn{
  min-height:44px; padding:6px; border-radius:9px;
  border:1px solid var(--edge-soft); background:rgba(0,0,0,.24);
  transition:background .12s ease, border-color .12s ease, box-shadow .12s ease;
}
.levelcfg__toolgrid .levelcfg__toolbtn:hover{
  border-color:var(--neon); background:rgba(61, 123, 255,.08); box-shadow:0 0 12px -6px var(--neon);
}
.levelcfg__toolgrid .levelcfg__toolbtn[aria-pressed="true"]{
  border-color:var(--neon-2);
  background:linear-gradient(180deg, rgba(255, 210, 63,.18), rgba(255, 210, 63,.05));
  box-shadow:0 0 13px -4px var(--neon-2), inset 0 0 0 1px rgba(255, 210, 63,.22);
}

/* Ghost House size selector + help inside the palette */
.lcg .levelcfg__row--stack .levelcfg__label{
  font-size:10.5px; font-weight:700; letter-spacing:.06em; text-transform:uppercase; color:var(--muted);
}
.lcg .levelcfg__help{ font-size:11.5px; line-height:1.5; color:var(--muted); opacity:.85; }

/* ===================================================================== *
 * Level editor — SETTINGS page redesign
 * A page header + gradient cards with neon section-header titles, matching
 * the global-config center pages.
 * ===================================================================== */
.levelcfg__page--cards[data-page="settings"]{ padding:18px; gap:14px; }

/* Full-width page header */
.levelcfg__pagehead{
  grid-column:1 / -1;
  margin:0 2px 2px;
  padding-bottom:14px;
  border-bottom:1px solid var(--edge-soft);
}
.levelcfg__pageeyebrow{
  font-size:10.5px; font-weight:800; letter-spacing:.14em; text-transform:uppercase;
  color:var(--link); opacity:.85; margin-bottom:6px;
}
.levelcfg__pagetitle{
  margin:0; font-size:20px; font-weight:800; line-height:1.15; letter-spacing:-.01em; color:#fff;
}
.levelcfg__pagedesc{
  margin-top:6px; font-size:12.5px; line-height:1.5; color:var(--muted); max-width:62ch;
}

/* Cards: gradient panel surface (override the forced "glass" layer) */
.levelcfg__page--cards[data-page="settings"] .levelcfg__group,
.levelcfg__page--cards[data-page="settings"] .levelcfg__winEditor{
  border:1px solid var(--edge-soft) !important;
  background:linear-gradient(180deg, rgba(255,255,255,.028), rgba(0,0,0,.20)) !important;
  border-radius:16px !important;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.05),
    0 18px 48px -30px rgba(0,0,0,.95) !important;
  padding:15px 17px 17px !important;
}

/* Card titles → neon section header with a hairline divider */
.levelcfg__page--cards[data-page="settings"] .levelcfg__group[data-card-title]::before,
.levelcfg__page--cards[data-page="settings"] .levelcfg__winEditor__title{
  display:block;
  font-size:11px; font-weight:800; letter-spacing:.08em; text-transform:uppercase;
  color:var(--link);
  margin:0 0 12px; padding-bottom:9px;
  border-bottom:1px solid var(--edge-soft);
}

/* Rows: compact aligned label | control */
.levelcfg__page--cards[data-page="settings"] .levelcfg__row,
.levelcfg__page--cards[data-page="settings"] .levelcfg__formrow{
  grid-template-columns:118px 1fr; gap:10px; padding:5px 0; align-items:center;
}
/* Let the control track shrink to its 1fr share. Without min-width:0 the grid
 * track's automatic minimum is floored by the neon-stepper's min-content, so
 * number steppers (e.g. Order, Size) overflow the card and clip the +/- button. */
.levelcfg__page--cards[data-page="settings"] .levelcfg__control{
  min-width:0;
}
.levelcfg__page--cards[data-page="settings"] .levelcfg__label{ font-size:12px; color:var(--muted); }
.levelcfg__page--cards[data-page="settings"] .levelcfg__help{
  grid-column:1 / -1; font-size:11.5px; line-height:1.5; color:var(--muted); opacity:.85; margin-top:2px;
}

/* Number steppers: left-align the value (so it lines up with the text fields'
 * values) and group the −/+ controls together on the right edge. */
.levelcfg__page--cards[data-page="settings"] .neon-stepper > input[type="number"]{
  order:-1;
  text-align:left;
  padding:8px 10px;
}
.levelcfg__page--cards[data-page="settings"] .neon-step--dec{
  border-left:1px solid var(--edge-soft);
  border-right:0;
}
.levelcfg__page--cards[data-page="settings"] .neon-step--inc{
  border-left:1px solid var(--edge-soft);
}

