:root {
  color-scheme: light dark;
  --pink: #FF1493;
  --pink-dark: #e01182;
  --dark: #111;
  --gray: #6b6b6b;          /* muted text */
  --light: #f5f5f5;         /* surfaces: cards, chips, inputs */
  --border: #e6e6e6;
  --bg: #fff;               /* page background */
  --text: #111;             /* primary text */
  --surface-2: #fff;        /* elevated surfaces (e.g. gallery buttons) */
  --footer-bg: rgba(255,255,255,.96);
  --pill-bg: #fff0f7;
  --skel-a: #ececec;        /* skeleton shimmer */
  --skel-b: #f6f6f6;
  --radius: 16px;
  --footer-h: 88px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --gray: #a8a8a8;        /* lighter muted text — keeps AA contrast on dark */
    --light: #1e1e1e;
    --border: #353535;
    --bg: #121212;
    --text: #f0f0f0;
    --surface-2: #262626;
    --footer-bg: rgba(18,18,18,.96);
    --pill-bg: rgba(255,20,147,.18);
    --skel-a: #262626;
    --skel-b: #333;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

img { display: block; max-width: 100%; }
a { color: var(--pink); }

.wrap {
  max-width: 560px;
  margin: 0 auto;
  padding: 20px 16px calc(var(--footer-h) + 24px);
}

.brand {
  text-align: center;
  font-weight: 800;
  font-size: 20px;
  letter-spacing: -0.3px;
  padding: 14px 0 4px;
}
.brand span { color: var(--pink); }

h1 {
  font-size: 30px;
  line-height: 1.15;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin: 14px 0 10px;
  text-align: center;
}
h2 { font-size: 19px; font-weight: 700; margin: 22px 0 10px; }
.sub {
  text-align: center;
  color: var(--gray);
  font-size: 16px;
  line-height: 1.45;
  margin: 0 auto 18px;
  max-width: 440px;
}

/* ---- Buttons ---- */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 17px;
  border: none;
  border-radius: var(--radius);
  font-size: 18px;
  font-weight: 800;
  cursor: pointer;
  text-decoration: none;
  transition: transform .1s ease, opacity .1s ease;
}
.btn:active:not(:disabled) { transform: scale(.98); opacity: .9; }
.btn-pink { background: var(--pink); color: #fff; }
.btn-dark { background: var(--dark); color: #fff; }
.btn-ghost { background: var(--light); color: var(--text); }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ---- Sticky footer CTA ---- */
.sticky-footer {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  background: var(--footer-bg);
  backdrop-filter: saturate(180%) blur(12px);
  border-top: 1px solid var(--border);
  padding: 14px 16px calc(14px + env(safe-area-inset-bottom));
  z-index: 50;
}
.sticky-footer .inner { max-width: 560px; margin: 0 auto; }
.footer-note { text-align: center; font-size: 13px; color: var(--gray); margin: 8px 0 0; }

/* ---- Before / after ---- */
.ba {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  border-radius: var(--radius);
  overflow: hidden;
}
.ba figure { margin: 0; position: relative; aspect-ratio: 3/4; background: var(--light); }
.ba.hero figure { aspect-ratio: 3/5; }
.ba figure img { width: 100%; height: 100%; object-fit: cover; }
.ba figcaption {
  position: absolute; top: 8px; left: 8px;
  background: rgba(0,0,0,.6); color: #fff;
  font-size: 12px; font-weight: 700;
  padding: 4px 10px; border-radius: 20px;
}

/* ---- Showcase / grid ---- */
.grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.card {
  border-radius: 14px;
  overflow: hidden;
  background: var(--light);
  position: relative;
}
.card .thumb { aspect-ratio: 1/1; }
.card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.card .label {
  font-size: 13px;
  font-weight: 700;
  padding: 8px 10px;
  text-align: center;
}
.card.locked::after {
  content: "🔒";
  position: absolute;
  top: 8px; right: 8px;
  background: rgba(0,0,0,.55);
  border-radius: 50%;
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
}
.card.free { border: 2px solid var(--pink); }
.card.free::after {
  content: "Free";
  position: absolute;
  top: 8px; right: 8px;
  background: var(--pink);
  color: #fff;
  border-radius: 20px;
  padding: 3px 11px;
  font-size: 12px;
  font-weight: 700;
}

/* masonry-ish waterfall for the showcase */
.waterfall { column-count: 2; column-gap: 10px; }
.waterfall .card { display: inline-block; width: 100%; margin: 0 0 10px; break-inside: avoid; }

/* ---- Color swatches ---- */
.swatches { display: flex; align-items: flex-start; overflow-x: auto; gap: 10px; padding: 4px 0 10px; scroll-snap-type: x mandatory; }
.swatches::-webkit-scrollbar { display: none; }
.swatch {
  flex: 0 0 auto; text-align: center; cursor: pointer; width: 84px; scroll-snap-align: center;
  background: none; border: none; padding: 0; font: inherit; color: inherit; display: block;
}
.swatch .name { display: block; }
.swatch .chip {
  width: 84px; height: 84px;
  border-radius: 14px;
  border: 3px solid transparent;
  overflow: hidden;
  background: var(--light);
  display: flex; align-items: center; justify-content: center;
}
.swatch .chip img { width: 100%; height: 100%; object-fit: cover; }
.swatch.selected .chip { border-color: var(--pink); }
.swatch .name { font-size: 11px; font-weight: 600; margin-top: 4px; line-height: 1.2; min-height: 2.4em; }
.swatch .none-chip { font-size: 26px; color: #bbb; }

/* ---- Upload ---- */
.uploader {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  background: var(--light);
  aspect-ratio: 4/5;
  width: 100%;
  max-width: 260px;
  margin: 0 auto;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  cursor: pointer;
  overflow: hidden;
  position: relative;
}
.uploader img { width: 100%; height: 100%; object-fit: contain; }
.uploader .ph { color: var(--gray); text-align: center; padding: 24px; }
.uploader .ph .ic { font-size: 44px; }

/* ---- Spinner / skeleton ---- */
.skeleton {
  background: linear-gradient(90deg, var(--skel-a) 25%, var(--skel-b) 50%, var(--skel-a) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.6s infinite linear;
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.spinner {
  width: 34px; height: 34px;
  border: 4px solid var(--border); border-top-color: var(--pink);
  border-radius: 50%; animation: spin 1s linear infinite;
  margin: 0 auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Visible keyboard focus for custom controls */
.uploader:focus-visible,
.swatch:focus-visible,
.btn:focus-visible,
.lb-nav:focus-visible,
.lb-close:focus-visible {
  outline: 3px solid var(--pink);
  outline-offset: 2px;
}

.center { text-align: center; }
.muted { color: var(--gray); }
.pill {
  display: inline-block; background: var(--pill-bg); color: var(--pink);
  font-weight: 700; font-size: 13px; padding: 6px 14px; border-radius: 20px;
}

/* ---- Trust row ---- */
.trust { display: flex; justify-content: center; gap: 18px; flex-wrap: wrap; margin: 16px 0; color: var(--gray); font-size: 13px; font-weight: 600; }
.trust span::before { content: "✓ "; color: var(--pink); }

/* ---- Result action buttons on gallery ---- */
.actions { display: flex; gap: 6px; padding: 8px; }
.actions button {
  flex: 1; border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
  border-radius: 10px; padding: 9px 0; font-size: 13px; font-weight: 700;
  cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 5px;
}
.actions button:active { background: var(--light); }

.price-strike { color: var(--gray); text-decoration: line-through; font-weight: 600; margin-right: 8px; }

/* ---- Legal / content pages ---- */
.legal { max-width: 720px; }
.legal h1 { text-align: left; font-size: 26px; }
.legal h2 { font-size: 18px; margin-top: 26px; }
.legal p, .legal li { font-size: 15px; line-height: 1.6; color: var(--text); }
.legal .updated { color: var(--gray); font-size: 13px; margin: 4px 0 22px; }
.legal a { word-break: break-word; }
.legal-links { text-align: center; margin: 30px 0 6px; font-size: 13px; }
.legal-links a { color: var(--gray); margin: 0 8px; text-decoration: none; }
.legal-links a:hover { color: var(--pink); }
.legal-links .biz { margin-top: 6px; color: var(--gray); }
.legal-links .biz a { margin: 0; }

/* ---- Lightbox ---- */
.zoomable { cursor: zoom-in; }
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0,0,0,.92);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: lbfade .15s ease;
}
.lightbox.open { display: flex; }
.lb-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 94vw;
}
.lightbox img {
  max-width: 94vw;
  max-height: 82vh;
  width: auto;
  object-fit: contain;
  border-radius: 10px;
  cursor: grab;
  touch-action: pan-y;
}
.lb-caption { color: #fff; font-size: 14px; font-weight: 600; margin-top: 12px; opacity: .9; }
.lightbox .lb-close {
  position: absolute;
  top: calc(12px + env(safe-area-inset-top));
  right: 18px;
  color: #fff;
  font-size: 30px;
  line-height: 1;
  font-weight: 300;
  cursor: pointer;
  background: none;
  border: none;
  padding: 6px;
  z-index: 2;
}
.lb-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0,0,0,.4);
  color: #fff;
  border: none;
  font-size: 32px;
  line-height: 1;
  width: 46px;
  height: 62px;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lb-prev { left: 10px; }
.lb-next { right: 10px; }
.lb-dots {
  position: absolute;
  bottom: calc(20px + env(safe-area-inset-bottom));
  left: 0; right: 0;
  display: flex; gap: 8px; justify-content: center;
}
.lb-dots span { width: 8px; height: 8px; border-radius: 50%; background: rgba(255,255,255,.4); }
.lb-dots span.on { background: #fff; }
@keyframes lbfade { from { opacity: 0; } to { opacity: 1; } }
