:root {
  --bg: var(--sim-paper);
  --panel: var(--sim-glass-soft);
  --panel-strong: var(--sim-glass);
  --border: var(--sim-line);
  --border-strong: var(--sim-line-strong);
  --text: var(--sim-ink);
  --dim: var(--sim-ink-soft);
  --muted: var(--sim-ink-faint);
  --accent: var(--sim-green);
  --accent-ink: var(--sim-paper);
  --teal: var(--sim-green);
  --gold: var(--sim-green);
  --risk: var(--sim-green);
  --ok: var(--sim-green);
  --shadow: var(--sim-shadow);
  color-scheme: light;
  accent-color: var(--accent);
}

.phase-rail-shell {
  position: fixed;
  z-index: 8;
  right: 12px;
  top: 12px;
  width: min(680px, calc(100vw - 24px));
  padding: 8px;
}

.phase-rail {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 4px;
}

.phase-rail-step {
  min-width: 0;
  padding: 6px 4px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--panel);
  color: var(--muted);
  font-size: 10px;
}

.phase-rail-step[data-status="running"] { border-color: var(--accent); color: var(--text); }
.phase-rail-step[data-status="passed"] { background: color-mix(in srgb, var(--accent) 18%, var(--panel)); }
.phase-rail-step[data-status="failed"] { border-color: #c2410c; color: #c2410c; }
.phase-rail-step[data-status="unsupported"] { border-style: dashed; color: #a16207; }
.phase-details { margin: 6px 0; color: var(--dim); font-size: 11px; }

@media (max-width: 520px) {
  .phase-rail-shell { top: 8px; right: 8px; width: calc(100vw - 16px); }
  .phase-rail { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: rgba(0, 255, 0, 0.18);
}

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font: 13px/1.46 ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background:
    radial-gradient(circle at 18% 12%, rgba(255, 0, 255, 0.08), transparent 32%),
    radial-gradient(circle at 84% 78%, rgba(255, 255, 255, 0.06), transparent 34%),
    var(--sim-paper);
}

::selection {
  background: rgba(255, 0, 255, 0.22);
  color: var(--text);
}

.panel {
  color: var(--text);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.86), var(--panel));
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
}

#hud {
  position: fixed;
  top: 14px;
  left: 14px;
  width: min(432px, calc(100vw - 28px));
  max-height: calc(100vh - 28px);
  overflow: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 10;
  scrollbar-color: rgba(255, 255, 255, 0.22) transparent;
}

#hud.panel {
  background: transparent;
  border: 0;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.control-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
}

.brand {
  margin: 0;
  font-size: 12px;
  line-height: 1;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.promise {
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.25;
}

.runtime-badge {
  margin-top: 7px;
  color: var(--teal);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.status {
  max-width: 190px;
  min-height: 1.25em;
  color: var(--dim);
  font-size: 11px;
  line-height: 1.25;
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status[data-kind="ok"] {
  color: var(--ok);
}

label,
.label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.scenario-form {
  display: grid;
  gap: 8px;
}

.prompt-shell {
  position: relative;
}

textarea,
input,
select,
button,
a {
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel-strong);
  color: var(--text);
  font: inherit;
}

textarea,
input,
select {
  width: 100%;
  min-width: 0;
  outline: none;
}

textarea {
  min-height: 88px;
  max-height: 210px;
  resize: vertical;
  padding: 10px;
}

input,
select {
  height: 32px;
  padding: 0 9px;
}

input[type="range"] {
  height: 26px;
  padding: 0;
  background: transparent;
  border: 0;
  appearance: none;
  -webkit-appearance: none;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.12);
}

input[type="range"]::-webkit-slider-thumb {
  width: 18px;
  height: 18px;
  margin-top: -6px;
  border: 2px solid rgba(255, 255, 255, 0.95);
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  appearance: none;
  -webkit-appearance: none;
}

input[type="range"]::-moz-range-track {
  height: 6px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.12);
}

input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.95);
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

textarea:focus,
input:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(0, 255, 0, 0.2);
}

button,
a {
  min-height: 32px;
  padding: 0 11px;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  font-weight: 650;
  transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

button:hover:not(:disabled),
a:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.14);
  transform: translateY(-1px);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.primary-action {
  background: rgba(255, 255, 255, 0.72);
  border-color: rgba(0, 0, 0, 0.18);
  color: var(--sim-ink);
}

.primary-action:hover:not(:disabled) {
  background: var(--accent);
  color: var(--accent-ink);
}

.scenario-examples,
.action-row,
.utility-row {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

.action-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  width: 100%;
}

.scenario-example {
  min-height: 28px;
  padding: 0 9px;
  color: var(--dim);
  font-size: 11px;
}

.action-row button {
  min-width: 0;
  width: 100%;
}

.board-objects {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 1px 0 3px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.22) transparent;
}

.object-chip {
  flex: 0 0 auto;
  min-width: 112px;
  max-width: 168px;
  min-height: 42px;
  padding: 6px 8px;
  text-align: left;
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.045);
  transition: background 0.24s, border-color 0.24s, color 0.24s, opacity 0.24s;
}

.object-chip[data-kind="actor"] {
  border-color: rgba(255, 255, 255, 0.32);
}

.object-chip[data-kind="resource"] {
  border-color: rgba(255, 255, 255, 0.34);
}

.object-chip[data-kind="shock"] {
  border-color: rgba(255, 255, 255, 0.38);
}

.object-chip[data-kind="goal"] {
  border-color: rgba(255, 255, 255, 0.36);
}

.object-chip.is-active {
  background: rgba(255, 255, 255, 0.16);
  border-color: var(--accent);
  color: var(--text);
}

.object-chip strong,
.object-chip span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.object-chip strong {
  color: var(--text);
  font-size: 10px;
  line-height: 1.18;
}

.object-chip span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.metric {
  min-height: 38px;
  padding: 5px 0;
  border-top: 1px solid var(--border);
  background: transparent;
}

.metric strong,
.metric span {
  display: block;
}

.metric strong {
  color: var(--muted);
  font-size: 9px;
  text-transform: uppercase;
}

.metric span {
  color: var(--accent);
  font-size: 16px;
  line-height: 1.18;
  transition: color 0.22s;
}

.worldspec-panel {
  border-top: 1px solid var(--border);
  padding-top: 8px;
  display: grid;
  gap: 7px;
}

.worldspec-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
}

.worldspec-title,
.worldspec-summary {
  margin: 0;
  overflow-wrap: anywhere;
}

.worldspec-title {
  color: var(--dim);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.worldspec-summary {
  color: var(--text);
  font-size: 11px;
  line-height: 1.35;
}

.model-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.chip {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  min-height: 24px;
  padding: 3px 7px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.045);
  color: var(--dim);
  font-size: 10px;
  text-transform: uppercase;
  transition: background 0.24s, border-color 0.24s, color 0.24s;
}

.chip strong {
  color: var(--accent);
  font-weight: 700;
}

.spec-preview {
  max-height: 128px;
  margin: 0;
  overflow: auto;
  padding: 8px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.52);
  color: rgba(0, 0, 0, 0.68);
  font: 10px/1.42 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre-wrap;
}

details {
  border-top: 1px solid var(--border);
  padding-top: 8px;
}

summary {
  cursor: pointer;
  color: var(--dim);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.setup-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 8px;
}

.setup-grid .wide {
  grid-column: 1 / -1;
}

.setup-grid textarea {
  min-height: 54px;
  font-size: 11px;
}

.utility-row {
  margin-top: 8px;
}

.utility-row button {
  flex: 1 1 78px;
  min-height: 30px;
  padding: 0 8px;
  font-size: 11px;
}

.trace-inline {
  border-top: 1px solid var(--border);
  padding-top: 8px;
  display: grid;
  gap: 5px;
}

.trace-inline-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.trace-title,
.room-state,
.replay-summary {
  margin: 0;
  font-size: 11px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.replay-summary {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color 0.24s;
}

.trace-title {
  color: var(--dim);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.room-state {
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.replay-list {
  display: grid;
  gap: 4px;
  max-height: 88px;
  overflow: auto;
  padding-right: 2px;
}

.replay-item {
  border-left: 1px solid rgba(255, 255, 255, 0.42);
  padding-left: 7px;
  cursor: pointer;
}

.replay-item:hover,
.replay-item:focus-visible {
  border-left-color: var(--accent);
  outline: none;
}

.replay-item strong,
.replay-item span {
  display: block;
}

.replay-item strong {
  color: var(--text);
  font-size: 11px;
  text-transform: uppercase;
}

.replay-item span {
  color: var(--dim);
  font-size: 11px;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.copyright {
  position: fixed;
  left: 14px;
  bottom: 10px;
  z-index: 3;
  color: rgba(255, 255, 255, 0.42);
  font-size: 10px;
  letter-spacing: 0.08em;
  pointer-events: none;
  text-transform: uppercase;
}

.room-tools {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
}

.room-tools button {
  min-width: 0;
}

@media (max-width: 760px) {
  #hud {
    top: 10px;
    left: 10px;
    width: calc(100vw - 20px);
    max-height: 59vh;
  }

  .replay-list {
    max-height: 72px;
  }

  .setup-grid,
  .metric-grid {
    grid-template-columns: 1fr 1fr;
  }

  .room-tools {
    grid-template-columns: 1fr;
  }

  .action-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .action-row button {
    padding: 0 6px;
  }

  .status {
    max-width: 128px;
  }
}

.physics-stage {
  position: fixed;
  inset: 0;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  min-height: 100vh;
  background:
    radial-gradient(circle at 14% 10%, rgba(255, 0, 255, 0.08), transparent 34%),
    radial-gradient(circle at 86% 82%, rgba(255, 255, 255, 0.06), transparent 36%),
    var(--sim-paper);
}

.physics-panel {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: auto;
  padding: 16px;
  border-right: 1px solid rgba(0, 0, 0, 0.1);
  background: rgba(255, 255, 255, 0.76);
  box-shadow: 18px 0 70px rgba(0, 0, 0, 0.11);
  backdrop-filter: blur(22px) saturate(1.08);
  -webkit-backdrop-filter: blur(22px) saturate(1.08);
  animation: surface-in 0.42s ease both;
}

@keyframes surface-in {
  from {
    opacity: 0;
    transform: translateX(-8px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.physics-brand h1 {
  margin: 0;
}

.physics-brand h1 {
  font-size: 17px;
  font-weight: 720;
  letter-spacing: 0;
}

.physics-status {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

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

.example-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 7px;
}

.component-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.example-chip,
.component-chip {
  min-height: 32px;
  padding: 0 11px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(0, 0, 0, 0.12);
  color: var(--text);
  font-size: 12px;
  font-weight: 680;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.055);
}

.example-chip {
  width: 100%;
  height: 34px;
  min-height: 34px;
  padding: 0 12px;
  font-size: 12px;
  letter-spacing: 0;
}

.example-chip.is-active {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.42);
}

.component-stack {
  min-height: 40px;
  align-items: center;
}

.component-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  color: rgba(0, 0, 0, 0.68);
  font-size: 11px;
  box-shadow: none;
}

.component-chip.is-domain {
  color: rgba(255, 255, 255, 0.86);
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.18);
}

.component-chip.is-source {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.2);
}

.component-chip.is-controller,
.component-chip.is-sensor,
.component-chip.is-process {
  background: rgba(255, 255, 255, 0.11);
  border-color: rgba(255, 255, 255, 0.2);
  color: rgba(0, 0, 0, 0.72);
}

.component-chip.is-field,
.component-chip.is-material {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.18);
  color: rgba(0, 0, 0, 0.7);
}

.component-chip.is-actor {
  background: rgba(255, 255, 255, 0.13);
  border-color: rgba(255, 255, 255, 0.22);
  color: rgba(0, 0, 0, 0.72);
}

.component-chip.is-sink,
.component-chip.is-loss {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.18);
}

.component-chip.is-empty {
  border-style: dashed;
  color: rgba(0, 0, 0, 0.46);
}

.template-chip {
  min-height: 68px;
  padding: 8px;
  text-align: left;
  background: rgba(255, 255, 255, 0.7);
  border-color: rgba(0, 0, 0, 0.12);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.06);
}

.template-chip strong,
.template-chip span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
}

.template-chip strong {
  color: var(--text);
  font-size: 11px;
  line-height: 1.2;
  font-weight: 720;
}

.template-chip span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.25;
}

.template-chip.is-active {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.46);
}

.template-chip[data-template-id="magnetic-wheel"] {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.78), rgba(255, 0, 255, 0.08));
}

.template-chip[data-template-id="fluid-vortex"] {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.78), rgba(255, 255, 255, 0.11));
  border-color: rgba(255, 255, 255, 0.18);
}

.template-chip[data-template-id="reaction-diffusion"] {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.78), rgba(255, 255, 255, 0.1));
  border-color: rgba(255, 255, 255, 0.18);
}

.template-chip[data-template-id="blank-world"] {
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.06) 1px, transparent 1px),
    linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px),
    rgba(255, 255, 255, 0.78);
  background-size: 14px 14px, 14px 14px, auto;
  border-style: dashed;
  border-color: rgba(255, 255, 255, 0.28);
}

.template-chip[data-template-id="fluid-vortex"].is-active {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.78));
  border-color: rgba(255, 255, 255, 0.46);
}

.template-chip[data-template-id="reaction-diffusion"].is-active {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.78));
  border-color: rgba(255, 255, 255, 0.42);
}

.template-chip[data-template-id="blank-world"].is-active {
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.08) 1px, transparent 1px),
    linear-gradient(rgba(255, 255, 255, 0.07) 1px, transparent 1px),
    rgba(255, 255, 255, 0.86);
  background-size: 12px 12px, 12px 12px, auto;
  border-color: rgba(255, 255, 255, 0.46);
}

.physics-name {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0;
  text-transform: none;
}

.builder-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: end;
}

.builder-row textarea {
  min-height: 136px;
  resize: vertical;
  border-radius: 8px;
  font-size: 16px;
  line-height: 1.36;
}

.builder-row button {
  min-width: 74px;
  height: 42px;
  border-radius: 8px;
}

.intent-runtime {
  display: grid;
  gap: 6px;
  padding: 9px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.58);
}

.intent-runtime[data-state="idle"] {
  opacity: 0.72;
}

.intent-runtime[data-state="error"] {
  border-color: rgba(255, 255, 255, 0.32);
  background: rgba(255, 255, 255, 0.08);
}

.intent-runtime-head,
.intent-runtime-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
  color: rgba(0, 0, 0, 0.58);
  font-size: 11px;
  line-height: 1.2;
}

.intent-runtime-head strong {
  overflow: hidden;
  color: var(--text);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.intent-runtime-percent {
  flex: 0 0 auto;
  color: rgba(0, 0, 0, 0.84);
  font-weight: 760;
}

.intent-runtime-track {
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.09);
}

.intent-runtime-fill {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(
    90deg,
    rgba(255, 0, 255, 0.82),
    rgba(255, 255, 255, 0.76),
    rgba(255, 255, 255, 0.78),
    rgba(0, 0, 0, 0.76),
    rgba(255, 255, 255, 0.78)
  );
  transition: width 0.22s ease;
}

.intent-runtime-meta span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.control-stack,
.readout-grid {
  display: grid;
  gap: 8px;
}

.physics-control {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0;
}

.physics-control input {
  width: 100%;
  accent-color: var(--accent);
}

.readout-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.readout {
  min-height: 54px;
  padding: 8px 0;
  border-top: 1px solid var(--border);
}

.readout strong,
.readout span {
  display: block;
}

.readout strong {
  color: var(--muted);
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0;
}

.readout span {
  color: var(--accent);
  font-size: 20px;
  font-weight: 720;
  line-height: 1.2;
}

.physics-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.physics-actions button {
  min-width: 0;
  width: 100%;
}

.physics-footer {
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  color: rgba(0, 0, 0, 0.42);
  font-size: 11px;
  line-height: 1.3;
}

.physics-footer a {
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font-size: inherit;
  font-weight: 650;
  text-decoration: none;
}

.physics-footer a:hover {
  background: transparent;
  box-shadow: none;
  color: rgba(0, 0, 0, 0.88);
  transform: none;
}

.physics-canvas-wrap {
  position: relative;
  min-width: 0;
  min-height: 100vh;
}

#physics-canvas {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  min-height: 100vh;
  display: block;
}

.physics-note {
  margin: 0;
  color: rgba(255, 255, 255, 0.56);
  font-size: 11px;
  line-height: 1.45;
}

.physics-spec-preview {
  max-height: 172px;
}

.intent-details {
  border-top: 1px solid var(--border);
  padding-top: 9px;
}

.intent-details > * + * {
  margin-top: 11px;
}

.intent-details summary {
  color: rgba(0, 0, 0, 0.54);
  font-size: 12px;
  font-weight: 680;
  letter-spacing: 0;
  text-transform: none;
}

.physics-stage {
  --mosaic-pink: rgba(0, 255, 0, 0.2);
  --mosaic-apricot: rgba(255, 255, 255, 0.18);
  --mosaic-mint: rgba(0, 255, 0, 0.18);
  --mosaic-sky: rgba(0, 0, 0, 0.16);
  --mosaic-lilac: rgba(255, 255, 255, 0.18);
  --mosaic-ink: var(--sim-ink);
  --mosaic-muted: rgba(0, 0, 0, 0.58);
  --mosaic-line: rgba(255, 255, 255, 0.12);
  --mosaic-cell: 20px;
  --mosaic-surface: rgba(255, 255, 255, 0.82);
  --mosaic-tile-soft: rgba(255, 255, 255, 0.08);
  --mosaic-tile-warm: rgba(0, 255, 0, 0.08);
  background-color: var(--sim-paper);
  background-image:
    linear-gradient(135deg, rgba(255, 255, 255, 0.08), transparent 35%),
    linear-gradient(225deg, rgba(255, 255, 255, 0.07), transparent 38%),
    linear-gradient(180deg, var(--sim-paper) 0%, var(--sim-paper) 54%, var(--sim-paper) 100%);
  background-size:
    auto,
    auto,
    auto;
}

.physics-panel {
  border-right: 1px solid var(--mosaic-line);
  border-radius: 0 8px 8px 0;
  background-color: rgba(255, 255, 255, 0.88);
  background-image:
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(255, 255, 255, 0.84)),
    conic-gradient(
      from 90deg,
      rgba(255, 255, 255, 0.07) 0 25%,
      rgba(255, 255, 255, 0.055) 0 50%,
      rgba(255, 255, 255, 0.06) 0 75%,
      rgba(255, 255, 255, 0.06) 0
    );
  background-size: auto, 28px 28px;
  box-shadow:
    14px 0 48px rgba(0, 0, 0, 0.12),
    inset -1px 0 0 rgba(255, 255, 255, 0.72);
  color: var(--mosaic-ink);
  scrollbar-color: rgba(255, 255, 255, 0.45) transparent;
}

.physics-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 42px;
  padding: 10px;
  border: 1px solid rgba(0, 0, 0, 0.14);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.8), rgba(255, 255, 255, 0.48)),
    repeating-linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.16) 0 10px,
      rgba(255, 255, 255, 0.13) 10px 20px,
      rgba(255, 255, 255, 0.14) 20px 30px,
      rgba(255, 255, 255, 0.12) 30px 40px,
      rgba(255, 255, 255, 0.13) 40px 50px
    );
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.08);
}

.physics-brand h1 {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--mosaic-ink);
  font-size: 16px;
  letter-spacing: 0.01em;
}

.physics-brand h1::before {
  content: "\221e";
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border: 1px solid rgba(0, 0, 0, 0.16);
  border-radius: 999px;
  background:
    radial-gradient(circle at 38% 32%, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.58) 62%, rgba(255, 255, 255, 0.18)),
    linear-gradient(135deg, rgba(255, 255, 255, 0.68), rgba(255, 255, 255, 0.62) 48%, rgba(255, 255, 255, 0.66));
  box-shadow:
    0 0 0 3px rgba(255, 255, 255, 0.58),
    0 7px 18px rgba(0, 0, 0, 0.14);
  color: rgba(0, 0, 0, 0.86);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 19px;
  font-weight: 700;
  line-height: 1;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.55);
}

.example-row {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  padding: 2px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.46);
}

.example-chip,
.component-chip,
.physics-actions button,
.primary-action {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  border-radius: 8px;
  border-color: rgba(0, 0, 0, 0.16);
  color: var(--mosaic-ink);
  background-color: rgba(255, 255, 255, 0.78);
  background-image:
    linear-gradient(180deg, rgba(255, 255, 255, 0.86), rgba(255, 255, 255, 0.62));
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.075);
}

.example-chip::before,
.component-chip::before,
.physics-actions button::before,
.primary-action::before {
  content: "";
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 5px;
  height: 3px;
  z-index: 0;
  opacity: 0.46;
  pointer-events: none;
  border-radius: 999px;
  background-image: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.82),
    rgba(255, 255, 255, 0.78),
    rgba(255, 255, 255, 0.74),
    rgba(255, 255, 255, 0.78),
    rgba(255, 255, 255, 0.8)
  );
}

.example-chip {
  width: auto;
  font-size: 12px;
}

.example-chip:nth-child(2)::before {
  filter: none;
}

.example-chip:nth-child(3)::before {
  filter: none;
}

.example-chip:nth-child(4)::before {
  filter: none;
}

.example-chip:nth-child(5)::before {
  filter: none;
}

.example-chip:nth-child(6)::before {
  filter: none;
}

.example-chip.is-active,
.example-chip:hover:not(:disabled) {
  border-color: rgba(255, 255, 255, 0.52);
  color: var(--sim-ink);
  background-color: rgba(255, 255, 255, 0.86);
  background-image:
    linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(255, 255, 255, 0.68));
  box-shadow:
    0 0 0 2px rgba(255, 255, 255, 0.78),
    0 14px 28px rgba(0, 0, 0, 0.11);
}

.builder-row {
  gap: 9px;
}

.builder-row textarea {
  min-height: 132px;
  border-radius: 8px;
  border-color: rgba(0, 0, 0, 0.18);
  background-color: rgba(255, 255, 255, 0.82);
  background-image:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.82)),
    linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px),
    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: auto, 18px 18px, 18px 18px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.84),
    0 12px 30px rgba(0, 0, 0, 0.07);
  color: var(--mosaic-ink);
  font-weight: 660;
}

textarea:focus,
input:focus,
select:focus {
  border-color: rgba(255, 255, 255, 0.62);
  box-shadow:
    0 0 0 3px rgba(255, 255, 255, 0.15),
    0 12px 30px rgba(0, 0, 0, 0.08);
}

.primary-action {
  min-height: 40px;
  border-color: rgba(0, 0, 0, 0.2);
  background-color: rgba(255, 255, 255, 0.72);
  color: var(--sim-ink);
  font-weight: 760;
}

button:hover:not(:disabled),
a:hover {
  border-color: rgba(255, 255, 255, 0.5);
  background: rgba(255, 255, 255, 0.88);
  color: var(--sim-ink);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.11);
  transform: translateY(-1px);
}

.primary-action.is-loading::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(
      90deg,
      transparent 0%,
      rgba(255, 255, 255, 0.04) 30%,
      rgba(255, 255, 255, 0.72) 50%,
      rgba(255, 255, 255, 0.04) 70%,
      transparent 100%
    );
  animation: mosaic-sweep 1.6s cubic-bezier(0.2, 0, 0, 1) infinite;
}

.intent-runtime {
  position: relative;
  overflow: hidden;
  gap: 8px;
  padding: 11px;
  border: 1px solid rgba(0, 0, 0, 0.14);
  border-radius: 8px;
  background-color: rgba(255, 255, 255, 0.68);
  background-image:
    linear-gradient(180deg, rgba(255, 255, 255, 0.84), rgba(255, 255, 255, 0.58));
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.08);
  transition:
    opacity 180ms ease,
    border-color 180ms ease,
    background-color 180ms ease,
    box-shadow 180ms ease;
}

.intent-runtime::before {
  content: none;
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
}

.intent-runtime[data-state="idle"] {
  opacity: 0.82;
}

.intent-runtime[data-state="error"] {
  border-color: rgba(255, 255, 255, 0.42);
  background-image:
    linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.62)),
    repeating-linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.16) 0 12px,
      rgba(255, 255, 255, 0.1) 12px 24px
    );
}

.intent-runtime-head,
.intent-runtime-meta {
  color: rgba(0, 0, 0, 0.56);
}

.intent-runtime-head strong {
  display: block;
  min-width: 0;
  overflow: hidden;
  color: var(--mosaic-ink);
  font-weight: 760;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.intent-runtime-percent {
  color: rgba(0, 0, 0, 0.86);
  font-variant-numeric: tabular-nums;
}

.intent-runtime-track {
  position: relative;
  height: 18px;
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 6px;
  background:
    rgba(255, 255, 255, 0.46);
}

.intent-runtime-fill {
  position: relative;
  z-index: 1;
  height: 100%;
  border-radius: 5px;
  background:
    linear-gradient(
      90deg,
      rgba(255, 0, 255, 0.82),
      rgba(255, 255, 255, 0.76),
      rgba(255, 255, 255, 0.78),
      rgba(0, 0, 0, 0.76),
      rgba(255, 255, 255, 0.78)
    );
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.6),
    0 0 18px rgba(255, 255, 255, 0.18);
}

.intent-runtime[data-state="active"] .intent-runtime-fill {
  min-width: 18px;
}

.intent-runtime[data-state="active"] {
  border-color: rgba(255, 255, 255, 0.28);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.62),
    0 12px 28px rgba(0, 0, 0, 0.11);
}

.intent-runtime-head {
  display: block;
  min-width: 0;
}

.intent-runtime-percent,
.intent-runtime-track,
.intent-runtime-meta,
.intent-runtime-detail {
  display: none;
}

.intent-runtime[data-stage="prompt-runtime"] .intent-runtime-fill {
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.8), rgba(255, 255, 255, 0.8));
}

.intent-runtime[data-stage="retrieval"] .intent-runtime-fill,
.intent-runtime[data-stage="activation-cloud"] .intent-runtime-fill {
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.84), rgba(255, 255, 255, 0.78));
}

.intent-runtime[data-stage="grounded-intent"] .intent-runtime-fill,
.intent-runtime[data-stage="simulation-compile"] .intent-runtime-fill {
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.84), rgba(255, 255, 255, 0.78));
}

.intent-runtime[data-stage="visual-ir"] .intent-runtime-fill,
.intent-runtime[data-stage="webgpu-ready"] .intent-runtime-fill {
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.78), rgba(255, 255, 255, 0.8));
}

.component-stack {
  padding: 2px 0;
}

.component-chip {
  min-height: 28px;
  border-radius: 7px;
  background-color: rgba(255, 255, 255, 0.64);
  background-image:
    linear-gradient(180deg, rgba(255, 255, 255, 0.68), rgba(255, 255, 255, 0.42)),
    conic-gradient(
      from 90deg,
      rgba(255, 255, 255, 0.18) 0 25%,
      rgba(255, 255, 255, 0.15) 0 50%,
      rgba(255, 255, 255, 0.16) 0 75%,
      rgba(255, 255, 255, 0.15) 0
    );
  background-size: auto, 16px 16px;
  color: rgba(0, 0, 0, 0.66);
}

.component-chip::before {
  opacity: 0.28;
}

.component-chip.is-domain,
.component-chip.is-source,
.component-chip.is-controller,
.component-chip.is-sensor,
.component-chip.is-process,
.component-chip.is-field,
.component-chip.is-material,
.component-chip.is-actor,
.component-chip.is-sink,
.component-chip.is-loss {
  background-image:
    linear-gradient(180deg, rgba(255, 255, 255, 0.58), rgba(255, 255, 255, 0.34)),
    conic-gradient(
      from 90deg,
      rgba(255, 255, 255, 0.2) 0 25%,
      rgba(255, 255, 255, 0.18) 0 50%,
      rgba(255, 255, 255, 0.18) 0 75%,
      rgba(255, 255, 255, 0.18) 0
    );
  background-size: auto, 16px 16px;
}

.component-chip.is-domain::before,
.component-chip.is-source::before {
  filter: hue-rotate(80deg);
  opacity: 0.38;
}

.component-chip.is-controller::before,
.component-chip.is-sensor::before,
.component-chip.is-process::before {
  filter: hue-rotate(154deg);
  opacity: 0.36;
}

.component-chip.is-field::before,
.component-chip.is-material::before {
  filter: hue-rotate(232deg);
  opacity: 0.34;
}

.component-chip.is-actor::before {
  filter: hue-rotate(24deg);
  opacity: 0.36;
}

.readout-grid {
  gap: 7px;
}

.readout {
  min-height: 58px;
  padding: 9px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0.5)),
    conic-gradient(
      from 90deg,
      rgba(255, 255, 255, 0.08) 0 25%,
      rgba(255, 255, 255, 0.07) 0 50%,
      rgba(255, 0, 255, 0.08) 0 75%,
      rgba(255, 255, 255, 0.07) 0
    );
  background-size: auto, 18px 18px;
}

.readout strong {
  color: rgba(0, 0, 0, 0.5);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.readout span {
  color: rgba(0, 0, 0, 0.92);
}

.physics-control {
  gap: 7px;
  padding: 8px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.5);
  color: rgba(0, 0, 0, 0.58);
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 10px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 5px;
  background:
    repeating-linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.52) 0 16px,
      rgba(255, 255, 255, 0.46) 16px 32px,
      rgba(255, 255, 255, 0.46) 32px 48px,
      rgba(255, 255, 255, 0.44) 48px 64px,
      rgba(255, 255, 255, 0.46) 64px 80px
    );
}

input[type="range"]::-webkit-slider-thumb {
  width: 20px;
  height: 20px;
  margin-top: -6px;
  border: 2px solid rgba(255, 255, 255, 0.96);
  border-radius: 6px;
  background: var(--sim-paper);
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.18),
    0 8px 18px rgba(0, 0, 0, 0.18);
}

input[type="range"]::-moz-range-track {
  height: 10px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 5px;
  background:
    repeating-linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.52) 0 16px,
      rgba(255, 255, 255, 0.46) 16px 32px,
      rgba(255, 255, 255, 0.46) 32px 48px,
      rgba(255, 255, 255, 0.44) 48px 64px,
      rgba(255, 255, 255, 0.46) 64px 80px
    );
}

input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.96);
  border-radius: 6px;
  background: var(--sim-paper);
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.18),
    0 8px 18px rgba(0, 0, 0, 0.18);
}

.intent-details {
  border-top: 1px solid rgba(0, 0, 0, 0.12);
  padding-top: 10px;
}

.intent-details summary {
  width: max-content;
  padding: 5px 9px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.56);
  color: rgba(0, 0, 0, 0.62);
}

.spec-preview {
  border-color: rgba(0, 0, 0, 0.12);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0.52)),
    linear-gradient(90deg, rgba(255, 255, 255, 0.08) 1px, transparent 1px);
  background-size: auto, 14px 14px;
  color: rgba(0, 0, 0, 0.68);
}

.physics-footer {
  border-top-color: rgba(0, 0, 0, 0.12);
  color: rgba(0, 0, 0, 0.46);
}

.physics-panel {
  background-color: rgba(255, 255, 255, 0.9);
  background-image:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(255, 255, 255, 0.86));
}

.physics-brand {
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.86), rgba(255, 255, 255, 0.58)),
    repeating-linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.07) 0 10px,
      rgba(255, 255, 255, 0.06) 10px 20px,
      rgba(255, 255, 255, 0.065) 20px 30px,
      rgba(255, 255, 255, 0.055) 30px 40px,
      rgba(255, 255, 255, 0.06) 40px 50px
    );
}

.example-chip,
.component-chip,
.physics-actions button,
.primary-action {
  background-color: rgba(255, 255, 255, 0.76);
  background-image:
    linear-gradient(180deg, rgba(255, 255, 255, 0.74), rgba(255, 255, 255, 0.48));
}

.example-chip::before,
.component-chip::before,
.physics-actions button::before,
.primary-action::before {
  opacity: 0;
  transition: opacity 0.36s ease, background-position 0.8s ease;
}

.example-chip:hover:not(:disabled)::before,
.example-chip.is-active::before,
.physics-actions button:hover:not(:disabled)::before,
.primary-action:hover:not(:disabled)::before,
.primary-action.is-loading::before {
  opacity: 0.18;
  animation: mosaic-drift 7s linear infinite;
}

.component-chip {
  background-color: rgba(255, 255, 255, 0.64);
  background-image:
    linear-gradient(180deg, rgba(255, 255, 255, 0.62), rgba(255, 255, 255, 0.38));
}

.component-chip::before {
  opacity: 0.07;
}

.component-chip.is-domain,
.component-chip.is-source,
.component-chip.is-controller,
.component-chip.is-sensor,
.component-chip.is-process,
.component-chip.is-field,
.component-chip.is-material,
.component-chip.is-actor,
.component-chip.is-sink,
.component-chip.is-loss {
  background-image:
    linear-gradient(180deg, rgba(255, 255, 255, 0.62), rgba(255, 255, 255, 0.36));
}

.component-chip.is-domain::before,
.component-chip.is-source::before,
.component-chip.is-controller::before,
.component-chip.is-sensor::before,
.component-chip.is-process::before,
.component-chip.is-field::before,
.component-chip.is-material::before,
.component-chip.is-actor::before,
.component-chip.is-sink::before,
.component-chip.is-loss::before {
  filter: none;
  opacity: 0.08;
}

.intent-runtime {
  background-color: rgba(255, 255, 255, 0.76);
  background-image:
    linear-gradient(180deg, rgba(255, 255, 255, 0.86), rgba(255, 255, 255, 0.58));
}

.intent-runtime::before {
  z-index: 1;
  height: 3px;
  opacity: 0;
}

.intent-runtime-track {
  height: 14px;
  background: rgba(255, 255, 255, 0.46);
}

.intent-runtime-fill {
  background:
    linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.42),
      rgba(255, 255, 255, 0.48),
      rgba(255, 255, 255, 0.42)
    );
}

.readout {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0.5));
}

input[type="range"]::-webkit-slider-runnable-track {
  background:
    repeating-linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.2) 0 16px,
      rgba(255, 255, 255, 0.16) 16px 32px,
      rgba(255, 255, 255, 0.18) 32px 48px,
      rgba(255, 255, 255, 0.16) 48px 64px,
      rgba(255, 255, 255, 0.17) 64px 80px
    );
}

input[type="range"]::-moz-range-track {
  background:
    repeating-linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.2) 0 16px,
      rgba(255, 255, 255, 0.16) 16px 32px,
      rgba(255, 255, 255, 0.18) 32px 48px,
      rgba(255, 255, 255, 0.16) 48px 64px,
      rgba(255, 255, 255, 0.17) 64px 80px
    );
}

@keyframes mosaic-drift {
  from {
    background-position: 0 0;
  }

  to {
    background-position: 72px 0;
  }
}

@keyframes mosaic-sweep {
  from {
    transform: translateX(-115%);
  }

  to {
    transform: translateX(115%);
  }
}

.physics-stage {
  position: fixed;
  inset: 0;
  z-index: 1;
  display: block;
  min-height: 100vh;
}

.physics-canvas-wrap,
#physics-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  min-height: 100vh;
  display: block;
}

#physics-canvas {
  opacity: 1;
  visibility: visible;
  transition: opacity 160ms ease, visibility 0ms linear 0ms;
}

#physics-canvas[data-scene-visible="false"] {
  opacity: 0;
  visibility: hidden;
  transition: opacity 160ms ease, visibility 0ms linear 160ms;
}

#loading-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 8;
  min-height: 100vh;
  display: block;
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease;
}

#loading-canvas.is-active {
  opacity: 1;
}

.physics-panel {
  position: fixed;
  z-index: 12;
  left: 50%;
  bottom: 16px;
  width: min(520px, calc(100vw - 24px));
  max-height: min(62vh, 286px);
  overflow: auto;
  transform: translateX(-50%);
  padding: 8px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.42);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.26), rgba(255, 255, 255, 0.08)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.06));
  backdrop-filter: blur(30px) saturate(1.48);
  -webkit-backdrop-filter: blur(30px) saturate(1.48);
  display: grid;
  gap: 8px;
  animation: none;
  box-shadow:
    0 24px 70px rgba(0, 0, 0, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.42),
    inset 0 -1px 0 rgba(0, 0, 0, 0.08);
  user-select: none;
}

.prompt-dock {
  touch-action: manipulation;
  transition:
    max-height 0.22s ease,
    width 0.22s ease,
    left 0.22s ease,
    right 0.22s ease,
    top 0.22s ease,
    bottom 0.22s ease,
    transform 0.22s ease,
    opacity 0.22s ease,
    background-color 0.22s ease,
    box-shadow 0.22s ease;
}

.prompt-dock::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background:
    radial-gradient(circle at 10% 0%, rgba(255, 255, 255, 0.42), transparent 42%),
    radial-gradient(circle at 88% 100%, rgba(255, 255, 255, 0.18), transparent 46%);
  pointer-events: none;
}

.prompt-dock[data-dock-edge="top"][data-collapsed="false"] {
  top: 16px;
  bottom: auto;
}

.prompt-dock[data-collapsed="true"] {
  width: 34px;
  max-height: 46px;
  overflow: hidden;
  transform: none !important;
  opacity: 0.88;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.38), rgba(255, 255, 255, 0.16)),
    linear-gradient(90deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.1));
  border-color: rgba(255, 255, 255, 0.28);
  box-shadow:
    0 14px 42px rgba(0, 0, 0, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.32);
  backdrop-filter: blur(18px) saturate(1.3);
  -webkit-backdrop-filter: blur(18px) saturate(1.3);
}

.prompt-dock[data-collapsed="true"][data-corner="top-left"] {
  left: 16px;
  right: auto;
  top: 16px;
  bottom: auto;
  transform: none;
}

.prompt-dock[data-collapsed="true"][data-corner="top-right"] {
  left: auto;
  right: 16px;
  top: 16px;
  bottom: auto;
  transform: none;
}

.prompt-dock[data-collapsed="true"][data-corner="bottom-left"] {
  left: 16px;
  right: auto;
  top: auto;
  bottom: 16px;
  transform: none;
}

.prompt-dock[data-collapsed="true"][data-corner="bottom-right"] {
  left: auto;
  right: 16px;
  top: auto;
  bottom: 16px;
  transform: none;
}

.prompt-dock[data-collapsed="true"] .prompt-dock-core {
  display: none;
}

.prompt-dock[data-collapsed="true"] .prompt-dock-head {
  justify-content: center;
  min-height: 34px;
}

.prompt-dock[data-collapsed="true"] .prompt-dock-autonomy {
  display: none;
}

.prompt-dock-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 30px;
}

.prompt-dock-autonomy {
  border: 0;
  background: transparent;
  color: rgba(0, 0, 0, 0.66);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-decoration: none;
  text-transform: uppercase;
}

.prompt-dock-autonomy:hover,
.prompt-dock-autonomy:focus-visible {
  color: rgba(0, 0, 0, 0.94);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.prompt-dock-toggle {
  min-height: 28px;
  min-width: 34px;
  border-radius: 8px;
  padding: 0 8px;
  border: 1px solid rgba(0, 0, 0, 0.14);
  background: rgba(255, 255, 255, 0.6);
  color: rgba(0, 0, 0, 0.72);
  font-size: 15px;
  line-height: 1;
}

.prompt-dock[data-collapsed="true"] .prompt-dock-toggle {
  color: rgba(0, 0, 0, 0.94);
}

.prompt-dock-core {
  display: grid;
  gap: 8px;
}

.prompt-dock .builder-row {
  position: relative;
  display: block;
  width: 100%;
}

.prompt-dock textarea {
  display: block;
  width: 100%;
  border-radius: 12px;
  min-height: 116px;
  max-height: 180px;
  padding-bottom: 60px;
  resize: vertical;
  font-size: 15px;
  line-height: 1.35;
}

.prompt-dock .builder-row button {
  position: absolute;
  bottom: 10px;
  z-index: 1;
  width: min(128px, calc(50% - 16px));
  min-width: 0;
  min-height: 38px;
  height: 38px;
  border-radius: 14px;
  margin: 0;
  padding: 0 12px;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.72);
  border-color: rgba(0, 0, 0, 0.16);
  box-shadow: 0 9px 24px rgba(0, 0, 0, 0.08);
  backdrop-filter: blur(14px) saturate(1.12);
  -webkit-backdrop-filter: blur(14px) saturate(1.12);
}

#shuffle-prompt {
  left: 10px;
}

#build-lab {
  right: 10px;
}

.prompt-dock .model-selection-panel {
  position: absolute;
  bottom: 10px;
  left: 50%;
  z-index: 2;
  min-height: 38px;
  transform: translateX(-50%);
}

.prompt-dock .model-selection-panel[open] .model-selection-controls {
  right: auto;
  left: 50%;
  transform: translateX(-50%);
}

.prompt-action-icon {
  display: block;
  font-family: "Times New Roman", Georgia, serif;
  font-size: 26px;
  font-weight: 700;
  line-height: 1;
  transform: translateY(-1px);
}

.prompt-action-label {
  position: static;
  width: auto;
  height: auto;
  margin: 0;
  overflow: visible;
  clip: auto;
  color: inherit;
  font-size: 12px;
  font-weight: 760;
  letter-spacing: 0;
  white-space: nowrap;
}

.prompt-dock .intent-runtime {
  --runtime-progress: 0%;
  position: relative;
  display: block;
  margin: 0;
  min-height: 42px;
  padding: 0 0 9px;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.prompt-dock .intent-runtime::before {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 3px;
  border-radius: 999px;
  background:
    repeating-linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.2) 0 7px,
      rgba(255, 255, 255, 0.05) 7px 10px
    ),
    rgba(255, 255, 255, 0.11);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.62);
}

.prompt-dock .intent-runtime::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: var(--runtime-progress);
  height: 3px;
  border-radius: 999px;
  background:
    repeating-linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.34) 0 2px,
      rgba(255, 255, 255, 0.02) 2px 10px
    ),
    linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.92),
      rgba(255, 255, 255, 0.88),
      rgba(255, 255, 255, 0.86),
      rgba(255, 255, 255, 0.84),
      rgba(255, 255, 255, 0.86),
      rgba(255, 255, 255, 0.9),
      rgba(255, 255, 255, 0.9),
      rgba(255, 255, 255, 0.92)
    );
  background-size: 12px 100%, 220% 100%;
  background-blend-mode: screen, normal;
  opacity: 0;
  transition: width 220ms cubic-bezier(0.2, 0, 0, 1), opacity 180ms ease;
}

.prompt-dock .intent-runtime[data-state="active"]::after,
.prompt-dock .intent-runtime[data-state="ready"]::after,
.prompt-dock .intent-runtime[data-state="error"]::after {
  opacity: 0.92;
}

.prompt-dock .intent-runtime[data-state="active"]::after {
  animation: runtime-pastel-flow 1.55s linear infinite;
}

.prompt-dock .intent-runtime[data-progress="indeterminate"]::after {
  width: 36%;
  animation: prompt-runtime-rainbow 1.15s linear infinite;
}

.prompt-dock .intent-runtime-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  min-width: 0;
}

.prompt-dock .intent-runtime-head strong {
  display: block;
  min-width: 0;
  overflow: hidden;
  color: rgba(0, 0, 0, 0.82);
  font-size: 11px;
  font-weight: 760;
  letter-spacing: 0;
  line-height: 1.32;
  text-overflow: ellipsis;
  text-transform: none;
  white-space: nowrap;
}

.prompt-dock .intent-runtime[data-heartbeat="true"] #intent-runtime-title::after {
  content: "";
  display: inline-block;
  width: 5px;
  height: 5px;
  margin-left: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
  vertical-align: 1px;
  animation: runtime-heartbeat-pulse 0.9s ease-in-out infinite;
}

.prompt-dock .intent-runtime-percent {
  display: block;
  color: rgba(0, 0, 0, 0.58);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  font-weight: 760;
  letter-spacing: 0;
  line-height: 1.2;
  white-space: nowrap;
}

.prompt-dock .intent-runtime-track,
.prompt-dock .intent-runtime-meta {
  display: none;
}

.prompt-dock .intent-runtime-detail {
  display: block;
  min-width: 0;
  margin-top: 2px;
  overflow: hidden;
  color: rgba(0, 0, 0, 0.52);
  font-size: 9px;
  font-variant-numeric: tabular-nums;
  font-weight: 680;
  letter-spacing: 0;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.prompt-dock .intent-runtime[data-byte-progress="unknown"] .intent-runtime-detail,
.prompt-dock .intent-runtime[data-byte-progress="unknown-total"] .intent-runtime-detail {
  animation: runtime-detail-heartbeat 1.2s ease-in-out infinite;
}

.prompt-dock .intent-runtime[data-state="idle"] .intent-runtime-detail {
  display: none;
}

.world-model-panel {
  display: grid;
  gap: 4px;
  padding: 2px 0 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.world-model-head {
  display: flex;
  gap: 8px;
  align-items: baseline;
  justify-content: space-between;
  min-width: 0;
}

.world-model-head strong {
  color: rgba(0, 0, 0, 0.76);
  font-size: 10px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.world-model-status {
  max-width: 48%;
  overflow: hidden;
  color: rgba(0, 0, 0, 0.8);
  font-size: 9px;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.world-model-summary {
  min-height: 1.3em;
  overflow: hidden;
  color: rgba(0, 0, 0, 0.66);
  font-size: 10px;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.prompt-more-menu {
  border-top: 0;
  padding-top: 0;
}

.prompt-more-menu summary {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  width: fit-content;
  padding: 0 9px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.42);
  color: rgba(0, 0, 0, 0.66);
  cursor: pointer;
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  user-select: none;
}

.prompt-more-menu summary::-webkit-details-marker {
  display: none;
}

.prompt-more-content {
  display: grid;
  gap: 8px;
  padding-top: 8px;
}

.prompt-more-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.prompt-more-actions button {
  min-height: 32px;
  border-radius: 8px;
}

.prompt-corner-controls {
  display: grid;
  grid-template-columns: repeat(4, 34px);
  gap: 6px;
  align-items: center;
}

.prompt-corner-controls button {
  width: 34px;
  min-width: 0;
  min-height: 30px;
  padding: 0;
  border-radius: 8px;
  font-size: 14px;
  line-height: 1;
}

.prompt-corner-controls button.is-active {
  border-color: rgba(255, 255, 255, 0.52);
  background: rgba(255, 255, 255, 0.84);
}

.prompt-more-runtime {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
}

.prompt-more-runtime .physics-status {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.world-model-chips {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
}

.world-model-chip {
  min-width: 0;
  padding: 5px 6px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.34);
}

.world-model-chip span,
.world-model-chip strong {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.world-model-chip span {
  color: rgba(0, 0, 0, 0.46);
  font-size: 8px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.world-model-chip strong {
  color: rgba(0, 0, 0, 0.78);
  font-size: 11px;
  line-height: 1.25;
}

.prompt-more-section-title {
  color: rgba(0, 0, 0, 0.46);
  font-size: 9px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.world-model-panel .spec-preview {
  max-height: 156px;
  margin-top: 6px;
}

.intent-runtime-detail {
  display: block;
  min-width: 0;
  overflow: hidden;
  color: rgba(0, 0, 0, 0.48);
  font-size: 9px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.intent-runtime[data-progress="indeterminate"] .intent-runtime-fill {
  width: 38% !important;
}

@keyframes prompt-runtime-rainbow {
  0% {
    transform: translateX(-110%);
    opacity: 0.35;
  }

  24% {
    opacity: 0.9;
  }

  100% {
    transform: translateX(280%);
    opacity: 0.35;
  }
}

@keyframes runtime-pastel-flow {
  0% {
    background-position: 0 50%, 0% 50%;
  }

  100% {
    background-position: 48px 50%, 220% 50%;
  }
}

@keyframes runtime-heartbeat-pulse {
  0%,
  100% {
    opacity: 0.44;
    transform: scale(0.82);
  }

  45% {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes runtime-detail-heartbeat {
  0%,
  100% {
    opacity: 0.5;
  }

  48% {
    opacity: 0.92;
  }
}

.prompt-dock .physics-status {
  color: rgba(0, 0, 0, 0.68);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.physics-fps {
  min-width: 48px;
  color: rgba(0, 0, 0, 0.68);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
  text-align: right;
  text-transform: uppercase;
  white-space: nowrap;
}

.physics-fps[data-perf="low"] {
  color: rgba(0, 0, 0, 0.9);
}

.physics-fps[data-perf="warn"] {
  color: rgba(0, 0, 0, 0.9);
}

.prompt-dock .physics-brand,
.prompt-dock .example-row,
.prompt-dock .physics-footer,
.prompt-dock .board-objects,
.prompt-dock .worldspec-panel,
.prompt-dock .intent-details,
.prompt-dock .physics-actions,
.prompt-dock .control-stack,
.prompt-dock .component-stack,
.prompt-dock .readout-grid,
.prompt-dock .template-chip,
.prompt-dock .room-tools,
.prompt-dock .metric-grid,
.prompt-dock .metric,
.prompt-dock .object-chip,
.prompt-dock .setup-grid,
.prompt-dock .trace-inline,
.prompt-dock .replay-list {
  display: none;
}

@media (max-width: 820px) {
  html,
  body {
    overflow: auto;
  }

  .physics-panel {
    left: 50%;
    right: auto;
    width: min(520px, calc(100vw - 24px));
    max-height: 62vh;
    transform: translateX(-50%);
  }

  .prompt-dock-core {
    gap: 7px;
  }

  .prompt-dock textarea {
    min-height: 112px;
  }

  .prompt-dock .builder-row button {
    width: min(126px, calc(50% - 14px));
    min-height: 38px;
  }
}
