/* BIPY GACHA POP · Market-In 6.0 Y2K × Bpedia.
   Satu layar: mesin di tengah, tombol GACHA! selalu terlihat tanpa gulir pada
   HP, tablet, layar lipat, laptop, dan PC. Ukuran mesin dihitung game.js (--mw)
   dari ruang yang benar-benar tersisa, termasuk gamebar arcade dan notch. */

@font-face { font-family: Poppins; font-weight: 400; font-display: swap; src: url('/g/gacha/assets/fonts/Poppins-400.woff2') format('woff2'); }
@font-face { font-family: Poppins; font-weight: 500; font-display: swap; src: url('/g/gacha/assets/fonts/Poppins-500.woff2') format('woff2'); }
@font-face { font-family: Poppins; font-weight: 600; font-display: swap; src: url('/g/gacha/assets/fonts/Poppins-600.woff2') format('woff2'); }
@font-face { font-family: Poppins; font-weight: 700; font-display: swap; src: url('/g/gacha/assets/fonts/Poppins-700.woff2') format('woff2'); }
@font-face { font-family: Poppins; font-weight: 800; font-display: swap; src: url('/g/gacha/assets/fonts/Poppins-800.woff2') format('woff2'); }
@font-face { font-family: Fraunces; font-style: italic; font-weight: 300 900; font-display: swap; src: url('/g/gacha/assets/fonts/Fraunces-Italic-Variable.woff2') format('woff2'); }

:root {
  --pink-500: #e62b5e;
  --pink-600: #d81f57;
  --berry-700: #b3164b;
  --plum-900: #45122b;
  --night-950: #2a0a18;
  --tulip-300: #f9a2c1;
  --pink-200: #fbcfdb;
  --blush-100: #fde7ec;
  --pearl-50: #fff7f8;
  --honey-400: #f5b83d;
  --sky: #39a7e5;
  --lilac: #9c8cff;
  --mint: #9fd6a4;
  --sun: #ffd23f;
  --ink: #1d0b12;
  --bg: radial-gradient(120% 90% at 50% 0%, #6b1439 0%, #3a0d22 46%, #1c0610 100%);
  --text: #fff7f8;
  --muted: #f9a2c1;
  --soft: #ffffff14;
  --panel: #2a0a18cc;
  --panel-line: #f9a2c133;
  --chip: #ffffff12;
  --checker-a: #e62b5e;
  --checker-op: .07;
  --mw: 300px;
  --radius: 22px;
  color-scheme: dark;
}
html[data-theme="light"] {
  --bg: radial-gradient(120% 90% at 50% 0%, #ffe3ec 0%, #fff7f8 55%, #fde7ec 100%);
  --text: #45122b;
  --muted: #6e4556;
  --soft: #45122b0d;
  --panel: #ffffffd9;
  --panel-line: #f3d3dd;
  --chip: #45122b0a;
  --checker-op: .1;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; overflow-x: clip; }
html, body { margin: 0; }
body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  font-family: Poppins, 'Segoe UI', Roboto, system-ui, sans-serif;
  color: var(--text);
  background: var(--night-950);
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}
html[data-theme="light"] body { background: var(--pearl-50); }
img { max-width: 100%; }
button, input { font: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--honey-400); outline-offset: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ── Latar Y2K ─────────────────────────────────────── */
.backdrop { position: fixed; inset: 0; z-index: 0; pointer-events: none; background: var(--bg); overflow: hidden; }
.backdrop-checker {
  position: absolute; inset: -40px;
  background-image: conic-gradient(var(--checker-a) 25%, transparent 0 50%, var(--checker-a) 0 75%, transparent 0);
  background-size: 56px 56px;
  opacity: var(--checker-op);
  transform: perspective(900px) rotateX(58deg) translateY(36%) scale(1.6);
  transform-origin: 50% 100%;
  mask-image: linear-gradient(to top, #000 0%, #000 30%, transparent 78%);
  -webkit-mask-image: linear-gradient(to top, #000 0%, #000 30%, transparent 78%);
}
.backdrop-rays {
  position: absolute; left: 50%; top: 38%; width: 180vmax; height: 180vmax; margin: -90vmax 0 0 -90vmax;
  background: repeating-conic-gradient(from 0deg, #ffffff0d 0deg 7deg, transparent 7deg 15deg);
  mask-image: radial-gradient(circle, #000 0%, transparent 62%);
  -webkit-mask-image: radial-gradient(circle, #000 0%, transparent 62%);
  animation: rays 90s linear infinite;
}
html[data-theme="light"] .backdrop-rays { background: repeating-conic-gradient(from 0deg, #e62b5e0d 0deg 7deg, transparent 7deg 15deg); }
.backdrop-vignette { position: absolute; inset: 0; background: radial-gradient(130% 90% at 50% 40%, transparent 55%, #12040a99 100%); }
html[data-theme="light"] .backdrop-vignette { background: radial-gradient(130% 90% at 50% 40%, transparent 60%, #f6c6d655 100%); }
.float-sticker { position: absolute; width: clamp(38px, 5.4vw, 86px); opacity: .9; filter: drop-shadow(0 6px 10px #12040a55); animation: bob 7s ease-in-out infinite; }
.s1 { left: 1.5%; top: 9%; animation-delay: -1s; }
.s2 { right: 4%; top: 12%; animation-delay: -3s; width: clamp(34px, 4.4vw, 70px); }
.s3 { left: 6%; bottom: 14%; animation-delay: -2s; }
.s4 { right: 8%; bottom: 24%; animation-delay: -4s; }
.s5 { left: 38%; top: 6%; animation-delay: -5s; width: clamp(28px, 3vw, 52px); opacity: .7; }
.s6 { right: 30%; bottom: 6%; animation-delay: -6s; width: clamp(28px, 3vw, 52px); }
.s7 { left: 24%; bottom: 4%; animation-delay: -2.5s; width: clamp(30px, 3.4vw, 58px); opacity: .75; }
.s8 { right: 22%; top: 30%; animation-delay: -3.5s; width: clamp(26px, 2.6vw, 46px); opacity: .6; }
@keyframes bob { 0%, 100% { transform: translateY(0) rotate(-6deg); } 50% { transform: translateY(-14px) rotate(6deg); } }
@keyframes rays { to { transform: rotate(360deg); } }

.fx-canvas { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 60; pointer-events: none; }

/* ── Topbar ────────────────────────────────────────── */
.topbar {
  position: relative; z-index: 5;
  display: flex; align-items: center; gap: clamp(8px, 1.6vw, 18px);
  padding: max(10px, env(safe-area-inset-top)) max(clamp(12px, 3vw, 34px), env(safe-area-inset-right)) 6px max(clamp(12px, 3vw, 34px), env(safe-area-inset-left));
}
.brand-logo { height: clamp(26px, 3.4vw, 42px); width: auto; object-fit: contain; }
.event-chip {
  display: flex; align-items: center; gap: 10px; min-width: 0;
  padding: 4px 14px 4px 6px; border-radius: 999px;
  background: var(--chip); border: 1.5px solid var(--panel-line);
}
.event-chip img { flex: 0 0 auto; height: clamp(26px, 3.2vw, 40px); width: auto; aspect-ratio: 900 / 339; filter: drop-shadow(0 2px 4px #12040a55); }
.event-chip span { display: grid; line-height: 1.1; min-width: 0; }
.event-chip b { font-size: 12.5px; font-weight: 700; white-space: nowrap; }
.event-chip small { font-size: 11px; color: var(--muted); white-space: nowrap; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.icon-button, .mode-pill, .admin-entry {
  min-height: 44px; border-radius: 999px; border: 1.5px solid var(--panel-line);
  background: var(--chip); color: var(--text);
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  text-decoration: none; transition: background .2s, transform .15s;
}
.icon-button { width: 44px; padding: 0; }
.icon-button svg, .admin-entry svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
#themeToggle svg { fill: none; stroke: currentColor; }
#themeToggle .theme-label { display: none; }
.icon-button:hover, .mode-pill:hover, .admin-entry:hover { background: var(--soft); }
.icon-button:active, .mode-pill:active { transform: scale(.95); }
#soundButton .mute { display: none; }
#soundButton[aria-pressed="false"] .wave { display: none; }
#soundButton[aria-pressed="false"] .mute { display: inline; }
.mode-pill { padding: 0 14px; font-size: 11.5px; font-weight: 800; letter-spacing: .08em; }
.mode-pill.live { background: var(--honey-400); color: var(--night-950); border-color: transparent; }
.admin-entry { padding: 0 14px 0 11px; font-size: 12.5px; font-weight: 700; }

/* ── Stage ─────────────────────────────────────────── */
.stage {
  position: relative; z-index: 2; flex: 1;
  display: grid; gap: 14px;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "intro" "machine" "rail";
  padding: 2px max(clamp(12px, 3vw, 34px), env(safe-area-inset-right)) 14px max(clamp(12px, 3vw, 34px), env(safe-area-inset-left));
}
.intro { grid-area: intro; min-width: 0; }
.machine-zone { grid-area: machine; min-width: 0; display: flex; flex-direction: column; align-items: center; }
.prize-rail { grid-area: rail; min-width: 0; }

.eyebrow { margin: 0; font-size: 11px; font-weight: 800; letter-spacing: .16em; color: var(--muted); }
.title { margin: 2px 0 0; display: flex; align-items: baseline; gap: .18em; line-height: .9; flex-wrap: wrap; }
.title-script { font-family: Fraunces, Georgia, serif; font-style: italic; font-weight: 800; font-size: clamp(30px, min(5vw, 7.4vh), 64px); color: var(--tulip-300); text-shadow: 0 3px 0 #45122b; }
html[data-theme="light"] .title-script { color: var(--pink-500); text-shadow: 0 2px 0 #fbcfdb; }
.title-pop { display: inline-flex; align-items: baseline; gap: .12em; font-weight: 800; font-size: clamp(32px, min(5.6vw, 8.4vh), 76px); letter-spacing: -.02em; color: #fff;
  text-shadow: 3px 0 0 var(--plum-900), -3px 0 0 var(--plum-900), 0 3px 0 var(--plum-900), 0 -3px 0 var(--plum-900), 2px 2px 0 var(--plum-900), -2px 2px 0 var(--plum-900), 2px -2px 0 var(--plum-900), -2px -2px 0 var(--plum-900), 0 8px 0 var(--pink-500); }
.title-pop em { font-style: normal; color: var(--sun); display: inline-block; transform: rotate(-6deg) translateY(-.04em); animation: popWiggle 3.6s ease-in-out infinite; }
@keyframes popWiggle { 0%, 82%, 100% { transform: rotate(-6deg) translateY(-.04em) scale(1); } 88% { transform: rotate(4deg) translateY(-.1em) scale(1.08); } 94% { transform: rotate(-8deg) translateY(-.02em) scale(.98); } }
.tagline { margin: 6px 0 0; font-family: Fraunces, Georgia, serif; font-style: italic; font-weight: 500; font-size: clamp(15px, 1.6vw, 22px); color: var(--muted); }
.steps { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 8px; }
.steps li { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 500; line-height: 1.3; }
.steps b { flex: 0 0 auto; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: 14px; font-weight: 800; color: var(--night-950); background: var(--sun); border: 2.5px solid var(--plum-900); box-shadow: 0 3px 0 var(--plum-900); }
.steps li:nth-child(2) b { background: var(--tulip-300); }
.steps li:nth-child(3) b { background: #8fd2ff; }
.steps strong { font-weight: 800; }
.pulls { margin-top: 18px; padding: 14px; border-radius: var(--radius); background: var(--panel); border: 1.5px solid var(--panel-line); backdrop-filter: blur(8px); }
.pulls h2 { margin: 0 0 8px; font-size: 13px; font-weight: 800; letter-spacing: .06em; }
.pulls-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; }
.pulls-list li { display: flex; align-items: center; gap: 10px; font-size: 12.5px; line-height: 1.25; animation: slideIn .4s ease-out both; }
.pulls-list img { width: 36px; height: 36px; border-radius: 10px; object-fit: cover; background: #fff; flex: 0 0 auto; }
.pulls-list b { font-weight: 700; }
.pulls-list small { display: block; color: var(--muted); font-size: 11px; }
.pulls-list .empty { color: var(--muted); font-size: 12.5px; }
@keyframes slideIn { from { opacity: 0; transform: translateX(-10px); } }

/* ── Mesin ─────────────────────────────────────────── */
.machine-wrap { position: relative; width: var(--mw); margin: calc(var(--mw) * .18) auto 0; }
.machine { position: relative; width: 100%; aspect-ratio: 400 / 600; cursor: pointer; touch-action: manipulation; }
.machine svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.machine-front { pointer-events: none; }
.plate-text { font-family: Poppins, sans-serif; font-weight: 800; font-size: 22px; letter-spacing: 2px; fill: var(--pink-500); }
.dome-canvas { position: absolute; left: 13.5%; top: 5.33%; width: 73%; height: 48.67%; border-radius: 50%; pointer-events: none; }
.knob { transform-box: view-box; transform-origin: 140px 494px; }
.chute-flap { transform-box: view-box; transform-origin: 279px 458px; transition: transform .25s ease; }
.machine.flap-open .chute-flap { transform: scaleY(-.35); }
.machine.shake { animation: machineShake .5s ease-in-out 3; }
.machine.attract { animation: machineHop 1.1s ease-in-out 2; }
@keyframes machineShake { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-1.6deg) translateX(-3px); } 75% { transform: rotate(1.6deg) translateX(3px); } }
@keyframes machineHop { 0%, 100% { transform: translateY(0) scale(1); } 30% { transform: translateY(-10px) scale(1.02, .98); } 55% { transform: translateY(0) scale(1.03, .96); } 75% { transform: translateY(-4px); } }

.top-bipy { position: absolute; left: 50%; top: -11.5%; width: 42%; transform: translateX(-50%); filter: drop-shadow(0 8px 10px #12040a66); pointer-events: none; animation: peek 5s ease-in-out infinite; transform-origin: 50% 100%; }
@keyframes peek { 0%, 100% { transform: translateX(-50%) translateY(0) rotate(0); } 45% { transform: translateX(-50%) translateY(-4%) rotate(-3deg); } 70% { transform: translateX(-50%) translateY(-1%) rotate(3deg); } }
.side-bipy { position: absolute; left: calc(var(--mw) * -.42); bottom: 2%; width: calc(var(--mw) * .46); filter: drop-shadow(0 10px 14px #12040a77); pointer-events: none; transform-origin: 50% 100%; animation: sway 4.2s ease-in-out infinite; }
@keyframes sway { 0%, 100% { transform: rotate(-2deg); } 50% { transform: rotate(2deg) translateY(-3px); } }
.side-bipy.jump, .top-bipy.jump { animation: bipyJump .8s cubic-bezier(.3, 1.6, .5, 1) 2; }
@keyframes bipyJump { 0%, 100% { translate: 0 0; } 40% { translate: 0 -18%; } }

.speech {
  position: absolute; z-index: 3; right: calc(var(--mw) * -.2); top: calc(var(--mw) * .02); max-width: calc(var(--mw) * .62); min-width: 130px;
  padding: 9px 13px; border-radius: 18px 18px 18px 4px;
  background: #fff; color: var(--plum-900); border: 2.5px solid var(--plum-900); box-shadow: 0 4px 0 var(--plum-900);
  font-size: clamp(11.5px, calc(var(--mw) * .042), 15px); font-weight: 700; line-height: 1.25;
  transform-origin: 0 100%; animation: speechIn .35s cubic-bezier(.3, 1.6, .5, 1) both;
}
.speech.swap { animation: none; }
@keyframes speechIn { from { opacity: 0; transform: scale(.6) rotate(-6deg); } }

.out-capsule {
  position: absolute; left: 69.75%; top: 81.9%; width: 14%; aspect-ratio: 1; margin: -7% 0 0 -7%;
  border-radius: 50%; opacity: 0; pointer-events: none; z-index: 2; filter: drop-shadow(0 6px 6px #12040a77);
}
.out-capsule.visible { opacity: 1; }
.out-capsule i, .big-capsule i { position: absolute; left: 0; right: 0; }
.out-capsule .cap-top, .big-capsule .cap-top { top: 0; height: 50%; border-radius: 999px 999px 0 0; background: var(--cap-a, #ff6e99); box-shadow: inset -6px 6px 10px #ffffff66, inset 4px -2px 8px #00000022; }
.out-capsule .cap-bottom, .big-capsule .cap-bottom { bottom: 0; height: 50%; border-radius: 0 0 999px 999px; background: var(--cap-b, #fff7f8); box-shadow: inset -4px -6px 10px #45122b22; }
.out-capsule .cap-top::after, .big-capsule .cap-top::after { content: ''; position: absolute; left: 18%; top: 16%; width: 28%; height: 34%; border-radius: 50%; background: #ffffffaa; transform: rotate(-30deg); }
.out-capsule .cap-bottom::before, .big-capsule .cap-bottom::before { content: ''; position: absolute; left: -2%; right: -2%; top: -3%; height: 9%; background: #45122b33; border-radius: 4px; }

/* ── Kontrol ───────────────────────────────────────── */
.controls { width: min(100%, 420px); display: grid; justify-items: center; gap: 8px; margin-top: 14px; }
.gacha-button {
  position: relative; width: min(100%, 340px); min-height: 78px; padding: 0 0 9px; border: 0; border-radius: 999px;
  background: var(--plum-900); color: #fff; box-shadow: 0 10px 24px #12040a66;
  transition: transform .12s ease, filter .2s;
}
.gacha-face {
  display: grid; place-items: center; height: 69px; border-radius: 999px; border: 3px solid var(--plum-900);
  background: linear-gradient(180deg, #ff86ad 0%, var(--pink-500) 52%, var(--berry-700) 100%);
  box-shadow: inset 0 4px 0 #ffffff66, inset 0 -6px 0 #00000026;
  transition: transform .12s ease;
}
.gacha-face b { font-size: 31px; font-weight: 800; letter-spacing: .06em; line-height: 1; text-shadow: 0 3px 0 var(--plum-900); }
.gacha-face small { font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; opacity: .92; }
.gacha-button::before { content: ''; position: absolute; inset: -8px; border-radius: 999px; border: 3px solid var(--sun); opacity: 0; pointer-events: none; }
body[data-stage="ready"] .gacha-button::before { animation: ring 1.8s ease-out infinite; }
@keyframes ring { 0% { opacity: .9; transform: scale(.94); } 100% { opacity: 0; transform: scale(1.12); } }
.gacha-button:hover .gacha-face { filter: brightness(1.06); }
.gacha-button:active .gacha-face, .gacha-button.pressed .gacha-face { transform: translateY(7px); }
.gacha-button:disabled { cursor: progress; }
.gacha-button:disabled .gacha-face { background: linear-gradient(180deg, #c99aab 0%, #9c7e8a 100%); transform: translateY(7px); }
body[data-stage="blocked"] .gacha-button:disabled { cursor: not-allowed; }
.controls-row { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; }
.capsule-meter { margin: 0; padding: 6px 12px; border-radius: 999px; background: var(--chip); border: 1.5px solid var(--panel-line); font-size: 12.5px; color: var(--muted); }
.capsule-meter b { color: var(--text); font-weight: 800; font-size: 14px; }
.name-toggle { min-height: 36px; padding: 0 14px; border-radius: 999px; border: 1.5px dashed var(--panel-line); background: transparent; color: var(--text); font-size: 12.5px; font-weight: 700; }
.name-field { display: grid; gap: 4px; width: min(100%, 300px); font-size: 12px; font-weight: 700; color: var(--muted); }
.name-field[hidden] { display: none; }
.name-field small { font-weight: 500; }
.name-field input { min-height: 46px; padding: 0 14px; border-radius: 14px; border: 2px solid var(--panel-line); background: var(--panel); color: var(--text); font-size: 16px; font-weight: 600; }
.name-field input:focus { border-color: var(--pink-500); outline: none; }
.fair-note { margin: 0; font-size: 11.5px; color: var(--muted); text-align: center; max-width: 330px; line-height: 1.35; }

/* ── Rak hadiah ────────────────────────────────────── */
.prize-rail { padding: 14px; border-radius: var(--radius); background: var(--panel); border: 1.5px solid var(--panel-line); backdrop-filter: blur(8px); }
.rail-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.rail-head h2 { margin: 0; font-size: 16px; font-weight: 800; }
.rail-head p { margin: 0; font-size: 11.5px; color: var(--muted); }
.rail-groups { display: grid; gap: 12px; margin-top: 10px; }
.rail-group h3 { margin: 0 0 7px; display: flex; align-items: center; gap: 7px; font-size: 11px; font-weight: 800; letter-spacing: .12em; }
.rail-group h3 i { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--plum-900); background: linear-gradient(var(--cap-a) 50%, #fff 50%); }
.rail-group h3 span { margin-left: auto; font-weight: 600; letter-spacing: 0; color: var(--muted); }
.rail-items { display: grid; grid-auto-flow: column; grid-auto-columns: 112px; gap: 8px; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 4px; scrollbar-width: thin; }
.rail-item { scroll-snap-align: start; position: relative; display: grid; gap: 5px; padding: 6px; border-radius: 16px; background: var(--chip); border: 1.5px solid var(--panel-line); }
.rail-item img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 11px; background: #fff; }
.rail-item b { font-size: 11px; font-weight: 700; line-height: 1.2; min-height: 2.4em; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.rail-item .count { position: absolute; top: 10px; right: 10px; min-width: 26px; padding: 2px 7px; border-radius: 999px; background: var(--plum-900); color: #fff; font-size: 11px; font-weight: 800; text-align: center; }
.rail-item.out { opacity: .45; filter: grayscale(.8); }
.rail-item.out .count { background: #9c7e8a; }

/* ── Ticker ────────────────────────────────────────── */
.ticker { position: relative; z-index: 2; overflow: hidden; border-block: 2.5px solid var(--plum-900); background: var(--sun); color: var(--night-950); white-space: nowrap; }
.ticker-track { display: inline-flex; gap: 34px; padding: 8px 0; font-size: 13px; font-weight: 800; letter-spacing: .04em; animation: marquee 48s linear infinite; }
.ticker-track span { display: inline-flex; align-items: center; gap: 8px; }
.ticker-track img { width: 20px; height: 20px; }
@keyframes marquee { to { transform: translateX(-50%); } }

/* ── Kartu hasil ───────────────────────────────────── */
.reveal-layer {
  --card-w: clamp(150px, min(76vw, calc(100dvh - 400px)), 340px);
  position: fixed; inset: 0; z-index: 50; display: flex; overflow-y: auto; overscroll-behavior: contain;
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) calc(16px + var(--gmy-bar-space, 0px) + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  background: radial-gradient(circle at 50% 42%, #6b1439f2 0%, #2a0a18f7 58%, #12040afa 100%);
}
.reveal-layer[hidden] { display: none; }
html[data-theme="light"] .reveal-layer { background: radial-gradient(circle at 50% 42%, #fff7f8f2 0%, #fde7ecf5 58%, #f8cfdcf7 100%); }
.reveal-rays { position: fixed; inset: 0; overflow: hidden; pointer-events: none; opacity: 0; transition: opacity .5s; }
.reveal-rays::before { content: ''; position: absolute; left: 50%; top: 45%; width: 160vmax; height: 160vmax; margin: -80vmax 0 0 -80vmax; background: repeating-conic-gradient(from 0deg, var(--ray, #f5b83d26) 0deg 9deg, transparent 9deg 20deg); mask-image: radial-gradient(circle, #000 0%, transparent 58%); -webkit-mask-image: radial-gradient(circle, #000 0%, transparent 58%); animation: rays 26s linear infinite; }
.reveal-layer.popped .reveal-rays { opacity: 1; }
.big-capsule { position: fixed; left: 50%; top: 45%; width: min(46vw, 42vh, 260px); aspect-ratio: 1; translate: -50% -50%; z-index: 2; filter: drop-shadow(0 18px 24px #12040a99); }
.big-capsule .cap-glow { inset: -30%; border-radius: 50%; background: radial-gradient(circle, var(--glow, #f5b83d) 0%, transparent 62%); opacity: 0; transition: opacity .6s; }
.big-capsule.charging .cap-glow { opacity: .75; }
.big-capsule.charging { animation: capShake .16s linear infinite; }
.big-capsule.charging.hard { animation-duration: .09s; }
@keyframes capShake { 0% { rotate: -5deg; } 50% { rotate: 5deg; } 100% { rotate: -5deg; } }
.big-capsule.popping .cap-top { animation: capTopFly .7s cubic-bezier(.2, .7, .3, 1) forwards; }
.big-capsule.popping .cap-bottom { animation: capBottomFly .7s cubic-bezier(.2, .7, .3, 1) forwards; }
.big-capsule.popping .cap-glow { opacity: 0; }
@keyframes capTopFly { to { transform: translate(-70%, -150%) rotate(-140deg); opacity: 0; } }
@keyframes capBottomFly { to { transform: translate(80%, 150%) rotate(120deg); opacity: 0; } }

.reveal-content { position: relative; z-index: 3; width: min(1040px, 100%); margin: auto; display: grid; grid-template-columns: minmax(0, 1fr); justify-items: center; align-items: center; gap: clamp(10px, 2.2vh, 18px); opacity: 0; pointer-events: none; }
.reveal-layer.popped .reveal-content { opacity: 1; pointer-events: auto; }
.sticker-card {
  position: relative; width: var(--card-w); padding: clamp(8px, 1.4vh, 12px); border-radius: 30px; background: #fff; color: var(--plum-900);
  box-shadow: 0 0 0 7px #fff, 0 0 0 10px var(--tier, var(--pink-500)), 0 26px 50px #12040a88;
  transform: rotate(-2.5deg);
}
.reveal-layer.popped .sticker-card { animation: cardIn .75s cubic-bezier(.2, 1.5, .4, 1) both; }
@keyframes cardIn { 0% { transform: scale(.2) rotate(-28deg); opacity: 0; } 60% { opacity: 1; } 100% { transform: scale(1) rotate(-2.5deg); } }
.card-ribbon { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: clamp(5px, 1vh, 8px) clamp(9px, 3.6%, 14px); border-radius: 20px 20px 10px 10px; background: var(--tier, var(--pink-500)); color: #fff; font-size: clamp(9.5px, calc(var(--card-w) * .034), 11.5px); font-weight: 800; letter-spacing: .08em; white-space: nowrap; }
.card-stars { letter-spacing: .05em; color: #fff3b0; }
.card-art { position: relative; margin-top: 10px; border-radius: 20px; overflow: hidden; aspect-ratio: 1; background: #fff; border: 2px solid #f3d3dd; }
.card-art img { width: 100%; height: 100%; object-fit: contain; display: block; }
.holo { position: absolute; inset: 0; opacity: 0; mix-blend-mode: color-dodge; background: linear-gradient(115deg, transparent 18%, #ff9cc0 32%, #9fd6ff 44%, #fff3a6 54%, #c7a7ff 64%, transparent 80%); background-size: 260% 260%; pointer-events: none; }
.sticker-card[data-tier="bundling"] .holo, .sticker-card[data-tier="collab"] .holo, .sticker-card[data-tier="voucher"] .holo { opacity: .55; animation: holo 3.2s ease-in-out infinite; }
.sticker-card[data-tier="voucher"] .card-art { border-color: #51bd95; background: #f1fff6; }
.sticker-card[data-tier="voucher"] .card-stars { color: #d1ffe0; }
@keyframes holo { 0%, 100% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } }
.card-name { margin: clamp(6px, 1.2vh, 12px) 4px 2px; font-size: clamp(16px, min(2.4vw, 2.8vh), 24px); font-weight: 800; line-height: 1.15; }
.card-sub { margin: 0 4px; font-size: 12.5px; color: #6e4556; }
.card-foot { display: flex; justify-content: space-between; gap: 8px; margin: 10px 4px 2px; font-size: 10px; font-weight: 700; letter-spacing: .08em; color: #9c7e8a; }

.reveal-info { width: min(460px, 100%); display: grid; gap: clamp(6px, 1.4vh, 10px); text-align: center; justify-items: center; }
.reveal-info h2 { margin: 0; font-size: clamp(24px, 3.4vw, 40px); font-weight: 800; line-height: 1.1; }
.reveal-lead { margin: 0; font-size: 14.5px; color: var(--muted); line-height: 1.4; }
.claim-box { width: 100%; display: grid; gap: 2px; padding: 12px 16px; border-radius: 18px; background: var(--sun); color: var(--night-950); border: 3px solid var(--plum-900); box-shadow: 0 5px 0 var(--plum-900); }
.claim-box small { font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.claim-box b { font-size: clamp(26px, 3.6vw, 36px); font-weight: 800; letter-spacing: .08em; font-variant-numeric: tabular-nums; }
.claim-box span { font-size: 12.5px; font-weight: 600; }
.claim-box[hidden] { display: none; }
.reveal-terms { margin: 0; font-size: 12px; color: var(--muted); line-height: 1.4; }
.demo-note { margin: 0; padding: 6px 12px; border-radius: 999px; background: #ffffff1f; font-size: 11px; font-weight: 800; letter-spacing: .08em; }
html[data-theme="light"] .demo-note { background: #45122b12; }
.next-button { position: sticky; bottom: calc(6px + var(--gmy-bar-space, 0px) + env(safe-area-inset-bottom)); z-index: 4; display: inline-flex; align-items: center; gap: 10px; min-height: 56px; padding: 0 24px 0 12px; border-radius: 999px; border: 3px solid var(--plum-900); background: #fff; color: var(--plum-900); font-size: clamp(13px, 3.8vw, 15px); font-weight: 800; white-space: nowrap; box-shadow: 0 5px 0 var(--plum-900); }
.next-button:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--plum-900); }
.next-ring { width: 36px; height: 36px; transform: rotate(-90deg); }
.next-ring circle { fill: none; stroke: #f3d3dd; stroke-width: 4; }
.next-ring .ring-progress { stroke: var(--pink-500); stroke-linecap: round; stroke-dasharray: 106.8; stroke-dashoffset: 0; }

.pause-banner { position: fixed; left: 50%; top: max(70px, calc(env(safe-area-inset-top) + 60px)); z-index: 40; transform: translateX(-50%); padding: 10px 18px; border-radius: 999px; background: var(--honey-400); color: var(--night-950); font-weight: 800; font-size: 13px; box-shadow: 0 6px 18px #12040a55; }
.toast { position: fixed; left: 50%; bottom: calc(24px + var(--gmy-bar-space, 0px) + env(safe-area-inset-bottom)); z-index: 70; max-width: min(92vw, 520px); transform: translate(-50%, 20px); padding: 12px 18px; border-radius: 16px; background: var(--plum-900); color: #fff; font-size: 14px; font-weight: 600; opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s; box-shadow: 0 10px 30px #12040a66; }
.toast.visible { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: #8f211d; }

body.modal-open { overflow: hidden; }

/* Kartu hasil: hadiah, kode klaim, dan tombol Lanjut muat satu layar. */
@media (max-height: 720px) {
  .reveal-lead { display: none; }
  .reveal-terms { font-size: 11px; }
  .card-sub, .card-foot { display: none; }
  .reveal-info h2 { font-size: clamp(20px, 3.6vh, 30px); }
  .claim-box { padding: 8px 14px; }
  .claim-box b { font-size: clamp(22px, 4vh, 30px); }
}
@media (orientation: landscape) and (min-width: 700px) {
  .reveal-layer { --card-w: clamp(170px, calc(100dvh - 190px - var(--gmy-bar-space, 0px)), 360px); }
  .reveal-content { grid-template-columns: auto minmax(0, 460px); justify-content: center; gap: clamp(20px, 4vw, 64px); }
  .reveal-info { text-align: left; justify-items: start; }
}

/* ── Ponsel kecil ──────────────────────────────────── */
@media (max-width: 599px) {
  .event-chip span, .admin-entry span { display: none; }
  .event-chip { padding: 3px 6px; }
  .mode-pill { padding: 0 10px; font-size: 10.5px; }
  .intro { text-align: center; }
  .title { justify-content: center; }
  .tagline, .steps, .pulls { display: none; }
  .eyebrow { font-size: 10px; }
  .side-bipy { display: none; }
  .speech { right: auto; left: 54%; top: calc(var(--mw) * -.02); }
  .float-sticker.s5, .float-sticker.s8, .float-sticker.s6 { display: none; }
  .float-sticker { opacity: .5; }
}
@media (max-width: 380px) {
  .top-actions { gap: 5px; }
  .icon-button, .mode-pill, .admin-entry { min-height: 40px; }
  .icon-button { width: 40px; }
  .brand-logo { height: 24px; }
  .gacha-button { min-height: 72px; }
  .gacha-face { height: 63px; }
  .gacha-face b { font-size: 27px; }
}

/* ── Tablet potret & lipat terbuka ────────────────── */
@media (min-width: 600px) and (max-width: 959px) {
  .intro { text-align: center; }
  .title { justify-content: center; }
  .steps { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px 18px; margin-top: 10px; }
  .steps li { font-size: 13px; }
  .pulls { display: none; }
  .rail-items { grid-auto-columns: 128px; }
  .side-bipy { left: calc(var(--mw) * -.4); width: calc(var(--mw) * .42); }
}

/* ── Laptop, PC, tablet lanskap ───────────────────── */
@media (min-width: 960px) and (min-height: 560px) {
  body { height: 100vh; height: 100dvh; min-height: 0; }
  html.gmy-has-bar body { height: 100dvh; }
  .stage {
    min-height: 0; overflow: hidden;
    grid-template-columns: minmax(250px, .9fr) minmax(0, 1.25fr) minmax(270px, .95fr);
    grid-template-areas: "intro machine rail";
    align-items: stretch; gap: clamp(16px, 2vw, 34px);
  }
  .intro { align-self: center; position: relative; z-index: 2; }
  .title-pop { font-size: clamp(34px, min(4.5vw, 8vh), 80px); }
  .title-script { font-size: clamp(30px, min(4vw, 7vh), 66px); }
  .side-bipy { left: calc(var(--mw) * -.36); width: calc(var(--mw) * .42); }
  .machine-zone { justify-content: center; min-height: 0; }
  .prize-rail { display: flex; flex-direction: column; min-height: 0; max-height: 100%; align-self: center; }
  .rail-groups { overflow-y: auto; min-height: 0; padding-right: 4px; scrollbar-width: thin; }
  .rail-items { grid-auto-flow: row; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); grid-auto-columns: auto; overflow: visible; scroll-snap-type: none; }
  .rail-item b { font-size: 10.5px; }
}
@media (min-width: 1500px) and (min-height: 820px) {
  .steps li { font-size: 16px; }
  .gacha-button { width: 380px; min-height: 92px; }
  .gacha-face { height: 82px; }
  .gacha-face b { font-size: 38px; }
  .rail-items { grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); }
}

/* ── Lanskap pendek (HP diputar) ──────────────────── */
@media (orientation: landscape) and (max-height: 559px) {
  .topbar { padding-top: max(6px, env(safe-area-inset-top)); padding-bottom: 4px; }
  .brand-logo { height: 24px; }
  .event-chip span { display: none; }
  .stage { grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "machine intro" "machine rail"; align-items: start; gap: 8px 18px; }
  .machine-zone { flex-direction: row; align-items: center; gap: 14px; }
  .machine-wrap { margin-top: calc(var(--mw) * .12); }
  .controls { width: 210px; margin-top: 0; }
  .gacha-button { min-height: 64px; }
  .gacha-face { height: 56px; }
  .gacha-face b { font-size: 25px; }
  .fair-note, .tagline, .steps, .pulls, .side-bipy, .eyebrow { display: none; }
  .title-script { font-size: 26px; }
  .title-pop { font-size: 30px; }
  .speech { display: none; }
  .prize-rail { padding: 10px; }
}

/* ── Gerak minimal ─────────────────────────────────── */
.connection-notice { position: fixed; z-index: 300; top: max(8px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); width: min(540px, calc(100% - 24px)); display: flex; align-items: center; gap: 12px; padding: 10px 14px; border: 2px solid #45122b; border-radius: 18px; background: #fff3cf; color: #45122b; box-shadow: 0 6px 24px #0004; font-size: 12px; font-weight: 600; }
.connection-notice[hidden] { display: none; }
.connection-notice button { flex-shrink: 0; min-height: 48px; padding: 8px 14px; border: 0; border-radius: 12px; background: #45122b; color: #fff; font: inherit; cursor: pointer; }
.connection-notice button:disabled, .next-button:disabled { opacity: .65; cursor: wait; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .backdrop-rays, .reveal-rays { display: none; }
}
