:root {
  --ink: #080808;
  --ink-soft: #11100e;
  --gold: #d6a347;
  --gold-light: #f2d9ac;
  --gold-bright: #ffcf72;
  --wine: #9e252b;
  --cream: #f8ead0;
  --muted: #c9bda7;
  --line: rgba(214, 163, 71, .7);
  --shadow: 0 20px 70px rgba(0,0,0,.55);
  --amazon-orange: #ff9900;
}
* { box-sizing: border-box; }
html { min-height: 100%; background: #050505; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; color: var(--cream); background:
    radial-gradient(ellipse at 50% 0%, rgba(126,73,23,.22), transparent 48%),
    linear-gradient(135deg, #070707, #17100a 55%, #060606);
  font-family: "DM Sans", sans-serif; padding: 24px;
  -webkit-tap-highlight-color: transparent;
}
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; opacity: .18;
  background-image: url("../assets/images/city-night.png");
  background-position: center; background-size: cover; mix-blend-mode: screen;
  filter: saturate(.7); z-index: 0;
}
.grain { position: fixed; inset: 0; pointer-events: none; z-index: 3; opacity: .05;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.4'/%3E%3C/svg%3E");
}
.invitation-shell {
  max-width: 1200px; margin: 0 auto; position: relative; overflow: hidden;
  background: linear-gradient(145deg, rgba(8,8,8,.97), rgba(15,10,7,.96));
  border: 1px solid var(--gold); box-shadow: var(--shadow);
}
.frame { position: absolute; pointer-events: none; z-index: 2; inset: 8px; border: 1px solid rgba(214,163,71,.75); }
.frame::before, .frame::after { content: "✦"; position: absolute; color: var(--gold); font-size: 18px; top: -10px; background: var(--ink); padding: 0 10px; }
.frame::before { left: 18px; } .frame::after { right: 18px; }
.topline, .bottomline {
  position: relative; z-index: 4; display: flex; justify-content: space-between; gap: 14px;
  padding: 20px 34px; font: 11px "Cinzel", serif; letter-spacing: .18em; color: var(--gold-light);
}
.topline { border-bottom: 1px solid rgba(214,163,71,.35); }
.topline-right { text-align: right; }
.topline i { color: var(--gold); font-style: normal; padding: 0 8px; }
.topline b { color: var(--gold-bright); font-weight: 600; }
.bottomline { justify-content: center; align-items: center; border-top: 1px solid rgba(214,163,71,.35); color: var(--gold); text-align: center; }
.bottomline span { padding: 0 12px; }

/* ---------- Hero ---------- */
.hero { position: relative; isolation: isolate; min-height: 760px; display: grid; place-items: center; overflow: hidden; }
.hero::before {
  content: ""; position: absolute; inset: 0; z-index: -2;
  background: linear-gradient(90deg, rgba(0,0,0,.04), rgba(0,0,0,.88) 34%, rgba(0,0,0,.88) 66%, rgba(0,0,0,.08)),
    radial-gradient(ellipse at 50% 45%, rgba(109,58,18,.25), transparent 62%);
}
.hero::after { content: ""; position: absolute; inset: 18px; border: 1px solid rgba(214,163,71,.3); pointer-events: none; z-index: -1; }
.cast { position: absolute; inset: 0; z-index: -3; }
.character { position: absolute; height: 95%; max-height: 760px; width: auto; object-fit: contain; filter: drop-shadow(0 0 24px rgba(0,0,0,.6)); opacity: .93; bottom: 0; transition: opacity .8s; }
.character-flapper { left: -3%; object-position: left bottom; }
.character-gentleman { right: -2%; height: 82%; opacity: .8; }
.hero-content { width: min(620px, 100%); padding: 54px 30px 44px; text-align: center; position: relative; z-index: 1; }

/* ---------- Birthday title ---------- */
.date-badge {
  display: inline-flex; align-items: center; gap: 8px; margin: 0 0 18px; padding: 6px 14px 6px 6px;
  border: 1px solid var(--line); border-radius: 999px; background: rgba(0,0,0,.6);
  font: 600 11px "Cinzel", serif; letter-spacing: .2em; color: var(--gold-light);
}
.date-badge span { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--wine); color: var(--gold-light); letter-spacing: 0; font-size: 11px; border: 1px solid var(--gold); }
.date-badge i { color: var(--gold); font-style: normal; }
.birthday-title { position: relative; margin: 0; font-weight: 400; cursor: pointer; user-select: none; }
.bt-kicker {
  display: block; font: 500 clamp(22px, 3.6vw, 36px) "Cinzel", serif; text-transform: uppercase;
  letter-spacing: .08em; color: var(--gold-light); text-shadow: 0 2px 18px rgba(214,163,71,.18);
}
.bt-name {
  display: inline-block; padding: .08em .22em .12em; margin-top: -.08em;
  font: 400 clamp(76px, 11vw, 132px) "Great Vibes", cursive; line-height: 1.05;
  background: linear-gradient(100deg, #b07a26 15%, #ffe3a3 35%, #fff8e6 45%, #ffcf72 55%, #b07a26 80%);
  background-size: 250% 100%; -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 18px rgba(255,207,114,.28));
  animation: shimmer 5s linear infinite;
}
.sparkle { position: absolute; color: var(--gold-bright); pointer-events: none; animation: twinkle 2.4s ease-in-out infinite; text-shadow: 0 0 10px rgba(255,207,114,.8); }
.s1 { top: 38%; left: 6%; font-size: 20px; }
.s2 { top: 50%; right: 4%; font-size: 26px; animation-delay: .8s; }
.s3 { bottom: 4%; left: 22%; font-size: 14px; animation-delay: 1.5s; }
.ornament { color: var(--gold); font-size: 12px; letter-spacing: .2em; margin: 14px 0 22px; }
.eyebrow { color: var(--gold); text-transform: uppercase; font-size: 11px; letter-spacing: .24em; margin: 0 0 16px; }
.eyebrow span { display: inline-block; width: 28px; height: 1px; vertical-align: middle; background: var(--gold); margin: 0 9px; }
h2 { font-family: "Cinzel", serif; font-weight: 500; text-transform: uppercase; }
h2 em { font-family: "Great Vibes", cursive; text-transform: none; font-weight: 400; color: var(--gold-bright); font-size: 1.3em; }
.intro-copy { max-width: 420px; margin: 0 auto 10px; line-height: 1.7; font-size: 15px; color: #f2e8d5; }
.intro-copy-small { color: var(--muted); font-size: 13px; }

/* ---------- Locked state ---------- */
.sealed-note { margin: 34px auto 18px; padding: 24px 20px 18px; max-width: 440px; border: 1px solid var(--line); outline: 1px solid rgba(214,163,71,.18); outline-offset: 5px; background: rgba(5,5,5,.78); position: relative; }
.seal { position: absolute; width: 38px; height: 38px; border: 1px solid var(--gold); border-radius: 50%; top: -20px; left: calc(50% - 19px); display: grid; place-items: center; background: var(--wine); color: var(--gold-light); box-shadow: 0 0 0 4px #080808; }
.sealed-note .eyebrow { margin: 7px 0 10px; }
.sealed-note h2 { font-size: clamp(20px, 3vw, 28px); line-height: 1.35; margin: 0; }
.sealed-note h2 span { color: var(--gold); }
.note-copy { color: var(--muted); font-size: 13px; margin: 10px 0 0; }
.countdown-card { max-width: 470px; margin: 0 auto; padding: 16px 14px 14px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.countdown-label { margin: 0 0 13px; font: 12px "Cinzel", serif; letter-spacing: .16em; color: var(--gold-light); }
.countdown { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.time-unit { min-width: 0; padding: 11px 4px 9px; border: 1px solid var(--gold); background: linear-gradient(150deg, rgba(214,163,71,.09), rgba(0,0,0,.5)); position: relative; }
.time-unit::before, .time-unit::after { content: "◆"; color: var(--gold); font-size: 6px; position: absolute; top: calc(50% - 3px); }
.time-unit::before { left: -3px; } .time-unit::after { right: -3px; }
.time-unit strong { display: block; color: var(--gold-bright); font: 500 clamp(26px, 4vw, 38px) "Cinzel", serif; line-height: 1.1; font-variant-numeric: tabular-nums; }
.time-unit span { display: block; color: var(--muted); font-size: 10px; letter-spacing: .14em; margin-top: 7px; }
.event-time { margin-top: 15px; color: var(--muted); font-size: 12px; line-height: 1.7; }
.event-time span { color: var(--gold); font-size: 17px; vertical-align: -1px; margin-right: 5px; }
.event-time b { color: var(--gold); padding: 0 8px; }

.mystery-card {
  position: relative; overflow: hidden; margin: 26px auto 0; max-width: 340px; aspect-ratio: 1.586;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--gold); border-radius: 14px;
  background: linear-gradient(135deg, #1a1208, #070707 60%, #1a1208);
  box-shadow: inset 0 0 0 6px rgba(0,0,0,.6), inset 0 0 0 7px rgba(214,163,71,.35), 0 12px 30px rgba(0,0,0,.5);
}
.mystery-pattern {
  position: absolute; inset: 0; opacity: .14;
  background: repeating-linear-gradient(45deg, var(--gold) 0 1px, transparent 1px 14px),
              repeating-linear-gradient(-45deg, var(--gold) 0 1px, transparent 1px 14px);
}
.mystery-card::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(105deg, transparent 35%, rgba(255,230,170,.18) 50%, transparent 65%);
  background-size: 250% 100%; animation: shimmer 4s linear infinite;
}
.mystery-lock { position: relative; display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; color: var(--gold-light); background: var(--wine); border: 1px solid var(--gold); box-shadow: 0 0 0 4px rgba(0,0,0,.7); animation: pulse 2.6s ease-in-out infinite; }
.mystery-label { position: relative; margin: 6px 0 0; font: 600 11px "Cinzel", serif; letter-spacing: .24em; color: var(--gold-light); }
.mystery-amount { position: relative; margin: -2px 0 2px; font: 40px "Great Vibes", cursive; line-height: 1.1; color: var(--gold-bright); text-shadow: 0 0 14px rgba(255,207,114,.35); }
.mystery-hint { position: relative; margin: 0; font-size: 11px; color: var(--muted); }

.signature { font-size: 13px; line-height: 1.8; color: var(--muted); margin: 24px 0 0; }
.signature span { font: 32px "Great Vibes", cursive; color: var(--gold-light); }
.footer-note { font: 10px "Cinzel", serif; letter-spacing: .16em; color: rgba(214,163,71,.7); margin: 26px 0 0; }

/* ---------- Revealed state ---------- */
.reveal-panel { margin: 30px auto 0; max-width: 480px; padding: 26px 20px; border: 1px solid var(--gold); background: linear-gradient(145deg, rgba(17,12,7,.97), rgba(0,0,0,.97)); box-shadow: 0 0 0 5px rgba(214,163,71,.08), 0 0 35px rgba(214,163,71,.1); animation: reveal-in .9s cubic-bezier(.2,.8,.2,1) both; }
.reveal-panel h2 { font-size: clamp(24px, 4vw, 34px); line-height: 1.2; margin: 0 0 14px; color: var(--gold-light); }
.reveal-panel > p:not(.eyebrow):not(.signature) { font-size: 14px; line-height: 1.7; color: var(--muted); }
.gift-message { margin: 14px 0 22px; }

.scratch-wrap { position: relative; margin: 0 auto; max-width: 360px; aspect-ratio: 1.586; border-radius: 14px; }
.gift-card {
  position: absolute; inset: 0; overflow: hidden; border-radius: 14px; padding: 18px 20px;
  display: flex; flex-direction: column; justify-content: space-between; text-align: left;
  background: radial-gradient(ellipse at 85% 0%, rgba(255,153,0,.22), transparent 55%), linear-gradient(140deg, #232f3e, #131a22 70%);
  border: 1px solid var(--gold); box-shadow: 0 14px 34px rgba(0,0,0,.55);
}
.gift-card .gc-top { display: flex; justify-content: space-between; align-items: flex-start; }
.amazon-word { position: relative; font: 700 30px Arial, Helvetica, sans-serif; letter-spacing: -.02em; color: #fff; line-height: 1; padding-bottom: 10px; }
.amazon-word svg { position: absolute; left: 2px; bottom: 0; width: 88%; height: 12px; }
.gc-chip { font: 600 9px "Cinzel", serif; letter-spacing: .16em; color: var(--gold-light); border: 1px solid rgba(214,163,71,.6); padding: 4px 8px; border-radius: 999px; }
.gc-label { font-size: 10px; letter-spacing: .18em; color: #c9d3de; text-transform: uppercase; }
.gc-amount { font: 600 clamp(32px, 9vw, 42px) "Cinzel", serif; color: var(--gold-bright); line-height: 1.1; margin-top: 2px; }
.gc-bottom { display: flex; justify-content: space-between; align-items: flex-end; }
.gc-for { font: 22px "Great Vibes", cursive; color: var(--gold-light); }
.gc-region { font-size: 10px; color: #c9d3de; }
.scratch-canvas { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 14px; touch-action: none; cursor: grab; transition: opacity .7s; }
.scratch-canvas.is-cleared { opacity: 0; pointer-events: none; }
.link-button { margin: 12px auto 0; padding: 8px; background: none; border: 0; color: var(--gold); font: 12px "DM Sans", sans-serif; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }

.gift-actions { margin-top: 20px; animation: reveal-in .6s cubic-bezier(.2,.8,.2,1) both; }
.gift-button {
  display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 56px; padding: 14px 18px; width: 100%;
  color: #100b04; background: linear-gradient(110deg, #c38a2f, #ffe0a0, #c38a2f); background-size: 200% 100%;
  border: 1px solid #ffdc91; border-radius: 4px; font: 700 13px "Cinzel", serif; text-transform: uppercase; letter-spacing: .08em; text-decoration: none;
  box-shadow: 0 0 0 4px rgba(214,163,71,.12), 0 10px 26px rgba(214,163,71,.22);
  transition: transform .2s, filter .2s; animation: shimmer 3.5s linear infinite;
}
.gift-button:hover, .gift-button:active { transform: translateY(-2px); filter: brightness(1.1); }
.gift-button.is-disabled { filter: grayscale(.6) brightness(.7); }
.copy-button { margin-top: 10px; width: 100%; min-height: 46px; background: transparent; border: 1px solid var(--line); border-radius: 4px; color: var(--gold-light); font: 600 12px "DM Sans", sans-serif; letter-spacing: .06em; cursor: pointer; }
.gift-status { font-size: 12px; color: #cbb58d; line-height: 1.5; margin: 12px 0 0; }
.reveal-panel .signature { margin-top: 18px; }

body.is-revealed .character { opacity: .35; }
body.is-revealed .hero::before { background: linear-gradient(90deg, rgba(0,0,0,.15), rgba(0,0,0,.82) 30%, rgba(0,0,0,.82) 70%, rgba(0,0,0,.15)); }
[hidden] { display: none !important; }

/* ---------- Confetti ---------- */
.confetti-layer { position: fixed; inset: 0; pointer-events: none; z-index: 20; overflow: hidden; }
.confetti-piece { position: absolute; top: -20px; width: 8px; height: 14px; opacity: .95; animation: fall linear forwards; }

@keyframes reveal-in { from { opacity: 0; transform: translateY(18px) scale(.98); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -150% 0; } }
@keyframes twinkle { 0%, 100% { opacity: .2; transform: scale(.7) rotate(0); } 50% { opacity: 1; transform: scale(1.15) rotate(20deg); } }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 4px rgba(0,0,0,.7), 0 0 0 0 rgba(214,163,71,.4); } 50% { box-shadow: 0 0 0 4px rgba(0,0,0,.7), 0 0 0 12px rgba(214,163,71,0); } }
@keyframes fall { to { transform: translate3d(var(--drift), 110vh, 0) rotate(var(--spin)); } }

/* ---------- Mobile ---------- */
@media (max-width: 760px) {
  body { padding: 0; }
  body::before { opacity: .1; }
  .invitation-shell { border: 0; min-height: 100svh; }
  .frame { inset: 6px; }
  .frame::before, .frame::after { font-size: 14px; top: -8px; padding: 0 6px; }
  .topline { justify-content: center; padding: calc(16px + env(safe-area-inset-top)) 18px 14px; font-size: 10px; letter-spacing: .14em; }
  .topline > span:first-child { display: none; }
  .topline-right { text-align: center; }
  .hero { display: block; min-height: 0; }
  .hero::before { background: radial-gradient(ellipse at 50% 30%, rgba(109,58,18,.22), transparent 70%); }
  .hero::after { inset: 10px; }

  /* Retratos como díptico de ventanas art déco */
  .cast { position: relative; inset: auto; z-index: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 22px 22px 0; height: clamp(250px, 80vw, 420px); }
  .character, body.is-revealed .character {
    position: static; width: 100%; height: 100%; max-height: none; opacity: 1;
    object-fit: cover; object-position: 50% 8%; border-radius: 999px 999px 0 0;
    border: 1px solid var(--line); border-bottom: 0;
    -webkit-mask-image: linear-gradient(180deg, #000 55%, transparent 98%); mask-image: linear-gradient(180deg, #000 55%, transparent 98%);
  }
  .character-gentleman { object-position: 40% 4%; }

  .hero-content { margin-top: -78px; padding: 0 20px calc(34px + env(safe-area-inset-bottom)); }
  .date-badge { font-size: 10px; letter-spacing: .16em; }
  .bt-kicker { font-size: clamp(19px, 6vw, 26px); letter-spacing: .06em; }
  .bt-name { font-size: clamp(72px, 23vw, 104px); }
  .s1 { top: 40%; left: 2%; }
  .s2 { right: 1%; }
  .intro-copy { font-size: 15px; }
  .intro-copy-small { font-size: 13px; }
  .sealed-note { margin-top: 34px; padding: 22px 14px 16px; }
  .countdown-card { padding-left: 0; padding-right: 0; }
  .countdown { gap: 6px; }
  .time-unit { padding: 10px 2px 8px; }
  .time-unit strong { font-size: clamp(24px, 8vw, 32px); }
  .time-unit span { font-size: 10px; letter-spacing: .08em; }
  .event-time { font-size: 12px; }
  .event-time b { display: block; height: 0; overflow: hidden; }
  .reveal-panel { padding: 24px 16px; }
  .bottomline { padding: 16px 12px calc(16px + env(safe-area-inset-bottom)); font-size: 9px; letter-spacing: .08em; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  .confetti-layer { display: none; }
}
