/* Santa's Midnight Spin — glossy 3D-cartoon UI */
:root { --navy: #0b1640; --gold: #ffcf4a; --gold2: #f5a623; --red: #e5243b; --red2: #a8102a; --green: #1f9d6b; --snow: #fffaf0; --ink: #2b1a12;
  --display: 'Lilita One', 'Kantumruy Pro', sans-serif; --body: 'Nunito', 'Kantumruy Pro', system-ui, sans-serif; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #050a24; overscroll-behavior: none; }
body { font-family: var(--body); color: var(--snow); user-select: none; -webkit-user-select: none; }
[hidden] { display: none !important; }
button, input, a { font: inherit; }

.backdrop { position: fixed; inset: 0; background: center/cover no-repeat; filter: blur(16px) brightness(.6); transform: scale(1.08); }
.stage { position: relative; width: 100%; max-width: 480px; height: 100%; height: 100dvh; margin: 0 auto; overflow: hidden; isolation: isolate;
  background: radial-gradient(120% 80% at 50% 100%, #1d3a7a 0%, var(--navy) 55%, #050a24 100%); }
@media (min-width: 700px) { .stage { box-shadow: 0 0 0 1px rgba(255,255,255,.08), 0 30px 90px rgba(0,0,0,.7); } }
.layer { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.bgv { object-fit: cover; z-index: 0; }
.shade { z-index: 1; pointer-events: none; background: linear-gradient(180deg, rgba(5,10,36,.35), transparent 25%, transparent 70%, rgba(5,10,36,.45)); transition: background .8s; }
.stage.win .shade { background: rgba(5,10,36,.55); }
#snow { z-index: 2; pointer-events: none; }
#fx { z-index: 60; pointer-events: none; }
.flash { position: absolute; inset: 0; z-index: 61; background: #fff; opacity: 0; pointer-events: none; }
.flash.go { animation: flash .7s ease-out; }
@keyframes flash { 0% { opacity: .9; } 100% { opacity: 0; } }

/* screens */
.screen { position: absolute; inset: 0; z-index: 5; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
  padding: 64px 18px 20px; opacity: 0; visibility: hidden; transform: scale(1.03); transition: opacity .5s, transform .5s, visibility .5s; }
.screen.on { opacity: 1; visibility: visible; transform: none; }
.logo { width: 100%; max-width: 390px; animation: float 4s ease-in-out infinite; position: relative; z-index: 3; }
.logo img { width: 100%; height: auto; filter: drop-shadow(0 10px 24px rgba(0,0,0,.5)); }
.logo.small { max-width: 270px; margin-top: -6px; }
.logo-text { font-family: var(--display); font-size: clamp(34px, 11vw, 52px); line-height: .95; color: var(--gold); text-shadow: 0 3px 0 var(--red2), 0 8px 24px rgba(0,0,0,.6); }
@keyframes float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }
.sub { position: relative; z-index: 3; font-weight: 800; font-size: 15px; margin: 10px 0 22px; text-shadow: 0 2px 8px rgba(0,0,0,.8); }
.brand { position: relative; z-index: 3; margin-top: 12px; font-size: 12px; font-weight: 800; opacity: .85; text-shadow: 0 1px 4px #000; }
.event-line { position: relative; z-index: 3; margin: 0 0 4px; padding: 4px 12px; border-radius: 99px; font-size: 12px; font-weight: 900; background: rgba(11,22,64,.7); border: 1px solid var(--gold); }
.hint { position: relative; z-index: 3; margin: 8px 0 0; font-size: 12.5px; font-weight: 800; opacity: .9; text-shadow: 0 1px 6px #000; }

.pile { position: absolute; left: 50%; bottom: -8px; transform: translateX(-50%); width: 108%; max-width: 520px; pointer-events: none; z-index: 1; filter: drop-shadow(0 -4px 14px rgba(0,0,0,.35)); }
.santa { position: absolute; left: -2%; bottom: 0; height: min(30%, 260px); pointer-events: none; z-index: 2; filter: drop-shadow(0 10px 18px rgba(0,0,0,.45)); animation: cheer 2.4s ease-in-out infinite; transform-origin: bottom center; }
@keyframes cheer { 0%,100% { transform: rotate(-2deg); } 50% { transform: rotate(2deg) translateY(-4px); } }
#scr-intro .santa { left: 50%; margin-left: -24%; height: min(34%, 290px); }
#scr-intro > .logo, #scr-intro > .sub, #scr-intro > .btn, #scr-intro > .brand { position: relative; z-index: 4; }

/* buttons */
.btn { position: relative; z-index: 4; display: block; width: 100%; max-width: 300px; margin: 8px auto 0; padding: 15px 18px; border: 0; border-radius: 999px; cursor: pointer;
  font-family: var(--display); font-size: 22px; letter-spacing: 1px; text-decoration: none; text-align: center; transition: transform .1s, box-shadow .1s, filter .2s; }
.btn:active { transform: translateY(4px); }
.btn:disabled { filter: grayscale(1) brightness(.85); cursor: default; animation: none; }
.btn-gold { background: linear-gradient(180deg, #ffe58a, var(--gold) 45%, var(--gold2)); color: var(--red2); box-shadow: 0 5px 0 #b86f0e, 0 10px 24px rgba(0,0,0,.35); }
.btn-gold:active { box-shadow: 0 1px 0 #b86f0e; }
.btn-red { background: linear-gradient(180deg, #ff5a6e, var(--red) 45%, var(--red2)); color: #fff; box-shadow: 0 6px 0 #6d0618, 0 12px 26px rgba(0,0,0,.4); text-shadow: 0 2px 0 rgba(0,0,0,.25); }
.btn-red:active { box-shadow: 0 1px 0 #6d0618; }
.btn-ghost { background: transparent; color: #7a5a3a; box-shadow: none; font-size: 16px; padding: 8px; }
#spin { font-size: 30px; padding: 13px; max-width: 240px; margin-top: 4px; }
.pulse { animation: pulse 1.5s ease-in-out infinite; }
@keyframes pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.05); } }
.icon-btn { width: 42px; height: 42px; border-radius: 50%; border: 2px solid rgba(255,255,255,.5); background: rgba(11,22,64,.6); color: #fff; font-size: 18px; cursor: pointer; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }

/* HUD */
.hud { position: absolute; top: max(10px, env(safe-area-inset-top)); left: 12px; right: 12px; z-index: 30; display: flex; justify-content: space-between; align-items: center; }
.hud-right { display: flex; gap: 8px; }
.pill { background: rgba(11,22,64,.72); border: 2px solid var(--gold); border-radius: 999px; padding: 6px 14px; font-weight: 900; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.pill b { color: var(--gold); font-size: 19px; }
.pill.bump { animation: bump .5s; }
@keyframes bump { 50% { transform: scale(1.25); } }
.menu { position: absolute; top: 52px; right: 0; display: flex; flex-direction: column; min-width: 220px; padding: 6px; border-radius: 16px; background: var(--snow); box-shadow: 0 14px 40px rgba(0,0,0,.5); }
.menu button, .menu a { background: none; border: 0; text-align: left; padding: 12px 14px; font-weight: 800; font-size: 15px; color: var(--ink); border-radius: 10px; cursor: pointer; text-decoration: none; }
.menu button:hover, .menu a:hover { background: #f3e7d3; }
.menu .danger { color: var(--red); }

/* WHEEL */
#scr-game { justify-content: center; padding-top: 56px; padding-bottom: 7vh; }
.wheel-area { position: relative; z-index: 3; width: 100%; display: flex; justify-content: center; margin-top: 16px; }
.wheel { position: relative; width: min(90vw, 54vh, 420px); aspect-ratio: 1; touch-action: none; cursor: grab; z-index: 2; }
.wheel:active { cursor: grabbing; }
.wheel-glow { position: absolute; inset: -9%; border-radius: 50%; background: radial-gradient(circle, rgba(255,214,90,.55) 0%, rgba(255,214,90,.18) 45%, rgba(255,214,90,0) 70%); animation: glow 2.4s ease-in-out infinite; pointer-events: none; }
@keyframes glow { 50% { transform: scale(1.06); opacity: .75; } }
.stage.spinning .wheel-glow { animation-duration: .5s; }
#face, #rim { position: absolute; inset: 0; width: 100%; height: 100%; }
#face { will-change: transform; filter: drop-shadow(0 0 0 transparent); }
#rim { pointer-events: none; }
.hub { position: absolute; left: 50%; top: 50%; width: 23%; transform: translate(-50%, -50%); pointer-events: none; filter: drop-shadow(0 6px 10px rgba(0,0,0,.45)); }
.pointer { position: absolute; left: 50%; top: -6.5%; width: 13%; transform-origin: 50% 14%; transform: translateX(-50%); pointer-events: none; filter: drop-shadow(0 6px 8px rgba(0,0,0,.45)); z-index: 3; }
.game-pile { position: absolute; bottom: -9%; width: 92%; max-width: 440px; z-index: 1; }
.game-santa { height: min(25%, 210px); bottom: 0; left: -4%; z-index: 3; }
#scr-game .btn, #scr-game .hint { margin-left: auto; margin-right: auto; }
#scr-game .btn { margin-top: 26px; }
@media (max-height: 700px) { .logo.small { max-width: 210px; } .wheel { width: min(80vw, 50vh, 360px); } #spin { font-size: 26px; padding: 11px; } .game-santa { height: 20%; } }

/* RESULT */
.result { position: absolute; inset: 0; z-index: 50; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; padding: 56px 18px 18px; background: rgba(5,10,36,.55); backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px); overflow-y: auto; }
.ny { width: 100%; max-width: 340px; animation: nyin .9s cubic-bezier(.2,1.5,.4,1) both; }
.ny img { display: block; margin: 0 auto; width: auto; max-width: 100%; max-height: 19vh; filter: drop-shadow(0 0 24px rgba(255,200,80,.6)); }
@keyframes nyin { 0% { opacity: 0; transform: scale(.5); } 100% { opacity: 1; transform: none; } }
.card { position: relative; width: 100%; max-width: 350px; margin-top: 42px; padding: 64px 18px 12px; border-radius: 22px; color: var(--ink); text-align: center;
  background: var(--snow); border: 4px solid var(--gold); box-shadow: 0 0 0 4px var(--red), 0 24px 60px rgba(0,0,0,.6); animation: cardin .7s .15s cubic-bezier(.2,1.4,.4,1) both; }
@keyframes cardin { 0% { transform: translateY(80px) scale(.8); opacity: 0; } 100% { transform: none; opacity: 1; } }
.card-box { position: absolute; left: 50%; top: -74px; width: 132px; transform: translateX(-50%); filter: drop-shadow(0 10px 16px rgba(0,0,0,.4)); animation: bob 2s ease-in-out infinite; }
@keyframes bob { 0%,100% { transform: translateX(-50%) translateY(0); } 50% { transform: translateX(-50%) translateY(-6px); } }
.ribbon { position: absolute; top: -18px; left: 50%; transform: translateX(-50%); white-space: nowrap; padding: 6px 22px; border-radius: 10px; color: #fff;
  font-family: var(--display); font-size: 18px; letter-spacing: 1px; background: linear-gradient(180deg, #ff5a6e, var(--red)); box-shadow: 0 4px 0 var(--red2); }
.card .ribbon { top: 44px; }
.prize { margin: 18px 0 4px; padding: 10px; border-radius: 14px; font-family: var(--display); font-size: 38px; color: var(--red2);
  background: linear-gradient(135deg, #ffe58a, var(--gold) 50%, #ffb43a); box-shadow: 0 0 30px rgba(255,190,60,.8); }
.claim { margin-top: 10px; text-align: left; font-size: 13px; }
.row { display: flex; justify-content: space-between; gap: 10px; padding: 5px 2px; border-bottom: 1px dashed #e4d3b8; }
.row span { color: #8a6c4f; font-weight: 700; } .row b { font-weight: 900; text-align: right; }
#code { color: var(--red); letter-spacing: 1px; font-size: 16px; }
.claim-note { margin: 10px 0 4px; padding: 8px 10px; border-radius: 10px; text-align: center; font-weight: 800; font-size: 12.5px; color: var(--red2); background: #fff0c2; border: 2px solid var(--gold); }
.card .btn { padding: 12px; font-size: 19px; }
.card .btn-ghost { font-size: 15px; padding: 6px; }

/* MODALS */
.modal-bg { position: absolute; inset: 0; z-index: 70; display: grid; place-items: center; padding: 20px; background: rgba(3,8,30,.6); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.modal { position: relative; width: 100%; max-width: 340px; padding: 36px 20px 16px; border-radius: 22px; text-align: center; color: var(--ink); background: var(--snow);
  border: 4px solid var(--gold); box-shadow: 0 0 0 4px var(--red), 0 24px 60px rgba(0,0,0,.6); animation: cardin .45s cubic-bezier(.2,1.4,.4,1); }
.modal label { display: block; text-align: left; font-size: 11px; font-weight: 900; letter-spacing: 1px; color: var(--red2); margin: 10px 0 4px; }
.modal input { width: 100%; padding: 13px 14px; border-radius: 12px; border: 2px solid #e2cfae; background: #fff; color: var(--ink); font-size: 17px; font-weight: 800; outline: none; user-select: text; -webkit-user-select: text; }
.modal input:focus { border-color: var(--red); }
#pin { letter-spacing: 8px; text-align: center; }
.modal-text { font-weight: 700; font-size: 14px; margin: 4px 0 12px; }
.err { margin: 10px 0 0; padding: 9px; border-radius: 10px; font-weight: 800; font-size: 13px; color: #fff; background: var(--red); }
.prize-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 6px 0 12px; }
.prize-grid div { padding: 12px 4px; border-radius: 12px; font-weight: 900; font-size: 13px; color: var(--red2); background: #fff; border: 2px solid #f1dcae; }
.prize-grid div.rare { background: linear-gradient(135deg, #ffe58a, var(--gold)); border-color: #fff; box-shadow: 0 4px 12px rgba(245,166,35,.5); }
.list { max-height: 300px; overflow: auto; text-align: left; margin-bottom: 8px; }
.list div { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 6px; border-bottom: 1px dashed #e4d3b8; font-weight: 800; font-size: 14px; }
.list small { display: block; color: #8a6c4f; font-weight: 700; font-size: 11.5px; }
.list p { color: #8a6c4f; text-align: center; padding: 18px; }
.tag { font-size: 10.5px; padding: 3px 8px; border-radius: 99px; font-weight: 900; } .tag.paid { background: #dff5ea; color: #12603e; } .tag.unpaid { background: #fff0c2; color: #8a5a00; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01s !important; animation-iteration-count: 1 !important; } }
