@font-face { font-family: 'Bebas Neue'; src: url('../fonts/BebasNeue-Regular.ttf') format('truetype'); font-display: swap; }
@font-face { font-family: 'DM Serif Display'; src: url('../fonts/DMSerifDisplay-Regular.ttf') format('truetype'); font-display: swap; }
@font-face { font-family: 'DM Serif Display'; font-style: italic; src: url('../fonts/DMSerifDisplay-Italic.ttf') format('truetype'); font-display: swap; }
@font-face { font-family: 'DM Sans'; src: url('../fonts/DMSans-Variable.woff') format('woff'); font-weight: 100 1000; font-display: swap; }

:root {
  --teal: #1f5f6b; --deep: #123f4a; --coral: #e2583e; --mustard: #e9b44c; --cream: #f7eedd; --paper: #fbf5e8; --ink: #1f2a30; --muted: #5d6a70;
}
* { box-sizing: border-box; margin: 0; }
html, body { height: 100%; }
body {
  background: radial-gradient(ellipse at top, #2a7380, var(--deep) 75%);
  color: var(--ink); font-family: 'DM Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  overflow: hidden; -webkit-tap-highlight-color: transparent; overscroll-behavior: none;
}
#stage { position: relative; height: 100dvh; max-width: 480px; margin: 0 auto; overflow: hidden; }
.scene { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px;
  opacity: 0; visibility: hidden; transition: opacity .55s ease, visibility .55s; }
.scene.on { opacity: 1; visibility: visible; }

/* ---------- Envelope ---------- */
.kicker { font-family: 'Bebas Neue', sans-serif; letter-spacing: .32em; font-size: 20px; color: var(--mustard); text-indent: .32em; }
.env-title { font-family: 'DM Serif Display', serif; color: #fff; font-size: 34px; line-height: 1.1; text-align: center; margin: 8px 0 28px; overflow-wrap: anywhere; }
.envelope { position: relative; width: min(84vw, 380px); aspect-ratio: 1.45; border: 0; padding: 0; background: none; cursor: pointer; display: block; perspective: 900px; animation: bob 2.6s ease-in-out infinite; }
.env-body { position: absolute; inset: 0; border-radius: 10px; background: var(--paper); box-shadow: 0 24px 50px rgba(0, 0, 0, .4); overflow: hidden; }
.env-body::before { content: ''; position: absolute; inset: 0; border-radius: 10px; border: 9px solid transparent;
  border-image: repeating-linear-gradient(135deg, var(--coral) 0 14px, var(--paper) 14px 24px, var(--teal) 24px 38px, var(--paper) 38px 48px) 9; }
.env-flap { position: absolute; left: 0; right: 0; top: 0; height: 58%; transform-origin: top; transition: transform .6s ease; z-index: 3;
  background: linear-gradient(180deg, #fffaf0, #efe4cc); clip-path: polygon(0 0, 100% 0, 50% 100%); filter: drop-shadow(0 3px 3px rgba(0, 0, 0, .18)); }
.seal { position: absolute; left: 50%; top: 58%; width: 66px; height: 66px; margin: -33px 0 0 -33px; border-radius: 50%; z-index: 4; display: grid; place-items: center; color: #ffe3da;
  background: radial-gradient(circle at 35% 30%, #f27a60, var(--coral) 55%, #b23c26); box-shadow: 0 4px 10px rgba(0, 0, 0, .35), inset 0 0 0 4px rgba(255, 255, 255, .14); transition: opacity .3s; }
.seal svg { width: 34px; height: 34px; fill: currentColor; }
.env-to { position: absolute; left: 0; right: 0; bottom: 14%; text-align: center; z-index: 2; font-family: 'DM Serif Display', serif; font-style: italic; font-size: 22px; color: var(--deep); padding: 0 24px; overflow-wrap: anywhere; }
.tap { margin-top: 30px; color: #fff; font-weight: 700; font-size: 18px; animation: pulse 1.6s ease-in-out infinite; }
.envelope.open { animation: none; }
.envelope.open .env-flap { transform: rotateX(178deg); }
.envelope.open .seal { opacity: 0; }
@keyframes bob { 50% { transform: translateY(-8px); } }
@keyframes pulse { 50% { opacity: .55; } }

/* ---------- Boarding pass ---------- */
.pass { width: min(90vw, 420px); background: var(--paper); border-radius: 18px; box-shadow: 0 26px 54px rgba(0, 0, 0, .42); overflow: hidden; transform: translateY(40px) rotate(-1.5deg); transition: transform .7s cubic-bezier(.2, 1.3, .4, 1); }
.scene.on .pass { transform: none; }
.pass-head { background: var(--teal); color: #fff; padding: 14px 20px; display: flex; justify-content: space-between; align-items: center; font-family: 'Bebas Neue', sans-serif; letter-spacing: .14em; font-size: 24px; }
.pass-head svg { width: 26px; height: 26px; fill: var(--mustard); }
.pass-body { padding: 18px 20px 12px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }
.lab { display: block; font-size: 11px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin-bottom: 2px; }
.val { font-family: 'DM Serif Display', serif; font-size: 20px; line-height: 1.15; overflow-wrap: anywhere; }
.scratch { position: relative; height: 112px; border-radius: 12px; background: #fff; box-shadow: inset 0 0 0 2px #e6dcc6; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; }
.scratch-under { position: absolute; inset: 0; display: grid; place-items: center; padding: 6px 14px; text-align: center; font-family: 'Bebas Neue', sans-serif; color: var(--coral); line-height: .95; font-size: 54px; letter-spacing: .02em; overflow-wrap: anywhere; }
.scratch canvas { position: absolute; inset: 0; width: 100%; height: 100%; cursor: grab; transition: opacity .5s; }
.scratch.done canvas { opacity: 0; pointer-events: none; }
.stub { border-top: 2px dashed #d9cdb3; margin: 16px -20px 0; padding: 10px 20px 2px; display: flex; justify-content: space-between; gap: 10px; font-size: 13px; color: var(--muted); font-weight: 600; }
.hint { margin-top: 18px; color: #fff; font-weight: 700; font-size: 18px; text-align: center; }
.skip { margin-top: 10px; background: none; border: 0; color: #cfe3e6; font: inherit; font-size: 14px; text-decoration: underline; cursor: pointer; padding: 8px; visibility: hidden; }
.skip.show { visibility: visible; }

/* ---------- Poster ---------- */
#s-poster { padding: 0; justify-content: flex-start; background: var(--cream); overflow-y: auto; -webkit-overflow-scrolling: touch; }
.poster { position: relative; width: 100%; flex: none; aspect-ratio: 3 / 4; max-height: 74dvh; overflow: hidden; background: var(--deep); }
.poster img { width: 100%; height: 100%; object-fit: cover; object-position: bottom; display: block; transform: scale(1.12); transition: transform 2.4s cubic-bezier(.2, .8, .2, 1); }
.scene.on .poster img { transform: scale(1); }
.poster-text { position: absolute; left: 0; right: 0; top: 0; padding: 22px 18px 34px; text-align: center; color: #fff; background: linear-gradient(180deg, rgba(10, 42, 50, .72), rgba(10, 42, 50, 0)); }
.poster-text .going { font-family: 'Bebas Neue', sans-serif; letter-spacing: .24em; font-size: 22px; text-indent: .24em; color: #ffe9b8; text-shadow: 0 2px 6px rgba(0, 0, 0, .4); }
.poster-text h1 { font-family: 'Bebas Neue', sans-serif; font-weight: 400; line-height: .92; letter-spacing: .01em; font-size: 88px; margin-top: 2px; text-shadow: 0 4px 0 rgba(0, 0, 0, .28), 0 8px 22px rgba(0, 0, 0, .4); overflow-wrap: anywhere; }
.card { width: 100%; padding: 20px 22px 28px; background: var(--cream); }
.when { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-family: 'DM Serif Display', serif; font-size: 22px; }
.count { font-family: 'Bebas Neue', sans-serif; font-size: 24px; letter-spacing: .08em; color: var(--coral); }
.msg { font-family: 'DM Serif Display', serif; font-style: italic; font-size: 21px; line-height: 1.32; margin-top: 12px; white-space: pre-line; overflow-wrap: anywhere; }
.sign { margin-top: 8px; font-weight: 700; color: var(--deep); overflow-wrap: anywhere; }
.packbox { margin-top: 14px; padding: 12px 14px; border: 2px dashed #d9cdb3; border-radius: 12px; font-size: 15px; line-height: 1.4; overflow-wrap: anywhere; }
.packbox b { display: block; font-family: 'Bebas Neue', sans-serif; font-weight: 400; letter-spacing: .1em; font-size: 19px; color: var(--teal); }
.acts { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.btn { flex: 1 1 140px; display: block; text-align: center; padding: 13px 14px; border-radius: 12px; font: 800 16px 'DM Sans', sans-serif; border: 2px solid var(--teal); background: var(--teal); color: #fff; text-decoration: none; cursor: pointer; }
.btn.ghost { background: transparent; color: var(--teal); }
.cta { margin-top: 18px; padding: 14px; border-radius: 12px; background: #fff; text-align: center; font-weight: 600; }
.cta a { display: block; margin-top: 8px; }
[hidden] { display: none !important; }

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

.ribbon { position: fixed; top: 14px; right: -38px; transform: rotate(38deg); background: var(--coral); color: #fff; font-weight: 800; font-size: 12px; letter-spacing: .2em; padding: 5px 44px; z-index: 30; }

.broken { color: #fff; text-align: center; max-width: 340px; }
.broken h1 { font-family: 'DM Serif Display', serif; font-weight: 400; font-size: 32px; margin-bottom: 10px; }

@media (min-width: 481px) { #stage { box-shadow: 0 0 60px rgba(0, 0, 0, .35); } }
@media (max-height: 640px) { .env-title { font-size: 26px; margin-bottom: 16px; } .tap { margin-top: 16px; } .scratch { height: 86px; } .scratch-under { font-size: 42px; } .row { margin-bottom: 8px; } }
@media (prefers-reduced-motion: reduce) {
  .envelope, .tap { animation: none; }
  .scene, .pass, .poster img, .env-flap { transition-duration: .01s; }
}
