:root {
  color-scheme: light;
  --bg: #f3f0e7;
  --surface: #fffdf8;
  --surface-2: #ebe4d4;
  --ink: #1d1c18;
  --muted: #70695c;
  --line: #d2c6ae;
  --accent: #ff6a00;
  --accent-2: #3a6073;
  --good: #1f9d5a;
  --warn: #c8782a;
  --bad: #c83f2a;
  --radius: 14px;
  --density: 1;
  --shadow: 0 16px 40px rgba(27, 22, 16, 0.12);
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
}

body {
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent) 9%, transparent), transparent 44%),
    linear-gradient(225deg, color-mix(in srgb, var(--accent-2) 8%, transparent), transparent 38%),
    var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  line-height: 1.35;
}

button,
input,
textarea,
select {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button,
.resource-card a {
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) * 0.7);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  font-weight: 800;
  text-decoration: none;
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease;
}

button {
  padding: calc(7px * var(--density)) calc(10px * var(--density));
}

button:hover,
.resource-card a:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
a:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 42%, transparent);
  outline-offset: 2px;
}

h1,
h2,
h3,
p {
  margin: 0;
}

small,
.small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

code {
  font-family: var(--font-mono);
  font-size: 11px;
}

.lab-shell {
  display: grid;
  grid-template-columns: minmax(280px, 340px) minmax(460px, 1fr) minmax(300px, 360px);
  gap: 14px;
  min-height: 100vh;
  padding: 14px;
}

.rail {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.left-rail,
.right-rail {
  position: sticky;
  top: 14px;
  align-self: start;
  max-height: calc(100vh - 28px);
  overflow: auto;
  padding-right: 2px;
}

.panel {
  border: 1px solid color-mix(in srgb, var(--line) 92%, transparent);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  box-shadow: var(--shadow);
  padding: calc(13px * var(--density));
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
}

.brand h1 {
  font-size: 20px;
}

.brand p,
.stage-top p {
  color: var(--muted);
  font-size: 13px;
}

.mark {
  display: grid;
  place-items: center;
  width: 43px;
  height: 43px;
  border-radius: calc(var(--radius) * 0.75);
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  font-family: var(--font-mono);
  font-weight: 950;
  box-shadow: inset 0 -8px 18px rgba(0, 0, 0, 0.18);
}

.view-tabs,
.pill-wrap,
.stage-actions,
.device-switch,
.inline-actions,
.export-grid,
.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.view-tabs button,
.pill-wrap button,
.device-switch button,
.stage-actions button,
.inline-actions button,
.card-actions button,
.export-grid button {
  font-size: 12px;
  padding: 7px 10px;
}

.is-active,
button.is-active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, var(--surface));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 34%, transparent);
}

.search,
.field,
.range-row,
.color-row {
  display: grid;
  gap: 6px;
}

.search {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 10px;
  box-shadow: var(--shadow);
}

.search span,
.field span,
.range-row span,
.color-row span {
  color: var(--muted);
  font: 800 10px var(--font-mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) * 0.65);
  background: var(--surface);
  color: var(--ink);
  padding: 9px 10px;
}

textarea {
  min-height: 86px;
  resize: vertical;
}

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

.panel h2 {
  color: var(--muted);
  font: 900 11px var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 22px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 16%, var(--surface));
  color: var(--ink);
  font: 900 11px var(--font-mono);
}

.library-list,
.clip-list,
.element-list,
.resource-list {
  display: grid;
  gap: 8px;
}

.theme-card,
.recipe-card,
.clip-card > button,
.element-card,
.mechanic-card,
.motion-card,
.branch-card > button,
.redesign-card > button,
.station-card > button,
.asset-card > button,
.prompt-card > button,
.qa-card > button,
.loop-card,
.tool-card,
.resource-card,
.stack-row {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) * 0.85);
  background: var(--surface);
  color: var(--ink);
  text-align: left;
}

.theme-card,
.element-card,
.resource-card,
.stack-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
}

.theme-card,
.recipe-card,
.clip-card > button,
.element-card,
.mechanic-card,
.motion-card,
.branch-card > button,
.redesign-card > button,
.station-card > button,
.asset-card > button,
.prompt-card > button,
.qa-card > button,
.loop-card,
.tool-card {
  padding: 10px;
}

.theme-card strong,
.recipe-card strong,
.clip-card strong,
.element-card strong,
.mechanic-card strong,
.motion-card strong,
.branch-card strong,
.redesign-card strong,
.station-card strong,
.asset-card strong,
.prompt-card strong,
.qa-card strong,
.loop-card strong,
.tool-card strong,
.resource-card strong,
.stack-row b {
  display: block;
  font-size: 13px;
}

.theme-card small,
.recipe-card small,
.clip-card small,
.element-card small,
.mechanic-card small,
.motion-card small,
.branch-card small,
.redesign-card small,
.station-card small,
.asset-card small,
.prompt-card small,
.qa-card small,
.loop-card small,
.tool-card small,
.resource-card small,
.stack-row small {
  margin-top: 3px;
}

.swatches {
  display: flex;
  gap: 4px;
}

.swatch {
  width: 17px;
  height: 17px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.22);
}

.recipe-card span {
  display: inline-block;
  margin-top: 8px;
  color: var(--accent);
  font: 900 10px var(--font-mono);
  text-transform: uppercase;
}

.clip-card {
  display: grid;
  gap: 5px;
}

.branch-card,
.redesign-card,
.station-card,
.asset-card,
.prompt-card,
.qa-card {
  display: grid;
  gap: 6px;
}

.clip-card > button {
  cursor: pointer;
}

.card-actions button {
  flex: 1;
  background: color-mix(in srgb, var(--surface-2) 54%, var(--surface));
}

.soft-pill {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface-2) 48%, var(--surface));
  color: var(--muted);
  font: 850 10px var(--font-mono);
  padding: 5px 8px;
  text-transform: uppercase;
}

.tiny,
.eyebrow {
  display: block;
  color: var(--muted);
  font: 900 10px var(--font-mono);
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.asset-dot {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 76%, #fff), var(--accent-2));
  color: #fff;
  font: 900 10px var(--font-mono);
}

.mechanic-card span {
  display: block;
  color: var(--ink);
  font-size: 12px;
  margin-top: 6px;
}

.loop-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 6px;
}

.branch-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 8px;
}

.branch-metrics i {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface-2) 54%, var(--surface));
  color: var(--muted);
  font: 850 10px var(--font-mono);
  padding: 4px 7px;
  font-style: normal;
}

.branch-actions {
  margin: 10px 0;
}

.compare-grid {
  display: grid;
  grid-template-columns: minmax(76px, 0.9fr) repeat(2, minmax(0, 1fr));
  gap: 6px;
  align-items: stretch;
}

.compare-grid > b {
  color: var(--muted);
  font: 900 10px var(--font-mono);
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.compare-row {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: minmax(76px, 0.9fr) repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.compare-row > * {
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) * 0.55);
  background: color-mix(in srgb, var(--surface-2) 34%, var(--surface));
  padding: 8px;
  font-size: 12px;
}

.compare-row b {
  color: var(--muted);
  font: 900 10px var(--font-mono);
  text-transform: uppercase;
}

.compare-row.is-different > * {
  border-color: color-mix(in srgb, var(--accent) 48%, var(--line));
  background: color-mix(in srgb, var(--accent) 9%, var(--surface));
}

.asset-card p,
.branch-card p,
.redesign-card p,
.qa-card p,
.tool-card p {
  color: var(--ink);
  font-size: 12px;
  margin: 0;
}

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

.tool-card {
  display: grid;
  gap: 5px;
}

.motion-card {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 9px;
  align-items: center;
}

.motion-demo {
  display: block;
  width: 28px;
  height: 28px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}

.resource-card {
  padding: 11px;
}

.resource-card p {
  color: var(--ink);
  font-size: 12px;
  margin-top: 8px;
}

.resource-card a {
  align-self: start;
  padding: 7px 9px;
  font-size: 12px;
}

.stage {
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  gap: 14px;
  min-width: 0;
}

.stage-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
}

.stage-top h2 {
  font-size: clamp(24px, 4vw, 42px);
  line-height: 1;
  letter-spacing: 0;
  margin: 5px 0 4px;
}

.work-row {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) repeat(6, minmax(84px, auto));
  gap: 10px;
}

.device-switch {
  align-items: center;
}

.device-switch > span,
.lab-stat span {
  color: var(--muted);
  font: 900 10px var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.lab-stat {
  display: grid;
  align-content: center;
  min-width: 92px;
  padding: 10px 12px;
}

.lab-stat b {
  font: 950 18px var(--font-mono);
  white-space: nowrap;
}

.canvas-zone {
  display: grid;
  place-items: center;
  min-height: 620px;
  overflow: hidden;
}

.preview-frame {
  width: 100%;
  max-width: 430px;
  min-height: 640px;
  border: 10px solid color-mix(in srgb, var(--ink) 88%, #000);
  border-radius: 34px;
  background: #101010;
  padding: 12px;
  transition: max-width 180ms ease, min-height 180ms ease;
}

.preview-frame.device-tablet {
  max-width: 720px;
  min-height: 600px;
  border-radius: 28px;
}

.preview-frame.device-wide {
  max-width: 980px;
  min-height: 560px;
  border-radius: 24px;
}

.preview-app {
  min-height: inherit;
  border-radius: 22px;
  overflow: hidden;
  background:
    linear-gradient(145deg, color-mix(in srgb, var(--accent) 10%, transparent), transparent 36%),
    var(--bg);
  color: var(--ink);
}

.app-chrome {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
}

.app-chrome strong {
  display: block;
  font-size: 19px;
}

.chrome-pills {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.chrome-pills span {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font: 850 10px var(--font-mono);
  padding: 5px 7px;
}

.preview-canvas {
  display: grid;
  gap: 10px;
  padding: 13px;
}

.device-wide .preview-canvas,
.device-tablet .preview-canvas {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
}

.preview-block {
  position: relative;
  min-height: 88px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface) 96%, transparent);
  padding: 12px;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.07);
  overflow: hidden;
}

.preview-block.size-compact {
  min-height: 64px;
  padding: 9px;
}

.preview-block.size-feature {
  grid-column: 1 / -1;
  min-height: 154px;
  padding: 16px;
}

.preview-block.is-selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 24%, transparent), 0 12px 30px rgba(0, 0, 0, 0.1);
}

.block-tools {
  position: absolute;
  z-index: 4;
  top: 7px;
  right: 7px;
  display: none;
  gap: 4px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.preview-block:hover .block-tools,
.preview-block.is-selected .block-tools {
  display: flex;
}

.block-tools button {
  padding: 4px 6px;
  font: 850 10px var(--font-mono);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
}

.hero-card {
  display: grid;
  gap: 10px;
  padding-right: 70px;
}

.hero-card h3,
.boss-demo h3,
.bench-card h3 {
  font-size: 22px;
  line-height: 1.04;
}

.hero-card p,
.boss-demo p,
.bench-card p {
  color: var(--muted);
  font-size: 13px;
}

.hero-card button,
.modal-demo button,
.command-demo button {
  width: fit-content;
  background: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 88%, #000);
  color: #fff;
}

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

.status-grid div,
.quest-demo div,
.builder-demo div,
.resource-demo,
.bars-demo,
.boss-demo,
.receipt-demo,
.inspector-demo,
.empty-demo,
.loot-demo {
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) * 0.75);
  background: color-mix(in srgb, var(--surface-2) 42%, var(--surface));
  padding: 10px;
}

.status-grid span,
.bar-row span,
.quest-demo span,
.builder-demo small {
  color: var(--muted);
  font: 850 10px var(--font-mono);
  text-transform: uppercase;
}

.status-grid b {
  display: block;
  font: 950 20px var(--font-mono);
  margin-top: 4px;
}

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

.door-grid button {
  min-height: 64px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 85%, #fff), var(--accent-2));
  color: #fff;
  border-color: transparent;
}

.arena-demo,
.ladder-demo,
.quest-demo,
.builder-demo,
.deck-demo,
.pattern-demo,
.resource-demo,
.bars-demo,
.replay-demo {
  display: grid;
  gap: 8px;
}

.versus {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
  text-align: center;
}

.versus span {
  border-radius: 999px;
  background: var(--accent-2);
  color: #fff;
  font: 900 10px var(--font-mono);
  padding: 5px 7px;
}

.track-demo {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 4px;
}

.track-demo span {
  height: 18px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: color-mix(in srgb, var(--surface-2) 70%, var(--surface));
}

.track-demo span.past {
  background: color-mix(in srgb, var(--good) 46%, var(--surface));
}

.track-demo span.cart {
  background: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 26%, transparent);
}

.track-demo.foe span.past {
  background: color-mix(in srgb, var(--warn) 52%, var(--surface));
}

.dice-demo {
  display: grid;
  grid-template-columns: auto auto 1fr;
  gap: 10px;
  align-items: center;
}

.die {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: var(--ink);
  color: var(--surface);
  font: 950 22px var(--font-mono);
  box-shadow: inset 0 -6px 14px rgba(255, 255, 255, 0.12);
}

.meter {
  height: 9px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--line) 78%, transparent);
  overflow: hidden;
}

.meter i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

.ladder-demo > div,
.bar-row {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 8px;
  align-items: center;
}

.quest-demo div,
.builder-demo div,
.replay-demo p,
.stack-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.quest-demo b,
.builder-demo strong {
  color: var(--good);
  font-family: var(--font-mono);
}

.tree-demo,
.timeline-demo,
.map-demo {
  display: grid;
  grid-template-columns: auto 1fr auto 1fr auto 1fr auto;
  gap: 7px;
  align-items: center;
}

.tree-demo span,
.timeline-demo span,
.map-demo span,
.deck-demo span,
.pattern-demo span,
.inventory-demo span,
.calendar-demo span,
.collection-demo span,
.risk-demo button,
.nav-demo span {
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) * 0.65);
  background: color-mix(in srgb, var(--surface-2) 55%, var(--surface));
  padding: 8px;
  text-align: center;
  font: 850 11px var(--font-mono);
}

.tree-demo i,
.timeline-demo i,
.map-demo i {
  height: 3px;
  border-radius: 999px;
  background: var(--line);
}

.receipt-demo {
  position: relative;
  min-height: 100px;
  overflow: hidden;
  display: grid;
  align-content: center;
  gap: 5px;
}

.scan-line {
  position: absolute;
  left: 0;
  right: 0;
  top: 20px;
  height: 2px;
  background: var(--accent);
  opacity: 0.8;
}

.inventory-demo,
.calendar-demo,
.collection-demo,
.deck-demo,
.pattern-demo {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 7px;
}

.collection-demo span {
  aspect-ratio: 1;
  padding: 0;
  background: color-mix(in srgb, var(--surface-2) 60%, var(--surface));
}

.collection-demo span.on {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}

.budget-demo,
.avatar-demo {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: center;
}

.ring,
.avatar-core {
  display: grid;
  place-items: center;
  width: 74px;
  height: 74px;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, var(--surface) 44%, transparent 46%),
    conic-gradient(var(--accent) 0 66%, color-mix(in srgb, var(--line) 80%, transparent) 0);
  color: var(--ink);
  font: 950 15px var(--font-mono);
}

.avatar-core {
  border-radius: 22px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
}

.command-demo {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  padding: 8px;
}

.command-demo span {
  color: var(--muted);
  padding-left: 8px;
}

.inspector-demo .mini-controls {
  display: flex;
  gap: 7px;
  margin-top: 10px;
}

.mini-controls i {
  display: block;
  width: 34px;
  height: 20px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

.modal-demo {
  display: grid;
  gap: 8px;
  max-width: 260px;
  margin: 6px auto;
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) * 1.1);
  background: var(--surface);
  padding: 14px;
  box-shadow: var(--shadow);
}

.risk-demo {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.replay-demo p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.replay-demo span {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
}

.nav-demo {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 7px;
}

.bench-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 12px;
}

.bench-card {
  display: grid;
  gap: 8px;
  align-content: start;
}

.bench-card hr {
  width: 100%;
  border: 0;
  border-top: 1px solid var(--line);
  margin: 4px 0;
}

.fork-line {
  display: grid;
  grid-template-columns: auto 1fr auto 1fr auto;
  align-items: center;
  gap: 7px;
  overflow: hidden;
}

.fork-line span {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface-2) 48%, var(--surface));
  color: var(--muted);
  font: 850 10px var(--font-mono);
  padding: 5px 7px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fork-line i {
  height: 2px;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

.stack-card {
  max-height: 320px;
  overflow: auto;
}

.qa-mini {
  display: grid;
  gap: 3px;
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) * 0.65);
  background: color-mix(in srgb, var(--surface-2) 42%, var(--surface));
  padding: 8px;
}

.qa-mini b {
  font-size: 12px;
}

.stack-row {
  padding: 9px;
  cursor: grab;
}

.stack-row div {
  display: flex;
  gap: 5px;
}

.stack-row button {
  padding: 4px 6px;
  font: 850 10px var(--font-mono);
}

.right-rail .panel {
  display: grid;
  gap: 10px;
}

.color-row {
  grid-template-columns: 86px 44px 1fr;
  align-items: center;
}

.color-row input {
  height: 34px;
  padding: 2px;
}

.color-row code {
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
}

.range-row {
  grid-template-columns: 76px 1fr 42px;
  align-items: center;
}

.range-row b {
  font: 900 11px var(--font-mono);
  color: var(--muted);
}

.dropzone {
  display: grid;
  place-items: center;
  min-height: 68px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface-2) 44%, var(--surface));
  color: var(--muted);
  font-weight: 800;
  text-align: center;
  padding: 10px;
  cursor: pointer;
}

.dropzone input {
  display: none;
}

.copybox {
  position: fixed;
  left: -1000px;
  top: -1000px;
}

.motion-settle {
  animation: settle 1.5s ease-in-out infinite alternate;
}

.motion-roll {
  animation: roll 1.4s cubic-bezier(.2, .9, .2, 1) infinite;
}

.motion-pulse {
  animation: pulse 1.3s ease-in-out infinite;
}

.motion-race {
  animation: race 2s linear infinite;
}

.motion-flip {
  animation: flip 2.2s ease-in-out infinite;
  transform-style: preserve-3d;
}

.motion-shimmer {
  position: relative;
  overflow: hidden;
}

.motion-shimmer::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 0 38%, rgba(255,255,255,.28) 50%, transparent 62% 100%);
  transform: translateX(-120%);
  animation: shimmer 2.2s ease-in-out infinite;
}

.motion-heat {
  animation: heat 1.8s ease-in-out infinite;
}

.motion-stack {
  animation: stack 1.6s ease-in-out infinite;
}

.motion-scan {
  animation: scanGlow 1.8s ease-in-out infinite;
}

.motion-orbit {
  animation: orbit 2.6s ease-in-out infinite;
}

@keyframes settle {
  from { transform: translateY(0); }
  to { transform: translateY(-2px); }
}

@keyframes roll {
  0% { transform: rotate(0deg) translateY(0); }
  50% { transform: rotate(4deg) translateY(-3px); }
  100% { transform: rotate(0deg) translateY(0); }
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 28%, transparent); }
  50% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--accent) 0%, transparent); }
}

@keyframes race {
  0% { background-position: 0 0; }
  100% { background-position: 36px 0; }
}

@keyframes flip {
  0%, 100% { transform: rotateY(0); }
  50% { transform: rotateY(5deg); }
}

@keyframes shimmer {
  to { transform: translateX(120%); }
}

@keyframes heat {
  0%, 100% { filter: saturate(1); }
  50% { filter: saturate(1.35) brightness(1.06); }
}

@keyframes stack {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-2px) scale(1.006); }
}

@keyframes scanGlow {
  0%, 100% { border-color: var(--line); }
  50% { border-color: var(--accent); }
}

@keyframes orbit {
  0%, 100% { transform: rotate(-.4deg); }
  50% { transform: rotate(.4deg); }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

@media (max-width: 1180px) {
  .lab-shell {
    grid-template-columns: minmax(260px, 320px) 1fr;
  }

  .right-rail {
    position: static;
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    max-height: none;
  }
}

@media (max-width: 860px) {
  .lab-shell,
  .work-row,
  .bench-grid,
  .right-rail {
    grid-template-columns: 1fr;
  }

  .left-rail,
  .right-rail {
    position: static;
    max-height: none;
  }

  .stage-top {
    align-items: stretch;
    flex-direction: column;
  }

  .canvas-zone {
    min-height: 520px;
  }

  .preview-frame,
  .preview-frame.device-tablet,
  .preview-frame.device-wide {
    max-width: 430px;
    min-height: 560px;
  }

  .device-wide .preview-canvas,
  .device-tablet .preview-canvas {
    grid-template-columns: 1fr;
  }
}
