/* 후추 슬롯머신 - slot.css — "버터 모닝" 리뉴얼 (2026-06) */
/* games.css(리뉴얼판) 변수/헤더 재사용. 셀렉터/JS 훅 보존. */
/* 🎰 슬롯 시그니처 연출: "장난감 나무 슬롯머신" —
   올리브 우드 캐비닛에 크림색 릴 창, 릴이 멈출 때마다 통통 튀고
   잭팟이면 릴 창이 버터빛으로 번쩍이며 기계 전체가 들썩인다. */

.slot-section { padding: 20px; }

.slot-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.slot-balance { color: var(--accent); font-size: 1.1rem; font-weight: 800; }
.slot-plays { color: var(--text-sub); font-size: 0.85rem; font-weight: 700; }
.slot-plays span { color: var(--accent); }

/* 슬롯 본체 — 나무 캐비닛 + 안쪽 종이 질감 */
.slot-machine {
  background: linear-gradient(135deg, #7a8450, #5c6339);
  border-radius: 22px;
  border: 3px solid #4b5230;
  padding: 24px 16px;
  box-shadow:
    inset 0 2px 10px rgba(0, 0, 0, 0.25),
    0 5px 0 rgba(70, 76, 42, 0.45);
  position: relative;
}
/* 캐비닛 상단 리벳 장식 */
.slot-machine::before {
  content: '';
  position: absolute;
  top: 10px;
  left: 16px;
  right: 16px;
  height: 6px;
  background-image: radial-gradient(circle 3px, rgba(245, 232, 168, 0.4) 3px, transparent 4px);
  background-size: 24px 6px;
  background-repeat: repeat-x;
  pointer-events: none;
}
.slot-reels {
  display: flex;
  gap: 10px;
  justify-content: center;
}
.slot-reel {
  width: 80px;
  height: 96px;
  background: var(--color-surface);
  border: 3px solid #fffdf5;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  box-shadow:
    inset 0 3px 8px rgba(0, 0, 0, 0.12),
    0 3px 0 rgba(0, 0, 0, 0.22);
  user-select: none;
  transition: box-shadow 0.3s ease;
}
[data-theme="dark"] .slot-reel {
  border-color: #57491f;
}
/* 릴 멈춤 — 통통 (스프링 강화) */
.reel-stop { animation: reelBounce .45s var(--bm-spring); }
@keyframes reelBounce {
  0%   { transform: translateY(-12px) scale(1.05); }
  55%  { transform: translateY(4px) scale(0.98); }
  100% { transform: translateY(0) scale(1); }
}

/* 결과 */
.slot-result {
  text-align: center;
  min-height: 56px;
  margin: 18px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  /* 결과 영역은 캐비닛 밖(크림 배경 위)이라 진한 색이어야 보임 */
  color: var(--color-text);
}
.slot-result-label { font-weight: 800; font-size: 1.1rem; }
.slot-result-net { font-weight: 900; font-size: 1.4rem; }
/* 잭팟 — 기계 들썩 + 버터 글로우 */
.slot-result.jackpot {
  color: #a8741a;
  text-shadow: 0 0 14px rgba(232, 181, 74, 0.55);
  animation: slotPop .5s var(--bm-spring);
}
.slot-result.win { color: var(--color-olive-dark); }
.slot-result.even { color: var(--color-text-secondary); }
.slot-result.lose { color: #c2473a; }
/* 다크 모드 — 어두운 배경 위라 밝은 톤 유지 */
[data-theme="dark"] .slot-result { color: #fdf6da; }
[data-theme="dark"] .slot-result.jackpot {
  color: #ffe9ad;
  text-shadow: 0 0 18px rgba(255, 233, 173, 0.65);
}
[data-theme="dark"] .slot-result.win { color: #d8e8b0; }
[data-theme="dark"] .slot-result.even { color: rgba(253, 246, 218, 0.7); }
[data-theme="dark"] .slot-result.lose { color: #f0a496; }
@keyframes slotPop {
  0%   { transform: scale(0.7) rotate(-2deg); }
  50%  { transform: scale(1.22) rotate(2deg); }
  100% { transform: scale(1); }
}
/* 잭팟 시 릴 창 버터빛 점멸 */
.slot-result.jackpot ~ * .slot-reel,
.slot-machine:has(.slot-result.jackpot) .slot-reel {
  animation: reelGlow 0.7s ease-in-out 2;
}
@keyframes reelGlow {
  0%, 100% { box-shadow: inset 0 3px 8px rgba(0, 0, 0, 0.12), 0 3px 0 rgba(0, 0, 0, 0.22); }
  50% { box-shadow: inset 0 3px 8px rgba(0, 0, 0, 0.08), 0 0 22px rgba(255, 233, 173, 0.85); }
}
.slot-machine:has(.slot-result.jackpot) {
  animation: cabinetShake 0.55s ease-in-out;
}
@keyframes cabinetShake {
  0%, 100% { transform: rotate(0deg); }
  20% { transform: rotate(-1deg) translateY(-2px); }
  40% { transform: rotate(1deg); }
  60% { transform: rotate(-0.7deg); }
  80% { transform: rotate(0.5deg); }
}

/* 🌟 그랜드 잭팟 — 빛나는 후추 셋 (황금빛 글로우, 0.1% 초레어) */
.slot-result.grand {
  color: #b8860b;
  text-shadow: 0 0 18px rgba(255, 200, 60, 0.85);
  animation: slotPop .5s var(--bm-spring), grandPulse 1.1s ease-in-out .5s infinite;
}
[data-theme="dark"] .slot-result.grand {
  color: #ffe9ad;
  text-shadow: 0 0 22px rgba(255, 215, 110, 0.95);
}
@keyframes grandPulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.07); }
}
/* 빛나는 후추 — 릴 황금 글로우 + 이모지 후광 */
.slot-reel.reel-grand {
  border-color: #ffd24a;
  filter: drop-shadow(0 0 7px rgba(255, 200, 60, 0.95));
  animation: grandReelGlow 0.9s ease-in-out infinite;
}
@keyframes grandReelGlow {
  0%, 100% { box-shadow: inset 0 3px 8px rgba(0, 0, 0, 0.1), 0 0 12px rgba(255, 210, 74, 0.65); }
  50%      { box-shadow: inset 0 3px 8px rgba(0, 0, 0, 0.06), 0 0 30px rgba(255, 210, 74, 1); }
}
/* 캐비닛 — 황금빛으로 들썩이며 번쩍 */
.slot-machine.grand-win {
  animation: cabinetShake 0.6s ease-in-out, grandCabinetGlow 1.2s ease-in-out infinite;
}
@keyframes grandCabinetGlow {
  0%, 100% { box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.25), 0 5px 0 rgba(70, 76, 42, 0.45); }
  50%      { box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.2), 0 5px 0 rgba(70, 76, 42, 0.45), 0 0 34px rgba(255, 210, 74, 0.75); }
}

/* 당기기 버튼 — 폭신한 빨강 레버 */
.slot-lever {
  width: 100%;
  padding: 16px;
  background: linear-gradient(135deg, #e0604c, #f0875e);
  color: #fff;
  border: none;
  border-radius: var(--r-pill);
  font-family: inherit;
  font-weight: 800;
  font-size: 1.1rem;
  cursor: pointer;
  box-shadow: 0 4px 0 rgba(160, 50, 35, 0.4);
  transition: transform 0.2s var(--bm-spring), filter 0.2s ease;
}
.slot-lever:hover:not(:disabled) {
  filter: brightness(1.06);
  transform: scale(1.02);
}
.slot-lever:active:not(:disabled) {
  transform: scale(0.96) translateY(2px);
  box-shadow: 0 2px 0 rgba(160, 50, 35, 0.4);
}
.slot-lever:disabled { opacity: 0.5; cursor: not-allowed; }

/* 배당표 */
.slot-paytable {
  margin-top: 18px;
  font-size: 0.85rem;
  color: var(--text-sub);
}
.slot-paytable summary {
  cursor: pointer;
  font-weight: 700;
  padding: 8px 0;
}
.slot-paytable summary:hover { color: var(--text); }
.slot-paytable table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
}
.slot-paytable td {
  padding: 6px 8px;
  border-bottom: 1.5px dashed var(--bm-line);
}
.slot-paytable td:first-child { font-size: 1.05rem; }
.slot-paytable td:last-child { text-align: right; font-weight: 800; color: var(--text); }
.slot-paytable-note { margin-top: 10px; text-align: center; }

/* ===== 🎰 가챠급 연출 (2026-07 · 스펙 docs/superpowers/specs/2026-07-02-slot-gacha-fx-design.md) ===== */

/* 릴 스트립 — 창(.slot-reel) 안에서 세로 심볼 띠가 실제로 구른다 */
.slot-reel.fx-reel { position: relative; overflow: hidden; }
.reel-strip { position: absolute; left: 0; top: 0; width: 100%; will-change: transform; }
.reel-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 96px; /* .slot-reel 높이와 동일 (slot-fx.js CELL) */
}
.fx-reel.fx-spinning .reel-strip {
  animation: fxReelSpin 0.32s linear infinite;
  filter: blur(1.5px);
}
@keyframes fxReelSpin {
  from { transform: translateY(0); }
  to   { transform: translateY(-576px); } /* 심볼 풀 6개 × 96px */
}

/* ① 레버 커밋 — 기계가 덜컹 */
.slot-machine.fx-pull { animation: fxPull 0.3s ease-out; }
@keyframes fxPull {
  30%  { transform: translateY(4px) scale(0.995); }
  100% { transform: none; }
}

/* 리치 — 페이지 딤 + 스포트라이트 + 하트비트 + 심볼 색 오라 */
.slot-fx-dim {
  position: fixed;
  inset: 0;
  background: rgba(20, 18, 10, 0.55);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
  z-index: 40;
}
body.fx-reach .slot-fx-dim { opacity: 1; }
body.fx-reach .slot-machine {
  position: relative;
  z-index: 41;
  animation: fxHeartbeat 0.9s ease-in-out infinite;
}
.slot-machine.fx-aura-gold {
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.25), 0 0 36px rgba(255, 210, 74, 0.8);
}
.slot-machine.fx-aura-pink {
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.25), 0 0 36px rgba(240, 130, 160, 0.8);
}
@keyframes fxHeartbeat {
  0%, 100% { transform: scale(1); }
  12%      { transform: scale(1.015); }
  24%      { transform: scale(1); }
  36%      { transform: scale(1.01); }
}

/* 리빌 쉐이크 (big은 기존 cabinetShake 재사용) */
.slot-machine.fx-shake-big { animation: cabinetShake 0.55s ease-in-out; }
.slot-machine.fx-shake-small { animation: fxShakeSmall 0.35s ease-in-out; }
@keyframes fxShakeSmall {
  25% { transform: translateX(-2px); }
  50% { transform: translateX(2px); }
  75% { transform: translateX(-1px); }
}
/* 니어미스(본전) — 아깝다 반동 */
.slot-machine.fx-near { animation: fxNear 0.5s ease-out; }
@keyframes fxNear {
  20% { transform: rotate(-0.6deg); }
  60% { transform: rotate(0.4deg); }
}

/* 파티클 캔버스 / 화이트아웃 / 배너 */
.slot-fx-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 80;
}
.slot-fx-white {
  position: fixed;
  inset: 0;
  background: #fffdf0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease;
  z-index: 90;
}
.slot-fx-white.show { opacity: 1; transition: opacity 0.18s ease; }
.slot-fx-banner {
  position: fixed;
  top: 26%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.4);
  opacity: 0;
  pointer-events: none;
  z-index: 85;
  font-weight: 900;
  font-size: clamp(1.4rem, 7vw, 2rem);
  text-align: center;
  white-space: nowrap;
  transition: opacity 0.4s ease;
}
.slot-fx-banner.show { animation: fxBannerSlam 0.45s var(--bm-spring) forwards; }
@keyframes fxBannerSlam {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(2.6); }
  60%  { opacity: 1; transform: translate(-50%, -50%) scale(0.92); }
  100% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}
.slot-fx-banner.jackpot {
  color: #ffe9ad;
  text-shadow: 0 0 18px rgba(232, 181, 74, 0.9), 0 2px 0 rgba(90, 60, 0, 0.5);
}
.slot-fx-banner.grand {
  font-size: clamp(1.6rem, 8vw, 2.4rem);
  color: #fff3c4;
  text-shadow: 0 0 24px rgba(255, 210, 74, 1), 0 0 60px rgba(255, 150, 220, 0.6), 0 2px 0 rgba(90, 60, 0, 0.6);
}

/* 사운드 토글 */
.slot-sound-toggle {
  border: none;
  background: transparent;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 8px;
  font-family: inherit;
}
.slot-sound-toggle:hover { background: rgba(0, 0, 0, 0.06); }
[data-theme="dark"] .slot-sound-toggle:hover { background: rgba(255, 255, 255, 0.1); }

/* 다크모드 */
[data-theme="dark"] .slot-fx-dim { background: rgba(0, 0, 0, 0.65); }
[data-theme="dark"] .slot-fx-white { background: #fff8dc; }

/* 모션 최소화 — 연출은 JS(buildChoreography)에서도 단축됨 (스펙 §4) */
@media (prefers-reduced-motion: reduce) {
  .fx-reel.fx-spinning .reel-strip { animation-duration: 0.6s; filter: none; }
  body.fx-reach .slot-machine { animation: none; }
  .slot-fx-banner.show { animation: none; opacity: 1; transform: translate(-50%, -50%) scale(1); }
}
