:root {
  --web-black: var(--xp-black, #050407);
  --web-panel: var(--xp-panel, #0b0a0e);
  --web-pink: var(--xp-pink, #e86fa4);
  --web-violet: var(--xp-violet, #b14fe0);
  --web-green: var(--xp-green, #31d67a);
  --web-ink: var(--web-pink);
  --web-muted: var(--web-violet);
  --web-chrome: var(--xp-font-chrome, Fixedsys, "MS Gothic", "Lucida Console", "Courier New", monospace);
  --web-mono: var(--xp-font-mono, "MS Gothic", Fixedsys, "Lucida Console", "Courier New", monospace);
  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  border-radius: 0 !important;
}

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--web-black);
}

body {
  min-height: 100vh;
  margin: 0;
  padding: 8px;
  overflow-x: hidden;
  background:
    repeating-conic-gradient(from 45deg, var(--web-panel) 0 25%, var(--web-black) 0 50%) 0 0 / 4px 4px;
  color: var(--web-ink);
  font-family: var(--web-mono);
  -webkit-font-smoothing: none;
  text-rendering: geometricPrecision;
}

.boot-screen {
  display: none;
}

html[data-boot="play"] {
  scrollbar-color: transparent transparent;
}

html[data-boot="play"]::-webkit-scrollbar-track,
html[data-boot="play"]::-webkit-scrollbar-thumb,
html[data-boot="play"]::-webkit-scrollbar-corner,
html[data-boot="play"]::-webkit-scrollbar-button {
  border-color: transparent;
  background: transparent;
}

html[data-boot="play"] .boot-screen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  overflow: hidden;
  contain: layout paint;
  padding:
    max(clamp(12px, 2vw, 32px), env(safe-area-inset-top))
    max(clamp(12px, 2vw, 32px), env(safe-area-inset-right))
    max(clamp(12px, 2vw, 32px), env(safe-area-inset-bottom))
    max(clamp(12px, 2vw, 32px), env(safe-area-inset-left));
  background: var(--web-black);
  color: var(--web-pink);
  cursor: default;
  user-select: none;
}

html[data-boot="play"] .boot-screen::before,
html[data-boot="play"] .boot-screen::after {
  content: "";
  position: absolute;
  pointer-events: none;
}

html[data-boot="play"] .boot-screen::before {
  z-index: 3;
  inset-inline: 0;
  inset-block-start: calc(50% - 1px);
  block-size: 2px;
  background: var(--web-violet);
  visibility: hidden;
  animation: boot-power-line 160ms steps(1, end) both;
}

html[data-boot="play"] .boot-screen::after {
  z-index: 2;
  inset: 0;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0 3px,
    var(--web-black) 3px 4px
  );
  visibility: hidden;
  animation: boot-show 1ms steps(1, end) 160ms both;
}

.boot-terminal {
  position: relative;
  z-index: 1;
  inline-size: min(100%, 125svh, 1280px);
  block-size: clamp(240px, 46svh, 620px);
  max-block-size: 100%;
  padding: clamp(22px, 4vw, 58px);
  overflow: hidden;
  border: clamp(4px, .55vw, 8px) solid var(--web-violet);
  border-block-start-color: var(--web-pink);
  border-inline-start-color: var(--web-pink);
  background: var(--web-panel);
  color: var(--web-violet);
  font: 700 clamp(12px, 1.5vw, 20px)/1.45 var(--web-mono);
  letter-spacing: .04em;
  visibility: hidden;
  animation: boot-show 1ms steps(1, end) 160ms both;
}

.boot-terminal p {
  margin: 0 0 clamp(8px, 1.4vh, 16px);
}

.boot-title {
  inline-size: 0;
  max-inline-size: 100%;
  overflow: hidden;
  color: var(--web-pink);
  font-size: clamp(17px, 3vw, 38px);
  line-height: 1.15;
  letter-spacing: 0;
  white-space: nowrap;
  animation: boot-type 550ms steps(22, end) 240ms both;
}

.boot-premise,
.boot-ready,
.boot-cursor {
  visibility: hidden;
  animation: boot-show 1ms steps(1, end) both;
}

.boot-premise-life {
  color: var(--web-pink);
  animation-delay: 850ms;
}

.boot-premise-agency {
  color: var(--web-green);
  animation-delay: 1010ms;
}

.boot-ready {
  margin-block-start: clamp(22px, 5vh, 56px) !important;
  color: var(--web-violet);
  animation-delay: 1190ms;
}

.boot-cursor {
  display: inline-block;
  color: var(--web-green);
  font-size: 1.25em;
  line-height: 1;
  animation:
    boot-show 1ms steps(1, end) 1250ms both,
    boot-cursor 600ms steps(1, end) 1250ms infinite;
}

@keyframes boot-power-line {
  0%, 62% { visibility: hidden; }
  63%, 99% { visibility: visible; }
  100% { visibility: hidden; }
}

@keyframes boot-show {
  from { visibility: hidden; }
  to { visibility: visible; }
}

@keyframes boot-type {
  from { inline-size: 0; }
  to { inline-size: 22ch; }
}

@keyframes boot-cursor {
  0%, 49% { color: var(--web-green); }
  50%, 100% { color: transparent; }
}

html[data-boot-hold="true"] .boot-screen::before {
  animation: none;
  visibility: hidden;
}

html[data-boot-hold="true"] .boot-screen::after,
html[data-boot-hold="true"] .boot-terminal,
html[data-boot-hold="true"] .boot-premise,
html[data-boot-hold="true"] .boot-ready,
html[data-boot-hold="true"] .boot-cursor {
  animation: none;
  visibility: visible;
}

html[data-boot-hold="true"] .boot-title {
  inline-size: 22ch;
  animation: none;
}

html[data-boot-hold="true"] .boot-cursor {
  color: var(--web-green);
}

.app-window {
  width: min(1584px, 100%);
  min-width: 0;
  margin: 0 auto;
  overflow: hidden;
  border: 2px solid var(--web-black);
  background: var(--web-panel);
  box-shadow:
    inset 2px 2px 0 var(--web-pink),
    inset -2px -2px 0 var(--web-black),
    2px 2px 0 var(--web-violet);
}

.app-titlebar,
.panel-titlebar {
  min-width: 0;
  display: flex;
  align-items: center;
  color: var(--web-black);
  user-select: none;
}

.app-titlebar {
  min-height: 27px;
  gap: 4px;
  padding: 3px 4px 3px 6px;
  border: 2px solid var(--web-black);
  border-top-color: var(--web-pink);
  border-left-color: var(--web-pink);
  background: linear-gradient(180deg, var(--web-pink) 0 48%, var(--web-violet) 48% 100%);
  font: 700 12px/1 var(--web-chrome);
}

.app-mark,
.panel-icon,
.tool-icons i {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--web-black);
  background: var(--web-green);
  color: var(--web-black);
  box-shadow: inset 1px 1px 0 var(--web-pink), inset -1px -1px 0 var(--web-black);
  font: 700 9px/1 var(--web-mono);
}

.titlebar-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.signal-state {
  margin-left: auto;
  color: var(--web-black);
  font: 700 9px var(--web-mono);
  white-space: nowrap;
}

.signal-state[data-state="live"] { color: var(--web-green); text-shadow: 1px 1px 0 var(--web-black); }
.signal-state[data-state="fallback"] { color: var(--web-black); }
.signal-state[data-state="waiting-life"] { color: var(--web-green); text-shadow: 1px 1px 0 var(--web-black); }
.signal-state[data-state="rebirth"] {
  color: var(--web-green);
  text-shadow: 1px 1px 0 var(--web-black);
  animation: rebirth-cursor 1.6s steps(1, end) infinite;
}
.signal-state[data-state="reconnecting"],
.signal-state[data-state="lost"] { color: var(--web-black); text-shadow: 1px 1px 0 var(--web-pink); }
/* B45: vuelta programada — placa de "volvemos", no un error: verde, no rosa */
.signal-state[data-state="scheduled"] { color: var(--web-green); text-shadow: 1px 1px 0 var(--web-black); }

@keyframes rebirth-cursor {
  0%, 49% { color: var(--web-green); }
  50%, 100% { color: var(--web-pink); }
}

.window-controls {
  display: inline-flex;
  gap: 2px;
  flex: 0 0 auto;
}

.window-control {
  width: 20px;
  height: 18px;
  display: inline-grid;
  place-items: center;
  border: 2px solid var(--web-black);
  border-top-color: var(--web-pink);
  border-left-color: var(--web-pink);
  background: var(--web-violet);
  box-shadow: inset -1px -1px 0 var(--web-black);
  color: var(--web-black);
  font: 700 9px/1 var(--web-mono);
}

.premise-strip {
  min-height: 23px;
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  align-items: center;
  gap: 0;
  margin: 0;
  padding: 2px 4px;
  overflow: hidden;
  border: 2px solid var(--web-black);
  border-top-color: var(--web-pink);
  border-left-color: var(--web-pink);
  background: var(--web-panel);
  color: var(--web-pink);
  font: 700 9px/1 var(--web-mono);
  white-space: nowrap;
}

.premise-strip span {
  min-width: 0;
  padding: 3px 8px;
  overflow: hidden;
  border-right: 1px solid var(--web-violet);
  text-overflow: ellipsis;
}

.premise-strip span::before { content: "> "; color: var(--web-green); }
.premise-strip span:nth-child(2) { color: var(--web-green); }
.premise-strip span:last-child { border-right: 0; color: var(--web-violet); }

.signal-strip {
  min-height: 30px;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px 4px;
  border: 2px solid var(--web-black);
  border-top-color: var(--web-violet);
  border-left-color: var(--web-violet);
  background: var(--web-panel);
  color: var(--web-violet);
  font-size: 8px;
}

.tool-icons { display: inline-flex; gap: 2px; }

.signal-detail,
.signal-message,
.last-signal {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.signal-detail {
  flex: 1 1 260px;
  padding: 5px 7px;
  border: 2px solid var(--web-black);
  border-right-color: var(--web-violet);
  border-bottom-color: var(--web-violet);
  background: var(--web-black);
  color: var(--web-green);
  font-weight: 700;
}

.signal-message { flex: 1; color: var(--web-pink); }
.last-signal-label { color: var(--web-violet); white-space: nowrap; }
.last-signal { color: var(--web-green); font-variant-numeric: tabular-nums; }

body[data-connection="fallback"] .signal-detail { color: var(--web-violet); }
body[data-connection="thinking"] .signal-detail { color: var(--web-green); }
body[data-connection="thinking"] .last-signal { color: var(--web-violet); }
body[data-connection="rebirth"] .app-titlebar,
body[data-connection="waiting-life"] .app-titlebar { background: var(--web-violet); }
body[data-connection="rebirth"] .signal-detail,
body[data-connection="rebirth"] .last-signal,
body[data-connection="waiting-life"] .signal-detail,
body[data-connection="waiting-life"] .last-signal { color: var(--web-green); }
body[data-connection="rebirth"] .scene,
body[data-connection="waiting-life"] .scene {
  border-top-color: var(--web-green);
  border-left-color: var(--web-green);
  box-shadow: 3px 3px 0 var(--web-violet), 6px 6px 0 var(--web-pink);
}
body[data-connection="rebirth"] .scene .panel-titlebar,
body[data-connection="waiting-life"] .scene .panel-titlebar {
  background: linear-gradient(90deg, var(--web-violet) 0 50%, var(--web-green) 50% 100%);
}
body[data-connection="rebirth"] .canvas-frame,
body[data-connection="waiting-life"] .canvas-frame {
  border-top-color: var(--web-green);
  border-left-color: var(--web-green);
}
body[data-connection="reconnecting"] .signal-detail,
body[data-connection="lost"] .signal-detail { color: var(--web-pink); }
/* B45: la placa "REANUDAREMOS TRANSMISIÓN" — tele vieja, tono sereno */
body[data-connection="scheduled"] .signal-detail { color: var(--web-green); }
body[data-connection="scheduled"] .last-signal { color: var(--web-violet); }
body[data-connection="reconnecting"] .last-signal,
body[data-connection="lost"] .last-signal { color: var(--web-pink); }

.punk-sticker {
  padding: 4px 6px;
  border: 2px dashed var(--web-pink);
  background: var(--web-green);
  color: var(--web-black);
  box-shadow: 2px 2px 0 var(--web-violet);
  font: 800 8px/1 var(--web-mono);
  transform: rotate(-2deg);
  white-space: nowrap;
}

.b31-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  grid-template-areas:
    "scene scene scene scene scene scene scene thought thought thought world world"
    "voice voice voice voice metrics metrics metrics talks talks talks world world";
  grid-template-rows: auto 166px;
  gap: 4px;
  padding: 4px;
  align-items: stretch;
  animation: none;
  transition: none;
}

.scene { grid-area: scene; }
.thought { grid-area: thought; }
.voice { grid-area: voice; }
.metrics { grid-area: metrics; }
.world { grid-area: world; }
.talks { grid-area: talks; }

.area-panel {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 2px solid var(--web-black);
  background: var(--web-panel);
  box-shadow: inset 2px 2px 0 var(--web-black), inset -2px -2px 0 var(--web-violet);
  animation: none;
  transition: none;
}

.area-panel[data-active="true"] {
  z-index: 2;
  border-top-color: var(--web-green);
  border-left-color: var(--web-green);
  box-shadow: inset 2px 2px 0 var(--web-black), inset -2px -2px 0 var(--web-green), 3px 3px 0 var(--web-pink);
}

.area-panel[data-active="true"] .panel-titlebar {
  background: linear-gradient(90deg, var(--web-green) 0 50%, var(--web-violet) 50% 76%, var(--web-pink) 76% 100%);
}

.area-panel[data-active="true"] .panel-status {
  border-top-color: var(--web-green);
  color: var(--web-green);
}

.thought[data-active="true"] .thought-copy {
  font-size: clamp(15px, 1.35vw, 20px);
}

.talks[data-active="true"] .chat-list > li { font-size: 10px; }
.talks[data-active="true"] .chat-card b,
.talks[data-active="true"] .chat-card span { font-size: 9px; }

.panel-titlebar {
  min-height: 22px;
  flex: 0 0 22px;
  gap: 4px;
  padding: 2px 3px 2px 5px;
  border: 2px solid var(--web-black);
  border-top-color: var(--web-pink);
  border-left-color: var(--web-pink);
  background: linear-gradient(90deg, var(--web-violet) 0 64%, var(--web-pink) 64% 100%);
  font: 700 9px/1 var(--web-mono);
}

.panel-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.panel-value {
  min-width: 0;
  margin-left: auto;
  overflow: hidden;
  color: var(--web-black);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.panel-body {
  min-width: 0;
  min-height: 0;
  flex: 1;
  padding: 5px;
  border: 2px solid var(--web-black);
  border-right-color: var(--web-violet);
  border-bottom-color: var(--web-violet);
  background: var(--web-black);
}

.panel-status {
  min-height: 19px;
  flex: 0 0 19px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  padding: 2px 4px;
  border-top: 2px solid var(--web-violet);
  background: var(--web-panel);
  color: var(--web-violet);
  font-size: 8px;
  white-space: nowrap;
}

.panel-state { min-width: 0; overflow: hidden; color: var(--web-pink); text-overflow: ellipsis; }
.status-signal { color: var(--web-pink); }
body[data-connection="live"] .panel-state,
body[data-connection="live"] .status-signal { color: var(--web-green); }
body[data-connection="fallback"] .panel-state,
body[data-connection="fallback"] .status-signal { color: var(--web-violet); }

.canvas-frame {
  position: relative;
  width: 100%;
  height: auto;
  flex: 0 0 auto;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  display: grid;
  border: 2px solid var(--web-black);
  border-right-color: var(--web-violet);
  border-bottom-color: var(--web-violet);
  background:
    linear-gradient(90deg, transparent 0 49%, var(--web-panel) 49% 51%, transparent 51% 100%),
    linear-gradient(0deg, transparent 0 49%, var(--web-panel) 49% 51%, transparent 51% 100%),
    repeating-conic-gradient(from 45deg, var(--web-violet) 0 25%, var(--web-black) 0 50%) 0 0 / 4px 4px;
  box-shadow: inset 2px 2px 0 var(--web-pink);
  image-rendering: pixelated;
}

.canvas-frame::before {
  content: "[ SIN SEÑAL // SIN DATO ]";
  position: absolute;
  z-index: 0;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--web-violet);
  font: 700 clamp(10px, 1vw, 14px) var(--web-mono);
}

.canvas-frame::after {
  content: "// CASA";
  position: absolute;
  z-index: 2;
  right: 8px;
  bottom: 7px;
  padding: 3px 5px;
  border: 2px solid var(--web-black);
  background: var(--web-green);
  color: var(--web-black);
  font-size: 8px;
  transform: rotate(2deg);
}

#room-canvas {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  display: block;
  outline: none;
  image-rendering: pixelated;
}

#room-canvas:focus-visible { box-shadow: inset 0 0 0 2px var(--web-green); }

.copy-slot {
  position: relative;
  overflow: auto;
  border-style: dashed;
  background: repeating-linear-gradient(0deg, var(--web-black) 0 15px, var(--web-panel) 15px 16px);
}

.thought-copy,
.voice-copy {
  min-height: 100%;
  margin: 0;
  overflow-wrap: anywhere;
}

.thought-copy {
  color: var(--web-violet);
  font-size: clamp(13px, 1.2vw, 18px);
  line-height: 1.4;
}

.thought-copy::before { content: ">> "; color: var(--web-green); }

.voice-copy {
  color: var(--web-pink);
  font-size: clamp(12px, 1vw, 16px);
  line-height: 1.35;
}

.voice-copy::before { content: "[LUNA] "; color: var(--web-green); }

.metric-grid {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: repeat(3, minmax(0, 1fr));
  gap: 2px;
  overflow: hidden;
}

.metric-card {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(92px, 1fr);
  grid-template-areas: "label value ascii";
  align-items: center;
  gap: 6px;
  padding: 3px 5px;
  overflow: hidden;
  border: 2px solid var(--web-black);
  border-right-color: var(--web-violet);
  border-bottom-color: var(--web-violet);
  background: var(--web-panel);
}

.metric-label {
  grid-area: label;
  overflow: hidden;
  color: var(--web-violet);
  font-size: 8px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metric-value {
  grid-area: value;
  min-height: 0;
  margin: 0;
  overflow: hidden;
  color: var(--web-green);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metric-track {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  border: 0;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.metric-bar {
  position: absolute;
  inset: 1px;
  overflow: hidden;
  color: var(--web-pink);
  font: 700 8px/.55 var(--web-mono);
  letter-spacing: 1px;
  white-space: nowrap;
}

.metric-bar-pink,
.metric-bar-violet,
.metric-bar-green { color: var(--web-pink); }

.metric-ascii {
  grid-area: ascii;
  margin: 0;
  overflow: hidden;
  color: var(--web-pink);
  font-size: 9px;
  letter-spacing: -.05em;
  text-align: right;
  white-space: nowrap;
}

.world-scroll,
.chat-scroll { overflow: auto; }

.world-scroll {
  background: repeating-conic-gradient(from 45deg, var(--web-panel) 0 25%, var(--web-black) 0 50%) 0 0 / 4px 4px;
}

.world-list { display: grid; gap: 2px; margin: 0; }

.world-row {
  min-width: 0;
  padding: 5px 4px;
  border: 1px dashed var(--web-violet);
  background: var(--web-panel);
}

.world-row dt { color: var(--web-violet); font-size: 8px; }

.world-row dd {
  min-height: 1.2em;
  margin: 2px 0 0;
  color: var(--web-pink);
  font-size: 8px;
  line-height: 1.2;
  overflow-wrap: anywhere;
  font-variant-numeric: tabular-nums;
}

.chat-list {
  min-height: 100%;
  display: grid;
  grid-auto-rows: minmax(48px, auto);
  align-content: start;
  gap: 3px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.chat-list > li {
  min-width: 0;
  padding: 4px;
  overflow: hidden;
  border: 2px solid var(--web-black);
  border-left-color: var(--web-violet);
  border-bottom-color: var(--web-violet);
  background: var(--web-panel);
  color: var(--web-pink);
  font-size: 8px;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.chat-card b { display: block; color: var(--web-violet); font-size: 8px; }
.chat-card.luna { border-left-color: var(--web-pink); }
.chat-card.luna b { color: var(--web-pink); }
.chat-card.npc { border-left-color: var(--web-green); }
.chat-card.npc b { color: var(--web-green); }
.chat-card p { margin: 3px 0 0; }
.chat-card span { display: block; margin-top: 3px; color: var(--web-violet); font-size: 8px; }
.chat-empty { display: grid; place-items: center; color: var(--web-violet) !important; }

.app-statusbar {
  min-height: 23px;
  display: flex;
  align-items: center;
  gap: 3px;
  margin: 0 4px 4px;
  padding: 2px 3px;
  border: 2px solid var(--web-black);
  border-top-color: var(--web-violet);
  background: var(--web-panel);
  color: var(--web-pink);
  font-size: 8px;
}

.app-statusbar span {
  min-width: 0;
  padding: 3px 5px;
  overflow: hidden;
  border: 1px solid var(--web-black);
  border-top-color: var(--web-violet);
  border-left-color: var(--web-violet);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-statusbar .status-grow { flex: 1; }
.app-statusbar i {
  width: 18px;
  height: 14px;
  flex: 0 0 18px;
  background: repeating-linear-gradient(135deg, transparent 0 2px, var(--web-violet) 2px 4px);
}

@media (min-width: 981px) {
  .b31-grid[data-focus="thought"] {
    grid-template-areas:
      "scene scene scene scene scene scene thought thought thought thought world world"
      "voice voice voice voice metrics metrics metrics talks talks talks world world";
  }

  .b31-grid[data-focus="talks"] {
    grid-template-areas:
      "scene scene scene scene scene scene scene thought thought thought world world"
      "voice voice voice metrics metrics talks talks talks talks talks world world";
    grid-template-rows: auto clamp(210px, 26vh, 238px);
  }
}

@media (min-width: 1681px) and (min-height: 900px) {
  .app-window { width: min(2400px, 100%); }

  .app-titlebar {
    min-height: 29px;
    font-size: 13px;
  }

  .premise-strip {
    min-height: 25px;
    font-size: 10px;
  }

  .signal-strip {
    min-height: 34px;
    font-size: 9px;
  }

  .b31-grid {
    grid-template-rows: auto clamp(210px, 21vh, 310px);
    gap: 5px;
    padding: 5px;
  }

  .b31-grid[data-focus="talks"] {
    grid-template-rows: auto clamp(270px, 24vh, 350px);
  }

  .panel-titlebar {
    min-height: 24px;
    flex-basis: 24px;
    font-size: 10px;
  }

  .panel-status {
    min-height: 21px;
    flex-basis: 21px;
    font-size: 9px;
  }

  .panel-body { padding: 6px; }
  .thought-copy { font-size: clamp(16px, 1vw, 20px); }
  .thought[data-active="true"] .thought-copy { font-size: clamp(18px, 1.15vw, 23px); }
  .voice-copy { font-size: clamp(14px, .85vw, 18px); }

  .metric-card { padding: 5px 6px; }
  .metric-label,
  .world-row dt,
  .world-row dd,
  .chat-list > li,
  .chat-card b,
  .chat-card span { font-size: 9px; }
  .metric-value { font-size: 12px; }
  .metric-ascii { font-size: 10px; }
  .world-row { padding: 6px 5px; }
  .chat-list { grid-auto-rows: minmax(54px, auto); }
  .talks[data-active="true"] .chat-list > li { font-size: 11px; }
  .talks[data-active="true"] .chat-card b,
  .talks[data-active="true"] .chat-card span { font-size: 10px; }

  .canvas-frame::before { font-size: clamp(12px, .75vw, 16px); }
  .canvas-frame::after,
  .punk-sticker { font-size: 9px; }
  .app-statusbar {
    min-height: 25px;
    font-size: 9px;
  }
}

@media (min-width: 2300px) and (min-height: 1100px) {
  .boot-terminal {
    inline-size: min(100%, 1440px);
    font-size: 22px;
  }

  .boot-title { font-size: 44px; }

  .app-titlebar {
    min-height: 31px;
    font-size: 14px;
  }

  .premise-strip {
    min-height: 27px;
    font-size: 11px;
  }

  .signal-strip {
    min-height: 36px;
    font-size: 10px;
  }

  .b31-grid {
    gap: 6px;
    padding: 6px;
  }

  .panel-titlebar {
    min-height: 26px;
    flex-basis: 26px;
    font-size: 11px;
  }

  .panel-status {
    min-height: 23px;
    flex-basis: 23px;
    font-size: 10px;
  }

  .panel-body { padding: 7px; }
  .thought-copy { font-size: clamp(18px, .85vw, 22px); }
  .thought[data-active="true"] .thought-copy { font-size: clamp(20px, .95vw, 24px); }
  .voice-copy { font-size: clamp(16px, .75vw, 20px); }

  .metric-card { padding: 6px 7px; }
  .metric-label,
  .world-row dt,
  .world-row dd,
  .chat-list > li,
  .chat-card b,
  .chat-card span { font-size: 10px; }
  .metric-value { font-size: 13px; }
  .metric-ascii { font-size: 11px; }
  .world-row { padding: 7px 6px; }
  .chat-list { grid-auto-rows: minmax(60px, auto); }
  .talks[data-active="true"] .chat-list > li { font-size: 12px; }
  .talks[data-active="true"] .chat-card b,
  .talks[data-active="true"] .chat-card span { font-size: 11px; }

  .canvas-frame::before { font-size: clamp(14px, .7vw, 18px); }
  .canvas-frame::after,
  .punk-sticker { font-size: 10px; }
  .app-statusbar {
    min-height: 27px;
    font-size: 10px;
  }
}

@media (max-width: 980px) {
  body { padding: 4px; }

  .b31-grid {
    grid-template-columns: 1fr;
    grid-template-areas:
      "scene"
      "thought"
      "voice"
      "metrics"
      "world"
      "talks";
    grid-template-rows: auto;
  }

  .metric-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-rows: 1fr;
  }
  .metric-card {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: center;
    gap: 0;
    padding: 3px;
  }
  .metric-value {
    min-height: 1.7em;
    display: flex;
    align-items: end;
    margin-top: 2px;
    font-size: clamp(9px, 2.8vw, 12px);
  }
  .metric-ascii { margin-top: 3px; text-align: left; }
  .signal-strip { flex-wrap: wrap; }
  .signal-detail { flex-basis: calc(100% - 64px); }
  .signal-message { flex-basis: 50%; }
}

@media (min-width: 601px) and (max-width: 980px) {
  .thought { height: 190px; }
  .voice { height: 135px; }
  .metrics { height: 130px; }
  .world { height: 390px; }
  .talks { height: 250px; }
  .thought[data-active="true"] { height: 240px; }
  .talks[data-active="true"] { height: 360px; }
}

@media (max-width: 600px) {
  body { padding: 2px; }
  .boot-terminal { padding: 22px; }
  .app-titlebar { font-size: 10px; }
  .titlebar-context,
  .window-controls { display: none; }
  .premise-strip {
    grid-template-columns: 1fr 1fr;
    white-space: normal;
  }
  .premise-strip span { line-height: 1.3; }
  .premise-strip span:last-child { grid-column: 1 / -1; border-top: 1px solid var(--web-violet); }
  .signal-strip { font-size: 8px; }
  .signal-detail { flex: 1 1 100%; }
  .tool-icons,
  .signal-message,
  .signal-separator,
  .punk-sticker { display: none; }
  .last-signal-label { margin-left: 0; }
  .canvas-frame { aspect-ratio: 16 / 7; }
  .thought-copy,
  .voice-copy { min-height: 0; }
  .thought .copy-slot {
    min-height: 48px;
    max-height: 112px;
    flex: 0 1 auto;
  }
  .voice .copy-slot {
    min-height: 42px;
    max-height: 84px;
    flex: 0 1 auto;
  }
  .metric-grid {
    min-height: 64px;
    flex: 0 0 auto;
  }
  .world-scroll {
    max-height: 300px;
    flex: 0 1 auto;
  }
  .chat-scroll {
    max-height: 210px;
    flex: 0 1 auto;
  }
  .thought[data-active="true"] .copy-slot {
    min-height: 96px;
    max-height: 140px;
  }
  .talks[data-active="true"] .chat-scroll {
    min-height: 280px;
    max-height: 340px;
  }
  .metric-grid { gap: 2px; padding: 3px; }
  .metric-card { padding: 2px; }
  .metric-label,
  .metric-value,
  .metric-ascii { font-size: 8px; }
  .app-statusbar { flex-wrap: wrap; }
  .app-statusbar .status-grow { flex-basis: 100%; }
}

@media (hover: hover) and (pointer: fine) {
  html,
  body,
  .app-window,
  .boot-screen {
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32' shape-rendering='crispEdges'%3E%3Cpath fill='%23b14fe0' d='M4 4V30L10 24L14 32H22L18 22H28Z'/%3E%3Cpath fill='%23050407' d='M2 2V28L8 22L12 30H20L16 20H26Z'/%3E%3Cpath fill='%23e86fa4' d='M4 6V22L8 18L14 28H16L12 18H20Z'/%3E%3Cpath fill='%2331d67a' d='M2 2H4V4H2Z'/%3E%3C/svg%3E") 2 2, default;
  }

  :is(input, textarea, [contenteditable="true"], [role="textbox"]),
  .copy-slot,
  .world-scroll,
  .chat-scroll {
    cursor: text;
  }

  :is(a[href], button, summary, [role="button"]) {
    cursor: pointer;
  }
}

@media (hover: none), (pointer: coarse), (forced-colors: active) {
  html,
  body,
  .app-window,
  .boot-screen {
    cursor: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  html[data-boot="play"] .boot-screen { display: none !important; }
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: .001ms !important;
    animation-delay: 0ms !important;
    transition-duration: .001ms !important;
  }
  .signal-state[data-state="rebirth"] { animation: none !important; }
}
