/* ==========================================================================
   LiebesBrief — „Mitternachtsbrief"
   Ein Brief, bei Kerzenlicht geöffnet: dunkler Samt, Kerzengold, Siegelwachs,
   cremefarbenes Papier. Mobile-first, self-hosted Fonts, CSP-kompatibel.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Schriften (self-hosted, variable, latin subset)
   -------------------------------------------------------------------------- */
@font-face {
  font-family: 'Cormorant Garamond';
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url('/fonts/cormorant-garamond.woff2') format('woff2');
}

@font-face {
  font-family: 'Cormorant Garamond';
  font-style: italic;
  font-weight: 300 700;
  font-display: swap;
  src: url('/fonts/cormorant-garamond-italic.woff2') format('woff2');
}

@font-face {
  font-family: 'EB Garamond';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url('/fonts/eb-garamond.woff2') format('woff2');
}

@font-face {
  font-family: 'EB Garamond';
  font-style: italic;
  font-weight: 400 800;
  font-display: swap;
  src: url('/fonts/eb-garamond-italic.woff2') format('woff2');
}

@font-face {
  font-family: 'Great Vibes';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/great-vibes.woff2') format('woff2');
}

/* --------------------------------------------------------------------------
   Design-Tokens
   -------------------------------------------------------------------------- */
:root {
  /* Nacht & Samt */
  --night-deep: #120b10;
  --night: #1c1118;
  --night-soft: #281823;
  --night-line: rgba(233, 200, 126, 0.14);

  /* Kerzengold */
  --gold: #d4a44c;
  --gold-bright: #e9c87e;
  --gold-deep: #a87b2f;
  --gold-faint: rgba(212, 164, 76, 0.35);

  /* Siegelwachs & Rosé */
  --wax: #7e1f38;
  --wax-deep: #5c1426;
  --rose: #c14b66;
  --rose-soft: #e08fa4;
  --rose-blush: #f0c1ce;

  /* Briefpapier */
  --paper: #f5ecdc;
  --paper-warm: #eee0c8;
  --paper-line: #ddcbab;
  --paper-shadow: rgba(10, 5, 8, 0.55);

  /* Text auf dunklem Grund */
  --text: #f2e7d5;
  --text-dim: #c0aa90;

  /* Legacy-Variablen (werden von JS-Inline-Styles referenziert).
     Auf Papier-Kontext abgestimmt; dunkle Kontexte überschreiben sie lokal. */
  --ink: #38271d;
  --muted: #7d6650;
  --accent: var(--gold);
  --heart-strong: #b53d59;
  --heart-soft: #d97e95;
  --heart-blush: #f0c1ce;
  --heart-pop: #c95876;

  /* Typografie */
  --font-display: 'Cormorant Garamond', 'Iowan Old Style', 'Palatino', Georgia, serif;
  --font-body: 'EB Garamond', 'Iowan Old Style', Georgia, serif;
  --font-script: 'Great Vibes', 'Snell Roundhand', cursive;

  --max-width: 720px;
  --shadow-card: 0 24px 60px rgba(8, 4, 7, 0.55);
  --shadow-paper: 0 30px 70px rgba(8, 4, 7, 0.65), 0 4px 18px rgba(8, 4, 7, 0.4);
  --ease-romantic: cubic-bezier(0.22, 1, 0.36, 1);
}

/* Dunkle Kontexte: hier zeigen die Legacy-Variablen helle Werte,
   damit JS-gesetzte Farben (var(--ink) etc.) lesbar bleiben. */
.admin-body,
.exchange-modal {
  --ink: #f0e4d2;
  --muted: #b39e88;
  --heart-strong: #e58aa0;
  --heart-soft: #e9c87e;
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background:
    radial-gradient(110% 80% at 50% -10%, rgba(212, 164, 76, 0.13), transparent 60%),
    radial-gradient(90% 70% at 85% 105%, rgba(126, 31, 56, 0.28), transparent 65%),
    radial-gradient(70% 60% at 8% 90%, rgba(193, 75, 102, 0.12), transparent 60%),
    linear-gradient(175deg, var(--night) 0%, var(--night-deep) 70%, #0d0709 100%);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.75;
  letter-spacing: 0.01em;
  padding: 24px 18px 56px;
  overflow-x: hidden;
}

/* Kerzenschein-Atmen */
body::before {
  content: "";
  position: fixed;
  inset: -20%;
  pointer-events: none;
  background: radial-gradient(42% 30% at 50% 18%, rgba(233, 200, 126, 0.09), transparent 70%);
  animation: candleBreath 7s ease-in-out infinite alternate;
  z-index: 0;
}

@keyframes candleBreath {
  from { opacity: 0.65; transform: scale(1); }
  to   { opacity: 1;    transform: scale(1.06); }
}

/* Feines Korn über allem */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
  opacity: 0.045;
  mix-blend-mode: overlay;
  z-index: 9999;
}

::selection {
  background: rgba(193, 75, 102, 0.45);
  color: #fff6ea;
}

a {
  color: var(--gold-bright);
}

.page {
  position: relative;
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 30px;
  z-index: 1;
}

/* --------------------------------------------------------------------------
   Hero
   -------------------------------------------------------------------------- */
.hero {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 18px 0 0;
  text-align: center;
}

.subtitle {
  margin: 0;
  order: -1;
  font-family: var(--font-script);
  font-size: clamp(1.5rem, 5.5vw, 1.9rem);
  font-weight: 400;
  color: var(--gold-bright);
  text-shadow: 0 0 24px rgba(233, 200, 126, 0.35);
  letter-spacing: 0.02em;
}

.title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(2.2rem, 9vw, 3.4rem);
  line-height: 1.12;
  color: var(--text);
  letter-spacing: 0.01em;
  text-wrap: balance;
}

/* Goldene Zierlinie mit Punkt */
.hero::after {
  content: "";
  width: min(240px, 60vw);
  height: 22px;
  margin-top: 14px;
  background:
    radial-gradient(circle at 50% 50%, var(--gold-bright) 0 2.5px, transparent 3px),
    linear-gradient(90deg, transparent, var(--gold-faint) 18%, var(--gold) 50%, var(--gold-faint) 82%, transparent) 50% 50% / 100% 1px no-repeat;
}

/* --------------------------------------------------------------------------
   Szene: Gate → Umschlag → Brief
   -------------------------------------------------------------------------- */
.scene {
  position: relative;
  display: grid;
  place-items: start center;
  gap: 22px;
  min-height: 62vh;
  isolation: isolate;
  z-index: 1;
  perspective: 1200px;
}

/* ---- Passwort-Gate ---- */
.gate-card {
  width: min(440px, 100%);
  background: linear-gradient(165deg, rgba(40, 24, 35, 0.92), rgba(28, 17, 24, 0.96));
  border: 1px solid var(--night-line);
  border-radius: 18px;
  box-shadow: var(--shadow-card);
  padding: 30px 26px 26px;
  text-align: center;
  backdrop-filter: blur(6px);
  transition: opacity 450ms ease, transform 450ms var(--ease-romantic);
}

.gate-card--hidden {
  display: none;
}

.gate-label {
  margin: 0 0 6px;
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--gold);
}

.gate-hint {
  margin: 0 0 20px;
  font-style: italic;
  color: var(--text-dim);
  font-size: 1rem;
}

.gate-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.gate-input {
  width: 100%;
  padding: 14px 16px;
  font-family: var(--font-body);
  font-size: 1.05rem;
  letter-spacing: 0.14em;
  text-align: center;
  color: var(--text);
  background: rgba(18, 11, 16, 0.7);
  border: 1px solid var(--night-line);
  border-radius: 12px;
  outline: none;
  transition: border-color 200ms ease, box-shadow 200ms ease;
}

.gate-input::placeholder {
  color: rgba(192, 170, 144, 0.55);
  letter-spacing: 0.18em;
}

.gate-input:focus-visible {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(212, 164, 76, 0.22), 0 0 26px rgba(212, 164, 76, 0.12);
}

.gate-button {
  appearance: none;
  border: none;
  cursor: pointer;
  min-height: 48px;
  padding: 12px 26px;
  border-radius: 12px;
  font-family: var(--font-display);
  font-size: 1.12rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: #2c1a10;
  background: linear-gradient(170deg, var(--gold-bright) 0%, var(--gold) 55%, var(--gold-deep) 100%);
  box-shadow: 0 10px 26px rgba(212, 164, 76, 0.25), inset 0 1px 0 rgba(255, 244, 214, 0.65);
  transition: transform 180ms var(--ease-romantic), box-shadow 180ms ease, filter 180ms ease;
}

.gate-button:hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
  box-shadow: 0 14px 32px rgba(212, 164, 76, 0.33), inset 0 1px 0 rgba(255, 244, 214, 0.65);
}

.gate-button:active {
  transform: translateY(0) scale(0.985);
}

.gate-button:disabled {
  opacity: 0.55;
  cursor: default;
  transform: none;
  filter: none;
}

.gate-button:focus-visible {
  outline: 2px solid var(--gold-bright);
  outline-offset: 3px;
}

.gate-error {
  min-height: 1.4em;
  margin: 4px 0 0;
  font-size: 0.98rem;
  color: var(--rose-soft);
}

/* ---- Umschlag ---- */
.envelope-grid {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  justify-content: center;
  width: 100%;
  grid-area: 1 / 1;
}

.envelope {
  appearance: none;
  position: relative;
  width: min(480px, 94vw);
  aspect-ratio: 5 / 3.3;
  border: none;
  border-radius: 10px;
  background:
    linear-gradient(160deg, rgba(255, 250, 238, 0.12), rgba(0, 0, 0, 0.16)),
    linear-gradient(180deg, var(--paper) 0%, var(--paper-warm) 100%);
  box-shadow:
    var(--shadow-paper),
    inset 0 0 0 1px rgba(168, 123, 47, 0.25);
  cursor: pointer;
  overflow: visible;
  transform-style: preserve-3d;
  transition: transform 700ms var(--ease-romantic), opacity 600ms ease, box-shadow 700ms ease, filter 600ms ease;
  z-index: 3;
}

.envelope:hover {
  transform: translateY(-4px);
}

.envelope:focus-visible {
  outline: 2px solid var(--gold-bright);
  outline-offset: 5px;
}

/* Goldenes Innenfutter, blitzt unter der Klappe hervor */
.envelope__lining {
  position: absolute;
  inset: 0;
  border-radius: 10px;
  overflow: hidden;
  pointer-events: none;
}

.envelope__lining::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(135deg, rgba(168, 123, 47, 0.5) 0 2px, transparent 2px 9px),
    linear-gradient(180deg, #caa45c, #8e6a28);
  clip-path: polygon(0 0, 100% 0, 50% 58%);
  opacity: 0.95;
}

/* Verschlussklappe */
.envelope__flap {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(195deg, var(--paper) 12%, var(--paper-warm) 78%, #e3d2b4 100%);
  clip-path: polygon(0 -1%, 100% -1%, 50% 57%);
  filter: drop-shadow(0 3px 4px rgba(61, 38, 22, 0.18));
  transform-origin: top center;
  transition: transform 900ms var(--ease-romantic) 80ms, opacity 400ms ease 700ms;
  z-index: 3;
}

/* Taschen-Falten unten */
.envelope__pocket {
  position: absolute;
  inset: 0;
  border-radius: 10px;
  pointer-events: none;
  overflow: hidden;
}

.envelope__pocket::before,
.envelope__pocket::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(61, 38, 22, 0.0), rgba(61, 38, 22, 0.07));
}

.envelope__pocket::before {
  clip-path: polygon(0 18%, 50% 70%, 0 102%);
}

.envelope__pocket::after {
  clip-path: polygon(100% 18%, 50% 70%, 100% 102%);
}

/* Wachssiegel */
.envelope__seal {
  position: absolute;
  left: 50%;
  top: 57%;
  width: clamp(58px, 16vw, 74px);
  height: clamp(58px, 16vw, 74px);
  transform: translate(-50%, -50%);
  border-radius: 47% 53% 51% 49% / 52% 48% 52% 48%;
  background:
    radial-gradient(circle at 36% 30%, rgba(255, 160, 170, 0.5), transparent 45%),
    radial-gradient(circle at 50% 55%, var(--wax) 0%, var(--wax-deep) 78%);
  box-shadow:
    0 6px 16px rgba(20, 4, 10, 0.55),
    inset 0 2px 4px rgba(255, 190, 190, 0.25),
    inset 0 -4px 8px rgba(30, 4, 12, 0.55);
  display: grid;
  place-items: center;
  z-index: 4;
  pointer-events: none;
  transition: transform 500ms var(--ease-romantic), opacity 400ms ease;
}

.envelope__seal::before {
  content: "";
  position: absolute;
  inset: 14%;
  border-radius: 50%;
  border: 1px solid rgba(233, 200, 126, 0.4);
  opacity: 0.7;
}

.seal-heart {
  font-size: clamp(1.3rem, 4.5vw, 1.7rem);
  line-height: 1;
  color: var(--gold-bright);
  text-shadow: 0 1px 2px rgba(30, 4, 12, 0.8);
  transform: translateY(-1px);
}

/* Empfänger-Label in Schreibschrift */
.envelope__label {
  position: absolute;
  left: 50%;
  bottom: 9%;
  transform: translateX(-50%);
  max-width: 86%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: var(--font-script);
  font-size: clamp(1.45rem, 6vw, 1.95rem);
  color: #5d4226;
  pointer-events: none;
}

/* Briefmarke oben rechts */
.envelope__stamp {
  position: absolute;
  top: 7%;
  right: 5%;
  width: clamp(40px, 11vw, 52px);
  aspect-ratio: 4 / 4.8;
  background:
    radial-gradient(circle at 50% 42%, var(--rose) 0 26%, transparent 27%),
    linear-gradient(170deg, #fbf3e2, #efe0c4);
  box-shadow: 0 1px 4px rgba(61, 38, 22, 0.25);
  border-radius: 3px;
  pointer-events: none;
  opacity: 0.92;
  transform: rotate(4deg);
  display: grid;
  place-items: center;
}

.envelope__stamp::after {
  content: "♥";
  font-size: clamp(0.85rem, 3vw, 1.05rem);
  color: #fbf3e2;
  transform: translateY(-12%);
}

/* ---- Öffnungs-Sequenz ---- */

/* Phase 1: Umschlag erwacht — sanftes Anheben + Glühen */
.envelope--wake {
  animation: envelopeWake 750ms var(--ease-romantic) forwards;
}

@keyframes envelopeWake {
  0%   { transform: translateY(0) scale(1); }
  45%  { transform: translateY(-7px) scale(1.018); box-shadow: 0 36px 80px rgba(8, 4, 7, 0.6), 0 0 50px rgba(233, 200, 126, 0.22), inset 0 0 0 1px rgba(168, 123, 47, 0.4); }
  100% { transform: translateY(-4px) scale(1.012); box-shadow: 0 32px 72px rgba(8, 4, 7, 0.6), 0 0 36px rgba(233, 200, 126, 0.18), inset 0 0 0 1px rgba(168, 123, 47, 0.35); }
}

/* Phase 2: Siegel bricht und fällt */
.scene--seal-broken .envelope__seal {
  animation: sealBreak 950ms var(--ease-romantic) forwards;
}

@keyframes sealBreak {
  0%   { transform: translate(-50%, -50%) rotate(0deg) scale(1); opacity: 1; }
  22%  { transform: translate(-50%, -54%) rotate(-7deg) scale(1.12); }
  38%  { transform: translate(-50%, -52%) rotate(5deg) scale(1.06); }
  100% { transform: translate(-50%, 110%) rotate(26deg) scale(0.82); opacity: 0; }
}

/* Phase 3: Klappe öffnet sich */
.scene--open .envelope__flap {
  transform: rotateX(-178deg);
  opacity: 0;
}

/* Phase 4: Brief erscheint, Umschlag tritt zurück */
.scene--letter-visible .envelope {
  opacity: 0;
  transform: translateY(34px) scale(0.92);
  pointer-events: none;
  filter: blur(1px);
}

.scene--letter-visible .envelope-grid {
  pointer-events: none;
}

/* Effekt-Ebenen */
.envelope-effects,
.hearts {
  position: absolute;
  inset: -10% -6%;
  pointer-events: none;
  grid-area: 1 / 1;
  z-index: 5;
}

.hearts--active {
  z-index: 6;
}

/* Kerzenfunken (ersetzt Lichtstrahlen/Schockwellen) */
.sparkle {
  position: absolute;
  width: var(--sparkle-size, 6px);
  height: var(--sparkle-size, 6px);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  animation: sparkleDrift var(--sparkle-duration, 1100ms) ease-out var(--sparkle-delay, 0ms) forwards;
  opacity: 0;
  filter: blur(0.4px);
}

@keyframes sparkleDrift {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.4); }
  18%  { opacity: 1; }
  100% { opacity: 0; transform: translate(calc(-50% + var(--sparkle-x, 0px)), calc(-50% + var(--sparkle-y, -60px))) scale(1); }
}

/* Goldstaub */
.golden-dust {
  position: absolute;
  width: var(--dust-size, 3px);
  height: var(--dust-size, 3px);
  border-radius: 50%;
  background: var(--dust-color, var(--gold-bright));
  box-shadow: 0 0 6px var(--dust-color, var(--gold-bright));
  transform: translate(-50%, -50%);
  opacity: 0;
  animation: dustFloat var(--dust-duration, 2000ms) ease-out var(--dust-delay, 0ms) forwards;
}

@keyframes dustFloat {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
  15%  { opacity: 0.95; }
  100% { opacity: 0; transform: translate(calc(-50% + var(--dust-x, 0px)), calc(-50% + var(--dust-y, -120px))) scale(1); }
}

/* Schwebende Glut im Hintergrund (ambient) */
.ember {
  position: fixed;
  left: var(--ember-x, 50%);
  bottom: -3vh;
  width: var(--ember-size, 4px);
  height: var(--ember-size, 4px);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 232, 178, 0.95) 0%, rgba(233, 200, 126, 0.55) 45%, transparent 75%);
  filter: blur(0.5px);
  opacity: 0;
  pointer-events: none;
  z-index: 0;
  animation: emberRise var(--ember-duration, 14s) linear var(--ember-delay, 0s) infinite;
}

@keyframes emberRise {
  0%   { opacity: 0; transform: translate3d(0, 0, 0) scale(1); }
  12%  { opacity: var(--ember-opacity, 0.5); }
  88%  { opacity: var(--ember-opacity, 0.5); }
  100% { opacity: 0; transform: translate3d(var(--ember-drift, 20px), -106vh, 0) scale(0.6); }
}

/* Herzen */
.heart {
  position: absolute;
  left: var(--heart-origin-x, 50%);
  top: var(--heart-origin-y, 50%);
  width: var(--heart-size, 16px);
  height: var(--heart-size, 16px);
  background: var(--heart-color, var(--rose));
  transform: translate(-50%, -50%) rotate(45deg) scale(0);
  opacity: 0;
  animation: heartRise var(--heart-duration, 1600ms) ease-out var(--heart-delay, 0ms) forwards;
  filter: drop-shadow(0 3px 10px rgba(193, 75, 102, 0.45));
}

.heart::before,
.heart::after {
  content: "";
  position: absolute;
  width: 100%;
  height: 100%;
  background: inherit;
  border-radius: 50%;
}

.heart::before { top: -50%; left: 0; }
.heart::after  { left: -50%; top: 0; }

.heart--mega {
  filter: drop-shadow(0 6px 18px rgba(193, 75, 102, 0.55));
}

.heart--with-trail {
  box-shadow: 0 0 14px rgba(233, 200, 126, 0.5);
}

@keyframes heartRise {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) rotate(45deg) scale(0);
  }
  18% {
    opacity: 1;
    transform: translate(-50%, -60%) rotate(45deg) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(calc(-50% + var(--heart-drift, 0px)), calc(-50% - 260px)) rotate(calc(45deg + var(--heart-spin, 0deg))) scale(0.75);
  }
}

/* --------------------------------------------------------------------------
   Brief
   -------------------------------------------------------------------------- */
.letter-card {
  position: relative;
  width: min(640px, 100%);
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='p'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23p)' opacity='0.05'/%3E%3C/svg%3E"),
    linear-gradient(168deg, #f8f0e0 0%, var(--paper) 48%, var(--paper-warm) 100%);
  color: var(--ink);
  border-radius: 6px;
  box-shadow: var(--shadow-paper);
  padding: clamp(30px, 7vw, 56px) clamp(22px, 6vw, 50px);
  grid-area: 1 / 1;
  z-index: 2;
}

/* Feiner Stationery-Rahmen */
.letter-card::before {
  content: "";
  position: absolute;
  inset: 12px;
  border: 1px solid rgba(168, 123, 47, 0.35);
  border-radius: 3px;
  pointer-events: none;
}

.letter-card::after {
  content: "♥";
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 0.8rem;
  line-height: 1;
  color: var(--gold-deep);
  background: #f8f0e0;
  padding: 0 10px;
}

.letter-card--concealed {
  display: none;
}

/* Auftritt des Briefs */
.letter-card[data-letter] {
  opacity: 0;
  transform: translateY(46px) scale(0.965);
  transition: opacity 900ms ease 150ms, transform 1000ms var(--ease-romantic) 150ms;
}

.scene--letter-visible .letter-card[data-letter] {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.scene--instant .letter-card[data-letter] {
  transition: none;
}

.letter-card--static {
  opacity: 1;
  transform: none;
}

.letter-section {
  position: relative;
}

/* Zarte Trenner zwischen den Abschnitten */
.letter-section + .letter-section {
  margin-top: 26px;
  padding-top: 26px;
}

.letter-section + .letter-section::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 110px;
  height: 9px;
  background:
    radial-gradient(circle at 50% 50%, var(--gold-deep) 0 1.6px, transparent 2.1px),
    linear-gradient(90deg, transparent, rgba(168, 123, 47, 0.45) 25%, rgba(168, 123, 47, 0.45) 75%, transparent) 50% 50% / 100% 1px no-repeat;
}

.intro,
.body-copy,
.closing {
  margin: 0;
  font-size: 1.08rem;
  line-height: 1.85;
  color: var(--ink);
  white-space: pre-line;
}

.intro {
  font-size: 1.14rem;
}

/* Initiale des Briefs */
.letter-section--opening .intro::first-letter {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 3.1em;
  line-height: 0.85;
  float: left;
  margin: 0.04em 0.12em 0 0;
  color: var(--wax);
}

.closing {
  font-style: italic;
}

.signature {
  margin: 30px 0 0;
  font-family: var(--font-script);
  font-size: clamp(1.9rem, 7vw, 2.5rem);
  line-height: 1.3;
  color: #4c3146;
  transform: rotate(-2deg);
  transform-origin: left bottom;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

/* Dezenter Verweis auf die Gutscheine */
.letter-aside {
  margin: 34px 0 0;
  text-align: right;
}

.letter-aside__link {
  font-family: var(--font-body);
  font-style: italic;
  font-size: 1rem;
  color: var(--gold-deep);
  text-decoration: none;
  border-bottom: 1px solid rgba(168, 123, 47, 0.45);
  padding-bottom: 1px;
  transition: color 180ms ease, border-color 180ms ease;
}

.letter-aside__link:hover,
.letter-aside__link:focus-visible {
  color: var(--wax);
  border-color: var(--wax);
}

/* Sanftes Einblenden der Abschnitte */
.fade-up {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 800ms ease, transform 800ms var(--ease-romantic);
}

.fade-up.visible {
  opacity: 1;
  transform: translateY(0);
}

/* --------------------------------------------------------------------------
   Gutschein-Seite
   -------------------------------------------------------------------------- */
.page-nav {
  display: flex;
  justify-content: flex-start;
}

.page-nav__back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 8px 4px;
  font-family: var(--font-body);
  font-style: italic;
  font-size: 1.02rem;
  color: var(--text-dim);
  text-decoration: none;
  transition: color 180ms ease;
}

.page-nav__back:hover,
.page-nav__back:focus-visible {
  color: var(--gold-bright);
}

.coupon-card {
  background: none;
  box-shadow: none;
  padding: 0;
  width: 100%;
  color: var(--text);
}

.coupon-card::before,
.coupon-card::after {
  display: none;
}

.coupon-card > .intro {
  color: var(--text-dim);
  font-style: italic;
  text-align: center;
  margin-bottom: 22px;
}

.coupon-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

/* Gutschein als edles Ticket */
.coupon-item {
  --punch: 11px;
  position: relative;
  display: flex;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='p'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23p)' opacity='0.05'/%3E%3C/svg%3E"),
    linear-gradient(165deg, #f8f0e0 0%, var(--paper) 55%, var(--paper-warm) 100%);
  color: var(--ink);
  border-radius: 10px;
  box-shadow: var(--shadow-card);
  overflow: hidden;
  opacity: 0;
  transform: translateY(20px);
  animation: ticketIn 650ms var(--ease-romantic) calc(var(--coupon-i, 0) * 130ms) forwards;
}

@keyframes ticketIn {
  to { opacity: 1; transform: translateY(0); }
}

/* Abriss-Stub links mit Perforation */
.coupon-mark {
  flex: 0 0 64px;
  display: grid;
  place-items: center;
  font-size: 1.5rem;
  color: var(--paper);
  background:
    radial-gradient(circle at 30% 25%, rgba(255, 170, 180, 0.35), transparent 50%),
    linear-gradient(170deg, var(--wax) 0%, var(--wax-deep) 100%);
  border-right: 2px dashed rgba(245, 236, 220, 0.55);
  text-shadow: 0 1px 3px rgba(30, 4, 12, 0.6);
}

/* Lochung oben/unten an der Perforation */
.coupon-item::before,
.coupon-item::after {
  content: "";
  position: absolute;
  left: calc(64px - var(--punch) / 2);
  width: var(--punch);
  height: var(--punch);
  border-radius: 50%;
  background: var(--night-deep);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.6);
  z-index: 1;
}

.coupon-item::before { top: calc(var(--punch) / -2.2); }
.coupon-item::after  { bottom: calc(var(--punch) / -2.2); }

.coupon-content {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 18px 18px 16px;
  min-width: 0;
}

.coupon-text {
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 600;
  line-height: 1.2;
  color: var(--ink);
}

.coupon-content .body-copy {
  font-size: 0.98rem;
  line-height: 1.55;
  color: var(--muted);
}

.coupon-remaining {
  font-size: 0.92rem;
  color: var(--muted);
  font-style: italic;
  min-height: 1.2em;
}

.coupon-select {
  display: flex;
  align-items: center;
  gap: 10px;
}

.coupon-dropdown,
.exchange-select,
.exchange-input {
  font-family: var(--font-body);
  font-size: 1rem; /* >=16px verhindert iOS-Zoom */
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(168, 123, 47, 0.4);
  background: rgba(255, 252, 244, 0.7);
  color: var(--ink);
  min-height: 44px;
}

.coupon-dropdown:focus-visible {
  outline: none;
  border-color: var(--gold-deep);
  box-shadow: 0 0 0 3px rgba(212, 164, 76, 0.25);
}

.coupon-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.coupon-button {
  appearance: none;
  border: none;
  cursor: pointer;
  min-height: 46px;
  padding: 10px 22px;
  border-radius: 11px;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: #2c1a10;
  background: linear-gradient(170deg, var(--gold-bright) 0%, var(--gold) 55%, var(--gold-deep) 100%);
  box-shadow: 0 8px 20px rgba(168, 123, 47, 0.3), inset 0 1px 0 rgba(255, 244, 214, 0.6);
  transition: transform 160ms var(--ease-romantic), box-shadow 160ms ease, filter 160ms ease, opacity 160ms ease;
}

.coupon-button:hover:not(:disabled) {
  transform: translateY(-1px);
  filter: brightness(1.05);
}

.coupon-button:active:not(:disabled) {
  transform: scale(0.98);
}

.coupon-button:disabled {
  opacity: 0.45;
  cursor: default;
  box-shadow: none;
}

.coupon-button:focus-visible {
  outline: 2px solid var(--gold-bright);
  outline-offset: 3px;
}

.coupon-button--exchange,
.coupon-button--secondary {
  background: transparent;
  color: var(--gold-deep);
  box-shadow: inset 0 0 0 1.5px rgba(168, 123, 47, 0.55);
}

.coupon-button--exchange:hover:not(:disabled),
.coupon-button--secondary:hover:not(:disabled) {
  background: rgba(212, 164, 76, 0.12);
  filter: none;
}

.exchange-modal .coupon-button--secondary {
  color: var(--gold-bright);
  box-shadow: inset 0 0 0 1.5px rgba(212, 164, 76, 0.5);
}

.coupon-status {
  font-size: 0.95rem;
  color: var(--muted);
  font-style: italic;
}

/* Aufgebraucht: Sepia + Stempel */
.coupon-item--depleted {
  filter: saturate(0.35) brightness(0.92);
}

.coupon-item--depleted .coupon-content::after {
  content: "EINGELÖST";
  position: absolute;
  top: 50%;
  right: 14px;
  transform: translateY(-50%) rotate(-12deg);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.3em;
  color: rgba(126, 31, 56, 0.55);
  border: 2px solid rgba(126, 31, 56, 0.45);
  border-radius: 6px;
  padding: 6px 10px 6px 13px;
  pointer-events: none;
}

/* --------------------------------------------------------------------------
   Tausch-Modal
   -------------------------------------------------------------------------- */
.exchange-modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 280ms ease;
}

.exchange-modal--visible {
  opacity: 1;
  pointer-events: auto;
}

.exchange-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 5, 9, 0.72);
  backdrop-filter: blur(3px);
}

.exchange-modal-content {
  position: relative;
  width: min(480px, 100%);
  max-height: 88vh;
  overflow-y: auto;
  background: linear-gradient(170deg, var(--night-soft), var(--night));
  border: 1px solid var(--night-line);
  border-bottom: none;
  border-radius: 22px 22px 0 0;
  box-shadow: 0 -20px 60px rgba(0, 0, 0, 0.5);
  padding: 30px 24px 34px;
  color: var(--text);
  transform: translateY(28px);
  transition: transform 320ms var(--ease-romantic);
}

.exchange-modal--visible .exchange-modal-content {
  transform: translateY(0);
}

.exchange-modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: rgba(242, 231, 213, 0.08);
  color: var(--text-dim);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease;
}

.exchange-modal-close:hover,
.exchange-modal-close:focus-visible {
  background: rgba(242, 231, 213, 0.16);
  color: var(--text);
}

.exchange-modal-title {
  margin: 0 0 2px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.7rem;
  color: var(--text);
}

.exchange-modal-subtitle {
  margin: 0 0 22px;
  font-style: italic;
  color: var(--gold-bright);
}

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

.exchange-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.exchange-label {
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.exchange-input-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.exchange-input,
.exchange-select {
  background: rgba(18, 11, 16, 0.7);
  border: 1px solid var(--night-line);
  color: var(--text);
}

.exchange-input {
  width: 86px;
  text-align: center;
}

.exchange-select {
  flex: 1;
  min-width: 0;
}

.exchange-input:focus-visible,
.exchange-select:focus-visible {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(212, 164, 76, 0.22);
}

.exchange-x {
  color: var(--text-dim);
  font-size: 1.05rem;
}

.exchange-arrow {
  text-align: center;
  font-size: 1.3rem;
  color: var(--gold);
  margin: -4px 0;
}

.exchange-result {
  min-width: 86px;
  padding: 10px 12px;
  text-align: center;
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--gold-bright);
  background: rgba(212, 164, 76, 0.1);
  border: 1px solid rgba(212, 164, 76, 0.3);
  border-radius: 10px;
}

.exchange-info {
  margin: 2px 0 0;
  font-size: 0.98rem;
  line-height: 1.6;
  color: var(--text-dim);
  min-height: 1.5em;
}

.exchange-actions {
  display: flex;
  gap: 12px;
  margin-top: 8px;
}

.exchange-actions .coupon-button {
  flex: 1;
}

.exchange-status {
  margin: 6px 0 0;
  min-height: 1.5em;
  font-size: 0.98rem;
  text-align: center;
  color: var(--text-dim);
}

/* --------------------------------------------------------------------------
   Statusseiten (404 / Fehler / Gesperrt)
   -------------------------------------------------------------------------- */
.status-container {
  min-height: calc(100vh - 80px);
  min-height: calc(100dvh - 80px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.5rem;
  text-align: center;
  position: relative;
  z-index: 1;
}

.status-seal {
  width: 84px;
  height: 84px;
  border-radius: 47% 53% 51% 49% / 52% 48% 52% 48%;
  background:
    radial-gradient(circle at 36% 30%, rgba(255, 160, 170, 0.5), transparent 45%),
    radial-gradient(circle at 50% 55%, var(--wax) 0%, var(--wax-deep) 78%);
  box-shadow:
    0 10px 26px rgba(20, 4, 10, 0.6),
    inset 0 2px 4px rgba(255, 190, 190, 0.25),
    inset 0 -4px 8px rgba(30, 4, 12, 0.55);
  display: grid;
  place-items: center;
  font-size: 1.7rem;
  color: var(--gold-bright);
  text-shadow: 0 1px 2px rgba(30, 4, 12, 0.8);
  margin-bottom: 1.6rem;
}

.status-title {
  margin: 0 0 0.8rem;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.8rem, 7vw, 2.4rem);
  color: var(--text);
}

.status-message {
  margin: 0;
  font-size: 1.08rem;
  color: var(--text-dim);
  max-width: 420px;
  line-height: 1.7;
}

.status-link {
  color: var(--gold-bright);
  text-decoration: none;
  border-bottom: 1px solid var(--gold-faint);
  transition: border-color 160ms ease;
}

.status-link:hover,
.status-link:focus-visible {
  border-color: var(--gold-bright);
}

/* --------------------------------------------------------------------------
   Admin
   -------------------------------------------------------------------------- */
.admin-body .hero {
  align-items: flex-start;
  text-align: left;
}

.admin-body .hero::after {
  margin-left: 0;
  background:
    linear-gradient(90deg, var(--gold) 0%, var(--gold-faint) 60%, transparent) 0 50% / 100% 1px no-repeat;
}

.admin-body .subtitle {
  font-family: var(--font-body);
  font-style: italic;
  font-size: 1.05rem;
  order: 0;
  color: var(--text-dim);
  text-shadow: none;
}

.admin-logout {
  position: absolute;
  top: 0;
  right: 0;
}

.admin-logout .gate-button,
.admin-small {
  min-height: 40px;
  padding: 8px 16px;
  font-size: 0.95rem;
  border-radius: 10px;
}

.admin-card {
  width: 100%;
  background: linear-gradient(170deg, rgba(40, 24, 35, 0.75), rgba(28, 17, 24, 0.9));
  border: 1px solid var(--night-line);
  border-radius: 16px;
  box-shadow: var(--shadow-card);
  padding: 24px 20px;
  color: var(--text);
}

.admin-card::before,
.admin-card::after {
  display: none;
}

.admin-section-title {
  margin: 0 0 18px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.45rem;
  color: var(--gold-bright);
}

.admin-section-subtitle {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.15rem;
  color: var(--text);
}

.admin-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.admin-field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.admin-label {
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.admin-input {
  width: 100%;
  font-family: var(--font-body);
  font-size: 1rem;
  padding: 11px 13px;
  min-height: 44px;
  border-radius: 10px;
  border: 1px solid var(--night-line);
  background: rgba(18, 11, 16, 0.7);
  color: var(--text);
  transition: border-color 180ms ease, box-shadow 180ms ease;
}

.admin-input:focus-visible {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(212, 164, 76, 0.2);
}

.admin-textarea {
  resize: vertical;
  line-height: 1.6;
}

.admin-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
}

.admin-hint {
  font-size: 0.92rem;
  color: var(--text-dim);
  line-height: 1.55;
  margin: 0;
}

.admin-header-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.admin-header-row .admin-section-title {
  margin: 0;
  flex: 1;
}

.admin-coupon-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.admin-coupon-row {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  padding-top: 56px;
  border: 1px solid var(--night-line);
  border-radius: 12px;
  background: rgba(18, 11, 16, 0.45);
}

.admin-coupon-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.admin-option-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.admin-option-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 8px;
  align-items: center;
}

.admin-option-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

.admin-remove {
  appearance: none;
  cursor: pointer;
  border: 1px solid rgba(229, 138, 160, 0.4);
  background: transparent;
  color: var(--heart-strong);
  border-radius: 10px;
  min-height: 40px;
  padding: 8px 14px;
  font-family: var(--font-body);
  font-size: 0.95rem;
  transition: background 160ms ease;
}

.admin-remove:hover,
.admin-remove:focus-visible {
  background: rgba(229, 138, 160, 0.12);
}

.admin-coupon-row > .admin-remove {
  position: absolute;
  top: 10px;
  right: 10px;
}

.admin-remove--small {
  min-height: 44px;
  min-width: 44px;
  padding: 6px 10px;
}

.admin-danger {
  border: 1px solid rgba(229, 138, 160, 0.5) !important;
  background: rgba(181, 61, 89, 0.2) !important;
  color: var(--heart-strong) !important;
  box-shadow: none !important;
}

.admin-valentine-confirmations {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--night-line);
}

.admin-confirmations-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.admin-confirmations-header,
.admin-confirmation-row {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1.2fr;
  gap: 10px;
  padding: 8px 10px;
  font-size: 0.92rem;
  border-radius: 8px;
}

.admin-confirmations-header {
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.78rem;
  color: var(--text-dim);
}

.admin-confirmation-row {
  background: rgba(18, 11, 16, 0.5);
  border: 1px solid rgba(233, 200, 126, 0.08);
  word-break: break-word;
}

/* Klebriger Speichern-Balken */
.admin-savebar {
  position: sticky;
  bottom: 14px;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 18px;
  background: linear-gradient(170deg, rgba(40, 24, 35, 0.97), rgba(28, 17, 24, 0.99));
  border: 1px solid var(--gold-faint);
  border-radius: 14px;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.55);
}

.admin-savebar .gate-button {
  flex-shrink: 0;
}

.admin-savebar .admin-hint {
  flex: 1;
  min-width: 0;
}

/* Admin-Login */
.admin-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 380px;
}

/* --------------------------------------------------------------------------
   Jahrestags-Overlay
   -------------------------------------------------------------------------- */
.anniversary-overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 600ms ease;
  z-index: 200;
  overflow: hidden;
}

.anniversary-overlay--visible {
  opacity: 1;
  pointer-events: auto;
}

.anniversary-gradient {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(85% 70% at 50% 30%, rgba(126, 31, 56, 0.55), transparent 70%),
    linear-gradient(180deg, rgba(18, 11, 16, 0.96), rgba(13, 7, 9, 0.98));
}

.anniversary-glow {
  position: absolute;
  inset: 0;
  background: radial-gradient(46% 34% at 50% 44%, rgba(233, 200, 126, 0.22), transparent 75%);
  animation: candleBreath 4.5s ease-in-out infinite alternate;
}

.anniversary-rings {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
}

.ring {
  position: absolute;
  border: 1px solid rgba(233, 200, 126, 0.35);
  border-radius: 50%;
  width: 240px;
  height: 240px;
  animation: ringPulse 3.2s ease-out infinite;
}

.ring--2 { animation-delay: 0.9s; }
.ring--3 { animation-delay: 1.8s; }

@keyframes ringPulse {
  0%   { transform: scale(0.55); opacity: 0; }
  25%  { opacity: 0.8; }
  100% { transform: scale(2.4); opacity: 0; }
}

.anniversary-beams {
  position: absolute;
  inset: 0;
  overflow: hidden;
  opacity: 0.55;
}

.anniversary-beam {
  position: absolute;
  bottom: 0;
  width: 2px;
  background: linear-gradient(180deg, hsla(var(--h, 40), 70%, 70%, 0.65), transparent);
  transform-origin: bottom center;
  animation: beamSway 2.8s ease-in-out infinite alternate;
}

@keyframes beamSway {
  from { transform: rotate(-2deg) scaleY(0.9); opacity: 0.4; }
  to   { transform: rotate(2deg) scaleY(1); opacity: 0.9; }
}

.anniversary-stars {
  position: absolute;
  inset: 0;
}

.anniversary-star {
  position: absolute;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: radial-gradient(circle, #fff6e0 0%, rgba(233, 200, 126, 0.7) 50%, transparent 75%);
  animation: starTwinkle 2.2s ease-in-out infinite alternate;
}

@keyframes starTwinkle {
  from { opacity: 0.15; }
  to   { opacity: 1; }
}

.anniversary-content {
  position: relative;
  text-align: center;
  z-index: 2;
  max-width: 480px;
}

.anniversary-kicker {
  margin: 0 0 4px;
  font-family: var(--font-script);
  font-size: clamp(2rem, 8vw, 2.8rem);
  color: var(--gold-bright);
  text-shadow: 0 0 30px rgba(233, 200, 126, 0.5);
}

.anniversary-title {
  margin: 0 0 14px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(2rem, 8vw, 3rem);
  color: var(--text);
}

.anniversary-body {
  margin: 0 0 22px;
  font-size: 1.12rem;
  font-style: italic;
  color: var(--text-dim);
  line-height: 1.7;
}

.anniversary-meta {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.pill {
  padding: 8px 18px;
  border-radius: 999px;
  border: 1px solid var(--gold-faint);
  background: rgba(212, 164, 76, 0.1);
  color: var(--gold-bright);
  font-size: 0.95rem;
  letter-spacing: 0.04em;
}

.pill:empty {
  display: none;
}

.anniversary-confetti {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.confetti-piece {
  position: absolute;
  top: -6%;
  background: var(--c, var(--gold-bright));
  width: 9px;
  height: 14px;
  border-radius: 3px;
  opacity: 0;
  transform: translateX(var(--tx, 0)) rotate(var(--rx, 0deg)) scale(var(--s, 1));
  animation: confettiFall var(--d, 3s) ease-in var(--dl, 0ms) forwards;
}

@keyframes confettiFall {
  0%   { opacity: 0; transform: translate3d(var(--tx, 0), -40px, 0) rotate(var(--rx, 0deg)) scale(var(--s, 1)); }
  12%  { opacity: 0.95; }
  100% { opacity: 0; transform: translate3d(calc(var(--tx, 0) * 2), 110vh, 0) rotate(calc(var(--rx, 0deg) + 540deg)) scale(var(--s, 1)); }
}

/* --------------------------------------------------------------------------
   Valentine-Event (hinter Flag deaktiviert — Styles bewusst erhalten)
   -------------------------------------------------------------------------- */
.valentine-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: radial-gradient(circle at 50% 50%, rgba(126, 31, 56, 0.5), rgba(28, 17, 24, 0.75) 60%, rgba(13, 7, 9, 0.9));
  opacity: 0;
  pointer-events: none;
  transition: opacity 400ms ease;
  z-index: 1000;
  overflow: hidden;
}

.valentine-overlay--visible {
  opacity: 1;
  pointer-events: auto;
}

.valentine-puzzle-container {
  position: absolute;
  width: min(380px, 90vw);
  height: 220px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 3px;
  z-index: 1;
}

.valentine-puzzle-piece {
  background: linear-gradient(145deg, var(--paper), #f3dbe2);
  border: 1px solid rgba(193, 75, 102, 0.25);
  opacity: 0;
  transform: var(--start-transform, translate(0, -200px) rotate(45deg) scale(0.3));
  animation: puzzlePieceIn 600ms cubic-bezier(0.34, 1.56, 0.64, 1) var(--delay, 0ms) forwards;
  box-shadow: 0 4px 12px rgba(193, 75, 102, 0.2);
}

.valentine-puzzle-piece:first-child { border-top-left-radius: 20px; }
.valentine-puzzle-piece:nth-child(4) { border-top-right-radius: 20px; }
.valentine-puzzle-piece:nth-child(9) { border-bottom-left-radius: 20px; }
.valentine-puzzle-piece:last-child { border-bottom-right-radius: 20px; }

@keyframes puzzlePieceIn {
  0%   { opacity: 0; transform: var(--start-transform, translate(0, -200px) rotate(45deg) scale(0.3)); }
  60%  { opacity: 1; }
  100% { opacity: 1; transform: translate(0, 0) rotate(0deg) scale(1); }
}

.valentine-popup {
  position: absolute;
  z-index: 2;
  background: transparent;
  border: none;
  padding: 36px 44px;
  text-align: center;
  max-width: min(380px, 90vw);
  opacity: 0;
  pointer-events: none;
}

.valentine-popup--ready {
  opacity: 1;
  pointer-events: auto;
}

.valentine-question {
  margin: 0 0 28px;
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 5.5vw, 2rem);
  color: var(--rose-blush);
  font-weight: 600;
  line-height: 1.3;
  text-shadow: 0 2px 14px rgba(193, 75, 102, 0.4);
  opacity: 0;
  transform: translateY(-120px) scale(0.8);
}

.valentine-question--falling {
  animation: textFallIn 800ms cubic-bezier(0.34, 1.2, 0.64, 1) forwards;
}

@keyframes textFallIn {
  0%   { opacity: 0; transform: translateY(-120px) scale(0.8) rotate(-5deg); }
  50%  { opacity: 1; transform: translateY(8px) scale(1.02) rotate(2deg); }
  70%  { transform: translateY(-4px) scale(0.98) rotate(-1deg); }
  85%  { transform: translateY(2px) scale(1.01) rotate(0.5deg); }
  100% { opacity: 1; transform: translateY(0) scale(1) rotate(0deg); }
}

.valentine-buttons {
  display: flex;
  gap: 20px;
  justify-content: center;
  flex-wrap: wrap;
  position: relative;
  min-height: 60px;
  opacity: 0;
  transform: translateY(20px);
}

.valentine-buttons--visible {
  animation: buttonsSlideIn 500ms ease forwards;
}

@keyframes buttonsSlideIn {
  0%   { opacity: 0; transform: translateY(20px); }
  100% { opacity: 1; transform: translateY(0); }
}

.valentine-btn {
  padding: 14px 36px;
  border-radius: 14px;
  border: none;
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 150ms ease, box-shadow 150ms ease;
}

.valentine-btn--yes {
  background: linear-gradient(135deg, var(--rose), #d96a85);
  color: #fff;
  box-shadow: 0 8px 24px rgba(193, 75, 102, 0.45);
  position: relative;
  z-index: 1005;
}

.valentine-btn--yes:hover {
  transform: scale(1.05);
  box-shadow: 0 12px 32px rgba(193, 75, 102, 0.55);
}

.valentine-btn--yes:active {
  transform: scale(0.98);
}

.valentine-btn--no {
  background: linear-gradient(135deg, #4a3a44, #382b34);
  color: #c0aa90;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3);
  position: absolute;
  transition: left 80ms ease-out, top 80ms ease-out, transform 150ms ease;
}

.valentine-btn--no:hover {
  transform: scale(1.02);
}

.valentine-btn--clone {
  position: fixed;
  z-index: 1003;
  animation: neinButtonSpawn 400ms cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  pointer-events: auto;
}

@keyframes neinButtonSpawn {
  0%   { opacity: 0; transform: scale(0) rotate(-20deg); }
  50%  { opacity: 1; transform: scale(1.2) rotate(10deg); }
  100% { opacity: 1; transform: scale(1) rotate(0deg); }
}

.valentine-btn--clone:active {
  transform: scale(0.95);
}

.valentine-puzzle-piece::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 40%, rgba(255, 255, 255, 0.4) 50%, transparent 60%);
  opacity: 0;
  animation: puzzleSparkle 1.5s ease var(--sparkle-delay, 0ms) forwards;
}

@keyframes puzzleSparkle {
  0%, 40% { opacity: 0; transform: translateX(-100%); }
  60%     { opacity: 1; }
  100%    { opacity: 0; transform: translateX(100%); }
}

@keyframes valentineShake {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  10% { transform: translate(-12px, -8px) rotate(-2deg); }
  20% { transform: translate(14px, 6px) rotate(2deg); }
  30% { transform: translate(-10px, 10px) rotate(-1deg); }
  40% { transform: translate(12px, -6px) rotate(1.5deg); }
  50% { transform: translate(-8px, 8px) rotate(-1.5deg); }
  60% { transform: translate(10px, -10px) rotate(1deg); }
  70% { transform: translate(-6px, 6px) rotate(-0.5deg); }
  80% { transform: translate(8px, -4px) rotate(0.5deg); }
  90% { transform: translate(-4px, 4px) rotate(0deg); }
}

.valentine-shaking {
  animation: valentineShake 600ms ease-in-out;
}

.valentine-celebration {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1001;
  overflow: hidden;
}

.valentine-celebration--active {
  pointer-events: none;
}

.valentine-confetti {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.valentine-confetti-piece {
  position: absolute;
  top: -5%;
  width: var(--size, 12px);
  height: calc(var(--size, 12px) * 1.4);
  background: var(--color);
  opacity: 0;
  transform: translate3d(var(--tx, 0), 0, 0) rotate3d(1, 1, 1, var(--rot, 0deg)) scale(var(--scale, 1));
  animation: valentineConfettiFall var(--duration, 3s) ease-out var(--delay, 0ms) forwards;
  border-radius: 4px;
}

@keyframes valentineConfettiFall {
  0% {
    opacity: 0;
    transform: translate3d(var(--tx, 0), -60px, 0) rotate3d(1, 1, 1, var(--rot, 0deg)) scale(var(--scale, 1));
  }
  15% { opacity: 1; }
  100% {
    opacity: 0;
    transform: translate3d(calc(var(--tx, 0) + var(--drift, 0px)), 110vh, 0) rotate3d(1, 1, 1, calc(var(--rot, 0deg) + 720deg)) scale(var(--scale, 1));
  }
}

.valentine-hearts {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.valentine-float-heart {
  position: absolute;
  width: var(--size, 30px);
  height: var(--size, 30px);
  background: var(--color, var(--rose));
  transform: translate(-50%, -50%) rotate(45deg) scale(0);
  border-radius: 4px;
  opacity: 0;
  animation: valentineHeartFloat var(--duration, 2.5s) ease-out var(--delay, 0ms) forwards;
  filter: drop-shadow(0 4px 12px rgba(193, 75, 102, 0.45));
}

.valentine-float-heart::before,
.valentine-float-heart::after {
  content: "";
  position: absolute;
  width: 100%;
  height: 100%;
  background: inherit;
  border-radius: 50%;
}

.valentine-float-heart::before { top: -50%; left: 0; }
.valentine-float-heart::after  { left: -50%; top: 0; }

@keyframes valentineHeartFloat {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) rotate(45deg) scale(0);
  }
  20% {
    opacity: 1;
    transform: translate(-50%, -50%) rotate(45deg) scale(var(--scale, 1));
  }
  100% {
    opacity: 0;
    transform: translate(calc(-50% + var(--drift, 0px)), calc(-50% - 200px)) rotate(45deg) scale(var(--scale, 1));
  }
}

.valentine-success {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0);
  background: linear-gradient(145deg, var(--paper), #f3dbe2);
  border: 2px solid rgba(193, 75, 102, 0.4);
  border-radius: 24px;
  padding: 30px 40px;
  text-align: center;
  box-shadow: 0 30px 80px rgba(193, 75, 102, 0.4);
  z-index: 1002;
  animation: valentineSuccessIn 500ms cubic-bezier(0.34, 1.56, 0.64, 1) 600ms forwards;
}

.valentine-success-text {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 6vw, 2.4rem);
  font-weight: 700;
  background: linear-gradient(90deg, var(--rose), var(--rose-soft), var(--gold-bright), var(--rose));
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: valentineShine 2s linear infinite;
}

@keyframes valentineSuccessIn {
  0%   { transform: translate(-50%, -50%) scale(0); opacity: 0; }
  100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

@keyframes valentineShine {
  0%   { background-position: 0% 50%; }
  100% { background-position: 200% 50%; }
}

/* --------------------------------------------------------------------------
   Utilities
   -------------------------------------------------------------------------- */
.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;
}

:focus-visible {
  outline-color: var(--gold-bright);
}

/* --------------------------------------------------------------------------
   Größere Screens
   -------------------------------------------------------------------------- */
@media (min-width: 700px) {
  body {
    padding: 40px 24px 72px;
  }

  .page {
    gap: 38px;
  }

  .exchange-modal {
    align-items: center;
    padding: 24px;
  }

  .exchange-modal-content {
    border-radius: 22px;
    border-bottom: 1px solid var(--night-line);
    max-height: 86vh;
    transform: translateY(14px) scale(0.985);
  }

  .exchange-modal--visible .exchange-modal-content {
    transform: translateY(0) scale(1);
  }

  .admin-grid {
    grid-template-columns: 1fr 1fr;
  }

  .admin-field--full {
    grid-column: 1 / -1;
  }

  .admin-coupon-grid {
    grid-template-columns: 1.2fr 1.6fr 0.8fr;
  }

  .coupon-mark {
    flex-basis: 78px;
  }

  .coupon-item::before,
  .coupon-item::after {
    left: calc(78px - var(--punch) / 2);
  }
}

/* --------------------------------------------------------------------------
   Reduzierte Bewegung
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  body::before,
  .anniversary-glow,
  .ring,
  .anniversary-beam,
  .anniversary-star {
    animation: none;
  }

  .ember {
    display: none;
  }

  .coupon-item {
    animation: none;
    opacity: 1;
    transform: none;
  }

  .fade-up {
    transition: none;
    opacity: 1;
    transform: none;
  }

  .letter-card[data-letter],
  .envelope,
  .envelope__flap,
  .envelope__seal,
  .exchange-modal-content,
  .gate-card {
    transition-duration: 1ms;
  }
}
