/* Christmas Unfold – mobile-first RSVP. Look inspired by Luxor Unfold: gold frames, purple reels, temple backdrop. */
:root {
  --gold-1: #fff0b8;
  --gold-2: #f5c451;
  --gold-3: #c8891e;
  --gold-4: #7a4a0e;
  --gold-dark: #4a2a06;
  --purple-1: #4b2569;
  --purple-2: #2a1340;
  --purple-3: #1a0d2b;
  --teal: #37e0d6;
  --teal-dark: #0d6e74;
  --ink: #fff7e3;
  --ink-soft: #d8c9ee;
  --red: #e0283f;
  --radius: 18px;
  --display: Cinzel, 'Trajan Pro', Georgia, serif;
  --body: Inter, system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
html { background: var(--purple-3); scrollbar-width: none; overflow-x: hidden; }
/* No visible scrollbars anywhere; content still scrolls by touch, wheel and keyboard. */
*, *::before, *::after { scrollbar-width: none; }
::-webkit-scrollbar { display: none; width: 0; height: 0; }
body {
  font-family: var(--body);
  color: var(--ink);
  background: var(--purple-3);
  line-height: 1.45;
  min-height: 100dvh;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}
button { font: inherit; color: inherit; }
img { max-width: 100%; }
[hidden] { display: none !important; }

/* ── Backdrop ─────────────────────────────────────────── */
.bg {
  position: fixed; inset: 0; z-index: 0;
  background:
    linear-gradient(180deg, rgba(14, 10, 30, .55) 0%, rgba(26, 13, 43, .72) 45%, rgba(18, 8, 30, .96) 100%),
    url('../assets/temple.webp') center top / cover no-repeat;
}
#snow { position: fixed; inset: 0; z-index: 1; pointer-events: none; }
#polaroids { position: fixed; inset: 0; z-index: 1; pointer-events: none; overflow: hidden; }

.demo { position: relative; z-index: 5; margin: 0; background: var(--gold-2); color: #2b1600; text-align: center; font-size: .78rem; font-weight: 600; padding: 5px 12px; }

/* ── Shell ────────────────────────────────────────────── */
.app {
  position: relative; z-index: 2;
  max-width: 460px; margin: 0 auto; min-height: 100dvh;
  display: flex; flex-direction: column;
  padding: max(10px, env(safe-area-inset-top)) 16px max(18px, env(safe-area-inset-bottom));
}
.top { position: relative; text-align: center; padding: 4px 40px 0; }
.logo { margin: 0; line-height: 1; display: flex; flex-direction: column; align-items: center; filter: drop-shadow(0 6px 10px rgba(0,0,0,.55)); }
.logo-xmas {
  font-family: var(--display); font-weight: 900; text-transform: uppercase;
  font-size: clamp(1.9rem, 9.6vw, 2.7rem); letter-spacing: .02em; line-height: .95;
  background: linear-gradient(180deg, #fff6c8 0%, #f9d36b 30%, #d6952a 55%, #f7cf6a 72%, #8b5410 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  -webkit-text-stroke: 1.2px var(--gold-dark);
  padding: 0 4px;
}
.logo img { width: min(68%, 270px); height: auto; margin-top: -2px; }
.icon-btn {
  position: absolute; top: 8px; width: 38px; height: 38px; border-radius: 50%;
  border: 2px solid var(--gold-3); background: rgba(26, 13, 43, .75); color: var(--gold-1);
  font-size: 1.4rem; line-height: 1; display: grid; place-items: center; cursor: pointer;
}
#back { left: 0; font-size: 1.8rem; padding-bottom: 4px; }
.lang-btn { right: 0; font-size: 1.1rem; }

.progress { list-style: none; margin: 10px 0 12px; padding: 0; display: flex; justify-content: center; gap: 8px; }
.progress li { width: 10px; height: 10px; transform: rotate(45deg); border-radius: 2px; background: rgba(255,255,255,.18); border: 1px solid rgba(245,196,81,.45); transition: background .3s, box-shadow .3s; }
.progress li.done { background: var(--gold-2); }
.progress li.on { background: var(--teal); box-shadow: 0 0 10px var(--teal); border-color: #b9fffa; }

.stage { flex: 1; display: flex; flex-direction: column; }
.screen { display: none; flex: 1; flex-direction: column; justify-content: center; gap: 14px; }
.screen.active { display: flex; animation: enter .35s ease both; }
@keyframes enter { from { opacity: 0; transform: translateY(10px); } }

/* ── Panels (gold-framed reels) ───────────────────────── */
.panel {
  position: relative; border-radius: var(--radius); padding: 22px 18px;
  background:
    radial-gradient(120% 70% at 50% 0%, rgba(120, 70, 170, .35), transparent 60%),
    linear-gradient(180deg, var(--purple-1), var(--purple-2));
  box-shadow:
    0 0 0 2px var(--gold-dark),
    0 0 0 5px var(--gold-2),
    0 0 0 7px var(--gold-4),
    inset 0 0 30px rgba(0, 0, 0, .45),
    0 18px 40px rgba(0, 0, 0, .55);
  margin: 7px;
}
.panel.center { text-align: center; }
h2 {
  font-family: var(--display); font-weight: 800; font-size: 1.45rem; line-height: 1.15;
  margin: 0 0 6px; color: var(--gold-1); text-shadow: 0 2px 0 var(--gold-dark), 0 0 18px rgba(245,196,81,.35);
}
.sub { margin: 0 0 16px; color: var(--ink-soft); }
.note { margin: 10px 0 0; color: var(--ink-soft); font-size: .92rem; text-align: center; }
.note.small { font-size: .82rem; }
.gold-text { color: var(--gold-2); font-weight: 600; }
.eyebrow { margin: 0 0 12px; text-align: center; font-family: var(--display); font-weight: 800; letter-spacing: .25em; text-transform: uppercase; font-size: .8rem; color: var(--teal); }
.error { background: rgba(224, 40, 63, .18); border: 1px solid rgba(224, 40, 63, .6); color: #ffd7dc; padding: 9px 12px; border-radius: 10px; margin: 12px 0 0; font-size: .9rem; text-align: left; }
.linkish { display: block; margin: 14px auto 0; background: none; border: 0; padding: 4px; color: var(--gold-2); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; font-size: .92rem; }

/* ── Buttons ──────────────────────────────────────────── */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; min-height: 54px; margin-top: 18px; padding: 12px 20px;
  border-radius: 999px; cursor: pointer; text-decoration: none;
  font-family: var(--display); font-weight: 800; font-size: 1.05rem; letter-spacing: .04em; text-transform: uppercase;
  transition: transform .08s, filter .15s;
}
.btn.gold {
  color: #3b1d05; border: 2px solid var(--gold-dark);
  background: linear-gradient(180deg, var(--gold-1) 0%, var(--gold-2) 38%, var(--gold-3) 72%, #9a6214 100%);
  box-shadow: inset 0 2px 0 rgba(255,255,255,.7), inset 0 -3px 0 rgba(90,52,8,.45), 0 4px 0 var(--gold-dark), 0 10px 18px rgba(0,0,0,.45);
}
.btn.ghost { margin-top: 10px; color: var(--gold-1); border: 2px solid var(--gold-3); background: rgba(26, 13, 43, .5); }
.btn:active { transform: translateY(2px); }
.btn:disabled { filter: grayscale(.7) brightness(.75); cursor: not-allowed; }
.btn img { width: 34px; height: auto; margin: -6px 0; }
.btn.loading { pointer-events: none; filter: brightness(.85); }
.btn.loading::after { content: ''; width: 16px; height: 16px; border-radius: 50%; border: 2.5px solid rgba(59,29,5,.3); border-top-color: #3b1d05; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
:focus-visible { outline: 3px solid var(--teal); outline-offset: 3px; }

/* ── Language grid ────────────────────────────────────── */
.lang-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.lang {
  min-height: 52px; padding: 8px 4px; border-radius: 12px; cursor: pointer;
  border: 1.5px solid rgba(245,196,81,.55); color: var(--ink);
  background: linear-gradient(180deg, rgba(255,255,255,.08), rgba(0,0,0,.18));
  font-weight: 600; font-size: .86rem; line-height: 1.15;
  transition: transform .1s, border-color .15s, background .15s;
}
.lang:hover { border-color: var(--gold-2); }
.lang:active { transform: scale(.96); }
.lang.on { border-color: var(--teal); background: rgba(55,224,214,.18); }
.lang.en { grid-column: 1 / -1; font-family: var(--display); font-weight: 800; letter-spacing: .08em; }

/* ── Info screen ──────────────────────────────────────── */
.pharaoh-wrap { position: relative; height: 170px; margin: 48px auto -42px; width: 230px; z-index: 0; pointer-events: none; }
.pharaoh { width: 230px; height: 170px; object-fit: cover; object-position: 50% 0; -webkit-mask-image: linear-gradient(180deg, #000 70%, transparent); mask-image: linear-gradient(180deg, #000 70%, transparent); }
/* Sits on top of the headdress: the white brim covers the top of the nemes, not the face. */
.santa-hat { position: absolute; width: 86px; top: -50px; left: 50%; transform: translateX(-46%) rotate(6deg); transform-origin: 40% 85%; filter: drop-shadow(0 4px 4px rgba(0,0,0,.4)); }
.info-panel { z-index: 1; }
.facts { margin: 0; display: grid; gap: 10px; }
.facts > div { display: grid; grid-template-columns: 92px 1fr; gap: 8px; align-items: baseline; }
.facts dt { font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--gold-2); }
.facts dd { margin: 0; font-weight: 600; }
.facts small { display: block; font-weight: 400; color: var(--ink-soft); font-size: .84rem; margin-top: 2px; }
.facts a { color: var(--ink); text-decoration-color: rgba(245,196,81,.6); text-underline-offset: 3px; }
.countdown { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 16px 0 0; }
.countdown div { text-align: center; padding: 8px 2px; border-radius: 10px; background: rgba(0,0,0,.3); border: 1px solid rgba(245,196,81,.35); }
.countdown b { font-family: var(--display); font-size: 1.4rem; color: var(--gold-1); font-variant-numeric: tabular-nums; }
.countdown.live { display: block; text-align: center; font-family: var(--display); color: var(--gold-1); }
.headcount { margin: 12px 0 0; text-align: center; color: var(--teal); font-weight: 700; }
.headcount::before { content: '✨ '; }

/* ── Attend tiles ─────────────────────────────────────── */
.choices { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 16px; }
.tile {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  aspect-ratio: 1 / 1.1; padding: 8px 4px; border-radius: 14px; cursor: pointer;
  font-family: var(--display); font-weight: 800; font-size: 1rem; color: var(--ink);
  border: 2px solid var(--gold-3);
  background:
    linear-gradient(180deg, rgba(10, 60, 70, .35), rgba(10, 30, 50, .65)),
    url('../assets/water.webp') center / 300% no-repeat;
  box-shadow: inset 0 0 0 2px rgba(0,0,0,.35), inset 0 0 18px rgba(55,224,214,.25), 0 6px 14px rgba(0,0,0,.4);
  transition: transform .12s, box-shadow .15s;
}
.tile em { font-style: normal; font-size: 2.1rem; line-height: 1; filter: drop-shadow(0 3px 3px rgba(0,0,0,.4)); }
.tile:hover { box-shadow: inset 0 0 0 2px rgba(0,0,0,.35), inset 0 0 24px rgba(55,224,214,.5), 0 6px 14px rgba(0,0,0,.4); }
.tile:active { transform: scale(.96); }
.tile.picked { border-color: var(--teal); box-shadow: 0 0 0 3px var(--teal), 0 0 22px rgba(55,224,214,.7); }
.tile.shake { animation: shake .35s linear; }
@keyframes shake { 20% { transform: translate(-3px, 1px) rotate(-2deg); } 40% { transform: translate(3px, -1px) rotate(2deg); } 60% { transform: translate(-2px, 2px) rotate(-1deg); } 80% { transform: translate(2px, 0) rotate(1deg); } }
.crumble-layer { position: fixed; z-index: 20; pointer-events: none; }
.crumble-layer > * { position: absolute; inset: 0; margin: 0; }
.crumbled { margin: 16px 0 0; color: var(--ink-soft); font-style: italic; }

/* ── Form fields ──────────────────────────────────────── */
.field { display: block; margin-top: 14px; }
.field > span { display: block; margin-bottom: 6px; font-size: .85rem; font-weight: 700; color: var(--gold-2); text-transform: uppercase; letter-spacing: .06em; }
input:not([type=checkbox]), textarea {
  width: 100%; font: inherit; font-size: 1rem; color: var(--ink); padding: 13px 14px;
  border-radius: 12px; border: 1.5px solid rgba(245,196,81,.5); background: rgba(10, 4, 20, .45);
  margin-top: 12px; transition: border-color .15s, box-shadow .15s;
}
.field input { margin-top: 0; }
input::placeholder, textarea::placeholder { color: rgba(216, 201, 238, .55); }
input:focus, textarea:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px rgba(55,224,214,.25); }
textarea { resize: vertical; min-height: 120px; }
#colleague { font-family: var(--display); font-weight: 800; font-size: 1.25rem; text-align: center; }

.toggle { display: flex; align-items: center; gap: 12px; margin-top: 18px; cursor: pointer; font-weight: 600; }
.toggle input { position: absolute; opacity: 0; }
.switch { width: 48px; height: 28px; border-radius: 99px; background: rgba(255,255,255,.2); border: 1.5px solid rgba(245,196,81,.5); position: relative; flex: none; transition: background .2s; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 19px; height: 19px; border-radius: 50%; background: var(--gold-1); transition: transform .2s; box-shadow: 0 1px 3px rgba(0,0,0,.4); }
.toggle input:checked + .switch { background: var(--teal-dark); border-color: var(--teal); }
.toggle input:checked + .switch::after { transform: translateX(20px); }
.toggle input:focus-visible + .switch { outline: 3px solid var(--teal); outline-offset: 2px; }

/* ── Wheel ────────────────────────────────────────────── */
.wheel-head { text-align: center; }
.wheel-head .sub { margin-bottom: 0; }
.wheel-wrap { position: relative; width: min(100%, 380px); aspect-ratio: 1; margin: 0 auto; }
.wheel-glow { position: absolute; inset: 6%; border-radius: 50%; box-shadow: 0 0 60px 10px rgba(55,224,214,.35); }
#wheel { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(0deg); will-change: transform; filter: drop-shadow(0 12px 18px rgba(0,0,0,.6)); }
.pointer {
  position: absolute; top: -6px; left: 50%; width: 34px; height: 44px; transform: translateX(-50%); z-index: 2;
  background: linear-gradient(180deg, var(--gold-1), var(--gold-3) 60%, var(--gold-4));
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  filter: drop-shadow(0 3px 3px rgba(0,0,0,.6));
}
.pointer.tick { animation: tick .12s ease; }
@keyframes tick { 50% { transform: translateX(-50%) rotate(-12deg); } }
.hub {
  position: absolute; top: 50%; left: 50%; width: 31%; aspect-ratio: 1; transform: translate(-50%, -50%);
  border-radius: 50%; border: 0; padding: 0; cursor: pointer; background: none; z-index: 3;
  display: grid; place-items: center;
}
.hub img { position: absolute; inset: -18%; width: 136%; height: 136%; max-width: none; pointer-events: none; animation: pulse 2.4s ease-in-out infinite; }
.hub span {
  position: relative; margin-top: 52%; font-family: var(--display); font-weight: 900; font-size: 1.05rem; letter-spacing: .08em;
  color: #fff; text-shadow: 0 0 6px #0b5d63, 0 2px 0 #0b5d63;
}
.hub:disabled { cursor: default; }
.hub:disabled img { animation: none; opacity: .75; }
@keyframes pulse { 50% { transform: scale(1.06); } }
.result { text-align: center; }
.result .big { font-size: 2.6rem; line-height: 1; margin-bottom: 6px; }
.result p { margin: 6px 0 0; color: var(--ink-soft); }
.result .prize-name { color: var(--gold-1); font-family: var(--display); font-weight: 800; font-size: 1.1rem; }

/* Camera */
.cam { position: relative; width: 200px; margin: 14px auto 0; padding: 8px 8px 30px; background: #fbf8f0; border-radius: 4px; box-shadow: 0 10px 24px rgba(0,0,0,.5); transform: rotate(-2deg); }
.cam video, .cam img { display: block; width: 184px; height: 230px; object-fit: cover; background: #222; }
.cam video { transform: scaleX(-1); }
.cam-actions { display: flex; gap: 8px; }
.cam-actions .btn { margin-top: 14px; font-size: .9rem; min-height: 46px; padding: 8px 12px; }
.file-pick { display: block; margin-top: 10px; font-size: .9rem; color: var(--gold-2); text-decoration: underline; cursor: pointer; }
.file-pick input { display: none; }

/* ── Done ─────────────────────────────────────────────── */
.done-eye { width: 110px; height: auto; margin: -6px auto 6px; display: block; filter: drop-shadow(0 0 16px rgba(80,140,255,.55)); }
#done-text { margin: 0; color: var(--ink-soft); }
.summary { margin: 16px 0 0; text-align: left; display: grid; gap: 6px; }
.summary div { display: flex; justify-content: space-between; gap: 12px; padding: 8px 12px; border-radius: 10px; background: rgba(0,0,0,.25); }
.summary dt { color: var(--gold-2); font-size: .85rem; font-weight: 600; }
.summary dd { margin: 0; font-weight: 600; text-align: right; }

/* ── Loading ──────────────────────────────────────────── */
.loading { text-align: center; color: var(--ink-soft); }
.loading img { width: 110px; animation: pulse 1.4s ease-in-out infinite; filter: drop-shadow(0 0 16px rgba(80,140,255,.55)); }

/* ── Toast ────────────────────────────────────────────── */
.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); z-index: 30;
  transform: translate(-50%, 30px); opacity: 0; pointer-events: none;
  padding: 10px 18px; border-radius: 999px; font-weight: 700; white-space: nowrap;
  color: #3b1d05; background: linear-gradient(180deg, var(--gold-1), var(--gold-2));
  box-shadow: 0 0 0 2px var(--gold-dark), 0 8px 20px rgba(0,0,0,.5);
  transition: opacity .25s, transform .25s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ── Polaroids ────────────────────────────────────────── */
.polaroid {
  position: absolute; width: 74px; padding: 5px 5px 18px; background: #fbf8f0; border-radius: 2px;
  box-shadow: 0 8px 18px rgba(0,0,0,.55); opacity: .92;
  animation: drift var(--dur, 30s) ease-in-out infinite alternate;
}
.polaroid img { display: block; width: 64px; height: 80px; object-fit: cover; }
.polaroid span { position: absolute; left: 0; right: 0; bottom: 1px; text-align: center; font: 600 .8rem/1 Caveat, cursive; color: #333; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; padding: 0 3px; }
@keyframes drift {
  from { transform: translate(0, 0) rotate(var(--r1, -6deg)); }
  to { transform: translate(var(--dx, 30px), var(--dy, -40px)) rotate(var(--r2, 6deg)); }
}

/* ── BIG WIN ──────────────────────────────────────────── */
.bigwin { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; background: radial-gradient(circle, rgba(60,20,90,.85), rgba(8,3,15,.95)); cursor: pointer; overflow: hidden; }
.bigwin .rays { position: absolute; width: 220vmax; height: 220vmax; background: repeating-conic-gradient(from 0deg, rgba(245,196,81,.22) 0 8deg, transparent 8deg 20deg); animation: spin 14s linear infinite; }
#coins { position: absolute; inset: 0; width: 100%; height: 100%; }
.bigwin-inner { position: relative; text-align: center; animation: slam .7s cubic-bezier(.2, 1.6, .4, 1) both; }
.bigwin-title {
  margin: 0; font-family: var(--display); font-weight: 900; font-size: clamp(3.4rem, 18vw, 6.5rem); line-height: .95;
  background: linear-gradient(180deg, #fff8d0, #f9d36b 35%, #d6952a 60%, #fff1a8 75%, #8b5410);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  -webkit-text-stroke: 2px var(--gold-dark);
  filter: drop-shadow(0 0 24px rgba(245,196,81,.7)) drop-shadow(0 6px 0 #3b1d05);
  animation: throb 1.1s ease-in-out .7s infinite;
}
.bigwin-amount { margin: 10px 0 0; font-family: var(--display); font-weight: 900; font-size: clamp(2rem, 10vw, 3.4rem); color: #fff; text-shadow: 0 0 18px var(--teal), 0 3px 0 #0b5d63; font-variant-numeric: tabular-nums; }
.bigwin.shake { animation: screenshake .5s linear; }
@keyframes slam { from { transform: scale(4); opacity: 0; } }
@keyframes throb { 50% { transform: scale(1.06); } }
@keyframes screenshake { 10%, 50%, 90% { transform: translate(-6px, 3px); } 30%, 70% { transform: translate(6px, -3px); } }

@media (min-width: 700px) {
  .app { padding-top: 24px; }
  .polaroid { width: 96px; }
  .polaroid img { width: 86px; height: 106px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition: none !important; }
}
