:root {
  --emerald: #0f2e27;
  --emerald-2: #16423a;
  --emerald-3: #1d5247;
  --ivory: #f6efe2;
  --ivory-2: #ece2cf;
  --ink: #1b2f2a;
  --muted: #5f6f69;
  --gold: #d4af6a;
  --gold-soft: rgba(212, 175, 106, 0.35);
  --gold-grad: linear-gradient(105deg, #7a5421 0%, #b3863f 11%, #e9cf8e 21%, #fff4cf 26%, #e2c07a 31%, #a57a36 41%, #7a5421 50%, #b98d45 60%, #efd79c 69%, #fff7da 73%, #d9b46c 78%, #9c7131 89%, #7a5421 100%);
  --gold-grad-paper: linear-gradient(105deg, #6b4718 0%, #9c7331 16%, #d9b46a 27%, #f3dea5 31%, #b48a45 40%, #6b4718 52%, #a57b37 64%, #e3c27f 73%, #8a6128 86%, #6b4718 100%);
  --glint: 50;
  --serif: "Playfair Display", Georgia, serif;
  --script: "Great Vibes", cursive;
  --sans: "Montserrat", system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  min-height: 100vh;
  font-family: var(--sans);
  color: var(--ivory);
  background: var(--emerald);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
/* Бархат: процедурная текстура + тёплый свет сверху + виньетка */
.bg {
  position: fixed; inset: 0; z-index: -1;
  background-color: #0d2b24;
  background-image:
    radial-gradient(120% 70% at 50% -5%, rgba(255,222,160,.13), transparent 60%),
    radial-gradient(90% 60% at 50% 110%, rgba(0,0,0,.5), transparent 70%),
    var(--tex-velvet, none);
  background-size: auto, auto, var(--tex-tile, 256px) var(--tex-tile, 256px);
}
.bg::after { content: ""; position: absolute; inset: 0; background: radial-gradient(ellipse at 50% 45%, transparent 50%, rgba(0,0,0,.55) 100%); }
/* Плёночное зерно */
.grain {
  position: fixed; inset: -50%; z-index: 45; pointer-events: none;
  background-image: var(--tex-grain, none); background-size: 192px 192px;
  opacity: .06; mix-blend-mode: overlay;
  animation: grain .9s steps(6) infinite;
}
@keyframes grain {
  0% { transform: translate(0, 0); } 20% { transform: translate(-3%, 2%); } 40% { transform: translate(2%, -4%); }
  60% { transform: translate(-4%, -1%); } 80% { transform: translate(3%, 3%); } 100% { transform: translate(0, 0); }
}
body.locked { overflow: hidden; height: 100vh; }
button { font: inherit; cursor: pointer; }

#sparkles, #confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; }
#sparkles { z-index: 0; }
#confetti { z-index: 60; }

/* Золотая фольга: блик смещается при наклоне телефона, движении мыши и скролле (--glint) */
.gold, .names .name, .intro-names, .letter-names, .hero-date, .flap b, .foot-names, .monogram, h2 {
  background: var(--gold-grad);
  background-size: 260% 100%;
  background-position: calc(var(--glint) * 1%) 50%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 1px 0 rgba(0,0,0,.35));
}
/* Золото через background-clip красит только рамку строки — даём завиткам букв запас,
   чтобы заглавные не срезались сверху и снизу (поля компенсируем отрицательным отступом) */
.names .name, .intro-names, .letter-names, .foot-names, .monogram, h2 {
  padding-top: .32em; padding-bottom: .18em;
  margin-top: -.32em; margin-bottom: -.18em;
}
h2 { margin-bottom: calc(18px - .18em); }

/* ============ Intro / Envelope ============ */
.intro {
  position: fixed; inset: 0; z-index: 50;
  display: flex; flex-direction: column; align-items: center; justify-content: space-between;
  padding: max(40px, env(safe-area-inset-top)) 16px max(40px, env(safe-area-inset-bottom));
  background:
    radial-gradient(600px 400px at 50% 50%, rgba(212,175,106,.16), transparent 70%),
    var(--emerald);
  transition: opacity 1s ease, transform 1.2s cubic-bezier(.7,0,.3,1), filter 1s;
}
.intro.done { opacity: 0; transform: scale(1.35); filter: blur(6px); pointer-events: none; }
#intro3d { position: absolute; inset: 0; width: 100%; height: 100%; display: block; opacity: 0; transition: opacity 1s ease; }
.intro.three #intro3d { opacity: 1; }
.intro.three { background: #0a241e; cursor: pointer; }
.intro.three .envelope { display: none; }
.intro.pending3d .envelope { opacity: 0; pointer-events: none; }
.intro .envelope { transition: opacity .6s; }
.intro.three::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse at 50% 50%, transparent 55%, rgba(0,0,0,.5) 100%);
}
.intro-top, .intro-bottom { position: relative; z-index: 2; text-align: center; transition: opacity .6s; text-shadow: 0 2px 12px rgba(0,0,0,.6); }
.intro.three .intro-names { filter: drop-shadow(0 2px 8px rgba(0,0,0,.7)); }
.intro.opening .intro-top, .intro.opening .intro-bottom { opacity: 0; }
.intro-names { font-family: var(--script); font-size: clamp(2rem, 9vw, 3rem); line-height: 1.2; }
.intro-names em { font-style: normal; }
.intro-date { letter-spacing: .35em; font-size: .8rem; color: var(--gold); margin-top: 6px; }
.intro-hint { font-family: var(--serif); font-size: 1.15rem; color: var(--ivory); letter-spacing: .05em; }
.intro-sub { font-size: .72rem; letter-spacing: .3em; text-transform: uppercase; color: var(--gold); margin-top: 8px; animation: pulse 2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }

.envelope {
  position: relative;
  width: min(86vw, 380px);
  aspect-ratio: 1.45;
  border: 0; background: none;
  perspective: 1400px;
  animation: float 4s ease-in-out infinite;
  -webkit-tap-highlight-color: transparent;
}
.intro.opening .envelope { animation: none; }
@keyframes float { 50% { transform: translateY(-10px) rotate(-.6deg); } }

.env-back, .env-front, .env-flap { position: absolute; inset: 0; }
.env-back { background: linear-gradient(160deg, #e3d6bd, #cdbb98); border-radius: 6px; box-shadow: 0 30px 50px rgba(0,0,0,.45); }
.env-front {
  z-index: 3;
  background: linear-gradient(170deg, #f1e7d3 0%, #e2d3b5 100%);
  clip-path: polygon(0 0, 50% 56%, 100% 0, 100% 100%, 0 100%);
  border-radius: 6px;
}
.env-front::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(to top right, transparent 49.6%, rgba(168,122,60,.35) 50%, transparent 50.4%),
              linear-gradient(to top left, transparent 49.6%, rgba(168,122,60,.35) 50%, transparent 50.4%);
}
.env-flap {
  z-index: 4;
  height: 60%;
  background: linear-gradient(180deg, #efe4cc, #d9c8a6);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  transform-origin: top center;
  transition: transform .9s cubic-bezier(.5,0,.3,1), z-index 0s .45s;
}
.intro.opening .env-flap { transform: rotateX(180deg); z-index: 1; }

.letter {
  position: absolute; left: 6%; right: 6%; top: 5%; bottom: 5%;
  z-index: 2;
  background: var(--ivory);
  border-radius: 4px;
  padding: 8px;
  transition: transform 1.1s cubic-bezier(.3,.8,.3,1);
  box-shadow: 0 -4px 16px rgba(0,0,0,.12);
}
.letter-inner {
  height: 100%; border: 1px solid var(--gold-soft); border-radius: 2px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  text-align: center; color: var(--ink);
}
.letter-names { font-family: var(--script); font-size: clamp(1.4rem, 6vw, 1.9rem); line-height: 1; }
.letter-names .amp { font-size: .7em; }
.letter-date { font-size: .65rem; letter-spacing: .3em; color: var(--muted); }
.letter-timer { font-family: var(--serif); font-size: .72rem; color: #8a6326; }
.intro.letter-out .letter { transform: translateY(-62%); }

.seal {
  position: absolute; z-index: 5;
  left: 50%; top: 60%;
  width: 72px; height: 72px;
  transform: translate(-50%, -50%);
}
.seal-half {
  position: absolute; inset: 0; border-radius: 50%;
  background:
    radial-gradient(circle at 35% 30%, #f2d79c 0%, #c9993f 38%, #8c6121 75%, #6d4913 100%);
  box-shadow: inset 0 0 0 4px rgba(255,255,255,.08), inset 0 -4px 10px rgba(0,0,0,.35), 0 4px 10px rgba(0,0,0,.35);
  display: grid; place-items: center;
  transition: transform .9s cubic-bezier(.5,0,.7,.3), opacity .9s;
}
.seal-half::before {
  content: ""; position: absolute; inset: 7px; border-radius: 50%;
  border: 1.5px dashed rgba(255,236,190,.55);
}
.seal-half.left  { clip-path: polygon(0 0, 52% 0, 45% 28%, 56% 50%, 44% 72%, 52% 100%, 0 100%); }
.seal-half.right { clip-path: polygon(52% 0, 100% 0, 100% 100%, 52% 100%, 44% 72%, 56% 50%, 45% 28%); }
.seal-text { font-family: var(--serif); font-size: 1.25rem; color: #fff3d6; text-shadow: 0 1px 2px rgba(0,0,0,.45); letter-spacing: .02em; }
.envelope:hover .seal { animation: wiggle .6s ease; }
@keyframes wiggle { 30% { transform: translate(-50%,-50%) rotate(-8deg) scale(1.06); } 60% { transform: translate(-50%,-50%) rotate(6deg) scale(1.06); } }
.intro.cracked .seal-half.left  { transform: translate(-40px, 180px) rotate(-70deg); opacity: 0; }
.intro.cracked .seal-half.right { transform: translate(40px, 200px) rotate(80deg); opacity: 0; }

/* ============ Controls ============ */
.controls { position: fixed; top: max(14px, env(safe-area-inset-top)); right: 14px; z-index: 40; }
.lang { display: flex; border: 1px solid var(--gold-soft); border-radius: 999px; overflow: hidden; backdrop-filter: blur(8px); background: rgba(15,46,39,.55); }
.lang button { background: none; border: 0; color: var(--ivory); padding: 7px 12px; font-size: .72rem; letter-spacing: .15em; }
.lang button.active { background: var(--gold); color: var(--emerald); font-weight: 600; }

.music-btn {
  position: fixed; z-index: 40; right: 16px; bottom: max(18px, env(safe-area-inset-bottom));
  width: 52px; height: 52px; border-radius: 50%;
  border: 1px solid var(--gold); color: var(--gold);
  background: rgba(15,46,39,.7); backdrop-filter: blur(8px);
  display: grid; place-items: center;
  box-shadow: 0 6px 24px rgba(0,0,0,.35);
  opacity: 0; transform: scale(.6); transition: opacity .5s, transform .5s;
}
body.opened .music-btn { opacity: 1; transform: none; }
.music-btn .bars { display: none; gap: 3px; align-items: flex-end; height: 18px; }
.music-btn .bars i { width: 3px; background: var(--gold); border-radius: 2px; animation: bar 1s ease-in-out infinite; }
.music-btn .bars i:nth-child(2) { animation-delay: -.3s; }
.music-btn .bars i:nth-child(3) { animation-delay: -.6s; }
.music-btn .bars i:nth-child(4) { animation-delay: -.15s; }
@keyframes bar { 0%,100% { height: 4px; } 50% { height: 18px; } }
.music-btn.playing .bars { display: flex; }
.music-btn.playing .note { display: none; }
.music-btn.unavailable { display: none; }

/* ============ Layout ============ */
main { position: relative; z-index: 1; max-width: 640px; margin: 0 auto; padding: 0 16px 80px; overflow-x: clip; }

/* Живые цветы (фото с прозрачным фоном) */
.bloom { position: absolute; pointer-events: none; z-index: 3; height: auto; filter: drop-shadow(0 10px 12px rgba(0,0,0,.35)) drop-shadow(0 2px 3px rgba(0,0,0,.3)); }
.bloom-bl { width: min(48vw, 186px); left: -36%; bottom: -9%; transform: rotate(-12deg); }
.bloom-tr { width: min(34vw, 136px); right: -24%; top: 42%; transform: rotate(78deg); }
.card .bloom { z-index: 2; }
.corner-tl { width: min(38vw, 160px); left: -40px; top: -62px; transform: rotate(-22deg); }
.card.invite { padding-top: 88px; padding-bottom: 70px; }
.card.location { padding-top: 70px; }
.corner-br { width: min(42vw, 170px); right: -34px; bottom: -64px; transform: scaleX(-1) rotate(-8deg); }
.corner-tr { width: min(38vw, 160px); right: -40px; top: -58px; transform: scaleX(-1) rotate(-14deg); }
.foot-bloom { position: relative; display: block; width: min(64vw, 240px); margin: -34px auto -6px; filter: drop-shadow(0 8px 10px rgba(0,0,0,.4)); }
footer { position: relative; }
footer .foot-seal { position: relative; z-index: 4; }

/* Пара голубей над аркой */
.doves { position: relative; width: min(100%, 320px); height: min(21vw, 84px); margin-bottom: 6px; z-index: 4; }
.dove { position: absolute; top: 0; width: min(27vw, 112px); height: auto; opacity: 0; filter: drop-shadow(0 8px 10px rgba(0,0,0,.35)); }
.dove-l { left: 0; --fx: 1; --from: -60vw; }
.dove-r { right: 0; --fx: -1; --from: 60vw; }
body.opened .dove { animation: doveIn 2.6s cubic-bezier(.2,.8,.25,1) .5s forwards, doveHover 3.4s ease-in-out 3.1s infinite; }
.dove-r { animation-delay: .75s, 3.4s !important; }
@keyframes doveIn {
  from { opacity: 0; transform: translate(var(--from), -40px) scaleX(var(--fx)) rotate(-12deg); }
  to { opacity: 1; transform: translate(0, 0) scaleX(var(--fx)) rotate(0deg); }
}
@keyframes doveHover {
  0%, 100% { opacity: 1; transform: translate(0, 0) scaleX(var(--fx)) rotate(0deg); }
  50% { opacity: 1; transform: translate(0, -9px) scaleX(var(--fx)) scaleY(.94) rotate(-3deg); }
}
section { margin: 0 auto 72px; text-align: center; }
h2 { font-family: var(--script); font-weight: 400; font-size: clamp(2.4rem, 10vw, 3.2rem); line-height: 1.2; margin-bottom: 18px; }

.reveal { opacity: 0; transform: translateY(28px); transition: opacity 1s ease, transform 1s cubic-bezier(.2,.7,.2,1); }
.reveal.in { opacity: 1; transform: none; }

/* Hero */
.hero { min-height: 100svh; overflow: visible; display: flex; flex-direction: column; align-items: center; justify-content: center; padding-top: 70px; margin-bottom: 40px; position: relative; }
.guest { font-family: var(--serif); font-style: italic; color: var(--ivory); font-size: 1.1rem; margin-bottom: 10px; }
.kicker { font-size: .72rem; letter-spacing: .38em; text-transform: uppercase; color: var(--gold); margin-bottom: 26px; }
/* Объёмная золотая рама */
.arch {
  position: relative;
  width: min(64vw, 260px); aspect-ratio: 3 / 4;
  border-radius: 999px 999px 14px 14px;
  padding: 11px; margin-bottom: 30px;
  background: var(--gold-grad); background-size: 260% 260%;
  background-position: calc(var(--glint) * 1%) 30%;
  box-shadow:
    0 2px 2px rgba(0,0,0,.2), 0 8px 12px rgba(0,0,0,.25), 0 24px 44px rgba(0,0,0,.45),
    inset 0 2px 1px rgba(255,248,220,.75), inset 0 -3px 4px rgba(60,35,5,.55), inset 0 0 0 1px rgba(90,60,20,.5);
}
.arch::before {
  content: ""; position: absolute; inset: -12px; border-radius: 999px 999px 20px 20px;
  border: 1px solid var(--gold-soft);
}
.arch-inner {
  width: 100%; height: 100%; border-radius: 999px 999px 6px 6px; overflow: hidden;
  background: radial-gradient(circle at 50% 35%, var(--emerald-3), #0b2621);
  display: grid; place-items: center; position: relative;
  box-shadow: inset 0 5px 16px rgba(0,0,0,.7), inset 0 0 0 1px rgba(40,25,5,.6);
}
.arch-inner::after { content: ""; position: absolute; inset: 0; pointer-events: none; border-radius: inherit; box-shadow: inset 0 6px 18px rgba(0,0,0,.55); }
/* Украшение внутри арки: мягкий свет, золотой гирих, внутренний контур, венок */
.arch-inner {
  background:
    radial-gradient(90% 55% at 50% 30%, rgba(255,226,160,.22), transparent 70%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='56' viewBox='0 0 56 56'%3E%3Cg fill='none' stroke='%23d4af6a' stroke-width='.8' opacity='.28'%3E%3Crect x='16' y='16' width='24' height='24'/%3E%3Crect x='16' y='16' width='24' height='24' transform='rotate(45 28 28)'/%3E%3Ccircle cx='28' cy='28' r='4'/%3E%3Cpath d='M0 28h8M48 28h8M28 0v8M28 48v8'/%3E%3C/g%3E%3C/svg%3E") center / 42px 42px,
    radial-gradient(circle at 50% 35%, var(--emerald-3), #0b2621);
}
.arch-inner::before {
  content: ""; position: absolute; inset: 12px; z-index: 1; pointer-events: none;
  border-radius: 999px 999px 4px 4px; border: 1px solid rgba(212,175,106,.55);
  box-shadow: 0 0 0 4px rgba(11,38,33,.55), 0 0 0 5px rgba(212,175,106,.3);
}
.arch-deco { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.wreath { width: 78%; height: auto; margin-top: -4%; filter: drop-shadow(0 2px 3px rgba(0,0,0,.5)); }
.arch-inner img.ok ~ .arch-deco, .arch-inner img.ok ~ .monogram { display: none; }
.arch-inner .monogram { position: relative; z-index: 2; margin-top: -6%; }
.bloom-top { width: min(40vw, 160px); left: 50%; top: -9%; transform: translateX(-50%) rotate(-4deg); z-index: 4; }
.seal-img { display: block; pointer-events: none; filter: drop-shadow(0 6px 8px rgba(0,0,0,.45)); }
.seal-img[hidden] { display: none; }
.hero-seal { position: absolute; left: 50%; bottom: 0; width: 78px; transform: translate(-50%, 50%); z-index: 5; }
.arch:has(.hero-seal:not([hidden])) { margin-bottom: 52px; }
.foot-seal { width: 74px; margin: 0 auto 6px; }
.arch-inner img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: none; transform: scale(1.08); transition: transform 8s ease-out; }
.arch-inner img.ok { display: block; }
.reveal.in .arch-inner img, .arch.in .arch-inner img { transform: scale(1); }
.monogram { font-family: var(--script); font-size: clamp(3.2rem, 16vw, 4.6rem); padding: .32em .45em .18em .3em; }
.arch-inner img.ok + .monogram { display: none; }

.names { font-weight: 400; display: flex; flex-direction: column; align-items: center; line-height: 1; }
.names .name {
  font-family: var(--script); font-size: clamp(3.2rem, 15vw, 5.6rem); padding: .32em .2em .18em;
  clip-path: inset(-40% 100% -40% -10%); transition: clip-path 1.8s cubic-bezier(.6,0,.2,1), opacity .2s;
  opacity: 1; transform: none;
}
.names .name.in { clip-path: inset(-40% -10% -40% -10%); }
.names .name + .heart + .name { transition-delay: .6s; }
.heart { font-family: var(--serif); font-style: italic; color: var(--gold); font-size: clamp(1.6rem, 6vw, 2.2rem); margin: 6px 0; }
.hero-date { font-family: var(--serif); letter-spacing: .3em; font-size: clamp(1rem, 4.4vw, 1.3rem); margin-top: 6px; }

.scroll-cue { position: relative; margin-top: 34px; width: 22px; height: 36px; border: 1px solid var(--gold-soft); border-radius: 12px; }
.scroll-cue span { position: absolute; left: 50%; top: 7px; width: 3px; height: 7px; margin-left: -1.5px; border-radius: 2px; background: var(--gold); animation: cue 1.8s ease-in-out infinite; }
@keyframes cue { 0% { opacity: 0; transform: translateY(0); } 30% { opacity: 1; } 100% { opacity: 0; transform: translateY(12px); } }

/* Ornament */
.ornament { display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--gold); margin: 18px auto; width: min(100%, 280px); }
.ornament::before, .ornament::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, transparent, var(--gold)); }
.ornament::after { background: linear-gradient(270deg, transparent, var(--gold)); }
.ornament svg { width: 34px; height: 34px; flex: none; }
.ornament.small { margin: 0; width: 70%; }
.ornament.small svg { width: 18px; height: 18px; }

/* Ivory card */
/* Хлопковая бумага: фактура, рваный край, реалистичная тень */
.card {
  position: relative; isolation: isolate;
  color: var(--ink);
  padding: 44px 24px;
  filter: drop-shadow(0 1px 1px rgba(0,0,0,.18)) drop-shadow(0 6px 8px rgba(0,0,0,.22)) drop-shadow(0 22px 30px rgba(0,0,0,.35));
}
.card::after {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background-color: #f5eee0;
  background-image:
    linear-gradient(160deg, rgba(255,255,255,.4), rgba(255,255,255,0) 45%, rgba(90,60,20,.06)),
    var(--tex-paper, none);
  background-size: 100% 100%, var(--tex-tile, 256px) var(--tex-tile, 256px);
  border-radius: 4px;
  -webkit-mask: var(--deckle, none) center / 100% 100% no-repeat;
  mask: var(--deckle, none) center / 100% 100% no-repeat;
}
.card::before { content: ""; position: absolute; inset: 12px; border: 1px solid rgba(184,137,74,.45); pointer-events: none; }
.card h2 { background: var(--gold-grad-paper); background-size: 260% 100%; background-position: calc(var(--glint) * 1%) 50%; -webkit-background-clip: text; background-clip: text; filter: drop-shadow(0 1px 0 rgba(255,255,255,.7)); }
/* Вдавленная печать текста (letterpress) */
.card .message, .card .big, .card .hosts, .card .small, .card .respect, .card .label { text-shadow: 0 1px 0 rgba(255,255,255,.8), 0 -1px 0 rgba(60,40,10,.12); }
.card .ornament { color: #b8894a; }
.message { font-family: var(--serif); font-size: 1.08rem; line-height: 1.75; color: var(--ink); max-width: 440px; margin: 0 auto 30px; }
.details { display: flex; justify-content: center; align-items: stretch; gap: 16px; }
.detail { flex: 1; min-width: 0; }
.vline { width: 1px; background: linear-gradient(transparent, #c89a52, transparent); }
.label { font-size: .66rem; letter-spacing: .3em; text-transform: uppercase; color: #a87a3c; margin-bottom: 8px; }
.big { font-family: var(--serif); font-size: 1.2rem; color: var(--ink); line-height: 1.3; overflow-wrap: anywhere; }
.small { font-size: .82rem; color: var(--muted); margin-top: 6px; line-height: 1.5; }
.respect { font-family: var(--serif); font-style: italic; color: var(--muted); }
.hosts { font-family: var(--serif); font-size: 1.2rem; margin-top: 4px; color: var(--ink); }

/* Countdown: split-flap табло */
.countdown h2 { margin-bottom: 26px; }
.timer { display: grid; grid-template-columns: repeat(4, 1fr); gap: clamp(8px, 2.6vw, 16px); max-width: 480px; margin: 0 auto; }
.unit span {
  display: block; margin-top: 12px; font-size: .6rem; font-weight: 500; letter-spacing: .28em; text-transform: uppercase;
  background: var(--gold-grad); background-size: 260% 100%; background-position: calc(var(--glint) * 1%) 50%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
/* золотая окантовка плитки */
.flap-frame {
  position: relative; padding: 3px; border-radius: 14px;
  background: var(--gold-grad); background-size: 260% 260%; background-position: calc(var(--glint) * 1%) 30%;
  box-shadow: 0 2px 3px rgba(0,0,0,.35), 0 14px 26px rgba(0,0,0,.5), inset 0 1px 1px rgba(255,248,220,.7), inset 0 -1px 2px rgba(60,35,5,.6);
}
.flap {
  position: relative; height: clamp(70px, 21vw, 100px); perspective: 900px;
  font-family: var(--serif); font-size: clamp(2.3rem, 11vw, 3.6rem); line-height: 1;
  font-variant-numeric: lining-nums tabular-nums; font-feature-settings: "lnum" 1, "tnum" 1;
  border-radius: 11px; overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.55);
}
.flap .half, .flap .leaf { position: absolute; left: 0; right: 0; height: 50%; overflow: hidden; }
.flap .top, .flap .front { top: 0; background: linear-gradient(180deg, #1f5a4a 0%, #15453a 100%); }
.flap .bottom, .flap .back { bottom: 0; background: linear-gradient(180deg, #0f3a30 0%, #0a2a23 100%); }
.flap b { position: absolute; left: 0; right: 0; height: 200%; display: flex; align-items: center; justify-content: center; font-weight: 400; }
.flap .top b, .flap .front b { top: 0; }
.flap .bottom b, .flap .back b { bottom: 0; }
/* глянец лака сверху и лёгкая тень у шарнира */
.flap .top::after, .flap .front::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(180deg, rgba(255,255,255,.14) 0%, rgba(255,255,255,.03) 45%, rgba(0,0,0,.28) 100%);
}
.flap .bottom::before, .flap .back::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 1;
  background: linear-gradient(180deg, rgba(0,0,0,.35) 0%, rgba(0,0,0,0) 30%, rgba(255,255,255,.04) 100%);
}
.flap .front { z-index: 3; transform-origin: 50% 100%; backface-visibility: hidden; visibility: hidden; }
.flap .back { z-index: 3; transform-origin: 50% 0; transform: rotateX(90deg); backface-visibility: hidden; }
.flap.flipping .front { visibility: visible; animation: flipTop .3s ease-in forwards; }
.flap.flipping .back { animation: flipBottom .34s .3s cubic-bezier(.3,1.35,.55,1) both; }
.flap.flipping .bottom::after { content: ""; position: absolute; inset: 0; background: rgba(0,0,0,.45); animation: shadeOut .64s forwards; }
@keyframes flipTop { to { transform: rotateX(-90deg); filter: brightness(.55); } }
@keyframes flipBottom { from { transform: rotateX(90deg); filter: brightness(1.5); } to { transform: rotateX(0); filter: none; } }
@keyframes shadeOut { to { opacity: 0; } }
/* шарнир: тёмная щель + золотые штифты по бокам */
.flap::after {
  content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 2px; margin-top: -1px; z-index: 4;
  background: #04120e; box-shadow: 0 1px 0 rgba(255,255,255,.07);
}
.flap-frame::before, .flap-frame::after {
  content: ""; position: absolute; top: 50%; width: 5px; height: 12px; margin-top: -6px; z-index: 5; border-radius: 2px;
  background: linear-gradient(90deg, #7a5421, #f3dca3 50%, #8a6128);
  box-shadow: 0 1px 2px rgba(0,0,0,.6);
}
.flap-frame::before { left: 0; }
.flap-frame::after { right: 0; }
.timer-done { font-family: var(--serif); font-size: 1.3rem; color: var(--gold); margin-top: 8px; }

/* Location */
.map { margin: 22px 0 18px; border-radius: 12px; overflow: hidden; border: 1px solid var(--gold-soft); aspect-ratio: 4 / 3; background: var(--ivory-2); }
.map iframe { width: 100%; height: 100%; border: 0; display: block; }
.map-btns { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 12px 22px; border-radius: 999px; border: 1px solid #b8894a;
  background: linear-gradient(100deg, #b8894a, #e3c683, #b8894a); background-size: 200% auto;
  color: var(--emerald); font-weight: 600; font-size: .78rem; letter-spacing: .12em; text-transform: uppercase;
  text-decoration: none; transition: background-position .6s, transform .2s;
}
.btn:hover { background-position: 100% center; }
.btn:active { transform: scale(.97); }
.btn.ghost { background: transparent; color: #8a6326; }
.btn:disabled { opacity: .6; cursor: default; }

/* Wishes */
.wishes .sub { color: var(--ivory-2); opacity: .8; margin: -8px 0 22px; font-size: .9rem; }
.wish-form { display: flex; flex-direction: column; gap: 12px; padding: 26px 20px; text-align: left; }
.wish-form input, .wish-form textarea {
  position: relative; z-index: 1;
  width: 100%; font: inherit; font-size: 16px; color: var(--ink);
  background: #fffaf0; border: 1px solid #e0d2b4; border-radius: 10px; padding: 12px 14px; resize: vertical;
  transition: border-color .2s, box-shadow .2s;
}
.wish-form input:focus, .wish-form textarea:focus { outline: none; border-color: #b8894a; box-shadow: 0 0 0 3px rgba(184,137,74,.2); }
.form-row { display: flex; justify-content: space-between; align-items: center; position: relative; z-index: 1; }
.counter { font-size: .75rem; color: var(--muted); }
.form-status { font-size: .85rem; color: #1d6b4f; min-height: 1.2em; text-align: center; }
.form-status.err { color: #a33a2c; }

.wish-list { list-style: none; margin-top: 22px; display: flex; flex-direction: column; gap: 12px; text-align: left; }
.wish {
  background: rgba(246,239,226,.06); border: 1px solid var(--gold-soft); border-radius: 14px; padding: 16px 18px;
  animation: wishIn .7s cubic-bezier(.2,.7,.2,1);
}
@keyframes wishIn { from { opacity: 0; transform: translateY(-12px) scale(.98); } }
.wish-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 6px; }
.wish-name { font-family: var(--serif); color: var(--gold); font-size: 1.05rem; overflow-wrap: anywhere; }
.wish-time { font-size: .7rem; color: var(--ivory-2); opacity: .6; white-space: nowrap; }
.wish-text { font-size: .92rem; line-height: 1.6; color: var(--ivory); white-space: pre-wrap; overflow-wrap: anywhere; }
.wish.pending { border-style: dashed; opacity: .75; }
.wish.pending .wish-time { color: var(--gold); opacity: 1; letter-spacing: .08em; }
.wish-form .hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.wish-empty { text-align: center; color: var(--ivory-2); opacity: .7; font-style: italic; font-family: var(--serif); }

/* Footer */
footer { text-align: center; padding-top: 10px; }
.foot-names { font-family: var(--script); font-size: 2.2rem; }
.views { display: inline-flex; align-items: center; gap: 8px; margin-top: 14px; padding: 8px 16px; border: 1px solid var(--gold-soft); border-radius: 999px; font-size: .82rem; color: var(--ivory-2); }
.views svg { color: var(--gold); }
.demo { margin-top: 14px; font-size: .72rem; color: var(--ivory-2); opacity: .55; }

@media (min-width: 700px) {
  .card { padding: 52px 44px; }
  section { margin-bottom: 96px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: .01s !important; transition-delay: 0s !important; }
  .names .name { clip-path: none; }
}
