@font-face {
  font-family: "Perfect DOS VGA 437";
  src: url("../fonts/PerfectDOSVGA437.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --dos-font: "Perfect DOS VGA 437", "Courier New", monospace;
  --dos-green: #2ecc2e;
  --dos-green-bright: #55ee55;
  --dos-green-dim: #2daa2d;
  --dos-green-dark: #1a801a;
  --dos-bg: #000000;
  --aspect: 1.94;
  /** 参考 terminal-text-animator 的 Neon glow（强度约为初版 -20%） */
  --dos-text-glow: 0 0 1px currentColor, 0 0 3px currentColor, 0 0 8px currentColor;
  --dos-text-glow-soft: 0 0 2px currentColor, 0 0 6px currentColor;
}

@supports (color: color-mix(in srgb, white 50%, black)) {
  :root {
    --dos-text-glow: 0 0 1px currentColor, 0 0 3px currentColor, 0 0 8px color-mix(in srgb, currentColor 34%, transparent);
    --dos-text-glow-soft: 0 0 2px currentColor, 0 0 6px color-mix(in srgb, currentColor 22%, transparent);
  }
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  overflow: hidden;
  overscroll-behavior: none;
}

html,
body {
  width: 100%;
  margin: 0;
  padding: 0;
  background: #050505;
}

body.is-booting {
  background: #000;
}

body.is-booting #viewport-wrap {
  visibility: hidden;
}

.boot-intro {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  background: #000;
  pointer-events: none;
  overflow: hidden;
  overscroll-behavior: none;
  opacity: 1;
}

#boot-intro-wrap {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  width: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  overscroll-behavior: none;
}

#boot-intro-wrap.is-viewport-fit {
  height: var(--terminal-scaled-height);
  max-height: var(--terminal-scaled-height);
  overflow: hidden;
}

#boot-intro-wrap.is-scrollable {
  height: 100dvh;
  max-height: 100dvh;
  overflow-x: hidden;
  overflow-y: auto;
}

.boot-intro-shell {
  position: relative;
  overflow: hidden;
  background: var(--dos-bg);
  flex-shrink: 0;
  box-shadow: 0 0 48px rgba(36, 179, 36, 0.06);
  font-family: var(--dos-font);
}

.boot-intro-stage {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
}

.boot-intro-line {
  margin: 0;
  padding: 0;
  font-family: var(--dos-font);
  font-weight: 700;
  text-align: center;
  line-height: 1;
  text-shadow: var(--dos-text-glow);
  white-space: nowrap;
}

.boot-intro-stack {
  display: grid;
  grid-template-rows: auto auto;
  row-gap: 1.15em;
  justify-items: center;
  align-content: center;
  width: 100%;
  padding: 0 6px;
  box-sizing: border-box;
}

.boot-intro-title {
  width: 100%;
  padding: 0 6px;
  box-sizing: border-box;
  text-align: center;
}

.boot-intro-title[hidden],
.boot-intro-stack[hidden] {
  display: none !important;
}

html.is-viewport-fit,
body:not(.is-editor).is-viewport-fit {
  height: var(--terminal-scaled-height);
  max-height: var(--terminal-scaled-height);
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: none;
}

html.is-scrollable,
body:not(.is-editor).is-scrollable {
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
}

body:not(.is-editor) {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  font-family: var(--dos-font);
  color: var(--dos-green);
}

#viewport-wrap {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  width: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  overscroll-behavior: none;
}

#viewport-wrap.is-viewport-fit {
  height: var(--terminal-scaled-height);
  max-height: var(--terminal-scaled-height);
  overflow: hidden;
  touch-action: none;
}

#viewport-wrap.is-scrollable {
  height: 100dvh;
  max-height: 100dvh;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 768px) {
  html:not(:has(body.is-editor)),
  body:not(.is-editor) {
    position: fixed;
    inset: 0;
    width: 100%;
    overflow: hidden;
    overscroll-behavior: none;
    touch-action: none;
  }

  body:not(.is-editor) #viewport-wrap {
    overflow: hidden;
    overscroll-behavior: none;
    touch-action: none;
  }

  body:not(.is-editor) #viewport-wrap.is-scrollable {
    overflow: hidden;
    overflow-y: hidden;
  }

  body:not(.is-editor) .is-dialog-feed .text-content {
    touch-action: pan-y;
    -webkit-overflow-scrolling: touch;
  }
}

.terminal-scale-host {
  flex-shrink: 0;
  overflow: hidden;
}

body:not(.is-editor) #viewport-wrap > .terminal-scale-host {
  max-height: var(--terminal-scaled-height);
}

body:not(.is-editor).is-viewport-fit .is-dialog-feed .text-content {
  touch-action: pan-y;
}

#terminal-shell {
  position: relative;
  width: 390px;
  height: 697px;
  overflow: hidden;
  background: var(--dos-bg);
  flex-shrink: 0;
  box-shadow: 0 0 48px rgba(36, 179, 36, 0.06);
  font-family: var(--dos-font);
}

#terminal-shell .layout-block.text-block .text-content,
#terminal-shell .region-divider,
#terminal-shell .ascii-grid,
#terminal-shell .monster-grid .cell {
  font-family: var(--dos-font);
}

/* 运行时终端文字：轻微 CRT 发光（随各块文字颜色变化） */
body:not(.is-editor) #terminal-shell .layout-block.text-block .text-content,
body:not(.is-editor) #terminal-shell .layout-block.text-block .dialog-chunk,
body:not(.is-editor) #terminal-shell .layout-block.text-block .dialog-choice,
body:not(.is-editor) #terminal-shell .layout-block.text-block .dialog-choice-gap,
body:not(.is-editor) #terminal-shell .region-divider,
body:not(.is-editor) #terminal-shell .frame-label-text,
body:not(.is-editor) #terminal-shell .ascii-cell {
  text-shadow: var(--dos-text-glow);
}

/* 主对话区：关闭发光，方便阅读 */
body:not(.is-editor) #terminal-shell .layout-block.text-block.is-dialog-feed .text-content,
body:not(.is-editor) #terminal-shell .layout-block.text-block.is-dialog-feed .dialog-chunk,
body:not(.is-editor) #terminal-shell .layout-block.text-block.is-dialog-feed .dialog-choice,
body:not(.is-editor) #terminal-shell .layout-block.text-block.is-dialog-feed .dialog-choice-gap,
body:not(.is-editor) #terminal-shell .layout-block.text-block.is-dialog-feed .dialog-em,
body:not(.is-editor) #terminal-shell .layout-block.text-block.is-dialog-feed .dialog-text,
body:not(.is-editor) #terminal-shell .layout-block.text-block.is-dialog-feed .dialog-system,
body:not(.is-editor) #terminal-shell .layout-block.text-block.is-dialog-feed .dialog-topic-next,
body:not(.is-editor) #terminal-shell .layout-block.text-block.is-dialog-feed .dialog-topic-next-btn,
body:not(.is-editor) #terminal-shell .layout-block.text-block.is-dialog-feed .dialog-analyzing,
body:not(.is-editor) #terminal-shell .layout-block.text-block.is-dialog-feed .dialog-analyzing-text,
body:not(.is-editor) #terminal-shell .layout-block.text-block.is-dialog-feed .dialog-you-top-spacer {
  text-shadow: none;
}

#ascii-frame {
  position: absolute;
  top: 0;
  z-index: 2;
  pointer-events: none;
  overflow: hidden;
}

/* Mecha V8 underlay — bottom-most; text/buttons stay above via #page-content z-index:3 */
#mecha-frame-v8 {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 0;
  pointer-events: none;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

/* RESTORE ASCII: set USE_MECHA_FRAME_V8=false — this class is then removed */
#ascii-frame.is-mecha-hidden {
  visibility: hidden;
}

body.is-editor .mecha-y-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 4px 0 6px;
}
body.is-editor .mecha-y-row input[type="number"] {
  width: 72px;
}
body.is-editor .mecha-y-row button {
  cursor: pointer;
}

.ascii-grid {
  display: grid;
  font-family: var(--dos-font);
  font-size: var(--frame-font-size, 8px);
  line-height: 1;
  width: fit-content;
  column-gap: 0;
  row-gap: 0;
}

.ascii-cell {
  width: 100%;
  height: 1em;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  color: var(--dos-green-bright);
  font-weight: 700;
  margin: 0;
  padding: 0;
}

.ascii-cell.is-thick {
  color: var(--dos-green-bright);
  font-weight: 900;
  text-shadow: var(--dos-text-glow);
}

.ascii-cell.is-outer {
  color: var(--dos-green-bright);
  opacity: 1;
  font-weight: 700;
}

.ascii-cell.is-outer-left {
  justify-content: center;
}

.ascii-cell.is-outer-right {
  justify-content: center;
}

.ascii-grid.is-frame-active .is-editable-border-cell {
  cursor: pointer;
}

.ascii-grid.is-frame-active .is-editable-border-cell:hover {
  outline: 1px dashed rgba(255, 255, 255, 0.85);
  background: rgba(255, 255, 255, 0.08);
}

.ascii-grid.is-frame-active .is-editable-border-cell.is-cell-picked {
  outline: 2px solid #fff;
  background: rgba(255, 255, 255, 0.15);
}

.layout-block.text-block.is-frame-label {
  z-index: 25;
}

.layout-block.text-block.is-frame-label .text-content {
  font-weight: 700;
  font-family: var(--dos-font);
  letter-spacing: 0.06em;
}

.monster-grid .cell {
  opacity: 1;
}

.frame-label-text {
  position: absolute;
  left: 0;
  width: 100%;
  text-align: center;
  color: var(--dos-green-bright);
  font-family: var(--dos-font);
  pointer-events: none;
  letter-spacing: 0.05em;
}

#ascii-frame .frame-main .ascii-cell.is-thick {
  color: var(--dos-green-bright);
}

#ascii-frame .frame-main .ascii-cell.is-outer {
  color: var(--dos-green-bright);
  opacity: 1;
}

.monster-frame {
  position: absolute;
  margin: 0;
  left: 0;
  top: 0;
  pointer-events: none;
}

body.is-editor .monster-frame .ascii-grid.is-frame-active {
  pointer-events: none;
  z-index: 9;
}

/*
 * Border cells steal hits from main-page blocks when always clickable.
 * Only enable when the monster group is already selected (panel/body/border).
 */
body.is-editor #monster-panel.is-selected-monster-panel .monster-frame .ascii-grid .is-editable-border-cell,
body.is-editor .monster-frame .ascii-grid.is-frame-active .is-editable-border-cell {
  pointer-events: auto;
  cursor: pointer;
}

body.is-editor #ascii-frame .ascii-grid.is-frame-active {
  pointer-events: none;
}

body.is-editor #ascii-frame .ascii-grid.is-frame-active .is-editable-border-cell {
  pointer-events: auto;
  cursor: pointer;
}

.monster-frame .ascii-cell {
  color: var(--dos-green-bright);
}

#monster-panel {
  position: absolute;
  z-index: 1;
  pointer-events: none;
  overflow: visible;
}

body.is-editor #monster-grid.is-editable-monster-body {
  pointer-events: auto;
  z-index: 7;
  cursor: move;
  outline: 1px dashed rgba(255, 255, 255, 0.72);
}

body.is-editor #monster-grid.is-editable-monster-body.is-selected {
  outline: 2px solid rgba(255, 255, 255, 0.95);
}

body.is-editor #monster-grid.is-editable-monster-body.is-dragging {
  outline-color: rgba(255, 255, 255, 1);
}

.monster-grid {
  position: absolute;
  display: grid;
  pointer-events: none;
  font-family: var(--dos-font);
}

.monster-grid .cell {
  width: 1em;
  height: 1em;
  line-height: 1;
  text-align: center;
  font-family: var(--dos-font);
  text-shadow: none;
}

body:not(.is-editor) #monster-grid.is-tornado-intro {
  display: block;
  perspective: 340px;
  perspective-origin: 50% 42%;
  transform-style: preserve-3d;
  overflow: visible;
}

body:not(.is-editor) #monster-grid.is-tornado-intro .tornado-cell {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 1em;
  height: 1em;
  margin-left: -0.5em;
  margin-top: -0.5em;
  transform-style: preserve-3d;
  will-change: transform, opacity;
  text-shadow: none;
}

body:not(.is-editor) #monster-grid.is-tornado-intro.is-output-hopping {
  animation: none;
}

body:not(.is-editor) #monster-grid.is-tornado-intro.is-tornado-morph .tornado-cell {
  text-shadow: 0 0 3px rgba(85, 238, 85, 0.28);
}

@keyframes monster-hop {
  0%, 100% { transform: translateY(0) scaleX(1) scaleY(1); }
  25%      { transform: translateY(0) scaleX(1.14) scaleY(0.8); }
  50%      { transform: translateY(-3px) scaleX(0.98) scaleY(1.02); }
  75%      { transform: translateY(0) scaleX(1.12) scaleY(0.84); }
}

body:not(.is-editor) #monster-grid.is-output-hopping {
  animation: monster-hop 0.65s ease-in-out infinite;
  transform-origin: center bottom;
}

#page-content {
  position: absolute;
  inset: 0;
  z-index: 3;
  overflow: visible;
}

body.is-editor #page-content {
  overflow: visible;
  cursor: default;
}

.region-divider {
  position: absolute;
  left: 0;
  height: 12px;
  pointer-events: none;
  font-family: var(--dos-font);
  font-size: var(--frame-font-size, 9px);
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  font-weight: 700;
}

.layout-block.text-block.is-input-box {
  pointer-events: auto;
}

body.is-editor .layout-block.text-block.is-input-box {
  pointer-events: auto;
}

.layout-block.text-block.is-input-box .text-content {
  font-weight: 400;
}

.layout-block.text-block.is-input-box .input-box-prompt {
  flex: 0 0 auto;
  font-weight: 700;
  color: var(--dos-green-bright, #55ee55);
  animation: input-prompt-blink 1s step-end infinite;
}

@keyframes input-prompt-blink {
  0%,
  49% {
    opacity: 1;
  }

  50%,
  100% {
    opacity: 0;
  }
}

.layout-block.text-block.is-input-box .input-box-text,
.layout-block.text-block.is-input-box .input-box-field {
  flex: 1;
  min-width: 0;
  font: inherit;
  color: inherit;
  background: transparent;
  border: none;
  outline: none;
  padding: 0;
  margin: 0;
  line-height: inherit;
}

.layout-block.text-block.is-input-box .text-content.is-command-typing .input-box-prompt {
  animation: none !important;
  opacity: 1 !important;
}

.layout-block.text-block.is-input-box .text-content.is-command-typing {
  align-items: flex-start;
}

.layout-block.text-block.is-input-box .input-box-viewport {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.layout-block.text-block.is-input-box .input-box-inner {
  white-space: pre-wrap;
  word-break: break-word;
  line-height: inherit;
}

.layout-block.text-block.is-input-box .input-box-text:not(.is-typing) {
  color: var(--input-placeholder-color, inherit);
}

.layout-block.text-block.is-input-box .input-box-text.is-typing {
  display: inline;
}

.layout-block.text-block.is-input-box .input-box-cursor {
  display: inline;
  font-weight: 700;
  animation: none;
}

.layout-block.text-block.is-input-box .input-box-field::placeholder {
  color: inherit;
  opacity: 0.92;
}

body.is-editor .layout-block.text-block.is-input-box .input-box-field {
  pointer-events: none;
}

body:not(.is-editor) .layout-block.text-block.is-input-box {
  cursor: pointer;
}

/* Popup overlay runtime */
.popup-overlay-root {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 12px;
  padding-top: max(12px, 6vh);
}

.popup-overlay-root[hidden] {
  display: none !important;
}

.popup-overlay-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.42);
}

.popup-shell {
  position: relative;
  z-index: 1;
  overflow: visible;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.65);
  flex-shrink: 0;
}

.popup-ascii-frame {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
}

body.is-editor #popup-editor-ascii-frame,
body.is-editor #popup-editor-inner-frame {
  inset: auto;
}

body.is-editor .popup-ascii-frame.is-editable-popup-frame {
  pointer-events: none;
}

body.is-editor .popup-ascii-frame.is-editable-popup-frame .ascii-cell {
  pointer-events: auto;
}

.popup-inner-frame {
  position: absolute;
  z-index: 3;
  pointer-events: none;
  box-sizing: border-box;
}

body.is-editor .popup-inner-frame.is-editable-popup-frame {
  pointer-events: none;
}

body.is-editor .popup-page-content .layout-block {
  position: absolute;
  z-index: 6;
}

.popup-frame-edge-hits {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
}

.popup-frame-edge {
  position: absolute;
  pointer-events: auto;
}

.popup-frame-edge-top {
  top: 0;
  left: 0;
  right: 0;
  height: 8px;
  cursor: move;
}

.popup-frame-edge-bottom {
  bottom: 0;
  left: 0;
  right: 0;
  height: 8px;
  cursor: move;
}

.popup-frame-edge-left {
  top: 0;
  bottom: 0;
  left: 0;
  width: 8px;
  cursor: move;
}

.popup-frame-edge-right {
  top: 0;
  bottom: 0;
  right: 0;
  width: 8px;
  cursor: move;
}

.popup-page-content {
  position: absolute;
  z-index: 4;
  overflow: visible;
}

body:not(.is-editor) .popup-overlay-root .popup-page-content {
  pointer-events: none;
}

.popup-page-content .layout-block.text-block.is-menu-button,
.popup-page-content .layout-block.text-block.is-popup-close,
body:not(.is-editor) .popup-overlay-root .layout-block.text-block.is-menu-button,
body:not(.is-editor) .popup-overlay-root .layout-block.text-block.is-popup-close,
body:not(.is-editor) .popup-overlay-root .layout-block.text-block.is-clickable-block,
body:not(.is-editor) .popup-overlay-root .popup-page-content .layout-block.text-block {
  pointer-events: auto !important;
}

body.is-editor .popup-page-content {
  pointer-events: none;
}

body.is-editor .popup-page-content .layout-block.text-block.is-menu-button,
body.is-editor .popup-page-content .layout-block.text-block.is-popup-close,
body.is-editor .popup-page-content .layout-block.text-block {
  pointer-events: auto !important;
}

body.is-editor .is-editable-popup-frame {
  pointer-events: auto;
  outline: 1px dashed rgba(255, 255, 255, 0.65);
}

body.is-editor .is-editable-popup-frame.is-selected {
  outline: 2px solid rgba(255, 255, 255, 0.95);
  z-index: 4;
}

body.is-editor #popup-terminal-shell.is-editable-popup-shell {
  position: relative;
}

body.is-editor #popup-terminal-shell.is-editable-popup-shell.is-selected {
  outline: 2px solid rgba(96, 176, 255, 0.95);
  outline-offset: 0;
  z-index: 1;
}

.popup-shell-edge-hits {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}

.popup-shell-edge {
  pointer-events: auto;
}

.popup-shell-handles {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 5;
}

.popup-frame-handles {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.popup-frame-handle {
  position: absolute;
  right: -7px;
  bottom: -7px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid #333;
  pointer-events: auto;
  cursor: nwse-resize;
}

/* Menu button unit */
.layout-block.is-menu-button,
.layout-block.is-popup-close {
  pointer-events: auto;
  overflow: visible;
}

.layout-block.is-menu-button .menu-button-content,
.layout-block.is-popup-close .popup-close-content {
  width: 100%;
  height: 100%;
  padding: 0;
  background: transparent;
  border: none;
}

/* Command Center (popup page 1) */
.layout-block.is-pixel-icon {
  overflow: hidden;
  pointer-events: none;
}
.layout-block.is-pixel-icon .pixel-icon-host,
.layout-block.is-pixel-icon .pixel-icon-grid {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
.layout-block.is-pixel-icon .pixel-icon-cell {
  display: block;
  width: 1em;
  height: 1em;
  line-height: 1;
  text-align: center;
  overflow: hidden;
}
.layout-block.is-scan-led {
  overflow: hidden;
  /* Keep above nearby text so the LED stays visible after move/sync */
  z-index: 12;
  pointer-events: none;
}
.layout-block.is-scan-led .scan-led-host,
.layout-block.is-scan-led .scan-led-canvas {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
/* Editor: always interactive so move/resize does not require a prior list-select race */
body.is-editor .layout-block.text-block.is-scan-led {
  pointer-events: auto;
}
.popup-page-content .layout-block.is-suggest-question .text-content {
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  padding: 4px 8px;
  border: 1px solid rgba(85, 238, 85, 0.75);
  background: rgba(8, 20, 40, 0.55);
  color: inherit;
  line-height: 1.15;
}
.popup-page-content .layout-block.is-cmd-section .text-content {
  letter-spacing: 0.04em;
  opacity: 0.95;
}
.popup-page-content .layout-block.is-cmd-desc .text-content {
  opacity: 0.78;
  white-space: normal;
  line-height: 1.25;
}
.popup-page-content .layout-block.is-cmd-footer .text-content {
  opacity: 0.7;
  letter-spacing: 0.02em;
}

/* Prediction popup */
.layout-block.is-pred-signals .text-content,
.pred-signals-box {
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  border: 1px solid rgba(85, 238, 85, 0.75);
  background: rgba(8, 20, 40, 0.55);
  padding: 0;
  display: block;
  overflow: hidden;
  position: relative;
  cursor: grab;
  user-select: none;
}
.pred-signal-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  font-family: var(--dos-font);
  line-height: 1.15;
}
.flash-card-viewport {
  position: relative;
  overflow: hidden;
}
.flash-card-face {
  box-sizing: border-box;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 3px;
  padding: 7px 12px;
  will-change: transform;
}
.flash-card-face.is-current {
  position: absolute;
  transform: translateX(0);
}
.pred-signal-k {
  color: inherit;
  opacity: 0.85;
  font-size: 11px;
  letter-spacing: 0.03em;
  flex: 0 1 auto;
}
.pred-signal-v {
  color: inherit;
  font-size: 12px;
  text-align: right;
  flex: 1 1 auto;
}
.pred-signal-v.is-muted {
  color: #e8e8e8;
  opacity: 1;
}
.pred-signal-v.is-green {
  color: #55ee55;
  opacity: 1;
}
.pred-signal-v.is-red,
.pred-signal-v.is-warn {
  color: #ff4d4d;
  opacity: 1;
}
.layout-block.is-pred-new-chat .text-content {
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  border: 1px solid rgba(85, 238, 85, 0.75);
  background: rgba(8, 20, 40, 0.55);
}
.pred-newchat-label {
  color: #c9a0ff;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.ask-newchat-lock {
  display: inline-block;
  font-size: 1em;
  line-height: 1;
  transform: scale(0.85);
  transform-origin: center center;
  flex: 0 0 auto;
}

.menu-button-text .brief-lock-emoji {
  display: inline-block;
  font-size: 0.8em;
  line-height: 1;
  transform-origin: center center;
  vertical-align: -0.05em;
}
.layout-block.is-pred-return {
  cursor: pointer;
}
.layout-block.is-open-prediction {
  cursor: pointer;
}
.panel-pred-question[hidden] {
  display: none !important;
}

/* Section dividers — must beat layout-engine inline transparent bg */
.tw-rule-line,
.oc-rule-line,
.pred-rule-line,
.news-rule-line,
.topic-section-rule,
.layout-block.is-pred-rule .text-content,
.layout-block.is-tw-rule .text-content,
.layout-block.is-oc-rule .text-content,
.layout-block.is-news-rule .text-content {
  box-sizing: border-box !important;
  display: block !important;
  width: 100% !important;
  height: 1px !important;
  min-height: 1px !important;
  margin: 6px 0 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: rgba(45, 95, 65, 0.55) !important;
  background-color: rgba(45, 95, 65, 0.55) !important;
  opacity: 1 !important;
  color: transparent !important;
  overflow: hidden !important;
}
.tw-list-box {
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  border: 1px solid rgba(85, 238, 85, 0.75);
  background: rgba(8, 20, 40, 0.55);
  padding: 4px 6px 4px 8px;
  display: block;
  overflow: hidden;
  position: relative;
  cursor: grab;
  user-select: none;
}
.tw-list-plain {
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 2px;
  padding: 2px 0;
}
.tw-card-title {
  color: #c2c2c2;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.15;
  margin-bottom: 2px;
  flex: 0 0 auto;
}
.tw-card-title.is-news-sentiment {
  color: #ffa200;
  letter-spacing: 0.06em;
}
.tw-card-title.is-top-headline {
  color: #55ee55;
  letter-spacing: 0.06em;
}
.tw-list-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  font-family: var(--dos-font);
  line-height: 1.08;
  font-size: 12px;
  min-width: 0;
  width: 100%;
  overflow: hidden;
}
.tw-list-row.is-hero {
  margin: 4px 0 6px;
  overflow: visible;
}
.tw-list-row.is-hero .tw-list-left {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.05;
  white-space: nowrap;
  overflow: visible;
  text-overflow: clip;
}
.tw-list-row.is-hero.is-tone-bullish .tw-list-left {
  color: #3dff6a;
}
.tw-list-row.is-hero.is-tone-bearish .tw-list-left {
  color: #ff5a5a;
}
.tw-list-row.is-hero.is-tone-neutral .tw-list-left {
  color: #f0f0f0;
}
.tw-list-row.is-subhead .tw-list-left {
  color: #c2c2c2;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  margin-top: 2px;
}
.tw-list-left {
  color: inherit;
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tw-list-right {
  color: inherit;
  flex: 1 1 52%;
  min-width: 0;
  max-width: 58%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
  text-align: right;
}
.tw-list-row.is-full .tw-list-left {
  flex: 1 1 auto;
  max-width: 100%;
}
.tw-list-row.is-full .tw-list-right {
  display: none;
}
.layout-block.is-tw-new-chat .text-content {
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  border: 1px solid rgba(85, 238, 85, 0.75);
  background: rgba(8, 20, 40, 0.55);
}
.tw-newchat-label {
  color: #c9a0ff;
  font-weight: 700;
  letter-spacing: 0.04em;
}
/* Onchain & Exchange popup */
.oc-list-box {
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  border: 1px solid rgba(85, 238, 85, 0.75);
  background: rgba(8, 20, 40, 0.55);
  padding: 0;
  display: block;
  overflow: hidden;
  position: relative;
  cursor: grab;
  user-select: none;
}
.oc-list-plain {
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 2px;
}
.oc-card-title {
  color: #c2c2c2;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.15;
  margin-bottom: 2px;
  flex: 0 0 auto;
}
.oc-list-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  font-family: var(--dos-font);
  line-height: 1.08;
}
.is-flash-swipe {
  cursor: grab;
  touch-action: pan-y;
  user-select: none;
}
.oc-list-left {
  color: inherit;
  opacity: 0.88;
  font-size: 11px;
  letter-spacing: 0.02em;
  flex: 0 1 auto;
}
.oc-list-right {
  font-size: 11px;
  text-align: right;
  flex: 1 1 auto;
  color: #55ee55;
}
.oc-list-right.is-bull {
  color: #55ee55;
}
.oc-list-right.is-bear {
  color: #ff6b4a;
}
.oc-list-right.is-neutral {
  color: #55ee55;
}
.layout-block.is-oc-new-chat .text-content {
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  border: 1px solid rgba(201, 160, 255, 0.7);
  padding: 0 8px;
}
.oc-newchat-label {
  color: #c9a0ff;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.layout-block.is-oc-return {
  cursor: pointer;
  opacity: 0.9;
}
.layout-block.is-oc-return:hover {
  opacity: 1;
}
.layout-block.is-tw-return {
  cursor: pointer;
}
.layout-block.is-open-twitter {
  cursor: pointer;
}
.layout-block.is-news-new-chat .text-content {
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  border: 1px solid rgba(85, 238, 85, 0.75);
  background: rgba(8, 20, 40, 0.55);
}
.news-newchat-label {
  color: #c9a0ff;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.layout-block.is-news-return {
  cursor: pointer;
}
.layout-block.is-open-news {
  cursor: pointer;
}
.panel-tw-question[hidden] {
  display: none !important;
}
.panel-oc-question[hidden] {
  display: none !important;
}
.panel-news-question[hidden] {
  display: none !important;
}

.menu-button-unit {
  position: relative;
  width: 100%;
  height: 100%;
}

.menu-button-shadow-wrap {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.menu-button-shadow-bottom,
.menu-button-shadow-right {
  position: absolute;
  pointer-events: none;
  overflow: hidden;
  color: rgba(148, 148, 148, 0.95);
  font-family: var(--dos-font);
}

.menu-button-shadow-row {
  white-space: pre;
  line-height: 1;
  height: 1em;
  letter-spacing: 0;
}

.menu-button-shadow-bottom {
  left: 5px;
  top: 100%;
}

.menu-button-shadow-right {
  left: 100%;
  top: 5px;
}

body.is-editor .menu-button-shadow-bottom.is-shadow-editable,
body.is-editor .menu-button-shadow-right.is-shadow-editable {
  pointer-events: auto;
  outline: 1px dashed rgba(255, 255, 255, 0.45);
}

body.is-editor .menu-button-shadow-bottom.is-shadow-active,
body.is-editor .menu-button-shadow-right.is-shadow-active {
  outline: 1px solid rgba(255, 255, 255, 0.9);
  z-index: 2;
}

.menu-shadow-handle {
  position: absolute;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid #333;
  pointer-events: auto;
  z-index: 3;
}

.menu-shadow-handle-east {
  right: -6px;
  top: 50%;
  transform: translateY(-50%);
  cursor: ew-resize;
}

.menu-shadow-handle-south {
  left: 50%;
  bottom: -6px;
  transform: translateX(-50%);
  cursor: ns-resize;
}

.menu-button-frame {
  position: relative;
  z-index: 1;
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  padding: 2px 8px;
  background: #9a9a9a;
  border: 1px dashed rgba(235, 235, 235, 0.95);
  display: flex;
  align-items: center;
  transition: transform 0.14s cubic-bezier(0.34, 1.45, 0.64, 1);
  pointer-events: auto;
  cursor: pointer;
}

.menu-button-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 700;
  letter-spacing: 0.02em;
  font-family: var(--dos-font), "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
}

body:not(.is-editor) .layout-block.is-menu-button {
  cursor: pointer;
}

body:not(.is-editor) .layout-block.is-menu-button.is-pressing .menu-button-frame {
  transform: translate(3.5px, 3.5px);
}

@keyframes menu-btn-soft-blink {
  0%, 100% { filter: brightness(1.35); }
  50% { filter: brightness(0.45); }
}

body:not(.is-editor) .layout-block.is-menu-button.is-soft-blink .menu-button-frame {
  animation: menu-btn-soft-blink 2.2s ease-in-out infinite;
}

body.is-editor .layout-block[data-id$="-emoji-4h-brief"] {
  z-index: 8;
  cursor: move;
}

body:not(.is-editor) .layout-block[data-id$="-emoji-4h-brief"] {
  display: none;
  pointer-events: none;
}

.popup-close-frame {
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #ffffff;
  background: transparent;
  font-weight: 700;
}

body:not(.is-editor) .layout-block.is-popup-close {
  cursor: pointer;
}

body:not(.is-editor) .layout-block.is-popup-close.is-pressed .popup-close-frame {
  transform: translate(0.7px, 0.7px);
  opacity: 0.85;
}

/* Editor dual canvas */
.editor-canvas-row {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 28px;
  width: max-content;
  min-width: 100%;
  padding: 0 12px 8px;
}

.editor-canvas-host {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.editor-canvas-label {
  font-size: 12px;
  color: #8fd48f;
  font-family: inherit;
  letter-spacing: 0.04em;
}

#popup-terminal-shell {
  box-shadow: 0 0 0 1px rgba(85, 238, 85, 0.35);
  flex-shrink: 0;
  position: relative;
  font-family: var(--dos-font);
  overflow: visible;
}

#editor-preview-scroller {
  overflow-x: auto;
  overflow-y: auto;
}

#editor-preview-scroller .editor-canvas-row {
  margin: 0 auto;
}

.layout-block {
  position: absolute;
  z-index: 4;
  touch-action: none;
  user-select: none;
}

.layout-block.text-block {
  overflow: visible;
  pointer-events: none;
}

.layout-block.text-block.is-menu-button,
.layout-block.text-block.is-popup-close,
.layout-block.text-block.is-input-box {
  pointer-events: auto;
}

.layout-block.text-block .text-content {
  width: 100%;
  min-height: 100%;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: var(--dos-font);
  color: var(--dos-green);
  line-height: 1;
}

.layout-block.text-block.is-dialog-feed {
  overflow: hidden;
  pointer-events: auto;
}

.layout-block.text-block.is-dialog-feed .text-content {
  height: 100%;
  max-height: 100%;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overflow-anchor: none;
  pointer-events: auto;
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 0, 0, 0.55) transparent;
}

body:not(.is-editor) .layout-block.text-block.is-dialog-feed .text-content {
  background-color: #020c02;
  background-image: repeating-linear-gradient(
    180deg,
    #031003 0px,
    #031003 3px,
    #061806 3px,
    #061806 4px
  );
}

body:not(.is-editor) [data-id="block-frame-label"] .text-content,
body:not(.is-editor) [data-id="block-energy-bar"] .text-content,
body:not(.is-editor) #monster-grid:not(.is-output-hopping):not(.is-tornado-intro) {
  animation: dos-phosphor-flicker 0.14s steps(1) infinite;
}

@keyframes dos-phosphor-flicker {
  0%,
  100% {
    opacity: 1;
  }

  6% {
    opacity: 0.94;
  }

  12% {
    opacity: 1;
  }

  48% {
    opacity: 1;
  }

  52% {
    opacity: 0.91;
  }

  56% {
    opacity: 0.97;
  }

  60% {
    opacity: 1;
  }

  88% {
    opacity: 1;
  }

  91% {
    opacity: 0.95;
  }
}

.layout-block.text-block.is-dialog-feed .dialog-you-top-spacer {
  display: block;
  width: 100%;
  pointer-events: none;
}

.layout-block.text-block.is-dialog-feed .dialog-analyzing {
  display: inline-flex;
  align-items: flex-start;
  gap: 0.35em;
  max-width: 100%;
  white-space: normal;
  color: #a3a3a3;
  font-size: 16px;
  line-height: 1.15;
}

.layout-block.text-block.is-dialog-feed .dialog-analyzing-text {
  display: inline;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
  flex: 1;
  min-width: 0;
}

.layout-block.text-block.is-dialog-feed .dialog-analyzing-spinner {
  display: inline-block;
  flex: 0 0 auto;
  min-width: 1ch;
  font-size: 16px;
  line-height: 1.15;
}

.layout-block.text-block.is-dialog-feed .dos-cursor {
  animation: none;
  text-shadow: var(--dos-text-glow);
}

.layout-block.text-block.is-dialog-feed .dialog-chunks {
  display: block;
  white-space: pre-wrap;
  word-break: break-word;
}

.layout-block.text-block.is-dialog-feed .dialog-chunk {
  white-space: pre-wrap;
  word-break: break-word;
}

.layout-block.text-block.is-dialog-feed .dialog-em {
  color: #ffffff;
  font-weight: 400;
}

.layout-block.text-block.is-dialog-feed .dialog-tone-bull {
  color: #55ee55;
  font-weight: 700;
}

.layout-block.text-block.is-dialog-feed .dialog-tone-bear {
  color: #ff5a5a;
  font-weight: 700;
}

.layout-block.text-block.is-dialog-feed .dialog-tone-dim {
  color: #a3a3a3;
  font-weight: 400;
}

.layout-block.text-block.is-dialog-feed .dialog-delta-table {
  display: block;
  text-align: center;
  opacity: 0;
  white-space: pre-wrap;
  margin: 0.85em 0; /* blank line before + after */
  position: relative;
  overflow: hidden;
}

/* Delta boot (~2s): laser reveal (scan prints text) + invert flicker */
@keyframes delta-crt-reveal {
  0% { clip-path: inset(0 0 100% 0); }
  100% { clip-path: inset(0 0 0% 0); }
}

@keyframes delta-crt-scan {
  0% { top: 0%; opacity: 0.95; }
  100% { top: 100%; opacity: 0.35; }
}

@keyframes delta-crt-load {
  0% { opacity: 0; filter: none; }
  2% { opacity: 1; filter: invert(1) contrast(1.3); }
  4% { opacity: 0.35; filter: none; }
  6% { opacity: 1; filter: invert(1) hue-rotate(40deg); }
  8% { opacity: 1; filter: none; }
  10% { opacity: 0.2; filter: none; }
  12% { opacity: 1; filter: invert(1) contrast(1.3); }
  14% { opacity: 0.4; filter: none; }
  16% { opacity: 1; filter: invert(1) hue-rotate(40deg); }
  18% { opacity: 1; filter: none; }
  20% { opacity: 0.15; filter: none; }
  22% { opacity: 1; filter: invert(1) contrast(1.35); }
  24% { opacity: 0.45; filter: none; }
  26% { opacity: 1; filter: invert(1) hue-rotate(40deg); }
  28% { opacity: 1; filter: none; }
  30% { opacity: 0.12; filter: none; }
  32% { opacity: 1; filter: invert(1) contrast(1.3); }
  34% { opacity: 0.35; filter: none; }
  36% { opacity: 1; filter: invert(1) hue-rotate(40deg); }
  38% { opacity: 1; filter: none; }
  40% { opacity: 0.18; filter: none; }
  42% { opacity: 1; filter: invert(1) contrast(1.3); }
  44% { opacity: 0.4; filter: none; }
  46% { opacity: 1; filter: invert(1) hue-rotate(40deg); }
  48% { opacity: 1; filter: none; }
  50% { opacity: 0.1; filter: none; }
  52% { opacity: 1; filter: invert(1) contrast(1.35); }
  54% { opacity: 0.38; filter: none; }
  56% { opacity: 1; filter: invert(1) hue-rotate(40deg); }
  58% { opacity: 1; filter: none; }
  60% { opacity: 0.16; filter: none; }
  62% { opacity: 1; filter: invert(1) contrast(1.3); }
  64% { opacity: 0.42; filter: none; }
  66% { opacity: 1; filter: invert(1) hue-rotate(40deg); }
  68% { opacity: 1; filter: none; }
  70% { opacity: 0.14; filter: none; }
  72% { opacity: 1; filter: invert(1) contrast(1.3); }
  74% { opacity: 0.36; filter: none; }
  76% { opacity: 1; filter: invert(1) hue-rotate(40deg); }
  78% { opacity: 1; filter: none; }
  80% { opacity: 0.2; filter: none; }
  82% { opacity: 1; filter: invert(1) contrast(1.3); }
  84% { opacity: 0.45; filter: none; }
  86% { opacity: 1; filter: invert(1) hue-rotate(40deg); }
  88% { opacity: 1; filter: none; }
  90% { opacity: 0.25; filter: none; }
  92% { opacity: 1; filter: invert(1) contrast(1.25); }
  94% { opacity: 0.55; filter: none; }
  96% { opacity: 1; filter: invert(1) hue-rotate(40deg); }
  98% { opacity: 1; filter: none; }
  100% { opacity: 1; filter: none; }
}

.layout-block.text-block.is-dialog-feed .dialog-delta-table.is-crt-loading {
  animation: delta-crt-load 2s steps(1, end) forwards;
}

.layout-block.text-block.is-dialog-feed .dialog-delta-table.is-crt-loading .dialog-delta-table-inner {
  animation: delta-crt-reveal 2s linear forwards;
  will-change: clip-path;
}

.layout-block.text-block.is-dialog-feed .dialog-delta-table.is-crt-loading::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  height: 14%;
  top: 0;
  z-index: 3;
  pointer-events: none;
  transform: translateY(-50%);
  background: linear-gradient(
    to bottom,
    transparent 0%,
    rgba(180, 255, 180, 0.14) 30%,
    rgba(230, 255, 230, 0.7) 50%,
    rgba(180, 255, 180, 0.14) 70%,
    transparent 100%
  );
  box-shadow: 0 0 10px rgba(180, 255, 180, 0.35);
  mix-blend-mode: screen;
  animation: delta-crt-scan 2s linear forwards;
}

.layout-block.text-block.is-dialog-feed .dialog-delta-table.is-in {
  opacity: 1;
  filter: none;
}

.layout-block.text-block.is-dialog-feed .dialog-delta-table.is-in .dialog-delta-table-inner {
  clip-path: none;
  animation: none;
}

.layout-block.text-block.is-dialog-feed .dialog-delta-table.is-in::after {
  content: none;
  animation: none;
}

/* Glow only on the delta cabin table — ~30% softer than global neon (less blur) */
body:not(.is-editor) #terminal-shell .layout-block.text-block.is-dialog-feed .dialog-delta-table,
body:not(.is-editor) #terminal-shell .layout-block.text-block.is-dialog-feed .dialog-delta-table .delta-line,
body:not(.is-editor) #terminal-shell .layout-block.text-block.is-dialog-feed .dialog-delta-table .delta-scroll,
body:not(.is-editor) #terminal-shell .layout-block.text-block.is-dialog-feed .dialog-delta-table .delta-scroll-inner,
body:not(.is-editor) #terminal-shell .layout-block.text-block.is-dialog-feed .dialog-delta-table .dialog-delta-title,
body:not(.is-editor) #terminal-shell .layout-block.text-block.is-dialog-feed .dialog-delta-table .dialog-delta-value,
body:not(.is-editor) #terminal-shell .layout-block.text-block.is-dialog-feed .dialog-delta-table .dialog-tone-bull,
body:not(.is-editor) #terminal-shell .layout-block.text-block.is-dialog-feed .dialog-delta-table .dialog-tone-bear,
body:not(.is-editor) #terminal-shell .layout-block.text-block.is-dialog-feed .dialog-delta-table .dialog-tone-dim,
body:not(.is-editor) #terminal-shell .layout-block.text-block.is-dialog-feed .dialog-delta-table .dialog-em {
  text-shadow:
    0 0 1px currentColor,
    0 0 2px color-mix(in srgb, currentColor 55%, transparent),
    0 0 5px color-mix(in srgb, currentColor 22%, transparent);
}

.layout-block.text-block.is-dialog-feed .dialog-delta-table .dialog-tone-bull {
  color: #55ee55;
  font-weight: 700;
}

.layout-block.text-block.is-dialog-feed .dialog-delta-table .dialog-tone-bear {
  color: #ff5a5a;
  font-weight: 700;
}

.layout-block.text-block.is-dialog-feed .dialog-delta-table-inner {
  display: inline-block;
  text-align: left;
  white-space: pre;
  letter-spacing: 0;
  font-variant-ligatures: none;
  font-weight: 400;
  width: 32ch;
  max-width: 100%;
  overflow: hidden; /* never let a fat glyph push pipes outside */
}

.layout-block.text-block.is-dialog-feed .delta-line {
  display: flex;
  flex-direction: row;
  align-items: center; /* ITEM / PREV / → / NOW share one baseline row */
  white-space: pre;
  line-height: 1;
  letter-spacing: 0;
  font-weight: 400;
  min-height: 1em;
  width: 100%;
}

.layout-block.text-block.is-dialog-feed .delta-cell,
.layout-block.text-block.is-dialog-feed .delta-pipe,
.layout-block.text-block.is-dialog-feed .delta-arrow {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: flex-start;
  line-height: 1;
  height: 1em;
  font-weight: 400;
  letter-spacing: 0;
  white-space: pre;
}

.layout-block.text-block.is-dialog-feed .delta-arrow {
  /* Pixel/unicode → sits low in this font — lift to optical center of SAME */
  transform: translateY(-0.12em);
}

.layout-block.text-block.is-dialog-feed .delta-scroll {
  display: block;
  flex: 0 0 auto;
  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;
  scrollbar-width: none;
  -ms-overflow-style: none;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  font-weight: 400;
  letter-spacing: 0;
  line-height: 1;
  height: 1em;
}

.layout-block.text-block.is-dialog-feed .delta-scroll::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

.layout-block.text-block.is-dialog-feed .delta-scroll.is-dragging {
  cursor: grabbing;
}

.layout-block.text-block.is-dialog-feed .delta-scroll-inner {
  display: block;
  white-space: nowrap;
  font-weight: 400;
  letter-spacing: 0;
  line-height: 1;
}

/* Title inside delta table must NOT use bold — iOS synthetic bold widens glyphs and shoves the right | out. */
.layout-block.text-block.is-dialog-feed .dialog-delta-table .dialog-delta-title,
.layout-block.text-block.is-dialog-feed .dialog-delta-table .dialog-system-title {
  color: #ffa200;
  font-weight: 400;
  letter-spacing: 0;
  font-synthesis: none;
}

.layout-block.text-block.is-dialog-feed .dialog-delta-table .dialog-em,
.layout-block.text-block.is-dialog-feed .dialog-delta-table .dialog-delta-value {
  color: #ffffff;
  font-weight: 400;
}

.layout-block.text-block.is-dialog-feed .dialog-delta-table .dialog-tone-dim {
  color: #a3a3a3;
  font-weight: 400;
}

.layout-block.text-block.is-dialog-feed .dialog-emoji {
  font-size: 0.85em;
  line-height: 1;
  vertical-align: baseline;
}

.layout-block.text-block.is-dialog-feed .dialog-divider {
  opacity: 0.85;
  letter-spacing: 0.12em;
}

.layout-block.text-block.is-dialog-feed .dialog-topic-next {
  display: block;
  color: var(--dos-green);
}

.layout-block.text-block.is-dialog-feed .dialog-topic-next-btn {
  display: inline-block;
  font-family: var(--dos-font);
  font-size: inherit;
  line-height: inherit;
  background: transparent;
  border: none;
  padding: 0;
  margin: 0;
  cursor: pointer;
  color: var(--dos-green);
  text-align: left;
  text-shadow: var(--dos-text-glow);
}

.layout-block.text-block.is-dialog-feed .dialog-topic-next-btn.is-inverted {
  background: var(--dos-green);
  color: #000000;
  /* Soft black bloom on solid green so glyphs still feel lit. */
  text-shadow:
    0 0 1px rgba(0, 0, 0, 0.55),
    0 0 3px rgba(0, 0, 0, 0.4),
    0 0 6px rgba(0, 0, 0, 0.28);
}

.layout-block.text-block.is-dialog-feed .dialog-topic-next-meta {
  display: block;
  color: var(--dos-green);
  opacity: 0.85;
  pointer-events: none;
  user-select: none;
}

.layout-block.text-block.is-dialog-feed .dialog-system {
  color: #a3a3a3;
}

.layout-block.text-block.is-dialog-feed .dialog-system-title {
  color: #ffa200;
  font-weight: 700;
}

.layout-block.is-emoji-icon .text-content {
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

body:not(.is-editor) .layout-block.is-emoji-icon {
  pointer-events: none;
}


.layout-block.text-block.is-dialog-feed .dialog-chunk-linebreak {
  display: block;
  height: 0.55em;
  overflow: hidden;
  line-height: 0.55em;
}

.layout-block.text-block.is-dialog-feed .dialog-choices {
  display: block;
  margin-top: 2px;
}

.layout-block.text-block.is-dialog-feed .dialog-choice {
  font-family: var(--dos-font);
  font-size: inherit;
  background: transparent;
  border: none;
  padding: 0;
  margin: 0;
  cursor: pointer;
  color: #a3a3a3;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.layout-block.text-block.is-dialog-feed .dialog-choice-gap {
  color: #a3a3a3;
}

body:not(.is-editor) .layout-block.is-clickable-block,
body:not(.is-editor) .layout-block.is-menu-button,
body:not(.is-editor) .layout-block.is-input-box,
body:not(.is-editor) .layout-block.is-popup-close {
  touch-action: manipulation;
}

body:not(.is-editor) .layout-block.is-clickable-block {
  pointer-events: auto;
  cursor: pointer;
}

body:not(.is-editor) .layout-block.is-clickable-block.is-pressed .text-content {
  transform: translate(0.7px, 0.7px);
}

body:not(.is-editor) .layout-block.is-block-button.is-pressed .text-content {
  transform: translate(1.4px, 1.4px);
  filter: brightness(0.88);
}

body:not(.is-editor) .layout-block.is-click-active .text-content {
  background-color: rgba(130, 130, 130, 0.42) !important;
}

body:not(.is-editor) .dos-pressable.is-pressed {
  transform: translate(0.7px, 0.7px);
}

.layout-block.text-block.is-dialog-feed .dialog-text {
  white-space: pre-wrap;
  word-break: break-word;
}

.layout-block.text-block.is-dialog-feed .text-content::-webkit-scrollbar {
  width: 5px;
}

.layout-block.text-block.is-dialog-feed .text-content::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.55);
  border-radius: 0;
}

.layout-block.text-block.is-dialog-feed .text-content::-webkit-scrollbar-track {
  background: transparent;
}

.layout-block.text-block.is-center .text-content {
  text-align: center;
}

.layout-block.text-block.is-right .text-content {
  text-align: right;
}

/* Phone-signal energy: 6 ascending bars, flat/compact, green via block color */
.layout-block.text-block.is-energy-bar .text-content {
  letter-spacing: 0;
  white-space: nowrap;
  word-break: keep-all;
  overflow: visible;
  text-shadow: none;
  display: flex;
  justify-content: flex-end;
  align-items: flex-end;
  height: 100%;
  box-sizing: border-box;
  padding: 0;
}

.layout-block.text-block.is-energy-bar .energy-signal {
  display: inline-flex;
  align-items: flex-end;
  justify-content: flex-end;
  gap: 0.14em;
  height: 0.95em;
  max-height: 100%;
  line-height: 0;
}

.layout-block.text-block.is-energy-bar .energy-seg {
  display: block;
  width: 0.26em;
  min-width: 2px;
  /* level 1 shortest → level 6 tallest */
  height: calc(0.22em + (var(--energy-level, 1) - 1) * 0.145em);
  box-sizing: border-box;
  flex-shrink: 0;
  border: 1px solid currentColor;
  border-radius: 0.5px;
  background: transparent;
}

.layout-block.text-block.is-energy-bar .energy-seg.is-filled {
  background: currentColor;
  border-color: currentColor;
  opacity: 1;
}

.layout-block.text-block.is-energy-bar .energy-seg.is-empty {
  background: transparent;
  opacity: 0.9;
}

@keyframes energy-depleted-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.2; }
}

body:not(.is-editor) .layout-block.text-block.is-energy-bar.is-energy-depleted .text-content {
  color: #ff3b3b !important;
}

body:not(.is-editor) .layout-block.text-block.is-energy-bar.is-energy-depleted .energy-signal {
  animation: energy-depleted-blink 1s ease-in-out infinite;
}

body:not(.is-editor) .layout-block.text-block.is-energy-bar.is-energy-depleted .energy-seg {
  border-color: #ff3b3b;
  background: transparent;
}

body:not(.is-editor) .layout-block.text-block.is-energy-bar.is-energy-depleted .energy-seg.is-filled {
  background: transparent;
}

.layout-block.text-block.is-energy-label .text-content {
  white-space: nowrap;
  word-break: keep-all;
  overflow: hidden;
  text-shadow: none;
}

body.is-editor .layout-block.text-block {
  outline: 1px dashed rgba(255, 255, 255, 0.72);
}

body.is-editor .layout-block.text-block:not(.is-selected) {
  pointer-events: none;
}

body.is-editor .region-divider.is-editable-divider:not(.is-selected) {
  pointer-events: none;
}

body.is-editor #monster-panel.is-editable-panel {
  pointer-events: auto;
  z-index: 6;
  outline: 1px dashed rgba(255, 255, 255, 0.75);
}

body.is-editor #monster-panel.is-editable-panel.is-dragging {
  outline-color: rgba(255, 255, 255, 0.95);
}

body.is-editor #monster-panel.is-selected-monster-panel {
  outline: 2px solid rgba(255, 255, 255, 0.95);
  z-index: 8;
}

body.is-editor .monster-panel-handles {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 9;
}

body.is-editor #monster-panel.is-selected-monster-panel .monster-panel-handles .handle-resize {
  pointer-events: auto;
  /*
   * Panel often overhangs #terminal-shell (overflow:hidden). Bottom-right handle
   * lands outside the shell and cannot receive hits — park it bottom-left inside.
   */
  right: auto;
  left: 2px;
  bottom: 2px;
  width: 16px;
  height: 16px;
  z-index: 12;
}

body.is-editor .layout-block.is-scan-led.is-selected .handle-resize {
  /* Keep drag area free: handle on top-right corner of tiny LED */
  right: 0;
  top: 0;
  bottom: auto;
}

.popup-runtime-scale-host {
  position: relative;
  flex-shrink: 0;
  z-index: 1;
}

body.is-editor .layout-block.text-block.is-selected {
  outline: 2px solid rgba(255, 255, 255, 0.95);
  z-index: 20;
  pointer-events: auto;
}

body.is-editor .region-divider.is-editable-divider {
  pointer-events: auto;
  cursor: ns-resize;
  outline: 1px dashed rgba(255, 255, 255, 0.55);
  z-index: 5;
}

body.is-editor .region-divider.is-editable-divider.is-selected {
  outline: 2px solid rgba(255, 255, 255, 0.9);
  z-index: 19;
  pointer-events: auto;
}

body.is-editor .region-divider.is-editable-divider.is-dragging {
  outline-color: rgba(255, 255, 255, 0.95);
}

.divider-badge {
  top: -12px;
  background: #fff;
  color: #111;
}

.block-id-badge {
  position: absolute;
  top: -14px;
  left: 0;
  padding: 0 4px;
  font-size: 9px;
  line-height: 1.2;
  color: #000;
  background: var(--dos-green-bright);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif;
  pointer-events: none;
  white-space: nowrap;
}

/* Editor preview: never show block-xxx / divider id badges on any page */
body.is-editor .block-id-badge {
  display: none !important;
}

.edit-handles {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

body.is-editor .layout-block.text-block.is-dialog-feed {
  pointer-events: auto;
}

body.is-editor .layout-block.text-block.is-dialog-feed .text-content {
  pointer-events: none;
}

.handle-rotate,
.handle-resize {
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid #333;
  pointer-events: auto;
  touch-action: none;
}

.handle-rotate {
  top: -18px;
  left: 50%;
  transform: translateX(-50%);
  cursor: grab;
}

.handle-resize {
  right: -7px;
  bottom: -7px;
  cursor: nwse-resize;
}

.layout-block.is-dragging {
  opacity: 0.88;
}

/* Editor chrome — normal UI, not DOS style */
html:has(body.is-editor) {
  height: 100%;
}

body.is-editor {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  height: 100%;
  min-height: 100dvh;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Helvetica Neue", sans-serif;
  color: #e8e8e8;
  background: #1a1a1a;
}

.editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 10px;
  background: #2a2a2a;
  border-bottom: 1px solid #444;
  flex-shrink: 0;
}

.editor-toolbar button {
  flex: 1 1 auto;
  min-width: 64px;
  padding: 7px 10px;
  border: 1px solid #555;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  color: #eee;
  background: #333;
  font-family: inherit;
}

.editor-toolbar button.active {
  background: #0d6efd;
  border-color: #0d6efd;
  color: #fff;
}

.editor-toolbar button.primary {
  background: #198754;
  border-color: #198754;
  color: #fff;
}

.editor-toolbar button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.editor-workspace {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.editor-preview {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  min-width: 0;
  min-height: 0;
  padding: 8px;
  background: #111;
  overflow: hidden;
}

#editor-preview-scroller {
  flex: 1;
  min-height: 0;
  overflow-x: auto;
  overflow-y: auto;
  display: flex;
  justify-content: flex-start;
  align-items: flex-start;
  padding: 8px 4px 16px;
  background: #0a0a0a;
  border: 1px solid #333;
  border-radius: 8px;
}

body.is-editor #terminal-shell {
  box-shadow: 0 0 0 1px rgba(85, 238, 85, 0.35);
  flex-shrink: 0;
  font-family: var(--dos-font);
  color: var(--dos-green);
}

#editor-info {
  margin-top: 8px;
  font-size: 12px;
  color: #999;
  text-align: center;
  font-family: inherit;
  flex-shrink: 0;
}

#editor-sidebar {
  width: min(320px, 38vw);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  background: #242424;
  border-left: 1px solid #444;
  padding: 10px;
}

#editor-sidebar > .sidebar-section:first-child {
  flex: 0 1 38%;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

#editor-sidebar .block-list {
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  margin-bottom: 0;
}

#editor-panel {
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#editor-panel .panel-body {
  flex: 1 1 0;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding-right: 4px;
  padding-bottom: 24px;
}

#panel-popup-frame {
  padding-bottom: 8px;
}

.sidebar-title {
  font-size: 13px;
  color: #f0f0f0;
  margin-bottom: 8px;
  font-family: inherit;
  font-weight: 600;
}

.block-list-item {
  padding: 6px 8px;
  margin-bottom: 4px;
  border: 1px solid #444;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  font-family: inherit;
  background: #2e2e2e;
}

.block-list-item.is-active {
  border-color: #0d6efd;
  background: rgba(13, 110, 253, 0.15);
}

.block-list-item .item-id {
  display: block;
  color: #7ec8ff;
  font-weight: 600;
  font-family: ui-monospace, monospace;
}

.block-list-item .item-label {
  display: block;
  color: #aaa;
  margin-top: 2px;
}

.panel-empty {
  font-size: 12px;
  color: #888;
  font-family: inherit;
}

.panel-selected-id {
  font-size: 12px;
  color: #7ec8ff;
  margin-bottom: 8px;
  font-family: ui-monospace, monospace;
}

.panel-controls label {
  display: block;
  font-size: 12px;
  color: #ccc;
  margin-bottom: 8px;
  font-family: inherit;
}

#lbl-system-message-title {
  display: block;
  margin-bottom: 4px;
}

.panel-controls input,
.panel-controls textarea {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 6px 8px;
  border: 1px solid #555;
  border-radius: 4px;
  background: #1a1a1a;
  color: #eee;
  font-family: ui-monospace, monospace;
  font-size: 12px;
}

.sidebar-action-btn {
  width: 100%;
  padding: 7px;
  margin-bottom: 8px;
  border: 1px solid #555;
  border-radius: 4px;
  background: #333;
  color: #eee;
  cursor: pointer;
  font-family: inherit;
}

.sidebar-action-btn.primary,
#btn-save-prompts {
  border-color: #198754;
  color: #b8f0c8;
}

#editor-prompts-sidebar {
  width: min(300px, 34vw);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  background: #242424;
  border-right: 1px solid #444;
  padding: 10px;
}

#editor-prompts-panel {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.prompts-panel-body {
  flex: 1 1 0;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding-right: 4px;
  scrollbar-width: thin;
  scrollbar-color: #555 #1a1a1a;
}

.prompts-panel-body::-webkit-scrollbar {
  width: 6px;
}

.prompts-panel-body::-webkit-scrollbar-thumb {
  background: #555;
  border-radius: 3px;
}

.prompts-panel-body::-webkit-scrollbar-track {
  background: #1a1a1a;
}

.prompts-panel-footer {
  flex-shrink: 0;
  padding-top: 8px;
  border-top: 1px solid #444;
  margin-top: 8px;
}

#editor-prompts-panel .prompts-field textarea {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 6px 8px;
  border: 1px solid #555;
  border-radius: 4px;
  background: #1a1a1a;
  color: #eee;
  font-family: ui-monospace, monospace;
  font-size: 12px;
  line-height: 1.4;
  min-height: 4.5em;
  max-height: 28vh;
  overflow-y: auto;
  resize: vertical;
  scrollbar-width: thin;
  scrollbar-color: #666 #1a1a1a;
}

#editor-prompts-panel #inp-topic-next-prompt {
  min-height: 5em;
  border-color: #3d8bfd;
}

#editor-prompts-panel .prompts-field textarea::-webkit-scrollbar {
  width: 6px;
}

#editor-prompts-panel .prompts-field textarea::-webkit-scrollbar-thumb {
  background: #666;
  border-radius: 3px;
}

#editor-prompts-panel .prompts-field {
  display: block;
  font-size: 12px;
  color: #ccc;
  margin-bottom: 10px;
}

#editor-prompts-panel .prompts-field[hidden],
#editor-prompts-panel label[hidden] {
  display: none !important;
}

.sidebar-section + .sidebar-section {
  margin-top: 14px;
}

.block-list {
  list-style: none;
}

.editor-marquee {
  position: absolute;
  border: 1px dashed rgba(255, 255, 255, 0.8);
  background: rgba(255, 255, 255, 0.06);
  pointer-events: none;
  z-index: 30;
}

.panel-hint {
  font-size: 11px;
  color: #999;
  margin-bottom: 10px;
  line-height: 1.4;
}

.frame-char-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 10px;
}

.frame-char-grid label {
  font-size: 11px;
  margin-bottom: 0;
}

.frame-char-grid select {
  width: 100%;
  margin-top: 3px;
  padding: 4px;
  background: #1a1a1a;
  color: #eee;
  border: 1px solid #555;
  border-radius: 4px;
  font-family: ui-monospace, monospace;
}

.border-char-palette {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 8px;
}

.border-char-palette button {
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid #555;
  border-radius: 4px;
  background: #222;
  color: #7ec8ff;
  font-family: ui-monospace, monospace;
  cursor: pointer;
}

.border-char-palette button:hover {
  border-color: #0d6efd;
  background: #333;
}

@media (max-width: 720px) {
  .editor-workspace {
    flex-direction: column;
  }

  #editor-prompts-sidebar {
    width: 100%;
    max-height: 36vh;
    border-right: none;
    border-bottom: 1px solid #444;
    order: -1;
  }

  #editor-sidebar {
    width: 100%;
    max-height: 38vh;
    min-height: 0;
    border-left: none;
    border-top: 1px solid #444;
  }
}


/* ===== Editor page tabs / list front-text (20260805e) ===== */
.editor-toolbar {
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}

.editor-toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.editor-toolbar-actions button {
  flex: 1 1 auto;
  min-width: 64px;
}

.editor-page-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.editor-page-tab {
  flex: 1 1 auto;
  min-width: 72px;
  padding: 7px 10px;
  border: 1px solid #555;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  color: #cfcfcf;
  background: #333;
  font-family: inherit;
}

.editor-page-tab.is-active {
  background: #0d6efd;
  border-color: #0d6efd;
  color: #fff;
}

body.is-editor.editor-mode-prompts .editor-workspace {
  align-items: stretch;
}

body.is-editor.editor-mode-prompts #editor-prompts-sidebar {
  display: flex;
  flex: 1 1 auto;
  align-self: stretch;
  width: 100%;
  max-width: none;
  height: auto;
  min-height: 0;
  max-height: none;
  border-right: none;
  padding: 12px 16px 16px;
  overflow: hidden;
}

body.is-editor.editor-mode-prompts #editor-prompts-panel {
  max-width: 760px;
  width: 100%;
  height: 100%;
  min-height: 0;
  margin: 0 auto;
  overflow: hidden;
}

body.is-editor.editor-mode-prompts .prompts-section {
  margin: 0 0 16px;
  padding: 12px;
  border: 1px solid #3a3a3a;
  border-radius: 8px;
  background: #2a2a2a;
}

body.is-editor.editor-mode-prompts .prompts-section.is-emphasis {
  border-color: #3d8bfd;
  background: #243044;
}

body.is-editor.editor-mode-prompts .prompts-section-title {
  margin: 0 0 6px;
  font-size: 14px;
  color: #f2f2f2;
  font-weight: 650;
}

body.is-editor.editor-mode-prompts .prompts-intro {
  margin-bottom: 12px;
  color: #b8d8b8;
}

/* Legacy stub grid: must stay hidden. Never override [hidden] with display:grid. */
body.is-editor.editor-mode-prompts .prompts-blocks-grid {
  gap: 10px;
}
body.is-editor.editor-mode-prompts .prompts-blocks-grid[hidden],
#editor-prompts-panel #prompts-blocks-grid[hidden] {
  display: none !important;
}

body.is-editor.editor-mode-prompts #sel-prompts-section,
body.is-editor.editor-mode-prompts #sel-topic-next {
  display: block;
  width: 100%;
  margin: 4px 0 8px;
  padding: 6px 8px;
  border: 1px solid #555;
  border-radius: 4px;
  background: #1a1a1a;
  color: #eee;
  font-family: inherit;
}

body.is-editor:not(.editor-mode-prompts) #editor-prompts-sidebar {
  display: none;
}

body.is-editor.editor-mode-prompts .editor-preview,
body.is-editor.editor-mode-prompts #editor-sidebar {
  display: none;
}

body.is-editor .editor-canvas-host:not(.is-active-page) {
  display: none !important;
}

body.is-editor .editor-canvas-row {
  width: 100%;
  min-width: 0;
  justify-content: center;
}

.sidebar-title-hint {
  font-weight: 500;
  color: #8fd48f;
  font-size: 12px;
  margin-left: 6px;
}

.block-list-item .item-text {
  display: block;
  color: #e8ffe8;
  font-weight: 600;
  font-family: var(--dos-font), ui-monospace, monospace;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.block-list-item .item-label {
  display: block;
  color: #888;
  margin-top: 2px;
  font-size: 11px;
}

.block-list-item .item-id {
  display: none;
}

@media (max-width: 720px) {
  body.is-editor.editor-mode-prompts #editor-prompts-sidebar {
    max-height: none;
    order: 0;
  }
}


/* ===== editor-layout-ratio-20260805i ===== */
body.is-editor .editor-preview {
  flex: 1 1 32%;
  max-width: 36%;
  min-width: 260px;
}

body.is-editor #editor-sidebar {
  flex: 2 1 64%;
  width: auto;
  max-width: none;
  min-width: 380px;
}

body.is-editor #editor-sidebar > .sidebar-section:first-child {
  flex: 0 1 36%;
}

body.is-editor #editor-panel {
  flex: 1 1 64%;
}

/* superseded panel grid in editor-comfort-chrome-20260805k */

body.is-editor #editor-panel .panel-field-full,
body.is-editor #editor-panel #lbl-text,
body.is-editor #editor-panel #lbl-system-message,
body.is-editor #editor-panel #panel-menu-btn-style,
body.is-editor #editor-panel #panel-divider-style,
body.is-editor #editor-panel #panel-popup-frame,
body.is-editor #editor-panel #panel-monster-panel,
body.is-editor #editor-panel #panel-frame-controls {
  grid-column: 1 / -1;
}

body.is-editor #editor-panel .panel-controls label {
  margin-bottom: 0;
}

/* superseded by editor-comfort-chrome-20260805k */

body.is-editor #panel-selected-id {
  word-break: break-all;
}


/* panel-hidden-fix-20260805i */
body.is-editor #editor-panel label[hidden],
body.is-editor #editor-panel .panel-controls[hidden],
body.is-editor #editor-panel [hidden] {
  display: none !important;
}


/* ===== editor-comfort-chrome-20260805m ===== */
html:has(body.is-editor) {
  background: #2c3036;
}

body.is-editor {
  --ed-bg0: #2a2c30;
  --ed-bg1: #34383e;
  --ed-bg2: #3e444c;
  --ed-bg3: #4a515b;
  --ed-bg4: #5a6270;
  --ed-line: #6a7382;
  --ed-text: #e6e8ec;
  --ed-muted: #a8b0bc;
  --ed-soft: #c5ccd6;
  --ed-accent: #5b9cff;
  --ed-accent-soft: rgba(91, 156, 255, 0.18);
  color: var(--ed-text);
  background:
    linear-gradient(180deg, #3a3f47 0%, var(--ed-bg0) 140px, #2a2e34 100%);
}

body.is-editor .editor-toolbar {
  background: linear-gradient(180deg, #4a505a 0%, var(--ed-bg2) 100%);
  border-bottom: 1px solid var(--ed-line);
  box-shadow: 0 1px 0 rgba(255,255,255,0.04);
}

body.is-editor .editor-toolbar-actions button,
body.is-editor .editor-page-tab {
  background: var(--ed-bg1);
  border-color: #5c6572;
  color: var(--ed-soft);
}

body.is-editor .editor-toolbar-actions button:hover,
body.is-editor .editor-page-tab:hover {
  background: var(--ed-bg3);
}

body.is-editor .editor-page-tab.is-active,
body.is-editor .editor-toolbar-actions button.active {
  background: var(--ed-accent);
  border-color: #7ab0ff;
  color: #fff;
}

body.is-editor .editor-toolbar-actions button.primary {
  background: #3f8f63;
  border-color: #57a87a;
}

body.is-editor .editor-workspace {
  background: var(--ed-bg0);
}

body.is-editor .editor-preview {
  background: #30343a;
  border-right: 1px solid #4c535e;
}

body.is-editor #editor-preview-scroller {
  background:
    repeating-linear-gradient(
      0deg,
      rgba(255,255,255,0.015) 0 1px,
      transparent 1px 8px
    ),
    #2b2f35;
  border: 1px solid #525a66;
  border-radius: 10px;
}

body.is-editor #editor-info {
  color: var(--ed-muted);
}

body.is-editor #editor-sidebar {
  background: linear-gradient(180deg, #3a3f47 0%, #31353c 40%, #2c3036 100%);
  border-left: 1px solid #555d6a;
  padding: 12px;
  gap: 10px;
}

body.is-editor #editor-sidebar > .sidebar-section {
  background: var(--ed-bg1);
  border: 1px solid #505866;
  border-radius: 10px;
  padding: 10px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
}

body.is-editor #editor-sidebar > .sidebar-section:first-child {
  flex: 0 1 40%;
}

body.is-editor .sidebar-title {
  color: var(--ed-soft);
  margin-bottom: 10px;
}

body.is-editor .sidebar-title-hint {
  color: #9fd49f;
}

/* Component list → compact chip buttons, multi per row */
body.is-editor #block-list,
body.is-editor .block-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  gap: 8px;
  align-content: start;
  border: 1px solid #4c545f;
  border-radius: 8px;
  padding: 8px;
  background: #2f343b;
  list-style: none;
  margin: 0;
}

body.is-editor .block-list-item {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 54px;
  margin: 0;
  padding: 8px 10px;
  border: 1px solid #5a6370;
  border-radius: 8px;
  background: linear-gradient(180deg, #454c57 0%, #3a4049 100%);
  box-shadow: 0 1px 0 rgba(255,255,255,0.04);
  transition: border-color 0.12s ease, background 0.12s ease, transform 0.08s ease;
}

body.is-editor .block-list-item:hover {
  border-color: #7c8796;
  background: linear-gradient(180deg, #505866 0%, #424954 100%);
}

body.is-editor .block-list-item.is-active {
  border-color: var(--ed-accent);
  background: linear-gradient(180deg, #3f5f8a 0%, #334e73 100%);
  box-shadow: inset 0 0 0 1px rgba(122, 176, 255, 0.35);
}

body.is-editor .block-list-item .item-text {
  color: #f1f3f6;
  font-size: 12px;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

body.is-editor .block-list-item .item-label {
  color: #b0b8c4;
  font-size: 10px;
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Property panel denser grid */
body.is-editor #editor-panel .panel-body {
  background: #2f343b;
  border: 1px solid #4c545f;
  border-radius: 8px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

body.is-editor #editor-panel .panel-controls {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px 8px;
  align-content: start;
}

body.is-editor #editor-panel .panel-hint,
body.is-editor #editor-panel .panel-empty {
  grid-column: 1 / -1;
  color: var(--ed-muted);
  margin: 0 0 2px;
}

body.is-editor #editor-panel #btn-delete-block {
  align-self: flex-start;
  min-width: 96px;
  max-width: 160px;
}

body.is-editor #editor-panel .panel-controls label {
  min-width: 0;
  margin: 0;
  padding: 6px 7px;
  border: 1px solid #4e5662;
  border-radius: 7px;
  background: #3a4049;
  color: var(--ed-muted);
  font-size: 11px;
}

body.is-editor #editor-panel .panel-controls input,
body.is-editor #editor-panel .panel-controls select,
body.is-editor #editor-panel .panel-controls textarea {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  margin-top: 4px;
  padding: 5px 7px;
  border: 1px solid #606978;
  border-radius: 5px;
  background: #2a2e35;
  color: var(--ed-text);
  font-size: 12px;
}

body.is-editor #editor-panel .panel-controls input[type="number"],
body.is-editor #editor-panel .panel-controls input[type="color"] {
  max-width: 100%;
}

body.is-editor #editor-panel .panel-controls input[type="range"] {
  padding: 0;
  height: 22px;
  background: transparent;
  border: none;
}

body.is-editor #editor-panel .panel-controls input[type="checkbox"] {
  width: auto;
  margin-top: 6px;
}

/* Full-width only for truly long fields / nested panels inside a grid */
body.is-editor #editor-panel .panel-field-full,
body.is-editor #editor-panel #lbl-text,
body.is-editor #editor-panel #lbl-system-message,
body.is-editor #editor-panel #panel-menu-btn-style {
  grid-column: 1 / -1;
}

body.is-editor #editor-panel .panel-share-url-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}

body.is-editor #editor-panel .panel-share-url-row #inp-share-url {
  flex: 1 1 auto;
  min-width: 0;
}

body.is-editor #editor-panel .panel-share-show-url {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex: 0 0 auto;
  white-space: nowrap;
  font-weight: 400;
  margin: 0;
}

/* Color / short numeric fields stay one cell — pack more per row */
body.is-editor #editor-panel #lbl-rotation,
body.is-editor #editor-panel #lbl-fontsize,
body.is-editor #editor-panel #lbl-lineheight,
body.is-editor #editor-panel #lbl-letter-spacing,
body.is-editor #editor-panel #lbl-block-w,
body.is-editor #editor-panel #lbl-block-h,
body.is-editor #editor-panel #lbl-color,
body.is-editor #editor-panel #lbl-brightness,
body.is-editor #editor-panel #lbl-bgcolor,
body.is-editor #editor-panel #lbl-bg-brightness,
body.is-editor #editor-panel #lbl-clear-bg,
body.is-editor #editor-panel #lbl-border-style,
body.is-editor #editor-panel #lbl-border-color,
body.is-editor #editor-panel #lbl-popup-shell-bg,
body.is-editor #editor-panel #lbl-popup-outer-frame-grid,
body.is-editor #editor-panel #lbl-popup-outer-frame-color,
body.is-editor #editor-panel #lbl-popup-inner-frame-color,
body.is-editor #editor-panel #lbl-popup-frame-x,
body.is-editor #editor-panel #lbl-popup-frame-y,
body.is-editor #editor-panel #lbl-popup-frame-w,
body.is-editor #editor-panel #lbl-popup-frame-h,
body.is-editor #editor-panel #lbl-divider-pattern,
body.is-editor #editor-panel #lbl-divider-color,
body.is-editor #editor-panel #lbl-divider-brightness {
  grid-column: span 1;
}

/* Nested grids (menu shadow etc.) keep their own 4-col packing */
body.is-editor #editor-panel #panel-menu-btn-style.panel-controls,
body.is-editor #editor-panel #panel-divider-style.panel-controls,
body.is-editor #editor-panel #panel-popup-frame.panel-controls,
body.is-editor #editor-panel #panel-monster-panel.panel-controls,
body.is-editor #editor-panel #panel-frame-controls.panel-controls {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

body.is-editor #panel-selected-id {
  color: #9ec5ff;
  background: #3a4452;
  border: 1px solid #5a6b80;
  border-radius: 6px;
  padding: 4px 8px;
}

body.is-editor .sidebar-action-btn {
  background: var(--ed-bg3);
  border-color: #66707e;
  color: var(--ed-text);
}

body.is-editor .sidebar-action-btn.is-danger {
  background: #6a3a3a;
  border-color: #8a5555;
}

body.is-editor #editor-prompts-sidebar,
body.is-editor.editor-mode-prompts #editor-prompts-sidebar {
  background: linear-gradient(180deg, #3a3f47 0%, #2f333a 100%);
}

body.is-editor.editor-mode-prompts .prompts-section {
  background: #3a4049;
  border-color: #5a6370;
}

body.is-editor.editor-mode-prompts .prompts-section.is-emphasis {
  background: #3a4a5f;
  border-color: #6a8eb8;
}

@media (max-width: 1200px) {
  body.is-editor #block-list,
  body.is-editor .block-list {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  }
  body.is-editor #editor-panel .panel-controls,
  body.is-editor #editor-panel #panel-menu-btn-style.panel-controls,
  body.is-editor #editor-panel #panel-divider-style.panel-controls,
  body.is-editor #editor-panel #panel-popup-frame.panel-controls,
  body.is-editor #editor-panel #panel-monster-panel.panel-controls,
  body.is-editor #editor-panel #panel-frame-controls.panel-controls {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  body.is-editor #editor-panel .panel-controls,
  body.is-editor #editor-panel #panel-menu-btn-style.panel-controls,
  body.is-editor #editor-panel #panel-divider-style.panel-controls,
  body.is-editor #editor-panel #panel-popup-frame.panel-controls,
  body.is-editor #editor-panel #panel-monster-panel.panel-controls,
  body.is-editor #editor-panel #panel-frame-controls.panel-controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* —— block-001 countdown + delta roll (merged former block-sys) —— */
#terminal-shell [data-id="block-001"] .text-content.is-workload-ticker {
  overflow: hidden;
  display: block;
}
#terminal-shell [data-id="block-001"] .workload-log {
  display: flex;
  flex-direction: column;
  width: 100%;
  min-width: 0;
}
#terminal-shell [data-id="block-001"] .workload-log-viewport {
  overflow: hidden;
  width: 100%;
}
#terminal-shell [data-id="block-001"] .workload-log-track {
  display: flex;
  flex-direction: column;
  will-change: transform;
  transform: translateY(0);
}
#terminal-shell [data-id="block-001"] .workload-log-line {
  box-sizing: border-box;
  width: 100%;
  white-space: nowrap;
  text-overflow: ellipsis;
  flex: 0 0 auto;
  overflow: hidden;
}

.panel-workload-ticker {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(120, 160, 140, 0.35);
}
.panel-workload-ticker[hidden] {
  display: none !important;
}
.workload-ticker-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 420px;
  overflow: auto;
  padding-right: 4px;
}
.workload-ticker-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px;
  border: 1px solid rgba(120, 160, 140, 0.3);
  background: rgba(0, 0, 0, 0.25);
}
.workload-ticker-enable {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #9f9f9f;
}
.workload-ticker-id {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  opacity: 0.85;
}
.workload-ticker-row input[type="text"] {
  width: 100%;
  box-sizing: border-box;
  font-size: 12px;
}
.workload-ticker-line3 {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px;
  align-items: center;
}
.workload-ticker-n {
  font-size: 11px;
  color: #6ecf8e;
  white-space: nowrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}


body.is-editor.editor-mode-prompts .prompts-why-topic {
  margin: 12px 0 16px;
  padding-top: 8px;
  border-top: 1px solid #3a3a3a;
}
body.is-editor.editor-mode-prompts .prompts-why-title {
  margin: 0 0 6px;
  font-size: 12px;
  color: #9ad;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
#btn-save-why-prompts {
  margin-top: 6px;
}


/* Suggest question: single-line horizontal pan (no scrollbar). Must beat .text-content pre-wrap. */
.popup-page-content .layout-block.text-block.is-suggest-question .text-content,
body:not(.is-editor) .popup-overlay-root .popup-page-content .layout-block.text-block.is-suggest-question .text-content {
  white-space: nowrap !important;
  word-break: normal !important;
  overflow-wrap: normal !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  scrollbar-width: none !important;
  -ms-overflow-style: none !important;
  touch-action: pan-x !important;
  -webkit-overflow-scrolling: touch;
  cursor: grab;
}
.popup-page-content .layout-block.text-block.is-suggest-question .text-content.is-panning {
  cursor: grabbing;
}
.popup-page-content .layout-block.text-block.is-suggest-question .text-content::-webkit-scrollbar {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
}
.popup-page-content .layout-block.text-block.is-suggest-question .text-content .suggest-q-track {
  display: inline-block;
  white-space: nowrap;
  flex: 0 0 auto;
  min-width: max-content;
}
