.customer { min-height: 100dvh; }
.waves { position: fixed; inset: 0; z-index: -2; }
.waves svg { width: 100%; height: 100%; display: block; }
.floaters { position: fixed; inset: 0; z-index: -1; perspective: 500px; pointer-events: none; overflow: hidden; }
.floaters img { position: absolute; left: var(--l); top: var(--t); width: var(--w); height: var(--w); opacity: .85; filter: drop-shadow(0 12px 10px rgba(91, 21, 24, .22)); animation: drift 9s ease-in-out infinite; animation-delay: var(--d); }
@keyframes drift {
  0%, 100% { transform: translate3d(0, 0, var(--z)) rotate3d(1, 1, 0, -18deg); }
  50% { transform: translate3d(8px, -24px, calc(var(--z) + 50px)) rotate3d(1, 1, 0, 28deg); }
}

#app { width: min(100%, 480px); margin: 0 auto; padding: calc(14px + env(safe-area-inset-top)) 16px calc(112px + env(safe-area-inset-bottom)); }
.page { animation: pageIn .38s var(--spring); }
@keyframes pageIn { from { opacity: 0; transform: translateY(14px); } }

.splash { position: fixed; inset: 0; z-index: 100; background: var(--cream); overflow: hidden; transition: opacity .42s, transform .42s; }
.splash canvas { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(180vw, 1100px); max-width: none; height: auto; }
.splash.out { opacity: 0; transform: scale(1.06); pointer-events: none; }

/* Welcome */
.hero { text-align: center; padding-top: 6px; }
.hero .logo { width: 172px; height: auto; filter: drop-shadow(0 8px 10px rgba(91, 21, 24, .2)); }
.hero-stage { position: relative; height: 300px; margin: -12px -16px -6px; }
.hero-stage canvas, .hero-stage img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.hero-stage .poster { padding: 56px; animation: drift 9s ease-in-out infinite; --z: 0px; }
.hero h1 { font-size: 34px; margin-bottom: 8px; text-wrap: balance; }
.hero .lead { color: var(--ink-2); margin-bottom: 20px; text-wrap: balance; }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 0 0 22px; padding: 0; list-style: none; }
.steps li { background: rgba(255, 255, 255, .75); border-radius: var(--r); padding: 12px 6px; font-size: 13px; font-weight: 800; color: var(--choc); box-shadow: var(--shadow-clay); line-height: 1.25; }
.steps .i3d { display: block; margin: 0 auto 6px; }

.pending-note { display: flex; gap: 12px; align-items: center; background: #fff; border-radius: var(--r); padding: 12px 14px; box-shadow: var(--shadow-clay); margin-bottom: 16px; font-weight: 700; text-align: left; }

.panel { background: rgba(255, 255, 255, .92); border-radius: var(--r-lg); padding: 20px; box-shadow: var(--shadow-clay); }
.auth h1 { font-size: 28px; margin-bottom: 4px; }
.auth .sub { color: var(--ink-2); margin-bottom: 18px; }
.auth-head { text-align: center; margin-bottom: 14px; }
.auth-head img { width: 120px; height: auto; }
.switch { text-align: center; margin-top: 14px; font-weight: 700; }
.linkish { background: none; border: 0; padding: 10px 6px; font: inherit; font-weight: 800; color: var(--caramel); text-decoration: underline; cursor: pointer; }

/* App header */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.top .logo { width: 74px; height: auto; }
.top h1 { font-size: 26px; }
.chip { display: inline-flex; align-items: center; gap: 6px; background: #fff; border-radius: 999px; padding: 6px 12px 6px 6px; font: 600 15px var(--head); color: var(--choc); box-shadow: var(--shadow-clay); text-decoration: none; }
.hello { font: 600 22px/1.2 var(--head); color: var(--choc); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ===== The 3D loyalty card ===== */
.card-scene { perspective: 1300px; margin: 8px auto 6px; width: 100%; max-width: 440px; }
.card-tilt { transform-style: preserve-3d; transition: transform .25s ease-out; transform: rotateX(var(--tx, 0deg)) rotateY(var(--ty, 0deg)); animation: float 6s ease-in-out infinite; }
@keyframes float { 0%, 100% { translate: 0 0; } 50% { translate: 0 -7px; } }
.card3d {
  display: block; width: 100%; aspect-ratio: 1.586; position: relative; transform-style: preserve-3d;
  background: none; border: 0; padding: 0; cursor: pointer; font: inherit; color: inherit; text-align: left;
  transition: transform 1.25s cubic-bezier(.22, .9, .3, 1); transform: rotateY(var(--spin, 0deg)); touch-action: pan-y;
}
.card3d:focus-visible { outline: none; }
.card3d:focus-visible .face { outline: 3px solid var(--gold); outline-offset: 3px; }
.card-edge { position: absolute; inset: 0; border-radius: 22px; background: #2E0A0C; }
.face {
  position: absolute; inset: 0; border-radius: 22px; overflow: hidden; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  padding: clamp(14px, 4.6vw, 22px); color: #fff; display: flex; flex-direction: column;
  box-shadow: 0 26px 40px -14px rgba(58, 14, 16, .55);
  background: radial-gradient(120% 140% at 12% 0%, #8A3522 0%, #5B1518 48%, #3C0D0F 100%);
}
.face.front { transform: translateZ(4px); }
.face.back { transform: rotateY(180deg) translateZ(4px); background: radial-gradient(120% 140% at 88% 0%, #FFF8DA 0%, #FBEBB9 60%, #F4D08A 100%); color: var(--choc); }
/* foil sheen that follows the tilt */
.face::after { content: ''; position: absolute; inset: -40%; pointer-events: none; background: linear-gradient(105deg, transparent 38%, rgba(255, 255, 255, .22) 49%, rgba(255, 255, 255, .04) 56%, transparent 66%); transform: translateX(var(--sheen, -12%)); transition: transform .25s ease-out; }
.face.back::after { background: linear-gradient(105deg, transparent 42%, rgba(255, 255, 255, .28) 49%, transparent 56%); }
.face .drip { position: absolute; top: -2px; right: 0; width: 62%; opacity: .5; }
.cf-top { display: flex; justify-content: space-between; align-items: flex-start; position: relative; }
.cf-logo { width: clamp(70px, 23vw, 96px); height: auto; filter: drop-shadow(0 3px 4px rgba(0, 0, 0, .4)); }
.cf-tag { font: 600 clamp(10px, 2.8vw, 12px) var(--head); letter-spacing: .14em; text-transform: uppercase; color: #F7D694; text-align: right; }
.cf-member { display: block; font: 700 clamp(10px, 2.8vw, 12px) ui-monospace, Consolas, monospace; letter-spacing: .06em; color: #fff; opacity: .85; margin-top: 2px; }
.cf-body { margin-top: auto; position: relative; min-width: 0; }
/* Long names and emails wrap to a second line rather than being cut off */
.cf-name { font: 600 clamp(16px, 5.4vw, 24px)/1.1 var(--head); color: #fff; overflow: hidden; display: -webkit-box !important; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow-wrap: anywhere; text-shadow: 0 2px 3px rgba(0, 0, 0, .35); }
.cf-line { display: flex; align-items: center; gap: 6px; font-size: clamp(11px, 3.2vw, 14px); font-weight: 700; color: #FBEBC4; min-width: 0; line-height: 1.25; margin-top: 2px; }
.cf-line span { overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow-wrap: anywhere; }
.cf-line .i3d { width: 16px; height: 16px; }

.cb-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: clamp(4px, 1.6vw, 10px); position: relative; }
.cb-title { font: 600 clamp(14px, 4.2vw, 18px)/1.1 var(--head); color: var(--choc); }
.cb-stats { display: flex; gap: 6px; font-weight: 800; font-size: clamp(10px, 2.9vw, 12px); }
.cb-stats span { background: rgba(255, 255, 255, .75); border-radius: 99px; padding: 2px 8px; white-space: nowrap; color: var(--choc); }
.slots { display: grid; grid-template-columns: repeat(5, 1fr); gap: clamp(4px, 1.6vw, 8px); margin: auto 0; position: relative; justify-items: center; }
.slot {
  width: 100%; max-width: 64px; aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center; position: relative;
  background: radial-gradient(circle at 50% 35%, #E8CF9A, #F6E4B6 70%);
  box-shadow: inset 0 3px 6px rgba(91, 21, 24, .3), 0 1px 0 rgba(255, 255, 255, .8);
  font: 600 clamp(11px, 3.4vw, 15px) var(--head); color: #9A7A55;
}
.slot.goal { background: radial-gradient(circle at 50% 35%, #F6C75E, #FBE29A 70%); box-shadow: inset 0 3px 6px rgba(120, 70, 0, .35), 0 0 0 2px var(--gold); }
.slot.goal .i3d { width: 64%; height: 64%; }
.slot .stamp { position: absolute; inset: -6%; width: 112%; height: 112%; filter: drop-shadow(0 3px 3px rgba(58, 14, 16, .4)); }
.slot .stamp.new { animation: stampIn .7s .55s var(--spring) both; }
@keyframes stampIn {
  0% { opacity: 0; transform: translateZ(0) scale(3.2) rotate(-40deg); }
  60% { opacity: 1; transform: scale(.86) rotate(4deg); }
  100% { opacity: 1; transform: scale(1) rotate(0); }
}
.tap-hint { text-align: center; color: var(--ink-2); font-size: 14px; font-weight: 700; margin: 8px 0 14px; }

.progress { display: flex; gap: 12px; align-items: center; padding: 14px; margin-bottom: 12px; }
.bar { height: 12px; border-radius: 99px; background: #F3E3BE; box-shadow: inset 0 2px 3px rgba(91, 21, 24, .18); overflow: hidden; margin-top: 6px; }
.bar i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(180deg, #D97A3A, var(--caramel)); box-shadow: inset 0 2px 0 rgba(255, 255, 255, .35); transition: width .8s var(--spring); }
.progress strong { color: var(--choc); font: 600 17px/1.2 var(--head); display: block; }

.cta-scan { display: flex; align-items: center; gap: 14px; width: 100%; padding: 12px 16px; border: 0; border-radius: var(--r-lg); cursor: pointer; text-align: left; color: #fff; text-decoration: none; background: linear-gradient(135deg, #7A2A1E, #5B1518); box-shadow: 0 6px 0 #3C0D0F, 0 16px 26px rgba(91, 21, 24, .3); margin-bottom: 18px; transition: transform .12s, box-shadow .12s; font: inherit; }
.cta-scan:active { transform: translateY(4px); box-shadow: 0 2px 0 #3C0D0F, 0 6px 10px rgba(91, 21, 24, .3); }
.cta-scan strong { display: block; font: 600 20px/1.2 var(--head); color: #fff; }
.cta-scan small { color: #FBEBC4; font-size: 14px; }

.reward-ticket { position: relative; background: linear-gradient(135deg, #FFF8DE, #FFE9B0); border-radius: 22px; padding: 16px; box-shadow: var(--shadow-clay), 0 0 0 2px var(--gold); margin-bottom: 12px; }
.reward-ticket.used { background: #F6EFE0; box-shadow: var(--shadow-clay); opacity: .8; }
.reward-ticket h3 { font-size: 18px; margin-bottom: 2px; overflow-wrap: anywhere; }
.code-box { display: flex; align-items: center; justify-content: space-between; gap: 8px; background: #fff; border: 2px dashed var(--caramel); border-radius: 14px; padding: 6px 6px 6px 14px; margin: 10px 0 8px; }
.code-box .mono { font-size: 18px; color: var(--choc); }
.section-title { font-size: 20px; margin: 22px 0 10px; }

.redeem { display: flex; gap: 12px; align-items: center; padding: 12px 14px; margin-bottom: 10px; }
.redeem .t { font: 600 16px/1.25 var(--head); color: var(--choc); }
.redeem .btn { flex: none; white-space: nowrap; }

.notif { display: flex; gap: 12px; padding: 14px; margin-bottom: 10px; }
.notif.unread { box-shadow: var(--shadow-clay), inset 4px 0 0 var(--caramel); }
.notif.offer { background: linear-gradient(135deg, #FFF3D0, #FFE2A8); }
.notif h3 { font-size: 17px; overflow-wrap: anywhere; }
.notif p { overflow-wrap: anywhere; white-space: pre-line; }
.empty { text-align: center; padding: 34px 20px; color: var(--ink-2); }
.empty .i3d { margin-bottom: 10px; animation: drift 7s ease-in-out infinite; --z: 0px; }

.info { display: flex; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); min-width: 0; }
.info:last-of-type { border-bottom: 0; }
.info small { display: block; color: var(--ink-2); font-size: 13px; }
.info b { font-weight: 700; overflow-wrap: anywhere; }

/* Scanner */
.scanner { position: relative; aspect-ratio: 1; border-radius: var(--r-lg); overflow: hidden; background: #2E0A0C; box-shadow: 0 18px 34px rgba(58, 14, 16, .4); margin-bottom: 14px; }
.scanner video, .scanner .msg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.scanner .msg { display: grid; place-content: center; justify-items: center; gap: 10px; padding: 24px; color: #FBEBC4; text-align: center; }
.frame { position: absolute; inset: 16%; border-radius: 22px; pointer-events: none; box-shadow: 0 0 0 999px rgba(46, 10, 12, .4); }
.frame::before, .frame::after { content: ''; position: absolute; left: 6%; right: 6%; height: 4px; border-radius: 4px; background: var(--gold); box-shadow: 0 0 14px var(--gold); top: 8%; animation: sweep 2.2s ease-in-out infinite alternate; }
.frame::after { display: none; }
.frame i { position: absolute; width: 34px; height: 34px; border: 5px solid #fff; }
.frame i:nth-child(1) { top: 0; left: 0; border-right: 0; border-bottom: 0; border-radius: 16px 0 0 0; }
.frame i:nth-child(2) { top: 0; right: 0; border-left: 0; border-bottom: 0; border-radius: 0 16px 0 0; }
.frame i:nth-child(3) { bottom: 0; left: 0; border-right: 0; border-top: 0; border-radius: 0 0 0 16px; }
.frame i:nth-child(4) { bottom: 0; right: 0; border-left: 0; border-top: 0; border-radius: 0 0 16px 0; }
@keyframes sweep { to { top: 90%; } }
.or { text-align: center; margin: 16px 0; color: var(--ink-2); font-weight: 800; font-size: 14px; }
.file-btn input { position: absolute; width: 1px; height: 1px; opacity: 0; }

/* Celebration */
.celebrate { position: fixed; inset: 0; z-index: 70; background: rgba(251, 243, 200, .97); overflow-y: auto; animation: fadeIn .25s; }
.celebrate-in { width: min(100%, 480px); margin: 0 auto; padding: calc(24px + env(safe-area-inset-top)) 16px 32px; text-align: center; }
.celebrate h1 { font-size: 32px; margin-bottom: 4px; }
.celebrate .gain { display: inline-flex; align-items: center; gap: 8px; background: #fff; border-radius: 99px; padding: 6px 16px 6px 8px; font: 600 18px var(--head); color: var(--choc); box-shadow: var(--shadow-clay); margin: 10px 0 6px; }
.celebrate .reward-ticket { text-align: left; margin-top: 16px; animation: rise .5s 1s var(--spring) both; }
.celebrate .prize { animation: giftPop 1s var(--spring); }
@keyframes giftPop { 0% { transform: perspective(500px) rotateY(-200deg) scale(.2); } 100% { transform: perspective(500px) rotateY(0) scale(1); } }
@keyframes fadeIn { from { opacity: 0; } }

/* Bottom tab bar */
.tabs { position: fixed; z-index: 40; left: 50%; transform: translateX(-50%); bottom: calc(10px + env(safe-area-inset-bottom)); width: min(calc(100% - 20px), 460px); display: grid; grid-template-columns: repeat(5, 1fr); align-items: end; background: rgba(255, 255, 255, .95); backdrop-filter: blur(10px); border-radius: 24px; padding: 6px; box-shadow: 0 14px 30px rgba(58, 14, 16, .24), inset 0 2px 0 #fff; }
.tabs[hidden] { display: none; }
.tab { position: relative; display: grid; justify-items: center; gap: 1px; min-height: 54px; padding: 5px 2px 3px; border-radius: 18px; color: var(--ink-2); text-decoration: none; font-size: 12px; font-weight: 800; transition: background .2s, color .2s; }
.tab .i3d { width: 28px; height: 28px; transition: transform .28s var(--spring); }
.tab[aria-current=page] { color: var(--choc); background: var(--cream-2); }
.tab[aria-current=page] .i3d { transform: translateY(-3px) scale(1.14) rotate(-5deg); }
.tab.main .i3d { width: 44px; height: 44px; margin-top: -24px; filter: drop-shadow(0 8px 8px rgba(91, 21, 24, .4)); }
.badge { position: absolute; top: 2px; left: 54%; background: var(--rasp); color: #fff; font-size: 11px; font-weight: 800; min-width: 18px; height: 18px; border-radius: 9px; padding: 0 4px; display: grid; place-items: center; box-shadow: 0 2px 4px rgba(0, 0, 0, .25); }

@media (max-width: 340px) {
  .hero h1 { font-size: 28px; }
  .steps li { font-size: 12px; }
}
