/* 카드 섞기 · 카드 공개 연출 — 사용자 점 보기 · 관리자 타로점 · 타로리더 작업실 공용(2026-11-06 운영자).
   동작은 static/js/card_fx.js(window.CardFx). 이 파일은 세 화면 모두 부른다(관리자는 style.css 없이 이 파일만으로 완성).
   색은 고정값(밤하늘 무대·금빛) — 화면 테마와 무관하다. */

/* 섞기 전 덱(관리자·작업실 랜덤 선택) — 상자 가운데 한 덱, 섞을 때 사방으로 펼쳤다가 가운데로 모인다 */
.cfx-deck{position:relative;height:300px;margin:8px 0 6px;overflow:hidden;border-radius:14px;
  background:radial-gradient(ellipse at 50% 60%,#2b2258 0%,#160f34 60%,#0d0922 100%);box-shadow:inset 0 0 0 1px rgba(227,193,118,.25)}
.cfx-card{position:absolute;left:50%;top:58%;width:84px;height:140px;margin:-70px 0 0 -42px;border-radius:9px;overflow:hidden;
  box-shadow:0 4px 12px rgba(0,0,0,.45);border:1px solid rgba(227,193,118,.35);will-change:transform;user-select:none}
.cfx-card img{width:100%;height:100%;object-fit:cover;display:block;pointer-events:none}
.cfx-bar{display:flex;flex-direction:column;align-items:center;gap:6px;margin:4px 0 10px;text-align:center}
.cfx-go{display:inline-flex;align-items:center;gap:.5em;padding:.7em 1.9em;font-size:1rem;font-weight:700;color:#2a1d05;border:0;border-radius:999px;cursor:pointer;
  background:linear-gradient(135deg,#e3a94a,#f6cf6a 45%,#fff2c4 55%,#e3a94a);box-shadow:0 0 0 1px #fff2c4 inset,0 0 26px rgba(255,190,80,.35)}
.cfx-go:disabled{opacity:.6;cursor:default}
.cfx-note{margin:0;font-size:.85rem;opacity:.8}
/* 섞은 뒤 고르는 카드 — 한 장씩 차례로 깔린다 */
.cfx-dealt > *{animation:cfxDeal .45s cubic-bezier(.2,.9,.25,1.05) both;animation-delay:calc(var(--d,0) * 8ms)}
@keyframes cfxDeal{from{opacity:0;transform:translateY(-14px) scale(.9)}to{opacity:1;transform:none}}
@media (max-width:640px){.cfx-deck{height:240px}.cfx-card{width:64px;height:107px;margin:-53px 0 0 -32px}}
@media (prefers-reduced-motion:reduce){.cfx-dealt > *{animation:none}}

/* 카드 공개 연출(.rc-*) — 2026-11-05 사용자 화면에서 시작, 2026-11-06 세 화면 공용 */
.rc-card.is-up .rc-dir{color:#1d1636}
.rc-ov{position:fixed;inset:0;z-index:2000;display:flex;align-items:center;justify-content:center;opacity:0;transition:opacity .4s;overflow:hidden;
  background:radial-gradient(ellipse at 50% 45%,rgba(60,36,120,.97),rgba(8,4,20,.995) 70%)}
.rc-ov.in{opacity:1}.rc-ov.out{opacity:0;transition-duration:.9s}
.rc-stage{position:relative;width:min(960px,100%);height:min(640px,92vh);display:flex;flex-direction:column;align-items:center;justify-content:center;overflow:visible}
.rc-rays{position:absolute;left:50%;top:46%;width:170vmax;aspect-ratio:1;transform:translate(-50%,-50%);opacity:0;transition:opacity .6s;mix-blend-mode:screen;pointer-events:none;
  background:repeating-conic-gradient(from 0deg,rgba(255,220,140,0) 0deg,rgba(255,220,140,.28) 4deg,rgba(255,220,140,0) 9deg,rgba(255,220,140,0) 18deg);
  -webkit-mask:radial-gradient(circle,#000 6%,transparent 42%);mask:radial-gradient(circle,#000 6%,transparent 42%);animation:rcSpin 9s linear infinite}
.rc-ring{position:absolute;left:50%;top:46%;width:min(560px,92vw);transform:translate(-50%,-50%) scale(.6);opacity:0;transition:opacity .6s,transform .9s;pointer-events:none;overflow:visible}
.rc-ring circle{fill:none;stroke:rgba(255,214,130,.7);stroke-width:.8}
.rc-ring text{fill:rgba(255,226,160,.92);font:600 9px serif;text-anchor:middle}
.rc-runes{transform-origin:100px 100px;animation:rcSpinR 14s linear infinite}
.rc-count{position:absolute;top:6%;left:0;right:0;text-align:center;font:600 clamp(2.4rem,8vw,4.2rem)/1 serif;color:#fff2c4;letter-spacing:.08em;
  text-shadow:0 0 18px rgba(255,206,110,.8),0 0 42px rgba(255,190,80,.4);pointer-events:none}
.rc-count.pop{animation:rcPop 1.2s ease-out}
.rc-cards{position:relative;z-index:3;display:flex;gap:clamp(14px,3.2vw,34px);justify-content:center;perspective:1400px}
.rc-card{width:clamp(78px,17vw,150px);display:flex;flex-direction:column;align-items:center;gap:8px;animation:rcIn .7s cubic-bezier(.2,.9,.25,1.1) both;animation-delay:calc(var(--i) * .12s)}
.rc-in{position:relative;width:100%;aspect-ratio:3/5;transform-style:preserve-3d;transition:transform .9s cubic-bezier(.2,.8,.2,1)}
.rc-face{position:absolute;inset:0;border-radius:10px;overflow:hidden;backface-visibility:hidden;-webkit-backface-visibility:hidden;
  box-shadow:0 0 0 2px rgba(246,207,106,.7),0 14px 34px rgba(0,0,0,.55)}
.rc-rot{position:relative;width:100%;transform-style:preserve-3d}
.rc-stage.open .rc-card.is-up .rc-rot{animation:rcTurnUp 1.6s cubic-bezier(.3,.7,.3,1) both;animation-delay:calc(1.6s + var(--i) * .4s)}
.rc-stage.open .rc-card.is-rev .rc-rot{animation:rcTurnRev 2s cubic-bezier(.3,.7,.3,1) both;animation-delay:calc(1.6s + var(--i) * .4s)}
.rc-dir{min-height:1.5em;padding:.15em .9em;border-radius:999px;font-size:clamp(.82rem,1.8vw,1rem);font-weight:700;letter-spacing:.04em;opacity:0}
.rc-dir:empty{visibility:hidden}
.rc-card.is-up .rc-dir{color:#1d1636;background:#f6cf6a}
.rc-card.is-rev .rc-dir{color:#fff;background:#d6455d}
.rc-stage.open .rc-dir{animation:rcDirIn .5s ease-out both;animation-delay:calc(3.4s + var(--i) * .4s)}
.rc-face img{width:100%;height:100%;object-fit:cover;display:block}
.rc-front{transform:rotateY(180deg)}
.rc-lbl{font-size:.85rem;font-weight:700;color:#f6cf6a;letter-spacing:.06em}
.rc-cap{position:relative;z-index:4;margin:26px 0 0;padding:.5em 1.2em;border-radius:999px;background:rgba(10,6,22,.72);border:1px solid rgba(255,214,140,.4);
  color:#fff2c4;font-size:clamp(.85rem,2.6vw,1rem);text-align:center;min-height:1.6em}
.rc-flash{position:absolute;inset:0;z-index:5;opacity:0;pointer-events:none;background:radial-gradient(circle at 50% 46%,#fff 0%,rgba(255,240,200,.9) 25%,rgba(255,220,150,0) 70%)}
.rc-fx{position:absolute;inset:0;width:100%;height:100%;z-index:4;pointer-events:none}
.rc-skip{position:absolute;right:14px;bottom:14px;z-index:7;background:rgba(255,255,255,.1);color:#fff2c4;border:1px solid rgba(255,214,140,.4);border-radius:999px;padding:.4em 1.1em;cursor:pointer;font-size:.85rem}
/* 단계마다 세짐 */
.rc-stage[data-phase="1"] .rc-rays,.rc-stage[data-phase="2"] .rc-rays{opacity:.4}
.rc-stage[data-phase="3"] .rc-rays{opacity:.65;animation-duration:4s}
.rc-stage[data-phase="4"] .rc-rays{opacity:.85;animation-duration:2.2s}
.rc-stage[data-phase="5"] .rc-rays{opacity:1;animation-duration:1.1s}
.rc-stage:not([data-phase="0"]) .rc-ring{opacity:.85;transform:translate(-50%,-50%) scale(1)}
.rc-stage[data-phase="4"] .rc-runes{animation-duration:6s}.rc-stage[data-phase="5"] .rc-runes{animation-duration:2.6s}
.rc-stage:not([data-phase="0"]) .rc-in{animation:rcShake .14s linear infinite;--amp:.5}
.rc-stage[data-phase="3"] .rc-in{--amp:1.4}.rc-stage[data-phase="4"] .rc-in{--amp:2.4}.rc-stage[data-phase="5"] .rc-in{--amp:3.6;animation-duration:.08s}
.rc-stage[data-phase="4"] .rc-face,.rc-stage[data-phase="5"] .rc-face{box-shadow:0 0 0 2px #fff2c4,0 0 34px rgba(255,206,110,.75)}
/* 초고속 회전 → 짠 */
.rc-stage.spin .rc-in{animation:rcCharge 1.6s ease-in forwards}
.rc-stage.spin .rc-rays{opacity:1;animation-duration:.3s}
.rc-stage.spin .rc-runes{animation-duration:.45s}
.rc-stage.open .rc-in{transform:rotateY(180deg);transition:none;animation:rcFlipOnce 1.5s cubic-bezier(.3,.8,.3,1.1) both}
.rc-stage.open .rc-front{animation:rcRim 1.6s ease-in-out infinite}
.rc-stage.flash .rc-flash{animation:rcFlash 1s ease-out}
.rc-stage.open{animation:rcQuake .55s cubic-bezier(.36,.07,.19,.97)}
@keyframes rcSpin{to{transform:translate(-50%,-50%) rotate(360deg)}}
@keyframes rcSpinR{to{transform:rotate(-360deg)}}
@keyframes rcIn{from{opacity:0;transform:translateY(60px) scale(.6) rotate(-8deg)}to{opacity:1;transform:none}}
@keyframes rcPop{0%{opacity:0;transform:scale(1.9);filter:blur(4px)}25%{opacity:1;transform:scale(1);filter:none}100%{opacity:.2;transform:scale(.92)}}
@keyframes rcShake{0%{transform:translate(calc(var(--amp)*1px),0) rotate(calc(var(--amp)*.3deg))}25%{transform:translate(calc(var(--amp)*-1px),calc(var(--amp)*.6px)) rotate(calc(var(--amp)*-.3deg))}
  50%{transform:translate(calc(var(--amp)*.6px),calc(var(--amp)*-1px))}75%{transform:translate(calc(var(--amp)*-.6px),calc(var(--amp)*.4px))}100%{transform:translate(calc(var(--amp)*1px),0)}}
@keyframes rcCharge{0%{transform:scale(1)}70%{transform:scale(1.06) translateY(-6px)}100%{transform:scale(1.08) translateY(-8px)}}
@keyframes rcFlipOnce{0%{transform:rotateY(0) scale(1.08)}60%{transform:rotateY(180deg) scale(1.14)}100%{transform:rotateY(180deg) scale(1)}}
@keyframes rcRim{0%,100%{box-shadow:0 0 0 2px #f6cf6a,0 0 26px 6px rgba(255,206,110,.75),0 0 80px 18px rgba(255,190,80,.32)}50%{box-shadow:0 0 0 3px #fff2c4,0 0 40px 12px rgba(255,206,110,.85),0 0 120px 34px rgba(255,190,80,.4)}}
@keyframes rcTurnUp{0%{transform:rotate(0)}100%{transform:rotate(360deg)}}
@keyframes rcTurnRev{0%{transform:rotate(0)}100%{transform:rotate(540deg)}}
@keyframes rcDirIn{0%{opacity:0;transform:translateY(8px) scale(.6)}100%{opacity:1;transform:none}}
@keyframes rcFlash{0%{opacity:0}10%{opacity:1}35%{opacity:.85}100%{opacity:0}}
@keyframes rcQuake{10%,90%{transform:translate(-2px,1px)}20%,80%{transform:translate(5px,-2px)}30%,50%,70%{transform:translate(-8px,3px)}40%,60%{transform:translate(8px,-3px)}}
/* 공개 불꽃 캔버스(CardFx.ignite·blast) — 화면 위 한 장, 누르기를 막지 않는다. 공개 무대(.rc-ov 2000)보다 위 */
.cfx-layer{position:fixed;left:0;top:0;width:100vw;height:100vh;z-index:2100;pointer-events:none}
@media (prefers-reduced-motion:reduce){.rc-ov{display:none}.cfx-layer{display:none}}
