@font-face { font-family: 'Playfair'; src: url('../fonts/playfair.woff2') format('woff2'); font-weight: 400 900; font-style: normal; font-display: swap; }
:root {
  --brown: #3b2113; --brown2: #5a3520; --brown3: #7a4a2e; --cream: #f6ead7; --cream2: #ecd9ba; --caramel: #d9772b; --caramel-d: #b45b17; --green: #86b34a; --ink: #2a170c;
  --serif: 'Playfair', Georgia, 'Times New Roman', serif; --sans: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px); --safe-l: env(safe-area-inset-left, 0px); --safe-r: env(safe-area-inset-right, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--brown); color: var(--ink); font-family: var(--sans); overflow: hidden; overscroll-behavior: none; touch-action: manipulation; -webkit-text-size-adjust: 100%; }
body { position: fixed; inset: 0; }
button { font: inherit; color: inherit; cursor: pointer; }
#app { position: absolute; inset: 0; height: 100dvh; overflow: hidden; }
#stage { position: absolute; inset: 0; display: block; touch-action: none; }
h1, h2, h3 { font-family: var(--serif); margin: 0; letter-spacing: .2px; }

/* HUD */
#hud { position: absolute; left: 0; right: 0; top: 0; padding: calc(var(--safe-t) + 8px) calc(var(--safe-r) + 12px) 6px calc(var(--safe-l) + 12px); z-index: 5; pointer-events: none;
  background: linear-gradient(180deg, rgba(59,33,19,.94), rgba(59,33,19,.78) 78%, rgba(59,33,19,0)); color: var(--cream); }
#hud > * { pointer-events: auto; }
.hud-row { display: flex; align-items: center; gap: 10px; max-width: 760px; margin: 0 auto; }
.brandbtn { background: none; border: 0; padding: 0; display: grid; place-items: center; flex: none; }
.lvl { flex: 1; min-width: 0; line-height: 1.15; }
.lvl b { font-family: var(--serif); font-weight: 800; font-size: 18px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lvl small { opacity: .8; font-size: 12.5px; font-weight: 600; letter-spacing: .3px; }
.lvl small i { font-style: normal; color: #ffd9a0; font-weight: 800; }
.icon { width: 44px; height: 44px; border-radius: 13px; border: 0; display: grid; place-items: center; background: rgba(246,234,215,.14); color: var(--cream); flex: none; transition: transform .1s, background .15s; }
.icon:active { transform: scale(.92); background: rgba(246,234,215,.28); }
.icon svg { width: 22px; height: 22px; }
.prog { display: flex; align-items: center; gap: 8px; max-width: 760px; margin: 7px auto 0; font-size: 12px; font-weight: 700; letter-spacing: .3px; color: #ffe2b8; }
.prog .bar { flex: 1; height: 8px; border-radius: 5px; background: rgba(0,0,0,.28); overflow: hidden; box-shadow: inset 0 1px 2px rgba(0,0,0,.35); }
.prog .bar i { display: block; height: 100%; width: 0; border-radius: 5px; background: linear-gradient(90deg, #f0a24a, #ffcf7a); transition: width .5s cubic-bezier(.2,.8,.2,1); }
.prog svg { width: 18px; height: 18px; flex: none; }
.prog .lbl { white-space: nowrap; }

/* bottom bar */
#bar { position: absolute; left: 0; right: 0; bottom: calc(var(--safe-b) + 40px); display: flex; justify-content: center; gap: 14px; z-index: 5; pointer-events: none; }
#bar > * { pointer-events: auto; }
.rb { width: 58px; height: 58px; border-radius: 50%; border: 0; display: grid; place-items: center; color: var(--cream);
  background: linear-gradient(180deg, #6a3f25, #4a2a17); box-shadow: 0 4px 0 #2a150a, 0 8px 14px rgba(30,12,4,.4), inset 0 1px 0 rgba(255,255,255,.18); transition: transform .08s, box-shadow .08s; position: relative; }
.rb:active { transform: translateY(3px); box-shadow: 0 1px 0 #2a150a, 0 3px 8px rgba(30,12,4,.4); }
.rb svg { width: 26px; height: 26px; }
.rb span { position: absolute; bottom: -17px; font-size: 10.5px; font-weight: 700; color: var(--cream); text-shadow: 0 1px 2px rgba(0,0,0,.5); letter-spacing: .3px; white-space: nowrap; }
.rb:disabled { opacity: .4; }
#foot { position: absolute; left: 0; right: 0; bottom: 0; z-index: 4; text-align: center; font-size: 10.5px; font-weight: 700; letter-spacing: .5px; color: rgba(246,234,215,.86); padding: 4px 10px calc(var(--safe-b) + 4px); background: rgba(40,20,9,.78); pointer-events: none; }
#foot b { color: #ffcf7a; }

/* overlays */
#layer { position: absolute; inset: 0; z-index: 10; pointer-events: none; }
.scrim { position: absolute; inset: 0; display: grid; place-items: center; padding: calc(var(--safe-t) + 14px) 14px calc(var(--safe-b) + 34px); background: rgba(35,17,7,.55); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); pointer-events: auto; overflow-y: auto; animation: fade .25s ease both; }
.scrim.clear { background: rgba(35,17,7,.18); backdrop-filter: none; -webkit-backdrop-filter: none; }
.card { position: relative; width: min(100%, 420px); background: linear-gradient(180deg, #fbf2e2, var(--cream)); border-radius: 26px; padding: 22px 20px 20px; text-align: center; color: var(--ink);
  box-shadow: 0 2px 0 rgba(255,255,255,.7) inset, 0 -5px 0 rgba(180,110,50,.16) inset, 0 20px 50px rgba(20,8,2,.5); animation: pop .42s cubic-bezier(.2,1.2,.3,1) both; margin: auto; }
.card h1 { font-size: 34px; line-height: 1.05; font-weight: 800; color: var(--brown); }
.card h2 { font-size: 26px; line-height: 1.1; font-weight: 800; color: var(--brown); }
.card p { margin: 8px 0 0; color: #5d4330; font-size: 15px; line-height: 1.4; }
.btn { display: block; width: 100%; min-height: 54px; border: 0; border-radius: 17px; font-weight: 800; font-size: 18px; letter-spacing: .3px; color: #fff; padding: 12px 18px;
  background: linear-gradient(180deg, #ec8f3d, var(--caramel)); box-shadow: 0 5px 0 var(--caramel-d), 0 10px 18px rgba(120,60,10,.3), inset 0 1px 0 rgba(255,255,255,.4); text-shadow: 0 1px 0 rgba(120,50,0,.35); transition: transform .08s, box-shadow .08s; }
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--caramel-d), 0 3px 8px rgba(120,60,10,.3), inset 0 1px 0 rgba(255,255,255,.4); }
.btn.ghost { background: #fff8ea; color: var(--brown); text-shadow: none; box-shadow: 0 4px 0 #cfb38a, 0 8px 14px rgba(80,40,10,.15), inset 0 1px 0 #fff; border: 1.5px solid #e3cba3; min-height: 48px; font-size: 16px; }
.btn.ghost:active { box-shadow: 0 1px 0 #cfb38a; }
.btn.dark { background: linear-gradient(180deg, #6a3f25, var(--brown2)); box-shadow: 0 5px 0 #2a150a, inset 0 1px 0 rgba(255,255,255,.2); }
.btn.sm { min-height: 42px; font-size: 15px; border-radius: 14px; padding: 8px 14px; }
.row { display: flex; gap: 10px; } .row > * { flex: 1; min-width: 0; }
.stack { display: grid; gap: 11px; margin-top: 16px; }
.link { background: none; border: 0; color: var(--brown3); font-weight: 700; font-size: 14.5px; text-decoration: underline; text-underline-offset: 3px; padding: 8px; }
.x { position: absolute; top: 10px; right: 10px; width: 36px; height: 36px; border-radius: 50%; border: 0; background: rgba(59,33,19,.08); color: var(--brown); display: grid; place-items: center; }
.x svg { width: 18px; height: 18px; }
.tag { display: inline-block; font-size: 11px; font-weight: 800; letter-spacing: 1.2px; text-transform: uppercase; color: #fff; background: var(--brown2); padding: 4px 10px; border-radius: 99px; }

/* splash */
.splash .logo { filter: drop-shadow(0 8px 14px rgba(40,18,6,.35)); }
.splash .logo .steam path { stroke-dasharray: 40; stroke-dashoffset: 40; animation: steam 2.6s ease-in-out infinite; }
.splash .logo .steam path:nth-child(2) { animation-delay: .5s; } .splash .logo .steam path:nth-child(3) { animation-delay: 1s; }
.brandname { font-family: var(--serif); font-weight: 800; font-size: 15px; letter-spacing: 3px; text-transform: uppercase; color: var(--brown3); margin: 10px 0 6px; }
.how { display: flex; gap: 10px; align-items: center; text-align: left; background: rgba(217,119,43,.12); border-radius: 14px; padding: 10px 12px; margin-top: 14px; font-size: 13.5px; color: #5d4330; line-height: 1.35; }
.how svg { width: 26px; height: 26px; flex: none; color: var(--caramel-d); }
.langs { display: inline-flex; border-radius: 99px; background: rgba(59,33,19,.1); padding: 3px; gap: 2px; }
.langs button { border: 0; background: none; padding: 6px 14px; border-radius: 99px; font-weight: 800; font-size: 13px; color: var(--brown3); letter-spacing: .5px; }
.langs button.on { background: var(--brown); color: var(--cream); }
.langwrap { margin-top: 12px; }

/* level card */
.stars { display: flex; justify-content: center; gap: 6px; margin: 4px 0 2px; }
.stars svg { width: 46px; height: 46px; filter: drop-shadow(0 3px 0 rgba(120,70,10,.25)); }
.stars svg.on { animation: starin .5s cubic-bezier(.2,1.5,.3,1) both; } .stars svg.off { opacity: .25; }
.stars svg:nth-child(2) { animation-delay: .12s; } .stars svg:nth-child(3) { animation-delay: .24s; }
.stats { margin: 14px 0 0; border-top: 1.5px dashed #d5b88c; }
.stats div { display: flex; justify-content: space-between; padding: 8px 4px; font-size: 15px; color: #5d4330; border-bottom: 1.5px dashed #d5b88c; }
.stats b { color: var(--brown); font-variant-numeric: tabular-nums; }
.stats .tot { font-size: 19px; border: 0; } .stats .tot b { color: var(--caramel-d); font-family: var(--serif); font-size: 24px; }

/* coupon ticket */
.ticket { padding: 0; overflow: hidden; width: min(100%, 400px); }
.ticket .top { background: linear-gradient(180deg, var(--brown2), var(--brown)); color: var(--cream); padding: 16px 16px 14px; position: relative; }
.ticket .top .logo { margin-bottom: 4px; }
.ticket .top .nm { font-family: var(--serif); font-size: 15px; letter-spacing: 3px; text-transform: uppercase; font-weight: 800; }
.ribbon { position: absolute; top: 20px; right: -44px; transform: rotate(38deg); background: #c43c2b; color: #fff; font-size: 10px; font-weight: 800; letter-spacing: 1.2px; padding: 4px 46px; box-shadow: 0 2px 6px rgba(0,0,0,.3); }
.ticket .body { padding: 16px 18px 6px; position: relative; }
.ticket .body h2 { font-size: 27px; }
.perf { position: relative; height: 0; border-top: 2.5px dashed #cdb089; margin: 14px 0 0; }
.perf::before, .perf::after { content: ''; position: absolute; top: -14px; width: 26px; height: 26px; border-radius: 50%; background: rgba(35,17,7,.55); }
.perf::before { left: -13px; } .perf::after { right: -13px; }
.code { font-family: ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace; font-weight: 800; font-size: 31px; letter-spacing: 3.5px; color: var(--brown); background: #fff8ea; border: 2px solid #e3cba3; border-radius: 14px; padding: 12px 6px; margin: 14px 0 8px; user-select: all; -webkit-user-select: all; }
.barcode { height: 38px; margin: 10px auto 2px; display: block; }
.meta { display: flex; justify-content: space-between; font-size: 12.5px; color: #7a5a40; font-weight: 700; padding: 4px 2px; }
.note { font-size: 12px; color: #8a6a50; margin-top: 6px; line-height: 1.35; }
.note.warn { color: #a3361f; font-weight: 700; }

/* forms */
.field { display: block; text-align: left; margin-top: 12px; font-size: 13px; font-weight: 700; color: var(--brown3); }
.field input[type=text], .field input[type=email] { width: 100%; margin-top: 5px; font: inherit; font-size: 17px; padding: 12px 14px; border-radius: 13px; border: 2px solid #e0c79c; background: #fffaf0; color: var(--ink); outline: none; }
.field input:focus { border-color: var(--caramel); box-shadow: 0 0 0 3px rgba(217,119,43,.2); }
.consent { display: flex; gap: 10px; align-items: flex-start; text-align: left; margin-top: 14px; font-size: 12.5px; line-height: 1.4; color: #5d4330; }
.consent input { width: 22px; height: 22px; flex: none; accent-color: var(--caramel); margin-top: 1px; }
.err { color: #b3321d; font-size: 13px; font-weight: 700; min-height: 18px; margin-top: 8px; text-align: left; }

/* lists */
.list { list-style: none; margin: 14px 0 0; padding: 0; text-align: left; }
.list li { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 13px; font-weight: 700; color: var(--brown); }
.list li:nth-child(odd) { background: rgba(217,119,43,.09); }
.list li.me { background: linear-gradient(90deg, #ffe3b6, #ffd08a); box-shadow: 0 0 0 2px var(--caramel) inset; }
.list .rk { width: 26px; font-family: var(--serif); font-size: 17px; color: var(--caramel-d); text-align: center; } .list .nm { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .list .sc { font-variant-numeric: tabular-nums; font-family: var(--serif); font-size: 18px; }
.menu { display: grid; gap: 9px; margin-top: 16px; }
.menu .btn.ghost { display: flex; align-items: center; gap: 12px; text-align: left; justify-content: flex-start; }
.menu .btn svg { width: 22px; height: 22px; flex: none; color: var(--caramel-d); }
.menu .btn em { margin-left: auto; font-style: normal; font-size: 14px; color: var(--brown3); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; justify-content: center; }
.chip { border: 0; padding: 10px 14px; border-radius: 12px; background: var(--brown); color: var(--cream); font-weight: 800; font-size: 14px; }
.evlog { text-align: left; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 11.5px; background: #2a170c; color: #f3dfbf; border-radius: 12px; padding: 10px 12px; margin-top: 8px; max-height: 150px; overflow: auto; line-height: 1.55; }
.evlog b { color: #ffcf7a; }
.h3 { font-family: var(--serif); font-size: 17px; font-weight: 800; color: var(--brown); text-align: left; margin: 18px 0 0; }
.coupon-mini { display: flex; align-items: center; gap: 10px; text-align: left; padding: 10px 12px; border-radius: 13px; background: #fff8ea; border: 1.5px dashed #cdb089; margin-top: 8px; }
.coupon-mini b { font-family: ui-monospace, Menlo, Consolas, monospace; letter-spacing: 1.5px; color: var(--brown); }
.coupon-mini small { display: block; color: #8a6a50; font-weight: 700; }

#toast { position: absolute; left: 50%; bottom: calc(var(--safe-b) + 128px); transform: translate(-50%, 20px); background: var(--brown); color: var(--cream); padding: 10px 18px; border-radius: 99px; font-weight: 700; font-size: 14px; opacity: 0; transition: opacity .25s, transform .25s; z-index: 30; pointer-events: none; box-shadow: 0 6px 18px rgba(0,0,0,.35); white-space: nowrap; max-width: 92vw; overflow: hidden; text-overflow: ellipsis; }
#toast.on { opacity: 1; transform: translate(-50%, 0); }
#stuck { position: absolute; left: 14px; right: 14px; bottom: calc(var(--safe-b) + 122px); z-index: 6; margin: 0 auto; width: fit-content; max-width: 380px; background: rgba(59,33,19,.94); color: var(--cream); padding: 10px 16px; border-radius: 14px; font-weight: 700; font-size: 14px; text-align: center; opacity: 0; transform: translateY(10px); transition: all .25s; pointer-events: none; }
#stuck.on { opacity: 1; transform: none; }

@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(24px) scale(.94); } }
@keyframes steam { 0% { stroke-dashoffset: 40; opacity: 0; } 30% { opacity: 1; } 70% { stroke-dashoffset: 0; opacity: .8; } 100% { stroke-dashoffset: -40; opacity: 0; } }
@keyframes starin { from { transform: scale(0) rotate(-40deg); opacity: 0; } }

@media (max-height: 560px) and (orientation: landscape) {
  .prog { display: none; } .lvl b { font-size: 16px; } #hud { padding-top: calc(var(--safe-t) + 4px); }
  .rb { width: 46px; height: 46px; } .rb svg { width: 22px; height: 22px; } .rb span { display: none; } #bar { bottom: calc(var(--safe-b) + 24px); }
  .card { padding: 14px 16px 14px; } .card h1 { font-size: 26px; } .stack { margin-top: 10px; gap: 8px; } .btn { min-height: 46px; font-size: 16px; }
  .stars svg { width: 36px; height: 36px; } .code { font-size: 26px; padding: 8px; margin: 8px 0 4px; } .how { display: none; } .splash .logo { width: 64px; height: 64px; }
}
@media (max-height: 560px) and (orientation: landscape) {
  .ticket { width: min(100%, 780px); } .ticket .top { padding: 7px 12px; display: flex; align-items: center; gap: 10px; justify-content: center; } .ticket .top .logo { width: 30px; height: 30px; margin: 0; } .ticket .top .nm { font-size: 13px; }
  .ticket .body { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; align-items: start; padding: 10px 18px 4px; text-align: left; } .ticket .body h2 { font-size: 22px; } .perf { display: none; } .ticket .code { font-size: 25px; letter-spacing: 2.5px; margin: 10px 0 4px; text-align: center; }
  .ticket .barcode { height: 26px; margin: 0 auto; } .ticket .note { margin-top: 3px; font-size: 11px; } .ticket .body .tag { margin-bottom: 2px; } .scrim { padding-bottom: calc(var(--safe-b) + 28px); }
}
@media (min-width: 900px) { .card { width: min(100%, 460px); } .ticket { width: min(100%, 430px); } }
@media (prefers-reduced-motion: reduce) { .card, .scrim { animation: none; } .splash .logo .steam path { animation: none; stroke-dashoffset: 0; } }
