:root {
  color-scheme: light;
  --bg: #f5efe4;
  --panel: rgba(255, 252, 246, 0.82);
  --panel-strong: rgba(255, 251, 243, 0.95);
  --border: rgba(106, 73, 32, 0.16);
  --text: #2f2418;
  --muted: #6e5b48;
  --accent: #de7a41;
  --accent-deep: #b85728;
  --shadow: 0 22px 60px rgba(91, 57, 22, 0.12);
  --joy: #f8bc42;
  --sadness: #6aa6f8;
  --anger: #ef6b56;
  --fear: #957ce6;
  --disgust: #6cb16c;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(255, 215, 158, 0.65), transparent 28%),
    radial-gradient(circle at bottom right, rgba(150, 213, 255, 0.55), transparent 24%),
    linear-gradient(135deg, #f8f2e6 0%, #f1e6d3 46%, #efe6dd 100%);
}

.app-shell {
  display: grid;
  grid-template-columns: 1.05fr 1.4fr 1.15fr;
  gap: 18px;
  min-height: 100vh;
  padding: 20px;
}

.panel {
  background: var(--panel);
  backdrop-filter: blur(18px);
  border: 1px solid var(--border);
  border-radius: 28px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.baby-panel,
.console-panel {
  display: flex;
  flex-direction: column;
  padding: 22px;
  gap: 18px;
}

.chat-panel {
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.chat-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 22px 22px 0;
}

.eyebrow {
  margin: 0 0 6px;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

h1,
h2,
p {
  margin: 0;
}

.muted {
  color: var(--muted);
}

.baby-card {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 18px;
  align-items: center;
}

.baby-orb {
  display: grid;
  place-items: center;
  width: 130px;
  height: 130px;
  border-radius: 34px;
  background:
    radial-gradient(circle at 25% 25%, rgba(255, 255, 255, 0.95), transparent 26%),
    linear-gradient(160deg, #f9d985, #efa877 45%, #98c9ff 100%);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.35), 0 16px 40px rgba(125, 73, 22, 0.22);
}

.baby-face {
  width: 86px;
  height: 86px;
  border-radius: 24px;
  display: grid;
  place-items: center;
  font-weight: 700;
  color: white;
  background: rgba(73, 42, 16, 0.24);
  border: 1px solid rgba(255,255,255,0.2);
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.metric-card,
.status-card,
.memory-card,
.consensus-card,
.operations-scene-card,
.operations-card,
.agent-card {
  background: var(--panel-strong);
  border: 1px solid var(--border);
  border-radius: 22px;
}

.metric-card {
  padding: 16px;
}

.metric-card span {
  display: block;
  margin-bottom: 10px;
  font-size: 13px;
  color: var(--muted);
}

.metric-card strong {
  font-size: 24px;
}

.status-card,
.memory-card,
.consensus-card,
.operations-scene-card,
.operations-card {
  padding: 18px;
}

.operations-scene {
  position: relative;
  margin-top: 12px;
  min-height: 420px;
  border-radius: 24px;
  overflow: hidden;
  border: 1px solid rgba(103, 184, 214, 0.14);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0)),
    radial-gradient(circle at 50% -8%, rgba(168, 235, 255, 0.18), transparent 34%),
    linear-gradient(180deg, #162433 0%, #1d2d3f 52%, #243647 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
}

.scene-toolbar {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 4;
  display: flex;
  gap: 8px;
}

.scene-tool-button {
  min-width: 38px;
  height: 34px;
  padding: 0 12px;
  border: 1px solid rgba(128, 210, 235, 0.16);
  border-radius: 999px;
  background: rgba(8, 15, 23, 0.82);
  color: rgba(231, 248, 255, 0.88);
  font: inherit;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(4, 8, 14, 0.2);
}

.scene-tool-button:hover {
  background: rgba(16, 28, 40, 0.96);
}

.scene-viewport {
  position: relative;
  min-height: 420px;
  overflow: hidden;
  cursor: grab;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0)),
    radial-gradient(circle at 50% 42%, rgba(146, 212, 240, 0.12), transparent 62%);
}

.scene-viewport.is-dragging {
  cursor: grabbing;
}

.scene-world {
  position: absolute;
  inset: 0 auto auto 0;
  width: 1120px;
  height: 820px;
  transform-origin: 0 0;
  will-change: transform;
  background: #1b2733;
}

.scene-bg,
.town-links,
.town-buildings {
  position: absolute;
  inset: 0;
}

.town-links {
  image-rendering: pixelated;
}

.pixel-backdrop {
  background:
    linear-gradient(180deg, #2b3f4f 0%, #314c5d 24%, #273744 24%, #273744 100%);
}

.pixel-far-buildings::before,
.pixel-far-buildings::after,
.pixel-mid-buildings::before,
.pixel-mid-buildings::after {
  content: "";
  position: absolute;
  image-rendering: pixelated;
}

.pixel-far-buildings::before {
  left: 108px;
  top: 126px;
  width: 220px;
  height: 176px;
  background:
    linear-gradient(180deg, #5b7a8f 0 18%, #425c6d 18% 100%),
    repeating-linear-gradient(90deg, #89d8eb 0 10px, transparent 10px 22px),
    repeating-linear-gradient(180deg, transparent 0 20px, rgba(0,0,0,0.12) 20px 22px);
  background-blend-mode: normal, screen, normal;
  box-shadow: 264px 18px 0 0 #476476, 264px 18px 0 0 inset;
}

.pixel-far-buildings::after {
  left: 692px;
  top: 136px;
  width: 174px;
  height: 148px;
  background:
    linear-gradient(180deg, #5f8195 0 16%, #476172 16% 100%),
    repeating-linear-gradient(90deg, #ffcf7c 0 9px, transparent 9px 20px);
  background-blend-mode: normal, screen;
}

.pixel-mid-buildings::before {
  left: 204px;
  top: 224px;
  width: 236px;
  height: 128px;
  background:
    linear-gradient(180deg, #4c6878 0 16%, #334855 16% 100%),
    repeating-linear-gradient(90deg, #8be7f1 0 12px, transparent 12px 24px);
  background-blend-mode: normal, screen;
  box-shadow: 286px -12px 0 0 #3d5565;
}

.pixel-mid-buildings::after {
  left: 756px;
  top: 232px;
  width: 124px;
  height: 106px;
  background:
    linear-gradient(180deg, #4e6c80 0 14%, #324754 14% 100%),
    repeating-linear-gradient(90deg, #90d9ee 0 8px, transparent 8px 18px);
  background-blend-mode: normal, screen;
}

.pixel-platform-shadow::before {
  content: "";
  position: absolute;
  left: 168px;
  top: 540px;
  width: 760px;
  height: 158px;
  background: #182129;
  box-shadow: 0 20px 0 #141b21;
}

.pixel-floor-tile::before {
  content: "";
  position: absolute;
  left: 154px;
  top: 504px;
  width: 792px;
  height: 168px;
  background:
    linear-gradient(180deg, #6a8ea2 0 18%, #496776 18% 100%),
    repeating-linear-gradient(90deg, rgba(255,255,255,0.14) 0 24px, transparent 24px 48px),
    repeating-linear-gradient(180deg, transparent 0 24px, rgba(0,0,0,0.16) 24px 26px);
  background-blend-mode: normal, overlay, normal;
}

.pixel-floor-edge::before,
.pixel-floor-edge::after {
  content: "";
  position: absolute;
  background: #9ec6d3;
}

.pixel-floor-edge::before {
  left: 154px;
  top: 500px;
  width: 792px;
  height: 10px;
}

.pixel-floor-edge::after {
  left: 154px;
  top: 670px;
  width: 792px;
  height: 8px;
  background: #273945;
}

.pixel-cable-lane::before {
  content: "";
  position: absolute;
  height: 12px;
  background:
    repeating-linear-gradient(90deg, #1d2a33 0 14px, #2d4350 14px 28px);
  box-shadow: inset 0 2px 0 rgba(255,255,255,0.12);
}

.lane-main::before {
  left: 234px;
  top: 612px;
  width: 612px;
}

.lane-side::before {
  left: 490px;
  top: 548px;
  width: 18px;
  height: 112px;
}

.pixel-rail::before,
.pixel-rail::after {
  content: "";
  position: absolute;
  background: #8fe1f0;
}

.rail-left::before {
  left: 208px;
  top: 520px;
  width: 12px;
  height: 122px;
}

.rail-left::after {
  left: 220px;
  top: 520px;
  width: 42px;
  height: 10px;
}

.rail-right::before {
  left: 870px;
  top: 520px;
  width: 12px;
  height: 122px;
}

.rail-right::after {
  left: 828px;
  top: 520px;
  width: 42px;
  height: 10px;
}

.pixel-console-glow::before {
  content: "";
  position: absolute;
  left: 372px;
  top: 506px;
  width: 352px;
  height: 86px;
  background: radial-gradient(circle, rgba(118, 239, 255, 0.18), transparent 70%);
  filter: blur(8px);
}

.scene-sprite-layer {
  position: absolute;
  inset: 0;
  image-rendering: pixelated;
}

.scene-sprite-layer {
  --core-theme: #7cecff;
}

.scene-sprite-layer.theme-joy {
  --core-theme: #ffd166;
}

.scene-sprite-layer.theme-sadness {
  --core-theme: #8ecae6;
}

.scene-sprite-layer.theme-anger {
  --core-theme: #ff6b6b;
}

.scene-sprite-layer.theme-fear {
  --core-theme: #b8a1ff;
}

.scene-sprite-layer.theme-disgust {
  --core-theme: #90be6d;
}

.town-buildings {
  image-rendering: pixelated;
}

.pixel-agent-stage {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: 128px;
  transform: translate(-50%, -50%);
  transition: left 360ms ease, top 360ms ease, transform 220ms ease, filter 220ms ease, opacity 220ms ease;
}

.pixel-agent-stage.is-idle {
  opacity: 0.86;
}

.pixel-agent-stage.is-away .pixel-station {
  opacity: 0.42;
}

.pixel-agent-stage.is-home .pixel-station {
  opacity: 1;
}

.pixel-agent-stage.is-active {
  transform: translate(-50%, -54%);
  filter: drop-shadow(0 0 8px color-mix(in srgb, var(--agent-color) 42%, transparent));
}

.pixel-agent-stage.is-dominant {
  transform: translate(-50%, -58%) scale(1.04);
  filter: drop-shadow(0 0 14px color-mix(in srgb, var(--agent-color) 50%, transparent));
}

.pixel-agent-stage.is-interrupting {
  animation: pixelJitter 280ms steps(2, end) infinite;
}

.pixel-agent-stage.is-active .pixel-agent-body,
.pixel-agent-stage.is-dominant .pixel-agent-body {
  animation: pixelBob 680ms steps(2, end) infinite;
}

.pixel-agent-stage.is-away .pixel-agent-body {
  filter: drop-shadow(0 0 6px color-mix(in srgb, var(--agent-color) 28%, transparent));
}

.pixel-station {
  position: relative;
  width: 104px;
  height: 64px;
  margin: 0 auto;
}

.pixel-station-top,
.pixel-station-monitor,
.pixel-station-desk,
.pixel-station-prop,
.pixel-station-accent {
  position: absolute;
  image-rendering: pixelated;
}

.pixel-station-top {
  left: 12px;
  top: 0;
  width: 80px;
  height: 6px;
  background: color-mix(in srgb, var(--agent-color) 70%, #d8eef4);
}

.pixel-station-monitor {
  left: 30px;
  top: 8px;
  width: 44px;
  height: 22px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--agent-color) 65%, #dcffff) 0 18%, #193744 18% 100%);
  box-shadow: 0 0 0 4px #22313a;
}

.pixel-station-desk {
  left: 8px;
  top: 36px;
  width: 88px;
  height: 16px;
  background: #4a6574;
  box-shadow: 0 6px 0 #2a3d48;
}

.pixel-station-prop {
  right: 8px;
  top: 24px;
  width: 12px;
  height: 12px;
  background: color-mix(in srgb, var(--agent-color) 72%, #ffe8ad);
  box-shadow: 0 0 0 2px #24323a;
}

.pixel-station-accent {
  left: 10px;
  top: 22px;
  width: 14px;
  height: 20px;
  background: color-mix(in srgb, var(--agent-color) 70%, #ecffff);
}

.pixel-agent-body {
  position: relative;
  width: 44px;
  height: 68px;
  margin: 4px auto 0;
}

.pixel-agent-stage.facing-left .pixel-agent-body {
  transform: scaleX(-1);
}

.pixel-agent-stage.facing-left .pixel-agent-label,
.pixel-agent-stage.facing-left .pixel-agent-signal {
  transform: none;
}

.pixel-agent-signal {
  width: 30px;
  height: 10px;
  margin: 0 auto 4px;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.pixel-agent-signal::before,
.pixel-agent-signal::after {
  content: "";
  display: block;
  margin: 0 auto;
  background: color-mix(in srgb, var(--agent-color) 76%, #f3feff);
}

.pixel-agent-signal::before {
  width: 18px;
  height: 4px;
}

.pixel-agent-signal::after {
  width: 8px;
  height: 4px;
  margin-top: 2px;
}

.pixel-agent-stage.is-active .pixel-agent-signal,
.pixel-agent-stage.is-dominant .pixel-agent-signal,
.pixel-agent-stage.is-interrupting .pixel-agent-signal {
  opacity: 1;
  transform: translateY(0);
}

.pixel-agent-stage.is-interrupting .pixel-agent-signal {
  animation: pixelSignalBlink 260ms steps(2, end) infinite;
}

.pixel-agent-stage.is-dominant .pixel-agent-signal::before {
  width: 24px;
}

.pixel-agent-stage.is-dominant .pixel-agent-signal::after {
  width: 12px;
}

.pixel-agent-shadow {
  position: absolute;
  left: 8px;
  bottom: 0;
  width: 28px;
  height: 6px;
  background: rgba(16, 24, 31, 0.45);
}

.pixel-agent-head {
  position: absolute;
  left: 12px;
  top: 4px;
  width: 20px;
  height: 18px;
  background: #f4c7a1;
}

.pixel-agent-hair {
  position: absolute;
  left: 10px;
  top: 0;
  width: 24px;
  height: 10px;
  background: #243642;
}

.pixel-agent-accessory {
  position: absolute;
  left: 16px;
  top: 20px;
  width: 12px;
  height: 6px;
  background: color-mix(in srgb, var(--agent-color) 62%, #f4f8fa);
}

.pixel-agent-eye {
  position: absolute;
  top: 12px;
  width: 3px;
  height: 3px;
  background: #17242c;
}

.pixel-agent-eye.eye-left {
  left: 18px;
}

.pixel-agent-eye.eye-right {
  left: 25px;
}

.pixel-agent-torso {
  position: absolute;
  left: 10px;
  top: 24px;
  width: 24px;
  height: 20px;
  background: color-mix(in srgb, var(--agent-color) 78%, #f4f8fa);
}

.pixel-agent-arm,
.pixel-agent-leg {
  position: absolute;
  background: #20303a;
}

.pixel-agent-arm.arm-left {
  left: 6px;
  top: 26px;
  width: 6px;
  height: 18px;
}

.pixel-agent-arm.arm-right {
  right: 6px;
  top: 26px;
  width: 6px;
  height: 18px;
}

.pixel-agent-leg.leg-left {
  left: 12px;
  top: 46px;
  width: 7px;
  height: 18px;
}

.pixel-agent-leg.leg-right {
  left: 24px;
  top: 46px;
  width: 7px;
  height: 18px;
}

.pixel-agent-label {
  display: grid;
  gap: 2px;
  margin-top: 8px;
  text-align: center;
  color: #e9f7fb;
  text-shadow: 0 1px 0 rgba(18, 29, 38, 0.65);
}

.pixel-agent-label strong {
  font-size: 11px;
}

.pixel-agent-label span {
  font-size: 10px;
  color: rgba(233, 247, 251, 0.78);
}

.stage-joy .pixel-station-prop {
  background: #ffd166;
}

.stage-joy .pixel-station-accent {
  width: 18px;
  height: 10px;
  top: 18px;
  background: #ffe27a;
  box-shadow: 16px 0 0 #ffe27a;
}

.stage-joy .pixel-agent-hair {
  background: #ffb703;
}

.stage-joy .pixel-agent-accessory {
  top: 24px;
  width: 12px;
  height: 8px;
  background: #ffd166;
  box-shadow: -6px 2px 0 -2px #ffd166, 6px 2px 0 -2px #ffd166;
}

.stage-sadness .pixel-station-prop {
  background: #8ecae6;
}

.stage-sadness .pixel-station-accent {
  width: 12px;
  height: 16px;
  background: #8ecae6;
  box-shadow: 0 12px 0 #5da7cc;
}

.stage-sadness .pixel-agent-hair {
  background: #467ea4;
}

.stage-sadness .pixel-agent-accessory {
  left: 12px;
  top: 26px;
  width: 20px;
  height: 6px;
  background: #8ecae6;
}

.stage-anger .pixel-station-prop {
  background: #ff6b6b;
}

.stage-anger .pixel-station-accent {
  left: 8px;
  top: 20px;
  width: 22px;
  height: 6px;
  background: #ff6b6b;
  box-shadow: 0 10px 0 #d94848;
}

.stage-anger .pixel-agent-hair {
  left: 8px;
  width: 28px;
  height: 8px;
  background: #5a1e1e;
}

.stage-anger .pixel-agent-accessory {
  left: 14px;
  top: 22px;
  width: 16px;
  height: 10px;
  background: #ff6b6b;
}

.stage-anger .pixel-agent-eye {
  top: 11px;
}

.stage-fear .pixel-station-prop {
  background: #b8a1ff;
}

.stage-fear .pixel-station-accent {
  left: 16px;
  top: 12px;
  width: 4px;
  height: 22px;
  background: #b8a1ff;
  box-shadow: 8px -6px 0 #d4c7ff;
}

.stage-fear .pixel-agent-hair {
  left: 11px;
  width: 22px;
  height: 8px;
  background: #6e64aa;
}

.stage-fear .pixel-agent-accessory {
  left: 10px;
  top: 6px;
  width: 24px;
  height: 4px;
  background: #b8a1ff;
  box-shadow: 0 -6px 0 -1px #d4c7ff;
}

.stage-disgust .pixel-station-prop {
  background: #90be6d;
}

.stage-disgust .pixel-station-accent {
  left: 12px;
  top: 18px;
  width: 18px;
  height: 18px;
  background: #90be6d;
  box-shadow: 12px 2px 0 #6ea050;
}

.stage-disgust .pixel-agent-hair {
  left: 8px;
  width: 26px;
  height: 10px;
  background: #5b7f49;
  box-shadow: 6px 4px 0 -2px #5b7f49;
}

.stage-disgust .pixel-agent-accessory {
  left: 12px;
  top: 22px;
  width: 20px;
  height: 8px;
  background: #90be6d;
}

.sprite {
  position: absolute;
}

.workstation-main {
  left: 374px;
  top: 502px;
  width: 340px;
  height: 126px;
}

.sprite-core-aura,
.sprite-core-ring,
.sprite-console-pulse {
  position: absolute;
}

.sprite-core-aura {
  left: 88px;
  top: -18px;
  width: 164px;
  height: 84px;
  background: radial-gradient(circle, color-mix(in srgb, var(--core-theme) 48%, white), transparent 70%);
  opacity: 0.26;
  filter: blur(10px);
}

.sprite-core-ring {
  left: 110px;
  top: -8px;
  width: 120px;
  height: 16px;
  background: color-mix(in srgb, var(--core-theme) 84%, #effbff);
  box-shadow: 0 0 0 4px #22313a;
  opacity: 0.7;
}

.sprite-console-pulse {
  top: 32px;
  width: 28px;
  height: 8px;
  background: color-mix(in srgb, var(--core-theme) 74%, #effbff);
  opacity: 0.35;
}

.pulse-left {
  left: 18px;
}

.pulse-right {
  right: 18px;
}

.sprite-desk-slab {
  position: absolute;
  left: 0;
  top: 42px;
  width: 340px;
  height: 58px;
  background:
    linear-gradient(180deg, #5a7689 0 16%, #354956 16% 100%);
  box-shadow:
    0 10px 0 #22323d,
    26px 58px 0 -18px #1d2a33,
    292px 58px 0 -18px #1d2a33;
}

.sprite-screen {
  position: absolute;
  top: 0;
  width: 74px;
  height: 52px;
  background:
    linear-gradient(180deg, #b3ffff 0 10%, #58d1ea 10% 100%);
  box-shadow: 0 0 0 6px #22323d, 0 8px 0 6px #1a252d;
}

.screen-left {
  left: 28px;
}

.screen-center {
  left: 132px;
  width: 78px;
  background: linear-gradient(180deg, #ffd995 0 10%, #ffb458 10% 100%);
}

.screen-right {
  right: 28px;
}

.sprite-keyboard {
  position: absolute;
  left: 112px;
  top: 82px;
  width: 120px;
  height: 22px;
  background:
    repeating-linear-gradient(90deg, #c4dbe4 0 8px, #7e9aa8 8px 10px);
  box-shadow: 0 0 0 4px #2a3943;
}

.sprite-chair {
  position: absolute;
  left: 132px;
  top: 102px;
  width: 78px;
  height: 22px;
  background: #203039;
  box-shadow:
    18px -38px 0 -10px #314a59,
    50px -38px 0 -10px #314a59,
    26px -60px 0 -12px #4b6577;
}

.scene-sprite-layer.is-idle .sprite-core-aura {
  opacity: 0.18;
}

.scene-sprite-layer.is-active .sprite-core-aura,
.scene-sprite-layer.is-dominant .sprite-core-aura {
  opacity: 0.34;
}

.scene-sprite-layer.is-dominant .sprite-core-ring,
.scene-sprite-layer.is-active .sprite-core-ring {
  box-shadow: 0 0 0 4px #22313a, 0 0 12px color-mix(in srgb, var(--core-theme) 38%, transparent);
}

.scene-sprite-layer.is-active .screen-center,
.scene-sprite-layer.is-dominant .screen-center,
.scene-sprite-layer.is-compose .screen-center {
  background: linear-gradient(180deg, color-mix(in srgb, var(--core-theme) 75%, #ffffff) 0 10%, color-mix(in srgb, var(--core-theme) 88%, #2a5262) 10% 100%);
}

.scene-sprite-layer.is-active .screen-left,
.scene-sprite-layer.is-active .screen-right,
.scene-sprite-layer.is-dominant .screen-left,
.scene-sprite-layer.is-dominant .screen-right,
.scene-sprite-layer.is-compose .screen-left,
.scene-sprite-layer.is-compose .screen-right {
  background: linear-gradient(180deg, color-mix(in srgb, var(--core-theme) 40%, #dcffff) 0 10%, color-mix(in srgb, var(--core-theme) 72%, #193744) 10% 100%);
}

.scene-sprite-layer.is-active .sprite-console-pulse {
  opacity: 0.7;
}

.scene-sprite-layer.is-compose .sprite-core-aura {
  opacity: 0.55;
  animation: workbenchGlow 1000ms ease-in-out infinite;
}

.scene-sprite-layer.is-compose .sprite-core-ring {
  animation: workbenchPulse 820ms steps(2, end) infinite;
}

.scene-sprite-layer.is-compose .sprite-console-pulse {
  opacity: 0.85;
  animation: workbenchSignal 720ms linear infinite;
}

.workstation-side {
  top: 540px;
  width: 122px;
  height: 74px;
  background: linear-gradient(180deg, #567386 0 18%, #344854 18% 100%);
  box-shadow: 0 8px 0 #22303a;
}

.side-left {
  left: 204px;
}

.side-right {
  left: 786px;
}

.neon-crate {
  top: 568px;
  width: 58px;
  height: 58px;
  background:
    linear-gradient(180deg, #4f6d80 0 18%, #2c3d48 18% 100%);
  box-shadow: 0 0 0 4px #1f2b33;
}

.crate-left {
  left: 338px;
}

.crate-right {
  left: 732px;
}

.town-links,
.town-buildings {
  position: absolute;
  inset: 0;
}

.scene-hud {
  position: absolute;
  left: 14px;
  bottom: 14px;
  z-index: 4;
}

.scene-hud-card {
  display: grid;
  gap: 4px;
  min-width: 150px;
  padding: 10px 12px;
  border-radius: 16px;
  background: rgba(8, 14, 20, 0.8);
  border: 1px solid rgba(122, 187, 215, 0.14);
  color: #effcff;
  backdrop-filter: blur(12px);
}

.scene-hud-label {
  font-size: 11px;
  letter-spacing: 0.08em;
  color: rgba(214, 243, 255, 0.72);
  text-transform: uppercase;
}

.town-link {
  display: none;
}

.pixel-link {
  position: absolute;
  left: var(--link-x);
  top: var(--link-y);
  width: var(--link-length);
  height: 8px;
  transform-origin: left center;
  transform: rotate(var(--link-angle));
  opacity: 0.34;
}

.pixel-link-beam,
.pixel-link-pulse {
  position: absolute;
  top: 0;
}

.pixel-link-beam {
  left: 0;
  width: 100%;
  height: 4px;
  background:
    repeating-linear-gradient(90deg, rgba(255,255,255,0.12) 0 10px, color-mix(in srgb, var(--agent-color) 34%, #20303a) 10px 20px);
  box-shadow: 0 1px 0 rgba(20, 30, 38, 0.42);
}

.pixel-link-pulse {
  left: 0;
  width: 18px;
  height: 4px;
  background: color-mix(in srgb, var(--agent-color) 82%, #f6ffff);
  opacity: 0;
}

.pixel-link.is-idle {
  opacity: 0.18;
}

.pixel-link.is-active,
.pixel-link.is-dominant,
.pixel-link.is-compose,
.pixel-link.is-interrupting {
  opacity: 0.92;
}

.pixel-link.is-active .pixel-link-beam {
  background: repeating-linear-gradient(90deg, color-mix(in srgb, var(--agent-color) 64%, #efffff) 0 10px, #29404b 10px 20px);
}

.pixel-link.is-dominant .pixel-link-beam,
.pixel-link.is-compose .pixel-link-beam {
  height: 6px;
  background: repeating-linear-gradient(90deg, color-mix(in srgb, var(--agent-color) 84%, #efffff) 0 12px, #22353f 12px 24px);
  box-shadow: 0 0 10px color-mix(in srgb, var(--agent-color) 34%, transparent);
}

.pixel-link.is-active .pixel-link-pulse,
.pixel-link.is-dominant .pixel-link-pulse,
.pixel-link.is-compose .pixel-link-pulse,
.pixel-link.is-interrupting .pixel-link-pulse {
  opacity: 1;
}

.pixel-link.is-active .pixel-link-pulse {
  animation: pixelSignalTravel 900ms linear infinite;
}

.pixel-link.is-dominant .pixel-link-pulse {
  width: 26px;
  animation: pixelSignalTravel 640ms linear infinite;
}

.pixel-link.is-compose .pixel-link-pulse {
  width: 30px;
  animation: pixelSignalTravel 520ms linear infinite;
}

.pixel-link.is-interrupting .pixel-link-beam {
  background: repeating-linear-gradient(90deg, color-mix(in srgb, var(--agent-color) 74%, #fff2f2) 0 8px, #2e3136 8px 16px);
}

.pixel-link.is-interrupting .pixel-link-pulse {
  width: 14px;
  animation: pixelSignalTravel 380ms linear infinite;
}

.town-link::after {
  content: none;
}

.town-link.is-primary::after {
  content: none;
}

.town-link.is-interrupt::after {
  content: none;
}

.town-link.is-compose::after {
  content: none;
}

.town-link.is-scan {
  display: none;
}

.town-link.is-primary {
  display: none;
}

.memory-list {
  margin: 12px 0 0;
  padding-left: 18px;
  display: grid;
  gap: 10px;
}

.memory-empty {
  color: var(--muted);
}

.section-head,
.console-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 10px;
}

.tag,
.pill,
.dominant-chip {
  display: inline-flex;
  align-items: center;
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(222, 122, 65, 0.12);
  color: var(--accent-deep);
  font-size: 12px;
  border: 1px solid rgba(222, 122, 65, 0.2);
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: end;
}

.pill-muted {
  background: rgba(99, 84, 68, 0.08);
  color: var(--muted);
  border-color: rgba(99, 84, 68, 0.08);
}

.chat-messages {
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow: auto;
}

.message {
  display: grid;
  gap: 6px;
}

.message-user {
  justify-items: end;
}

.message-role {
  font-size: 12px;
  color: var(--muted);
}

.message-bubble {
  max-width: 85%;
  padding: 14px 16px;
  border-radius: 20px;
  line-height: 1.6;
  border: 1px solid var(--border);
}

.message-user .message-bubble {
  background: linear-gradient(135deg, #e37d49, #c36135);
  color: white;
}

.message-baby .message-bubble {
  background: rgba(255, 255, 255, 0.78);
}

.composer {
  display: grid;
  gap: 12px;
  padding: 0 22px 22px;
}

.composer textarea {
  width: 100%;
  resize: vertical;
  border-radius: 22px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.84);
  min-height: 120px;
  padding: 16px;
  font: inherit;
  color: var(--text);
}

.composer-actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.placeholder-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.primary-button,
.ghost-button {
  border: none;
  border-radius: 999px;
  padding: 12px 18px;
  font: inherit;
}

.primary-button {
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  color: white;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(190, 92, 39, 0.24);
}

.primary-button:disabled {
  cursor: wait;
  opacity: 0.7;
}

.ghost-button {
  background: rgba(99, 84, 68, 0.08);
  color: var(--muted);
  cursor: pointer;
}

.upload-button {
  position: relative;
}

.attachment-panel {
  display: grid;
  gap: 12px;
}

.hidden {
  display: none;
}

.image-preview-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.image-preview-item {
  position: relative;
  width: 88px;
  height: 88px;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.7);
}

.image-preview-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.image-preview-remove {
  position: absolute;
  top: 6px;
  right: 6px;
  border: none;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: rgba(47, 36, 24, 0.72);
  color: white;
  cursor: pointer;
}

.audio-transcript {
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px dashed var(--border);
  background: rgba(255,255,255,0.45);
}

.composer-status {
  min-height: 20px;
  color: var(--muted);
  font-size: 13px;
}

.agent-grid {
  display: grid;
  gap: 12px;
}

.task-timeline {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.task-item {
  display: grid;
  grid-template-columns: 38px 1fr;
  gap: 12px;
  align-items: start;
  padding: 12px;
  border-radius: 18px;
  background: rgba(255,255,255,0.58);
  border: 1px solid rgba(106, 73, 32, 0.1);
  opacity: 0.52;
  transform: translateY(8px);
  transition: opacity 220ms ease, transform 220ms ease, border-color 220ms ease;
}

.task-item.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.task-item.is-fallback {
  border-color: rgba(184, 87, 40, 0.28);
  background: rgba(255, 244, 236, 0.82);
}

.task-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 14px;
  color: white;
  font-weight: 700;
  background: linear-gradient(135deg, #c36a37, #8459ce);
}

.task-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.task-title-row strong {
  font-size: 14px;
}

.task-owner {
  font-size: 12px;
  color: var(--muted);
}

.task-detail {
  margin-top: 6px;
  font-size: 13px;
  color: var(--text);
  line-height: 1.5;
}

.agent-card {
  padding: 16px;
  position: relative;
  overflow: hidden;
}

.agent-card::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 4px;
  background: var(--agent-color, var(--accent));
}

.agent-card.is-dominant {
  border-color: color-mix(in srgb, var(--agent-color, var(--accent)) 48%, white);
  box-shadow: 0 12px 28px color-mix(in srgb, var(--agent-color, var(--accent)) 24%, transparent);
}

.agent-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

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

.agent-dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: var(--agent-color, var(--accent));
}

.agent-weight {
  margin-top: 12px;
}

.weight-track {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: rgba(87, 65, 42, 0.08);
  overflow: hidden;
}

.weight-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--agent-color, var(--accent));
}

.weight-label {
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
}

@media (max-width: 1200px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .chat-panel {
    min-height: 720px;
  }

}

@media (max-width: 720px) {
  .operations-scene {
    min-height: 400px;
  }

  .scene-viewport {
    min-height: 400px;
  }

  .scene-toolbar {
    right: 10px;
    top: 10px;
  }

  .scene-tool-button {
    min-width: 34px;
    height: 32px;
    padding: 0 10px;
  }
}

@keyframes pixelWalk {
  0%,
  100% {
    transform: translateX(-50%) translateY(0);
  }
  50% {
    transform: translateX(-50%) translateY(-3px);
  }
}

@keyframes linkPulse {
  0%,
  100% {
    opacity: 0.75;
  }
  50% {
    opacity: 1;
  }
}

@keyframes linkSweep {
  0% {
    opacity: 0.32;
    transform: scale(0.98);
  }
  50% {
    opacity: 1;
    transform: scale(1.02);
  }
  100% {
    opacity: 0.32;
    transform: scale(0.98);
  }
}

@keyframes nodeJolt {
  0%,
  100% {
    transform: translateY(-2px);
  }
  50% {
    transform: translateY(-6px);
  }
}

@keyframes corePulse {
  0%,
  100% {
    opacity: 0.7;
    transform: translateX(-50%) scale(1);
  }
  50% {
    opacity: 1;
    transform: translateX(-50%) scale(1.12);
  }
}

@keyframes pixelJitter {
  0%,
  100% {
    transform: translate(-50%, -50%);
  }
  50% {
    transform: translate(calc(-50% + 2px), calc(-50% - 2px));
  }
}

@keyframes pixelBob {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-2px);
  }
}

@keyframes pixelSignalBlink {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.35;
  }
}

@keyframes workbenchGlow {
  0%,
  100% {
    transform: scale(0.98);
    opacity: 0.46;
  }
  50% {
    transform: scale(1.04);
    opacity: 0.68;
  }
}

@keyframes workbenchPulse {
  0%,
  100% {
    transform: translateY(0);
    opacity: 0.78;
  }
  50% {
    transform: translateY(-2px);
    opacity: 1;
  }
}

@keyframes workbenchSignal {
  0% {
    transform: scaleX(0.6);
    opacity: 0.35;
  }
  50% {
    transform: scaleX(1);
    opacity: 0.95;
  }
  100% {
    transform: scaleX(0.6);
    opacity: 0.35;
  }
}

@keyframes pixelSignalTravel {
  0% {
    transform: translateX(0);
    opacity: 0.2;
  }
  20% {
    opacity: 1;
  }
  100% {
    transform: translateX(calc(var(--link-length) - 24px));
    opacity: 0.25;
  }
}
