/*
 * Worldbuilder page chrome. The studio stylesheet (../styles.css) is loaded
 * first, so tokens, buttons, chips, panels, the topbar, the thread, toasts,
 * and the mobile sheets are the same design system as the avatar studio.
 * Everything here is the world-specific layer: a docked right deck, a HUD
 * over the stage, the pick card, maps, kit cards, meters, and the lookbook.
 */

:root {
  --wb-deck-w: min(400px, 36vw);
  --region-a: #1d9bf0;
  --region-b: #00ba7c;
  --region-c: #ff9f0a;
  --region-d: #ff5d8f;
}

/* ---------- Topbar ---------- */

.wb-brand {
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.wb-brand:hover {
  background: var(--bg-3);
}

.wb-brand-sep {
  color: var(--text-dim);
}

.wb-shell .workspace-name {
  cursor: default;
}

.wb-shell .workspace-name:hover {
  background: transparent;
}

.wb-seed-field input {
  width: 92px;
  min-height: var(--control-h);
  padding: 0 8px;
  border-radius: var(--radius-pill);
  font-family: var(--font-mono);
  font-size: 12px;
}

.wb-shell .save-status[data-status="idle"]::before {
  background: var(--text-dim);
}

.wb-shell .save-status[data-status="review"]::before {
  background: var(--warn);
}

.wb-shell .save-status[data-status="sealed"]::before {
  background: var(--ok);
}

.wb-shell .save-status[data-status="compiling"]::before {
  background: var(--accent);
  animation: status-pulse 1.2s ease-in-out infinite;
}

@keyframes status-pulse {
  50% { opacity: 0.35; }
}

.wb-shell .workspace-group {
  flex: 0 0 auto;
}

.wb-shell .workspace-name {
  flex: 0 0 auto;
  max-width: 240px;
}

.wb-shell .topbar-examples {
  flex: 0 1 auto;
  overflow: hidden;
}

.wb-shell .topbar-examples button {
  flex: 0 0 auto;
}

.wb-shell .topbar-examples button:nth-child(n + 8) {
  display: none;
}

@media (max-width: 1560px) {
  .wb-shell .topbar-examples button:nth-child(n + 7) {
    display: none;
  }
}

@media (max-width: 1500px) {
  .wb-shell .topbar-examples button:nth-child(n + 6) {
    display: none;
  }
}

.wb-shell .topbar-examples button[aria-pressed="true"] {
  color: var(--text);
  border-color: rgb(10 132 255 / 50%);
  background: var(--accent-soft);
}

.wb-shell .accent-button[data-stale="true"] {
  box-shadow: 0 0 0 2px rgb(255 212 0 / 45%);
}

/* ---------- Layout: stage + docked deck ---------- */

.wb-shell .wb-grid {
  grid-template-columns: minmax(0, 1fr) var(--wb-deck-w);
}

.wb-shell .wb-deck {
  position: relative;
  z-index: 1;
  right: auto;
  bottom: auto;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: auto;
  max-height: none;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  border: 0;
  border-left: 1px solid var(--line);
  border-radius: 0;
  background: var(--bg-1);
}

.wb-shell .inspector {
  display: block;
  height: 100%;
  overflow: hidden auto;
}

.wb-shell .inspector > .panel-header {
  min-height: 40px;
  padding: 6px 12px;
}

.wb-shell .inspector > .wb-lookbook-section {
  position: sticky;
  top: 0;
  z-index: 3;
  margin-top: 0;
  padding-top: 4px;
  padding-bottom: 8px;
  background: var(--bg-1);
  box-shadow: 0 10px 14px -10px rgb(0 0 0 / 70%);
}

.wb-lookbook-section .section-note {
  display: none;
}

.wb-lookbook-section .wb-look canvas {
  max-height: 56px;
}

.wb-shell .inspector .eyebrow {
  display: block;
}

.wb-shell .inspector .panel-title {
  font-size: 15px;
}

.wb-shell .left-dock {
  width: min(380px, 38vw);
  max-height: min(60vh, 560px);
}

.wb-shell .left-panel {
  border: 1px solid rgb(47 51 54 / 70%);
  border-radius: 16px;
  background: rgb(12 13 15 / 86%);
}

.wb-thread-clear {
  width: 24px;
  min-height: 24px;
  border-color: transparent;
  background: transparent;
  font-size: 14px;
}

.agent-avatar[data-agent="reader"] { background: #1d9bf0; }
.agent-avatar[data-agent="terrain"] { background: #00ba7c; }
.agent-avatar[data-agent="architect"] { background: #ff9f0a; }
.agent-avatar[data-agent="playtesters"] { background: #bf5af2; }
.agent-avatar[data-agent="validator"] { background: #7c5cff; }
.agent-avatar[data-agent="system"] { background: #536471; }

.bubble-row[data-from="reader"] .bubble,
.bubble-row[data-from="terrain"] .bubble,
.bubble-row[data-from="architect"] .bubble,
.bubble-row[data-from="playtesters"] .bubble,
.bubble-row[data-from="validator"] .bubble,
.bubble-row[data-from="system"] .bubble {
  border-bottom-left-radius: 5px;
  font-size: 12px;
}

.bubble-row[data-from="system"] .bubble {
  color: var(--text-muted);
  background: rgb(38 37 42 / 55%);
}

.bubble .chip-row {
  margin-top: 6px;
  gap: 4px;
}

.bubble .chip-row .chip {
  min-height: 20px;
  padding: 0 8px;
  color: var(--text-muted);
  font-size: 10px;
  cursor: default;
}

.wb-thread-empty {
  margin: 6px;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 13px;
  color: var(--text-muted);
  background: var(--accent-soft);
  font-size: 11px;
  line-height: 1.5;
}

.wb-thread-empty b {
  color: var(--text);
}

.wb-thread-empty > b:first-child {
  display: block;
  margin-bottom: 4px;
  font-size: 12px;
}

.wb-thread-empty ul {
  margin: 6px 0 0;
  padding-left: 15px;
  color: var(--text-dim);
}

/* ---------- Stage ---------- */

.wb-shell .viewport-stage {
  background:
    radial-gradient(circle at 50% 42%, rgb(0 186 124 / 10%), transparent 44%),
    radial-gradient(circle at 20% 10%, rgb(29 155 240 / 12%), transparent 40%),
    #000000;
}

#world-canvas {
  display: block;
  grid-row: 1;
  grid-column: 1;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  outline: 0;
  cursor: grab;
  touch-action: none;
}

#world-canvas:active {
  cursor: grabbing;
}

.wb-viewport-message {
  max-width: 360px;
  padding: 14px 16px;
}

.wb-viewport-copy {
  display: grid;
  gap: 4px;
  font-size: 12px;
  line-height: 1.45;
}

.wb-viewport-copy b {
  color: var(--text);
  font-size: 13px;
}

.wb-viewport-message[data-level="error"] {
  border-color: rgb(244 33 46 / 50%);
}

.wb-hud {
  position: absolute;
  z-index: 8;
  top: 8px;
  left: 8px;
  display: flex;
  flex-wrap: wrap;
  max-width: calc(100% - 16px);
  gap: 6px;
  pointer-events: none;
}

.wb-hud-group {
  padding: 2px;
  border: 1px solid rgb(255 255 255 / 8%);
  border-radius: 12px;
  background: rgb(0 0 0 / 52%);
  pointer-events: auto;
}

.wb-hud-group .segmented-button {
  flex: 0 0 auto;
  min-height: 24px;
  padding: 0 9px;
  overflow: visible;
  border-color: transparent;
  background: transparent;
  font-size: 11px;
}

.wb-hud-group .segmented-button + .segmented-button {
  border-left: 0;
}

.wb-hud-group .segmented-button:first-child {
  border-radius: 10px 0 0 10px;
}

.wb-hud-group .segmented-button:last-child {
  border-radius: 0 10px 10px 0;
}

.wb-hud-group .segmented-button[aria-pressed="true"] {
  color: var(--text);
  background: var(--accent-soft);
}

.wb-stats {
  position: absolute;
  z-index: 8;
  top: 10px;
  right: 10px;
  max-width: 46%;
  padding: 5px 9px;
  border: 1px solid rgb(255 255 255 / 8%);
  border-radius: 10px;
  background: rgb(0 0 0 / 52%);
}

.wb-stats:empty {
  display: none;
}

.wb-shell .viewport-chrome {
  justify-content: space-between;
}

.wb-chrome-left {
  flex: 1 1 auto;
}

.wb-chrome-regions {
  display: flex;
  flex: 0 1 auto;
  align-items: center;
  gap: 2px;
  overflow: hidden;
}

.wb-chrome-regions button {
  min-height: 22px;
  padding: 0 8px;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  color: var(--text-muted);
  background: transparent;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}

.wb-chrome-regions button::before {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 5px;
  border-radius: 50%;
  background: var(--swatch, var(--accent));
  content: "";
}

.wb-chrome-regions button:hover,
.wb-chrome-regions button[aria-pressed="true"] {
  color: var(--text);
  border-color: var(--line-strong);
  background: var(--bg-3);
}

/* ---------- Pick card ---------- */

.wb-pick {
  top: var(--pick-y, 48px);
  left: var(--pick-x, 48px);
  width: min(300px, calc(100% - 16px));
}

.wb-pick::before {
  left: 18px;
}

.wb-pick-facts {
  display: grid;
  margin: 0;
  gap: 3px;
}

.wb-pick-facts > div {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 8px;
}

.wb-pick-facts dt {
  color: var(--text-dim);
  font-size: 10px;
}

.wb-pick-facts dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
  color: var(--text-muted);
  font-size: 10px;
}

.wb-pick .component-context-actions {
  flex-wrap: wrap;
}

.wb-pick .component-context-actions .small-button {
  border-radius: var(--radius-pill);
}

/* ---------- Mode rail ---------- */

.wb-shell .mode-rail {
  min-height: 36px;
}

.wb-shell .mode-button {
  min-height: 36px;
  gap: 5px;
}

.wb-shell .mode-glyph {
  display: grid;
  width: 16px;
  height: 16px;
  color: var(--text-dim);
  background: rgb(255 255 255 / 8%);
  font-size: 9px;
}

.wb-shell .mode-button[data-badge]::after {
  position: absolute;
  top: 5px;
  right: 6px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--warn);
  content: "";
}

.wb-shell .mode-button[data-badge="error"]::after {
  background: var(--error);
}

.wb-shell .mode-button[data-badge="ok"]::after {
  background: var(--ok);
}

/* ---------- Inspector building blocks ---------- */

.wb-note {
  margin: 0 0 var(--space-2);
  color: var(--text-dim);
  font-size: 11px;
  line-height: 1.5;
}

.wb-note b {
  color: var(--text-muted);
}

.wb-stage-list {
  display: grid;
  gap: 6px;
}

.wb-stage {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  padding: 8px;
  gap: 4px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg-1);
}

.wb-stage[data-status="idle"] {
  opacity: 0.6;
}

.wb-stage[data-status="ready"],
.wb-stage[data-status="done"] {
  border-color: rgb(0 186 124 / 35%);
}

.wb-stage[data-status="review"] {
  border-color: rgb(255 212 0 / 40%);
}

.wb-stage[data-status="active"] {
  border-color: rgb(29 155 240 / 55%);
}

.wb-stage-index {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border-radius: 50%;
  color: var(--text-dim);
  background: var(--bg-3);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 800;
}

.wb-stage[data-status="done"] .wb-stage-index,
.wb-stage[data-status="ready"] .wb-stage-index {
  color: #04120b;
  background: var(--ok);
}

.wb-stage[data-status="review"] .wb-stage-index {
  color: #1a1500;
  background: var(--warn);
}

.wb-stage[data-status="active"] .wb-stage-index {
  color: #fff;
  background: var(--accent);
  animation: status-pulse 1s ease-in-out infinite;
}

.wb-stage-head {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 6px;
}

.wb-stage-head strong {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wb-stage-facts {
  display: grid;
  grid-column: 2;
  margin: 0;
  gap: 2px;
}

.wb-stage-facts > div {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  gap: 6px;
}

.wb-stage-facts dt {
  color: var(--text-dim);
  font-size: 10px;
}

.wb-stage-facts dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
  color: var(--text-muted);
  font-size: 10px;
}

.wb-interp-chips .chip[data-tone="ok"] {
  color: var(--ok);
  border-color: rgb(0 186 124 / 40%);
}

.wb-interp-chips .chip[data-tone="warn"] {
  color: var(--warn);
  border-color: rgb(255 212 0 / 40%);
}

.wb-hooks {
  display: grid;
  margin: 0;
  padding: 0;
  gap: 3px;
  list-style: none;
}

.wb-hooks li {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: baseline;
  gap: 8px;
  color: var(--text-muted);
  font-size: 10px;
}

.wb-hooks code {
  color: var(--accent-hover);
  font-family: var(--font-mono);
  font-size: 10px;
}

.wb-trend {
  margin: var(--space-2) 0 0;
  padding: 8px 10px;
  border-left: 2px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text-muted);
  background: var(--bg-2);
  font-size: 11px;
  line-height: 1.45;
}

.wb-hash-list {
  display: grid;
  margin: 0;
  gap: 4px;
}

.wb-hash-list > div {
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr);
  gap: 6px;
}

.wb-hash-list dt {
  color: var(--text-dim);
  font-size: 10px;
}

.wb-hash-list dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 10px;
}

.wb-shell .plan-command {
  min-height: 36px;
}

.wb-shell .plan-command code {
  color: var(--text-dim);
}

/* Option rows: label, control, reading value */

.wb-option {
  display: grid;
  grid-template-columns: minmax(84px, 0.7fr) minmax(0, 1.3fr);
  align-items: center;
  min-height: var(--row-h);
  gap: var(--space-2);
}

.wb-option > label {
  min-width: 0;
  overflow: hidden;
  color: var(--text-muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wb-option-control {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 6px;
}

.wb-option-control select,
.wb-option-control input[type="range"] {
  min-width: 0;
  flex: 1;
}

.wb-option-control output {
  min-width: 44px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.wb-option[data-set="true"] > label {
  color: var(--text);
}

.wb-option[data-set="true"] .wb-option-control output {
  color: var(--accent-hover);
}

.wb-option-reset {
  width: 20px;
  min-height: 20px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: var(--text-dim);
  background: transparent;
  font-size: 12px;
  cursor: pointer;
}

.wb-option-reset:hover {
  color: var(--text);
  background: var(--bg-3);
}

.wb-option-reset[hidden] {
  display: none;
}

.wb-genre-rail .chip {
  min-height: 24px;
  padding: 0 10px;
  font-size: 11px;
}

.wb-genre-rail .chip[data-read="true"][aria-pressed="false"] {
  border-style: dashed;
  color: var(--text);
}

.wb-genre-family {
  margin: var(--space-2) 0 4px;
  color: var(--text-dim);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* Kit cards */

.wb-kit-list {
  display: grid;
  gap: 6px;
}

.wb-kit {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  padding: 8px 10px;
  gap: 2px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg-1);
  transition: border-color 140ms ease, background-color 140ms ease;
}

.wb-kit[data-enabled="true"] {
  border-color: rgb(0 186 124 / 35%);
  background: rgb(0 186 124 / 6%);
}

.wb-kit[data-enabled="false"] {
  opacity: 0.72;
}

.wb-kit-head {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 6px;
}

.wb-kit-head strong {
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wb-kit-blurb {
  grid-column: 1;
  margin: 0;
  color: var(--text-dim);
  font-size: 10px;
  line-height: 1.45;
}

.wb-kit-meta {
  display: flex;
  flex-wrap: wrap;
  grid-column: 1;
  margin-top: 2px;
  gap: 4px;
}

.wb-kit-swatch {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--swatch, var(--accent));
}

.wb-kit .switch {
  grid-row: 1 / span 3;
  align-self: start;
}

.wb-object-chip .badge {
  margin-left: 6px;
  min-height: 14px;
  padding: 0 4px;
  font-size: 9px;
}

.wb-outliner {
  display: grid;
  gap: 4px;
}

.wb-outliner details {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg-1);
}

.wb-outliner summary {
  display: flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  gap: 8px;
  color: var(--text);
  font-size: 11px;
  font-weight: 650;
  cursor: pointer;
  list-style: none;
}

.wb-outliner summary::-webkit-details-marker {
  display: none;
}

.wb-outliner summary::before {
  color: var(--text-dim);
  content: "›";
  transition: transform 140ms ease;
}

.wb-outliner details[open] summary::before {
  transform: rotate(90deg);
}

.wb-outliner summary .badge {
  margin-left: auto;
}

.wb-outliner-rows {
  display: grid;
  padding: 0 6px 6px;
  gap: 2px;
}

.wb-outliner-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  min-height: 26px;
  padding: 0 8px;
  gap: 8px;
  border: 0;
  border-radius: 6px;
  color: var(--text-muted);
  background: transparent;
  font-size: 10px;
  text-align: left;
  cursor: pointer;
}

.wb-outliner-row:hover,
.wb-outliner-row[aria-current="true"] {
  color: var(--text);
  background: var(--bg-3);
}

.wb-outliner-row code {
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 9px;
}

/* Regions and maps */

.wb-region-list {
  display: grid;
  gap: 6px;
}

.wb-region {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  align-items: center;
  width: 100%;
  min-height: 40px;
  padding: 6px 10px;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--text);
  background: var(--bg-1);
  text-align: left;
  cursor: pointer;
}

.wb-region:hover,
.wb-region[aria-current="true"] {
  border-color: var(--line-strong);
  background: var(--bg-3);
}

.wb-region[aria-current="true"] {
  box-shadow: inset 0 0 0 1px var(--swatch, var(--accent));
}

.wb-region-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--swatch, var(--accent));
}

.wb-region-copy {
  display: grid;
  min-width: 0;
}

.wb-region-copy strong {
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wb-region-copy small {
  color: var(--text-dim);
  font-size: 10px;
}

.wb-map-card {
  position: relative;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg-1);
}

.wb-map-card canvas {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 6px;
  background: #06080b;
  image-rendering: pixelated;
}

.wb-map-card[data-clickable="true"] canvas {
  cursor: crosshair;
  image-rendering: auto;
}

.wb-map-caption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 4px 2px 0;
  color: var(--text-dim);
  font-size: 10px;
}

.wb-map-caption button {
  min-height: 18px;
  padding: 0 7px;
  font-size: 9px;
}

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

.wb-legend {
  display: flex;
  flex-wrap: wrap;
  margin-top: 6px;
  gap: 4px 10px;
  color: var(--text-dim);
  font-size: 10px;
}

.wb-legend span::before {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 4px;
  border-radius: 2px;
  background: var(--swatch, #8b98a5);
  content: "";
  vertical-align: -1px;
}

.wb-legend span[data-shape="dot"]::before {
  border-radius: 50%;
}

.wb-material-bars {
  display: grid;
  gap: 5px;
}

.wb-material-bar {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr) 36px;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 10px;
}

.wb-material-bar .meter > span {
  background: var(--swatch, var(--accent));
}

.wb-material-bar output {
  color: var(--text-dim);
  font-family: var(--font-mono);
  text-align: right;
}

/* Playtest */

.wb-node-list {
  display: grid;
  gap: 4px;
}

.wb-node {
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr) auto;
  align-items: center;
  width: 100%;
  min-height: 30px;
  padding: 4px 10px;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  background: var(--bg-1);
  text-align: left;
  cursor: pointer;
}

.wb-node:hover,
.wb-node[aria-pressed="true"] {
  color: var(--text);
  border-color: rgb(10 132 255 / 56%);
  background: var(--accent-soft);
}

.wb-node-kind {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--swatch, var(--accent));
}

.wb-node strong {
  overflow: hidden;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wb-node small {
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 9px;
}

.wb-log {
  display: grid;
  margin: 0;
  padding: 0;
  gap: 2px;
  list-style: none;
  counter-reset: step;
}

.wb-log li {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  gap: 6px;
  border-radius: 6px;
  color: var(--text-muted);
  background: var(--bg-1);
  font-size: 10px;
  counter-increment: step;
}

.wb-log li::before {
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 9px;
  content: counter(step);
}

.wb-log li[data-current="true"] {
  color: var(--text);
  background: var(--accent-soft);
}

.wb-log code {
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 9px;
}

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

.wb-evidence > div {
  display: grid;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-2);
}

.wb-evidence dt {
  color: var(--text-dim);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.wb-evidence dd {
  margin: 2px 0 0;
  overflow-wrap: anywhere;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 10px;
}

/* Release: budgets */

.wb-budget-device {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg-1);
}

.wb-budget-device + .wb-budget-device {
  margin-top: 6px;
}

.wb-budget-device[data-ok="false"] {
  border-color: rgb(244 33 46 / 45%);
}

.wb-budget-head {
  display: flex;
  align-items: center;
  margin-bottom: 6px;
  gap: 8px;
}

.wb-budget-head strong {
  flex: 1;
  font-size: 11px;
  text-transform: capitalize;
}

.wb-budget-rows {
  display: grid;
  gap: 5px;
}

.wb-budget-row {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr) 84px;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 10px;
}

.wb-budget-row output {
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 9px;
  text-align: right;
  white-space: nowrap;
}

/* Lookbook */

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

.wb-look {
  display: grid;
  padding: 6px;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--text);
  background: var(--bg-1);
  text-align: left;
  cursor: pointer;
}

.wb-look:hover {
  border-color: var(--line-strong);
  background: var(--bg-3);
}

.wb-look[aria-current="true"] {
  border-color: rgb(10 132 255 / 56%);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.wb-look canvas {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 6px;
  background: #06080b;
  image-rendering: pixelated;
}

.wb-look-head {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
}

.wb-look-head .badge {
  margin-left: auto;
}

.wb-look small {
  overflow: hidden;
  color: var(--text-dim);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wb-look[data-building="true"] {
  opacity: 0.6;
  animation: status-pulse 1.2s ease-in-out infinite;
}

.wb-swarm-notes {
  display: grid;
  gap: 4px;
}

.wb-shell .toast-region {
  top: calc(var(--topbar-height) + 10px);
  right: auto;
  bottom: auto;
  left: 50%;
  width: min(360px, calc(100vw - 24px));
  transform: translateX(-50%);
}

/* ---------- Responsive ---------- */

@media (max-width: 1180px) {
  :root {
    --wb-deck-w: min(360px, 40vw);
  }

  .wb-hud-group[aria-label="Surface overlay"] .segmented-button:nth-child(n + 4) {
    display: none;
  }
}

@media (max-width: 940px) {
  .wb-shell .left-dock {
    width: min(320px, 44vw);
    max-height: min(46vh, 420px);
  }
}

@media (max-width: 820px) {
  .wb-shell .wb-grid {
    display: block;
  }

  .wb-brand,
  .wb-brand-sep,
  .wb-seed-field,
  .wb-shell [data-action="shuffle"] {
    display: none;
  }

  .wb-shell .workspace-name {
    max-width: 128px;
  }

  .wb-shell .left-dock {
    width: 100%;
    height: min(52dvh, 520px);
    max-height: calc(100dvh - var(--topbar-height) - var(--mobile-nav-height) - env(safe-area-inset-bottom));
  }

  .wb-shell[data-mobile-sheet="left"] .left-dock {
    height: min(60dvh, 620px);
  }

  .wb-shell .wb-deck {
    position: fixed;
    z-index: 90;
    right: 0;
    bottom: calc(var(--mobile-nav-height) + env(safe-area-inset-bottom));
    left: 0;
    width: 100%;
    height: min(58dvh, 560px);
    border: 1px solid var(--line-strong);
    border-width: 1px 0 0;
    border-radius: 14px 14px 0 0;
  }

  .wb-shell .wb-deck .inspector {
    height: auto;
  }

  .wb-shell .mobile-sheet-nav {
    grid-template-columns: repeat(3, 1fr);
  }

  .wb-hud {
    top: 6px;
    left: 6px;
    gap: 4px;
  }

  .wb-hud-group[aria-label="World layer"] {
    display: none;
  }

  .wb-stats {
    top: auto;
    bottom: 40px;
    right: 6px;
    max-width: 60%;
  }

  .wb-shell .viewport-chrome {
    position: absolute;
    bottom: 6px;
    left: 6px;
    display: flex;
    max-width: calc(100% - 12px);
    padding: 2px;
    border: 1px solid rgb(47 51 54 / 80%);
    border-radius: var(--radius-lg);
    background: rgb(22 24 28 / 90%);
  }

  .wb-chrome-regions {
    display: none;
  }

  .wb-pick {
    top: auto !important;
    bottom: 48px;
    left: 8px !important;
    width: calc(100% - 16px);
  }

  .wb-pick::before {
    display: none;
  }

  .wb-map-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .wb-stage[data-status="active"] .wb-stage-index,
  .wb-look[data-building="true"],
  .wb-shell .save-status[data-status="compiling"]::before {
    animation: none;
  }
}

@media (forced-colors: active) {
  .wb-region-dot,
  .wb-node-kind,
  .wb-kit-swatch,
  .wb-legend span::before {
    forced-color-adjust: none;
  }
}
