/* Ported from Splitink4's studio design language. */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --ink: #fff;
  --ink-deep: #05050f;
  --paper: #0b0a18;
  --paper-bright: #141126;
  --cyan: #c4b5fd;
  --magenta: #8b5cf6;
  --violet: #7c3aed;
  --red: #5b21b6;
  --line: rgba(255, 255, 255, 0.18);
  --line-soft: rgba(255, 255, 255, 0.09);
  --muted: rgba(255, 255, 255, 0.62);
  --display: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  --serif: Georgia, "Times New Roman", serif;
  --sans: "Arial Narrow", "Roboto Condensed", "Helvetica Neue", Arial, sans-serif;
}

[hidden] { display: none !important; }

html { min-height: 100%; }

body {
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
}

button,
input,
select { font: inherit; }

button { color: inherit; }

a { color: inherit; text-decoration: none; }

img,
canvas { display: block; max-width: 100%; height: auto; }

*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: rgba(139, 92, 246, 0.45); }

.mobile-banner {
  display: none;
  padding: 0.7rem 1rem;
  background: var(--red);
  text-align: center;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.05em;
}

.top-bar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 2rem;
  min-height: 142px;
  padding: 0 max(20px, 3vw);
  background: rgba(11, 10, 24, 0.94);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}

.top-brand {
  display: block;
  width: 156px;
  height: 136px;
  overflow: hidden;
}

.top-brand img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.local-badge,
.eyebrow,
.panel-step,
.panel-note,
.choice-tag,
.btn,
.preview-card header span,
.view-head span {
  font-size: 0.7rem;
  font-weight: 900;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.local-badge {
  justify-self: end;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--line);
  color: var(--muted);
}

.stage {
  position: relative;
  overflow: hidden;
  padding: clamp(2rem, 5vw, 5rem) max(20px, 3vw) 3rem;
}

.stage::before,
.stage::after {
  content: "";
  position: absolute;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 50%;
  pointer-events: none;
}

.stage::before { width: 46vw; height: 46vw; left: -24vw; top: -12vw; }
.stage::after { width: 34vw; height: 34vw; right: -17vw; bottom: 1rem; }

.stage-inner {
  position: relative;
  z-index: 1;
  width: min(1480px, 100%);
  margin: 0 auto;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin-bottom: 1.3rem;
  color: var(--muted);
}

.eyebrow span {
  width: 32px;
  height: 3px;
  background: linear-gradient(90deg, var(--cyan) 0 25%, var(--magenta) 25% 50%, var(--violet) 50% 75%, var(--ink) 75%);
}

.stage-title {
  font-family: var(--display);
  font-size: clamp(3.5rem, 6vw, 6.5rem);
  letter-spacing: -0.045em;
  line-height: 0.83;
  text-transform: uppercase;
}

.stage-title em {
  color: var(--cyan);
  font-family: var(--serif);
  font-size: 0.75em;
  font-style: italic;
  font-weight: 400;
  text-transform: none;
}

.stage-lede {
  max-width: 66ch;
  margin-top: 1.25rem;
  color: var(--muted);
  font-size: 1.05rem;
}

.setup-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
  gap: 1.5rem;
  align-items: start;
  margin-top: 2.5rem;
}

.setup-main,
.source-side {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.source-side { position: sticky; top: 100px; }

.panel,
.preview-card,
.work-view,
.screens-list,
.export-panel {
  background: var(--paper-bright);
  border: 2px solid var(--line);
}

.panel { padding: 1.4rem; }

.panel-head,
.preview-card header,
.view-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.panel-head { margin-bottom: 1.2rem; }

.panel h2,
.preview-card h2,
.view-head h2,
.screens-list h2,
.export-panel h2 {
  font-family: var(--display);
  font-size: 1.55rem;
  font-weight: 400;
  letter-spacing: -0.01em;
  line-height: 1;
  text-transform: uppercase;
}

.panel-step,
.choice-tag,
.preview-card header span,
.view-head span { color: var(--cyan); }

.panel-note { color: var(--muted); }

.dropzone {
  display: grid;
  place-items: center;
  gap: 0.55rem;
  min-height: 180px;
  padding: 2rem;
  border: 2px dashed var(--line);
  background-color: rgba(255, 255, 255, 0.02);
  background-image: radial-gradient(rgba(255, 255, 255, 0.09) 1px, transparent 1.2px);
  background-size: 8px 8px;
  cursor: pointer;
  text-align: center;
  transition: border-color 180ms ease, background 180ms ease;
}

.dropzone:hover { border-color: var(--cyan); background-color: rgba(124, 58, 237, 0.12); }
.dropzone input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.dropzone-mark { font-size: 2.5rem; font-weight: 200; color: var(--cyan); line-height: 1; }
.dropzone strong { font-family: var(--display); font-size: 1.55rem; text-transform: uppercase; }
.dropzone small { color: var(--muted); }

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

.method-card {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  min-height: 250px;
  padding: 1.25rem;
  border: 2px solid var(--line);
  background: var(--paper);
}

.method-card.is-selected { border-color: var(--cyan); box-shadow: 6px 6px 0 var(--red); }
.method-card.is-disabled { opacity: 0.52; }
.method-card h3 { font-family: var(--display); font-size: 1.8rem; font-weight: 400; text-transform: uppercase; }
.method-card p { color: var(--muted); font-size: 0.88rem; }
.method-card ul { list-style: none; margin-top: auto; padding-top: 0.75rem; border-top: 1px solid var(--line-soft); font-size: 0.84rem; }
.method-card li + li { margin-top: 0.35rem; }
.method-card li::before { content: "→ "; color: var(--cyan); }
.method-card .btn { align-self: flex-start; margin-top: auto; }

.field-stack { display: flex; flex-direction: column; gap: 1rem; }
.size-fields { display: grid; grid-template-columns: 1fr 1fr 0.8fr; gap: 1rem; }

/* --- Spot screen hint ------------------------------------------------------- */
.screen-hint {
  margin-top: 0.6rem;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.5;
}
.screen-hint.is-warn {
  color: #fcd34d;
}

.field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 76px;
  padding: 0.8rem 1rem;
  border: 1px solid var(--line);
  background: var(--paper);
}

.field span { display: flex; flex-direction: column; }
.field b { font-size: 0.88rem; text-transform: uppercase; letter-spacing: 0.06em; }
.field small { color: var(--muted); }

.field input,
.field select {
  width: 8.5rem;
  min-height: 44px;
  padding: 0 0.75rem;
  border: 1px solid var(--line);
  background: var(--paper-bright);
  color: var(--ink);
  outline: none;
}

.field input:focus,
.field select:focus { border-color: var(--cyan); }
.field input:disabled,
.field select:disabled { opacity: 0.4; }
.unit-field select { width: 9.5rem; }

.maximum-size { min-height: 1.5rem; margin-top: 1rem; color: var(--cyan); font-size: 0.84rem; }
.maximum-size.is-warn { color: #fcd34d; }

.stage-actions {
  display: flex;
  align-items: center;
  gap: 1.3rem;
  flex-wrap: wrap;
  margin-top: 1.1rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--line-soft);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 1.2rem;
  border: 1px solid var(--line);
  background: transparent;
  cursor: pointer;
}

.btn:disabled { opacity: 0.3; cursor: not-allowed; }
.btn-primary { background: var(--red); border-color: var(--red); box-shadow: 5px 5px 0 var(--ink); }
.btn-primary:hover:not(:disabled) { transform: translate(3px, 3px); box-shadow: 2px 2px 0 var(--ink); }
.status { flex: 1; min-width: 260px; color: var(--muted); font-size: 0.86rem; }

.preview-card header,
.view-head { padding: 1rem 1.15rem; border-bottom: 1px solid var(--line); }
.preview-card header > div,
.view-head > div { display: flex; flex-direction: column; gap: 0.25rem; }

.preview-frame,
.canvas-frame {
  display: grid;
  place-items: center;
  min-height: 260px;
  padding: 1rem;
  overflow: hidden;
  background-color: var(--ink-deep);
  background-image: radial-gradient(rgba(255, 255, 255, 0.07) 1px, transparent 1.2px);
  background-size: 10px 10px;
}

.source-frame:has(img:not([hidden])) .empty-preview { display: none; }
.preview-frame:has(canvas) .empty-preview,
.canvas-frame:has(canvas) .empty-preview { display: none; }
.empty-preview,
.empty-side { color: rgba(255, 255, 255, 0.38); font-size: 0.85rem; text-align: center; }

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 1.5rem;
  align-items: start;
  padding: 2rem max(20px, 3vw) 4rem;
  border-top: 1px solid var(--line);
}

.work-main { min-width: 0; }
.view-head p { color: var(--muted); font-size: 0.82rem; }
.canvas-frame { min-height: 520px; }
.canvas-frame canvas { max-height: 76vh; }

.work-side {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  position: sticky;
  top: 96px;
}

.screens-list,
.export-panel { padding: 1.1rem; }
.screens-list h2,
.export-panel h2 { margin-bottom: 0.9rem; padding-bottom: 0.65rem; border-bottom: 1px solid var(--line); color: var(--cyan); }

#screen-results { max-height: 58vh; overflow-y: auto; }
#screen-results > section { padding: 0.75rem 0; border-bottom: 1px solid var(--line-soft); }
#screen-results h3 { margin-bottom: 0.55rem; font-size: 0.74rem; letter-spacing: 0.06em; text-transform: uppercase; }
#screen-results canvas { width: 100%; max-height: 180px; object-fit: contain; background: #fff; }

.export-panel p { margin-bottom: 1rem; color: var(--muted); font-size: 0.86rem; }
.export-panel .btn { width: 100%; }

@media (max-width: 1100px) {
  .setup-grid,
  .workspace { grid-template-columns: 1fr; }
  .source-side,
  .work-side { position: static; }
  .source-side { display: grid; grid-template-columns: 1fr 1fr; }
  .size-fields,
  .cmyk-fields { grid-template-columns: 1fr; }
  .toggle-row { flex-wrap: wrap; }
}

/* --- Selection-ready method cards ---------------------------------------- */
.method-card { cursor: pointer; user-select: none; transition: border-color 160ms ease, transform 160ms ease; }
.method-card:hover:not(.is-selected) { border-color: var(--magenta); }
.method-card:focus-visible { outline: 3px solid var(--cyan); outline-offset: 2px; }
.method-card.is-selected .choice-tag { color: var(--cyan); }

/* --- CMYK controls --------------------------------------------------------- */
.cmyk-fields { grid-template-columns: 1fr 1fr; }
.toggle-row { display: flex; gap: 1rem; align-items: stretch; }
.checkbox-field {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  flex: 1;
  min-height: 76px;
  padding: 0.8rem 1rem;
  border: 1px solid var(--line);
  background: var(--paper);
}
.checkbox-field input { width: 20px; height: 20px; accent-color: var(--violet); cursor: pointer; }
.checkbox-field > span { display: flex; flex-direction: column; }
.checkbox-field b { font-size: 0.88rem; text-transform: uppercase; letter-spacing: 0.06em; }
.checkbox-field small { color: var(--muted); }
.proof-field { flex: none; }

/* --- Garment preview -------------------------------------------------------- */
.preview-tools {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 1.15rem;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.preview-tools-label {
  font-size: 0.7rem;
  font-weight: 900;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--cyan);
}
.garment-hint { color: var(--muted); font-size: 0.8rem; }
.swatches { display: flex; gap: 0.55rem; align-items: center; flex-wrap: wrap; }
.swatch {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid var(--line);
  background: var(--swatch);
  cursor: pointer;
  color: transparent;
  font-size: 0;
}
.swatch.is-active { outline: 3px solid var(--cyan); outline-offset: 2px; }
.swatch-custom { overflow: hidden; border-style: dashed; }
.swatch-custom input { width: 100%; height: 100%; border: none; background: none; padding: 0; cursor: pointer; }

/* --- Screen rail ------------------------------------------------------------- */
.screens-hint { color: var(--muted); font-size: 0.8rem; margin-bottom: 0.75rem; }
#screen-results > section { padding: 0.75rem 0; border-bottom: 1px solid var(--line-soft); }
.screen-card-head { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.5rem; }
.screen-card-head h3 { margin-bottom: 0; flex: 1; }
.screen-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.68rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  cursor: pointer;
  white-space: nowrap;
}
.screen-toggle input { width: 16px; height: 16px; accent-color: var(--violet); cursor: pointer; }
.screen-coverage { font-size: 0.7rem; color: var(--cyan); font-weight: 700; white-space: nowrap; }
.screen-thumb { display: block; width: 100%; padding: 0; border: 1px solid var(--line); background: #fff; cursor: zoom-in; }
.screen-thumb:focus-visible { outline: 3px solid var(--cyan); }
.screen-thumb canvas { width: 100%; max-height: 160px; object-fit: contain; display: block; }

/* --- Full-size film viewer ---------------------------------------------------- */
.viewer {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  grid-template-rows: auto 1fr auto;
  background: rgba(5, 5, 15, 0.97);
}
.viewer-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.9rem 1.2rem;
  border-bottom: 1px solid var(--line);
  background: var(--paper-bright);
}
.viewer-title {
  flex: 1;
  font-family: var(--display);
  text-transform: uppercase;
  font-size: 1.2rem;
  color: var(--cyan);
}
.viewer-zoom { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.viewer-zoom button {
  min-height: 36px;
  padding: 0 0.8rem;
  border: 1px solid var(--line);
  background: transparent;
  cursor: pointer;
}
.viewer-zoom button:hover { border-color: var(--cyan); }
.viewer-stage { overflow: auto; padding: 1.2rem; background-color: var(--ink-deep); }
#viewer-canvas { background: #fff; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5); }
.viewer-status { padding: 0.5rem 1.2rem; color: var(--muted); font-size: 0.8rem; border-top: 1px solid var(--line); }

@media (max-width: 720px) {
  .mobile-banner { display: block; }
  .top-bar { grid-template-columns: 1fr auto; min-height: 64px; }
  .local-badge { font-size: 0.6rem; }
  .stage-title { font-size: clamp(3rem, 15vw, 4.5rem); }
  .method-grid,
  .source-side { grid-template-columns: 1fr; }
  .workspace { padding-inline: 14px; }
  .canvas-frame { min-height: 300px; }
}

/* --- Workflow trail (copied from Splitink4's studio design language) ------- */
.top-bar { grid-template-columns: auto 1fr auto; }
.trail {
  display: flex;
  align-items: center;
  gap: 1.6rem;
  justify-self: center;
  list-style: none;
  overflow: hidden;
  margin: 0;
  padding: 0;
}
.trail-step {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  color: rgba(255, 255, 255, 0.3);
  white-space: nowrap;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}
.trail-step i { font-style: normal; color: rgba(255, 255, 255, 0.22); }
.trail-step.is-done { color: var(--muted); }
.trail-step.is-done i { color: var(--magenta); }
.trail-step.is-current { color: var(--ink); }
.trail-step.is-current i { color: var(--cyan); }

/* --- Progress bar ---------------------------------------------------------- */
.progress { display: flex; align-items: center; gap: 0.8rem; margin-top: 1rem; }
.progress[hidden] { display: none; }
.progress-track {
  flex: 1;
  height: 8px;
  border: 1px solid var(--line);
  background: var(--paper);
  overflow: hidden;
}
.progress-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--cyan), var(--magenta), var(--violet));
  transition: width 120ms ease;
}
.progress-label { color: var(--muted); font-size: 0.78rem; white-space: nowrap; }

/* --- Job readout (copied from Splitink4) ------------------------------------ */
.readout {
  display: flex;
  gap: 2.5rem;
  flex-wrap: wrap;
  margin-top: 1.1rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--line-soft);
}
.readout[hidden] { display: none; }
.readout-item { display: flex; flex-direction: column; }
.readout-item b {
  font-family: var(--display);
  font-size: 2.2rem;
  font-weight: 400;
  letter-spacing: -0.03em;
  line-height: 1.05;
}
.readout-item span {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

/* --- Dropzone drag & drop --------------------------------------------------- */
.dropzone.is-over {
  border-color: var(--cyan);
  background-color: rgba(124, 58, 237, 0.14);
}
.dropzone-sub { margin-top: 0.7rem; color: var(--muted); font-size: 0.8rem; }

/* --- Uploaded file row ------------------------------------------------------- */
.file-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 0.85rem;
  border-bottom: 1px solid var(--line);
}
.file-row[hidden] { display: none; }
.file-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 0.82rem;
}
.icon-btn {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink);
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
}
.icon-btn:hover { background: var(--red); border-color: var(--red); }

/* --- Job spec panel (copied from Splitink4) --------------------------------- */
.spec { padding: 1.1rem; }
.spec h2 { margin-bottom: 0.9rem; padding-bottom: 0.65rem; border-bottom: 1px solid var(--line); color: var(--cyan); }
.spec dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.45rem 1rem;
  font-size: 0.86rem;
  margin: 0;
}
.spec dt {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding-top: 0.12rem;
}
.spec dd { text-align: right; margin: 0; }
.spec dd[data-hint] { color: var(--muted); }

/* --- Export chips (copied from Splitink4) ----------------------------------- */
.chip-row { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.75rem; }
.chip {
  min-height: 42px;
  padding: 0 0.95rem;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  transition: color 150ms ease, border-color 150ms ease, background 150ms ease;
}
.chip:hover:not(:disabled) { color: var(--ink); border-color: var(--ink); }
.chip:disabled { opacity: 0.28; cursor: not-allowed; }
.chip.is-active { background: var(--red); border-color: var(--red); color: var(--ink); }

/* --- Fullscreen inspection (copied from Splitink4) --------------------------- */
body.overlay-open { overflow: hidden; }
.fullscreen-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: rgba(5, 5, 15, 0.95);
}
.fullscreen-overlay[hidden] { display: none; }
.fullscreen-inner {
  width: min(96vw, 1500px);
  height: min(92vh, 960px);
  display: flex;
  flex-direction: column;
  background: var(--paper-bright);
  border: 2px solid var(--line);
}
.fullscreen-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1.25rem;
  border-bottom: 1px solid var(--line);
}
.fullscreen-head h3 {
  font-family: var(--display);
  font-size: 1.25rem;
  font-weight: 400;
  text-transform: uppercase;
  margin: 0;
}
.fullscreen-canvas-wrap {
  flex: 1;
  display: grid;
  place-items: center;
  padding: 1rem;
  min-height: 0;
  overflow: auto;
  background-color: var(--ink-deep);
  background-image: radial-gradient(rgba(255, 255, 255, 0.07) 1px, transparent 1.2px);
  background-size: 10px 10px;
}
#fullscreen-canvas {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

/* --- Combined preview click-to-inspect -------------------------------------- */
.canvas-frame canvas { cursor: zoom-in; }

/* --- Trail / top-bar responsiveness ----------------------------------------- */
@media (max-width: 1100px) {
  .top-bar {
    grid-template-columns: 1fr auto;
    gap: 0.75rem;
    min-height: auto;
    padding-block: 0.75rem;
  }
  .trail {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-self: start;
    gap: 1.25rem;
    overflow-x: auto;
    padding-bottom: 0.25rem;
  }
  .local-badge { align-self: center; }
}
@media (max-width: 720px) {
  .readout { gap: 1.25rem; }
  .readout-item b { font-size: 1.6rem; }
}

/* --- Screen editing: card actions, modal, and preview tiles ----------------- */
.screens-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.9rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid var(--line);
}
.screens-head h2 { margin-bottom: 0; padding-bottom: 0; border-bottom: none; }
#layer-undo { margin-top: 0; flex: none; }

.layer-actions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.3rem;
  margin-top: 0.5rem;
}
.layer-action {
  padding: 0.35rem 0.2rem;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-size: 0.68rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 150ms ease, border-color 150ms ease, background 150ms ease;
}
.layer-action:hover { color: var(--ink); border-color: var(--cyan); background: rgba(124, 58, 237, 0.18); }
.layer-action:focus-visible { outline: 2px solid var(--cyan); outline-offset: 1px; }
.layer-action.is-danger:hover { border-color: #f87171; background: rgba(248, 113, 113, 0.16); }

.layer-modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: rgba(5, 5, 15, 0.95);
}
.layer-modal[hidden] { display: none; }
.layer-modal-panel {
  display: flex;
  flex-direction: column;
  width: min(94vw, 960px);
  max-height: 90vh;
  background: var(--paper-bright);
  border: 2px solid var(--line);
  box-shadow: 10px 10px 0 rgba(0, 0, 0, 0.45);
}
.layer-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1.25rem;
  border-bottom: 1px solid var(--line);
}
.layer-modal-head h3 {
  font-family: var(--display);
  font-size: 1.3rem;
  font-weight: 400;
  text-transform: uppercase;
}
.layer-modal-note {
  padding: 0.85rem 1.25rem 0;
  color: var(--muted);
  font-size: 0.85rem;
}
.layer-modal-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 1rem 1.25rem;
}
.layer-modal-row {
  display: flex;
  align-items: flex-end;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.layer-modal-row .field { flex: 1; min-width: 220px; }
.layer-modal-foot {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.9rem 1.25rem;
  border-top: 1px solid var(--line);
}
.layer-modal-status { flex: 1; color: var(--muted); font-size: 0.82rem; }
.layer-modal-foot .chip { margin-top: 0; }
.btn.is-danger { background: #b91c1c; border-color: #b91c1c; }

.layer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.75rem;
}
.layer-tile {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 0.5rem;
  border: 1px solid var(--line);
  background: transparent;
  text-align: left;
}
.layer-tile.is-selectable { cursor: pointer; transition: border-color 150ms ease, background 150ms ease; }
.layer-tile.is-selectable:hover { border-color: var(--cyan); }
.layer-tile.is-selected { border-color: var(--cyan); background: rgba(124, 58, 237, 0.2); box-shadow: inset 0 0 0 1px var(--cyan); }
.layer-tile.is-selectable:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
.layer-tile-frame {
  display: grid;
  place-items: center;
  min-height: 90px;
  background-color: #fff;
  background-image:
    linear-gradient(45deg, rgba(0, 0, 0, 0.08) 25%, transparent 25%, transparent 75%, rgba(0, 0, 0, 0.08) 75%),
    linear-gradient(45deg, rgba(0, 0, 0, 0.08) 25%, transparent 25%, transparent 75%, rgba(0, 0, 0, 0.08) 75%);
  background-size: 14px 14px;
  background-position: 0 0, 7px 7px;
}
.layer-tile-frame canvas { max-height: 150px; object-fit: contain; }
.layer-tile-label { font-size: 0.72rem; letter-spacing: 0.05em; text-transform: uppercase; }
.layer-tile-note { color: var(--muted); font-size: 0.72rem; }

.colour-editor { display: flex; flex-direction: column; gap: 1rem; }
.colour-swatch {
  display: grid;
  place-items: center;
  min-height: 110px;
  border: 1px solid var(--line);
  color: #05050f;
  font-family: var(--display);
  font-size: 1.5rem;
  letter-spacing: 0.08em;
  text-shadow: 0 0 6px rgba(255, 255, 255, 0.75);
}
.colour-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 0.75rem; }
.colour-fields .field input[type="color"] { height: 42px; padding: 2px; cursor: pointer; }
#delete-preview { margin-bottom: 1rem; max-width: 260px; }

@media (max-width: 720px) {
  .layer-actions { grid-template-columns: repeat(2, 1fr); }
  .layer-modal { padding: 0.75rem; }
}

/* The screen count the chosen print size leaves room for. */
.screen-limit:empty { display: none; }
.screen-limit { color: var(--cyan); }
