:root {
  --bg: #fff4e6;
  --ink: #1d1a2f;
  --red: #e63946;
  --gold: #ffb703;
  --blue: #3a86ff;
  --green: #2a9d8f;
  --pink: #ff8fab;
  --card: #ffffff;
  --muted: #6b6680;
  --r: 22px;
  --font: ui-rounded, "SF Pro Rounded", "Avenir Next", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background:
    radial-gradient(circle at 15% 10%, #ffe1c2 0 18%, transparent 19%),
    radial-gradient(circle at 90% 85%, #ffd6e0 0 22%, transparent 23%),
    var(--bg);
  background-attachment: fixed;
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

#progress {
  position: fixed; top: 0; left: 0; right: 0; height: calc(6px + env(safe-area-inset-top));
  padding-top: env(safe-area-inset-top); z-index: 50; pointer-events: none;
}
#bar { height: 6px; width: 0; background: var(--red); border-radius: 0 6px 6px 0; transition: width .6s cubic-bezier(.2,.8,.2,1); }

#app { min-height: 100dvh; }

.scene {
  min-height: 100dvh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 18px;
  padding: calc(28px + env(safe-area-inset-top)) 20px calc(28px + env(safe-area-inset-bottom));
  max-width: 480px; margin: 0 auto;
  text-align: center;
  opacity: 0; transform: translateY(24px) scale(.98);
  transition: opacity .45s ease, transform .55s cubic-bezier(.2,.9,.2,1.2);
}
.scene.in { opacity: 1; transform: none; }
.scene.settled { transition: none; }

h1 { font-size: clamp(28px, 8.4vw, 38px); line-height: 1.08; margin: 0; font-weight: 900; letter-spacing: -.02em; }
h2 { font-size: 24px; line-height: 1.15; margin: 0; font-weight: 900; }
p { margin: 0; }
.lead { font-size: 19px; line-height: 1.35; color: var(--ink); }
.kicker { text-transform: uppercase; letter-spacing: .14em; font-size: 12px; font-weight: 800; color: var(--red); }
.hint { font-size: 15px; color: var(--muted); min-height: 1.3em; }
.small { font-size: 12.5px; color: var(--muted); line-height: 1.35; }
.big-emoji { font-size: 64px; line-height: 1; }

.card {
  width: 100%;
  background: var(--card);
  border: 3px solid var(--ink);
  border-radius: var(--r);
  box-shadow: 6px 6px 0 var(--ink);
  padding: 22px 18px;
  display: flex; flex-direction: column; gap: 14px; align-items: center;
}

.btn {
  font: inherit; font-weight: 900; font-size: 20px;
  color: var(--ink);
  background: var(--gold);
  border: 3px solid var(--ink);
  border-radius: 16px;
  box-shadow: 4px 4px 0 var(--ink);
  padding: 14px 22px;
  cursor: pointer;
  transition: transform .08s, box-shadow .08s, background .2s;
}
.btn:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--ink); }
.btn:disabled { opacity: .4; }
.btn.wide { width: 100%; }
.btn.red { background: var(--red); color: #fff; }
.btn.blue { background: var(--blue); color: #fff; }
.btn.white { background: #fff; }
.btn.ghost { background: transparent; box-shadow: none; border-style: dashed; font-size: 15px; padding: 8px 14px; }

.choices { display: grid; gap: 12px; width: 100%; }
.choices.two { grid-template-columns: 1fr 1fr; }
.choice {
  font: inherit; font-weight: 800; font-size: 17px; color: var(--ink);
  background: #fff; border: 3px solid var(--ink); border-radius: 16px;
  box-shadow: 4px 4px 0 var(--ink); padding: 14px 12px; cursor: pointer;
  display: flex; align-items: center; gap: 10px; text-align: left;
  transition: transform .08s, box-shadow .08s, background .2s;
}
.choice:active { transform: translate(3px,3px); box-shadow: 1px 1px 0 var(--ink); }
.choice.col { flex-direction: column; text-align: center; justify-content: center; }
.choice .emo { font-size: 44px; }
.choice.sel { background: var(--gold); }
.choice .letter {
  flex: none; width: 32px; height: 32px; border-radius: 10px; border: 2.5px solid var(--ink);
  display: grid; place-items: center; font-size: 15px; background: var(--bg);
}

.reaction {
  width: 100%;
  background: var(--ink); color: #fff; border-radius: 16px; padding: 14px 16px;
  font-size: 17px; line-height: 1.35; font-weight: 700;
  animation: pop .45s cubic-bezier(.2,.9,.3,1.4);
}
@keyframes pop { from { transform: scale(.6); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- Gift ---------- */
.gift {
  position: relative; width: 210px; height: 210px; margin: 30px 0 10px;
  background: none; border: 0; padding: 0; cursor: pointer;
  animation: wiggle 2.2s ease-in-out infinite;
}
.gift .box {
  position: absolute; left: 15px; right: 15px; bottom: 0; height: 145px;
  background: var(--red); border: 4px solid var(--ink); border-radius: 10px;
  box-shadow: 6px 6px 0 var(--ink);
}
.gift .box::after, .gift .lid::after {
  content: ""; position: absolute; top: 0; bottom: 0; left: 50%; width: 30px; margin-left: -15px;
  background: var(--gold); border-left: 4px solid var(--ink); border-right: 4px solid var(--ink);
}
.gift .lid {
  position: absolute; left: 0; right: 0; top: 30px; height: 46px; z-index: 2;
  background: var(--red); border: 4px solid var(--ink); border-radius: 10px;
  transition: transform .9s cubic-bezier(.2,.8,.3,1), opacity .9s;
}
.gift .bow { position: absolute; top: -18px; left: 50%; transform: translateX(-50%); font-size: 64px; z-index: 3; transition: transform .9s, opacity .9s; }
.gift.shake { animation: shake .45s; }
.gift.open { animation: none; }
.gift.open .lid { transform: translate(60px, -260px) rotate(50deg); opacity: 0; }
.gift.open .bow { transform: translate(-150px, -300px) rotate(-90deg); opacity: 0; }
@keyframes wiggle { 0%,80%,100% { transform: rotate(0) } 84% { transform: rotate(-6deg) } 88% { transform: rotate(6deg) } 92% { transform: rotate(-4deg) } 96% { transform: rotate(3deg) } }
@keyframes shake { 0%,100%{transform:translate(0)} 20%{transform:translate(-10px,2px) rotate(-5deg)} 40%{transform:translate(10px,-2px) rotate(5deg)} 60%{transform:translate(-8px,0) rotate(-3deg)} 80%{transform:translate(8px,1px) rotate(3deg)} }

/* ---------- Security ---------- */
.badge { display: inline-flex; gap: 8px; align-items: center; font-weight: 900; font-size: 14px; letter-spacing: .08em; text-transform: uppercase; background: var(--ink); color: #fff; padding: 8px 14px; border-radius: 999px; }
.loading { width: 100%; height: 18px; border: 3px solid var(--ink); border-radius: 99px; overflow: hidden; background: #fff; }
.loading > div { height: 100%; width: 0; background: repeating-linear-gradient(45deg, var(--blue) 0 12px, #6aa4ff 12px 24px); transition: width 1.6s cubic-bezier(.4,0,.2,1); }

/* ---------- Big question ---------- */
.yn { display: flex; gap: 16px; align-items: center; justify-content: center; width: 100%; min-height: 120px; flex-wrap: wrap; }
.yn .btn { min-width: 120px; font-size: 24px; }
#yes { background: var(--green); color: #fff; transition: transform .35s cubic-bezier(.2,.9,.3,1.5); transform-origin: center; position: relative; z-index: 5; }
#no { background: #fff; transition: left .25s cubic-bezier(.2,.9,.3,1.3), top .25s cubic-bezier(.2,.9,.3,1.3), transform .25s; z-index: 40; white-space: nowrap; }
#no.flee { position: fixed; margin: 0; }

.shout {
  position: fixed; inset: 0; display: grid; place-items: center; z-index: 60; pointer-events: none;
  font-size: 72px; font-weight: 900; color: var(--red);
  -webkit-text-stroke: 3px var(--ink); text-shadow: 6px 6px 0 var(--ink);
  animation: shout 2.4s cubic-bezier(.2,.9,.3,1.3) forwards;
}
@keyframes shout { 0% { transform: scale(0) rotate(-20deg); } 25% { transform: scale(1.15) rotate(-6deg); } 35% { transform: scale(1) rotate(-6deg); } 85% { opacity: 1; } 100% { opacity: 0; transform: scale(1.1) rotate(-6deg); } }

/* iOS-style alert */
.ios-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 100; display: grid; place-items: center; animation: fade .2s; }
.ios-alert { width: 270px; background: rgba(242,242,247,.96); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); border-radius: 14px; text-align: center; overflow: hidden; animation: pop .25s; font-family: -apple-system, system-ui, sans-serif; }
.ios-alert .t { font-weight: 600; font-size: 17px; padding: 19px 16px 2px; }
.ios-alert .m { font-size: 13px; padding: 2px 16px 19px; line-height: 1.35; }
.ios-alert .acts { display: flex; border-top: .5px solid rgba(60,60,67,.36); }
.ios-alert button { flex: 1; font: inherit; font-family: -apple-system, system-ui, sans-serif; font-size: 17px; color: #007aff; background: none; border: 0; padding: 11px; }
.ios-alert button + button { border-left: .5px solid rgba(60,60,67,.36); font-weight: 600; }
@keyframes fade { from { opacity: 0 } }

/* ---------- FX layer ---------- */
#fx { position: fixed; inset: 0; pointer-events: none; z-index: 30; overflow: hidden; }
.drop { position: absolute; top: -140px; will-change: transform; animation: fall linear forwards; }
.drop img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; border: 3px solid var(--ink); background: #fff; }
.drop.emoji { line-height: 1; }
.drop.conf { width: 10px; height: 16px; border-radius: 2px; }
@keyframes fall { to { transform: translateY(calc(100dvh + 300px)) rotate(var(--rot)); } }
.flash { position: fixed; inset: 0; background: #fff; z-index: 90; animation: flash .7s forwards; pointer-events: none; display: grid; place-items: center; font-size: 90px; }
@keyframes flash { 0% { opacity: 1 } 100% { opacity: 0 } }
.toast { position: fixed; left: 50%; top: calc(18px + env(safe-area-inset-top)); transform: translateX(-50%); background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 14px; font-weight: 800; z-index: 95; animation: pop .3s; width: max-content; max-width: 88vw; text-align: center; }

/* ---------- Boarding pass ---------- */
.pass { width: 100%; background: #fff; border: 3px solid var(--ink); border-radius: var(--r); box-shadow: 6px 6px 0 var(--ink); overflow: hidden; text-align: left; }
.pass .top { background: var(--blue); color: #fff; padding: 14px 16px; font-size: 13px; white-space: nowrap; gap: 10px; display: flex; justify-content: space-between; align-items: center; font-weight: 900; letter-spacing: .06em; }
.pass .route { display: flex; align-items: center; justify-content: space-between; padding: 18px; gap: 8px; }
.pass .code { font-size: 40px; font-weight: 900; line-height: 1; }
.pass .city { font-size: 12px; color: var(--muted); font-weight: 700; margin-top: 4px; }
.pass .mode.flip { transform: scaleX(-1); }
.pass .mode { font-size: 38px; position: relative; transition: transform .5s; }
.pass .mode.cross::after { content: ""; position: absolute; left: -6px; right: -6px; top: 50%; height: 5px; background: var(--red); transform: rotate(-30deg); border-radius: 4px; }
.pass .grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; padding: 4px 18px 18px; }
.pass .lbl { font-size: 10.5px; color: var(--muted); font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.pass .val { font-size: 15px; font-weight: 800; }
.pass .val.strike { text-decoration: line-through; text-decoration-color: var(--red); text-decoration-thickness: 3px; }
.pass .tear { border-top: 3px dashed var(--ink); margin: 0 -3px; position: relative; }
.pass .barcode { height: 54px; margin: 16px 18px; background: repeating-linear-gradient(90deg, var(--ink) 0 2px, transparent 2px 4px, var(--ink) 4px 7px, transparent 7px 9px, var(--ink) 9px 10px, transparent 10px 14px); }
.stamp {
  position: absolute; font-size: 30px; font-weight: 900; color: var(--red); border: 4px solid var(--red); border-radius: 8px;
  padding: 4px 12px; transform: rotate(-14deg); letter-spacing: .06em; background: rgba(255,255,255,.75);
  animation: stamp .35s cubic-bezier(.2,.9,.3,1.4);
}
@keyframes stamp { from { transform: scale(3) rotate(-14deg); opacity: 0; } }

/* ---------- Car ---------- */
.car { width: 230px; height: auto; overflow: visible; }
.car .seat rect { fill: #f1e9dd; stroke: var(--ink); stroke-width: 3; transition: fill .25s; cursor: pointer; }
.car .seat.sel rect { fill: var(--gold); }
.car .seat text { font-size: 22px; text-anchor: middle; dominant-baseline: central; pointer-events: none; }
.car .seat .lab { font-size: 9px; font-weight: 800; font-family: var(--font); fill: var(--ink); }
.car .seat.back rect { fill: #e3dbd0; }
.car.sink { animation: sink 1.4s cubic-bezier(.3,1.6,.5,1) forwards; }
@keyframes sink { to { transform: translateY(16px) scaleY(.92); } }

/* ---------- DJ license ---------- */
.license { width: 100%; border: 3px solid var(--ink); border-radius: 16px; box-shadow: 6px 6px 0 var(--ink); background: linear-gradient(135deg, #ffe5ec, #d7e3ff); padding: 16px; text-align: left; display: grid; grid-template-columns: 84px 1fr; gap: 14px; animation: pop .5s cubic-bezier(.2,.9,.3,1.4); }
.license .ph { width: 84px; height: 104px; border: 3px solid var(--ink); border-radius: 10px; background: #fff; display: grid; place-items: center; font-size: 46px; overflow: hidden; }
.license .ph img { width: 100%; height: 100%; object-fit: cover; }
.license h3 { margin: 0 0 6px; font-size: 13px; letter-spacing: .1em; }
.license .row { font-size: 13px; line-height: 1.45; }
.license .row b { font-weight: 900; }

/* ---------- Doors ---------- */
.doors { display: flex; gap: 12px; justify-content: center; width: 100%; }
.door {
  flex: 1; height: 150px; border: 4px solid var(--ink); border-radius: 8px 8px 0 0;
  background: linear-gradient(135deg, rgba(186,230,253,.55) 0 40%, rgba(255,255,255,.9) 45% 50%, rgba(186,230,253,.5) 55%);
  position: relative; cursor: pointer; font: inherit; padding: 0;
  transition: transform .15s;
}
.door::after { content: ""; position: absolute; right: 8px; top: 50%; width: 6px; height: 26px; background: var(--ink); border-radius: 3px; }
.door:active { transform: scale(.96); }
.door .tag { position: absolute; inset: auto 0 10px; font-weight: 900; font-size: 13px; color: var(--red); opacity: 0; transition: opacity .3s; }
.door.hit { animation: shake .4s; }
.door.hit .tag { opacity: 1; }
.door.hit::before { content: "💥"; position: absolute; top: 26%; left: 50%; transform: translateX(-50%); font-size: 40px; }

/* Signature */
.waiver { text-align: left; font-size: 14.5px; line-height: 1.45; background: #fffdf8; border: 2px dashed var(--ink); border-radius: 12px; padding: 14px; font-family: "Georgia", serif; }
.sigwrap { width: 100%; position: relative; }
#sig { width: 100%; height: 150px; background: #fff; border: 3px solid var(--ink); border-radius: 14px; touch-action: none; display: block; }
.sigwrap .x { position: absolute; left: 14px; bottom: 30px; font-weight: 900; color: var(--muted); pointer-events: none; }
.sigwrap .line { position: absolute; left: 34px; right: 16px; bottom: 34px; border-bottom: 2px solid #ccc; pointer-events: none; }

/* ---------- Final ---------- */
.summary { width: 100%; text-align: left; display: flex; flex-direction: column; gap: 0; }
.summary .r { display: flex; justify-content: space-between; gap: 12px; padding: 10px 2px; border-bottom: 2px dashed #e6dccd; font-size: 15px; }
.summary .r:last-child { border-bottom: 0; }
.summary .r span:first-child { color: var(--muted); font-weight: 700; flex: none; }
.summary .r span:last-child { font-weight: 900; text-align: right; }
.countdown { display: flex; gap: 8px; justify-content: center; }
.countdown div { background: var(--ink); color: #fff; border-radius: 12px; padding: 8px 10px; min-width: 62px; }
.countdown b { display: block; font-size: 26px; font-variant-numeric: tabular-nums; }
.countdown small { font-size: 10px; letter-spacing: .1em; text-transform: uppercase; opacity: .7; }
.sent { font-weight: 800; font-size: 15px; }

.reaction.left { text-align: left; }

/* ---------- Car pick ---------- */
.choice.carpick { gap: 12px; padding: 12px; }
.choice.carpick .side { width: 118px; flex: none; height: auto; overflow: visible; }

/* ---------- Waiver co-sign ---------- */
.cosign { margin-top: 14px; font-family: "Snell Roundhand", "Savoye LET", cursive; font-size: 26px; display: flex; align-items: baseline; gap: 10px; border-bottom: 1.5px solid #ccc; padding-bottom: 2px; }
.cosign span { font-family: var(--font); font-size: 12px; font-weight: 800; color: var(--green); }

/* ---------- Calendar ---------- */
.cal-card { padding: 16px 12px; gap: 12px; }
.tabs { display: flex; gap: 8px; width: 100%; }
.tab { flex: 1; font: inherit; font-weight: 900; font-size: 16px; text-transform: capitalize; padding: 9px; border: 3px solid var(--ink); border-radius: 12px; background: #fff; color: var(--ink); }
.tab.on { background: var(--ink); color: #fff; }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px 0; width: 100%; }
.cal .dow { font-size: 11px; font-weight: 900; color: var(--muted); padding-bottom: 4px; }
.day { font: inherit; font-size: 15px; font-weight: 800; height: 40px; border: 0; background: none; color: var(--ink); padding: 0; position: relative; }
.day.off { color: #cfc8bd; font-weight: 600; }
.day.pickable::after { content: ""; position: absolute; left: 50%; bottom: 4px; width: 5px; height: 5px; margin-left: -2.5px; border-radius: 50%; background: var(--green); }
.day.blocked { color: #c9a7a7; text-decoration: line-through; text-decoration-color: var(--red); text-decoration-thickness: 2px; }
.day.in { background: var(--gold); }
.day.in::after { display: none; }
.day.start { border-radius: 12px 0 0 12px; }
.day.end { border-radius: 0 12px 12px 0; }
.legend { display: flex; gap: 16px; font-size: 12px; color: var(--muted); font-weight: 700; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.lg { display: inline-block; width: 8px; height: 8px; border-radius: 50%; }
.lg.ok { background: var(--green); }
.lg.hol { background: #d8f3dc; border: 1.5px solid var(--green); width: 12px; height: 12px; border-radius: 4px; }

.lg.no { background: var(--red); width: 14px; height: 2.5px; border-radius: 2px; }
.chips { display: flex; gap: 10px; width: 100%; }
.chip { flex: 1; font: inherit; font-weight: 900; font-size: 15px; padding: 10px; border: 3px solid var(--ink); border-radius: 12px; background: #fff; color: var(--ink); }
.chip.on { background: var(--gold); }
.chip:disabled { opacity: .3; }
.chip { font-size: 14px; }

/* ---------- Text input ---------- */
input.text { width: 100%; font: inherit; font-size: 17px; font-weight: 700; padding: 14px 16px; border: 3px solid var(--ink); border-radius: 14px; background: var(--bg); color: var(--ink); outline: none; -webkit-user-select: text; user-select: text; }
input.text:focus { background: #fff; box-shadow: 0 0 0 4px rgba(58,134,255,.3); }
.day.in:nth-child(7n) { border-radius: 0 12px 12px 0; }
.day.in:nth-child(7n+1) { border-radius: 12px 0 0 12px; }
.day.end:nth-child(7n+1) { border-radius: 12px; }
