/* 게임 속 스타트 룰렛(Scene/RouletteUi.tscn)을 그대로 옮긴 체험 룰렛
   좌표는 게임 화면(640x360) 기준에서 (40, 36)을 뺀 564x304 무대 단위. --u = 무대 1px */
#roulette { overflow-x: clip; }   /* 효과 캔버스가 좌우로 삐져나와 휴대폰 화면이 넓어지지 않게 */
.gr { max-width: 900px; margin: 0 auto; container-type: inline-size; }
.gr-stage {
  --u: calc(100cqw / 564);
  position: relative; width: 100cqw; height: calc(304 * var(--u));
  font-family: "Mulmaru", "Galmuri9", sans-serif; color: #ff9a2e;
  user-select: none; -webkit-user-select: none;
}
.gr-stage img, .gr-stage .px { image-rendering: pixelated; image-rendering: crisp-edges; }
.gr-a { position: absolute; left: calc(var(--x) * var(--u)); top: calc(var(--y) * var(--u)); width: calc(var(--w) * var(--u)); height: calc(var(--h) * var(--u)); }
.gr-img { background: var(--img) 0 0 / 100% 100% no-repeat; }
.gr-txt { display: flex; align-items: center; justify-content: center; text-align: center; white-space: nowrap; overflow: hidden; line-height: 1; }

.gr-title { font-size: max(10px, calc(11 * var(--u))); color: #ffb23f; text-shadow: 0 0 calc(4 * var(--u)) rgba(255, 140, 30, .45); }
.gr-cat { font-size: max(9px, calc(10 * var(--u))); color: #ff9a2e; transition: color .15s, text-shadow .15s; }
.gr-cat.glow { color: #ffe7a6; text-shadow: 0 0 calc(5 * var(--u)) rgba(255, 190, 70, .9); }
.gr-name { font-size: max(8px, calc(8.6 * var(--u))); color: #ff9a2e; padding: 0 calc(5 * var(--u)); text-overflow: ellipsis; display: block; line-height: calc(22 * var(--u)); }
.gr-name.r-A { color: #ffd23d; text-shadow: 0 0 calc(5 * var(--u)) rgba(255, 210, 61, .8); }
.gr-name.r-B { color: #ff8a3d; }
.gr-name.r-C { color: #e9e4da; }

/* 칸 */
.gr-slot { overflow: hidden; background: #0b0d11; transition: transform .05s; }
.gr-strip { position: absolute; left: 0; right: 0; top: 0; will-change: transform; }
.gr-cell { height: calc(56 * var(--u)); display: grid; place-items: center; }
.gr-cell img { width: calc(46 * var(--u)); height: calc(46 * var(--u)); object-fit: contain; filter: drop-shadow(0 calc(2 * var(--u)) 0 #000); }
.gr-slot.spin .gr-cell img { filter: blur(calc(.6 * var(--u))) brightness(1.15); }
.gr-slot::before, .gr-slot::after { content: ""; position: absolute; left: 0; right: 0; height: 30%; z-index: 2; pointer-events: none; }
.gr-slot::before { top: 0; background: linear-gradient(#0b0d11, rgba(11, 13, 17, 0)); }
.gr-slot::after { bottom: 0; background: linear-gradient(rgba(11, 13, 17, 0), #0b0d11); }
/* A: 빛줄기(아이콘 뒤), B: 광택(아이콘 앞) */
.gr-rays { position: absolute; inset: -40%; z-index: 0; opacity: 0; pointer-events: none;
  background: repeating-conic-gradient(from 0deg, rgba(255, 214, 90, .55) 0deg 9deg, transparent 9deg 24deg);
  -webkit-mask-image: radial-gradient(circle, #000 15%, transparent 62%); mask-image: radial-gradient(circle, #000 15%, transparent 62%); }
.gr-rays.on { opacity: 1; animation: gr-spin 6s linear infinite, gr-fadein .4s ease-out; }
@keyframes gr-spin { to { transform: rotate(360deg); } }
@keyframes gr-fadein { from { opacity: 0; } }
.gr-shine { position: absolute; inset: 0; z-index: 3; pointer-events: none; opacity: 0;
  background: linear-gradient(115deg, transparent 35%, rgba(255, 236, 200, .55) 47%, transparent 58%); background-size: 260% 100%; }
.gr-shine.on { animation: gr-shine .7s ease-out; }
@keyframes gr-shine { 0% { opacity: 1; background-position: 120% 0; } 100% { opacity: 1; background-position: -60% 0; } }

.gr-border { z-index: 4; transition: filter .2s; pointer-events: none; }
.gr-border.r-A { filter: brightness(1.5) saturate(1.3) drop-shadow(0 0 calc(4 * var(--u)) rgba(255, 210, 61, .95)); }
.gr-border.r-B { filter: hue-rotate(-12deg) brightness(1.2) drop-shadow(0 0 calc(3 * var(--u)) rgba(255, 138, 61, .8)); }
.gr-border.tease { animation: gr-pulse .22s steps(2) infinite; }
@keyframes gr-pulse { 50% { filter: brightness(2) hue-rotate(-25deg) drop-shadow(0 0 calc(5 * var(--u)) #ff3a1a); } }

/* 옆 게이지 (12칸) */
.gr-gauge { display: flex; flex-direction: column-reverse; justify-content: space-between; }
.gr-seg { height: calc(6.8 * var(--u)); background: #261701; transition: background .06s, box-shadow .06s; }
.gr-seg.on { background: #ffc05a; box-shadow: 0 0 calc(4 * var(--u)) rgba(255, 170, 60, .95), 0 0 calc(10 * var(--u)) rgba(255, 140, 30, .5); }
.gr-seg.on.white { background: #fff6dc; box-shadow: 0 0 calc(5 * var(--u)) rgba(255, 250, 220, .95); }
.gr-seg.on.red { background: #ff4a26; box-shadow: 0 0 calc(5 * var(--u)) rgba(255, 60, 30, .95); }
.gr-seg.on.c0 { background: #ff5a5a; } .gr-seg.on.c1 { background: #ffc94a; } .gr-seg.on.c2 { background: #6dff8a; } .gr-seg.on.c3 { background: #5ad2ff; } .gr-seg.on.c4 { background: #c78bff; }

/* 아래 받침과 행운 판 */
.gr-plate { z-index: 3; }
.gr-plate .cherry { position: absolute; top: calc(4 * var(--u)); width: calc(16 * var(--u)); height: calc(16 * var(--u)); background: url("assets/roulette/cherry.png") 0 0 / 100% 100% no-repeat; image-rendering: pixelated; }
.gr-plate .cherry.l { left: calc(8 * var(--u)); } .gr-plate .cherry.r { left: calc(113 * var(--u)); }
.gr-plate .fb { position: absolute; left: calc(26 * var(--u)); right: calc(26 * var(--u)); top: 0; bottom: 0; font-size: max(8px, calc(9 * var(--u))); color: #ffd23d; text-shadow: 0 0 calc(4 * var(--u)) rgba(255, 190, 60, .7); }
.gr-plate.pop { animation: gr-pop .35s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes gr-pop { from { transform: scale(var(--pop, 1.3)); } }

/* 시작 버튼 + 전구 */
.gr-btn { z-index: 5; cursor: pointer; border: 0; padding: 0; background: url("assets/roulette/btn.png") 0 0 / 100% 100% no-repeat; image-rendering: pixelated;
  font-family: "Mulmaru", sans-serif; font-size: max(11px, calc(13 * var(--u))); color: #ffe9b0; text-shadow: 0 calc(1 * var(--u)) 0 #5a0b08;
  transition: transform .12s; }
.gr-btn:hover:not(:disabled) { transform: translateY(calc(-1 * var(--u))); filter: brightness(1.08); }
.gr-btn:active:not(:disabled), .gr-btn.press { background-image: url("assets/roulette/btn_click.png"); transform: translateY(calc(1.5 * var(--u))); }
.gr-btn:disabled { cursor: default; }
.gr-btn .lbl { position: relative; z-index: 2; }
.gr-btn .dots { display: none; gap: calc(7 * var(--u)); position: relative; z-index: 2; }
.gr-btn .dots i { width: calc(4 * var(--u)); height: calc(4 * var(--u)); background: #ffd23d; opacity: .25; }
.gr-btn .dots i.on { opacity: 1; box-shadow: 0 0 calc(3 * var(--u)) #ffd23d; }
.gr-btn.spinning .lbl { display: none; }
.gr-btn.spinning .dots { display: flex; }
.gr-btn .sweep { position: absolute; left: calc(66 * var(--u)); top: calc(13 * var(--u)); width: calc(92 * var(--u)); height: calc(38 * var(--u)); overflow: hidden; z-index: 1; pointer-events: none; display: none; }
.gr-btn.spinning .sweep { display: block; }
.gr-btn .sweep::before { content: ""; position: absolute; top: 0; bottom: 0; width: calc(18 * var(--u)); left: -30%; background: rgba(255, 199, 178, .28); transform: skewX(-20deg); animation: gr-sweep .8s linear infinite; }
@keyframes gr-sweep { to { left: 120%; } }
.gr-bulb { position: absolute; width: calc(3.4 * var(--u)); height: calc(3.4 * var(--u)); background: #6e5222; z-index: 6; pointer-events: none; transition: background .05s, box-shadow .05s; }
.gr-bulb.on { background: #ffe066; box-shadow: 0 0 calc(3 * var(--u)) #ffd23d, 0 0 calc(7 * var(--u)) rgba(255, 190, 60, .6); }
.gr-bulb.on.red { background: #ff4a2a; box-shadow: 0 0 calc(4 * var(--u)) #ff3a1a; }

/* 어둡게(예고) · 섬광 · 도장 · 배너 · 입자 */
.gr-dim { position: absolute; inset: 0; z-index: 7; pointer-events: none; opacity: 0; transition: opacity .25s;
  background: rgba(0, 0, 0, .55); -webkit-mask: var(--hole); mask: var(--hole); }
.gr-dim.on { opacity: 1; }
.gr-flash { position: absolute; inset: calc(-20 * var(--u)); z-index: 9; pointer-events: none; opacity: 0; }
.gr-stamp { position: absolute; z-index: 10; pointer-events: none; font-family: "Mulmaru", sans-serif; line-height: 1; transform-origin: 50% 50%;
  -webkit-text-stroke: calc(1.6 * var(--u)) #2a0d00; paint-order: stroke fill; animation: gr-stamp .18s cubic-bezier(.3, 0, .6, 1) both; }
.gr-stamp.A { color: #ffd23d; font-size: calc(36 * var(--u)); text-shadow: 0 0 calc(6 * var(--u)) rgba(255, 220, 90, .8); }
.gr-stamp.B { color: #ff8a3d; font-size: calc(30 * var(--u)); }
@keyframes gr-stamp { from { transform: translate(-50%, -50%) rotate(-12deg) scale(var(--big, 3)); opacity: 0; } to { transform: translate(-50%, -50%) rotate(-12deg) scale(1); opacity: 1; } }
.gr-stamp.A.shim { animation: gr-stamp .18s cubic-bezier(.3, 0, .6, 1) both, gr-shim .25s .18s ease-in-out infinite alternate; }
@keyframes gr-shim { to { color: #fff6c8; } }
.gr-ring { position: absolute; z-index: 10; pointer-events: none; border-radius: 50%; border: calc(1.5 * var(--u)) solid rgba(255, 230, 170, 1); transform: translate(-50%, -50%); animation: gr-ring .35s .18s ease-out both; }
@keyframes gr-ring { from { width: calc(30 * var(--u)); height: calc(30 * var(--u)); opacity: 1; } to { width: calc(80 * var(--u)); height: calc(80 * var(--u)); opacity: 0; } }
.gr-banner { position: absolute; z-index: 11; left: 50%; top: 50%; width: calc(330 * var(--u)); height: calc(46 * var(--u)); pointer-events: none;
  display: grid; place-items: center; background: rgba(20, 6, 0, .78); box-shadow: inset 0 calc(2 * var(--u)) 0 #ffd23d, inset 0 calc(-2 * var(--u)) 0 #ffd23d;
  font-family: "Mulmaru", sans-serif; font-size: calc(26 * var(--u)); color: #ffd23d; -webkit-text-stroke: calc(1.6 * var(--u)) #4a1400; paint-order: stroke fill;
  transform: translate(-50%, -50%); animation: gr-banner-in .25s cubic-bezier(.2, .9, .3, 1) both, gr-banner-glow .2s linear infinite alternate; }
.gr-banner.big { font-size: calc(32 * var(--u)); animation: gr-banner-in .25s cubic-bezier(.2, .9, .3, 1) both, gr-banner-glow .2s linear infinite alternate, gr-wobble .1s linear infinite alternate; }
.gr-banner.out { animation: gr-banner-out .3s ease-in both; }
@keyframes gr-banner-in { from { transform: translate(-50%, -50%) scale(2.4); opacity: 0; } }
@keyframes gr-banner-out { to { opacity: 0; } }
@keyframes gr-banner-glow { to { color: #fff6c8; } }
@keyframes gr-wobble { to { transform: translate(-50%, -50%) scale(1.04); } }
.gr-fx { position: absolute; left: -15%; top: -25%; width: 130%; height: 150%; z-index: 12; pointer-events: none; }

.gr-log { margin-top: 14px; min-height: 1.6em; text-align: center; color: var(--ink-dim, #a9b4dc); font-size: 14px; }
.gr-log b { color: #ffd23d; font-weight: normal; }
.gr-log b.r-B { color: #ff8a3d; } .gr-log b.r-C { color: #e9e4da; }

/* ================= 다운로드 팝업: 페이지와 같은 밤하늘 테마 ================= */
.gp { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 16px;
  background: radial-gradient(ellipse at 50% 40%, rgba(8, 14, 60, .72), rgba(2, 4, 18, .9)); backdrop-filter: blur(3px);
  opacity: 0; transition: opacity .22s ease; }
.gp.show { opacity: 1; }
.gp[hidden] { display: none; }
.gp-card { position: relative; width: min(500px, calc(100vw - 32px)); max-height: calc(100svh - 32px); overflow: auto; overscroll-behavior: contain;
  background: linear-gradient(180deg, #071040 0%, #050b30 46%, #040924 100%);
  box-shadow: 0 0 0 1px rgba(160, 180, 255, .16), 0 0 0 4px rgba(4, 8, 30, .9), 0 0 0 5px rgba(239, 210, 138, .35), 0 30px 80px rgba(0, 0, 0, .6);
  transform: translateY(18px) scale(.97); transition: transform .35s cubic-bezier(.2, .9, .3, 1.15); }
.gp.show .gp-card { transform: none; }

/* 위쪽: 작은 밤하늘 장면 */
.gp-sky { position: relative; height: 168px; overflow: hidden;
  background: url("assets/sky.png") center / cover, rgb(77, 56, 148); background-blend-mode: multiply; }
.gp-l { position: absolute; inset: 0; background-repeat: repeat-x; background-position: 0 100%; image-rendering: pixelated; }
.gp-stars { background: url("assets/star.png") center / cover no-repeat; opacity: .9; animation: gp-tw 4s ease-in-out infinite alternate; }
@keyframes gp-tw { from { opacity: .6; } }
.gp-cloud { background-image: url("assets/cloud.png"); background-size: auto 150px; background-position: 0 115%; filter: url(#gm-cloud); opacity: .95; animation: gp-drift 60s linear infinite; }
@keyframes gp-drift { to { background-position-x: -550px; } }
.gp-mtn { background-image: url("assets/mountain.png"); background-size: auto 150px; background-position: -40px 100%; filter: url(#gm-mtn); }
.gp-grass { background-image: url("assets/grass.png"); background-size: auto 88px; filter: url(#gm); }
.gp-sky::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 46%; background: linear-gradient(transparent, #071040); }
.gp-mach { position: absolute; right: 9%; bottom: 14px; width: 50px; height: 70px; z-index: 1; }
.gp-mach::before, .gp-mach::after { content: ""; position: absolute; inset: 0; background: url("assets/machine.png") 0 0 / 1700% 100% no-repeat; image-rendering: pixelated; }
.gp-mach::before { filter: url(#gm-machine); }
.gp-mach::after { clip-path: polygon(22% 19.5%, 78% 19.5%, 75% 52%, 25% 52%); animation: gp-flick 2.2s steps(1) infinite; }
@keyframes gp-flick { 0%, 100% { opacity: 1; } 12% { opacity: .45; } 18% { opacity: 1; } 55% { opacity: .7; } 60% { opacity: 1; } }
.gp-glow { position: absolute; left: -90%; right: -90%; top: -50%; height: 160%;
  background: radial-gradient(ellipse 36% 32% at 50% 48%, rgba(252, 177, 59, .45), rgba(252, 177, 59, .1) 55%, transparent 75%); }
.gp-fly { position: absolute; left: var(--x); top: var(--y); width: 3px; height: 3px; border-radius: 50%; z-index: 2;
  background: #fff7c0; box-shadow: 0 0 4px 2px rgba(255, 220, 110, .75), 0 0 12px 4px rgba(255, 200, 80, .3);
  animation: gp-fly var(--t) ease-in-out var(--d) infinite alternate; }
@keyframes gp-fly { 0% { transform: translate(0, 0); opacity: .35; } 50% { opacity: 1; } 100% { transform: translate(14px, -16px); opacity: .55; } }
.gp-logo { position: absolute; left: 50%; top: 4px; width: 230px; transform: translateX(-50%); z-index: 3; filter: drop-shadow(0 3px 0 rgba(0, 0, 0, .45)); image-rendering: auto; }
.gp-x { position: absolute; top: 8px; right: 8px; z-index: 5; width: 32px; height: 32px; border: 0; cursor: pointer;
  background: rgba(4, 8, 30, .55); color: #c9d2f5; font-size: 15px; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .15); }
.gp-x:hover { color: #fff; background: rgba(4, 8, 30, .85); }

/* 아래: 내용 */
.gp-body { position: relative; padding: 0 26px 22px; text-align: center; margin-top: -8px; }
.gp-k { display: inline-block; font-size: 12px; letter-spacing: .14em; color: #efd28a; padding: 3px 10px; box-shadow: inset 0 0 0 1px rgba(239, 210, 138, .45); background: rgba(239, 210, 138, .06); }
.gp-body h3 { margin: 10px 0 14px; font-family: "Mulmaru", sans-serif; font-weight: normal; font-size: clamp(20px, 5.4vw, 25px); color: #eef1ff; text-shadow: 0 3px 0 rgba(0, 0, 0, .45); word-break: keep-all; }
.gp-got { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.gp-item { position: relative; padding: 10px 6px 9px; background: rgba(255, 255, 255, .03); box-shadow: inset 0 0 0 1px rgba(160, 180, 255, .16);
  display: flex; flex-direction: column; align-items: center; gap: 4px; opacity: 0; transform: translateY(10px); }
.gp.show .gp-item { animation: gp-item .45s cubic-bezier(.2, .9, .3, 1.3) forwards; animation-delay: calc(.12s + var(--k) * .1s); }
@keyframes gp-item { to { opacity: 1; transform: none; } }
.gp-item img { width: 46px; height: 46px; object-fit: contain; image-rendering: pixelated; filter: drop-shadow(0 3px 0 rgba(0, 0, 0, .6)); }
.gp-cat { font-size: 11px; color: #8d98c8; letter-spacing: .15em; align-self: flex-start; padding-left: 4px; }
.gp-rank { position: absolute; top: 7px; right: 8px; font-family: "Mulmaru", sans-serif; font-weight: normal; font-size: 15px; line-height: 1; color: #c9ccd6; }
.gp-name { font-size: 12px; line-height: 1.3; color: #dfe4fb; min-height: 2.6em; display: flex; align-items: center; word-break: keep-all; }
.gp-item.r-A { background: linear-gradient(180deg, rgba(255, 210, 61, .14), rgba(255, 210, 61, .03)); box-shadow: inset 0 0 0 1px rgba(255, 210, 61, .7), 0 0 18px rgba(255, 210, 61, .18); }
.gp-item.r-A .gp-rank, .gp-item.r-A .gp-name { color: #ffd23d; }
.gp-item.r-B { box-shadow: inset 0 0 0 1px rgba(255, 138, 61, .6); }
.gp-item.r-B .gp-rank, .gp-item.r-B .gp-name { color: #ffa064; }
.gp-msg { margin: 14px 0 16px; font-size: 13px; line-height: 1.65; color: #a9b4dc; word-break: keep-all; }
.gp-dl { width: 100%; font-size: 22px; }
.gp-meta { margin-top: 8px; font-size: 12px; color: #8d98c8; }
.gp-meta b { color: #dfe4fb; font-weight: normal; }
.gp-acts { display: flex; gap: 8px; margin-top: 16px; }
.gp-sub { flex: 1; padding: 9px 10px; border: 0; cursor: pointer; font: inherit; font-size: 13px; color: #c9d2f5;
  background: rgba(255, 255, 255, .04); box-shadow: inset 0 0 0 1px rgba(160, 180, 255, .2); }
.gp-sub:hover { color: #fff; box-shadow: inset 0 0 0 1px rgba(160, 180, 255, .5); background: rgba(255, 255, 255, .07); }
@media (max-width: 420px) {
  .gp-sky { height: 140px; } .gp-logo { width: 190px; }
  .gp-body { padding: 0 16px 18px; }
  .gp-got { gap: 6px; } .gp-item img { width: 38px; height: 38px; } .gp-name { font-size: 11px; }
  .gp-dl { font-size: 19px; }
}
@media (prefers-reduced-motion: reduce) { .gp-fly, .gp-cloud, .gp-stars, .gp-mach::after { animation: none; } .gp-item { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  .gr-rays.on, .gr-btn .sweep::before, .gr-banner, .gr-stamp { animation-duration: .01s !important; }
}
