/* Bundled fonts: rendered onto the canvas by js/render.js. Family names
   here must match FONT_FAMILIES there (keep in sync; see fonts/README.md).
   Canvas use is loaded via HandleRender.ensureFontsLoaded(); Montserrat and
   Playfair Display are additionally used (and therefore loaded) by the page
   chrome below. unicode-range keeps downloads to the subsets actually used. */
@font-face {
  font-family: "DejaVu Sans";
  src: url("../fonts/DejaVuSans.ttf") format("truetype");
  font-weight: 400;
}
@font-face {
  font-family: "DejaVu Sans";
  src: url("../fonts/DejaVuSans-Bold.ttf") format("truetype");
  font-weight: 700;
}

/* Google-Fonts subsets (static latin / latin-ext woff2; provenance in
   fonts/README.md). Ranges are Google's own. */
@font-face { font-family: "Montserrat"; font-weight: 400; src: url("../fonts/montserrat-400-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Montserrat"; font-weight: 400; src: url("../fonts/montserrat-400-latin-ext.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Montserrat"; font-weight: 700; src: url("../fonts/montserrat-700-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Montserrat"; font-weight: 700; src: url("../fonts/montserrat-700-latin-ext.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Bebas Neue"; font-weight: 400; src: url("../fonts/bebas-neue-400-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Bebas Neue"; font-weight: 400; src: url("../fonts/bebas-neue-400-latin-ext.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Playfair Display"; font-weight: 400; src: url("../fonts/playfair-display-400-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Playfair Display"; font-weight: 400; src: url("../fonts/playfair-display-400-latin-ext.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Playfair Display"; font-weight: 700; src: url("../fonts/playfair-display-700-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Playfair Display"; font-weight: 700; src: url("../fonts/playfair-display-700-latin-ext.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Pacifico"; font-weight: 400; src: url("../fonts/pacifico-400-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Pacifico"; font-weight: 400; src: url("../fonts/pacifico-400-latin-ext.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Great Vibes"; font-weight: 400; src: url("../fonts/great-vibes-400-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Great Vibes"; font-weight: 400; src: url("../fonts/great-vibes-400-latin-ext.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

/* ====================================================================
   "Atelier" visual language: warm espresso-ink surfaces, champagne-brass
   accents, Playfair Display for display type, Montserrat for UI chrome.
   Pure CSS over the JS contract in app.js: element IDs, .dragover,
   .thumb/.active/.remove, .grabbable/.dragging, corner .active, [hidden],
   and :disabled must all keep working. Zero network requests: every
   background image below is a data URI, every font a bundled file.
   ==================================================================== */

:root {
  /* Ground */
  --ink-950: #120E0A;      /* page base, near-black espresso */
  --ink-900: #1A1410;      /* page gradient upper glow */

  /* Surfaces */
  --panel:   #201913;      /* card surface */
  --panel-2: #2A2119;      /* inputs, inset wells, dropzone fill */
  --panel-3: #342921;      /* hover fill for inputs and buttons */

  /* Lines */
  --border:        #3A2F24;               /* default hairline */
  --border-strong: #4E4032;               /* hover hairline */
  --rule:          rgba(201, 169, 106, 0.22); /* gold hairline rules */

  /* Text */
  --text:       #F1E9DC;   /* warm ivory */
  --text-2:     #A69885;   /* muted, labels */
  --text-faint: #9A8C7C;   /* placeholders, footnotes; keeps WCAG AA (4.5:1)
                              on every surface it is used on */

  /* Accent: champagne brass */
  --gold:        #C9A96A;
  --gold-bright: #E3C98F;
  --gold-deep:   #A8894E;
  --gold-ink:    #221A10;  /* text on gold surfaces */
  --gold-ghost:  rgba(201, 169, 106, 0.14);

  /* States */
  --danger:     #C4695A;
  --focus-ring: rgba(227, 201, 143, 0.8);

  /* Geometry and depth */
  --radius:    14px;
  --radius-sm: 9px;
  --shadow-panel: inset 0 1px 0 rgba(255, 255, 255, 0.035),
                  0 24px 48px -28px rgba(0, 0, 0, 0.65);
  --shadow-pop: 0 4px 16px -4px rgba(0, 0, 0, 0.5);
  --shadow-cta: 0 10px 24px -10px rgba(201, 169, 106, 0.45),
                0 2px 4px rgba(0, 0, 0, 0.4);
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

* { box-sizing: border-box; }

/* Author display rules (e.g. .field { display:flex }) would otherwise beat
   the UA's [hidden] { display:none }; this keeps the hidden attribute
   authoritative for JS-toggled sections. */
[hidden] { display: none !important; }

/* Visually hidden but read by screen readers (status announcements). */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

html {
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

body {
  margin: 0;
  font-family: "Montserrat", "Segoe UI", system-ui, sans-serif;
  font-size: 13.5px;
  line-height: 1.55;
  letter-spacing: 0.01em;
  -webkit-font-smoothing: antialiased;
  color: var(--text);
  min-height: 100vh;
  background-color: var(--ink-950);
  /* Film grain (inline SVG turbulence) over a warm radial glow. */
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)' opacity='0.035'/%3E%3C/svg%3E"),
    radial-gradient(1100px 520px at 68% -12%, var(--ink-900), var(--ink-950));
  background-repeat: repeat, no-repeat;
}

::selection { background: rgba(201, 169, 106, 0.3); }

:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

/* ---- Masthead ------------------------------------------------------- */

.topbar {
  max-width: 1240px;
  margin: 0 auto;
  padding: 32px 40px 20px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  border-bottom: 1px solid var(--rule);
  box-shadow: 0 3px 0 -2px rgba(201, 169, 106, 0.10); /* double editorial rule */
}
.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}
.brand-mark {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
}
.topbar h1 {
  margin: 0;
  font-family: "Playfair Display", Georgia, "Times New Roman", serif;
  font-size: 30px;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: 0.01em;
}
.brand-dot { color: var(--gold); }
.topbar p {
  margin: 3px 0 0;
  color: var(--text-2);
  font-size: 13.5px;
}
.privacy-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  color: var(--gold);
  background: rgba(201, 169, 106, 0.06);
  font-size: 12px;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.privacy-badge svg { flex-shrink: 0; }

/* ---- Layout and panels ---------------------------------------------- */

.layout {
  max-width: 1240px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 372px;
  gap: 28px;
  padding: 28px 40px 64px;
  align-items: start;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-panel);
}

.settings-panel {
  display: flex;
  flex-direction: column;
  gap: 28px;
  position: sticky;
  top: 24px;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.colophon {
  max-width: 1240px;
  margin: 0 auto;
  padding: 20px 40px 40px;
  border-top: 1px solid var(--rule);
}
.colophon-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px 24px;
  flex-wrap: wrap;
}
.colophon p {
  margin: 0;
  font-size: 12px;
  color: var(--text-faint);
  letter-spacing: 0.04em;
}
.colophon a {
  color: var(--text-2);
  text-decoration: none;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 1px;
  transition: color 0.16s var(--ease), border-color 0.16s var(--ease);
}
.colophon a:hover { color: var(--gold); border-color: var(--gold); }

/* ---- Dropzone (the hero) -------------------------------------------- */

.dropzone {
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(180deg, #241C15, var(--panel-2));
  padding: 64px 32px;
  text-align: center;
  cursor: pointer;
  box-shadow: inset 0 0 60px rgba(0, 0, 0, 0.25);
  transition: border-color 0.16s var(--ease), background-color 0.16s var(--ease);
}
.dropzone::before {
  /* inner dashed keyline: the "print mat" */
  content: "";
  position: absolute;
  inset: 10px;
  border: 1px dashed var(--border-strong);
  border-radius: 8px;
  pointer-events: none;
  transition: border-color 0.16s var(--ease);
}
.dz-icon {
  display: block;
  margin: 0 auto 14px;
  transition: transform 0.16s var(--ease);
}
.dropzone-inner strong {
  display: block;
  font-family: "Playfair Display", Georgia, "Times New Roman", serif;
  font-size: 22px;
  font-weight: 400;
  line-height: 1.3;
  letter-spacing: 0.01em;
  color: var(--text);
  margin-bottom: 6px;
}
.dropzone-inner span {
  display: block;
  max-width: 46ch;
  margin: 0 auto;
  color: var(--text-2);
  font-size: 13px;
  line-height: 1.55;
}
.dropzone:hover { border-color: var(--border-strong); }
.dropzone:hover .dz-icon { transform: translateY(-2px); }
.dropzone:hover::before { border-color: var(--rule); }
.dropzone.dragover {
  border-color: var(--gold);
  background-color: var(--panel-3);
  animation: beckon 1.2s ease-out infinite;
}

/* With no images yet, the hero fills the first screen's left column on
   desktop instead of leaving it top-heavy. Progressive enhancement via
   :has(), like the slim strip below. */
@media (min-width: 821px) {
  .dropzone:has(+ .thumbs[hidden]) {
    min-height: 460px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
}

/* Once images exist, the hero collapses into a slim "add more" strip.
   Progressive enhancement: browsers without :has() keep the full hero. */
.dropzone:has(+ .thumbs:not([hidden])) {
  padding: 18px 24px;
  box-shadow: none;
}
.dropzone:has(+ .thumbs:not([hidden]))::before { inset: 6px; }
.dropzone:has(+ .thumbs:not([hidden])) .dz-icon { display: none; }
.dropzone:has(+ .thumbs:not([hidden])) .dropzone-inner strong { display: none; }
.dropzone:has(+ .thumbs:not([hidden])) .dropzone-inner span {
  display: inline;
  max-width: none;
}

/* ---- Thumbnails (markup generated by app.js; style only) ------------- */

.thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}
.thumb {
  position: relative;
  width: 72px;
  height: 72px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
  cursor: pointer;
  box-shadow: var(--shadow-pop);
  transition: border-color 0.16s var(--ease), transform 0.16s var(--ease),
              box-shadow 0.16s var(--ease);
}
.thumb:hover { transform: translateY(-2px); }
.thumb.active {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-ghost), var(--shadow-pop);
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .remove {
  position: absolute;
  top: 3px; right: 3px;
  width: 20px; height: 20px;
  line-height: 18px;
  padding: 0;
  border-radius: 50%;
  background: rgba(18, 14, 10, 0.8);
  color: var(--text-2);
  border: none;
  cursor: pointer;
  font-size: 12px;
  opacity: 0;
  transition: opacity 0.16s var(--ease), background-color 0.16s var(--ease),
              color 0.16s var(--ease);
}
.thumb:hover .remove,
.thumb:focus-within .remove { opacity: 1; }
.thumb .remove:hover { background: var(--danger); color: #fff; }
@media (hover: none) {
  .thumb .remove { opacity: 1; }
}

/* ---- Preview -------------------------------------------------------- */

.preview-wrap { margin-top: 20px; animation: rise 0.3s var(--ease); }
.thumbs { animation: rise 0.3s var(--ease); }
.preview-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
  color: var(--text-2);
  letter-spacing: 0.04em;
  margin-bottom: 10px;
}
#previewName {
  color: var(--text-faint);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.preview-stage {
  position: relative;
  background: repeating-conic-gradient(#191410 0% 25%, #221B15 0% 50%) 50% / 24px 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  min-height: 240px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.preview-stage::after {
  /* vignette; pointer-events none keeps canvas dragging unaffected */
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  box-shadow: inset 0 0 90px rgba(0, 0, 0, 0.5);
}
.preview-stage canvas {
  max-width: 100%;
  max-height: 60vh;
  display: block;
  box-shadow: 0 12px 32px -12px rgba(0, 0, 0, 0.7);
  touch-action: none; /* allow watermark dragging on touch screens */
}
.preview-stage canvas.grabbable { cursor: grab; }
.preview-stage canvas.dragging { cursor: grabbing; }

.spinner {
  position: absolute;
  width: 30px; height: 30px;
  border: 2px solid rgba(241, 233, 220, 0.15);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Settings column ------------------------------------------------- */

.group { display: flex; flex-direction: column; gap: 16px; }
.group-title {
  display: flex;
  align-items: center;
  margin: 0;
  color: var(--text-2);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.group-title .num {
  font-family: "Playfair Display", Georgia, "Times New Roman", serif;
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0.06em;
  color: var(--gold);
  margin-right: 8px;
}
.group-title .rule {
  flex: 1;
  height: 1px;
  background: var(--rule);
  margin-left: 12px;
}

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

.field { display: flex; flex-direction: column; gap: 6px; }
.field > span {
  color: var(--text-2);
  font-size: 12px;
  line-height: 1.4;
  letter-spacing: 0.03em;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.field small { color: var(--text-faint); }
.field-row { display: flex; gap: 12px; }
.field-row .field { flex: 1; }

output {
  color: var(--gold);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
}

/* ---- Text inputs and select ------------------------------------------ */

textarea {
  width: 100%;
  min-height: 78px;
  padding: 10px 12px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  line-height: 1.5;
  resize: vertical;
  transition: border-color 0.16s var(--ease), box-shadow 0.16s var(--ease);
}
textarea::placeholder { color: var(--text-faint); }
textarea:hover { border-color: var(--border-strong); }
textarea:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-ghost);
  outline: none;
}

select {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  background-color: var(--panel-2);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23C9A96A' stroke-width='1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 10px 36px 10px 12px;
  font-size: 14px;
  cursor: pointer;
  transition: border-color 0.16s var(--ease), background-color 0.16s var(--ease);
}
select:hover { border-color: var(--border-strong); }
option {
  background: var(--panel-2);
  color: var(--text);
  font-size: 15px;
}

/* ---- Color inputs ---------------------------------------------------- */

input[type="color"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 38px;
  padding: 0;
  cursor: pointer;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color 0.16s var(--ease);
}
input[type="color"]::-webkit-color-swatch-wrapper { padding: 4px; }
input[type="color"]::-webkit-color-swatch { border: none; border-radius: 6px; }
input[type="color"]::-moz-color-swatch { border: none; border-radius: 6px; }
input[type="color"]:hover { border-color: var(--gold); }

/* ---- Sliders --------------------------------------------------------- */

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 38px; /* matches input[type=color] so paired rows align */
  padding: 0;
  margin: 0;
  background: transparent;
  border: none;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 3px;
  border-radius: 2px;
  background: var(--border-strong);
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  margin-top: -6.5px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: linear-gradient(180deg, var(--gold-bright), var(--gold-deep));
  border: 1px solid #8C7347;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
  transition: box-shadow 0.16s var(--ease);
}
input[type="range"]::-moz-range-track {
  height: 3px;
  border-radius: 2px;
  background: var(--border-strong);
}
input[type="range"]::-moz-range-progress {
  height: 3px;
  border-radius: 2px;
  background: var(--gold);
}
input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: linear-gradient(180deg, var(--gold-bright), var(--gold-deep));
  border: 1px solid #8C7347;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
  transition: box-shadow 0.16s var(--ease);
}
input[type="range"]:hover::-webkit-slider-thumb  { box-shadow: 0 0 0 5px var(--gold-ghost), 0 2px 6px rgba(0, 0, 0, 0.5); }
input[type="range"]:active::-webkit-slider-thumb { box-shadow: 0 0 0 7px rgba(201, 169, 106, 0.22), 0 2px 6px rgba(0, 0, 0, 0.5); }
input[type="range"]:hover::-moz-range-thumb      { box-shadow: 0 0 0 5px var(--gold-ghost), 0 2px 6px rgba(0, 0, 0, 0.5); }
input[type="range"]:active::-moz-range-thumb     { box-shadow: 0 0 0 7px rgba(201, 169, 106, 0.22), 0 2px 6px rgba(0, 0, 0, 0.5); }
input[type="range"]:focus-visible { outline: none; }
input[type="range"]:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 4px var(--focus-ring), 0 2px 6px rgba(0, 0, 0, 0.5); }
input[type="range"]:focus-visible::-moz-range-thumb     { box-shadow: 0 0 0 4px var(--focus-ring), 0 2px 6px rgba(0, 0, 0, 0.5); }

/* ---- Buttons and pickers --------------------------------------------- */

.logo-control { display: flex; align-items: center; gap: 10px; }
.pick-btn {
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  letter-spacing: 0.02em;
  transition: border-color 0.16s var(--ease), background-color 0.16s var(--ease);
}
.pick-btn:hover:not(:disabled) { border-color: var(--gold); background: var(--panel-3); }
.pick-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.font-row { align-items: center; justify-content: space-between; }
.font-row .pick-btn { padding: 8px 12px; }

/* Secondary action: the .pick-btn recipe at full width. */
.secondary {
  width: 100%;
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  font: inherit;
  font-size: 13px;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: border-color 0.16s var(--ease), background-color 0.16s var(--ease);
}
.secondary:hover:not(:disabled) { border-color: var(--gold); background: var(--panel-3); }
.secondary:disabled { opacity: 0.4; cursor: not-allowed; }

.logo-preview {
  position: relative;
  width: 48px; height: 48px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: repeating-conic-gradient(#191410 0% 25%, #221B15 0% 50%) 50% / 12px 12px;
  overflow: hidden;
  flex-shrink: 0;
}
.logo-preview img { width: 100%; height: 100%; object-fit: contain; display: block; }
.logo-remove {
  position: absolute;
  top: 2px; right: 2px;
  width: 16px; height: 16px;
  line-height: 14px;
  padding: 0;
  border-radius: 50%;
  background: rgba(18, 14, 10, 0.8);
  color: var(--text-2);
  border: none;
  cursor: pointer;
  font-size: 11px;
  transition: background-color 0.16s var(--ease), color 0.16s var(--ease);
}
.logo-remove:hover { background: var(--danger); color: #fff; }

/* ---- Corner picker (framed-print miniatures with a position dot) ----- */

/* Photo-aspect tiles (not full-width wells): each reads as a small framed
   print with a dot marking where the watermark will sit. */
.corner-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 96px));
  gap: 8px;
}
.corner-grid button {
  position: relative;
  height: 64px;
  font-size: 0; /* hides the arrow glyph; the text still names the button */
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color 0.16s var(--ease), background-color 0.16s var(--ease);
}
.corner-grid button::after {
  content: "";
  position: absolute;
  inset: 7px;
  border: 1px solid var(--border-strong);
  border-radius: 3px;
  pointer-events: none;
}
.corner-grid button::before {
  content: "";
  position: absolute;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--text-faint);
  transition: background-color 0.16s var(--ease);
}
.corner-grid button[data-corner="top-left"]::before     { top: 12px; left: 12px; }
.corner-grid button[data-corner="top-right"]::before    { top: 12px; right: 12px; }
.corner-grid button[data-corner="bottom-left"]::before  { bottom: 12px; left: 12px; }
.corner-grid button[data-corner="bottom-right"]::before { bottom: 12px; right: 12px; }
.corner-grid button:hover { border-color: var(--border-strong); background: var(--panel-3); }
.corner-grid button.active { border-color: var(--gold); background: var(--gold-ghost); }
.corner-grid button.active::before {
  background: var(--gold-bright);
  box-shadow: 0 0 6px rgba(227, 201, 143, 0.6);
}

/* ---- Checkboxes as toggle switches ----------------------------------- */

.checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
}
.checkbox input {
  -webkit-appearance: none;
  appearance: none;
  width: 36px; height: 20px;
  margin: 0;
  flex-shrink: 0;
  border-radius: 999px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  position: relative;
  cursor: pointer;
  transition: background-color 0.16s var(--ease), border-color 0.16s var(--ease);
}
.checkbox input::before {
  content: "";
  position: absolute;
  top: 2px; left: 2px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--text-2);
  transition: transform 0.16s var(--ease), background-color 0.16s var(--ease);
}
.checkbox input:checked { background: rgba(201, 169, 106, 0.28); border-color: #8C7347; }
.checkbox input:checked::before { transform: translateX(16px); background: var(--gold-bright); }
.checkbox input:disabled { opacity: 0.4; cursor: not-allowed; }
.checkbox input:disabled + span { opacity: 0.45; }

/* ---- Primary CTA and status ------------------------------------------ */

.primary {
  margin-top: 4px;
  padding: 15px 16px;
  width: 100%;
  background: linear-gradient(180deg, #DDBE82, #B2905A);
  color: var(--gold-ink);
  border: 1px solid #8C7347;
  border-radius: var(--radius-sm);
  font: 700 13px/1 "Montserrat", "Segoe UI", system-ui, sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  cursor: pointer;
  box-shadow: var(--shadow-cta);
  transition: filter 0.16s var(--ease), transform 0.16s var(--ease),
              box-shadow 0.16s var(--ease);
}
.primary:hover:not(:disabled) {
  filter: brightness(1.07);
  transform: translateY(-1px);
  box-shadow: 0 14px 28px -10px rgba(201, 169, 106, 0.55), 0 2px 4px rgba(0, 0, 0, 0.4);
}
.primary:active:not(:disabled) { transform: translateY(0); filter: brightness(0.97); }
.primary:disabled {
  background: var(--panel-3);
  color: var(--text-faint);
  border-color: var(--border);
  box-shadow: none;
  cursor: not-allowed;
}

.status {
  min-height: 19px;
  font-size: 12.5px;
  color: var(--text-2);
  letter-spacing: 0.03em;
  font-variant-numeric: tabular-nums;
  margin: 0;
}
.export-note {
  margin: 0;
  font-size: 11.5px;
  color: var(--text-faint);
  letter-spacing: 0.04em;
  text-align: center;
}
.muted { color: var(--text-2); }

/* ---- Scrollbars ------------------------------------------------------ */

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 999px;
  border: 3px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--border-strong);
  background-clip: content-box;
}

/* ---- Editorial (crawlable prose below the tool) ----------------------
   Static SEO copy in index.html; keep it quiet: narrow measure, muted ink,
   gold hairlines. The app above stays the hero. */

.editorial {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 40px 56px;
}
.editorial h2 {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 44px 0 16px;
  font-family: "Playfair Display", Georgia, "Times New Roman", serif;
  font-size: 21px;
  font-weight: 400;
  letter-spacing: 0.01em;
  color: var(--text);
}
.editorial h2::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--rule);
}
.editorial p,
.editorial li {
  margin: 0 0 12px;
  color: var(--text-2);
  font-size: 13.5px;
  line-height: 1.7;
}
.editorial strong { color: var(--text); font-weight: 600; }
.editorial .steps { margin: 0; padding-left: 20px; }
.editorial .sample { margin: 20px 0 0; }
.editorial .sample img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: 0 12px 32px -12px rgba(0, 0, 0, 0.7);
}
.editorial .sample figcaption {
  margin-top: 8px;
  color: var(--text-faint);
  font-size: 12px;
  letter-spacing: 0.02em;
}
.editorial .steps li::marker {
  font-family: "Playfair Display", Georgia, "Times New Roman", serif;
  color: var(--gold);
}
.editorial details { border-bottom: 1px solid var(--border); }
.editorial summary {
  cursor: pointer;
  padding: 11px 0;
  color: var(--text);
  font-size: 13.5px;
  font-weight: 600;
  transition: color 0.16s var(--ease);
}
.editorial summary::marker { color: var(--gold); }
.editorial summary:hover { color: var(--gold-bright); }
.editorial details p { padding-left: 20px; }

.noscript-note {
  max-width: 720px;
  margin: 0 auto;
  padding: 16px 40px;
  color: var(--text-2);
  text-align: center;
}

/* ---- Motion ---------------------------------------------------------- */

@keyframes rise {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: none; }
}
@keyframes beckon {
  from { box-shadow: 0 0 0 0 rgba(201, 169, 106, 0.35); }
  to   { box-shadow: 0 0 0 14px rgba(201, 169, 106, 0); }
}
.topbar         { animation: rise 0.42s cubic-bezier(0.22, 1, 0.36, 1) both; }
.preview-panel  { animation: rise 0.42s cubic-bezier(0.22, 1, 0.36, 1) 60ms both; }
.settings-panel { animation: rise 0.42s cubic-bezier(0.22, 1, 0.36, 1) 120ms both; }
.editorial      { animation: rise 0.42s cubic-bezier(0.22, 1, 0.36, 1) 180ms both; }
.colophon       { animation: rise 0.42s cubic-bezier(0.22, 1, 0.36, 1) 240ms both; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  /* The spinner is state communication, not decoration; it keeps spinning. */
  .spinner {
    animation-duration: 0.8s !important;
    animation-iteration-count: infinite !important;
  }
}

/* ---- Responsive ------------------------------------------------------ */

@media (max-width: 820px) {
  .topbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    padding: 24px 20px 16px;
  }
  .privacy-badge { white-space: normal; } /* wraps instead of overflowing < 344px */
  .layout {
    grid-template-columns: 1fr;
    padding: 20px 20px 48px;
    gap: 20px;
  }
  .settings-panel {
    position: static;
    max-height: none;
    overflow-y: visible;
  }
  .dropzone { padding: 48px 20px; }
  .dropzone-inner strong { font-size: 20px; }
  .preview-stage canvas { max-height: 50vh; }
  .editorial { padding: 0 20px 40px; }
  .colophon { padding: 16px 20px 32px; }
  .colophon-inner {
    flex-direction: column;
    text-align: center;
    gap: 6px;
  }
}
