/* =========================================================
   경품 대추첨 - 스타일
   ========================================================= */
:root {
  --bg-0: #0d0a1f;
  --bg-1: #161033;
  --panel: rgba(255, 255, 255, 0.06);
  --panel-brd: rgba(255, 255, 255, 0.12);
  --txt: #f4f1ff;
  --txt-dim: #b9b2da;
  --accent: #7c5cff;
  --accent-2: #ffd76b;

  --bronze: #cd7f32;
  --silver: #c9d2dc;
  --gold: #ffcf40;
  --platinum: #d9e3ff;
  --diamond: #7af0ff;
}

* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  height: 100%;
}
body {
  font-family: "Gowun Dodum", "Jua", sans-serif;
  background: radial-gradient(1200px 800px at 70% -10%, #2a1d5e 0%, transparent 55%),
    radial-gradient(900px 700px at 10% 110%, #3a1b54 0%, transparent 55%),
    linear-gradient(160deg, var(--bg-0), var(--bg-1));
  color: var(--txt);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* 배경 장식 */
.bg-decor {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}
.bg-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.35;
  animation: float 14s ease-in-out infinite;
}
.blob-1 {
  width: 420px;
  height: 420px;
  background: #7c5cff;
  top: -120px;
  left: -80px;
}
.blob-2 {
  width: 380px;
  height: 380px;
  background: #ff5fa2;
  bottom: -140px;
  right: -60px;
  animation-delay: -4s;
}
.blob-3 {
  width: 300px;
  height: 300px;
  background: #3fb6c9;
  top: 40%;
  right: 20%;
  animation-delay: -8s;
}
@keyframes float {
  0%,
  100% {
    transform: translate(0, 0) scale(1);
  }
  50% {
    transform: translate(30px, -30px) scale(1.1);
  }
}

#confetti-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 60;
  pointer-events: none;
}

/* ---------- 상단바 ---------- */
.topbar {
  position: relative;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 12px 22px;
  background: rgba(0, 0, 0, 0.25);
  border-bottom: 1px solid var(--panel-brd);
  backdrop-filter: blur(8px);
}
.brand {
  font-family: "Black Han Sans", sans-serif;
  font-size: 22px;
  letter-spacing: 0.5px;
  white-space: nowrap;
}
.progress-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 12px;
}
.progress-bar {
  flex: 1;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 99px;
  overflow: hidden;
}
.progress-bar span {
  display: block;
  height: 100%;
  width: 7%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border-radius: 99px;
  transition: width 0.4s ease;
}
.progress-label {
  font-size: 13px;
  color: var(--txt-dim);
  white-space: nowrap;
}
.topbar-tools {
  display: flex;
  gap: 8px;
}
.tool-btn {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--panel-brd);
  background: var(--panel);
  color: var(--txt);
  font-size: 18px;
  cursor: pointer;
  transition: 0.2s;
}
.tool-btn:hover {
  background: rgba(255, 255, 255, 0.16);
  transform: translateY(-1px);
}

/* ---------- 스테이지 ---------- */
.stage {
  position: relative;
  z-index: 2;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow: auto;
}
.page {
  width: min(960px, 100%);
  text-align: center;
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}
.page.in {
  opacity: 1;
  transform: none;
}

/* ---------- 등수 뱃지 / 공통 ---------- */
.rank-badge {
  display: inline-block;
  font-family: "Jua", sans-serif;
  font-size: 26px;
  padding: 8px 26px;
  border-radius: 99px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.02));
  border: 2px solid var(--tier-color, var(--accent));
  color: #fff;
  box-shadow: 0 0 24px var(--tier-glow, rgba(124, 92, 255, 0.5));
  margin-bottom: 18px;
}
.rank-badge.sm {
  font-size: 20px;
  padding: 6px 18px;
  margin-bottom: 0;
}

/* 등수별 테마 색 */
.tier-bronze {
  --tier-color: var(--bronze);
  --tier-glow: rgba(205, 127, 50, 0.5);
}
.tier-silver {
  --tier-color: var(--silver);
  --tier-glow: rgba(201, 210, 220, 0.5);
}
.tier-gold {
  --tier-color: var(--gold);
  --tier-glow: rgba(255, 207, 64, 0.55);
}
.tier-platinum {
  --tier-color: var(--platinum);
  --tier-glow: rgba(217, 227, 255, 0.6);
}
.tier-diamond {
  --tier-color: var(--diamond);
  --tier-glow: rgba(122, 240, 255, 0.7);
}

/* ---------- 경품 안내 화면 ---------- */
.intro-title {
  font-family: "Black Han Sans", sans-serif;
  font-size: clamp(28px, 4vw, 46px);
  line-height: 1.25;
  margin: 6px 0 10px;
  background: linear-gradient(90deg, #fff, var(--tier-color));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.value-note {
  display: inline-block;
  font-size: 18px;
  color: #fff;
  background: var(--panel);
  border: 1px dashed var(--tier-color);
  padding: 6px 16px;
  border-radius: 12px;
  margin-bottom: 20px;
}
.prize-grid {
  display: grid;
  gap: 18px;
  margin: 10px auto 18px;
  justify-content: center;
}
.prize-grid.single {
  grid-template-columns: minmax(260px, 420px);
}
.prize-grid.multi {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  max-width: 880px;
}
.prize-card {
  background: var(--panel);
  border: 1px solid var(--panel-brd);
  border-radius: 18px;
  padding: 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  transition: 0.3s;
}
.prize-card:hover {
  transform: translateY(-4px);
  border-color: var(--tier-color);
}
.prize-photo {
  aspect-ratio: 4 / 3;
  border-radius: 14px;
  overflow: hidden;
  background: repeating-linear-gradient(
    45deg,
    rgba(255, 255, 255, 0.04),
    rgba(255, 255, 255, 0.04) 12px,
    rgba(255, 255, 255, 0.07) 12px,
    rgba(255, 255, 255, 0.07) 24px
  );
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px dashed var(--panel-brd);
}
.prize-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.photo-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: var(--txt-dim);
}
.photo-icon {
  font-size: 46px;
  opacity: 0.85;
}
.photo-text {
  font-size: 13px;
  letter-spacing: 1px;
}
.prize-info {
  margin-top: 12px;
}
.prize-name {
  font-family: "Jua", sans-serif;
  font-size: 19px;
  line-height: 1.35;
}
.prize-qty {
  margin-top: 4px;
  font-size: 14px;
  color: var(--tier-color);
  font-weight: bold;
}
.intro-tagline {
  font-size: 18px;
  color: var(--txt);
  margin: 8px 0 4px;
}
.intro-foot {
  font-size: 14px;
  color: var(--txt-dim);
}

/* ---------- 추첨 페이지 공통 ---------- */
.draw-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
.draw-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.draw-sub {
  font-size: 15px;
  color: var(--txt-dim);
}
.machine-host {
  width: 100%;
  min-height: 360px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.draw-controls {
  margin-top: 4px;
}
.draw-start-btn {
  font-family: "Jua", sans-serif;
  font-size: 22px;
  padding: 14px 44px;
  border-radius: 99px;
  border: none;
  cursor: pointer;
  color: #1a1030;
  background: linear-gradient(135deg, var(--accent-2), #ffb44d);
  box-shadow: 0 10px 26px rgba(255, 180, 77, 0.4);
  transition: 0.2s;
}
.draw-start-btn:hover:not(:disabled) {
  transform: translateY(-2px) scale(1.03);
}
.draw-start-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.m-hint {
  margin-top: 14px;
  font-size: 16px;
  color: var(--txt-dim);
  min-height: 22px;
}
.already-drawn {
  font-size: 18px;
  color: var(--txt);
  background: var(--panel);
  border: 1px solid var(--panel-brd);
  padding: 24px 30px;
  border-radius: 16px;
  line-height: 1.6;
}
.already-drawn b {
  color: var(--accent-2);
  font-size: 22px;
}

/* ===== 슬롯머신 ===== */
.m-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.m-slot-shell {
  background: linear-gradient(160deg, #2a1f55, #1a1238);
  border: 4px solid var(--accent-2);
  border-radius: 24px;
  padding: 26px 30px 18px;
  box-shadow: 0 0 50px rgba(255, 215, 107, 0.25), inset 0 0 30px rgba(0, 0, 0, 0.4);
}
.m-slot-window {
  display: flex;
  gap: 14px;
  padding: 10px;
  background: #0c0820;
  border-radius: 16px;
  border: 2px solid rgba(255, 255, 255, 0.12);
}
.m-slot-window.win {
  animation: slotWin 0.6s ease;
}
@keyframes slotWin {
  50% {
    box-shadow: 0 0 60px var(--accent-2);
  }
}
.reel {
  width: 92px;
  height: 130px;
  background: linear-gradient(#fff, #e7e2ff);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-shadow: inset 0 8px 14px rgba(0, 0, 0, 0.25),
    inset 0 -8px 14px rgba(0, 0, 0, 0.25);
}
.reel span {
  font-family: "Black Han Sans", sans-serif;
  font-size: 86px;
  color: #2a1d5e;
}
.reel.spinning span {
  filter: blur(2px);
  opacity: 0.85;
}
.reel.locked {
  background: linear-gradient(#fff7d6, #ffe9a8);
}
.m-slot-deco {
  margin-top: 12px;
  font-family: "Jua", sans-serif;
  color: var(--accent-2);
  letter-spacing: 3px;
}

/* ===== 셔플 그리드 ===== */
.m-shuffle {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.sf-grid {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 8px;
  max-width: 640px;
}
.sf-cell {
  width: 54px;
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: var(--panel);
  border: 2px solid var(--panel-brd);
  font-family: "Jua", sans-serif;
  font-size: 22px;
  color: var(--txt);
  transition: background 0.08s, transform 0.08s;
}
.sf-cell.active {
  background: linear-gradient(135deg, var(--accent), #b28dff);
  border-color: #fff;
  transform: scale(1.12);
  box-shadow: 0 0 22px rgba(124, 92, 255, 0.7);
  color: #fff;
}
.sf-cell.won {
  background: linear-gradient(135deg, var(--accent-2), #ffb44d);
  color: #1a1030;
  border-color: #fff;
  transform: scale(1.25);
  box-shadow: 0 0 34px var(--accent-2);
  animation: wonPulse 0.8s ease infinite alternate;
}
@keyframes wonPulse {
  to {
    transform: scale(1.32);
  }
}
@media (max-width: 640px) {
  .sf-grid {
    grid-template-columns: repeat(8, 1fr);
  }
  .sf-cell {
    width: 40px;
    height: 40px;
    font-size: 17px;
  }
}

/* ===== 룰렛 휠 ===== */
.m-wheel {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.wheel-svg {
  width: min(440px, 80vw);
  height: min(440px, 80vw);
  filter: drop-shadow(0 12px 30px rgba(0, 0, 0, 0.5));
}
.wheel-num {
  fill: #fff;
  font-family: "Jua", sans-serif;
  font-size: 15px;
}
.wheel-hub {
  fill: var(--accent-2);
  font-family: "Black Han Sans", sans-serif;
  font-size: 16px;
}
.wheel-pointer {
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 40px;
  color: var(--accent-2);
  z-index: 3;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.6));
}
.m-wheel.win .wheel-svg {
  animation: wheelWin 0.7s ease;
}
@keyframes wheelWin {
  50% {
    filter: drop-shadow(0 0 40px var(--accent-2));
  }
}

/* ===== 볼/구슬 엔진 ===== */
.m-balls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}
.balls-chamber {
  position: relative;
  width: min(380px, 80vw);
  height: min(380px, 80vw);
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.02) 60%),
    rgba(10, 8, 26, 0.6);
  border: 6px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 0 50px rgba(124, 92, 255, 0.25), inset 0 0 40px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}
.balls-chamber.popping {
  animation: chamberPop 0.35s ease;
}
@keyframes chamberPop {
  50% {
    transform: scale(1.03);
    box-shadow: 0 0 70px var(--tier-color, #7c5cff);
  }
}
.balls-chamber canvas {
  position: absolute;
  inset: 0;
}
.chamber-glass {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 25%, rgba(255, 255, 255, 0.22), transparent 40%);
  pointer-events: none;
}
.chamber-exit {
  position: absolute;
  width: 46px;
  height: 46px;
  background: radial-gradient(circle, rgba(255, 215, 107, 0.5), transparent 70%);
  border-radius: 50%;
}
.exit-bottom {
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
}
.exit-top {
  top: -6px;
  left: 50%;
  transform: translateX(-50%);
}
.balls-tray {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.tray-label {
  font-family: "Jua", sans-serif;
  color: var(--tier-color, var(--accent-2));
  font-size: 16px;
}
.tray-slots {
  display: flex;
  gap: 12px;
}
.tray-slot {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--panel);
  border: 2px dashed var(--panel-brd);
  font-family: "Black Han Sans", sans-serif;
  font-size: 28px;
  color: var(--txt-dim);
}
.tray-slot.filled {
  background: radial-gradient(circle at 35% 30%, #fff, var(--tier-color, #ffd76b));
  border: 2px solid #fff;
  color: #1a1030;
  animation: slotFill 0.5s ease;
  box-shadow: 0 0 24px var(--tier-glow, rgba(255, 215, 107, 0.6));
}
@keyframes slotFill {
  0% {
    transform: scale(0.3);
  }
  60% {
    transform: scale(1.2);
  }
}

/* ===== 마블 룰렛 (lazygyu 스타일 네온 레이스) ===== */
.m-marble.lazy {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  width: 100%;
}
.lazy-stage {
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 10px;
  height: min(62vh, 540px);
  max-width: 96vw;
  padding: 10px;
  background: #05060d;
  border: 2px solid rgba(46, 230, 255, 0.25);
  border-radius: 16px;
  box-shadow: 0 0 50px rgba(46, 230, 255, 0.15), inset 0 0 40px rgba(0, 0, 0, 0.6);
}
.lazy-mini {
  height: 100%;
  width: auto;
  aspect-ratio: 84 / 440;
  background: #070811;
  border: 1px solid rgba(46, 230, 255, 0.25);
  border-radius: 8px;
}
.lazy-course {
  position: relative;
  height: 100%;
  aspect-ratio: 440 / 430;
  border-radius: 8px;
  overflow: hidden;
  background: #05060d;
}
.lazy-course canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}
.lazy-board {
  height: 100%;
  width: 152px;
  display: flex;
  flex-direction: column;
  background: #070811;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  overflow: hidden;
}
.board-count {
  flex: 0 0 auto;
  text-align: right;
  font-family: "Jua", sans-serif;
  font-size: 15px;
  color: #cfd8ff;
  padding: 6px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.board-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.board-list::-webkit-scrollbar {
  width: 5px;
}
.board-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.18);
  border-radius: 3px;
}
.brow {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: "Jua", sans-serif;
  font-size: 13px;
  color: #aeb6d6;
  padding: 1px 2px;
}
.brow .brk {
  width: 26px;
  text-align: right;
  opacity: 0.7;
  font-size: 11px;
}
.brow .bdot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  box-shadow: 0 0 6px currentColor;
}
.brow .bnum {
  color: #fff;
  min-width: 22px;
}
.brow.win {
  color: #ffd76b;
}
.brow.win .bnum {
  color: #ffd76b;
  text-shadow: 0 0 8px rgba(255, 215, 107, 0.6);
}
.brow.fin .brk {
  color: #6bcb77;
  opacity: 1;
}

/* GO 카운트다운 */
.lazy-course .marble-go {
  position: absolute;
  top: 42%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 3;
  font-family: "Black Han Sans", sans-serif;
  font-size: 84px;
  color: #fff;
  text-shadow: 0 0 28px #2ee6ff, 0 4px 10px rgba(0, 0, 0, 0.6);
  pointer-events: none;
}
.lazy-course .marble-go.pop {
  animation: countPop 0.8s ease;
}

/* WINNER 공개 */
.lazy-winner {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: radial-gradient(circle at 50% 45%, rgba(0, 0, 0, 0.35), rgba(0, 0, 0, 0.78));
}
.lazy-winner.show {
  display: flex;
  animation: fadeIn 0.3s ease;
}
.lazy-winner .wlabel {
  font-family: "Black Han Sans", sans-serif;
  font-size: 42px;
  letter-spacing: 3px;
  color: #fff;
  text-shadow: 0 0 24px #ffd76b;
}
.lazy-winner .wnums {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  justify-content: center;
}
.lazy-winner .wnums span {
  min-width: 66px;
  height: 66px;
  padding: 0 10px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: "Black Han Sans", sans-serif;
  font-size: 34px;
  color: #0a0a18;
  background: radial-gradient(circle at 35% 30%, #fff, var(--c, #ffd76b));
  box-shadow: 0 0 30px var(--c, #ffd76b);
  animation: chipIn 0.5s cubic-bezier(0.2, 1.4, 0.4, 1) both;
}

@media (max-width: 640px) {
  .lazy-stage {
    height: auto;
    flex-wrap: wrap;
  }
  .lazy-mini {
    display: none;
  }
  .lazy-course {
    width: 100%;
    height: auto;
    aspect-ratio: 440 / 430;
  }
  .lazy-board {
    width: 100%;
    height: 160px;
  }
}

/* ===== 파이널 (1등) ===== */
.m-finale {
  width: 100%;
}
.finale-stage {
  position: relative;
  width: min(640px, 92vw);
  margin: 0 auto;
  min-height: 360px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 24px;
  border-radius: 24px;
  background: radial-gradient(circle at 50% 30%, rgba(122, 240, 255, 0.12), transparent 60%);
}
.finale-stage.shake {
  animation: shake 0.5s ease;
}
@keyframes shake {
  0%,
  100% {
    transform: translate(0, 0);
  }
  20% {
    transform: translate(-8px, 4px);
  }
  40% {
    transform: translate(8px, -4px);
  }
  60% {
    transform: translate(-6px, -3px);
  }
  80% {
    transform: translate(6px, 3px);
  }
}
.tension-wrap {
  width: 80%;
  display: flex;
  align-items: center;
  gap: 10px;
}
.tension-label {
  font-size: 14px;
  color: var(--diamond);
  white-space: nowrap;
}
.tension-bar {
  flex: 1;
  height: 12px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
  border: 1px solid rgba(122, 240, 255, 0.4);
}
.tension-bar span {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #7af0ff, #ff5fa2, #ffd76b);
  transition: width 2.4s linear;
}
.finale-orb {
  position: relative;
  width: 120px;
  height: 120px;
}
.orb-core {
  position: absolute;
  inset: 28px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff, #7af0ff 50%, #4d6bff);
  box-shadow: 0 0 40px #7af0ff;
}
.orb-ring,
.orb-ring.r2 {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 3px solid rgba(122, 240, 255, 0.6);
}
.orb-ring.r2 {
  inset: 12px;
  border-color: rgba(255, 95, 162, 0.5);
}
.finale-orb.charging .orb-core {
  animation: orbPulse 0.6s ease infinite alternate;
}
.finale-orb.charging .orb-ring {
  animation: spin 1.2s linear infinite;
}
.finale-orb.charging .orb-ring.r2 {
  animation: spin 0.8s linear infinite reverse;
}
.finale-orb.blast .orb-core {
  animation: orbBlast 0.6s ease;
}
@keyframes orbPulse {
  to {
    transform: scale(1.15);
    box-shadow: 0 0 70px #7af0ff;
  }
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
@keyframes orbBlast {
  50% {
    transform: scale(1.6);
    box-shadow: 0 0 90px #fff;
  }
}
.finale-msg {
  font-family: "Jua", sans-serif;
  font-size: 22px;
  color: #fff;
  min-height: 30px;
}
.finale-display {
  display: flex;
  gap: 14px;
}
.fd-digit {
  width: 110px;
  height: 150px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Black Han Sans", sans-serif;
  font-size: 100px;
  color: #fff;
  background: linear-gradient(160deg, #1a1238, #0c0820);
  border: 3px solid rgba(122, 240, 255, 0.5);
  box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.6);
}
.fd-digit.locked {
  border-color: var(--accent-2);
  background: linear-gradient(160deg, #2a1f55, #1a1238);
  color: var(--accent-2);
  box-shadow: 0 0 30px var(--accent-2);
  animation: digitLock 0.3s ease;
}
@keyframes digitLock {
  0% {
    transform: scale(1.3);
  }
}
.finale-count {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: "Black Han Sans", sans-serif;
  font-size: 160px;
  color: #fff;
  text-shadow: 0 0 40px var(--diamond);
  pointer-events: none;
}
.finale-count.pop {
  animation: countPop 0.9s ease;
}
@keyframes countPop {
  0% {
    transform: translate(-50%, -50%) scale(0.2);
    opacity: 0;
  }
  30% {
    transform: translate(-50%, -50%) scale(1.2);
    opacity: 1;
  }
  100% {
    transform: translate(-50%, -50%) scale(2.4);
    opacity: 0;
  }
}
.finale-stage.final-win {
  animation: finalWin 0.8s ease;
}
@keyframes finalWin {
  50% {
    box-shadow: 0 0 120px var(--accent-2);
  }
}

/* ---------- 막간 ---------- */
.interlude-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}
.interlude-emoji {
  font-size: 80px;
  animation: bob 2s ease-in-out infinite;
}
@keyframes bob {
  50% {
    transform: translateY(-12px);
  }
}
.interlude-title {
  font-family: "Black Han Sans", sans-serif;
  font-size: clamp(28px, 4.5vw, 50px);
}
.interlude-lines p {
  font-size: 20px;
  color: var(--txt-dim);
  margin: 6px 0;
}
.tbc {
  margin-top: 14px;
  font-family: "Black Han Sans", sans-serif;
  font-size: clamp(26px, 5vw, 54px);
  letter-spacing: 2px;
  background: linear-gradient(90deg, var(--accent-2), #ff5fa2, var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: tbcGlow 2.2s ease-in-out infinite;
}
@keyframes tbcGlow {
  50% {
    filter: brightness(1.4);
  }
}

/* ---------- 최종 축하 ---------- */
.final-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
.final-title {
  font-family: "Black Han Sans", sans-serif;
  font-size: clamp(26px, 4.2vw, 46px);
  background: linear-gradient(90deg, #ffd76b, #ff5fa2, #7af0ff);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.final-subtitle {
  color: var(--txt-dim);
  font-size: 17px;
  margin-top: -4px;
}
.final-list {
  width: 100%;
  max-width: 760px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 8px 0 6px;
}
.final-row {
  display: grid;
  grid-template-columns: 120px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-radius: 14px;
  background: var(--panel);
  border: 1px solid var(--panel-brd);
  border-left: 5px solid var(--tier-color);
  text-align: left;
}
.fw-rank {
  font-family: "Jua", sans-serif;
  font-size: 20px;
  color: var(--tier-color);
}
.fw-prize {
  font-size: 15px;
  color: var(--txt-dim);
}
.fw-nums {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.fw-num {
  min-width: 40px;
  height: 40px;
  padding: 0 8px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 35% 30%, #fff, var(--tier-color));
  color: #1a1030;
  font-family: "Black Han Sans", sans-serif;
  font-size: 20px;
}
.final-empty {
  color: var(--txt-dim);
  padding: 20px;
}
.final-celebrate {
  margin-top: 6px;
  font-family: "Jua", sans-serif;
  font-size: 18px;
  padding: 12px 32px;
  border-radius: 99px;
  border: none;
  cursor: pointer;
  color: #1a1030;
  background: linear-gradient(135deg, var(--accent-2), #ff5fa2);
  transition: 0.2s;
}
.final-celebrate:hover {
  transform: translateY(-2px) scale(1.04);
}
@media (max-width: 560px) {
  .final-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }
  .fw-nums {
    justify-content: flex-start;
  }
}

/* ---------- 하단 네비 ---------- */
.navbar {
  position: relative;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 22px;
  background: rgba(0, 0, 0, 0.25);
  border-top: 1px solid var(--panel-brd);
  backdrop-filter: blur(8px);
}
.nav-btn {
  font-family: "Jua", sans-serif;
  font-size: 18px;
  padding: 10px 26px;
  border-radius: 99px;
  border: 1px solid var(--panel-brd);
  background: var(--panel);
  color: var(--txt);
  cursor: pointer;
  transition: 0.2s;
}
.nav-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.16);
  transform: translateY(-1px);
}
.nav-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.nav-btn.blocked {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}
.dots {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  justify-content: center;
}
.dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.2);
  cursor: pointer;
  padding: 0;
  transition: 0.2s;
}
.dot:hover {
  background: rgba(255, 255, 255, 0.4);
}
.dot.on {
  background: var(--accent-2);
  transform: scale(1.3);
}

/* ---------- 당첨 팝업 ---------- */
.winner-popup {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(5, 3, 15, 0.78);
  backdrop-filter: blur(6px);
}
.winner-popup.show {
  display: flex;
  animation: fadeIn 0.3s ease;
}
@keyframes fadeIn {
  from {
    opacity: 0;
  }
}
.popup-confetti {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.popup-inner {
  position: relative;
  z-index: 2;
  width: min(560px, 92vw);
  text-align: center;
  padding: 34px 30px 28px;
  border-radius: 26px;
  background: linear-gradient(160deg, #221848, #140d30);
  border: 3px solid var(--tier-color, var(--accent-2));
  box-shadow: 0 0 60px var(--tier-glow, rgba(255, 215, 107, 0.5));
  animation: popIn 0.5s cubic-bezier(0.2, 1.3, 0.4, 1);
}
@keyframes popIn {
  0% {
    transform: scale(0.5) translateY(40px);
    opacity: 0;
  }
}
.popup-ribbon {
  display: inline-block;
  font-family: "Black Han Sans", sans-serif;
  font-size: 26px;
  padding: 6px 28px;
  border-radius: 99px;
  background: linear-gradient(135deg, var(--tier-color), #fff);
  color: #1a1030;
  margin-bottom: 12px;
}
.popup-prize {
  font-size: 17px;
  color: var(--txt-dim);
  margin-bottom: 6px;
}
.popup-congrats {
  font-family: "Jua", sans-serif;
  font-size: 24px;
  color: #fff;
  margin-bottom: 18px;
}
.popup-numbers {
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 24px;
}
.win-chip {
  min-width: 78px;
  height: 78px;
  padding: 0 12px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: "Black Han Sans", sans-serif;
  font-size: 40px;
  color: #1a1030;
  background: radial-gradient(circle at 35% 30%, #fff, var(--tier-color, #ffd76b));
  box-shadow: 0 0 30px var(--tier-glow, rgba(255, 215, 107, 0.6));
  opacity: 0;
  transform: scale(0.3);
  animation: chipIn 0.5s cubic-bezier(0.2, 1.4, 0.4, 1) forwards;
}
@keyframes chipIn {
  to {
    opacity: 1;
    transform: scale(1);
  }
}
.popup-close {
  font-family: "Jua", sans-serif;
  font-size: 18px;
  padding: 11px 40px;
  border-radius: 99px;
  border: none;
  cursor: pointer;
  color: #1a1030;
  background: linear-gradient(135deg, #fff, var(--tier-color, #ffd76b));
  transition: 0.2s;
}
.popup-close:hover {
  transform: translateY(-2px) scale(1.04);
}

/* 등수 올라갈수록 화려하게 (팝업 추가 연출) */
.winner-popup.tier-gold .popup-inner,
.winner-popup.tier-platinum .popup-inner,
.winner-popup.tier-diamond .popup-inner {
  animation: popIn 0.5s cubic-bezier(0.2, 1.3, 0.4, 1), glowPulse 1.8s ease-in-out infinite 0.6s;
}
@keyframes glowPulse {
  50% {
    box-shadow: 0 0 90px var(--tier-glow);
  }
}
.winner-popup.tier-platinum .popup-inner {
  border-width: 4px;
}
.winner-popup.tier-diamond .popup-inner {
  border-width: 5px;
  background: linear-gradient(160deg, #1a2a48, #0d1830);
}
.winner-popup.tier-diamond .popup-congrats {
  font-size: 28px;
  background: linear-gradient(90deg, #7af0ff, #fff, #ffd76b);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: tbcGlow 1.5s ease-in-out infinite;
}
.winner-popup.tier-diamond .win-chip {
  width: 100px;
  height: 100px;
  font-size: 52px;
  animation: chipIn 0.5s cubic-bezier(0.2, 1.4, 0.4, 1) forwards,
    wonPulse 1s ease-in-out infinite alternate 0.6s;
}
.winner-popup.tier-diamond .popup-ribbon {
  font-size: 32px;
  animation: wonPulse 0.9s ease-in-out infinite alternate;
}

/* 스크롤바 */
.stage::-webkit-scrollbar {
  width: 8px;
}
.stage::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
}

/* ===== 신규 추첨기: 플링코 / 사다리타기 / 금고 다이얼 ===== */
.m-plinko,
.m-ladder,
.m-safe {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  width: 100%;
}
.plinko-arena {
  height: min(60vh, 520px);
  aspect-ratio: 460 / 500;
  max-width: 94vw;
  border-radius: 16px;
  overflow: hidden;
  border: 3px solid rgba(124, 92, 255, 0.4);
  background: #0c0820;
  box-shadow: 0 0 40px rgba(124, 92, 255, 0.25), inset 0 0 30px rgba(0, 0, 0, 0.5);
}
.ladder-arena {
  height: min(58vh, 480px);
  aspect-ratio: 500 / 460;
  max-width: 94vw;
  border-radius: 16px;
  overflow: hidden;
  border: 3px solid rgba(124, 92, 255, 0.4);
  background: #0c0820;
  box-shadow: 0 0 40px rgba(124, 92, 255, 0.25), inset 0 0 30px rgba(0, 0, 0, 0.5);
}
.plinko-arena canvas,
.ladder-arena canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* 금고 다이얼 */
.safe-body {
  position: relative;
  width: min(360px, 82vw);
  height: min(360px, 82vw);
  display: flex;
  align-items: center;
  justify-content: center;
}
.safe-svg {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 10px 26px rgba(0, 0, 0, 0.5));
}
.safe-tick-num {
  fill: #cdd2f0;
  font-family: "Jua", sans-serif;
  font-size: 14px;
}
.safe-pointer {
  position: absolute;
  top: -4px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 34px;
  color: var(--accent-2);
  z-index: 3;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.6));
}
.safe-reveal {
  position: absolute;
  z-index: 4;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Black Han Sans", sans-serif;
  font-size: 56px;
  color: #1a1030;
  background: radial-gradient(circle at 35% 30%, #fff, var(--accent-2));
  box-shadow: 0 0 40px var(--accent-2);
  opacity: 0;
  transform: scale(0.2);
  transition: opacity 0.4s ease, transform 0.5s cubic-bezier(0.2, 1.4, 0.4, 1);
}
.safe-body.open .safe-reveal {
  opacity: 1;
  transform: scale(1);
}
.safe-body.open .safe-svg {
  filter: drop-shadow(0 0 30px var(--accent-2));
  opacity: 0.45;
  transition: opacity 0.4s ease;
}
