*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --black: #05050f;
  --black-soft: rgba(10, 12, 26, 0.78);
  /* Fully opaque surface — cards sit ON the sky, they don't melt into it */
  --black-card: #141830;
  --card-shadow: 0 10px 30px rgba(0, 0, 0, 0.55), 0 2px 8px rgba(0, 0, 0, 0.4);
  --teal: #5eead4;
  --cyan: #22d3ee;
  --violet: #a78bfa;
  --pink: #e0aaff;
  --shellac: #a72e1e;
  --indigo: #5b21b6;
  --indigo-light: #7c3aed;
  --indigo-bright: #a78bfa;
  --indigo-dark: #3b0f80;
  --indigo-deep: #160a2e;
  --indigo-glow: rgba(139, 92, 246, 0.32);
  --aurora: linear-gradient(115deg, #0d9488 0%, #4c1d95 52%, #7e22ce 100%);
  --aurora-soft: linear-gradient(100deg, var(--teal), var(--indigo-light) 45%, var(--violet) 75%, var(--pink));
  --aurora-hairline: linear-gradient(90deg, transparent, rgba(94, 234, 212, 0.7) 25%, rgba(167, 139, 250, 0.7) 70%, transparent);
  --glow: 0 0 14px rgba(45, 212, 191, 0.18), 0 0 26px rgba(139, 92, 246, 0.22);
  --white: #ffffff;
  --white-muted: rgba(255, 255, 255, 0.74);
  --white-subtle: rgba(255, 255, 255, 0.45);
  --border: rgba(158, 208, 255, 0.14);
  --radius: 14px;
  --font: "Futura", "Futura PT", "Jost", "Century Gothic", system-ui, sans-serif;
  --font-heading: "Poiret One", "Futura", "Jost", sans-serif;
}

/* Art-nouveau display caps: airy hairline geometry, wide tracking */
h1, h2, h3 {
  font-family: var(--font-heading);
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.2em;
}

html, body { height: 100%; }

/* Night sky: aurora curtains washing over the red circuit-geometry art
   (background.png). A dim layer between them keeps the linework from
   competing with the UI floating on top. */
body {
  font-family: var(--font);
  background:
    radial-gradient(58% 42% at 78% -8%, rgba(45, 212, 191, 0.14), transparent 62%),
    radial-gradient(50% 38% at 12% -4%, rgba(124, 58, 237, 0.2), transparent 65%),
    radial-gradient(42% 40% at 96% 55%, rgba(147, 51, 234, 0.13), transparent 62%),
    radial-gradient(48% 42% at -8% 82%, rgba(34, 211, 238, 0.1), transparent 60%),
    radial-gradient(40% 32% at 55% 108%, rgba(52, 211, 153, 0.08), transparent 60%),
    linear-gradient(rgba(5, 5, 15, 0.42), rgba(5, 5, 15, 0.42)),
    url("../background.png") center / cover no-repeat,
    var(--black);
  background-attachment: fixed;
  color: var(--white);
  line-height: 1.5;
}

::selection {
  background: rgba(139, 92, 246, 0.85);
  color: var(--white);
}

*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: rgba(139, 92, 246, 0.3);
  border-radius: 999px;
}
*::-webkit-scrollbar-thumb:hover { background: rgba(94, 234, 212, 0.45); }

.app {
  display: grid;
  grid-template-columns: 1fr 1fr;
  height: 100vh;
}

.chat-panel, .preview-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.chat-panel {
  border-right: 1px solid var(--border);
  background: var(--black-soft);
}

.chat-header, .preview-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.chat-header {
  background:
    linear-gradient(115deg, rgba(13, 148, 136, 0.22) 0%, rgba(88, 28, 135, 0.36) 48%, rgba(126, 34, 206, 0.28) 100%),
    var(--indigo-deep);
  background-size: 220% 220%;
  border-bottom: 1px solid transparent;
  border-image: var(--aurora-hairline) 1;
  animation: aurora-shimmer 16s ease-in-out infinite alternate;
}

@keyframes aurora-shimmer {
  from { background-position: 0% 50%; }
  to { background-position: 100% 50%; }
}

@media (prefers-reduced-motion: reduce) {
  .chat-header { animation: none; }
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-icon {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  background: var(--aurora);
  border-radius: 14px 14px 14px 4px;
  font-weight: 700;
  box-shadow: var(--glow);
}

.brand h1 {
  font-size: 1.45rem;
  letter-spacing: 0.3em;
  background: var(--aurora-soft);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.preview-header h2 { font-size: 1.1rem; }
.preview-header p { font-size: 0.8rem; color: var(--white-subtle); margin-top: 0.15rem; }

.preview-dimensions {
  margin-top: 0.75rem;
  padding: 0.65rem 0.75rem;
  background: var(--black-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
}

.preview-dim-line {
  font-size: 0.85rem;
  color: var(--white-muted);
  margin: 0.25rem 0;
}

.preview-dim-line:first-child { margin-top: 0; }
.preview-dim-line:last-child { margin-bottom: 0; }

.preview-dim-label {
  color: var(--white-subtle);
  display: inline-block;
  min-width: 4.5rem;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.message { display: flex; gap: 0.6rem; max-width: 85%; }
.message-user { align-self: flex-end; flex-direction: row-reverse; }

.message-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50% 50% 50% 12%;
  background: var(--aurora);
  display: grid;
  place-items: center;
  font-size: 0.7rem;
  font-weight: 700;
  flex-shrink: 0;
  box-shadow: 0 0 10px rgba(94, 234, 212, 0.25);
}

.message-user .message-avatar {
  background: var(--black-card);
  border: 1px solid var(--border);
  border-radius: 50% 50% 12% 50%;
  box-shadow: none;
}

/* Organic whiplash corners — one leaf-point per bubble */
.message-bubble {
  background: var(--black-card);
  border: 1px solid var(--border);
  border-radius: 4px 20px 20px 20px;
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
  box-shadow: var(--card-shadow);
}

.message-user .message-bubble {
  background: linear-gradient(125deg, #0d6b60, #46208c 55%, #6d21ad);
  border-color: rgba(158, 208, 255, 0.2);
  border-radius: 20px 4px 20px 20px;
  box-shadow: var(--card-shadow);
}

.chat-actions {
  padding: 0.85rem 1rem;
  border-top: 1px solid var(--border);
  background: rgba(5, 5, 15, 0.55);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  max-height: 40vh;
  overflow-y: auto;
}

.action-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.action-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--white-subtle);
  min-width: 4.2rem;
}

.action-busy {
  font-size: 0.85rem;
  color: var(--white-muted);
  padding: 0.35rem 0;
}

.action-busy::before {
  content: "";
  display: inline-block;
  width: 0.7rem;
  height: 0.7rem;
  margin-right: 0.5rem;
  border: 2px solid var(--teal);
  border-top-color: transparent;
  border-radius: 50%;
  vertical-align: -0.1rem;
  animation: action-spin 0.8s linear infinite;
}

@keyframes action-spin {
  to { transform: rotate(360deg); }
}

.chat-ask {
  display: flex;
  gap: 0.5rem;
  padding: 0.7rem 1rem;
  border-top: 1px solid var(--border);
  background: rgba(5, 5, 15, 0.55);
  flex-shrink: 0;
}

.chat-ask input {
  flex: 1;
  min-width: 0;
  background: var(--black-card);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--white);
  font-family: inherit;
  font-size: 0.85rem;
  padding: 0.5rem 0.95rem;
  outline: none;
  transition: border-color 0.15s;
}

.chat-ask input:focus {
  border-color: rgba(94, 234, 212, 0.55);
  box-shadow: 0 0 0 3px rgba(94, 234, 212, 0.14), 0 0 16px rgba(139, 92, 246, 0.18);
}
.chat-ask input::placeholder { color: var(--white-subtle); }
.chat-ask input:disabled { opacity: 0.5; }

.btn-ask {
  background: var(--aurora);
  border: none;
  border-radius: 999px;
  color: var(--white);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 0.5rem 1.05rem;
  transition: filter 0.15s, box-shadow 0.15s;
}

.btn-ask:hover:not(:disabled) {
  filter: brightness(1.2) saturate(1.1);
  box-shadow: var(--glow);
}
.btn-ask:disabled { opacity: 0.5; cursor: default; }

.btn { border: none; cursor: pointer; font-family: inherit; }

.btn-chip {
  background: var(--black-card);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--white-muted);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.82rem;
  padding: 0.42rem 0.8rem;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.btn-chip:hover:not(:disabled) {
  border-color: rgba(94, 234, 212, 0.5);
  color: var(--white);
}

.btn-chip.active {
  background: linear-gradient(115deg, rgba(13, 148, 136, 0.28), rgba(124, 58, 237, 0.3) 55%, rgba(147, 51, 234, 0.26));
  border-color: rgba(94, 234, 212, 0.55);
  color: var(--white);
  box-shadow: 0 0 12px rgba(94, 234, 212, 0.12);
}

.btn-chip:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.btn-chip-primary {
  background: var(--aurora);
  border-color: transparent;
  color: var(--white);
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 0.5rem 1.1rem;
  box-shadow: 0 0 12px rgba(94, 234, 212, 0.16), 0 0 20px rgba(139, 92, 246, 0.18);
  transition: filter 0.15s, box-shadow 0.15s;
}

.btn-chip-primary:hover:not(:disabled) {
  filter: brightness(1.2) saturate(1.1);
  color: var(--white);
  box-shadow: var(--glow);
}

.btn-chip-swatch {
  position: relative;
  padding-left: 1.7rem;
}

.btn-chip-swatch::before {
  content: "";
  position: absolute;
  left: 0.55rem;
  top: 50%;
  transform: translateY(-50%);
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 50%;
  background: var(--swatch, #888);
  border: 1px solid rgba(255, 255, 255, 0.25);
}

.toggle-group {
  display: inline-flex;
  background: var(--black-card);
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
}

.toggle-option {
  background: transparent;
  border: none;
  color: var(--white-subtle);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.82rem;
  padding: 0.42rem 0.85rem;
  transition: background 0.15s, color 0.15s;
}

.toggle-option:hover { color: var(--white); }

.toggle-option.active {
  background: var(--aurora);
  color: var(--white);
  font-weight: 600;
}

.stepper {
  display: inline-flex;
  align-items: center;
  background: var(--black-card);
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
}

.stepper-btn {
  background: transparent;
  border: none;
  color: var(--white-muted);
  cursor: pointer;
  font-family: inherit;
  font-size: 1rem;
  padding: 0.3rem 0.7rem;
}

.stepper-btn:hover { color: var(--white); background: rgba(94, 234, 212, 0.16); }

.stepper-value {
  font-size: 0.82rem;
  color: var(--white);
  min-width: 4.2rem;
  text-align: center;
}

.palette-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.palette-item {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.82rem;
}

.palette-swatch {
  width: 1rem;
  height: 1rem;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  flex-shrink: 0;
}

.palette-name { color: var(--white); min-width: 4.5rem; }

.palette-hex {
  color: var(--white-muted);
  font-size: 0.78rem;
  background: rgba(255, 255, 255, 0.06);
  padding: 0.05rem 0.35rem;
  border-radius: 4px;
}

.palette-coverage { color: var(--white-subtle); font-size: 0.78rem; }

.preview-panel { background: transparent; }

.preview-columns {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  min-height: 0;
}

.preview-column {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
}

.preview-column-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.preview-column-head .preview-column-title {
  margin-bottom: 0;
}

.preview-column-title {
  font-family: var(--font);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--white-muted);
  margin-bottom: 0.5rem;
}

.btn-preview-expand {
  width: 28px;
  height: 28px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--black-card);
  color: var(--white-muted);
  display: grid;
  place-items: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: border-color 0.2s, color 0.2s;
}

.btn-preview-expand:hover {
  border-color: var(--indigo);
  color: var(--white);
}

.btn-preview-expand svg {
  width: 14px;
  height: 14px;
}

.preview-column-canvas-wrap {
  flex: 1;
  display: grid;
  place-items: center;
  position: relative;
  background: var(--black-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem;
  min-height: 200px;
  cursor: zoom-in;
  box-shadow: var(--card-shadow);
}

.preview-column canvas {
  max-width: 100%;
  max-height: 100%;
  border-radius: 6px;
  display: none;
}

.preview-column-placeholder {
  position: absolute;
  color: var(--white-subtle);
  font-size: 0.78rem;
  text-align: center;
  padding: 0 0.5rem;
  pointer-events: none;
}

.upscale-notice {
  padding: 0 1.25rem 0.5rem;
  font-size: 0.75rem;
  color: var(--white-subtle);
  line-height: 1.4;
}

.preview-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem 1.25rem;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--black-soft);
}

.preview-controls-label {
  font-size: 0.85rem;
  color: var(--white-muted);
  white-space: nowrap;
}

.screen-count-input {
  width: 4rem;
  background: var(--black-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--white);
  font-family: inherit;
  font-size: 0.95rem;
  padding: 0.5rem 0.65rem;
  outline: none;
}

.screen-count-input:focus {
  border-color: rgba(94, 234, 212, 0.55);
  box-shadow: 0 0 0 3px rgba(94, 234, 212, 0.14);
}

.artwork-style-select {
  background: var(--black-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--white);
  font-family: inherit;
  font-size: 0.85rem;
  padding: 0.5rem 0.4rem;
  outline: none;
  max-width: 9.5rem;
}

.artwork-style-select:focus {
  border-color: rgba(94, 234, 212, 0.55);
  box-shadow: 0 0 0 3px rgba(94, 234, 212, 0.14);
}

.btn-separate {
  flex: 1;
  max-width: 160px;
  padding: 0.55rem 1rem;
  border-radius: 999px;
  background: var(--aurora);
  color: var(--white);
  font-family: inherit;
  font-weight: 600;
  font-size: 0.9rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  box-shadow: 0 0 12px rgba(94, 234, 212, 0.16), 0 0 20px rgba(139, 92, 246, 0.18);
  transition: filter 0.2s, box-shadow 0.2s, opacity 0.2s;
}

.btn-separate:hover {
  filter: brightness(1.2) saturate(1.1);
  box-shadow: var(--glow);
}
.btn-separate:disabled { opacity: 0.5; cursor: not-allowed; }

.fullscreen-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(0, 0, 0, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.fullscreen-overlay[hidden] {
  display: none;
}

body.fullscreen-open {
  overflow: hidden;
}

.fullscreen-inner {
  width: min(96vw, 1400px);
  height: min(92vh, 900px);
  display: flex;
  flex-direction: column;
  background: var(--black-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg, 16px);
  overflow: hidden;
}

.fullscreen-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid transparent;
  border-image: var(--aurora-hairline) 1;
  background:
    linear-gradient(115deg, rgba(13, 148, 136, 0.22) 0%, rgba(88, 28, 135, 0.36) 48%, rgba(126, 34, 206, 0.28) 100%),
    var(--indigo-deep);
}

.fullscreen-header h3 {
  font-family: var(--font);
  font-size: 0.95rem;
  font-weight: 600;
}

.btn-fullscreen-close {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.12);
  color: var(--white);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-fullscreen-close:hover {
  background: rgba(255, 255, 255, 0.22);
}

.fullscreen-canvas-wrap {
  flex: 1;
  display: grid;
  place-items: center;
  padding: 1rem;
  min-height: 0;
  overflow: auto;
  background: var(--black);
}

#fullscreen-canvas {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 6px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

/* legacy single-canvas rules removed */
.preview-canvas-wrap { display: none; }
.layer-strip { display: none; }

@media (max-width: 768px) {
  .preview-columns { grid-template-columns: 1fr; }
  .app { grid-template-columns: 1fr; grid-template-rows: 1fr 1fr; }
  .chat-panel { border-right: none; border-bottom: 1px solid var(--border); }
}

.message-bubble p { margin: 0 0 0.5rem; }
.message-bubble p:last-child { margin-bottom: 0; }
.message-bubble ul { margin: 0.35rem 0 0.5rem; padding-left: 1.25rem; }
.message-bubble li { margin-bottom: 0.35rem; }
.message-bubble li:last-child { margin-bottom: 0; }
.message-bubble strong { font-weight: 600; color: var(--white); }

/* ---------- Separation studio ---------- */

.btn-view-separation {
  padding: 0.55rem 1rem;
  border-radius: var(--radius);
  background: var(--black-card);
  border: 1px solid var(--border);
  color: var(--white);
  font-family: inherit;
  font-weight: 600;
  font-size: 0.9rem;
  transition: border-color 0.2s, background 0.2s, opacity 0.2s;
}

.btn-view-separation:hover:not(:disabled) {
  border-color: rgba(94, 234, 212, 0.5);
  background: rgba(94, 234, 212, 0.08);
}

.btn-view-separation:disabled { opacity: 0.4; cursor: not-allowed; }

.studio-overlay {
  position: fixed;
  inset: 0;
  z-index: 2100;
  background: rgba(0, 0, 0, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.studio-overlay[hidden] { display: none; }

.studio-inner {
  background: var(--black-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: min(1100px, 100%);
  max-height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.studio-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.9rem 1.25rem;
  border-bottom: 1px solid transparent;
  border-image: var(--aurora-hairline) 1;
  background:
    linear-gradient(115deg, rgba(13, 148, 136, 0.22) 0%, rgba(88, 28, 135, 0.36) 48%, rgba(126, 34, 206, 0.28) 100%),
    var(--indigo-deep);
  flex-shrink: 0;
}

.studio-header h3 { font-size: 1rem; }

.studio-status {
  flex: 1;
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.85);
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.studio-close {
  background: rgba(255, 255, 255, 0.12);
  border: none;
  border-radius: 8px;
  color: var(--white);
  cursor: pointer;
  font-size: 1.2rem;
  line-height: 1;
  padding: 0.25rem 0.6rem;
}

.studio-close:hover { background: rgba(255, 255, 255, 0.25); }

.studio-body {
  padding: 1.25rem;
  overflow-y: auto;
}

.studio-panels {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  justify-content: center;
}

.studio-panel {
  background: var(--black-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem;
  text-align: center;
  flex: 1 1 320px;
  max-width: 480px;
}

.studio-panel-title {
  font-family: var(--font);
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--white-subtle);
  margin-bottom: 0.6rem;
}

.studio-panel-canvas {
  max-width: 100%;
  border-radius: 8px;
  background:
    repeating-conic-gradient(rgba(255,255,255,0.06) 0% 25%, transparent 0% 50%)
    0 0 / 16px 16px;
}

.studio-banner {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-top: 1rem;
  padding: 0.6rem 0.85rem;
  background: linear-gradient(115deg, rgba(13, 148, 136, 0.14), rgba(99, 102, 241, 0.16));
  border: 1px solid rgba(94, 234, 212, 0.4);
  border-radius: 4px 16px 16px 16px;
  font-size: 0.85rem;
}

.studio-banner[hidden] { display: none; }

.studio-banner-busy::before {
  content: "";
  display: inline-block;
  width: 0.7rem;
  height: 0.7rem;
  margin-right: 0.5rem;
  border: 2px solid var(--indigo-light);
  border-top-color: transparent;
  border-radius: 50%;
  vertical-align: -0.1rem;
  animation: action-spin 0.8s linear infinite;
}

.studio-layers-title {
  font-family: var(--font);
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--white-subtle);
  margin: 1.25rem 0 0.6rem;
}

.studio-layers {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 0.9rem;
}

.layer-card {
  background: var(--black-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.65rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.layer-card.merge-base { border-color: var(--indigo); box-shadow: 0 0 0 1px var(--indigo); }
.layer-card.merge-candidate { cursor: pointer; }
.layer-card.merge-candidate:hover { border-color: var(--indigo-light); }
.layer-card.merge-selected {
  border-color: var(--indigo-light);
  box-shadow: 0 0 0 2px var(--indigo-light);
}

.layer-card-thumb {
  border-radius: 8px;
  overflow: hidden;
  display: grid;
  place-items: center;
  background:
    repeating-conic-gradient(rgba(255,255,255,0.06) 0% 25%, transparent 0% 50%)
    0 0 / 14px 14px;
}

.layer-card-thumb canvas { display: block; max-width: 100%; }

.layer-card-info {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.8rem;
}

.layer-card-swatch {
  width: 0.95rem;
  height: 0.95rem;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  flex-shrink: 0;
}

.layer-card-name { color: var(--white); font-weight: 600; }

.layer-card-hex {
  color: var(--white-muted);
  font-size: 0.75rem;
  background: rgba(255, 255, 255, 0.06);
  padding: 0.05rem 0.3rem;
  border-radius: 4px;
}

.layer-card-coverage { color: var(--white-subtle); font-size: 0.75rem; margin-left: auto; }

.layer-card-actions {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  align-items: center;
}

.layer-card-prompt { font-size: 0.78rem; color: var(--white-muted); }

.studio-btn {
  background: var(--black-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--white-muted);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.78rem;
  padding: 0.32rem 0.6rem;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  position: relative;
}

.studio-btn:hover:not(:disabled) { border-color: var(--indigo); color: var(--white); }
.studio-btn:disabled { opacity: 0.35; cursor: not-allowed; }

.studio-btn-primary {
  background: var(--indigo);
  border-color: transparent;
  color: var(--white);
  font-weight: 600;
}

.studio-btn-primary:hover:not(:disabled) { background: var(--indigo-light); color: var(--white); }

.studio-btn-danger {
  background: var(--shellac);
  border-color: transparent;
  color: var(--white);
  font-weight: 600;
}

.studio-btn-danger:hover:not(:disabled) { background: #c53a26; color: var(--white); }

.studio-btn-danger-ghost:hover:not(:disabled) { border-color: var(--shellac); color: #e06a52; }

.studio-btn-edit { display: inline-flex; align-items: center; }

.studio-color-input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}
