/* ==========================================================================
   WishCraft — design system
   Themes inject --bg-1/2/3, --ink, --accent, --accent-2, --card-bg and
   --display-font at runtime; everything below is written against those tokens
   so a single theme switch repaints the whole page.
   ========================================================================== */

:root {
  --bg-1: #2d0b45;
  --bg-2: #5b1e73;
  --bg-3: #c2417a;
  --ink: #fff6fb;
  --accent: #ffd166;
  --accent-2: #ff7eb6;
  --card-bg: rgba(38, 6, 52, .58);
  --display-font: 'Fraunces', Georgia, serif;

  --ui-font: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --hand-font: 'Caveat', 'Segoe Script', cursive;

  --radius-sm: 10px;
  --radius: 18px;
  --radius-lg: 28px;

  --shadow-soft: 0 18px 50px rgba(0, 0, 0, .34);
  --shadow-lift: 0 28px 70px rgba(0, 0, 0, .46);

  --line: rgba(255, 255, 255, .14);
  --line-strong: rgba(255, 255, 255, .28);
  --muted: rgba(255, 255, 255, .68);
  --muted-soft: rgba(255, 255, 255, .48);

  --ease: cubic-bezier(.22, 1, .36, 1);
  --maxw: 1180px;
}

*, *::before, *::after { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--ui-font);
  color: var(--ink);
  background: var(--bg-1);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* --- Living background ---------------------------------------------------
   Three soft radial blooms drifting over a base gradient. Cheap, GPU-friendly,
   and it makes every theme feel lit from within rather than flat. */
.aurora {
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(60% 55% at 18% 12%, color-mix(in srgb, var(--bg-3) 78%, transparent) 0%, transparent 62%),
    radial-gradient(55% 50% at 84% 22%, color-mix(in srgb, var(--accent-2) 42%, transparent) 0%, transparent 60%),
    radial-gradient(70% 60% at 50% 100%, color-mix(in srgb, var(--bg-2) 88%, transparent) 0%, transparent 70%),
    linear-gradient(170deg, var(--bg-1) 0%, var(--bg-2) 58%, var(--bg-1) 100%);
  transition: background 900ms var(--ease);
}

.aurora::after {
  content: '';
  position: absolute;
  inset: -20%;
  background:
    radial-gradient(28% 28% at 30% 30%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 70%),
    radial-gradient(26% 26% at 72% 66%, color-mix(in srgb, var(--accent-2) 26%, transparent), transparent 70%);
  filter: blur(40px);
  animation: drift 24s ease-in-out infinite alternate;
}

@keyframes drift {
  0%   { transform: translate3d(-3%, -2%, 0) scale(1); }
  100% { transform: translate3d(4%, 3%, 0) scale(1.12); }
}

/* Subtle film grain keeps large gradients from banding on cheap panels. */
.grain {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: .16;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='.5'/%3E%3C/svg%3E");
}

#fx-layer, #burst-layer {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
#fx-layer  { z-index: 0; }
#burst-layer { z-index: 40; }

/* --- Typography ---------------------------------------------------------- */
h1, h2, h3 { font-family: var(--display-font); font-weight: 600; line-height: 1.1; margin: 0; }
h1 { font-size: clamp(2.4rem, 6.4vw, 4.6rem); letter-spacing: -.02em; }
h2 { font-size: clamp(1.7rem, 3.6vw, 2.6rem); letter-spacing: -.01em; }
h3 { font-size: 1.12rem; font-family: var(--ui-font); font-weight: 700; letter-spacing: -.01em; }
p  { line-height: 1.65; margin: 0; }

.lede { font-size: clamp(1rem, 1.6vw, 1.16rem); color: var(--muted); max-width: 58ch; }
.eyebrow {
  text-transform: uppercase;
  letter-spacing: .18em;
  font-size: .72rem;
  font-weight: 700;
  color: var(--accent);
  opacity: .95;
}
.shine {
  background: linear-gradient(96deg, var(--accent) 0%, var(--ink) 40%, var(--accent-2) 78%, var(--accent) 100%);
  background-size: 220% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: shine 9s linear infinite;
}
@keyframes shine { to { background-position: 220% 0; } }

/* --- Layout -------------------------------------------------------------- */
.wrap { width: min(100% - 2.4rem, var(--maxw)); margin-inline: auto; }
.stack > * + * { margin-top: 1rem; }

.site-header {
  position: relative;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.35rem 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: .6rem;
  font-family: var(--display-font);
  font-size: 1.28rem;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: -.01em;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 34px; height: 34px;
  border-radius: 11px;
  background: linear-gradient(140deg, var(--accent), var(--accent-2));
  color: #2a0b2a;
  font-size: 1rem;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .3);
}

.nav-links { display: flex; align-items: center; gap: .4rem; }
.nav-links a {
  color: var(--muted);
  text-decoration: none;
  font-size: .9rem;
  font-weight: 600;
  padding: .5rem .8rem;
  border-radius: 999px;
  transition: color .2s, background .2s;
}
.nav-links a:hover { color: var(--ink); background: rgba(255, 255, 255, .09); }

/* --- Buttons ------------------------------------------------------------- */
.btn {
  --btn-bg: rgba(255, 255, 255, .1);
  --btn-fg: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .55rem;
  padding: .82rem 1.5rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-family: var(--ui-font);
  font-size: .95rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  transition: transform .22s var(--ease), box-shadow .22s var(--ease),
              background .22s, border-color .22s, opacity .2s;
}
.btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-soft); background: rgba(255, 255, 255, .16); }
.btn:active { transform: translateY(0); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; transform: none; }

.btn-primary {
  --btn-fg: #241030;
  border-color: transparent;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  box-shadow: 0 12px 34px color-mix(in srgb, var(--accent-2) 34%, transparent);
}
.btn-primary:hover {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  filter: brightness(1.06);
  box-shadow: 0 20px 46px color-mix(in srgb, var(--accent-2) 44%, transparent);
}
.btn-lg { padding: 1.02rem 2rem; font-size: 1.02rem; }
.btn-sm { padding: .55rem 1rem; font-size: .84rem; }
.btn-block { width: 100%; }

/* --- Glass surfaces ------------------------------------------------------ */
.glass {
  background: rgba(255, 255, 255, .07);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(20px) saturate(130%);
  -webkit-backdrop-filter: blur(20px) saturate(130%);
  box-shadow: var(--shadow-soft);
}

/* --- Landing hero -------------------------------------------------------- */
.hero {
  position: relative;
  z-index: 10;
  display: grid;
  grid-template-columns: 1.06fr .94fr;
  gap: clamp(2rem, 5vw, 4.5rem);
  align-items: center;
  padding: clamp(2.5rem, 7vw, 5.5rem) 0 clamp(2.5rem, 6vw, 4rem);
}
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; text-align: center; padding-top: 1.5rem; }
  .hero .lede { margin-inline: auto; }
  .hero-actions { justify-content: center; }
  .trust { justify-content: center; }
}

.hero-actions { display: flex; flex-wrap: wrap; gap: .8rem; margin-top: 1.9rem; }

.trust {
  display: flex;
  flex-wrap: wrap;
  gap: 1.2rem;
  margin-top: 2.1rem;
  font-size: .85rem;
  color: var(--muted-soft);
}
.trust span { display: inline-flex; align-items: center; gap: .42rem; }

/* Tilting preview card in the hero */
.hero-visual { display: grid; place-items: center; perspective: 1400px; }
.card-3d {
  width: min(100%, 400px);
  padding: 2.6rem 2rem;
  border-radius: var(--radius-lg);
  text-align: center;
  background: var(--card-bg);
  border: 1px solid var(--line-strong);
  backdrop-filter: blur(22px) saturate(140%);
  -webkit-backdrop-filter: blur(22px) saturate(140%);
  box-shadow: var(--shadow-lift);
  transform: rotateY(-11deg) rotateX(6deg);
  animation: float-card 7s ease-in-out infinite alternate;
}
@keyframes float-card {
  from { transform: rotateY(-11deg) rotateX(6deg) translateY(-8px); }
  to   { transform: rotateY(6deg) rotateX(-3deg) translateY(10px); }
}
.card-3d .glyph { font-size: 3.2rem; display: block; margin-bottom: .7rem; }
.card-3d .to { font-family: var(--hand-font); font-size: 1.5rem; color: var(--accent); }
.card-3d .title { font-family: var(--display-font); font-size: 2rem; margin: .35rem 0 .8rem; }
.card-3d .msg { font-size: .94rem; color: var(--muted); line-height: 1.6; }
.card-3d .sign { font-family: var(--hand-font); font-size: 1.35rem; margin-top: 1.2rem; color: var(--accent-2); }

/* --- Sections ------------------------------------------------------------ */
.section { position: relative; z-index: 10; padding: clamp(3rem, 7vw, 5rem) 0; }
.section-head { text-align: center; max-width: 62ch; margin: 0 auto clamp(2rem, 4vw, 3rem); }
.section-head .lede { margin-inline: auto; margin-top: .9rem; }

.occasion-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: .9rem;
}
.occasion-card {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: .3rem;
  padding: 1.35rem 1.15rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .06);
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
  text-align: left;
  font-family: var(--ui-font);
  transition: transform .26s var(--ease), border-color .26s, background .26s, box-shadow .26s;
}
.occasion-card::before {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0;
  background: linear-gradient(150deg,
    color-mix(in srgb, var(--oc-1) 55%, transparent),
    color-mix(in srgb, var(--oc-2) 45%, transparent));
  transition: opacity .3s;
}
.occasion-card > * { position: relative; z-index: 1; }
.occasion-card:hover {
  transform: translateY(-5px);
  border-color: var(--line-strong);
  box-shadow: var(--shadow-soft);
}
.occasion-card:hover::before { opacity: .85; }
.occasion-card .oc-emoji { font-size: 1.9rem; line-height: 1; }
.occasion-card .oc-name { font-weight: 700; font-size: 1rem; margin-top: .45rem; }
.occasion-card .oc-sub { font-size: .8rem; color: var(--muted-soft); }
.occasion-card:hover .oc-sub { color: rgba(255, 255, 255, .8); }

/* --- Steps --------------------------------------------------------------- */
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1.1rem; }
.step { padding: 1.7rem 1.5rem; border-radius: var(--radius); }
.step-num {
  display: grid;
  place-items: center;
  width: 40px; height: 40px;
  border-radius: 13px;
  font-family: var(--display-font);
  font-size: 1.16rem;
  font-weight: 600;
  color: #24102e;
  background: linear-gradient(140deg, var(--accent), var(--accent-2));
  margin-bottom: 1rem;
}
.step p { color: var(--muted); font-size: .93rem; margin-top: .45rem; }

/* --- Feature strip ------------------------------------------------------- */
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; }
.feature { padding: 1.5rem 1.4rem; border-radius: var(--radius); }
.feature .ficon { font-size: 1.7rem; }
.feature h3 { margin-top: .7rem; }
.feature p { color: var(--muted); font-size: .9rem; margin-top: .4rem; }

/* --- CTA band ------------------------------------------------------------ */
.cta-band {
  text-align: center;
  padding: clamp(2.5rem, 6vw, 4rem) 1.5rem;
  border-radius: var(--radius-lg);
}
.cta-band .lede { margin: .9rem auto 1.8rem; }

/* --- Footer -------------------------------------------------------------- */
.site-footer {
  position: relative;
  z-index: 10;
  padding: 2.5rem 0 3rem;
  margin-top: 2rem;
  border-top: 1px solid var(--line);
  color: var(--muted-soft);
  font-size: .86rem;
  display: flex;
  flex-wrap: wrap;
  gap: .8rem;
  justify-content: space-between;
  align-items: center;
}
.site-footer a { color: var(--muted); text-decoration: none; }
.site-footer a:hover { color: var(--ink); }

/* ==========================================================================
   Builder
   ========================================================================== */
.studio {
  position: relative;
  z-index: 10;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, .92fr);
  gap: clamp(1.4rem, 3vw, 2.4rem);
  align-items: start;
  padding-bottom: 4rem;
}
@media (max-width: 940px) { .studio { grid-template-columns: 1fr; } }

.panel { padding: clamp(1.3rem, 2.6vw, 2rem); border-radius: var(--radius-lg); }
.panel + .panel { margin-top: 1.1rem; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 1.1rem; }
.panel-head h3 { font-size: 1.05rem; }
.panel-head .hint { font-size: .78rem; color: var(--muted-soft); }

.field { margin-bottom: 1.15rem; }
.field:last-child { margin-bottom: 0; }
.field label {
  display: block;
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: .5rem;
}
.field .sub { font-size: .78rem; color: var(--muted-soft); font-weight: 500; text-transform: none; letter-spacing: 0; }

input[type="text"], textarea, select {
  width: 100%;
  padding: .85rem 1rem;
  font-family: var(--ui-font);
  font-size: .96rem;
  color: var(--ink);
  background: rgba(255, 255, 255, .07);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  transition: border-color .2s, background .2s, box-shadow .2s;
}
input[type="text"]::placeholder, textarea::placeholder { color: rgba(255, 255, 255, .38); }
input[type="text"]:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  background: rgba(255, 255, 255, .11);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}
textarea { resize: vertical; min-height: 128px; line-height: 1.6; }
select option { background: #241033; color: #fff; }

.counter { text-align: right; font-size: .75rem; color: var(--muted-soft); margin-top: .35rem; }
.counter.over { color: #ff8a8a; }

/* Theme picker chips */
.theme-chips { display: flex; flex-wrap: wrap; gap: .5rem; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .5rem .85rem;
  font-family: var(--ui-font);
  font-size: .85rem;
  font-weight: 600;
  color: var(--muted);
  background: rgba(255, 255, 255, .06);
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  transition: all .2s var(--ease);
}
.chip:hover { color: var(--ink); background: rgba(255, 255, 255, .13); transform: translateY(-1px); }
.chip[aria-pressed="true"] {
  color: #241030;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent;
  box-shadow: 0 8px 22px color-mix(in srgb, var(--accent-2) 34%, transparent);
}

/* Message starter suggestions */
.starters { display: grid; gap: .55rem; }
.starter {
  text-align: left;
  padding: .8rem .95rem;
  font-family: var(--ui-font);
  font-size: .86rem;
  line-height: 1.5;
  color: var(--muted);
  background: rgba(255, 255, 255, .05);
  border: 1px dashed var(--line);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all .2s;
}
.starter:hover { color: var(--ink); background: rgba(255, 255, 255, .1); border-color: var(--accent); border-style: solid; }

/* Photo drop zone */
.photo-zone {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, .04);
}
.photo-zone.has-photo { border-style: solid; }
.photo-grid {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
}
.photo-grid:empty { display: none; }
.photo-cell {
  position: relative;
  width: 62px; height: 62px;
  border-radius: 12px;
  overflow: hidden;
  border: 2px solid var(--accent);
  box-shadow: 0 6px 16px rgba(0, 0, 0, .28);
}
.photo-cell img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-remove {
  position: absolute;
  top: -6px; right: -6px;
  width: 20px; height: 20px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, .75);
  color: #fff;
  font-size: .95rem;
  line-height: 20px;
  font-weight: 700;
  cursor: pointer;
  padding: 0;
}
.photo-zone .pz-text { flex: 1 1 200px; font-size: .84rem; color: var(--muted-soft); line-height: 1.5; }
.photo-zone .pz-actions { display: flex; gap: .4rem; flex-wrap: wrap; }
input[type="file"] { display: none; }

/* Slideshow controls */
.slideshow-controls { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.slideshow-controls input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

/* Audio (upload + voice) */
.audio-zone {
  padding: 1rem;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, .04);
  display: grid;
  gap: .7rem;
}
.audio-zone .az-info { font-size: .82rem; color: var(--muted-soft); line-height: 1.5; }
.audio-zone .az-info.recording { color: #ff8a8a; font-weight: 600; }
.audio-zone .audio-preview { width: 100%; }
.audio-zone .pz-actions { display: flex; gap: .4rem; flex-wrap: wrap; }

/* Segmented buttons (slideshow style + font picker) */
.segment {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, .05);
  gap: 2px;
  flex-wrap: wrap;
}
.seg-btn {
  padding: .48rem .9rem;
  font-family: var(--ui-font);
  font-size: .82rem;
  font-weight: 600;
  color: var(--muted);
  background: transparent;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  transition: color .2s, background .2s;
}
.seg-btn:hover { color: var(--ink); }
.seg-btn[aria-pressed="true"] {
  color: #241030;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}

/* Colour + date inputs sit in a compact row */
.color-row { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.color-row input[type="color"] {
  width: 46px; height: 42px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, .06);
  cursor: pointer;
}
.color-row input[type="datetime-local"] {
  padding: .7rem .9rem;
  font-family: var(--ui-font);
  font-size: .9rem;
  color: var(--ink);
  background: rgba(255, 255, 255, .07);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color-scheme: dark;
}

.hint-inline { color: var(--muted-soft); font-weight: 500; font-size: .82em; margin-left: .35rem; }

/* Toggle switch */
.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .85rem 0;
  border-top: 1px solid var(--line);
}
.switch-row:first-of-type { border-top: none; }
.switch-row .sr-label { font-size: .92rem; font-weight: 600; }
.switch-row .sr-sub { font-size: .78rem; color: var(--muted-soft); margin-top: .15rem; }
.switch {
  position: relative;
  flex: 0 0 46px;
  width: 46px; height: 26px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .1);
  cursor: pointer;
  transition: background .24s, border-color .24s;
}
.switch::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--ink);
  transition: transform .24s var(--ease);
}
.switch[aria-checked="true"] { background: linear-gradient(135deg, var(--accent), var(--accent-2)); border-color: transparent; }
.switch[aria-checked="true"]::after { transform: translateX(20px); background: #2a0f36; }

/* Live preview column */
.preview-col { position: sticky; top: 1.2rem; }
@media (max-width: 940px) { .preview-col { position: static; } }

.preview-frame {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-lift);
  min-height: 460px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  justify-items: center;
  align-content: center;
  padding: clamp(1.6rem, 3vw, 2.4rem);
  background:
    radial-gradient(70% 60% at 20% 10%, color-mix(in srgb, var(--bg-3) 70%, transparent), transparent 60%),
    radial-gradient(60% 55% at 85% 80%, color-mix(in srgb, var(--accent-2) 34%, transparent), transparent 62%),
    linear-gradient(165deg, var(--bg-1), var(--bg-2));
  transition: background 700ms var(--ease);
}
.preview-label {
  position: absolute;
  top: .85rem; left: 1rem;
  z-index: 3;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .5);
}
#preview-fx { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 1; }

/* ==========================================================================
   The card (shared by preview and the opened wish)
   ========================================================================== */
.wish-card {
  position: relative;
  z-index: 2;
  width: min(100%, 460px);
  max-width: 100%;
  padding: clamp(1.8rem, 4vw, 2.8rem) clamp(1.4rem, 3.4vw, 2.4rem);
  text-align: center;
  border-radius: var(--radius-lg);
  background: var(--card-bg);
  border: 1px solid var(--line-strong);
  backdrop-filter: blur(24px) saturate(140%);
  -webkit-backdrop-filter: blur(24px) saturate(140%);
  box-shadow: var(--shadow-lift);
}
.wish-card::before {
  content: '';
  position: absolute;
  inset: 10px;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: calc(var(--radius-lg) - 8px);
  pointer-events: none;
}

.wc-glyph { font-size: clamp(2.6rem, 7vw, 3.6rem); line-height: 1; display: block; }
.wc-to {
  font-family: var(--hand-font);
  font-size: clamp(1.4rem, 3.4vw, 1.9rem);
  color: var(--accent);
  margin-top: .7rem;
}
.wc-title {
  font-family: var(--display-font);
  font-size: clamp(1.8rem, 5.2vw, 2.9rem);
  line-height: 1.08;
  letter-spacing: -.02em;
  margin: .3rem 0 1.05rem;
}
.wc-rule {
  width: 68px; height: 2px;
  margin: 0 auto 1.15rem;
  border-radius: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
}
.wc-msg {
  font-size: clamp(.95rem, 2.1vw, 1.04rem);
  line-height: 1.75;
  color: rgba(255, 255, 255, .9);
  white-space: pre-wrap;
  word-break: break-word;
}
.wc-sign {
  font-family: var(--hand-font);
  font-size: clamp(1.35rem, 3.2vw, 1.75rem);
  color: var(--accent-2);
  margin-top: 1.4rem;
}
.wc-photo {
  width: 96px; height: 96px;
  border-radius: 50%;
  object-fit: cover;
  margin: 0 auto 1rem;
  display: block;
  border: 3px solid var(--accent);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .4);
}
.wc-motifs { margin-top: 1.15rem; font-size: 1.05rem; letter-spacing: .5rem; opacity: .75; }

/* Slideshow inside the card */
.wc-slideshow-frame {
  position: relative;
  width: min(100%, 320px);
  aspect-ratio: 1 / 1;
  margin: 0 auto 1.1rem;
  border-radius: var(--radius);
  overflow: hidden;
  border: 3px solid var(--accent);
  box-shadow: 0 12px 32px rgba(0, 0, 0, .4);
  background: rgba(0, 0, 0, .25);
}
.wc-slide {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity .9s ease-in-out, transform 6s linear;
}
.wc-slide.on { opacity: 1; }

.wc-slide-slide { transform: translateX(28%); transition: transform .8s var(--ease), opacity .8s ease-in-out; }
.wc-slide-slide.on { transform: translateX(0); }

.wc-slide-kenburns { transform: scale(1); transition: opacity .9s ease-in-out, transform 5.5s linear; }
.wc-slide-kenburns.on { transform: scale(1.12); }

/* Slideshow preview in the studio (compact strip) */
.wc-slideshow {
  display: flex;
  gap: .35rem;
  justify-content: center;
  margin-bottom: 1rem;
}
.wc-slideshow img {
  width: 48px; height: 48px;
  border-radius: 10px;
  object-fit: cover;
  border: 2px solid var(--accent);
}

.wc-voice {
  display: block;
  margin: .8rem auto 0;
  max-width: 320px;
  width: 100%;
}

/* Locked stage */
.locked-stage {
  text-align: center;
  display: grid;
  justify-items: center;
  gap: 1rem;
  max-width: 46ch;
}
.locked-stage .glyph { font-size: 3.2rem; }
.locked-stage p { color: var(--muted); }
.countdown {
  margin-top: .5rem;
  padding: .75rem 1.25rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent);
  background: rgba(0, 0, 0, .3);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  letter-spacing: .04em;
}

/* Typewriter caret while the message reveals */
.wc-msg.typing::after {
  content: '';
  display: inline-block;
  width: 2px; height: 1.05em;
  margin-left: 2px;
  vertical-align: -.16em;
  background: var(--accent);
  animation: caret .8s steps(2) infinite;
}
@keyframes caret { 50% { opacity: 0; } }

/* ==========================================================================
   Share / result
   ========================================================================== */
.link-box {
  display: flex;
  gap: .5rem;
  align-items: stretch;
  flex-wrap: wrap;
}
.link-box input {
  flex: 1 1 220px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .8rem;
  overflow-x: auto;
}
.share-row { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .85rem; }

.shorten-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem;
  margin-top: .85rem;
}
.shorten-note { font-size: .76rem; color: var(--muted-soft); flex: 1 1 100%; }
.shorten-note.ok { color: var(--accent); }

.meter { margin-top: .9rem; }
.meter-track { height: 5px; border-radius: 999px; background: rgba(255, 255, 255, .12); overflow: hidden; }
.meter-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width .4s var(--ease), background .3s;
}
.meter-fill.warn { background: linear-gradient(90deg, #ffb454, #ff7a45); }
.meter-fill.bad  { background: linear-gradient(90deg, #ff7a45, #ff4d4d); }
.meter-note { font-size: .76rem; color: var(--muted-soft); margin-top: .45rem; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 1.6rem;
  z-index: 200;
  transform: translate(-50%, 130%);
  padding: .8rem 1.3rem;
  border-radius: 999px;
  font-size: .88rem;
  font-weight: 600;
  color: #241030;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: var(--shadow-lift);
  transition: transform .4s var(--ease);
  pointer-events: none;
}
.toast.show { transform: translate(-50%, 0); }

/* ==========================================================================
   Wish viewer
   ========================================================================== */
.viewer {
  position: relative;
  z-index: 10;
  min-height: 100dvh;
  display: grid;
  /* minmax(0, 1fr) rather than an auto track: an auto track sizes to the
     message's max-content width and overflowed narrow phones. */
  grid-template-columns: minmax(0, 1fr);
  justify-items: center;
  align-content: center;
  padding: 2rem 1.2rem 3rem;
}

/* Stage 1 — the sealed envelope */
.seal-stage { text-align: center; display: grid; justify-items: center; gap: 1.4rem; max-width: 100%; }
.seal-stage.gone { display: none; }

.envelope {
  position: relative;
  width: min(84vw, 320px);
  aspect-ratio: 3 / 2;
  cursor: pointer;
  border: none;
  padding: 0;
  background: none;
  filter: drop-shadow(0 26px 50px rgba(0, 0, 0, .5));
  animation: breathe 3.4s ease-in-out infinite;
  transition: transform .5s var(--ease), opacity .5s;
}
@keyframes breathe {
  0%, 100% { transform: translateY(0) scale(1); }
  50%      { transform: translateY(-9px) scale(1.02); }
}
.envelope:hover { animation-play-state: paused; transform: translateY(-9px) scale(1.045); }
.envelope:focus-visible { outline: 2px solid var(--accent); outline-offset: 8px; border-radius: 12px; }
.envelope svg { width: 100%; height: 100%; overflow: visible; perspective: 800px; }
.env-flap {
  transform-box: fill-box;      /* hinge on the flap itself, not the whole viewBox */
  transform-origin: 50% 0%;
  transition: transform .8s var(--ease);
}
.envelope.opening { animation: none; }
.envelope.opening .env-flap { transform: rotateX(-170deg); }
.envelope.opening { transform: scale(1.1); opacity: 0; transition: transform .8s var(--ease), opacity .6s .35s; }

.seal-for { font-family: var(--hand-font); font-size: clamp(1.6rem, 5vw, 2.4rem); color: var(--accent); }
.seal-hint { font-size: .9rem; color: var(--muted); display: flex; align-items: center; gap: .5rem; }
.seal-hint .pulse-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .35; transform: scale(1.5); } }

/* Stage 2 — the revealed card */
.reveal-stage { display: none; width: 100%; max-width: 100%; justify-items: center; gap: 1.2rem; }
.reveal-stage.on { display: grid; animation: rise .9s var(--ease) both; }
@keyframes rise {
  from { opacity: 0; transform: translateY(46px) scale(.94); }
  to   { opacity: 1; transform: none; }
}

.viewer-actions { display: flex; flex-wrap: wrap; gap: .55rem; justify-content: center; max-width: 100%; }

.made-with {
  margin-top: .6rem;
  font-size: .8rem;
  color: var(--muted-soft);
  text-align: center;
}
.made-with a { color: var(--accent); text-decoration: none; font-weight: 600; }
.made-with a:hover { text-decoration: underline; }

.error-state { text-align: center; max-width: 46ch; }
.error-state .glyph { font-size: 3rem; }
.error-state h2 { margin: 1rem 0 .6rem; }
.error-state p { color: var(--muted); }

/* Floating music toggle */
.music-btn {
  position: fixed;
  right: 1.1rem; bottom: 1.1rem;
  z-index: 60;
  width: 46px; height: 46px;
  display: grid;
  place-items: center;
  font-size: 1.05rem;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, .35);
  color: var(--ink);
  cursor: pointer;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: transform .2s, background .2s;
}
.music-btn:hover { transform: scale(1.08); background: rgba(0, 0, 0, .5); }
.music-btn.off { opacity: .55; }

/* --- Utility ------------------------------------------------------------- */
/* An author `display` beats the UA stylesheet's [hidden] rule, so elements
   like .music-btn (display:grid) stayed on screen after being hidden. */
[hidden] { display: none !important; }

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
.center { text-align: center; }
.mt-lg { margin-top: 1.6rem; }

/* Entrance animation for scroll-revealed sections */
.reveal-on-scroll { opacity: 0; transform: translateY(26px); transition: opacity .7s var(--ease), transform .7s var(--ease); }
.reveal-on-scroll.in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  .reveal-on-scroll { opacity: 1; transform: none; }
}
