/* ==========================================================================
   PlayLab 인게임 모션 팩 — 6종 미니게임 내부 화면 전체 애니메이션
   ========================================================================== */

@keyframes mPopIn { 0% { opacity: 0; transform: scale(0.4) rotate(-8deg); } 70% { opacity: 1; transform: scale(1.12) rotate(2deg); } 100% { opacity: 1; transform: scale(1) rotate(0); } }
@keyframes mSlideUp { from { opacity: 0; transform: translateY(26px); } to { opacity: 1; transform: translateY(0); } }
@keyframes mSlideLeft { from { opacity: 0; transform: translateX(-34px); } to { opacity: 1; transform: translateX(0); } }
@keyframes mFlipIn { from { opacity: 0; transform: perspective(600px) rotateX(-75deg); } to { opacity: 1; transform: perspective(600px) rotateX(0); } }
@keyframes mFloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes mBounce { 0%, 100% { transform: translateY(0) scale(1); } 30% { transform: translateY(-14px) scale(1.12); } 55% { transform: translateY(0) scale(0.94); } 75% { transform: translateY(-5px) scale(1.03); } }
@keyframes mWiggle { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-9deg); } 75% { transform: rotate(9deg); } }
@keyframes mGlowPulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.55); } 50% { box-shadow: 0 0 0 18px rgba(16, 185, 129, 0); } }
@keyframes mBreath { 0%, 100% { transform: scale(1); filter: brightness(1); } 50% { transform: scale(1.015); filter: brightness(1.12); } }
@keyframes mShine { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }
@keyframes mStatGrow { from { width: 0; } }
@keyframes mStamp { 0% { opacity: 0; transform: scale(2.6) rotate(-14deg); } 60% { opacity: 1; transform: scale(0.92) rotate(3deg); } 100% { opacity: 1; transform: scale(1) rotate(0); } }
@keyframes mSpinIn { from { opacity: 0; transform: rotate(-200deg) scale(0.3); } to { opacity: 1; transform: rotate(0) scale(1); } }
@keyframes mTickPulse { 0% { transform: scale(1); } 40% { transform: scale(1.28); color: #f59e0b; } 100% { transform: scale(1); } }
@keyframes mRingOut { 0% { transform: scale(0.6); opacity: 0.9; } 100% { transform: scale(2.2); opacity: 0; } }

/* ---------- 공통 스테이지 ---------- */
.stage-header { animation: mSlideUp 0.4s cubic-bezier(0.22, 1, 0.36, 1) both; }
.stage-eyebrow { animation: mPopIn 0.45s 0.05s cubic-bezier(0.34, 1.56, 0.64, 1) both; }
.stage-title { animation: mSlideUp 0.45s 0.1s cubic-bezier(0.22, 1, 0.36, 1) both; }
.hud-box { animation: mPopIn 0.42s cubic-bezier(0.34, 1.56, 0.64, 1) both; }
.hud-box:nth-child(2) { animation-delay: 0.06s; }
.hud-box:nth-child(3) { animation-delay: 0.12s; }
.hud-value.bump { animation: mTickPulse 0.35s ease; }
.hud-value.danger { animation: mWiggle 0.5s ease infinite; }
.timer-fill.low { background-size: 200% 100%; animation: mShine 0.8s linear infinite; background-image: linear-gradient(90deg, #ef4444, #f97316, #ef4444); }
.back-btn:hover { transform: translateX(-3px); }
.step-dot.active { animation: mBreath 1.6s ease-in-out infinite; }

/* ---------- 1번 색감 타일 ---------- */
.color-tile { animation: mPopIn 0.32s cubic-bezier(0.34, 1.56, 0.64, 1) both; transition: transform 0.12s ease, filter 0.12s ease; }
.color-tile:hover { transform: scale(1.06); filter: brightness(1.08); }
.color-tile:nth-child(3n) { animation-delay: 0.03s; }
.color-tile:nth-child(3n+1) { animation-delay: 0.06s; }
.color-tile:nth-child(4n) { animation-delay: 0.09s; }

/* ---------- 1번 반응속도 패드 ---------- */
.reaction-pad { position: relative; overflow: hidden; animation: mSlideUp 0.4s ease both; }
.reaction-pad.state-wait { animation: mBreath 1.4s ease-in-out infinite; }
.reaction-pad.state-wait .reaction-icon { animation: mWiggle 1s ease-in-out infinite; display: inline-block; }
.reaction-pad.state-go { animation: mGlowPulse 0.7s ease-out infinite; }
.reaction-pad.state-go .reaction-icon { animation: mBounce 0.5s ease infinite; display: inline-block; }
.reaction-pad.state-go::after { content: ''; position: absolute; left: 50%; top: 50%; width: 160px; height: 160px; margin: -80px 0 0 -80px; border-radius: 50%; border: 4px solid rgba(255,255,255,0.7); animation: mRingOut 0.8s ease-out infinite; pointer-events: none; }
.reaction-pad.state-early { animation: shakeX 0.35s ease 2; }
.reaction-pad.state-result .reaction-big { animation: mStamp 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) both; }
.trial-chip.filled { animation: mPopIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both; }

/* ---------- 1번 기억력 셀 ---------- */
.memory-cell { animation: mFlipIn 0.38s cubic-bezier(0.22, 1, 0.36, 1) both; }
.memory-cell:nth-child(2n) { animation-delay: 0.04s; }
.memory-cell:nth-child(3n) { animation-delay: 0.08s; }
.memory-cell:nth-child(5n) { animation-delay: 0.12s; }
.memory-cell.lit { animation: mBounce 0.5s ease both; }
.memory-cell.correct { animation: mStamp 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) both; }
.memory-cell.wrong { animation: shakeX 0.3s ease 2; }
.memory-status-banner { animation: mSlideLeft 0.35s ease both; }

/* ---------- 라운드 전환 ---------- */
.transition-emoji { animation: mSpinIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) both, mFloat 2.2s 0.6s ease-in-out infinite; }
.transition-score { animation: mStamp 0.5s 0.25s cubic-bezier(0.34, 1.56, 0.64, 1) both; }

/* ---------- 2번 서울 생존 ---------- */
.stage-art-banner { animation: mSlideUp 0.5s ease both; }
.house-card { animation: mSlideLeft 0.45s cubic-bezier(0.22, 1, 0.36, 1) both; }
.house-card:nth-child(2) { animation-delay: 0.1s; }
.house-card:nth-child(3) { animation-delay: 0.2s; }
.house-card:hover .house-icon { animation: mBounce 0.6s ease; }
.surv-month-bar { animation: mFlipIn 0.45s ease both; background-size: 200% 100%; }
.surv-stat-card { animation: mPopIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both; }
.surv-stat-card:nth-child(2) { animation-delay: 0.05s; }
.surv-stat-card:nth-child(3) { animation-delay: 0.1s; }
.surv-stat-card:nth-child(4) { animation-delay: 0.15s; }
.surv-stat-val.danger { animation: mWiggle 0.6s ease infinite; display: inline-block; }
.surv-event-box { animation: mFlipIn 0.5s cubic-bezier(0.22, 1, 0.36, 1) both; }
.surv-event-emoji { animation: mBounce 0.8s 0.2s ease both, mFloat 2.4s 1s ease-in-out infinite; display: inline-block; }
.surv-event-tag { animation: mPopIn 0.4s 0.15s cubic-bezier(0.34, 1.56, 0.64, 1) both; }
.surv-choice-btn { animation: mSlideUp 0.42s cubic-bezier(0.22, 1, 0.36, 1) both; }
.surv-choice-btn:nth-child(1) { animation-delay: 0.18s; }
.surv-choice-btn:nth-child(2) { animation-delay: 0.28s; }
.surv-choice-btn:nth-child(3) { animation-delay: 0.38s; }
.surv-choice-btn:hover { transform: translateX(6px); }
.surv-outcome-box { animation: mStamp 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) both; }
.delta-pill { animation: mPopIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both; }
.delta-pill:nth-child(2) { animation-delay: 0.08s; }
.delta-pill:nth-child(3) { animation-delay: 0.16s; }
.delta-pill:nth-child(4) { animation-delay: 0.24s; }
.surv-buff-chip { animation: mBreath 1.4s ease-in-out infinite; }
.codex-item:not(.locked) { animation: mPopIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both; }

/* ---------- 3번 피부·추구미 ---------- */
.beauty-q-card { animation: mFlipIn 0.45s cubic-bezier(0.22, 1, 0.36, 1) both; }
.beauty-opt-btn { animation: mSlideLeft 0.4s cubic-bezier(0.22, 1, 0.36, 1) both; }
.beauty-opt-btn:nth-child(1) { animation-delay: 0.1s; }
.beauty-opt-btn:nth-child(2) { animation-delay: 0.18s; }
.beauty-opt-btn:nth-child(3) { animation-delay: 0.26s; }
.beauty-opt-btn:nth-child(4) { animation-delay: 0.34s; }
.beauty-opt-btn:hover .beauty-opt-emoji { animation: mBounce 0.55s ease; }
.beauty-progress-fill { background-size: 200% 100%; background-image: linear-gradient(90deg, #db2777, #f472b6, #db2777); animation: mShine 1.6s linear infinite; }
.beauty-ing-tag { animation: mPopIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both; }
.beauty-ing-tag:nth-child(2) { animation-delay: 0.08s; }
.beauty-ing-tag:nth-child(3) { animation-delay: 0.16s; }
.beauty-ing-tag:nth-child(4) { animation-delay: 0.24s; }
.beauty-routine-card, .beauty-curation-box { animation: mSlideUp 0.5s 0.2s ease both; }

/* ---------- 4번 2027 연봉 ---------- */
.money-live-card { animation: mFlipIn 0.5s ease both; position: relative; overflow: hidden; }
.money-live-card::after { content: ''; position: absolute; inset: 0; background: linear-gradient(110deg, transparent 30%, rgba(255,255,255,0.22) 50%, transparent 70%); background-size: 200% 100%; animation: mShine 2.6s linear infinite; pointer-events: none; }
.money-live-val.bump { animation: mTickPulse 0.3s ease; }
.check-chip.on { animation: mPopIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1); }
.mini-preset:hover, .check-chip:hover { transform: translateY(-2px); }
.deduct-cell { animation: mPopIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both; }
.deduct-cell:nth-child(2) { animation-delay: 0.07s; }
.deduct-cell:nth-child(3) { animation-delay: 0.14s; }
.deduct-cell:nth-child(4) { animation-delay: 0.21s; }
.subsidy-item { animation: mSlideLeft 0.42s cubic-bezier(0.22, 1, 0.36, 1) both; }
.subsidy-item:nth-child(2) { animation-delay: 0.1s; }
.subsidy-item:nth-child(3) { animation-delay: 0.2s; }
.subsidy-item:nth-child(4) { animation-delay: 0.3s; }
.subsidy-item:nth-child(5) { animation-delay: 0.4s; }
.subsidy-item:nth-child(6) { animation-delay: 0.5s; }
.subsidy-icon { animation: mFloat 2s ease-in-out infinite; display: inline-block; }

/* ---------- 5번 룰렛·폭탄 ---------- */
.wheel-stage { animation: mSpinIn 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) both; }
.wheel-pointer { animation: mBounce 1s ease-in-out infinite; display: inline-block; }
.wheel-winner-banner { animation: mStamp 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both; }
.wheel-tag-chip { animation: mPopIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) both; }
.bomb-visual { animation: mFloat 1.8s ease-in-out infinite; }
.bomb-arena.exploded .bomb-visual { animation: mStamp 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both; }
.year-pill.active { animation: mPopIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1); }

/* ---------- 결과 화면 공통 ---------- */
.result-rank-pill { animation: mStamp 0.55s cubic-bezier(0.34, 1.56, 0.64, 1) both; }
.result-art-frame { animation: mSpinIn 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) both, mFloat 3s 0.7s ease-in-out infinite; }
.result-age-big { animation: mPopIn 0.6s 0.15s cubic-bezier(0.34, 1.56, 0.64, 1) both; }
.result-persona { animation: mSlideUp 0.45s 0.3s ease both; }
.result-comment { animation: mSlideUp 0.45s 0.4s ease both; }
.stat-item { animation: mSlideLeft 0.45s cubic-bezier(0.22, 1, 0.36, 1) both; }
.stat-item:nth-child(1) { animation-delay: 0.45s; }
.stat-item:nth-child(2) { animation-delay: 0.55s; }
.stat-item:nth-child(3) { animation-delay: 0.65s; }
.stat-fill { animation: mStatGrow 1.1s 0.6s cubic-bezier(0.22, 1, 0.36, 1) both; }
.card-preview-wrap { animation: mSlideUp 0.5s 0.6s ease both; }
#resultCanvas { transition: transform 0.3s ease; }
#resultCanvas:hover { transform: rotate(-1.5deg) scale(1.02); }
.result-actions .btn { animation: mSlideUp 0.4s ease both; }
.result-actions .btn:nth-child(1) { animation-delay: 0.7s; }
.result-actions .btn:nth-child(2) { animation-delay: 0.8s; }
.result-actions .btn-emerald { position: relative; overflow: hidden; }
.result-actions .btn-emerald::after { content: ''; position: absolute; inset: 0; background: linear-gradient(110deg, transparent 30%, rgba(255,255,255,0.35) 50%, transparent 70%); background-size: 200% 100%; animation: mShine 2.2s linear infinite; }
.challenge-verdict { animation: mStamp 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) both; }
.challenge-verdict.win strong { animation: mBounce 0.9s 0.6s ease 2; display: inline-block; }
.next-reco-card { animation: mSlideUp 0.45s ease both; }
.next-reco-card:nth-child(2) { animation-delay: 0.1s; }
.next-reco-card:hover img { transform: scale(1.08); }
.next-reco-card img { transition: transform 0.4s ease; }

/* ---------- 6번 3D 스택 HUD ---------- */
.stack3d-score-num.bump { animation: mTickPulse 0.3s ease; }
.stack3d-start-overlay h3 { animation: mSlideUp 0.5s ease both; }
.stack3d-start-overlay .btn { animation: mBreath 1.3s ease-in-out infinite; }
.skin-chip { animation: mPopIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) both; }
.skin-chip:nth-child(2) { animation-delay: 0.05s; }
.skin-chip:nth-child(3) { animation-delay: 0.1s; }
.skin-chip:nth-child(4) { animation-delay: 0.15s; }
.skin-chip.active { animation: mBreath 1.5s ease-in-out infinite; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}


/* ==========================================================================
   홈 하단 3D 업그레이드 — 감각 미니게임 카드 · 전체 목록 · 기록 바 · 가이드
   ========================================================================== */
@keyframes m3dSpin { from { transform: translateZ(40px) rotateY(0deg); } to { transform: translateZ(40px) rotateY(360deg); } }
@keyframes m3dBob { 0%, 100% { transform: translateZ(36px) translateY(0) rotateX(8deg); } 50% { transform: translateZ(48px) translateY(-8px) rotateX(-6deg); } }
@keyframes m3dReveal { from { opacity: 0; transform: perspective(900px) rotateX(38deg) translateY(50px) scale(0.92); } to { opacity: 1; transform: perspective(900px) rotateX(0) translateY(0) scale(1); } }
@keyframes m3dHolo { 0% { background-position: 0% 50%; } 100% { background-position: 200% 50%; } }
@keyframes m3dShadowPulse { 0%, 100% { transform: translateX(-50%) scale(1); opacity: 0.35; } 50% { transform: translateX(-50%) scale(0.75); opacity: 0.18; } }

.quick-grid, .hub-grid, .guide-grid { perspective: 1100px; }

/* 스크롤 3D 등장 */
.reveal-3d { opacity: 0; }
.reveal-3d.in-view { animation: m3dReveal 0.75s cubic-bezier(0.22, 1, 0.36, 1) both; }
.reveal-3d.in-view:nth-child(2) { animation-delay: 0.1s; }
.reveal-3d.in-view:nth-child(3) { animation-delay: 0.2s; }
.reveal-3d.in-view:nth-child(4) { animation-delay: 0.3s; }
.reveal-3d.in-view:nth-child(5) { animation-delay: 0.4s; }
.reveal-3d.in-view:nth-child(6) { animation-delay: 0.5s; }

/* 공통 3D 틸트 카드 */
.tilt-3d {
  position: relative;
  transform-style: preserve-3d;
  will-change: transform;
  transition: transform 0.18s ease-out, box-shadow 0.25s ease;
}
.tilt-3d .tilt-glare {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s ease;
  mix-blend-mode: soft-light;
  z-index: 3;
}
.tilt-3d:hover { box-shadow: 0 26px 50px rgba(79, 70, 229, 0.22); }

/* 감각 미니게임 카드 → 3D 네온 큐브 카드 */
.quick-card {
  overflow: visible;
  border: 1.5px solid transparent;
  background:
    linear-gradient(#ffffff, #ffffff) padding-box,
    linear-gradient(120deg, #6366f1, #ec4899, #10b981, #f59e0b, #6366f1) border-box;
  background-size: 100% 100%, 200% 100%;
  animation: m3dHolo 4s linear infinite;
  min-height: 210px;
}
.quick-card > * { transform: translateZ(18px); }
.quick-card .quick-emoji {
  width: 66px;
  height: 66px;
  font-size: 34px;
  border-radius: 20px;
  position: relative;
  transform-style: preserve-3d;
  box-shadow: 0 14px 26px rgba(79, 70, 229, 0.28), inset 0 2px 0 rgba(255, 255, 255, 0.7);
  animation: m3dBob 2.6s ease-in-out infinite;
}
.quick-card .quick-emoji.eye { background: linear-gradient(145deg, #e0e7ff, #818cf8); }
.quick-card .quick-emoji.reflex { background: linear-gradient(145deg, #d1fae5, #34d399); animation-delay: -0.8s; }
.quick-card .quick-emoji.memory { background: linear-gradient(145deg, #ffe4e6, #fb7185); animation-delay: -1.6s; }
.quick-card .quick-emoji::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: -18px;
  width: 46px;
  height: 8px;
  border-radius: 50%;
  background: rgba(22, 26, 45, 0.35);
  filter: blur(4px);
  animation: m3dShadowPulse 2.6s ease-in-out infinite;
  transform: translateX(-50%);
}
.quick-card:hover .quick-emoji { animation: m3dSpin 1.1s cubic-bezier(0.34, 1.2, 0.64, 1) infinite; }
.quick-card .quick-name { font-size: 18px; }
.quick-card .quick-meta {
  display: inline-flex;
  align-self: flex-start;
  background: linear-gradient(135deg, #4f46e5, #ec4899);
  color: #ffffff;
  padding: 8px 14px;
  border-radius: 12px;
  box-shadow: 0 8px 18px rgba(236, 72, 153, 0.3);
  transform: translateZ(34px);
}
.quick-card:hover .quick-meta { animation: mBounce 0.7s ease; }

/* 전체 놀이터 목록 → 3D 홀로그램 카드 */
.hub-card { overflow: visible; }
.hub-card > * { transform: translateZ(14px); }
.hub-card .hub-order-icon {
  width: 58px;
  height: 58px;
  font-size: 30px;
  transform-style: preserve-3d;
  box-shadow: 0 12px 22px rgba(22, 26, 45, 0.18), inset 0 2px 0 rgba(255, 255, 255, 0.7);
  animation: m3dBob 3s ease-in-out infinite;
}
.hub-card:nth-child(2) .hub-order-icon { animation-delay: -0.5s; }
.hub-card:nth-child(3) .hub-order-icon { animation-delay: -1s; }
.hub-card:nth-child(4) .hub-order-icon { animation-delay: -1.5s; }
.hub-card:nth-child(5) .hub-order-icon { animation-delay: -2s; }
.hub-card:nth-child(6) .hub-order-icon { animation-delay: -2.5s; }
.hub-card:hover .hub-order-icon { animation: m3dSpin 1.1s cubic-bezier(0.34, 1.2, 0.64, 1) infinite; }
.hub-card.is-live .hub-status-pill {
  background: linear-gradient(90deg, #4f46e5, #ec4899, #4f46e5);
  background-size: 200% 100%;
  animation: m3dHolo 2.5s linear infinite;
}
.hub-card::after {
  content: '▶ PLAY';
  position: absolute;
  right: 14px;
  bottom: 12px;
  font-size: 11px;
  font-weight: 900;
  color: #4f46e5;
  opacity: 0;
  transform: translateZ(30px) translateX(-8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.hub-card:hover::after { opacity: 1; transform: translateZ(30px) translateX(0); }

/* 기록 바 3D 트로피 */
.best-record-bar { transform-style: preserve-3d; }
.best-badge-icon {
  font-size: 26px;
  background: linear-gradient(145deg, #fef3c7, #fbbf24);
  box-shadow: 0 10px 20px rgba(245, 158, 11, 0.3), inset 0 2px 0 rgba(255, 255, 255, 0.7);
  animation: m3dBob 2.4s ease-in-out infinite;
}
.metric-chip { transition: transform 0.2s ease; }
.metric-chip:hover { transform: translateY(-3px) scale(1.06); }

/* 가이드 박스 3D */
.guide-box { transition: transform 0.18s ease-out, box-shadow 0.25s ease; }
.faq-item { transition: transform 0.2s ease, box-shadow 0.2s ease; }
.faq-item:hover { transform: translateX(6px); box-shadow: -6px 0 0 #4f46e5; }
.faq-item[open] { animation: mFlipIn 0.35s ease; }

@media (hover: none) {
  .quick-card .quick-emoji { animation: m3dSpin 3.5s linear infinite; }
}
