/* noumenon shell — viewport-locked: the window never scrolls. */
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  background: var(--nm-bg);
  color: var(--nm-text);
  font-family: var(--nm-font);
}

/* header — brand + action cluster */
.app-header {
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  background: var(--nm-surface);
  border-bottom: 1px solid var(--nm-border);
}
.brand {
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.brand .ph {
  color: var(--nm-accent);
  font-size: 18px;
  align-self: center;
}
.brand-title {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.08em;
}
.brand-subtitle {
  font-size: 12px;
  color: var(--nm-muted);
  font-style: italic;
}
.spacer { flex: 1; }

/* icon-only action buttons (ui_and_styling.md minimal-elegant contract) */
.btn-icon {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  border-radius: var(--nm-radius-sm);
  color: var(--nm-text);
  font-size: 17px;
  cursor: pointer;
  padding: 0;
}
.btn-icon.btn-xs { width: 26px; height: 26px; font-size: 15px; }
.btn-icon:hover { background: rgba(var(--nm-accent-rgb), 0.14); }
.btn-icon:focus-visible { outline: 1px solid var(--nm-accent); }
.btn-icon:disabled { opacity: 0.35; cursor: default; }
.btn-icon:disabled:hover { background: none; }

/* layout: panel | stage */
.app-layout {
  flex: 1;
  min-height: 0;
  display: flex;
}
body[data-panel="closed"] .panel { display: none; }

/* control panel — hidden-scrollbar idiom */
.panel {
  flex: none;
  width: 268px;
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  background: var(--nm-surface);
  border-right: 1px solid var(--nm-border);
  padding: 14px;
}
.panel::-webkit-scrollbar { display: none; }

.ctl { margin-bottom: 14px; }
.ctl-label {
  display: block;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--nm-muted);
  margin-bottom: 5px;
}
.ctl-value {
  font-size: 12px;
  color: var(--nm-muted);
  min-width: 34px;
  text-align: right;
}

.stepper {
  display: flex;
  align-items: center;
  gap: 8px;
}
.step-value {
  min-width: 24px;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
}

/* segmented tiles — every option visible, the active one STICKY-highlighted
   (owner UI ruling 2026-08-06: no value-cycling toggle buttons in this app) */
.segment {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.seg-btn {
  background: none;
  border: 1px solid var(--nm-border);
  border-radius: var(--nm-radius-sm);
  color: var(--nm-muted);
  font-family: var(--nm-font);
  font-size: 12px;
  padding: 4px 10px;
  cursor: pointer;
  white-space: nowrap; /* tile names (A1-A2) never break mid-name */
}
.seg-btn:hover { border-color: var(--nm-accent); }
.seg-btn:focus-visible { outline: 1px solid var(--nm-accent); }
.seg-btn.is-active {
  color: var(--nm-accent);
  border-color: var(--nm-accent);
  background: rgba(var(--nm-accent-rgb), 0.12);
}
.segment.segment-xs .seg-btn { font-size: 11px; padding: 2px 7px; }

.slider-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.slider {
  flex: 1;
  accent-color: var(--nm-accent);
  min-width: 0;
}

.ctl-group-head {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 4px 0 6px;
}
.ctl-group-head .ctl-label { margin-bottom: 0; }

.plane-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 0;
}
.plane-on { accent-color: var(--nm-accent); margin: 0; }
.plane-label {
  font-size: 12px;
  min-width: 44px;
  color: var(--nm-text);
}
.plane-hint {
  font-size: 10px;
  min-width: 26px;
  color: var(--nm-muted);
}
.planes-subhead {
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--nm-muted);
  margin: 8px 0 3px;
}

.ctl-check .check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}
.check { accent-color: var(--nm-accent); margin: 0; }
.ctl-check-label { font-size: 12px; }

/* stage — the render surface */
.stage {
  flex: 1;
  min-width: 0;
  min-height: 0;
  position: relative;
}
.stage canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

/* grid divider hairlines — positions arrive as custom props from viewports.js */
.divider {
  position: absolute;
  background: var(--nm-border);
  pointer-events: none;
}
.divider.dv-v { left: var(--dv-pos); top: 0; bottom: 0; width: 1px; }
.divider.dv-h { top: var(--dv-pos); left: 0; right: 0; height: 1px; }

/* per-view config strips at each viewport's top edge (U7, custom-prop
   positioned): title + pair/mode/depth tiles, translucent over the canvas */
.view-strip {
  position: absolute;
  left: var(--vs-x, 14px);
  top: var(--vs-y, 10px);
  max-width: var(--vs-w, 40%);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  padding: 3px 6px;
  background: rgba(var(--nm-bg-rgb), 0.72);
  border-radius: var(--nm-radius-sm);
}
.view-title {
  font-size: 12px;
  color: var(--nm-muted);
  user-select: none;
}
.stage-add { position: absolute; top: 8px; right: 8px; }

/* footer — vendor credit first, then mono build facts (ui_and_styling.md) */
.app-footer {
  flex: none;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 5px 14px;
  background: var(--nm-surface);
  border-top: 1px solid var(--nm-border);
  font-size: 11px;
  color: var(--nm-muted);
}
.wb-credit {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--nm-text);
}
.wb-mark { width: 14px; height: 14px; }
.wb-dot { fill: var(--nm-accent); }
.foot-fact {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--nm-font-mono);
}
.foot-fact .ph { font-size: 12px; }
.foot-fact.nonprod { color: var(--nm-warning); }
