:root {
  --ink: #0b0b0a;
  --ink-2: #12120f;
  --panel: #191915;
  --panel-2: #20201b;
  --paper: #f5f0e6;
  --muted: #aaa397;
  --gold: #bd9650;
  --gold-bright: #dfbd79;
  --line: rgba(189, 150, 80, 0.25);
  --soft-line: rgba(255, 255, 255, 0.09);
  --positive: #7dca9b;
  --danger: #e47867;
  --radius: 6px;
  --ce-font: Inter, Arial, Helvetica, sans-serif;
  --font-sans: Inter, Arial, Helvetica, sans-serif;
  --font-display: "Libre Baskerville", Georgia, serif;
}

* { box-sizing: border-box; }

html {
  color-scheme: dark;
  background: var(--ink);
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--paper);
  background:
    linear-gradient(rgba(189, 150, 80, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(189, 150, 80, 0.028) 1px, transparent 1px),
    var(--ink);
  background-size: 56px 56px;
  font-family: var(--font-sans);
  font-size: 15px;
  letter-spacing: 0;
}

button,
input,
select { font: inherit; }

button,
label[for] { -webkit-tap-highlight-color: transparent; }

button { cursor: pointer; }

button:focus-visible,
input:focus-visible,
select:focus-visible,
a:focus-visible {
  outline: 2px solid var(--gold-bright);
  outline-offset: 2px;
}

.brand-cinema {
  position: relative;
  isolation: isolate;
  min-height: 282px;
  overflow: hidden;
  border-bottom: 1px solid rgba(223, 189, 121, 0.3);
  background: #080807;
}

.brand-cinema::after {
  position: absolute;
  z-index: 2;
  right: 0;
  bottom: 0;
  left: 0;
  height: 1px;
  background: rgba(223, 189, 121, 0.5);
  box-shadow: 0 0 24px rgba(223, 189, 121, 0.45);
  content: "";
}

.brand-cinema-video {
  position: absolute;
  z-index: -2;
  inset: -12%;
  width: 124%;
  height: 124%;
  object-fit: cover;
  opacity: 0.58;
  filter: saturate(0.8) contrast(1.08) brightness(0.68);
}

.brand-cinema-overlay {
  position: absolute;
  z-index: -1;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(7, 7, 6, 0.96) 0%, rgba(7, 7, 6, 0.74) 50%, rgba(7, 7, 6, 0.42) 100%),
    linear-gradient(0deg, rgba(7, 7, 6, 0.9) 0%, transparent 54%);
}

.brand-cinema-inner {
  display: flex;
  width: min(1540px, 100%);
  min-height: 282px;
  align-items: flex-end;
  justify-content: space-between;
  gap: 38px;
  margin: 0 auto;
  padding: 42px 28px 34px;
}

.app-shell {
  width: min(1540px, 100%);
  margin: 0 auto;
  padding: 28px 26px 78px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 24px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0;
  text-decoration: none;
  text-transform: uppercase;
}

.back-link svg { width: 15px; }
.back-link:hover { color: var(--paper); }

.eyebrow,
.step-kicker,
.field > span,
.export-copy > span {
  color: var(--gold-bright);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.eyebrow { margin: 0 0 10px; }

h1 {
  max-width: 900px;
  margin: 0;
  font: 400 clamp(38px, 4.6vw, 64px)/1.08 var(--font-display);
  letter-spacing: 0;
}

.intro-copy {
  max-width: 720px;
  margin: 17px 0 0;
  color: var(--muted);
  font-size: clamp(14px, 1.5vw, 18px);
  line-height: 1.65;
}

.privacy-note {
  display: flex;
  width: 275px;
  flex: 0 0 auto;
  align-items: center;
  gap: 13px;
  padding: 15px 17px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  background: rgba(8, 8, 7, 0.72);
  backdrop-filter: blur(12px);
  font-size: 11px;
  line-height: 1.45;
}

.privacy-note svg { width: 22px; color: var(--gold-bright); }
.privacy-note strong { display: block; color: var(--paper); font-size: 12px; }

.studio-layout {
  display: grid;
  grid-template-columns: minmax(440px, 570px) minmax(480px, 1fr);
  gap: 24px;
  align-items: start;
}

.editor,
.preview-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(18, 18, 15, 0.96);
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.32);
}

.editor { overflow: hidden; }

.editor-topline,
.preview-toolbar,
.export-dock {
  display: flex;
  min-height: 72px;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--soft-line);
  background: #10100e;
}

.editor-topline > div,
.export-copy { display: grid; gap: 4px; }
.editor-topline strong { font-size: 14px; }

.icon-button {
  display: grid;
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  place-items: center;
  padding: 0;
  border: 1px solid var(--soft-line);
  border-radius: 50%;
  color: var(--muted);
  background: transparent;
  transition: border-color 160ms ease, color 160ms ease, background 160ms ease;
}

.icon-button:hover { border-color: var(--line); color: var(--paper); background: rgba(255,255,255,.04); }
.icon-button svg { width: 18px; }

.control-section { padding: 26px 22px 28px; }
.control-section + .control-section { border-top: 1px solid var(--soft-line); }

.section-heading {
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: 13px;
  margin-bottom: 21px;
}

.section-number {
  color: var(--gold-bright);
  font-size: 11px;
  font-weight: 800;
}

.section-heading h2 {
  margin: -4px 0 4px;
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1.2;
}

.section-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.segmented {
  display: grid;
  min-height: 47px;
  padding: 4px;
  border: 1px solid var(--soft-line);
  border-radius: var(--radius);
  background: #0e0e0c;
}

.segmented.three { grid-template-columns: repeat(3, 1fr); }

.segmented button {
  min-width: 0;
  padding: 9px 8px;
  border: 0;
  border-radius: 4px;
  color: var(--muted);
  background: transparent;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  transition: color 160ms ease, background 160ms ease;
}

.segmented button.is-active { color: #0d0d0b; background: var(--gold-bright); }

.control-grid { display: grid; }
.control-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.control-grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.compact-gap { gap: 12px; }

.field {
  display: grid;
  min-width: 0;
  gap: 8px;
  margin-top: 17px;
}

.field > span { color: #bdb6aa; letter-spacing: 0; }
.field.grow { flex: 1 1 auto; }

.field input,
.field select {
  width: 100%;
  min-width: 0;
  height: 46px;
  padding: 0 13px;
  border: 1px solid var(--soft-line);
  border-radius: 4px;
  color: var(--paper);
  background: var(--panel);
  font-size: 13px;
  transition: border-color 160ms ease, background 160ms ease;
}

.field input::placeholder { color: #5f5c55; }
.field input:hover,
.field select:hover { border-color: var(--line); }
.field input:focus,
.field select:focus { border-color: var(--gold); background: #1d1d19; }

.theme-swatches {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 12px;
}

.theme-swatch {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  height: 34px;
  gap: 3px;
  padding: 4px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
}

.theme-swatch span { border-radius: 2px; }
.theme-swatch.navy span:nth-child(1) { background: #09265e; }
.theme-swatch.navy span:nth-child(2) { background: #f2f1ed; }
.theme-swatch.navy span:nth-child(3) { background: #7c9ad2; }
.theme-swatch.light span:nth-child(1) { background: #f2eee5; }
.theme-swatch.light span:nth-child(2) { background: #23231e; }
.theme-swatch.light span:nth-child(3) { background: #b28a50; }
.theme-swatch.obsidian span:nth-child(1) { background: #0b0b0a; }
.theme-swatch.obsidian span:nth-child(2) { background: #d8af66; }
.theme-swatch.obsidian span:nth-child(3) { background: #585044; }
.theme-swatch.is-active { border-color: var(--gold-bright); }

.import-row { display: flex; align-items: end; gap: 10px; }
.import-row .field { margin-top: 0; }

.action-button {
  display: inline-flex;
  min-height: 45px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 17px;
  border: 1px solid var(--line);
  border-radius: 4px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
  transition: transform 160ms ease, filter 160ms ease, background 160ms ease;
}

.action-button:hover { filter: brightness(1.08); transform: translateY(-1px); }
.action-button:active { transform: translateY(0); }
.action-button svg { width: 16px; }
.action-button.primary { border-color: var(--gold-bright); color: #10100e; background: var(--gold-bright); }
.action-button.secondary { color: var(--paper); background: transparent; }
.action-button[disabled] { cursor: not-allowed; opacity: .42; transform: none; }
.import-button { height: 46px; flex: 0 0 auto; }

.field-note {
  margin: 9px 0 0;
  color: #7d786f;
  font-size: 10px;
  line-height: 1.55;
}

.field-note.is-success { color: var(--positive); }
.field-note.is-error { color: var(--danger); }

.address-lookup { position: relative; }
.address-suggestions {
  position: absolute;
  z-index: 80;
  top: calc(100% + 6px);
  right: 0;
  left: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #171713;
  box-shadow: 0 24px 48px rgba(0, 0, 0, .48);
}
.address-suggestions[hidden] { display: none; }
.address-suggestion {
  display: grid;
  width: 100%;
  gap: 3px;
  padding: 12px 13px;
  border: 0;
  border-bottom: 1px solid var(--soft-line);
  color: var(--paper);
  background: transparent;
  text-align: left;
}
.address-suggestion:last-child { border-bottom: 0; }
.address-suggestion:hover,
.address-suggestion.is-active { background: rgba(189, 150, 80, .12); }
.address-suggestion strong { font-size: 12px; line-height: 1.35; }
.address-suggestion span { color: var(--muted); font-size: 9px; line-height: 1.45; }
.address-note { margin-top: 7px; }

.drop-zone {
  display: flex;
  width: 100%;
  min-height: 84px;
  align-items: center;
  gap: 15px;
  padding: 16px;
  border: 1px dashed rgba(189, 150, 80, 0.45);
  border-radius: var(--radius);
  color: var(--muted);
  background: rgba(189, 150, 80, 0.035);
  text-align: left;
}

.drop-zone:hover,
.drop-zone.is-over { border-color: var(--gold-bright); background: rgba(189, 150, 80, 0.08); }
.drop-zone > svg { width: 25px; color: var(--gold-bright); }
.drop-zone > span { display: grid; gap: 3px; font-size: 10px; }
.drop-zone strong { color: var(--paper); font-size: 13px; }

.photo-list { display: grid; gap: 8px; margin-top: 12px; }

.photo-item {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) auto;
  min-height: 58px;
  align-items: center;
  gap: 11px;
  padding: 7px;
  border: 1px solid var(--soft-line);
  border-radius: 4px;
  background: var(--panel);
}

.photo-item img { width: 58px; height: 44px; border-radius: 3px; object-fit: cover; }
.photo-item-copy { display: grid; min-width: 0; gap: 3px; }
.photo-item-copy strong { overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.photo-item-copy span { color: var(--muted); font-size: 9px; text-transform: uppercase; }
.photo-item-actions { display: flex; gap: 3px; }
.photo-item-actions button {
  display: grid;
  width: 29px;
  height: 29px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: var(--muted);
  background: transparent;
}
.photo-item-actions button:hover { color: var(--paper); background: rgba(255,255,255,.06); }
.photo-item-actions button.is-hero { color: var(--gold-bright); }
.photo-item-actions svg { width: 14px; }

.layout-control {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 10px;
}

.layout-control > div { display: grid; gap: 3px; }
.layout-control strong { color: var(--paper); font-size: 12px; }

.switch { position: relative; width: 43px; height: 24px; flex: 0 0 auto; }
.switch input { position: absolute; opacity: 0; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: #3b3a35; transition: background 160ms ease; }
.switch span::after { position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; content: ""; transition: transform 160ms ease; }
.switch input:checked + span { background: var(--gold); }
.switch input:checked + span::after { transform: translateX(19px); }

.upload-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 17px; }
.asset-upload {
  display: grid;
  grid-template-columns: 44px 1fr 17px;
  align-items: center;
  gap: 10px;
  min-height: 65px;
  padding: 9px;
  border: 1px solid var(--soft-line);
  border-radius: 4px;
  color: var(--muted);
  background: var(--panel);
  cursor: pointer;
}
.asset-upload:hover { border-color: var(--line); }
.asset-upload > span:nth-child(2) { display: grid; gap: 2px; min-width: 0; font-size: 9px; }
.asset-upload strong { color: var(--paper); font-size: 11px; }
.asset-upload > svg { width: 15px; }
.asset-preview { display: grid; width: 44px; height: 44px; place-items: center; overflow: hidden; border-radius: 3px; color: var(--gold-bright); background: #0d0d0b; }
.asset-preview.round { border-radius: 50%; }
.asset-preview img { width: 100%; height: 100%; object-fit: cover; }

.preview-panel {
  position: sticky;
  top: 96px;
  min-width: 0;
  overflow: hidden;
}

.preview-toolbar > div { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 10px; }
.preview-toolbar strong { color: var(--paper); font-size: 12px; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--positive); box-shadow: 0 0 0 4px rgba(125, 202, 155, .12); }
.preview-status { min-width: 0; flex-wrap: wrap; }
.beta-chip {
  padding: 4px 7px;
  border: 1px solid rgba(217, 176, 106, .34);
  border-radius: 999px;
  color: var(--gold-bright);
  background: rgba(217, 176, 106, .08);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.toolbar-actions { display: flex; gap: 6px; }

.canvas-stage {
  position: relative;
  display: grid;
  min-height: 680px;
  place-items: center;
  overflow: auto;
  padding: 34px;
  background:
    linear-gradient(45deg, #141411 25%, transparent 25%),
    linear-gradient(-45deg, #141411 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #141411 75%),
    linear-gradient(-45deg, transparent 75%, #141411 75%), #0c0c0a;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  background-size: 16px 16px;
}

#designCanvas {
  display: block;
  width: min(100%, 650px);
  height: auto;
  max-height: 72vh;
  border: 1px solid rgba(255,255,255,.12);
  background: #fff;
  box-shadow: 0 32px 80px rgba(0,0,0,.48);
  cursor: text;
  touch-action: manipulation;
  transition: width 180ms cubic-bezier(.22,1,.36,1);
}

.canvas-edit-targets {
  position: absolute;
  z-index: 10;
  inset: 0;
  overflow: visible;
  pointer-events: none;
}

.canvas-edit-target {
  position: absolute;
  min-width: 28px;
  min-height: 28px;
  padding: 0;
  border: 0;
  border-radius: 2px;
  background: transparent;
  cursor: text;
  pointer-events: auto;
  -webkit-tap-highlight-color: transparent;
}

.canvas-edit-target:hover,
.canvas-edit-target:focus-visible {
  outline: 1px solid rgba(246, 240, 228, .72);
  outline-offset: 1px;
  background: rgba(217, 176, 106, .09);
}

.canvas-edit-target:focus-visible {
  outline-width: 2px;
  outline-color: var(--gold-bright);
}

.canvas-inline-editor {
  position: absolute;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 38px;
  align-items: end;
  gap: 7px;
  width: 280px;
  padding: 9px;
  border: 1px solid var(--gold-bright);
  border-radius: 5px;
  background: rgba(12, 12, 10, .94);
  box-shadow: 0 18px 50px rgba(0,0,0,.58), 0 0 0 3px rgba(217,176,106,.12);
  backdrop-filter: blur(14px);
}
.canvas-inline-editor[hidden] { display: none; }
.canvas-inline-editor label { display: grid; min-width: 0; gap: 5px; }
.canvas-inline-editor label > span {
  overflow: hidden;
  color: var(--gold-bright);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: .08em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}
.canvas-inline-editor input {
  width: 100%;
  min-width: 0;
  height: 38px;
  padding: 0 10px;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 3px;
  color: var(--paper);
  background: #1a1a17;
  font: 600 13px/1 var(--font-sans);
}
.canvas-inline-editor input:focus { border-color: var(--gold); outline: none; }
.canvas-inline-editor button {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 3px;
  color: #11100e;
  background: var(--gold-bright);
}
.canvas-inline-editor button svg { width: 17px; }

.export-dock { border-top: 1px solid var(--soft-line); border-bottom: 0; }
.export-copy strong { max-width: 245px; overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.export-buttons { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }

.progress-modal {
  position: fixed;
  z-index: 20000;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(6, 6, 5, .82);
  backdrop-filter: blur(16px);
}

.progress-modal[hidden] { display: none; }

.progress-dialog {
  width: min(430px, 100%);
  padding: 38px 34px 32px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #131310;
  box-shadow: 0 40px 100px rgba(0,0,0,.6);
  text-align: center;
}

.progress-mark { display: grid; width: 58px; height: 58px; place-items: center; margin: 0 auto 22px; border-radius: 50%; color: #11100e; background: var(--gold-bright); }
.progress-mark svg { width: 25px; }
.progress-dialog h2 { margin: 0; font: 600 28px/1.15 var(--font-display); letter-spacing: 0; }
.progress-dialog > p:last-child { margin: 12px 0 0; color: var(--muted); font-size: 11px; }
.progress-track { height: 5px; margin-top: 25px; overflow: hidden; border-radius: 999px; background: #31302b; }
.progress-track span { display: block; width: 0; height: 100%; background: linear-gradient(90deg, var(--gold), #f3d89e); transition: width 220ms ease; }

.toast {
  position: fixed;
  z-index: 21000;
  right: 24px;
  bottom: 24px;
  max-width: min(370px, calc(100vw - 48px));
  padding: 14px 17px;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--paper);
  background: #171713;
  box-shadow: 0 18px 48px rgba(0,0,0,.45);
  font-size: 11px;
  line-height: 1.5;
  opacity: 0;
  pointer-events: none;
  transform: translateY(14px);
  transition: opacity 180ms ease, transform 180ms ease;
}
.toast.is-visible { opacity: 1; transform: translateY(0); }

@media (max-width: 1120px) {
  .studio-layout { grid-template-columns: minmax(390px, .82fr) minmax(430px, 1fr); }
  .canvas-stage { min-height: 610px; padding: 24px; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
}

@media (max-width: 900px) {
  .brand-cinema,
  .brand-cinema-inner { min-height: 252px; }
  .brand-cinema-inner {
    align-items: flex-start;
    flex-direction: column;
    justify-content: flex-end;
    padding: 36px 18px 28px;
  }
  .brand-cinema-overlay {
    background: linear-gradient(180deg, rgba(7, 7, 6, .18), rgba(7, 7, 6, .94) 88%);
  }
  .app-shell { padding: 20px 16px 54px; }
  .privacy-note { display: none; }
  .studio-layout { display: flex; flex-direction: column-reverse; }
  .editor,
  .preview-panel { width: 100%; }
  .preview-panel { position: relative; top: auto; }
  .canvas-stage { min-height: 520px; }
}

@media (max-width: 620px) {
  .app-shell { padding-inline: 12px; }
  .brand-cinema,
  .brand-cinema-inner { min-height: 242px; }
  .brand-cinema-inner { padding: 30px 18px 26px; }
  .brand-cinema-video {
    inset: -5%;
    width: 110%;
    height: 110%;
    opacity: .48;
  }
  .back-link { margin-bottom: 18px; }
  h1 { font-size: 38px; }
  .intro-copy { font-size: 13px; }
  .editor-topline,
  .preview-toolbar,
  .export-dock { min-height: 64px; padding-inline: 14px; }
  .control-section { padding: 23px 15px 25px; }
  .control-grid.two,
  .upload-pair { grid-template-columns: 1fr; }
  .control-grid.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .import-row { align-items: stretch; flex-direction: column; }
  .import-button { width: 100%; }
  .canvas-stage { min-height: 430px; padding: 16px; }
  #designCanvas { max-height: 68vh; }
  .beta-chip { width: 100%; border: 0; padding: 0; background: transparent; }
  .export-dock { align-items: stretch; flex-direction: column; }
  .export-buttons { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .action-button { padding-inline: 11px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
  .brand-cinema-video { display: none; }
}

@media print {
  .brand-cinema,
  .ce-footer,
  .editor,
  .preview-toolbar,
  .export-dock { display: none !important; }
  .preview-panel { border: 0; box-shadow: none; }
  .canvas-stage { min-height: 0; padding: 0; background: #fff; }
  #designCanvas { width: 100%; max-height: none; border: 0; box-shadow: none; }
}
