:root {
  color-scheme: dark;
  --panel: rgba(20, 22, 31, 0.8);
  --panel-border: rgba(255, 255, 255, 0.08);
  --text: #f5f7fb;
  --muted: #a9b0c1;
  --bg-base: #0a0b10;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    'Segoe UI',
    sans-serif;
  color: var(--text);
  overflow-x: hidden;
}

body {
  background: var(--bg-base);
  padding: 36px 20px 60px;
  transition: background 500ms ease;
}

button {
  font: inherit;
}

.particle-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
  pointer-events: none;
}

.page-background {
  position: fixed;
  inset: 0;
  overflow: hidden;
  z-index: -1;
  pointer-events: none;
  transition: background 700ms ease;
}

.bg-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(45px);
  opacity: 0.35;
  transition: all 700ms ease;
}

.orb-1 {
  width: 42vw;
  height: 42vw;
  left: -8vw;
  top: -8vw;
  background: rgba(121, 170, 255, 0.24);
}
.orb-2 {
  width: 36vw;
  height: 36vw;
  right: -6vw;
  top: 18vh;
  background: rgba(83, 118, 210, 0.18);
}
.orb-3 {
  width: 44vw;
  height: 44vw;
  left: 28vw;
  bottom: -20vw;
  background: rgba(98, 140, 255, 0.16);
}

.bg-stars {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 700ms ease;
}
.bg-stars::before,
.bg-stars::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle, rgba(255, 255, 255, 0.92) 0 1px, transparent 1.5px),
    radial-gradient(circle, rgba(255, 255, 255, 0.72) 0 1px, transparent 1.5px),
    radial-gradient(circle, rgba(255, 255, 255, 0.9) 0 1.4px, transparent 2px),
    radial-gradient(circle, rgba(255, 248, 230, 0.95) 0 2px, transparent 2.6px);
  background-size:
    120px 120px,
    160px 160px,
    220px 220px,
    300px 300px;
  background-position:
    14px 18px,
    42px 56px,
    70px 14px,
    24px 78px;
}
.bg-stars::after {
  transform: scale(1.08) translate(18px, -12px);
  opacity: 0.65;
}

.app-shell {
  width: min(1140px, 100%);
  margin: 0 auto;
  position: relative;
  z-index: 2;
}

.hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}
.eyebrow {
  margin: 0 0 8px;
  letter-spacing: 0.18em;
  font-size: 0.72rem;
  font-weight: 800;
  color: #79aaff;
}
h1 {
  margin: 0;
  font-size: clamp(2.1rem, 5vw, 4.5rem);
  line-height: 0.96;
  letter-spacing: -0.045em;
}
.subtitle {
  max-width: 780px;
  color: var(--muted);
  line-height: 1.6;
  margin: 16px 0 0;
}

.status-pill {
  border: 1px solid var(--panel-border);
  background: rgba(20, 22, 31, 0.86);
  border-radius: 999px;
  padding: 10px 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  letter-spacing: 0.08em;
  font-size: 0.78rem;
  white-space: nowrap;
}
.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #79aaff;
  box-shadow: 0 0 16px #79aaff;
}

.grid {
  display: grid;
  grid-template-columns: 1.35fr 0.85fr;
  gap: 20px;
}

.panel {
  border: 1px solid var(--panel-border);
  background: var(--panel);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.26);
  border-radius: 24px;
  padding: 24px;
  backdrop-filter: blur(16px);
}

.stage-panel,
.telemetry-panel {
  min-height: 720px;
}

.stage-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

h2 {
  margin: 0 0 6px;
  font-size: 1.15rem;
}
h3 {
  margin: 0 0 10px;
  font-size: 0.98rem;
}

.stage-header p,
.architecture-note {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.sphere-wrap {
  min-height: 390px;
  display: grid;
  place-items: center;
  perspective: 1000px;
}

.sphere {
  width: min(330px, 70vw);
  aspect-ratio: 1;
  border-radius: 50%;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  user-select: none;
  touch-action: none;
  outline: none;
  border: 1px solid rgba(255, 255, 255, 0.25);
  transition:
    transform 0.16s ease,
    box-shadow 0.2s ease,
    filter 0.18s ease;
  background:
    radial-gradient(circle at 32% 24%, rgba(255, 255, 255, 0.46), transparent 18%),
    radial-gradient(circle at 50% 45%, rgba(70, 110, 190, 0.35), transparent 52%),
    radial-gradient(circle at 50% 65%, rgba(40, 53, 95, 0.4), rgba(8, 11, 18, 0.94) 72%);
}
.sphere.idle {
  animation: breathe 3s ease-in-out infinite;
}
.sphere.active {
  transform: scale(1.035);
}
.sphere:focus-visible {
  box-shadow: 0 0 0 4px rgba(121, 170, 255, 0.25);
}

.sphere-glow,
.nebula-layer,
.stars-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.sphere-glow {
  inset: 10%;
  border-radius: 50%;
  filter: blur(24px);
  opacity: 0.82;
}
.sphere-highlight {
  position: absolute;
  width: 36%;
  height: 20%;
  left: 19%;
  top: 13%;
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(255, 255, 255, 0.3), transparent 70%);
  transform: rotate(-22deg);
  filter: blur(5px);
}
.touch-ring {
  position: absolute;
  inset: 18%;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.16);
  opacity: 0;
}
.sphere.active .touch-ring {
  animation: ringPulse 1.2s ease-out infinite;
}

.nebula-layer {
  opacity: 0;
  filter: blur(10px) saturate(1.15);
}
.stars-layer {
  opacity: 0;
}
.stars-layer::before,
.stars-layer::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle, rgba(255, 255, 255, 0.92) 0 1px, transparent 1.5px),
    radial-gradient(circle, rgba(255, 255, 255, 0.72) 0 1px, transparent 1.5px),
    radial-gradient(circle, rgba(255, 255, 255, 0.9) 0 1.4px, transparent 2px),
    radial-gradient(circle, rgba(255, 248, 230, 0.95) 0 2px, transparent 2.6px),
    radial-gradient(circle, rgba(255, 255, 255, 0.72) 0 1px, transparent 1.6px);
  background-size:
    95px 95px,
    130px 130px,
    170px 170px,
    210px 210px,
    155px 155px;
  background-position:
    14px 18px,
    42px 56px,
    70px 14px,
    24px 78px,
    90px 108px;
  mix-blend-mode: screen;
}
.stars-layer::after {
  transform: scale(1.02) translate(12px, -10px);
  opacity: 0.7;
}

.sphere-label {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 2;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.74rem;
  font-weight: 900;
  color: rgba(255, 255, 255, 0.84);
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.7);
}

.selector {
  margin: 10px 0 18px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.chip {
  border-radius: 999px;
  padding: 9px 13px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text);
  cursor: pointer;
}
.chip.active {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.2);
}

.particle-controls {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 18px;
  align-items: center;
  margin-bottom: 18px;
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.14);
}

.toggle-row,
.density-row {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 0.88rem;
}

.density-row input {
  flex: 1;
  min-width: 120px;
}

.density-row strong {
  width: 30px;
  text-align: right;
  color: var(--text);
}

.controls {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

.primary-button,
.secondary-button,
.emotion-button {
  border-radius: 14px;
  padding: 11px 15px;
  cursor: pointer;
  transition: transform 0.12s ease;
}
.primary-button {
  border: 1px solid rgba(255, 173, 87, 0.32);
  color: #1a0d03;
  background: linear-gradient(180deg, #ffd09a, #ff9e4b);
  font-weight: 800;
}
.emotion-button {
  border: 1px solid rgba(154, 233, 255, 0.28);
  color: #151219;
  background: linear-gradient(180deg, #ffd1e5, #9befff);
  font-weight: 800;
}
.secondary-button {
  border: 1px solid var(--panel-border);
  color: var(--text);
  background: rgba(255, 255, 255, 0.055);
}
.primary-button:hover,
.secondary-button:hover,
.emotion-button:hover {
  transform: translateY(-1px);
}

.hint {
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  margin: 14px 0 0;
}
kbd {
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.06);
  padding: 2px 6px;
  border-radius: 6px;
}

.metric-row {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 11px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  color: var(--muted);
}
.metric-row strong {
  color: var(--text);
  text-align: right;
}
.divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
  margin: 22px 0;
}
.event-log {
  height: 270px;
  overflow: auto;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(0, 0, 0, 0.22);
  padding: 12px;
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', monospace;
  font-size: 0.78rem;
  line-height: 1.55;
}
.log-entry {
  padding: 4px 0;
  color: #c9cfdd;
}
.log-entry .time {
  color: #7d879f;
  margin-right: 7px;
}
.log-touch {
  color: #ffd2a2;
}
.log-release {
  color: #a9c7ff;
}
.log-emotion {
  color: #ffd3eb;
}

.architecture-panel {
  margin-top: 20px;
}
.flow {
  margin-top: 18px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}
.flow-box {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 10px 13px;
  border-radius: 12px;
  font-size: 0.87rem;
}
.flow-box.accent {
  border-color: rgba(255, 172, 83, 0.28);
  background: rgba(255, 157, 73, 0.08);
}
.arrow {
  color: #737d92;
}
.architecture-note {
  margin-top: 15px;
  font-size: 0.88rem;
}

/* Retained Presentation motion; palette fields now come from light-expression.js. */
.sphere.emotion-dream.active .nebula-layer {
  opacity: 1;
  animation: nebulaShift 8s ease-in-out infinite alternate;
}
.sphere.emotion-dream.active .stars-layer {
  opacity: 0.95;
  animation: starTwinkle 2.8s ease-in-out infinite;
}
body.bg-dream .bg-stars {
  opacity: 0.95;
  animation: starTwinkle 3s ease-in-out infinite;
}
body.bg-happy .bg-stars {
  opacity: 0.92;
  animation: starTwinkle 2.4s ease-in-out infinite;
}
body.bg-night .bg-stars {
  opacity: 0.42;
}

@keyframes breathe {
  0%,
  100% {
    box-shadow:
      0 0 26px rgba(90, 145, 255, 0.22),
      0 0 70px rgba(90, 145, 255, 0.08);
    transform: scale(0.99);
  }
  50% {
    box-shadow:
      0 0 42px rgba(90, 145, 255, 0.35),
      0 0 100px rgba(90, 145, 255, 0.16);
    transform: scale(1.015);
  }
}
@keyframes warmPulse {
  0%,
  100% {
    filter: brightness(0.95);
  }
  50% {
    filter: brightness(1.14);
  }
}
@keyframes dreamPulse {
  0%,
  100% {
    filter: brightness(0.98) saturate(1);
  }
  50% {
    filter: brightness(1.12) saturate(1.08);
  }
}
@keyframes calmPulse {
  0%,
  100% {
    filter: brightness(0.97);
  }
  50% {
    filter: brightness(1.05);
  }
}
@keyframes happyPulse {
  0%,
  100% {
    filter: brightness(0.98);
  }
  50% {
    filter: brightness(1.16);
  }
}
@keyframes sadPulse {
  0%,
  100% {
    filter: brightness(0.94);
  }
  50% {
    filter: brightness(1.02);
  }
}
@keyframes excitedPulse {
  0%,
  100% {
    filter: brightness(0.96) saturate(1);
  }
  50% {
    filter: brightness(1.2) saturate(1.14);
  }
}
@keyframes nightPulse {
  0%,
  100% {
    filter: brightness(0.92);
  }
  50% {
    filter: brightness(1);
  }
}
@keyframes ringPulse {
  0% {
    transform: scale(0.72);
    opacity: 0.55;
  }
  100% {
    transform: scale(1.45);
    opacity: 0;
  }
}
@keyframes nebulaShift {
  0% {
    transform: translate(-4px, 2px) scale(1);
  }
  100% {
    transform: translate(5px, -4px) scale(1.03);
  }
}
@keyframes starTwinkle {
  0%,
  100% {
    opacity: 0.76;
  }
  50% {
    opacity: 1;
  }
}

@media (max-width: 850px) {
  .grid {
    grid-template-columns: 1fr;
  }
  .hero {
    flex-direction: column;
  }
  .stage-panel,
  .telemetry-panel {
    min-height: auto;
  }
  .sphere-wrap {
    min-height: 350px;
  }
  .particle-controls {
    grid-template-columns: 1fr;
  }
}

/* ---------------- Presentation / Physical Robot View ---------------- */

.view-switch {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  margin-top: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.18);
}

.view-button {
  border: 0;
  border-radius: 10px;
  padding: 9px 13px;
  cursor: pointer;
  color: var(--muted);
  background: transparent;
  font-weight: 700;
}

.view-button.active {
  color: var(--text);
  background: rgba(255, 255, 255, 0.11);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.view-description {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.45;
  margin: 8px 0 0;
}

.led-layer {
  position: absolute;
  inset: 8%;
  border-radius: 50%;
  z-index: 1;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.led-dot {
  position: absolute;
  width: 8px;
  height: 8px;
  margin: -4px 0 0 -4px;
  border-radius: 50%;
  background: rgba(105, 155, 255, 0.18);
  box-shadow: 0 0 5px rgba(105, 155, 255, 0.12);
  opacity: 0.22;
  transition:
    background 0.25s ease,
    box-shadow 0.25s ease,
    opacity 0.25s ease;
}

/* Physical mode keeps the page neutral because those screen visuals are not on the robot. */
body.physical-view .particle-canvas {
  opacity: 0;
}

body.physical-view .page-background {
  background:
    radial-gradient(circle at 50% 18%, rgba(58, 72, 105, 0.16), transparent 32%),
    linear-gradient(180deg, #080a10, #0a0d15 58%, #070910) !important;
}

body.physical-view .bg-orb,
body.physical-view .bg-stars {
  opacity: 0 !important;
}

body.physical-view .sphere {
  background:
    radial-gradient(circle at 32% 24%, rgba(255, 255, 255, 0.15), transparent 17%),
    radial-gradient(circle at 50% 45%, rgba(46, 53, 67, 0.28), transparent 46%),
    radial-gradient(circle at 50% 70%, rgba(16, 19, 28, 0.76), rgba(4, 6, 10, 0.98) 73%) !important;
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow:
    inset 0 0 34px rgba(255, 255, 255, 0.035),
    0 0 38px rgba(80, 110, 170, 0.1) !important;
}

body.physical-view .sphere-glow {
  opacity: 0.2 !important;
}

body.physical-view .nebula-layer,
body.physical-view .stars-layer {
  opacity: 0 !important;
}

body.physical-view .led-layer {
  opacity: 1;
}

body.physical-view .sphere-label {
  color: rgba(255, 255, 255, 0.72);
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.85);
}

/* Physical light color, rhythm, density and glow are sampled in app.js from
   the same expression profiles as the 3D shell. */

/* v6: shared controls, renderer lifecycle, and responsive additions. */
[hidden] {
  display: none !important;
}
.view-switch {
  flex-wrap: wrap;
}
.view-button {
  font-size: 14px;
}
.grid > * {
  min-width: 0;
}
body.robot-3d-view .sphere-wrap,
body.robot-3d-view .particle-canvas,
body.robot-3d-view .page-background {
  display: none;
}
body.robot-3d-view {
  background: #080d18;
}
body.robot-3d-view .stage-panel {
  background: #0d1422;
}
.robot3d-stage {
  position: relative;
  margin: 18px -8px 22px;
  overflow: hidden;
  border: 1px solid #263247;
  border-radius: 18px;
  background: #090f1b;
}
.robot3d-topline {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  padding: 18px 18px 0;
  color: #93a5bd;
  font-size: 12px;
  letter-spacing: 0.08em;
}
.robot3d-viewport {
  width: 100%;
  height: clamp(300px, 36vw, 430px);
}
.robot3d-viewport canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  outline: none;
}
.robot3d-viewport canvas:focus-visible {
  outline: 2px solid #9dc7ff;
  outline-offset: -3px;
}
.robot3d-toolbar {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  padding: 0 18px;
}
.robot3d-toolbar button {
  font-size: 14px;
  padding: 9px 12px;
}
.robot3d-toolbar .toggle-row {
  font-size: 14px;
}
.render-fps {
  margin-left: auto;
  font-size: 12px;
  color: #93a5bd;
  font-variant-numeric: tabular-nums;
}
.robot3d-hint {
  color: #a6b4c8;
  font-size: 14px;
  padding: 0 18px 2px;
  line-height: 1.6;
}
.robot3d-message {
  margin: 0;
  padding: 16px;
  color: #c8dcf8;
}
.volume-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 18px;
  font-size: 14px;
  color: var(--muted);
}
.volume-row input {
  min-width: 70px;
  flex: 1;
  accent-color: #a6c9ff;
}
.volume-row output {
  width: 4ch;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
button:focus-visible,
input:focus-visible {
  outline: 2px solid #a6c9ff;
  outline-offset: 4px;
}
#touchButton {
  touch-action: none;
  user-select: none;
}
.metric-row {
  gap: 12px;
}
.metric-row strong {
  text-align: right;
  overflow-wrap: anywhere;
}
@media (max-width: 480px) {
  .panel {
    padding: 18px;
  }
  .view-switch {
    display: grid;
    grid-template-columns: 1fr;
  }
  .robot3d-toolbar {
    gap: 12px;
  }
  .controls {
    flex-wrap: wrap;
  }
  .stage-header {
    gap: 12px;
  }
  .sphere {
    width: min(330px, 65vw);
  }
}

/* v6.1: full light experience. These replace the deprecated fixed color mappings. */
body {
  --light-1: 184, 218, 239;
  --light-2: 211, 197, 229;
  --light-3: 202, 226, 220;
  --light-power: 0.4;
  --light-glow: 1;
}
body.expression-theme:not(.physical-view) .page-background {
  background:
    radial-gradient(ellipse at 18% 20%, rgba(var(--light-1), 0.18), transparent 44%),
    radial-gradient(ellipse at 83% 58%, rgba(var(--light-2), 0.16), transparent 46%),
    radial-gradient(ellipse at 50% 95%, rgba(var(--light-3), 0.16), transparent 46%), #0b0e17;
}
body.expression-theme .orb-1 {
  background: rgba(var(--light-1), 0.22);
}
body.expression-theme .orb-2 {
  background: rgba(var(--light-2), 0.18);
}
body.expression-theme .orb-3 {
  background: rgba(var(--light-3), 0.16);
}
body.expression-theme:not(.physical-view) .sphere.active,
body.expression-theme:not(.physical-view) .sphere.idle {
  background:
    radial-gradient(ellipse at 30% 23%, rgba(255, 255, 255, 0.75), transparent 22%),
    radial-gradient(ellipse at 35% 35%, rgba(var(--light-1), 0.95), transparent 60%),
    radial-gradient(ellipse at 70% 65%, rgba(var(--light-2), 0.8), transparent 61%),
    radial-gradient(ellipse at 40% 85%, rgba(var(--light-3), 0.9), #2e3542);
  box-shadow:
    0 0 45px rgba(var(--light-1), 0.25),
    0 0 110px rgba(var(--light-2), 0.16);
  animation: expressionBreath var(--light-speed, 6s) ease-in-out infinite;
}
body.expression-theme:not(.physical-view) .sphere .sphere-glow {
  background: radial-gradient(circle, rgba(var(--light-1), 0.4), transparent 70%);
}
body.expression-theme:not(.physical-view) .sphere .nebula-layer {
  background:
    radial-gradient(ellipse at 25% 35%, rgba(var(--light-2), 0.28), transparent 45%),
    radial-gradient(ellipse at 70% 60%, rgba(var(--light-3), 0.28), transparent 45%);
}
body.expression-theme.physical-view .sphere .led-dot {
  animation: none !important;
  background: rgb(var(--led-color, 182, 210, 229)) !important;
  color: rgb(var(--led-color, 182, 210, 229));
  opacity: var(--led-opacity, 0.1) !important;
  box-shadow: 0 0 var(--led-glow, 8px) currentColor !important;
}
@keyframes expressionBreath {
  0%,
  100% {
    filter: brightness(0.94);
  }
  50% {
    filter: brightness(1.08);
  }
}
.expression-controls {
  margin: 16px 0 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 8px 14px;
}
.expression-controls label {
  color: #b5c0cc;
  font-size: 14px;
}
.expression-controls select {
  min-width: 0;
  border: 1px solid #34404f;
  border-radius: 10px;
  background: #151d29;
  color: #e2e9ee;
  font: inherit;
  font-size: 14px;
  padding: 10px 12px;
}
.territory-hint {
  grid-column: 1 / -1;
  margin: 0;
  color: #8998aa;
  font-size: 13px;
}
.expression-description {
  border-left: 2px solid rgba(var(--light-1), 0.45);
  padding-left: 12px;
  margin: 16px 0 20px;
  line-height: 1.6;
}
.expression-description strong {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: #d0d9e3;
}
.expression-description span {
  display: block;
  font-size: 13px;
  color: #95a5b8;
}
select:focus-visible {
  outline: 2px solid #c6dce4;
  outline-offset: 3px;
}
body.robot-3d-view {
  background: #090d14;
  padding-top: 24px;
}
body.robot-3d-view .app-shell {
  width: min(1240px, 100%);
}
body.robot-3d-view .hero {
  margin-bottom: 22px;
  align-items: center;
}
body.robot-3d-view h1 {
  font-size: clamp(2rem, 3.7vw, 3rem);
  line-height: 1.05;
}
body.robot-3d-view .eyebrow {
  color: #a3b4be;
  font-size: 12px;
  font-weight: 600;
}
body.robot-3d-view .subtitle {
  margin-top: 10px;
  font-size: 15px;
}
body.robot-3d-view .grid {
  grid-template-columns: minmax(0, 1.9fr) minmax(290px, 0.9fr);
  gap: 20px;
  align-items: start;
}
body.robot-3d-view .stage-panel {
  background: #101721;
  border-color: #27313e;
  padding: 22px;
}
body.robot-3d-view .telemetry-panel {
  background: #0f151e;
  padding: 22px;
}
body.robot-3d-view .stage-header p {
  font-size: 14px;
}
body.robot-3d-view .view-description {
  font-size: 14px;
  line-height: 1.5;
  margin: 10px 0 0;
}
body.robot-3d-view .robot3d-stage {
  margin: 16px -8px 18px;
  background: #0c121b;
  border-color: #25303b;
  border-radius: 20px;
}
body.robot-3d-view .robot3d-topline {
  font-size: 12px;
  color: #81929f;
  padding: 16px 18px 0;
}
body.robot-3d-view .robot3d-viewport {
  height: clamp(340px, 38vw, 480px);
}
body.robot-3d-view .robot3d-message {
  font-size: 12px;
  color: #8798a7;
  padding: 0 18px 12px;
}
body.robot-3d-view .robot3d-hint {
  font-size: 13px;
  color: #91a0af;
}
body.robot-3d-view .metric-row {
  padding: 13px 0;
  font-size: 14px;
}
body.robot-3d-view .metric-row strong {
  font-size: 13px;
  font-weight: 600;
}
body.robot-3d-view .chip {
  font-size: 14px;
  padding: 9px 13px;
}
body.robot-3d-view .controls {
  justify-content: flex-start;
  gap: 10px;
}
body.robot-3d-view .controls button {
  font-size: 14px;
  padding: 12px 16px;
}
body.robot-3d-view .primary-button {
  background: #e0e9ec;
  color: #14212b;
}
body.robot-3d-view .emotion-button {
  background: #aebfc9;
  color: #14212b;
}
body.robot-3d-view .event-log {
  max-height: 180px;
  min-height: 80px;
}
@media (max-width: 900px) {
  body.robot-3d-view .grid {
    grid-template-columns: 1fr;
  }
  body.robot-3d-view .hero {
    align-items: flex-start;
  }
}
@media (max-width: 480px) {
  body.robot-3d-view {
    padding: 20px 12px 36px;
  }
  body.robot-3d-view .stage-panel,
  body.robot-3d-view .telemetry-panel {
    padding: 16px;
  }
  .expression-controls {
    grid-template-columns: 1fr;
  }
  body.robot-3d-view .robot3d-viewport {
    height: 330px;
  }
}

/* v6.2: let the fuller particle field show through the Presentation panels. */
body:not(.physical-view):not(.robot-3d-view) .panel {
  background: rgba(14, 18, 28, 0.66);
  backdrop-filter: blur(5px);
}

/* v6.3: reference-based body and visible orb animation controls. */
body.robot-3d-view .robot3d-viewport {
  height: clamp(420px, 42vw, 530px);
}
@media (max-width: 480px) {
  body.robot-3d-view .robot3d-viewport {
    height: 380px;
  }
}

/* Source control stays below the visual; all modes share the existing controller. */
.api-controls {
  margin: 18px 0;
  padding: 16px;
  border: 1px solid #354354;
  border-radius: 14px;
  background: rgba(11, 17, 26, 0.8);
}
.api-controls label {
  display: block;
  font-size: 13px;
  color: #b9c6d1;
  margin: 8px 0 6px;
}
.api-controls select,
.api-controls input[type='file'] {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  background: #172331;
  color: #edf2f7;
  border: 1px solid #394b5d;
  border-radius: 8px;
  padding: 9px;
  font: inherit;
  font-size: 13px;
}
.api-controls input[type='range'] {
  width: 100%;
}
.api-controls p,
.asset-note {
  font-size: 12px;
  color: #aab9c8;
  line-height: 1.5;
}
.api-controls details {
  margin-top: 10px;
}
.api-controls summary,
.api-telemetry summary {
  cursor: pointer;
  color: #c6d4df;
  font-size: 13px;
}
.api-actions {
  display: flex;
  gap: 10px;
  margin-top: 12px;
  flex-wrap: wrap;
}
.api-telemetry {
  margin: 15px 0;
  padding: 12px;
  background: #0b111a;
  border: 1px solid #293746;
  border-radius: 10px;
}
.api-telemetry dl {
  margin: 8px 0 0;
  font-size: 12px;
}
.api-telemetry dl div {
  display: flex;
  gap: 12px;
  justify-content: space-between;
  padding: 5px 0;
}
.api-telemetry dt {
  color: #99aabd;
  flex-shrink: 0;
}
.api-telemetry dd {
  margin: 0;
  text-align: right;
  overflow-wrap: anywhere;
  min-width: 0;
}
.reference-background {
  position: fixed;
  inset: 0;
  z-index: -1;
  background-size: cover;
  background-position: center;
  pointer-events: none;
  transition: opacity 700ms ease;
}
.reference-background::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(5, 9, 18, 0.1), rgba(5, 9, 18, 0.36));
}
body.has-reference:not(.physical-view):not(.robot-3d-view) .page-background {
  opacity: 0.22;
}
.robot3d-viewport {
  background-size: cover;
  background-position: center;
}
[hidden] {
  display: none !important;
}

/* The source artwork remains behind the robot, never on its shell. */
.reference-motion {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
  z-index: 0;
}
.reference-background::after {
  z-index: 1;
}
.robot3d-viewport {
  position: relative;
  overflow: hidden;
  isolation: isolate;
}
.robot3d-viewport canvas {
  position: relative;
  z-index: 1;
}
.reference-background,
.robot3d-viewport {
  animation: reference-drift var(--reference-duration, 80s) ease-in-out infinite alternate;
}
@keyframes reference-drift {
  from {
    background-position: 48% 49%;
  }
  to {
    background-position: 52% 51%;
  }
}
@media (prefers-reduced-motion: reduce) {
  .reference-background,
  .robot3d-viewport {
    animation: none;
  }
  .reference-motion {
    display: none;
  }
}

/* v6.6.1: two-view navigation and Presentation background-only inspection. */
.presentation-options {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 10px 0 2px;
}
.presentation-options[hidden] {
  display: none !important;
}
.background-only-button {
  padding: 9px 12px;
  font-size: 13px;
}
.background-only-hint {
  color: #95a5b8;
  font-size: 12px;
  line-height: 1.45;
  flex: 1 1 260px;
}
.background-only-toolbar {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 50;
  display: flex;
  gap: 8px;
  align-items: center;
}
.background-only-toolbar .secondary-button {
  background: rgba(8, 12, 19, 0.78);
  border-color: rgba(220, 232, 245, 0.28);
  backdrop-filter: blur(8px);
  box-shadow: 0 10px 36px rgba(0, 0, 0, 0.28);
}
body.background-only {
  overflow: hidden;
  background: #050912;
}
body.background-only .app-shell {
  display: none;
}
body.background-only .particle-canvas {
  display: block;
  z-index: 1;
}
body.background-only.has-reference .page-background {
  display: none;
}
body.background-only .reference-background {
  z-index: 0;
  opacity: 1 !important;
  animation-duration: var(--reference-duration, 80s);
}
body.background-only .reference-background::after {
  display: none;
}
body.background-only .reference-motion {
  z-index: 0;
  object-fit: cover;
}
@media (max-width: 480px) {
  .background-only-toolbar {
    top: 10px;
    right: 10px;
    left: 10px;
    justify-content: flex-end;
    flex-wrap: wrap;
  }
  .presentation-options {
    align-items: flex-start;
  }
}

/* v6.6.2: keep 3D Robot View reachable while Presentation Background Only is active. */
body.background-only .background-only-toolbar {
  display: flex;
}

/* v6.6.3: two reusable 3D layers, below the robot and on its orb. */
.robot3d-viewport canvas[data-renderer] {
  position: relative;
  z-index: 2;
}
.robot3d-viewport canvas.robot-environment-particles {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  touch-action: auto;
}

.public-return {
  display: block;
  max-width: 1240px;
  margin: 0 auto 18px;
  color: #d7c8a8;
  font: 13px system-ui;
  text-decoration: none;
}

.environment-select {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  margin: 10px 0;
}
.environment-select select {
  background: #151923;
  color: #ede6d9;
  border: 1px solid #59616e;
  border-radius: 4px;
  min-height: 40px;
  padding: 6px 10px;
}

.chip[hidden] {
  display: none !important;
}

.reference-dissolve {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  pointer-events: none;
  z-index: 0;
}
.reference-dissolve canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.environment-select[hidden] {
  display: none !important;
}
@media (prefers-reduced-motion: reduce) {
  .reference-dissolve {
    display: none;
  }
}
