:root {
  --ink: #120d0a;
  --ink-2: #1d1511;
  --smoke: #cfc3b8;
  --smoke-dim: #8a7d73;
  --ember: #ff8a3d;
  --ember-hot: #ffd27a;
  --rust: #a8421f;
  --dock-h: 64px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--ink);
}

body {
  min-height: 100svh;
  color: var(--smoke);
  font-family: "Special Elite", "Courier New", ui-monospace, monospace;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}

/* --- atmosphere --- */
.glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(120% 70% at 50% 0%, rgba(255, 138, 61, 0.20), transparent 60%),
    radial-gradient(90% 60% at 50% 30%, rgba(168, 66, 31, 0.18), transparent 70%),
    linear-gradient(180deg, #1b1310 0%, #120d0a 45%, #0b0807 100%);
  animation: breathe 6s ease-in-out infinite;
}

.grain {
  position: fixed;
  inset: -50%;
  z-index: 1;
  pointer-events: none;
  opacity: 0.05;
  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.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}

@keyframes breathe {
  0%, 100% { opacity: 0.9; }
  50% { opacity: 1; }
}

/* --- gift gate --- */
body:not(.is-open) { overflow: hidden; }

.gate {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: radial-gradient(90% 60% at 50% 40%, rgba(255, 138, 61, 0.16), transparent 70%), rgba(8, 6, 5, 0.96);
  transition: opacity 0.5s ease 0.3s, transform 0.6s ease 0.3s;
}

.gate.is-gone { display: none; }

body.is-open .gate {
  opacity: 0;
  transform: scale(1.2);
  pointer-events: none;
}

.gift {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.1rem;
  padding: 1rem 1.5rem 1.25rem;
  border: 0;
  background: transparent;
  color: var(--smoke);
  font-family: inherit;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

.gift-box {
  position: relative;
  width: 150px;
  height: 132px;
  filter: drop-shadow(0 18px 30px rgba(0, 0, 0, 0.55)) drop-shadow(0 0 34px rgba(255, 138, 61, 0.28));
  animation: nudge 2.8s ease-in-out infinite;
}

.gift-body {
  position: absolute;
  bottom: 0;
  left: 8px;
  width: 134px;
  height: 96px;
  border-radius: 4px 4px 6px 6px;
  background:
    linear-gradient(90deg, transparent 44%, rgba(255, 210, 122, 0.9) 44%, var(--ember) 50%, rgba(255, 210, 122, 0.9) 56%, transparent 56%),
    linear-gradient(170deg, #6d2515, #3a130b 60%, #250c07);
  box-shadow: inset -10px 0 18px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 210, 122, 0.15);
}

.gift-lid {
  position: absolute;
  top: 22px;
  left: 0;
  width: 150px;
  height: 30px;
  border-radius: 5px;
  background:
    linear-gradient(90deg, transparent 44%, rgba(255, 210, 122, 0.9) 44%, var(--ember) 50%, rgba(255, 210, 122, 0.9) 56%, transparent 56%),
    linear-gradient(180deg, #83301c, #4a180d);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 210, 122, 0.22);
  transition: transform 0.6s cubic-bezier(0.2, 0.9, 0.25, 1), opacity 0.6s ease;
}

body.is-open .gift-lid {
  transform: translate(18px, -70px) rotate(-16deg);
  opacity: 0;
}

/* bow: two loops + a knot */
.gift-bow {
  position: absolute;
  top: -24px;
  left: 50%;
  width: 0;
  height: 0;
}

.gift-bow i {
  position: absolute;
  top: -2px;
  width: 42px;
  height: 27px;
  background: linear-gradient(180deg, var(--ember-hot), var(--ember) 65%, var(--rust));
  box-shadow: inset 0 -4px 8px rgba(90, 30, 10, 0.45);
}

.gift-bow i:first-child {
  left: -40px;
  border-radius: 60% 30% 55% 45%;
  transform: rotate(-16deg);
  transform-origin: 100% 100%;
}

.gift-bow i:last-of-type {
  left: -2px;
  border-radius: 30% 60% 45% 55%;
  transform: rotate(16deg);
  transform-origin: 0 100%;
}

.gift-bow em {
  position: absolute;
  top: 13px;
  left: -8px;
  width: 16px;
  height: 15px;
  border-radius: 48% 48% 42% 42%;
  background: radial-gradient(circle at 40% 30%, #fff1cd, var(--ember) 60%, var(--rust));
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.35);
}

.gift-label {
  font-family: "Anton", "Arial Narrow", Impact, sans-serif;
  font-size: clamp(1.6rem, 9vw, 2.4rem);
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #f1e7dc;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.55), 0 0 26px rgba(255, 138, 61, 0.25);
}

.gift-hint {
  margin-top: -0.7rem;
  font-size: 0.7rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--smoke-dim);
}

@keyframes nudge {
  0%, 62%, 100% { transform: rotate(0deg); }
  68% { transform: rotate(-3.5deg); }
  74% { transform: rotate(3deg); }
  80% { transform: rotate(-2deg); }
  86% { transform: rotate(1deg); }
}

/* --- layout --- */
.stage {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 40rem;
  margin: 0 auto;
  padding: max(0.75rem, env(safe-area-inset-top)) 1.15rem calc(var(--dock-h) + env(safe-area-inset-bottom) + 1.5rem);
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.7s ease 0.25s, transform 0.7s ease 0.25s;
}

body.is-open .stage {
  opacity: 1;
  transform: none;
}

/* Hero + note together stay inside the first screen on phones. */
.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding-top: 0.25rem;
}

.kicker {
  margin: 0 0 0.5rem;
  font-size: 0.7rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--smoke-dim);
}

/* --- candle --- */
.candle {
  position: relative;
  width: 34px;
  height: 74px;
  margin-bottom: 0.35rem;
  filter: drop-shadow(0 0 18px rgba(255, 138, 61, 0.45));
}

.wax {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 22px;
  height: 46px;
  border-radius: 4px 4px 3px 3px;
  background: linear-gradient(180deg, #e8dcc9, #b9a892 55%, #8a7a66);
  box-shadow: inset -4px 0 6px rgba(0, 0, 0, 0.3);
}

.wick {
  position: absolute;
  bottom: 44px;
  left: 50%;
  transform: translateX(-50%);
  width: 2px;
  height: 7px;
  background: #2b201a;
}

.flame {
  position: absolute;
  bottom: 49px;
  left: 50%;
  width: 15px;
  height: 26px;
  margin-left: -7.5px;
  border-radius: 50% 50% 45% 45%;
  background: radial-gradient(ellipse at 50% 75%, #fff6d8 0%, var(--ember-hot) 35%, var(--ember) 65%, rgba(168, 66, 31, 0) 100%);
  transform-origin: 50% 100%;
  animation: flicker 2.6s ease-in-out infinite;
}

@keyframes flicker {
  0%, 100% { transform: scale(1, 1) rotate(-1deg); opacity: 0.95; }
  25% { transform: scale(0.94, 1.08) rotate(2deg); opacity: 1; }
  50% { transform: scale(1.05, 0.95) rotate(-2deg); opacity: 0.9; }
  75% { transform: scale(0.97, 1.04) rotate(1deg); opacity: 1; }
}

/* --- headline --- */
.headline {
  margin: 0.35rem 0 0;
  font-family: "Anton", "Arial Narrow", Impact, sans-serif;
  font-weight: 400;
  line-height: 0.88;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  display: flex;
  flex-direction: column;
}

.headline .line {
  font-size: clamp(2.6rem, 15vw, 5rem);
  color: #f1e7dc;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.55), 0 0 26px rgba(255, 138, 61, 0.18);
}

.headline .line-sm {
  font-size: clamp(1.8rem, 10vw, 3.3rem);
  letter-spacing: 0.02em;
}

.headline .age {
  color: var(--ember-hot);
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.55), 0 0 22px rgba(255, 138, 61, 0.4);
}

.headline .accent {
  background: linear-gradient(180deg, var(--ember-hot), var(--ember) 55%, var(--rust));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  text-shadow: none;
  filter: drop-shadow(0 0 20px rgba(255, 138, 61, 0.35));
}

.tagline {
  margin: 0.7rem 0 0;
  font-size: 0.82rem;
  color: var(--smoke-dim);
  letter-spacing: 0.05em;
}

/* --- written message --- */
.note {
  margin-top: 1rem;
  padding: 0.9rem 1rem;
  border: 1px solid rgba(207, 195, 184, 0.16);
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(29, 21, 17, 0.85), rgba(12, 9, 7, 0.85));
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 210, 122, 0.06);
  backdrop-filter: blur(2px);
  font-size: 1rem;
  line-height: 1.55;
  color: #ece1d6;
}

.note p { margin: 0 0 0.7rem; }
.note p:last-child { margin-bottom: 0; }

/* --- concert ticket --- */
.ticket {
  display: flex;
  align-items: stretch;
  margin-top: 0.9rem;
  border: 1px solid rgba(255, 138, 61, 0.35);
  border-radius: 10px;
  overflow: hidden;
  background: linear-gradient(100deg, rgba(168, 66, 31, 0.22), rgba(29, 21, 17, 0.9) 45%);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.45);
}

.ticket-stub {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  padding: 0.6rem 0.55rem;
  border-right: 1px dashed rgba(255, 210, 122, 0.45);
  background: rgba(0, 0, 0, 0.3);
  color: var(--ember-hot);
  font-size: 0.6rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.ticket-body {
  flex: 1 1 auto;
  padding: 0.6rem 0.85rem;
  text-align: left;
}

.ticket-body p { margin: 0; }

.ticket-kicker {
  font-size: 0.62rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--smoke-dim);
}

.ticket-act {
  font-family: "Anton", "Arial Narrow", Impact, sans-serif;
  font-size: 1.35rem;
  line-height: 1.1;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #f1e7dc;
}

.ticket-date {
  font-size: 0.88rem;
  letter-spacing: 0.1em;
  color: var(--ember);
}

.ticket-time { white-space: nowrap; }

.foot {
  margin-top: 1.25rem;
  text-align: center;
  font-size: 0.75rem;
  color: rgba(138, 125, 115, 0.85);
}

.foot p { margin: 0; }

/* --- player dock --- */
.player-dock {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 5;
  display: flex;
  justify-content: center;
  padding: 0.5rem 1rem calc(0.5rem + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, rgba(11, 8, 7, 0), rgba(11, 8, 7, 0.92) 45%);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.6s ease 0.5s;
}

body:not(.is-open) .player-dock { visibility: hidden; }

body.is-open .player-dock { opacity: 1; }

.sound-btn {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  min-height: 46px;
  padding: 0.5rem 1.1rem;
  border: 1px solid rgba(255, 138, 61, 0.5);
  border-radius: 999px;
  background: rgba(29, 21, 17, 0.9);
  color: var(--ember-hot);
  font-family: inherit;
  font-size: 0.8rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.5);
}

.sound-btn:active { transform: translateY(1px); }

.eq {
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
  height: 14px;
}

.eq i {
  width: 3px;
  height: 4px;
  background: var(--ember);
  border-radius: 1px;
}

.sound-btn.is-playing .eq i { animation: bounce 0.9s ease-in-out infinite; }
.sound-btn.is-playing .eq i:nth-child(2) { animation-delay: 0.15s; }
.sound-btn.is-playing .eq i:nth-child(3) { animation-delay: 0.3s; }
.sound-btn.is-playing .eq i:nth-child(4) { animation-delay: 0.45s; }

@keyframes bounce {
  0%, 100% { height: 4px; }
  50% { height: 14px; }
}

/* keep the iframe present but out of sight */
.yt-host {
  position: fixed;
  width: 1px;
  height: 1px;
  left: -9999px;
  top: 0;
  overflow: hidden;
  opacity: 0;
}

/* --- short phones: tighten so the note stays above the fold --- */
@media (max-height: 700px) {
  .candle { height: 58px; margin-bottom: 0.2rem; }
  .wax { height: 34px; }
  .wick { bottom: 32px; }
  .flame { bottom: 37px; }
  .headline .line { font-size: clamp(2.2rem, 12.5vw, 3.4rem); }
  .headline .line-sm { font-size: clamp(1.5rem, 8.5vw, 2.3rem); }
  .tagline { margin-top: 0.5rem; font-size: 0.76rem; }
  .note { margin-top: 0.8rem; }
  #message { min-height: 6rem; }
  .foot { margin-top: 0.9rem; }
}

@media (min-width: 40rem) {
  .stage { padding-top: 2rem; }
  .tagline { font-size: 0.95rem; }
  .foot { font-size: 0.85rem; }
}

@media (prefers-reduced-motion: reduce) {
  .flame, .glow, .eq i, .gift-box { animation: none !important; }
  .stage, .gate, .gift-lid { transition-duration: 0.2s; }
}
