/* Straw Gold palette
   50 FBF7E9 · 100 F7EED4 · 200 EFDEA9 · 300 E7CD7E · 400 DFBC53 · 500 D7AB28
   600 AC8920 · 700 816718 · 800 564510 · 900 2B2208 · 950 1E1806 */
:root {
  /* Dark theme (default) */
  --bg: #14110a;
  --panel: #1c180d;
  --elev: #262011;
  --ink: #FBF7E9;
  --muted: #b3a276;
  --line: #352b15;
  --hover: #2a2210;
  --accent: #DFBC53;       /* 400 */
  --accent-ink: #211a06;
  --radius: 14px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.5);
  --font: 'Montserrat', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}

html[data-theme="light"] {
  --bg: #FBF7E9;           /* 50 */
  --panel: #ffffff;
  --elev: #F7EED4;         /* 100 */
  --ink: #2B2208;          /* 900 */
  --muted: #87702a;
  --line: #EADAA8;         /* ~200 */
  --hover: #F1E6C5;
  --accent: #D7AB28;       /* 500 */
  --accent-ink: #2B2208;   /* 900 */
  --shadow: 0 18px 50px rgba(120, 95, 20, 0.18);
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }

body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ---------- Topbar ---------- */
.topbar {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}
.brand { font-weight: 800; letter-spacing: 4px; font-size: 18px; color: var(--ink); }
.topbar__actions { display: flex; align-items: center; gap: 18px; }
.price { font-weight: 700; font-size: 18px; color: var(--accent); }

.btn {
  font-family: var(--font);
  font-weight: 700;
  font-size: 14px;
  border: none;
  border-radius: 999px;
  padding: 11px 24px;
  cursor: pointer;
  transition: transform .08s ease, opacity .15s ease, box-shadow .15s ease;
}
.btn:active { transform: translateY(1px); }
.btn--primary {
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 6px 18px rgba(215, 171, 40, 0.28);
}
.btn--primary:hover { box-shadow: 0 8px 24px rgba(215, 171, 40, 0.45); }
.btn--primary:disabled { opacity: .5; cursor: default; box-shadow: none; }

/* ---------- App shell ---------- */
.app { flex: 1; display: flex; min-height: 0; }

/* ---------- Slim icon rail ---------- */
.rail {
  width: 74px;
  flex: none;
  background: var(--panel);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: 12px 0;
  gap: 4px;
  z-index: 12;
}
.rail__btn {
  background: none;
  border: none;
  color: var(--muted);
  font-family: var(--font);
  cursor: pointer;
  padding: 10px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  position: relative;
  transition: color .15s ease;
}
.rail__btn svg { width: 23px; height: 23px; }
.rail__btn span { font-size: 10px; letter-spacing: .3px; }
.rail__btn:hover { color: var(--ink); }
.rail__btn.is-active { color: var(--accent); }
.rail__btn.is-active::before {
  content: '';
  position: absolute;
  left: 0; top: 8px; bottom: 8px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
}

/* ---------- Flyout panel ---------- */
.flyout {
  width: 304px;
  flex: none;
  background: var(--panel);
  border-right: 1px solid var(--line);
  padding: 22px;
  overflow-y: auto;
  z-index: 11;
}
.flyout.is-closed { display: none; }
.flyout__section { display: none; }
.flyout__section.is-active { display: block; }
.flyout__title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--muted);
  margin: 0 0 16px;
}

/* ---------- Inputs ---------- */
.input {
  width: 100%;
  font-family: var(--font);
  font-size: 14px;
  color: var(--ink);
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--elev);
  outline: none;
  transition: border-color .15s ease;
}
.input::placeholder { color: var(--muted); }
.input:focus { border-color: var(--accent); }

.field { display: block; margin-bottom: 12px; }
.field > span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 5px; }

.check { display: flex; align-items: center; gap: 9px; font-size: 13px; cursor: pointer; color: var(--ink); }
.check input { width: 16px; height: 16px; accent-color: var(--accent); }

.hint { font-size: 12px; color: var(--muted); line-height: 1.5; margin-top: 14px; }

/* ---------- Search suggestions (shared: sidebar + launch modal) ---------- */
.search { position: relative; }
.suggest {
  list-style: none;
  margin: 6px 0 0;
  padding: 0;
  position: absolute;
  width: 100%;
  background: var(--elev);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
  z-index: 10;
  overflow: hidden;
  display: none;
}
.suggest.is-open { display: block; }
.suggest li {
  padding: 10px 13px;
  font-size: 13px;
  cursor: pointer;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
}
.suggest li:last-child { border-bottom: none; }
.suggest li:hover { background: var(--hover); }
.suggest li b { display: block; font-weight: 600; }
.suggest li span { display: block; font-size: 11px; color: var(--muted); margin-top: 2px; }

/* ---------- Swatches ---------- */
.swatches { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.swatch {
  cursor: pointer;
  border: 2px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: var(--elev);
  padding: 0;
  transition: border-color .12s ease;
}
.swatch.is-active { border-color: var(--accent); }
.swatch__chip { height: 46px; width: 100%; }
.swatch__name { display: block; font-size: 11px; padding: 5px 4px; text-align: center; color: var(--muted); }

/* ---------- Theme cards (terraink-style) ---------- */
.theme-head { margin-bottom: 16px; }
.theme-head__name { font-size: 13px; font-weight: 700; letter-spacing: 1.5px; color: var(--ink); }
.theme-head__desc { font-size: 12px; color: var(--muted); margin-top: 5px; line-height: 1.45; }

.theme-list { display: flex; flex-direction: column; gap: 10px; }
.theme-card {
  position: relative;
  height: 84px;
  padding: 0;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: var(--elev);
  cursor: pointer;
  overflow: hidden;
  transition: border-color .12s ease;
}
.theme-card.is-active { border-color: var(--accent); }
.theme-card__strip { position: absolute; inset: 0; display: flex; }
.theme-card__strip span { flex: 1; }
.theme-card__name {
  position: absolute;
  left: 12px; bottom: 9px;
  font-family: var(--font);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 1px;
  color: #fff;
  text-shadow: 0 1px 4px rgba(0,0,0,0.75);
}

/* ---------- Color Editor (terraink-style) ---------- */
.ceditor { margin-top: 22px; border-top: 1px solid var(--line); padding-top: 18px; }
.ceditor__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.ceditor__head span { font-size: 12px; text-transform: uppercase; letter-spacing: 2px; color: var(--muted); }
.ceditor__reset {
  background: none; border: 1px solid var(--line); color: var(--muted);
  border-radius: 8px; padding: 5px 11px; font-family: var(--font); font-size: 11px; cursor: pointer;
}
.ceditor__reset:hover { color: var(--ink); border-color: var(--ink); }
.ceditor__grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.cslot { display: flex; flex-direction: column; align-items: center; gap: 6px; cursor: pointer; }
.cslot input[type=color] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 46px; padding: 0;
  border: 1px solid var(--line); border-radius: 9px; background: none; cursor: pointer;
}
.cslot input[type=color]::-webkit-color-swatch-wrapper { padding: 4px; }
.cslot input[type=color]::-webkit-color-swatch { border: none; border-radius: 6px; }
.cslot input[type=color]::-moz-color-swatch { border: none; border-radius: 6px; }
.cslot span { font-size: 10px; color: var(--muted); text-align: center; line-height: 1.2; }

/* ---------- Markers ---------- */
.mk-colors { display: flex; gap: 8px; margin-bottom: 16px; }
.mk-color {
  width: 26px; height: 26px;
  border-radius: 50%;
  border: 2px solid var(--line);
  cursor: pointer;
  padding: 0;
}
.mk-color.is-active { border-color: var(--accent); }
.mk-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 16px; }
.mk-btn {
  background: var(--elev);
  border: 1px solid var(--line);
  border-radius: 10px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color .12s ease;
}
.mk-btn:hover { border-color: var(--accent); }
.mk-btn svg { width: 24px; height: 30px; }
.mk-clear {
  width: 100%;
  background: none;
  border: 1px solid var(--line);
  color: var(--muted);
  border-radius: 10px;
  padding: 10px;
  font-family: var(--font);
  font-size: 13px;
  cursor: pointer;
}
.mk-clear:hover { color: var(--ink); border-color: var(--ink); }

/* live draggable marker element */
.mk { cursor: grab; }
.mk:active { cursor: grabbing; }
.mk svg { display: block; }

/* ---------- Sizes / toggles ---------- */
.sizes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px; margin-bottom: 12px; }
.size-btn {
  font-family: var(--font);
  cursor: pointer;
  border: 1px solid var(--line);
  background: var(--elev);
  color: var(--ink);
  border-radius: 10px;
  padding: 10px;
  text-align: left;
  transition: border-color .12s ease;
}
.size-btn.is-active { border-color: var(--accent); }
.size-btn b { display: block; font-size: 13px; }
.size-btn span { font-size: 12px; color: var(--muted); }

.orient { display: flex; gap: 9px; }
.orient__btn {
  flex: 1;
  font-family: var(--font);
  font-size: 12px;
  cursor: pointer;
  border: 1px solid var(--line);
  background: var(--elev);
  color: var(--ink);
  border-radius: 10px;
  padding: 9px;
  transition: border-color .12s ease;
}
.orient__btn.is-active { border-color: var(--accent); }

/* ---------- Stage / Poster ---------- */
.stage {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  overflow: hidden;
  background: var(--bg);
}

/* Blurred ambient map behind the poster (terraink-style) */
.stage__bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  filter: blur(16px) saturate(1.1);
  transform: scale(1.12);
  pointer-events: none;
}
.stage::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  background: radial-gradient(circle at 50% 40%, rgba(13,15,19,0) 45%, rgba(13,15,19,0.45) 100%);
  pointer-events: none;
}
/* Light theme: soft fade of the blurred map into white on all four sides. */
html[data-theme="light"] .stage::after {
  background:
    linear-gradient(to right,  #fff, rgba(255,255,255,0) 26px, rgba(255,255,255,0) calc(100% - 26px), #fff),
    linear-gradient(to bottom, #fff, rgba(255,255,255,0) 26px, rgba(255,255,255,0) calc(100% - 26px), #fff);
}

.poster {
  position: relative;
  z-index: 2;
  background: #ffffff;
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.18),
    0 0 0 6px rgba(255, 255, 255, 0.06),
    0 30px 80px rgba(0, 0, 0, 0.65);
}
.poster__map { position: absolute; overflow: hidden; background: #e9e9e9; }

/* High-res supersampled render shown when the map is idle (dense detail, terraink-style) */
.poster__hires { position: absolute; pointer-events: none; opacity: 0; transition: opacity .12s ease; }

/* Soft fade of the map into the white poster at top & bottom */
.poster__fade {
  position: absolute;
  pointer-events: none;
  background: linear-gradient(to bottom,
    #ffffff 0%, rgba(255,255,255,0) 12%,
    rgba(255,255,255,0) 88%, #ffffff 100%);
}
/* Full-map mode: larger bottom fade so the overlaid caption sits on white */
.poster--full .poster__fade {
  background: linear-gradient(to bottom,
    #ffffff 0%, rgba(255,255,255,0) 12%,
    rgba(255,255,255,0) 58%, #ffffff 100%);
}

.poster__caption { position: absolute; }
.caption__title, .caption__subtitle, .caption__coords {
  position: absolute;
  left: 0; right: 0;
  text-align: center;
  line-height: 1;
  white-space: nowrap;
}
.caption__title { font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; color: #1c1b19; }
.caption__subtitle { font-weight: 500; letter-spacing: 0.16em; text-transform: uppercase; color: #3a3a3a; }
.caption__coords { font-weight: 400; letter-spacing: 0.14em; color: #8a857d; }
.caption__rule { position: absolute; left: 50%; transform: translateX(-50%); background: #1c1b19; }

.poster__attr {
  position: absolute;
  left: 0; right: 0;
  text-align: center;
  color: rgba(0, 0, 0, 0.30);
  white-space: nowrap;
  letter-spacing: .02em;
}

.maplibregl-ctrl-attrib { display: none !important; }

/* ---------- Launch modal ---------- */
.launch {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(9, 10, 14, 0.55);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: opacity .35s ease, visibility .35s ease;
}
.launch.is-hidden { opacity: 0; visibility: hidden; pointer-events: none; }
/* Returning visitor (saved session): hide instantly, before JS runs -> no reload flash. */
html.has-session .launch { display: none; }
.launch__card {
  width: 100%;
  max-width: 440px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 38px 34px 30px;
  text-align: center;
}
.launch__title { margin: 0 0 8px; font-size: 24px; font-weight: 800; letter-spacing: .5px; }
.launch__sub { margin: 0 0 22px; font-size: 14px; color: var(--muted); }
.launch__input {
  width: 100%;
  font-family: var(--font);
  font-size: 16px;
  color: var(--ink);
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--elev);
  outline: none;
  transition: border-color .15s ease;
}
.launch__input:focus { border-color: var(--accent); }
.launch .suggest { text-align: left; }
.launch__skip {
  margin-top: 18px;
  background: none;
  border: none;
  color: var(--muted);
  font-family: var(--font);
  font-size: 13px;
  cursor: pointer;
}
.launch__skip:hover { color: var(--ink); }

/* ---------- Overlay ---------- */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(8, 9, 12, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.overlay[hidden] { display: none; }
.overlay__box {
  background: var(--elev);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 34px 40px;
  text-align: center;
  max-width: 320px;
}
.overlay__box p { font-size: 14px; color: var(--ink); margin: 18px 0 0; }
.spinner {
  width: 38px; height: 38px;
  border: 3px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  margin: 0 auto;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Responsive ---------- */
@media (max-width: 820px) {
  /* Bar heights kept in sync so the stage fills exactly and sheets dock above them. */
  :root { --topbar-h: 52px; --rail-h: 56px; --buybar-h: 60px; }

  body { overflow: hidden; height: 100%; }
  .app { flex-direction: column; height: auto; }

  .topbar { height: var(--topbar-h); padding: 0 16px; }
  .brand { font-size: 15px; letter-spacing: 3px; }

  /* Map fills the space between topbar and the bottom bars — no gap, no overlap. */
  .stage {
    order: 1;
    flex: none;
    height: calc(100vh - var(--topbar-h) - var(--rail-h) - var(--buybar-h) - env(safe-area-inset-bottom, 0px));
    height: calc(100dvh - var(--topbar-h) - var(--rail-h) - var(--buybar-h) - env(safe-area-inset-bottom, 0px));
    padding: 12px;
  }

  /* Icon rail = bottom navigation, fixed just above the buy bar. */
  .rail {
    position: fixed;
    left: 0; right: 0; top: auto;
    bottom: calc(var(--buybar-h) + env(safe-area-inset-bottom, 0px));
    width: 100%;
    height: var(--rail-h);
    flex-direction: row;
    justify-content: space-around;
    align-items: center;
    background: var(--panel);
    border-right: none;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    padding: 0;
    z-index: 44;
  }
  .rail__btn { padding: 5px 0; }
  .rail__btn.is-active::before {
    left: 8px; right: 8px; bottom: auto; top: 0; /* indicator points up toward the sheet */
    width: auto; height: 3px;
    border-radius: 0 0 3px 3px;
  }

  /* Flyout = slide-up sheet docked above the rail. */
  .flyout {
    position: fixed;
    left: 0; right: 0; top: auto;
    bottom: calc(var(--buybar-h) + var(--rail-h) + env(safe-area-inset-bottom, 0px));
    width: 100%;
    max-height: 58vh;
    overflow-y: auto;
    border-right: none;
    border-top: 1px solid var(--line);
    border-radius: 18px 18px 0 0;
    transform: translateY(125%);
    transition: transform .3s cubic-bezier(.4, 0, .2, 1);
    z-index: 42;
  }
  .flyout.is-open { transform: translateY(0); }
  .flyout.is-closed { display: block; } /* on mobile, visibility is via .is-open transform */

  /* >=16px stops iOS Safari from auto-zooming when an input is focused */
  .input, .launch__input { font-size: 16px; }
}

/* ---------- Stripe Embedded Checkout modal ---------- */
.paymodal {
  position: fixed; inset: 0; z-index: 60;
  display: flex; align-items: center; justify-content: center;
  background: rgba(10, 12, 18, 0.72);
  backdrop-filter: blur(6px);
  padding: 24px;
  /* Always dark straw-gold, independent of the app's light/dark theme, so the modal
     stays cohesive with the (dark) Stripe form in both themes. */
  --panel: #1c180d;
  --elev: #211a0c;
  --ink: #FBF7E9;
  --muted: #b3a276;
  --line: #352b15;
  --accent: #DFBC53;
  --accent-ink: #211a06;
}
.paymodal[hidden] { display: none; }

.paymodal__card {
  position: relative;
  width: min(480px, 100%);
  max-height: 92vh;
  overflow-y: auto;
  /* Gold (D7AB28) glow on the left & right, fading into the dark panel centre. */
  background:
    radial-gradient(75% 120% at 0% 50%, rgba(215, 171, 40, 0.22), transparent 55%),
    radial-gradient(75% 120% at 100% 50%, rgba(215, 171, 40, 0.22), transparent 55%),
    var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
}

.paymodal__mount { min-height: 320px; }

.paymodal__close {
  position: absolute; top: 10px; right: 10px; z-index: 2;
  width: 32px; height: 32px;
  border: none; border-radius: 50%;
  background: var(--elev); color: var(--ink);
  font-size: 15px; line-height: 1; cursor: pointer;
}
.paymodal__close:hover { background: var(--line); }

@media (max-width: 560px) {
  .paymodal { padding: 0; }
  .paymodal__card { width: 100%; height: 100%; max-height: none; border-radius: 0; }
}

/* ---------- Finish toggle / disabled sizes ---------- */
#finishToggle { margin-bottom: 14px; }
.size-btn.is-disabled { opacity: 0.35; cursor: not-allowed; }

/* ---------- Buy panel (right of the map) ---------- */
.buypanel {
  width: 272px;
  flex-shrink: 0;
  background: var(--panel);
  border-left: 1px solid var(--line);
  padding: 20px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
}
.buypanel__head {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--ink);
  margin-bottom: 4px;
}
.buypanel__label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 6px;
}
.buypanel .sizes { margin-bottom: 0; }

.buypanel__finish .orient__btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 9px;
  padding: 12px 8px 10px;
  font-weight: 600;
}
.thumb {
  width: 40px;
  height: 54px;
  background: #e9eaee;
  border-radius: 2px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .45);
}
.thumb--framed { border: 5px solid #15161a; outline: 1px solid #3a3d46; }

.buypanel__spacer { flex: 1; }
.buypanel__price {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-size: 28px;
  font-weight: 800;
  color: var(--accent);
}
.buypanel__price small { font-size: 12px; font-weight: 500; color: var(--muted); }
.buypanel__buy { width: 100%; padding: 13px; font-size: 15px; }

@media (max-width: 820px) {
  /* Buy panel becomes a slide-up bottom sheet, opened from the sticky bar. */
  .buypanel {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    width: 100%;
    z-index: 45;
    max-height: 86vh;
    overflow-y: auto;
    border-left: none;
    border-top: 1px solid var(--line);
    border-radius: 18px 18px 0 0;
    transform: translateY(110%);
    transition: transform .3s cubic-bezier(.4, 0, .2, 1);
    padding-bottom: calc(22px + env(safe-area-inset-bottom, 0px));
  }
  .buypanel.is-open { transform: translateY(0); }
  .buypanel__spacer { display: none; }
  .buypanel__handle { display: block; }
  .buypanel { z-index: 48; } /* above the rail / buy bar when open */
}

/* Live frame preview when "Black frame" finish is selected.
   Drawn via box-shadow so the poster's inner size (map layout) stays unchanged. */
.poster.is-framed {
  box-shadow:
    0 0 0 2px #050608,
    0 0 0 16px #17181d,
    0 0 0 17px #3c3f48,
    0 34px 90px rgba(0, 0, 0, 0.75);
}

/* ---------- Paymodal: big poster preview next to the Stripe form ---------- */
.paymodal .paymodal__card { width: min(900px, 100%); }
.paymodal__body { display: flex; min-height: 480px; }
.paymodal__preview {
  flex: 0 0 360px;
  background: var(--elev);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 36px;
}
.paymodal__preview img {
  display: block;
  max-width: 100%;
  max-height: 500px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.3), 0 22px 60px rgba(0, 0, 0, 0.6);
}
.paymodal__preview img.is-framed {
  border: 10px solid #17181d;
  outline: 1px solid #3c3f48;
  /* weicher weißer Glow, damit sich der schwarze Rahmen vom dunklen Modal abhebt */
  box-shadow:
    0 0 28px rgba(255, 255, 255, 0.22),
    0 0 80px rgba(255, 255, 255, 0.10),
    0 22px 60px rgba(0, 0, 0, 0.55);
}
.paymodal__mount { flex: 1; }

@media (max-width: 760px) {
  .paymodal__body { flex-direction: column; min-height: 0; }
  .paymodal__preview { flex: none; padding: 18px; }
  .paymodal__preview img { max-height: 200px; }
}

/* ---------- Frame upsell step in the paymodal ---------- */
.paymodal__upsell {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  gap: 14px;
  padding: 40px 36px;
}
/* `display:flex` above would otherwise override the [hidden] attribute, leaving the
   upsell permanently visible next to the Stripe form. Force it hidden when set. */
.paymodal__upsell[hidden] { display: none; }
.paymodal__mount[hidden] { display: none; }
.paymodal__upsell h3 {
  margin: 0;
  font-size: 23px;
  font-weight: 800;
  color: var(--ink);
}
.paymodal__upsell p {
  margin: 0;
  font-size: 14px;
  line-height: 1.55;
  color: var(--muted);
}
.upsell__price {
  font-size: 28px;
  font-weight: 800;
  color: var(--accent);
}
.upsell__skip {
  background: none;
  border: none;
  padding: 8px 0;
  font-family: var(--font);
  font-size: 13px;
  color: var(--muted);
  text-decoration: underline;
  cursor: pointer;
}
.upsell__skip:hover { color: var(--ink); }

/* ---------- Font picker (Text panel) ---------- */
.fontlist { display: flex; flex-direction: column; gap: 8px; }
.font-btn {
  font-size: 17px;
  text-align: left;
  cursor: pointer;
  border: 1px solid var(--line);
  background: var(--elev);
  color: var(--ink);
  border-radius: 10px;
  padding: 11px 13px;
  transition: border-color .12s ease;
}
.font-btn:hover { border-color: var(--muted); }
.font-btn.is-active { border-color: var(--accent); }

/* ---------- Range slider (marker size) ---------- */
.range {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 6px;
  border-radius: 999px;
  background: var(--elev);
  border: 1px solid var(--line);
  outline: none;
  cursor: pointer;
}
.range::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--accent); border: none; cursor: pointer;
}
.range::-moz-range-thumb {
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--accent); border: none; cursor: pointer;
}

/* ---------- Layout picker (preview thumbnails) ---------- */
.layout-cards { display: flex; gap: 14px; }
.layout-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 9px;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font-family: var(--font);
}
.layout-card__name { font-size: 12px; color: var(--muted); transition: color .12s ease; }
.layout-card.is-active .layout-card__name { color: var(--ink); font-weight: 600; }

.lt {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4;
  border-radius: 7px;
  border: 2px solid var(--line);
  background: var(--panel);
  overflow: hidden;
  transition: border-color .12s ease;
}
.layout-card:hover .lt { border-color: var(--muted); }
.layout-card.is-active .lt { border-color: var(--accent); }

/* map area inside the thumbnail (faux streets) */
.lt__map {
  position: absolute;
  background:
    repeating-linear-gradient(58deg, rgba(255,255,255,.12) 0 1px, transparent 1px 8px),
    repeating-linear-gradient(-34deg, rgba(255,255,255,.09) 0 1px, transparent 1px 10px),
    linear-gradient(135deg, #2c4d73, #1c3350);
}
.lt__cap {
  position: absolute;
  left: 0; right: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}
.lt__cap i { height: 3px; border-radius: 2px; background: var(--muted); }
.lt__cap i:first-child { width: 58%; background: var(--ink); }
.lt__cap i:last-child  { width: 34%; }

/* Full: map covers everything, caption overlaid near the bottom */
.lt--full .lt__map { inset: 0; }
.lt--full .lt__cap { bottom: 13%; }

/* Framed: map inset with a paper border, caption sits below the map */
.lt--framed .lt__map { top: 8%; left: 8%; right: 8%; bottom: 32%; border-radius: 2px; }
.lt--framed .lt__cap { bottom: 10%; }

/* ---------- Sticky mobile buy bar ---------- */
.mobilebar { display: none; }
@media (max-width: 820px) {
  .mobilebar {
    display: flex;
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 44;
    height: calc(var(--buybar-h) + env(safe-area-inset-bottom, 0px));
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 0 16px env(safe-area-inset-bottom, 0px);
    background: var(--panel);
    border-top: 1px solid var(--line);
    box-shadow: 0 -6px 22px rgba(0, 0, 0, 0.35);
  }
  .mobilebar__price { font-size: 21px; font-weight: 800; color: var(--accent); }
  .mobilebar .btn--primary { flex: 1; max-width: 62%; padding: 13px; }
}

/* ---------- Bottom-sheet handle + backdrop ---------- */
.buypanel__handle { display: none; }
.sheet-backdrop { display: none; }
@media (max-width: 820px) {
  .buypanel__handle {
    width: 44px; height: 5px;
    border: none; border-radius: 999px;
    background: var(--line);
    margin: 0 auto 16px;
    cursor: pointer;
  }
  .sheet-backdrop {
    display: block;
    position: fixed; inset: 0;
    z-index: 40; /* below the rail/buy bar (44) so they stay tappable, above the map */
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
    opacity: 0; pointer-events: none;
    transition: opacity .25s ease;
  }
  .sheet-backdrop.is-open { opacity: 1; pointer-events: auto; }
}

/* ---------- Brush on the active theme card -> jump to colour editor ---------- */
.theme-card__brush {
  position: absolute;
  top: 8px; right: 8px;
  display: none;
  align-items: center;
  justify-content: center;
  width: 30px; height: 30px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  cursor: pointer;
  transition: background .12s ease, color .12s ease;
}
.theme-card.is-active .theme-card__brush { display: flex; }
.theme-card__brush:hover { background: var(--accent); color: var(--accent-ink); }
.theme-card__brush svg { width: 16px; height: 16px; }

/* ---------- Light / Dark theme toggle ---------- */
.themetoggle {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font);
  padding: 4px;
}
.themetoggle__txt {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .04em;
  color: var(--muted);
  transition: color .15s ease;
}
/* highlight the active side */
html[data-theme="light"] .themetoggle__txt--light { color: var(--ink); }
html[data-theme="dark"]  .themetoggle__txt--dark  { color: var(--ink); }

.themetoggle__track {
  position: relative;
  width: 40px;
  height: 22px;
  border-radius: 999px;
  background: var(--elev);
  border: 1px solid var(--line);
  transition: background .15s ease;
}
.themetoggle__thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  transition: transform .2s cubic-bezier(.4, 0, .2, 1);
}
/* dark = thumb right; light = thumb left */
html[data-theme="light"] .themetoggle__thumb { transform: translateX(0); }
html[data-theme="dark"]  .themetoggle__thumb { transform: translateX(18px); }
