:root {
  --frame: #1f1a15;
  --frame-deep: #14100d;
  --frame-soft: #2f2821;
  --paper: #d5c8b4;
  --paper-soft: #e8dece;
  --paper-strong: #c4b59e;
  --paper-blue: #c7e1f2;
  --paper-blue-strong: #a7d1ee;
  --ink: #181410;
  --ink-soft: #4f463c;
  --ink-faint: #796f63;
  --line: #3f352b;
  --line-soft: #75685b;
  --line-pale: rgba(63, 53, 43, 0.22);
  --viewport: #5b5952;
  --viewport-deep: #4a4842;
  --accent: #d69444;
  --accent-strong: #efbf79;
  --accent-blue: #57b5f1;
  --accent-blue-strong: #d2f0ff;
  --success: #6d8d54;
  --danger: #a75a54;
  --shadow: 0 18px 44px rgba(0, 0, 0, 0.3);
  --radius-lg: 14px;
  --radius-md: 10px;
  --radius-sm: 7px;
  font-family: "Cascadia Mono", "Consolas", "Courier New", monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  color: var(--ink);
  background:
    radial-gradient(circle at top, rgba(255, 226, 186, 0.08), transparent 24%),
    linear-gradient(180deg, #2a241d, #18130f 56%, #100c0a);
}

body {
  min-height: 100vh;
  image-rendering: pixelated;
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
}

body::before {
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 28px 28px;
  opacity: 0.24;
}

body::after {
  background: radial-gradient(circle at center, transparent 58%, rgba(0, 0, 0, 0.18));
}

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

button,
select,
input[type="text"],
textarea,
input[type="color"] {
  border: 2px solid var(--line);
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, var(--paper-soft), #ddd1bf 64%, #c8baa4);
  color: var(--ink);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.65),
    0 1px 0 rgba(0, 0, 0, 0.12);
}

button,
select,
input[type="text"] {
  min-height: 42px;
  padding: 0 12px;
}

textarea {
  width: 100%;
  min-height: 92px;
  padding: 10px 12px;
  resize: vertical;
}

button {
  cursor: pointer;
  font-weight: 700;
  letter-spacing: 0.02em;
  transition: transform 120ms steps(2, end), filter 120ms steps(2, end), background 120ms steps(2, end);
}

button:hover {
  transform: translateY(-1px);
  filter: brightness(1.02);
}

button:active {
  transform: translateY(1px);
}

button.secondary {
  background: linear-gradient(180deg, #e9e0d2, #cec0aa);
}

button.small {
  min-height: 36px;
  padding: 0 10px;
}

button:disabled,
input:disabled,
select:disabled,
textarea:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

input[type="range"] {
  width: 100%;
  padding: 0;
  border: none;
  background: transparent;
  appearance: none;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 12px;
  border: 2px solid var(--line);
  border-radius: 999px;
  background:
    linear-gradient(180deg, #f5eee1, #d3c4ae 62%, #c0b099),
    repeating-linear-gradient(90deg, transparent 0 10px, rgba(0, 0, 0, 0.08) 10px 11px);
}

input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 18px;
  height: 18px;
  margin-top: -5px;
  border: 2px solid var(--line);
  border-radius: 4px;
  background: linear-gradient(180deg, var(--accent-strong), var(--accent));
  box-shadow: 1px 1px 0 rgba(0, 0, 0, 0.24);
}

input[type="range"]::-moz-range-track {
  height: 12px;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: linear-gradient(180deg, #f5eee1, #d3c4ae 62%, #c0b099);
}

input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border: 2px solid var(--line);
  border-radius: 4px;
  background: linear-gradient(180deg, var(--accent-strong), var(--accent));
  box-shadow: 1px 1px 0 rgba(0, 0, 0, 0.24);
}

input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 0;
  border: 2px solid var(--line);
  border-radius: 3px;
  accent-color: var(--accent-blue);
}

input[type="color"] {
  width: 52px;
  min-height: 42px;
  padding: 4px;
}

select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--line) 50%),
    linear-gradient(135deg, var(--line) 50%, transparent 50%);
  background-position:
    calc(100% - 19px) calc(50% - 4px),
    calc(100% - 12px) calc(50% - 4px);
  background-size: 7px 7px, 7px 7px;
  background-repeat: no-repeat;
  padding-right: 34px;
}

canvas {
  display: block;
}

code {
  font-family: inherit;
}

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

h1,
h2,
h3,
strong,
button,
.field span,
.group-title,
.pill,
.viewport-label,
.preview-panel-head,
.upload-kicker,
.eyebrow,
.surface-head-copy h2,
.surface-head-copy h3 {
  text-transform: none;
  font-weight: 700;
}

.app-shell {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 100vh;
  padding: 12px;
}

.surface {
  position: relative;
  overflow: hidden;
  border: 2px solid var(--line);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(180deg, var(--paper-soft), var(--paper) 58%, var(--paper-strong)),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.08) 0 2px, transparent 2px 4px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.65),
    inset 0 -1px 0 rgba(0, 0, 0, 0.08),
    var(--shadow);
}

.surface::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.07), transparent 22%, transparent 78%, rgba(0, 0, 0, 0.06));
}

.topbar {
  display: grid;
  grid-template-columns: minmax(320px, 1.25fr) auto auto;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border-color: #524637;
  background:
    linear-gradient(180deg, #2a241d, #17120f 64%, #100c0a),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.03) 0 1px, transparent 1px 6px);
  color: #f2e7d4;
}

.topbar::before {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent 36%);
}

.brand-cluster {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 46px;
  aspect-ratio: 1;
  border: 2px solid #15374a;
  border-radius: 12px;
  background: linear-gradient(180deg, #7fd2ff, var(--accent-blue));
  color: #0e1b24;
  font-size: 1.05rem;
  font-weight: 800;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.brand-copy {
  min-width: 0;
}

.brand-copy h1 {
  margin-top: 2px;
  font-size: clamp(1.4rem, 2vw, 1.9rem);
  letter-spacing: 0.02em;
}

.eyebrow {
  color: #bfe7ff;
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.eyebrow-small {
  font-size: 0.64rem;
  letter-spacing: 0.12em;
}

.subtle,
.tiny-note {
  color: #c2b8a9;
}

.subtle {
  max-width: 720px;
  margin-top: 4px;
  line-height: 1.45;
  font-size: 0.78rem;
}

.topbar-stats,
.topbar-actions,
.stage-head-actions,
.callout-actions,
.stage-status-row,
.asset-meta,
.export-meta,
.preset-actions {
  display: flex;
  gap: 10px;
}

.topbar-stats {
  flex-wrap: wrap;
  justify-content: center;
}

.topbar-actions {
  justify-content: flex-end;
  align-items: center;
  flex-wrap: wrap;
}

.topbar button,
.topbar select {
  border-color: #564a3d;
  color: #f5ecd9;
}

.topbar select,
.topbar button.secondary {
  background: linear-gradient(180deg, #312a22, #1d1814 66%, #16110f);
}

.topbar button:not(.secondary) {
  background: linear-gradient(180deg, #f6d39f, #c98640 70%, #b5702d);
  color: #1d130a;
}

.topbar select {
  min-width: 200px;
  background-image:
    linear-gradient(45deg, transparent 50%, #f0e7d6 50%),
    linear-gradient(135deg, #f0e7d6 50%, transparent 50%);
}

.stat-chip {
  min-width: 92px;
  padding: 10px 12px;
  border: 2px solid #4e4337;
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(0, 0, 0, 0.08));
  text-align: left;
}

.stat-chip strong {
  display: block;
  font-size: 1rem;
  color: #f6efde;
}

.stat-chip span {
  display: block;
  margin-top: 2px;
  color: #c0b49e;
  font-size: 0.74rem;
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  gap: 12px;
  align-items: start;
}

.workspace-main {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.stage-surface,
.sidebar-section,
.texture-surface,
.assets-surface {
  padding: 12px;
}

.stage-surface {
  min-height: 720px;
}

.surface-head {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin: -12px -12px 12px;
  padding: 9px 12px;
  border-bottom: 2px solid #050403;
  background: linear-gradient(180deg, #2a241d, #161210 72%, #0d0a08);
  color: #f7edd8;
}

.surface-head-copy {
  min-width: 0;
}

.surface-head-copy h2,
.surface-head-copy h3 {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 3px;
  font-size: 0.98rem;
  line-height: 1.2;
}

.surface-head-copy h2::after,
.surface-head-copy h3::after {
  content: "";
  flex: 1;
  min-width: 46px;
  height: 2px;
  background: repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.5) 0 4px, transparent 4px 8px);
  opacity: 0.7;
}

.surface-head .eyebrow {
  color: #f1cd97;
}

.stage-head-actions {
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 10px;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: linear-gradient(180deg, #e7dcc9, #cdbda4);
  color: var(--ink);
  font-size: 0.74rem;
}

.pill.muted {
  background: linear-gradient(180deg, #d2e9f8, #b1d6ee);
}

.stage-status-row {
  position: relative;
  z-index: 1;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.info-strip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 12px;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 249, 237, 0.72);
  color: var(--ink);
}

.subtle-strip {
  background: rgba(208, 229, 243, 0.74);
}

.subtle-strip strong {
  color: var(--ink);
}

.info-dot {
  width: 9px;
  height: 9px;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: var(--accent);
}

.info-dot.cool {
  background: var(--accent-blue);
}

.viewport-layout {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  min-height: 562px;
}

.viewport-layout.compare {
  grid-template-columns: 1fr 1fr;
}

.viewport-card {
  position: relative;
  overflow: hidden;
  min-height: 562px;
  border: 2px solid var(--line);
  border-radius: var(--radius-md);
  background:
    linear-gradient(180deg, #66645d, #5a5851 44%, #4f4d47),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.03) 0 1px, transparent 1px 18px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.viewport-card::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 44px 44px;
  opacity: 0.75;
}

.viewport-label {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 2;
  padding: 6px 10px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  background: rgba(18, 16, 13, 0.62);
  color: #f9efde;
  font-size: 0.72rem;
}

.viewport-canvas {
  width: 100%;
  height: 100%;
  min-height: 562px;
}

.stage-callout {
  position: absolute;
  left: 26px;
  bottom: 26px;
  z-index: 3;
  max-width: 360px;
  padding: 14px;
  border: 2px solid #1f4f6c;
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, rgba(219, 242, 255, 0.97), rgba(179, 221, 248, 0.94));
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.18);
  transition: opacity 120ms steps(2, end), transform 120ms steps(2, end);
}

.stage-callout.is-hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(6px);
}

.stage-callout h3 {
  margin-top: 6px;
  font-size: 0.98rem;
}

.stage-callout p:last-of-type {
  margin-top: 8px;
  color: #23475d;
  line-height: 1.4;
  font-size: 0.82rem;
}

.callout-actions {
  margin-top: 12px;
  flex-wrap: wrap;
}

.callout-actions button:first-child {
  background: linear-gradient(180deg, #77c7f6, #3ea5e4);
}

.workspace-bottom-grid {
  display: grid;
  grid-template-columns: 1.08fr 0.92fr;
  gap: 12px;
}

.texture-preview-grid,
.upload-grid,
.summary-grid,
.quick-preset-grid,
.field-grid.two {
  display: grid;
}

.texture-preview-grid,
.upload-grid,
.summary-grid,
.quick-preset-grid {
  gap: 12px;
}

.texture-preview-grid,
.upload-grid,
.summary-grid,
.field-grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.preview-panel,
.summary-card,
.control-group,
.list-card,
.quick-preset-card {
  position: relative;
  overflow: hidden;
  border: 2px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 250, 242, 0.38);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

.preview-panel,
.summary-card,
.quick-preset-card,
.list-card {
  padding: 12px;
}

.preview-panel-head {
  color: var(--ink-soft);
  font-size: 0.8rem;
}

.preview-stage {
  position: relative;
  overflow: hidden;
  margin-top: 10px;
  border: 2px solid var(--line);
  border-radius: var(--radius-sm);
  aspect-ratio: 1;
  background:
    linear-gradient(45deg, rgba(80, 70, 60, 0.08) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(80, 70, 60, 0.08) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(80, 70, 60, 0.08) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(80, 70, 60, 0.08) 75%),
    #f1e8da;
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
}

.preview-stage canvas {
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
}

.preview-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  text-align: center;
  color: var(--ink-faint);
  line-height: 1.45;
  font-size: 0.8rem;
}

.preview-empty.is-hidden {
  display: none;
}

.upload-card {
  min-height: 120px;
  padding: 14px;
  border-radius: var(--radius-md);
  text-align: left;
  align-items: flex-start;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 6px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.42), rgba(212, 199, 178, 0.7)),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.08) 0 1px, transparent 1px 8px);
}

.upload-card.accent {
  background:
    linear-gradient(180deg, rgba(207, 234, 249, 0.8), rgba(171, 213, 238, 0.85)),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.08) 0 1px, transparent 1px 8px);
}

.upload-card.is-dragging {
  border-color: #2a7eae;
  background: linear-gradient(180deg, #e2f5ff, #bfe3f8);
}

.upload-card strong {
  font-size: 0.96rem;
}

.upload-card span:last-child,
.upload-card .upload-kicker {
  color: var(--ink-soft);
}

.upload-kicker {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.68rem;
}

.field-grid {
  margin-top: 12px;
  gap: 12px;
}

.field {
  display: grid;
  gap: 8px;
}

.field span {
  color: var(--ink-soft);
  font-size: 0.8rem;
}

.field span strong {
  color: var(--ink);
}

.field-tall {
  align-content: start;
}

.inline-field {
  grid-template-columns: 1fr auto;
  align-items: center;
}

.range-field input[type="range"] {
  margin-top: 1px;
}

.tint-field {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  align-items: end;
}

.tint-field > span {
  grid-column: 1 / -1;
}

.summary-grid {
  margin-top: 12px;
}

.summary-card span {
  display: block;
  color: var(--ink-soft);
  font-size: 0.74rem;
}

.summary-card strong {
  display: block;
  margin-top: 6px;
  font-size: 0.9rem;
  overflow-wrap: anywhere;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sidebar-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.control-group {
  padding: 12px;
}

.group-title {
  margin-bottom: 10px;
  color: var(--ink);
  font-size: 0.82rem;
  letter-spacing: 0.04em;
}

.swatch-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 22px;
}

.swatch {
  width: 22px;
  height: 18px;
  border: 2px solid rgba(0, 0, 0, 0.28);
  border-radius: 2px;
}

.swatch-empty {
  color: var(--ink-faint);
  font-size: 0.76rem;
}

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

.quick-preset-card {
  display: grid;
  gap: 10px;
}

.quick-preset-card strong,
.asset-meta strong {
  font-size: 0.9rem;
}

.quick-preset-card p,
.asset-meta span,
.export-meta,
.list-card > span {
  color: var(--ink-soft);
  font-size: 0.78rem;
  line-height: 1.4;
}

.quick-preset-card button,
.preset-actions button {
  width: 100%;
}

.stack-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.list-card {
  display: grid;
  gap: 10px;
}

.asset-meta,
.export-meta,
.preset-actions {
  align-items: center;
}

.asset-meta,
.export-meta {
  justify-content: space-between;
}

.asset-meta {
  align-items: flex-start;
}

.preset-actions {
  justify-content: flex-end;
}

.toast {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 30;
  min-width: 260px;
  max-width: min(420px, calc(100vw - 32px));
  padding: 12px 14px;
  border: 2px solid #1f4f6c;
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, #e2f5ff, #b8def3);
  color: #153549;
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.2);
  opacity: 0;
  pointer-events: none;
  transform: translateY(6px);
  transition: opacity 120ms steps(2, end), transform 120ms steps(2, end);
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

body.fullscreen-mode .app-shell {
  padding: 0;
}

body.fullscreen-mode .topbar,
body.fullscreen-mode .sidebar,
body.fullscreen-mode .workspace-bottom-grid {
  display: none;
}

body.fullscreen-mode .workspace-grid {
  grid-template-columns: 1fr;
}

body.fullscreen-mode .stage-surface {
  min-height: 100vh;
  border-radius: 0;
}

body.fullscreen-mode .viewport-card,
body.fullscreen-mode .viewport-canvas {
  min-height: calc(100vh - 170px);
}

@media (max-width: 1500px) {
  .topbar {
    grid-template-columns: 1fr;
  }

  .topbar-stats,
  .topbar-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 1280px) {
  .workspace-grid {
    grid-template-columns: 1fr;
  }

  .sidebar {
    order: 2;
  }
}

@media (max-width: 1040px) {
  .workspace-bottom-grid,
  .texture-preview-grid,
  .upload-grid,
  .summary-grid,
  .field-grid.two,
  .quick-preset-grid,
  .viewport-layout.compare {
    grid-template-columns: 1fr;
  }

  .stage-callout {
    position: relative;
    inset: auto;
    max-width: none;
    margin-top: 10px;
  }

  .viewport-card,
  .viewport-canvas {
    min-height: 420px;
  }
}

@media (max-width: 760px) {
  .app-shell {
    padding: 8px;
  }

  .brand-cluster {
    align-items: flex-start;
  }

  .stage-head-actions,
  .stage-status-row,
  .topbar-actions,
  .callout-actions {
    width: 100%;
  }

  .topbar-actions > *,
  .stage-head-actions > button,
  .callout-actions > button {
    flex: 1 1 160px;
  }

  .topbar select {
    min-width: 0;
    width: 100%;
  }

  .viewport-card,
  .viewport-canvas {
    min-height: 340px;
  }
}

.topbar-actions {
  align-items: flex-start;
}

button.secondary.danger {
  background: linear-gradient(180deg, #f0d4cf, #d9a39a 72%, #c27e74);
  color: #3f1713;
}

.progress-panel {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
  padding: 10px 12px;
  border: 2px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 250, 242, 0.82);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.progress-meta {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  font-size: 0.76rem;
  color: var(--ink-soft);
}

.progress-meta strong {
  color: var(--ink);
  text-align: center;
}

.progress-track {
  position: relative;
  overflow: hidden;
  height: 14px;
  border: 2px solid var(--line);
  border-radius: 999px;
  background:
    linear-gradient(180deg, #f4ecde, #d2c3ae 64%, #c0af96),
    repeating-linear-gradient(90deg, transparent 0 9px, rgba(0, 0, 0, 0.08) 9px 10px);
}

.progress-fill {
  width: 0;
  height: 100%;
  border-right: 2px solid rgba(0, 0, 0, 0.28);
  background:
    linear-gradient(90deg, #f3cb85, #d89d48 52%, #8ac67b),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.14) 0 8px, transparent 8px 16px);
  transition: width 180ms ease;
}

.progress-panel[data-state="queued"] .progress-fill,
.progress-panel[data-state="processing"] .progress-fill {
  background:
    linear-gradient(90deg, #f5d188, #dc9f49 48%, #da8c3d),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.18) 0 8px, transparent 8px 16px);
}

.progress-panel[data-state="ready"] .progress-fill {
  background:
    linear-gradient(90deg, #b8d98b, #78aa5f 62%, #5b8f46),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.16) 0 8px, transparent 8px 16px);
}

.progress-panel[data-state="error"] .progress-fill {
  background:
    linear-gradient(90deg, #efb0a6, #cf6c5e 62%, #a24b42),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.16) 0 8px, transparent 8px 16px);
}

.progress-panel.is-indeterminate .progress-fill {
  width: 42%;
  animation: progress-sweep 1s linear infinite;
}

@keyframes progress-sweep {
  0% {
    transform: translateX(-120%);
  }

  100% {
    transform: translateX(240%);
  }
}

.field,
.summary-card,
.quick-preset-card,
.list-card,
.control-group {
  min-width: 0;
}

.field input[type="text"],
.field select,
.field textarea {
  width: 100%;
}

.swatch-row {
  margin: 6px 0 8px;
  row-gap: 8px;
}

.stack-list {
  max-height: 260px;
  overflow-y: auto;
  padding-right: 4px;
}

.stack-list::-webkit-scrollbar {
  width: 10px;
}

.stack-list::-webkit-scrollbar-thumb {
  border: 2px solid rgba(0, 0, 0, 0);
  border-radius: 999px;
  background: rgba(63, 53, 43, 0.32);
  background-clip: padding-box;
}

.quick-preset-grid {
  align-items: start;
}

.preview-panel .preview-stage,
.preview-panel canvas {
  max-width: 100%;
}

@media (max-width: 760px) {
  .progress-meta {
    grid-template-columns: 1fr;
    justify-items: start;
  }
}

.info-strip {
  min-width: 0;
  max-width: 100%;
}

.info-strip span,
.info-strip strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.field input[type="text"],
.field select,
.field textarea {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.field textarea {
  text-overflow: clip;
}

.asset-meta > div,
.list-card > div,
.quick-preset-card > div {
  min-width: 0;
}

.asset-meta strong,
.asset-meta span,
.list-card strong,
.list-card > span,
.quick-preset-card p,
.quick-preset-card span {
  overflow-wrap: anywhere;
}

.quick-preset-grid,
.stack-list,
.field-grid.two {
  min-width: 0;
}

.workspace-picker {
  display: grid;
  gap: 4px;
  min-width: 220px;
  flex: 1 1 260px;
  max-width: 320px;
}

.workspace-picker span {
  color: #cdbc9f;
  font-size: 0.66rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.topbar .workspace-picker select {
  min-width: 0;
  width: 100%;
  border-color: #7c5b32;
  background:
    linear-gradient(180deg, #fff5df, #e5c898 70%, #c7945a),
    linear-gradient(45deg, transparent 50%, #2b1b10 50%),
    linear-gradient(135deg, #2b1b10 50%, transparent 50%);
  color: #24160d;
  font-weight: 800;
  text-shadow: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.topbar select option {
  color: #24160d;
  background: #f6ead5;
  font-weight: 700;
}

.topbar-actions > button {
  flex: 0 0 auto;
}

.library-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.library-actions > button {
  flex: 0 0 auto;
}

.app-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  color: #d5cab7;
}

.app-footer a {
  color: #8fd6ff;
}

.consent-banner[hidden] {
  display: none !important;
}

.consent-banner {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 16px;
  z-index: 28;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border: 2px solid #4f422f;
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, rgba(255, 246, 230, 0.98), rgba(228, 207, 171, 0.98));
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
}

.consent-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.consent-copy strong {
  color: #2b1a0d;
}

.consent-copy span {
  color: #58432f;
  font-size: 0.82rem;
  line-height: 1.45;
}

body.has-consent-banner .toast {
  bottom: 110px;
}

body.fullscreen-mode .app-footer,
body.fullscreen-mode .consent-banner {
  display: none;
}

@media (max-width: 980px) {
  .app-footer,
  .consent-banner {
    flex-direction: column;
    align-items: flex-start;
  }

  .workspace-picker {
    max-width: none;
  }
}


.settings-anchor {
  position: relative;
  display: flex;
  align-items: center;
}

.settings-toggle {
  display: grid;
  place-items: center;
  width: 42px;
  min-width: 42px;
  padding: 0;
}

.settings-toggle.is-open {
  border-color: #8d6b3b;
  filter: brightness(1.08);
}

.settings-toggle-icon {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.settings-panel[hidden] {
  display: none !important;
}

.settings-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 24;
  width: min(340px, calc(100vw - 32px));
  padding: 12px;
  border: 2px solid var(--line);
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, rgba(251, 245, 233, 0.98), rgba(224, 209, 185, 0.98));
  box-shadow: var(--shadow);
  display: grid;
  gap: 12px;
}

.settings-panel-head strong,
.settings-scale-readout strong,
.theme-option strong {
  display: block;
}

.settings-panel-head span,
.settings-scale-readout span,
.theme-option span,
.settings-label {
  color: var(--ink-soft);
  font-size: 0.76rem;
}

.settings-group {
  display: grid;
  gap: 8px;
}

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

.settings-scale-readout {
  min-width: 0;
  padding: 8px 10px;
  border: 2px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.35);
}

.theme-option-grid {
  display: grid;
  gap: 8px;
}

.theme-option {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 8px 10px;
  align-items: center;
  justify-items: start;
  min-height: 54px;
  padding: 10px 12px;
  text-align: left;
}

.theme-option .theme-chip {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(0, 0, 0, 0.3);
  border-radius: 999px;
  grid-row: span 2;
}

.theme-option.is-active {
  border-color: #8d6b3b;
  background: linear-gradient(180deg, #fff1cf, #e2bb7f 72%, #c8914f);
}

.theme-option[data-theme-choice="workshop"] .theme-chip {
  background: linear-gradient(180deg, #f3cb85, #d89d48 60%, #8b5b2d);
}

.theme-option[data-theme-choice="blueprint"] .theme-chip {
  background: linear-gradient(180deg, #d9f1ff, #6db8e8 60%, #245a7d);
}

.theme-option[data-theme-choice="midnight"] .theme-chip {
  background: linear-gradient(180deg, #b28cff, #5e69d9 56%, #161a39);
}

body[data-theme="blueprint"] {
  background:
    radial-gradient(circle at top, rgba(160, 220, 255, 0.14), transparent 25%),
    linear-gradient(180deg, #173447, #102535 58%, #0b1721);
}

body[data-theme="blueprint"] .topbar button,
body[data-theme="blueprint"] .topbar select,
body[data-theme="blueprint"] .stat-chip {
  border-color: #2a5b78;
}

body[data-theme="blueprint"] .topbar button,
body[data-theme="blueprint"] .topbar select {
  color: #eef8ff;
}

body[data-theme="blueprint"] .topbar select,
body[data-theme="blueprint"] .topbar button.secondary {
  background: linear-gradient(180deg, #2b5672, #18384f 66%, #11293a);
}

body[data-theme="blueprint"] .topbar button:not(.secondary) {
  background: linear-gradient(180deg, #dff3ff, #78c0ea 68%, #5599c2);
  color: #102535;
}

body[data-theme="blueprint"] .surface-head {
  border-bottom-color: #0a2435;
  background: linear-gradient(180deg, #376886, #1f445b 72%, #163245);
  color: #f4fbff;
}

body[data-theme="blueprint"] .surface-head .eyebrow {
  color: #b9e4ff;
}

body[data-theme="blueprint"] .pill.muted,
body[data-theme="blueprint"] .upload-card.accent {
  background: linear-gradient(180deg, #e6f6ff, #b9dcf1);
}

body[data-theme="midnight"] {
  background:
    radial-gradient(circle at top, rgba(124, 116, 255, 0.16), transparent 24%),
    linear-gradient(180deg, #15172a, #0d1020 56%, #080a14);
}

body[data-theme="midnight"] .topbar button,
body[data-theme="midnight"] .topbar select,
body[data-theme="midnight"] .stat-chip {
  border-color: #3f4d7c;
}

body[data-theme="midnight"] .topbar button,
body[data-theme="midnight"] .topbar select {
  color: #eef1ff;
}

body[data-theme="midnight"] .topbar select,
body[data-theme="midnight"] .topbar button.secondary {
  background: linear-gradient(180deg, #2a315b, #1a2144 66%, #121831);
}

body[data-theme="midnight"] .topbar button:not(.secondary) {
  background: linear-gradient(180deg, #f4d8ff, #9f85f4 68%, #7259cd);
  color: #110f25;
}

body[data-theme="midnight"] .surface-head {
  border-bottom-color: #090b16;
  background: linear-gradient(180deg, #2e3360, #1a1f41 72%, #12162f);
  color: #f5f3ff;
}

body[data-theme="midnight"] .surface-head .eyebrow {
  color: #d4cfff;
}

body[data-theme="midnight"] .pill.muted,
body[data-theme="midnight"] .upload-card.accent {
  background: linear-gradient(180deg, #dfe5ff, #b6bff0);
}

@media (max-width: 980px) {
  .settings-panel {
    right: auto;
    left: 0;
  }

  .settings-scale-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .settings-scale-readout {
    grid-column: 1 / -1;
    order: -1;
  }
}

.topbar.surface {
  overflow: visible;
  z-index: 70;
  isolation: isolate;
}

.workspace-grid {
  position: relative;
  z-index: 1;
}

.topbar {
  grid-template-columns: minmax(340px, 1.2fr) auto minmax(420px, 1fr);
  align-items: start;
}

.brand-copy {
  display: grid;
  gap: 6px;
}

.brand-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.brand-heading,
.brand-tools {
  min-width: 0;
}

.brand-tools {
  display: flex;
  flex: 0 0 auto;
  align-items: flex-start;
}

.topbar-stats {
  justify-content: flex-start;
  align-self: start;
}

.topbar-actions {
  align-items: flex-end;
  row-gap: 8px;
}

.topbar-actions > button {
  white-space: nowrap;
}

.workspace-picker {
  min-width: 176px;
  max-width: 250px;
  flex: 0 1 250px;
}

.settings-anchor {
  position: relative;
  z-index: 110;
  flex: 0 0 auto;
}

.settings-panel {
  top: calc(100% + 12px);
  right: 0;
  z-index: 140;
  width: min(390px, calc(100vw - 24px));
  max-height: min(72vh, 560px);
  overflow-y: auto;
  background: linear-gradient(180deg, var(--paper-soft), var(--paper) 66%, var(--paper-strong));
}

.settings-panel::-webkit-scrollbar {
  width: 10px;
}

.settings-panel::-webkit-scrollbar-thumb {
  border: 2px solid rgba(0, 0, 0, 0);
  border-radius: 999px;
  background: rgba(63, 53, 43, 0.32);
  background-clip: padding-box;
}

.settings-group + .settings-group {
  padding-top: 10px;
  border-top: 1px solid var(--line-pale);
}

.theme-option-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
}

.theme-option {
  min-height: 62px;
}

.theme-option.is-active {
  border-color: var(--line);
  background: linear-gradient(180deg, var(--accent-strong), var(--accent) 72%, var(--paper-strong));
  color: var(--ink);
}

.theme-option[data-theme-choice="modern"] .theme-chip {
  background: linear-gradient(180deg, #d3fbff, #57bee3 60%, #21455e);
}

.theme-option[data-theme-choice="clean"] .theme-chip {
  background: linear-gradient(180deg, #ffffff, #dce3e8 60%, #8a98a3);
}

.theme-option[data-theme-choice="dark"] .theme-chip {
  background: linear-gradient(180deg, #d7c7ff, #7767d5 56%, #1a2037);
}

.theme-option[data-theme-choice="light"] .theme-chip {
  background: linear-gradient(180deg, #fffaf0, #eeddb8 56%, #c79d62);
}

body[data-theme="modern"] {
  --paper: #d3dfe7;
  --paper-soft: #edf5fa;
  --paper-strong: #bcc9d2;
  --ink: #10202a;
  --ink-soft: #51626d;
  --ink-faint: #6f818c;
  --line: #355464;
  --line-soft: #597280;
  --line-pale: rgba(53, 84, 100, 0.22);
  --viewport: #586972;
  --viewport-deep: #47555d;
  --accent: #46a9d4;
  --accent-strong: #a5e7ff;
  --accent-blue: #72d8ff;
  --accent-blue-strong: #d8f6ff;
  background:
    radial-gradient(circle at top, rgba(120, 222, 255, 0.18), transparent 24%),
    linear-gradient(180deg, #1a2631, #111a22 58%, #0b1218);
}

body[data-theme="modern"] .topbar {
  border-color: #2a5064;
  background:
    linear-gradient(180deg, #1f3340, #13232d 64%, #0d181f),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.04) 0 1px, transparent 1px 6px);
  color: #eef9ff;
}

body[data-theme="modern"] .topbar .eyebrow,
body[data-theme="modern"] .topbar .subtle,
body[data-theme="modern"] .stat-chip span,
body[data-theme="modern"] .workspace-picker span {
  color: #b7d7e7;
}

body[data-theme="modern"] .brand-mark {
  border-color: #23566d;
  background: linear-gradient(180deg, #8de8ff, #44b6e0);
  color: #082230;
}

body[data-theme="modern"] .topbar button,
body[data-theme="modern"] .topbar select,
body[data-theme="modern"] .stat-chip {
  border-color: #376179;
  color: #eef9ff;
}

body[data-theme="modern"] .topbar select,
body[data-theme="modern"] .topbar button.secondary {
  background: linear-gradient(180deg, #30485a, #1b2d39 66%, #13222b);
}

body[data-theme="modern"] .topbar button:not(.secondary) {
  background: linear-gradient(180deg, #ebfbff, #79d0ef 68%, #4a99b9);
  color: #0c2230;
}

body[data-theme="modern"] .topbar .workspace-picker select {
  border-color: #58b0d6;
  background:
    linear-gradient(180deg, #f6fcff, #d3f0fd 70%, #93cfe6),
    linear-gradient(45deg, transparent 50%, #0f2330 50%),
    linear-gradient(135deg, #0f2330 50%, transparent 50%);
  color: #0f2330;
}

body[data-theme="modern"] .topbar select option {
  background: #edf9ff;
  color: #0f2330;
}

body[data-theme="modern"] .surface-head {
  border-bottom-color: #122f3f;
  background: linear-gradient(180deg, #31596f, #1d3f50 72%, #16303d);
  color: #f4fbff;
}

body[data-theme="modern"] .surface-head .eyebrow {
  color: #c8efff;
}

body[data-theme="modern"] .surface-head-copy h2::after,
body[data-theme="modern"] .surface-head-copy h3::after {
  background: repeating-linear-gradient(90deg, rgba(200, 239, 255, 0.7) 0 4px, transparent 4px 8px);
}

body[data-theme="modern"] .pill.muted,
body[data-theme="modern"] .upload-card.accent {
  background: linear-gradient(180deg, #e4f8ff, #b7def1);
}

body[data-theme="clean"] {
  --paper: #e5eaee;
  --paper-soft: #fafcfd;
  --paper-strong: #d4dbe1;
  --ink: #18212a;
  --ink-soft: #52616b;
  --ink-faint: #7b8790;
  --line: #7a8791;
  --line-soft: #9ba7af;
  --line-pale: rgba(122, 135, 145, 0.24);
  --viewport: #78818a;
  --viewport-deep: #646d76;
  --accent: #8d9ca8;
  --accent-strong: #e4eaef;
  --accent-blue: #98c4dc;
  --accent-blue-strong: #e5f1f7;
  background:
    radial-gradient(circle at top, rgba(255, 255, 255, 0.9), transparent 26%),
    linear-gradient(180deg, #eff3f6, #dfe5ea 64%, #cfd7de);
}

body[data-theme="clean"] .topbar {
  border-color: #98a4ae;
  background:
    linear-gradient(180deg, #f9fbfd, #dfe5eb 68%, #ccd4dc),
    repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.03) 0 1px, transparent 1px 6px);
  color: #18212a;
}

body[data-theme="clean"] .topbar .eyebrow,
body[data-theme="clean"] .topbar .subtle,
body[data-theme="clean"] .stat-chip span,
body[data-theme="clean"] .workspace-picker span {
  color: #5b6973;
}

body[data-theme="clean"] .brand-mark {
  border-color: #8896a1;
  background: linear-gradient(180deg, #ffffff, #dce3e8);
  color: #18212a;
}

body[data-theme="clean"] .topbar button,
body[data-theme="clean"] .topbar select,
body[data-theme="clean"] .stat-chip {
  border-color: #8f9ca7;
  color: #18212a;
}

body[data-theme="clean"] .topbar select,
body[data-theme="clean"] .topbar button.secondary,
body[data-theme="clean"] .stat-chip {
  background: linear-gradient(180deg, #ffffff, #ebeff3 66%, #dde3e8);
}

body[data-theme="clean"] .topbar button:not(.secondary) {
  background: linear-gradient(180deg, #37434a, #20282d 70%, #141b1f);
  color: #f4f7f8;
}

body[data-theme="clean"] .topbar .workspace-picker select {
  border-color: #93a0ab;
  background:
    linear-gradient(180deg, #ffffff, #edf1f4 70%, #dde3e8),
    linear-gradient(45deg, transparent 50%, #18212a 50%),
    linear-gradient(135deg, #18212a 50%, transparent 50%);
  color: #18212a;
}

body[data-theme="clean"] .topbar select option {
  background: #ffffff;
  color: #18212a;
}

body[data-theme="clean"] .surface-head {
  border-bottom-color: #8d99a3;
  background: linear-gradient(180deg, #f9fbfc, #dce4ea 72%, #c9d2da);
  color: #18212a;
}

body[data-theme="clean"] .surface-head .eyebrow {
  color: #5d6b75;
}

body[data-theme="clean"] .surface-head-copy h2::after,
body[data-theme="clean"] .surface-head-copy h3::after {
  background: repeating-linear-gradient(90deg, rgba(24, 33, 42, 0.26) 0 4px, transparent 4px 8px);
}

body[data-theme="clean"] .pill.muted,
body[data-theme="clean"] .upload-card.accent {
  background: linear-gradient(180deg, #f1f7fb, #d8e6ef);
}

body[data-theme="dark"] {
  --paper: #323848;
  --paper-soft: #43495b;
  --paper-strong: #242a39;
  --ink: #edf1ff;
  --ink-soft: #bcc6de;
  --ink-faint: #909bb4;
  --line: #5b6683;
  --line-soft: #7d88a6;
  --line-pale: rgba(164, 176, 214, 0.2);
  --viewport: #4c5568;
  --viewport-deep: #394153;
  --accent: #9077e7;
  --accent-strong: #ddd0ff;
  --accent-blue: #73d8ff;
  --accent-blue-strong: #d8f7ff;
  background:
    radial-gradient(circle at top, rgba(128, 109, 255, 0.18), transparent 24%),
    linear-gradient(180deg, #141722, #0d1118 56%, #090c12);
}

body[data-theme="dark"] .surface {
  background:
    linear-gradient(180deg, #353b4b, #2a3040 58%, #202534),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.04) 0 2px, transparent 2px 4px);
}

body[data-theme="dark"] .surface::before {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent 22%, transparent 78%, rgba(0, 0, 0, 0.12));
}

body[data-theme="dark"] button,
body[data-theme="dark"] select,
body[data-theme="dark"] input[type="text"],
body[data-theme="dark"] textarea,
body[data-theme="dark"] input[type="color"] {
  border-color: var(--line);
  background: linear-gradient(180deg, #484f62, #353b4d 64%, #2a3142);
  color: #eef1ff;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 1px 0 rgba(0, 0, 0, 0.22);
}

body[data-theme="dark"] button.secondary {
  background: linear-gradient(180deg, #42485a, #2f3444 66%, #252b38);
}

body[data-theme="dark"] .preview-panel,
body[data-theme="dark"] .summary-card,
body[data-theme="dark"] .control-group,
body[data-theme="dark"] .list-card,
body[data-theme="dark"] .quick-preset-card {
  background: rgba(18, 21, 29, 0.28);
}

body[data-theme="dark"] .preview-stage {
  background:
    linear-gradient(45deg, rgba(255, 255, 255, 0.03) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(255, 255, 255, 0.03) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(255, 255, 255, 0.03) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(255, 255, 255, 0.03) 75%),
    #222736;
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
}

body[data-theme="dark"] .topbar {
  border-color: #414a64;
  background:
    linear-gradient(180deg, #232840, #171c2f 64%, #111626),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.04) 0 1px, transparent 1px 6px);
  color: #eef1ff;
}

body[data-theme="dark"] .topbar .eyebrow,
body[data-theme="dark"] .topbar .subtle,
body[data-theme="dark"] .stat-chip span,
body[data-theme="dark"] .workspace-picker span {
  color: #b9c3de;
}

body[data-theme="dark"] .brand-mark {
  border-color: #4e628f;
  background: linear-gradient(180deg, #cfc3ff, #8b79eb);
  color: #15192d;
}

body[data-theme="dark"] .topbar button,
body[data-theme="dark"] .topbar select,
body[data-theme="dark"] .stat-chip {
  border-color: #505b78;
  color: #eef1ff;
}

body[data-theme="dark"] .topbar select,
body[data-theme="dark"] .topbar button.secondary,
body[data-theme="dark"] .stat-chip {
  background: linear-gradient(180deg, #313856, #212741 66%, #171c2e);
}

body[data-theme="dark"] .topbar button:not(.secondary) {
  background: linear-gradient(180deg, #f0e6ff, #b39df6 68%, #7d68d8);
  color: #15172a;
}

body[data-theme="dark"] .topbar .workspace-picker select {
  border-color: #737fd4;
  background:
    linear-gradient(180deg, #404769, #2c3350 70%, #202640),
    linear-gradient(45deg, transparent 50%, #eef1ff 50%),
    linear-gradient(135deg, #eef1ff 50%, transparent 50%);
  color: #eef1ff;
}

body[data-theme="dark"] .topbar select option {
  background: #252b3d;
  color: #eef1ff;
}

body[data-theme="dark"] .surface-head {
  border-bottom-color: #101423;
  background: linear-gradient(180deg, #4a5071, #313854 72%, #242b42);
  color: #f5f7ff;
}

body[data-theme="dark"] .surface-head .eyebrow {
  color: #d8d0ff;
}

body[data-theme="dark"] .surface-head-copy h2::after,
body[data-theme="dark"] .surface-head-copy h3::after {
  background: repeating-linear-gradient(90deg, rgba(232, 236, 255, 0.44) 0 4px, transparent 4px 8px);
}

body[data-theme="dark"] .pill.muted,
body[data-theme="dark"] .upload-card.accent {
  background: linear-gradient(180deg, #556182, #414d6d);
}

body[data-theme="dark"] .app-footer {
  color: #c9d1e4;
}

body[data-theme="dark"] .app-footer a {
  color: #95ddff;
}

body[data-theme="dark"] .consent-banner {
  border-color: #525d7b;
  background: linear-gradient(180deg, rgba(55, 61, 80, 0.98), rgba(39, 44, 60, 0.98));
}

body[data-theme="dark"] .consent-copy strong {
  color: #eef1ff;
}

body[data-theme="dark"] .consent-copy span {
  color: #c2ccdf;
}

body[data-theme="light"] {
  --paper: #ebe2d3;
  --paper-soft: #fff8ee;
  --paper-strong: #dcccb0;
  --ink: #20170f;
  --ink-soft: #5f4e3e;
  --ink-faint: #8a7764;
  --line: #8a755d;
  --line-soft: #b09b82;
  --line-pale: rgba(138, 117, 93, 0.22);
  --viewport: #8d7c6a;
  --viewport-deep: #766757;
  --accent: #d29b50;
  --accent-strong: #fae0b1;
  --accent-blue: #84cce9;
  --accent-blue-strong: #edf8ff;
  background:
    radial-gradient(circle at top, rgba(255, 255, 255, 0.88), transparent 26%),
    linear-gradient(180deg, #f8efdf, #efe4d2 62%, #dcc7a7);
}

body[data-theme="light"] .topbar {
  border-color: #9a8567;
  background:
    linear-gradient(180deg, #fff8ea, #ecd9bd 68%, #d7be97),
    repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.03) 0 1px, transparent 1px 6px);
  color: #24180d;
}

body[data-theme="light"] .topbar .eyebrow,
body[data-theme="light"] .topbar .subtle,
body[data-theme="light"] .stat-chip span,
body[data-theme="light"] .workspace-picker span {
  color: #6e5b46;
}

body[data-theme="light"] .brand-mark {
  border-color: #b18e63;
  background: linear-gradient(180deg, #fffdf5, #efd6aa);
  color: #2b1d11;
}

body[data-theme="light"] .topbar button,
body[data-theme="light"] .topbar select,
body[data-theme="light"] .stat-chip {
  border-color: #a58d6a;
  color: #24180d;
}

body[data-theme="light"] .topbar select,
body[data-theme="light"] .topbar button.secondary,
body[data-theme="light"] .stat-chip {
  background: linear-gradient(180deg, #fffaf1, #f0e1c6 66%, #dfccb0);
}

body[data-theme="light"] .topbar button:not(.secondary) {
  background: linear-gradient(180deg, #3a2b1e, #26190f 70%, #1a1008);
  color: #f7efe4;
}

body[data-theme="light"] .topbar .workspace-picker select {
  border-color: #c09a61;
  background:
    linear-gradient(180deg, #fffdf6, #f5e6c8 70%, #e4cc9e),
    linear-gradient(45deg, transparent 50%, #2b1b10 50%),
    linear-gradient(135deg, #2b1b10 50%, transparent 50%);
  color: #2b1b10;
}

body[data-theme="light"] .topbar select option {
  background: #fff6e7;
  color: #2b1b10;
}

body[data-theme="light"] .surface-head {
  border-bottom-color: #7e684d;
  background: linear-gradient(180deg, #fff7ea, #e7d5b9 72%, #d3bb94);
  color: #24180d;
}

body[data-theme="light"] .surface-head .eyebrow {
  color: #7b613f;
}

body[data-theme="light"] .surface-head-copy h2::after,
body[data-theme="light"] .surface-head-copy h3::after {
  background: repeating-linear-gradient(90deg, rgba(36, 24, 13, 0.22) 0 4px, transparent 4px 8px);
}

body[data-theme="light"] .pill.muted,
body[data-theme="light"] .upload-card.accent {
  background: linear-gradient(180deg, #edf8ff, #d4e9f3);
}

@media (max-width: 1500px) {
  .topbar {
    grid-template-columns: minmax(0, 1fr);
  }

  .topbar-stats,
  .topbar-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 980px) {
  .brand-title-row {
    align-items: stretch;
    flex-direction: column;
  }

  .theme-option-grid {
    grid-template-columns: 1fr;
  }

  .settings-panel {
    right: auto;
    left: 0;
  }
}

:focus-visible {
  outline: 3px solid rgba(106, 169, 255, 0.38);
  outline-offset: 2px;
}

.workspace-grid {
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 14px;
}

.stage-surface,
.sidebar-section,
.texture-surface,
.assets-surface {
  padding: 14px;
}

.stage-surface {
  min-height: 780px;
}

.surface-head {
  margin: -14px -14px 14px;
  padding: 10px 14px;
}

.surface-head-copy h2,
.surface-head-copy h3 {
  margin-top: 4px;
  font-size: 1.04rem;
}

.surface-head .tiny-note {
  line-height: 1.35;
}

.stage-head-actions {
  gap: 8px;
}

.viewport-layout {
  min-height: 620px;
}

.viewport-card,
.viewport-canvas {
  min-height: 620px;
}

.viewport-card {
  background:
    radial-gradient(circle at 50% 18%, rgba(120, 168, 212, 0.14), transparent 34%),
    linear-gradient(180deg, #111823, #0c121a 48%, #091018),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.03) 0 1px, transparent 1px 18px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.07),
    inset 0 -18px 48px rgba(0, 0, 0, 0.18);
}

.viewport-card::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at 50% 78%, rgba(255, 255, 255, 0.05), transparent 28%);
}

.viewport-label {
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(10, 14, 19, 0.64);
}

.preview-panel,
.summary-card,
.control-group,
.list-card,
.quick-preset-card {
  background: rgba(255, 250, 242, 0.54);
}

.sidebar {
  gap: 14px;
}

.sidebar-section {
  gap: 14px;
}

.control-group {
  padding: 14px;
}

.group-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.group-title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line-pale);
}

.field {
  gap: 7px;
}

.field span {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.field span strong {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border: 1px solid var(--line-pale);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.48);
  font-size: 0.75rem;
  line-height: 1.15;
}

.range-field input[type="range"] {
  margin-top: 2px;
}

.preview-panel-head {
  font-size: 0.76rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.quick-preset-card,
.list-card {
  gap: 12px;
}

.quick-preset-card p,
.list-card > span,
.asset-meta span,
.export-meta {
  line-height: 1.45;
}

.quick-preset-card > span {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 4px 8px;
  border: 1px solid var(--line-pale);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.4);
}

.list-card strong,
.quick-preset-card strong,
.summary-card strong {
  line-height: 1.35;
}

.stack-list {
  max-height: 320px;
}

.library-actions {
  gap: 8px;
  row-gap: 8px;
}

.library-actions > button,
.topbar-actions > button {
  white-space: nowrap;
}

.theme-option-grid {
  grid-template-columns: 1fr;
}

.theme-option {
  min-height: 68px;
}

.progress-panel {
  padding: 12px 14px;
}

.info-strip {
  background: rgba(255, 250, 237, 0.82);
}

.subtle-strip {
  background: rgba(208, 229, 243, 0.82);
}

body[data-theme="modern"] .surface {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.72),
    inset 0 -1px 0 rgba(0, 0, 0, 0.05),
    0 12px 34px rgba(20, 34, 45, 0.16);
}

body[data-theme="modern"] .preview-panel,
body[data-theme="modern"] .summary-card,
body[data-theme="modern"] .control-group,
body[data-theme="modern"] .list-card,
body[data-theme="modern"] .quick-preset-card,
body[data-theme="modern"] .progress-panel {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.86), rgba(233, 239, 244, 0.88));
}

body[data-theme="modern"] .info-strip {
  background: rgba(255, 255, 255, 0.92);
}

body[data-theme="modern"] .subtle-strip {
  background: rgba(220, 239, 248, 0.94);
}

body[data-theme="modern"] .field span strong,
body[data-theme="modern"] .quick-preset-card > span {
  background: rgba(247, 250, 252, 0.94);
}

body[data-theme="modern"] .viewport-card {
  background:
    radial-gradient(circle at 50% 18%, rgba(140, 198, 240, 0.22), transparent 34%),
    linear-gradient(180deg, #182430, #101821 50%, #0c131b),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.03) 0 1px, transparent 1px 18px);
}

body[data-theme="modern"] .stage-callout {
  border-color: #4b7d9b;
  background: linear-gradient(180deg, rgba(245, 251, 255, 0.97), rgba(214, 231, 242, 0.96));
}

body[data-theme="modern"] .settings-panel {
  box-shadow: 0 16px 42px rgba(16, 31, 41, 0.22);
}

body[data-theme="workshop"] .field span strong,
body[data-theme="workshop"] .quick-preset-card > span {
  background: rgba(255, 250, 242, 0.45);
}

@media (max-width: 1440px) {
  .workspace-grid {
    grid-template-columns: minmax(0, 1fr) 360px;
  }
}

@media (max-width: 1040px) {
  .workspace-grid,
  .topbar,
  .workspace-bottom-grid,
  .viewport-layout.compare {
    grid-template-columns: minmax(0, 1fr);
  }

  .stage-surface {
    min-height: auto;
  }

  .viewport-layout,
  .viewport-card,
  .viewport-canvas {
    min-height: 460px;
  }
}

.startup-status {
  position: fixed;
  z-index: 1000;
  inset: 12px 12px auto;
  max-width: 640px;
  margin-inline: auto;
  padding: 20px;
  border: 2px solid #466077;
  border-radius: 12px;
  background: #f7fafc;
  color: #152536;
  box-shadow: 0 8px 36px #0005;
  font-family: "Segoe UI", "Trebuchet MS", sans-serif;
}

.startup-status[hidden] {
  display: none;
}

.startup-status p {
  margin: 12px 0;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

/* Editor workspace: keep the model and everyday actions in the first screen. */
[hidden] {
  display: none !important;
}

.topbar {
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 70px;
  padding: 10px 14px;
  overflow: visible;
}

.topbar .brand-heading .eyebrow,
.topbar .subtle,
.topbar-stats {
  display: none;
}

.brand-mark {
  width: 40px;
  border-radius: 9px;
}

.brand-copy h1 {
  margin: 0;
  font-size: 1.3rem;
  white-space: nowrap;
}

.topbar-actions {
  flex: 1;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: nowrap;
  gap: 8px;
  min-width: 0;
}

.topbar-actions > button {
  min-height: 38px;
}

.workspace-picker {
  display: block;
  flex: 0 1 240px;
  min-width: 140px;
  max-width: 260px;
}

.workspace-picker span {
  display: none;
}

.topbar .workspace-picker select {
  min-height: 38px;
}

.project-more {
  position: relative;
  flex: none;
}

.project-more summary {
  display: flex;
  align-items: center;
  min-height: 38px;
  padding: 0 14px;
  border: 2px solid #564a3d;
  border-radius: var(--radius-sm);
  background: #312a22;
  color: #f5ecd9;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
}

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

.project-more summary::after {
  content: "\25BE";
  margin-left: 8px;
  font-size: 0.75rem;
}

.project-more-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 30;
  display: grid;
  gap: 8px;
  min-width: 220px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper-soft);
  box-shadow: var(--shadow);
}

.project-more-menu button {
  width: 100%;
  text-align: left;
}

.topbar .project-more-menu button.danger,
body[data-theme="modern"] .topbar .project-more-menu button.danger {
  border-color: #b86e67;
  background: #f5e2de;
  color: #6f2925;
}

.stage-surface {
  min-height: 0;
}

.stage-head {
  align-items: center;
}

.stage-head-actions .pill.muted,
.stage-status-row,
.stage-callout {
  display: none;
}

.stage-assets {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(130px, 1fr) auto minmax(130px, 1fr) auto;
  align-items: end;
  gap: 9px;
  margin-bottom: 12px;
}

.stage-assets .field {
  gap: 4px;
}

.stage-assets .field span {
  font-size: 0.7rem;
  font-weight: 700;
}

.stage-assets select,
.stage-assets button {
  width: 100%;
  min-width: 0;
  min-height: 38px;
}

.progress-panel[data-state="idle"] {
  display: none;
}

.progress-panel {
  gap: 4px;
  padding: 7px 10px;
}

.progress-meta span:first-child {
  display: none;
}

.progress-meta {
  grid-template-columns: 1fr auto;
}

.progress-meta strong {
  text-align: left;
}

.progress-track {
  height: 7px;
}

.viewport-layout {
  height: max(380px, calc(100dvh - 255px));
  min-height: 0;
}

.viewport-card,
.viewport-canvas {
  height: 100%;
  min-height: 0;
}

.surface-head-copy h2::after,
.surface-head-copy h3::after {
  display: none;
}

body[data-theme="modern"] {
  font-family: "Aptos", "Trebuchet MS", sans-serif;
  background: #e9eef2;
}

body[data-theme="modern"] .surface {
  border: 1px solid #bccbd4;
  background: #f8fafb;
  box-shadow: 0 3px 16px rgba(12, 34, 48, 0.1);
}

body[data-theme="modern"] .surface::before {
  display: none;
}

body[data-theme="modern"] .topbar {
  border-color: #203542;
  background: #142732;
}

body[data-theme="modern"] .surface-head {
  border-bottom: 1px solid #d6e0e6;
  background: #f1f5f7;
  color: #132b38;
}

body[data-theme="modern"] .surface-head .eyebrow {
  color: #557483;
}

body[data-theme="modern"] .control-group,
body[data-theme="modern"] .preview-panel,
body[data-theme="modern"] .summary-card {
  border: 1px solid #d7e1e6;
  background: #fff;
  box-shadow: none;
}

body[data-theme="modern"] .stage-assets select,
body[data-theme="modern"] .sidebar select,
body[data-theme="modern"] .sidebar input[type="text"],
body[data-theme="modern"] .sidebar textarea {
  border: 1px solid #aebfc9;
  background: #fff;
}

body[data-theme="modern"] .project-more summary {
  border-color: #376179;
  background: #263f4e;
  color: #eef9ff;
}

@media (min-width: 1041px) {
  .sidebar {
    position: sticky;
    top: 12px;
    max-height: calc(100dvh - 110px);
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
  }

  .sidebar-section {
    flex-shrink: 0;
  }
}

@media (max-width: 1240px) {
  .brand-copy h1 {
    font-size: 1.1rem;
  }

  .topbar-actions > button {
    padding-inline: 9px;
  }
}

@media (max-width: 1040px) {
  .topbar {
    flex-wrap: wrap;
  }

  .brand-title-row {
    flex-direction: row;
    align-items: center;
    gap: 10px;
  }

  .topbar-actions {
    flex: 1 1 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .stage-assets {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .viewport-layout {
    height: max(380px, 55dvh);
  }
}

@media (max-width: 600px) {
  .brand-copy h1 {
    white-space: normal;
  }

  .workspace-picker {
    flex: 1 1 100%;
    max-width: none;
  }

  .stage-head-actions .pill {
    display: none;
  }

  .stage-head {
    display: block;
  }

  .stage-head-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    margin-top: 9px;
  }

  .stage-head-actions button {
    min-width: 0;
    padding-inline: 5px;
    font-size: 0.78rem;
  }

  .settings-panel {
    position: fixed;
    top: 68px;
    right: 12px;
    left: 12px;
    width: auto;
  }

  .stage-assets {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 7px;
  }

  .stage-assets button {
    width: auto;
    padding-inline: 8px;
  }
}
