/* Asciiscope — Matrix glyph face (character cells, not sub-glyph pixels) */

/* Waterfall plate chrome: padding + pill/squircle rounding (no extra green frame). */
.node-asciiscope-face.node-matrix-waterfall-face {
  padding: var(--matrix-face-inset, 0px);
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.node-matrix-waterfall-face > .node-asciiscope-stage {
  border: 0;
  border-radius: var(--matrix-face-radius, 0px);
  corner-shape: var(--matrix-face-corner-shape, round);
  overflow: hidden;
}

.node-matrix-waterfall-face .node-asciiscope-canvas {
  border-radius: inherit;
  corner-shape: inherit;
}

/* Full-bleed matrix face — glyph table lives in Display Settings. */
.node-asciiscope-face {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: 4px;
  overflow: hidden;
  border: 1px solid rgba(40, 180, 70, 0.22);
  border-radius: 6px;
  background:
    linear-gradient(180deg, rgba(20, 80, 30, 0.12), transparent 40%),
    #020403;
  box-sizing: border-box;
}

.node-asciiscope-stage {
  position: relative;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border: 1px solid rgba(40, 180, 70, 0.28);
  border-radius: 4px;
  /* Letterbox bars when the grid aspect doesn't match the face. */
  background: #010201;
}

/* Fill the stage. Sharp/Pixel only change image-rendering, not geometry. */
.node-asciiscope-canvas {
  position: absolute;
  display: block;
  /* Always fill the stage — never lock a leftover px box (that left a
     black strip on the right after the first undersized layout tick). */
  inset: 0;
  width: 100% !important;
  height: 100% !important;
}

/* Display Settings: waterfall uses LED/waveform row chrome.
   Plate (Matrix Display) still uses these leftovers. */
.node-matrix-face-settings-panel {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  grid-column: 1 / -1;
}

.node-trace-display-settings-popover .node-matrix-face-settings-panel .node-matrix-face-gradient-section,
.node-trace-display-settings-popover .node-matrix-face-settings-panel .node-trace-display-gradient-section,
.node-trace-display-settings-popover .node-matrix-face-settings-panel .node-gradient-selector-host,
.node-trace-display-settings-popover .node-matrix-face-settings-panel .sge-host,
.node-trace-display-settings-popover .node-matrix-face-settings-panel .sge-root,
.node-trace-display-settings-popover .node-matrix-face-settings-panel .sge-presets {
  display: grid;
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  box-sizing: border-box;
  align-self: stretch;
  justify-self: stretch;
}

.node-trace-display-settings-popover .node-matrix-face-settings-panel .sge-presets {
  grid-template-columns: 1fr 1fr;
}

.node-trace-display-settings-popover .node-matrix-face-settings-panel .sge-root button.sge-preset {
  width: 100% !important;
  min-width: 0 !important;
  flex: 1 1 0 !important;
}

.node-matrix-face-settings-hint {
  margin: 0;
  padding: 3px 6px;
  color: var(--muted);
  font: inherit;
}

.node-matrix-face-glyph-table,
.node-matrix-face-message {
  width: 100%;
  min-height: 0;
  margin: 0;
  padding: 6px 8px;
  resize: vertical;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 0;
  background: #05090b;
  color: var(--text);
  font: 600 0.72rem/1.3 Consolas, "Courier New", monospace;
  white-space: pre;
  tab-size: 2;
  box-sizing: border-box;
}

.node-matrix-face-glyph-table {
  min-height: 10rem;
}

.node-matrix-face-message {
  min-height: 4.5rem;
  white-space: pre-wrap;
}

.node-matrix-face-glyph-table:focus,
.node-matrix-face-message:focus {
  outline: none;
}

.node-matrix-face-render-toggle {
  display: flex;
  flex-wrap: nowrap;
  gap: 4px;
  width: 100%;
}

.node-trace-display-settings-popover .metadata-popover-grid .node-matrix-face-tool,
.node-matrix-face-tool {
  flex: 1 1 auto;
  width: auto !important;
  min-height: var(--ds-row-h, 28px);
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: #05090b;
  color: var(--text);
  font: 650 0.66rem/1 inherit;
  cursor: var(--node-dot-cursor);
}

.node-matrix-face-tool.active,
.node-matrix-face-tool[aria-pressed="true"] {
  border-color: rgba(90, 255, 150, 0.62);
  background: rgba(90, 255, 150, 0.16);
  color: rgba(180, 255, 210, 0.95);
}

/* Fallback stack only if apply-layout has not written --node-module-stack-rows.
   LayoutA: header | io | face | params | lip. No reserved 0px face hole. */
.dsp-node.asciiscope-layout:not(.module-stack),
.dsp-node.matrix-waterfall-layout:not(.module-stack),
.dsp-node.matrix-plate-layout:not(.module-stack) {
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows:
    var(--node-header-height)
    minmax(var(--node-io-section-min-height), auto)
    var(--node-module-scope-height)
    auto
    var(--node-module-bottom-gap-track, minmax(2px, 1fr));
}

.dsp-node.asciiscope-layout:not(.module-stack) > .dsp-node-io-section,
.dsp-node.matrix-waterfall-layout:not(.module-stack) > .dsp-node-io-section,
.dsp-node.matrix-plate-layout:not(.module-stack) > .dsp-node-io-section {
  grid-row: 2;
}

.dsp-node.asciiscope-layout:not(.module-stack) > .node-asciiscope-face,
.dsp-node.matrix-waterfall-layout:not(.module-stack) > .node-asciiscope-face,
.dsp-node.matrix-plate-layout:not(.module-stack) > .node-asciiscope-face {
  grid-row: 3;
}

.dsp-node.asciiscope-layout > .node-asciiscope-face,
.dsp-node.matrix-waterfall-layout > .node-asciiscope-face,
.dsp-node.matrix-plate-layout > .node-asciiscope-face {
  grid-column: 1 / -1;
  align-self: stretch;
  justify-self: stretch;
  width: 100%;
  max-width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  pointer-events: auto;
}


