/* ═══════════════════════════════════════════════════════════════════
   Animal Totem Mystic CSS  —  완전 재작성 v4
    카드 flip 레이아웃 완전 수정 (잘림 현상 해소)
    동물별 컬러 테마 CSS 변수 (--card-glow, --card-primary, --card-particle)
    Tailwind-compatible utility + 순수 CSS 하이브리드
   ═══════════════════════════════════════════════════════════════════ */

/*  CSS 변수  */
.animal-totem-overlay {
  --at-indigo:  #0f0d2a;
  --at-violet:  #1e1550;
  --at-forest:  #1a2e12;
  --at-earth:   #3d2914;
  --at-beige:   #e8dcc8;
  --at-moon:    #f5f0e6;
  --at-lav:     #b8a9c9;
  --at-lav-gl:  rgba(184,169,201,0.32);
  --at-fire:    rgba(200,255,180,0.85);
  --at-radius:  16px;
  --at-radius-lg: 22px;
  --at-pill:    999px;
  --card-glow:    rgba(184,169,201,0.45);
  --card-primary: #5c4033;
  --card-particle: rgba(245,240,230,0.98);
}

/*  포인터 이벤트 보장  */
.tarot-tile--animal-totem,
[data-action="openAnimalTotemModal"] {
  position: relative;
  z-index: 10;
  cursor: pointer;
  pointer-events: auto !important;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.feat-collection--animal .feat-collection__grid,
.feat-collection--animal .tarot-tile--animal-totem {
  position: relative;
  z-index: 5;
  isolation: isolate;
}

/*  오버레이  */
.animal-totem-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: none;
  width: 100%;
  min-width: 100%;
  height: 100dvh;
  max-height: 100dvh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  touch-action: pan-y;
  background:
    radial-gradient(ellipse 100% 70% at 80% 12%, var(--at-lav-gl), transparent 48%),
    radial-gradient(ellipse 90% 60% at 8%  90%, rgba(45,80,22,0.25), transparent 46%),
    linear-gradient(165deg, #111b0d 0%, #1e2a18 35%, #1c2118 68%, #151310 100%);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.animal-totem-overlay.is-open { display: block; }
body.animal-totem-modal-open .lang-toggle-wrap {
  visibility: hidden;
  pointer-events: none;
  z-index: -1;
}
.animal-totem-overlay::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: radial-gradient(rgba(255,255,255,0.28) 0.5px, transparent 0.5px);
  background-size: 28px 28px;
  opacity: 0.07;
}
.animal-totem-overlay::after {
  content: "";
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: 20%;
  pointer-events: none;
  background: linear-gradient(to top, rgba(12,15,10,0.5), transparent);
}

/*  셸 & 패널  */
.animal-totem-shell {
  position: relative;
  max-width: 1020px;
  margin: 36px auto;
  min-height: 100%;
  padding: 0 16px max(24px, env(safe-area-inset-bottom, 0px));
}
.animal-totem-overlay.is-result-view .animal-totem-shell {
  max-width: 680px;
}
.animal-totem-panel {
  position: relative;
  border: 1px solid rgba(232,220,200,0.16);
  border-radius: var(--at-radius-lg);
  background: linear-gradient(165deg,
    rgba(45,80,22,0.07),
    rgba(92,64,51,0.05),
    rgba(232,220,200,0.03));
  box-shadow: 0 20px 50px rgba(10,15,8,0.48), inset 0 1px 0 rgba(255,255,255,0.04);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  padding: 20px;
}

/*  닫기 버튼  */
.animal-totem-close {
  position: absolute;
  top: 12px; right: 12px;
  width: 48px; height: 48px;
  min-width: 48px; min-height: 48px;
  border-radius: var(--at-pill);
  border: 1px solid rgba(232,220,200,0.28);
  background: rgba(30,50,20,0.22);
  color: var(--at-moon);
  font-size: 1.5rem;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  z-index: 2;
  transition: background 0.2s, transform 0.15s;
}
.animal-totem-close:hover, .animal-totem-close:focus {
  background: rgba(92,64,51,0.38);
}
.animal-totem-close:active { transform: scale(0.92); }

/*  스테이지 시스템  */
.animal-totem-stage { display: none; }
.animal-totem-stage.is-active {
  display: block;
  animation: atFadeUp 0.38s ease;
}
@keyframes atFadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ═══ 인트로 ═══ */
.totem-intro-hero {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(232,220,200,0.18);
  border-radius: var(--at-radius-lg);
  padding: 26px 22px 28px;
  background:
    radial-gradient(circle at 78% 18%, var(--at-lav-gl), transparent 30%),
    radial-gradient(circle at 12% 92%, rgba(45,80,22,0.26), transparent 34%),
    linear-gradient(162deg, rgba(232,220,200,0.07), rgba(45,80,22,0.04));
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.04), 0 14px 36px rgba(10,16,8,0.36);
}
.totem-intro-hero::before {
  content: "";
  position: absolute;
  width: 110px; height: 110px;
  right: 18px; top: 14px;
  border-radius: 50%;
  background: radial-gradient(circle at 42% 38%, rgba(245,240,230,0.58), rgba(184,169,201,0.18) 55%, transparent 72%);
  opacity: 0.88;
  pointer-events: none;
}
.totem-intro-title {
  position: relative; z-index: 1;
  display: block;
  color: var(--at-moon);
  font-family: "Cinzel", Georgia, serif;
  font-size: 1.1rem; font-weight: 700; letter-spacing: 0.16em;
  text-shadow: 0 0 20px var(--at-lav-gl), 0 0 40px rgba(184,169,201,0.12);
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(232,220,200,0.14);
  margin-bottom: 8px;
}
.totem-intro-subtitle {
  position: relative; z-index: 1;
  margin-top: 8px;
  color: var(--at-beige);
  font-size: 0.94rem;
  line-height: 1.78;
  max-width: 85%;
}

/*  공통 버튼  */
.totem-btn {
  border: 0;
  border-radius: var(--at-radius);
  padding: 12px 18px;
  color: var(--at-moon);
  font-weight: 700;
  letter-spacing: 0.02em;
  background: linear-gradient(135deg, #2d5016 0%, #6b4423 100%);
  box-shadow: 0 4px 18px rgba(30,55,16,0.38), 0 0 0 1px rgba(245,240,230,0.1) inset;
  transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.totem-btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.07);
  box-shadow: 0 7px 22px rgba(30,55,16,0.48), 0 0 0 1px rgba(245,240,230,0.16) inset;
}
.totem-btn:active { transform: scale(0.97); }
.totem-btn:focus-visible { outline: 2px solid var(--at-lav); outline-offset: 2px; }
.totem-btn--invoke {
  position: relative;
  padding-left: 44px;
  text-transform: uppercase;
  font-size: 0.82rem;
  letter-spacing: 0.16em;
}
.totem-btn--invoke::before {
  content: "🌿";
  position: absolute;
  left: 15px; top: 50%;
  transform: translateY(-50%);
  font-size: 1rem;
}
.totem-btn--subtle {
  background: rgba(60,45,25,0.22);
  border: 1px solid rgba(232,220,200,0.32);
  color: var(--at-beige);
}
.totem-btn--spread {
  background: linear-gradient(135deg, #2d5016 0%, #6b4423 100%) !important;
  box-shadow: 0 4px 18px rgba(30,55,16,0.42), 0 0 0 1px rgba(245,240,230,0.14) inset !important;
  animation: at-spread-pulse 3.2s ease-in-out infinite;
}
@keyframes at-spread-pulse {
  0%,100% { box-shadow: 0 4px 18px rgba(30,55,16,0.42), 0 0 0 1px rgba(245,240,230,0.14) inset; }
  50%      { box-shadow: 0 6px 26px rgba(30,55,16,0.56), 0 0 0 1px rgba(245,240,230,0.22) inset; }
}

/*  별빛 캔버스  */
.totem-canvas-wrap {
  position: relative;
  height: 400px;
  margin-top: 16px;
  border-radius: var(--at-radius);
  overflow: hidden;
  border: 1px solid rgba(232,220,200,0.15);
  background:
    radial-gradient(circle at 80% 20%, var(--at-lav-gl), transparent 28%),
    radial-gradient(circle at 10% 86%, rgba(45,80,22,0.24), transparent 36%),
    linear-gradient(148deg, rgba(20,30,14,0.88), rgba(40,52,30,0.72));
  box-shadow: 0 14px 34px rgba(8,14,6,0.42);
}
.totem-canvas-wrap canvas { width: 100%; height: 100%; display: block; }
.totem-canvas-wrap::before {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(8,14,6,0.88) 0%, rgba(8,14,6,0.28) 36%, transparent 62%);
  pointer-events: none;
}
.totem-rune-field, .totem-animal-figures {
  position: absolute; inset: 0;
  pointer-events: none; overflow: hidden;
}
.totem-rune {
  position: absolute;
  color: rgba(232,220,200,0.48);
  font-size: 13px;
  text-shadow: 0 0 8px var(--at-lav-gl);
  animation: atRuneFloat linear infinite;
}
@keyframes atRuneFloat {
  from { transform: translateY(108%); opacity: 0; }
  18%  { opacity: 0.82; }
  to   { transform: translateY(-122%); opacity: 0; }
}
.totem-animal-figure {
  position: absolute;
  font-size: 20px;
  filter: drop-shadow(0 0 6px var(--at-fire)) drop-shadow(0 0 12px var(--at-lav-gl));
  opacity: 0.68;
  animation: atAnimalFloat linear infinite;
}
.totem-animal-figure--static { animation: none; opacity: 0.62; }
.totem-animal-figure--static.totem-animal-figure--tl { top: 12px; left: 14px; font-size: 24px; }
.totem-animal-figure--static.totem-animal-figure--tr { top: 12px; right: 14px; font-size: 24px; }
.totem-animal-figure--static.totem-animal-figure--bl { bottom: 14px; left: 14px; font-size: 22px; }
.totem-animal-figure--static.totem-animal-figure--br { bottom: 14px; right: 14px; font-size: 22px; }
.totem-animal-figure--static.totem-animal-figure--mt { top: 8px; left: 50%; transform: translateX(-50%); font-size: 20px; }
@keyframes atAnimalFloat {
  from { transform: translateY(108%) rotate(0deg); opacity: 0; }
  14%  { opacity: 0.78; }
  86%  { opacity: 0.68; }
  to   { transform: translateY(-122%) rotate(8deg); opacity: 0; }
}

/* ═══ 모드 선택 ═══ */
.totem-mode-stage.is-active {
  animation: atModeIn 0.5s cubic-bezier(0.34,1.56,0.64,1) forwards;
}
@keyframes atModeIn {
  from { opacity: 0; transform: translateY(14px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.totem-mode-header { text-align: center; margin-bottom: 20px; }
.totem-mode-badge {
  display: inline-block;
  padding: 5px 14px;
  border-radius: var(--at-pill);
  font-size: 0.7rem; font-weight: 700; letter-spacing: 0.18em;
  color: var(--at-beige);
  background: linear-gradient(135deg, rgba(45,80,22,0.36), rgba(92,64,51,0.28));
  border: 1px solid rgba(232,220,200,0.34);
  box-shadow: 0 0 18px var(--at-lav-gl);
  animation: atBadgeGlow 2.8s ease-in-out infinite;
}
@keyframes atBadgeGlow {
  0%,100% { box-shadow: 0 0 16px var(--at-lav-gl); }
  50%      { box-shadow: 0 0 28px rgba(184,169,201,0.38); }
}
.totem-mode-title { margin: 0 0 6px !important; color: var(--at-moon); }
.totem-mode-hint  { margin: 0; font-size: 0.85rem; color: var(--at-beige); opacity: 0.88; }
.totem-mode-grid { display: grid; gap: 14px; margin-top: 18px; }
.totem-mode-btn {
  position: relative;
  border-radius: var(--at-radius);
  border: 1px solid rgba(232,220,200,0.2);
  background: linear-gradient(148deg, rgba(40,68,24,0.12), rgba(74,53,32,0.08));
  color: var(--at-beige);
  text-align: left;
  padding: 18px 18px 18px 58px;
  min-height: 74px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  overflow: hidden;
  transition: transform 0.26s cubic-bezier(0.34,1.56,0.64,1), box-shadow 0.3s, border-color 0.26s;
}
.totem-mode-btn::before {
  content: "";
  position: absolute; inset: 0;
  border-radius: inherit;
  background: linear-gradient(135deg, var(--at-lav-gl), transparent 52%);
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}
.totem-mode-btn:hover            { transform: translateY(-3px); box-shadow: 0 12px 28px rgba(0,0,0,0.3); }
.totem-mode-btn:hover::before    { opacity: 1; }
.totem-mode-btn:active           { transform: scale(0.97); }
.totem-mode-btn.is-active {
  border-color: rgba(184,169,201,0.56);
  box-shadow: 0 0 0 1px rgba(184,169,201,0.34) inset, 0 0 22px var(--at-lav-gl);
  background: linear-gradient(148deg, rgba(40,68,24,0.22), rgba(74,53,32,0.18));
}
.totem-mode-btn.is-active::before { opacity: 1; }
.totem-mode-icon {
  position: absolute;
  left: 16px; top: 50%;
  transform: translateY(-50%);
  font-size: 1.9rem;
  filter: drop-shadow(0 0 7px var(--at-lav-gl));
  transition: transform 0.3s;
}
.totem-mode-btn.is-active .totem-mode-icon {
  transform: translateY(-50%) scale(1.12);
  animation: atIconFloat 2.2s ease-in-out infinite;
}
@keyframes atIconFloat {
  0%,100% { transform: translateY(-50%) scale(1.12); }
  50%      { transform: translateY(calc(-50% - 2px)) scale(1.15); }
}
.totem-mode-content b     { font-size: 1rem; display: block; margin-bottom: 2px; }
.totem-mode-content small { font-size: 0.8rem; opacity: 0.88; }
.totem-mode-actions { margin-top: 20px; }

/* ═══════════════════════════════════════════════════
   카드 뒤집기 스테이지
   ═══════════════════════════════════════════════════ */
.totem-draw-stage.is-active {
  animation: atDrawIn 0.45s cubic-bezier(0.34,1.56,0.64,1) forwards;
}
@keyframes atDrawIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.totem-draw-header-wrap { text-align: center; margin-bottom: 18px; }
.totem-draw-badge {
  display: inline-block;
  padding: 5px 12px;
  border-radius: var(--at-pill);
  font-size: 0.68rem; font-weight: 700; letter-spacing: 0.15em;
  color: var(--at-beige);
  background: rgba(40,60,22,0.32);
  border: 1px solid rgba(232,220,200,0.32);
  margin-bottom: 10px;
}
.totem-draw-header { color: var(--at-moon); margin: 0 0 5px !important; font-size: 1.02rem; }
.totem-draw-hint   { margin: 0; font-size: 0.82rem; color: var(--at-beige); opacity: 0.84; }

/* 그루터기 래퍼 */
.totem-stump-wrap {
  position: relative;
  min-height: 180px;
  padding: 28px 16px 30px;
  margin: 0 auto;
  max-width: 520px;
  background:
    radial-gradient(ellipse 88% 72% at 50% 100%, #5c4033 0%, #3d2914 42%, #2a1e12 100%);
  border-radius: 46% 46% 44% 44% / 16% 16% 10% 10%;
  box-shadow: inset 0 3px 18px rgba(0,0,0,0.32), 0 12px 38px rgba(0,0,0,0.38);
  border: 1px solid rgba(92,64,51,0.5);
}
.totem-stump-wrap::before {
  content: "";
  position: absolute; inset: 6px;
  border-radius: inherit;
  background: radial-gradient(ellipse 70% 52% at 50% 96%, rgba(0,0,0,0.14), transparent);
  pointer-events: none;
}

/* 카드 그리드 */
.totem-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 14px;
  justify-items: center;
  align-items: center;
}
.totem-card-grid--organic {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-end;
  gap: 14px 18px;
  padding: 4px 6px;
}
.totem-card-grid--organic .totem-draw-card:nth-child(1) { transform: rotate(-3deg) translateY(2px); }
.totem-card-grid--organic .totem-draw-card:nth-child(2) { transform: rotate(1.5deg) translateY(-3px); }
.totem-card-grid--organic .totem-draw-card:nth-child(3) { transform: rotate(3deg) translateY(2px); }
.totem-card-grid--organic .totem-draw-card:nth-child(4) { transform: rotate(-1.5deg) translateY(-2px); }
.totem-card-grid--organic .totem-draw-card:nth-child(5) { transform: rotate(2deg) translateY(1px); }
.totem-card-grid--organic .totem-draw-card.is-revealed  { transform: rotate(0deg) translateY(0px); }

/* ═══════════════════════════════════════════════════
   타로 카드 컴포넌트   핵심 수정 
   perspective container = .totem-draw-card  (explicit w/h)
   flip wrapper = .totem-draw-card-inner     (position:absolute inset:0)
   front / back  = position:absolute inset:0
   ═══════════════════════════════════════════════════ */
.totem-draw-card {
  width: 104px;
  height: 156px;
  flex-shrink: 0;
  perspective: 1000px;
  perspective-origin: 50% 50%;
  position: relative;
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.26s ease, box-shadow 0.28s ease;
  will-change: transform;
}
.totem-draw-card:focus-visible { outline: 2px solid var(--at-lav); outline-offset: 3px; }
.totem-draw-card.is-disabled   { opacity: 0.42; pointer-events: none; cursor: default; }
.totem-draw-card:not(.is-disabled):hover  { transform: translateY(-7px) scale(1.04) !important; }
.totem-draw-card:not(.is-disabled):active { transform: scale(0.97) !important; }

/*  플립 래퍼: 부모 완전 덮기  */
.totem-draw-card-inner {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.72s cubic-bezier(0.34,1.56,0.64,1);
  will-change: transform;
}
.totem-draw-card.is-revealed .totem-draw-card-inner {
  transform: rotateY(180deg);
}

/*  앞/뒷면 공통: position:absolute inset:0  */
.totem-card-face {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: var(--at-radius);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* ═══ 카드 뒷면 ═══ */
.totem-card-face--back {
  background:
    radial-gradient(circle at 50% 22%, rgba(245,240,230,0.14) 0%, transparent 38%),
    radial-gradient(circle at 14% 80%, rgba(45,80,22,0.22) 0%, transparent 44%),
    radial-gradient(circle at 86% 74%, rgba(92,64,51,0.18) 0%, transparent 40%),
    linear-gradient(168deg, #1b3a1b 0%, #254a10 22%, #3d2914 58%, #1a1712 100%);
  border: 1.5px solid rgba(232,220,200,0.22);
  box-shadow: 0 8px 28px rgba(0,0,0,0.52), inset 0 0 0 1px rgba(232,220,200,0.14);
  animation: atCardPulse 3.2s ease-in-out infinite;
}
@keyframes atCardPulse {
  0%,100% { box-shadow: 0 8px 28px rgba(0,0,0,0.52), inset 0 0 0 1px rgba(232,220,200,0.14), 0 0 8px rgba(200,255,180,0.06); }
  50%      { box-shadow: 0 8px 28px rgba(0,0,0,0.52), inset 0 0 0 1px rgba(232,220,200,0.32), 0 0 18px rgba(200,255,180,0.14); }
}
.totem-card-face--back::before {
  content: "";
  position: absolute; inset: 0;
  border-radius: inherit;
  background: repeating-linear-gradient(
    135deg,
    transparent, transparent 9px,
    rgba(232,220,200,0.022) 9px, rgba(232,220,200,0.022) 10px
  );
  pointer-events: none;
}
.totem-card-face--back::after {
  content: "";
  position: absolute; inset: 7px;
  border: 1px solid rgba(232,220,200,0.18);
  border-radius: calc(var(--at-radius) - 6px);
  pointer-events: none;
}
.totem-card-face--back .atc-glyph {
  position: relative; z-index: 2;
  font-size: 2rem; line-height: 1;
  filter: drop-shadow(0 0 10px rgba(200,255,180,0.7)) drop-shadow(0 0 22px rgba(200,255,180,0.38));
  animation: atGlyphPulse 2.6s ease-in-out infinite;
}
@keyframes atGlyphPulse {
  0%,100% { filter: drop-shadow(0 0 8px rgba(200,255,180,0.55)) drop-shadow(0 0 18px rgba(200,255,180,0.28)); }
  50%      { filter: drop-shadow(0 0 18px rgba(200,255,180,0.88)) drop-shadow(0 0 36px rgba(200,255,180,0.48)); }
}
.totem-card-face--back .atc-slot {
  position: relative; z-index: 2;
  margin-top: 8px;
  font-size: 0.6rem; font-weight: 600;
  color: rgba(232,220,200,0.68);
  letter-spacing: 0.08em;
  text-align: center; padding: 0 8px; line-height: 1.3;
}
.totem-card-face--back .atc-roman {
  position: relative; z-index: 2;
  margin-top: 5px;
  font-size: 0.48rem;
  color: rgba(232,220,200,0.42);
  letter-spacing: 0.22em;
  font-family: "Cinzel", Georgia, serif;
}
.atc-corner {
  position: absolute; z-index: 2;
  font-size: 0.44rem; color: rgba(232,220,200,0.38);
  line-height: 1; pointer-events: none;
  filter: drop-shadow(0 0 3px rgba(200,255,180,0.28));
}
.atc-corner--tl { top: 10px; left: 11px; }
.atc-corner--tr { top: 10px; right: 11px; }
.atc-corner--bl { bottom: 10px; left: 11px; }
.atc-corner--br { bottom: 10px; right: 11px; }

/* ═══ 카드 앞면 ═══ */
.totem-card-face--front {
  transform: rotateY(180deg);
  background:
    radial-gradient(circle at 50% 34%, var(--card-glow) 0%, transparent 60%),
    linear-gradient(165deg, var(--card-particle) 0%, rgba(255,255,255,0.99) 55%, rgba(245,240,230,0.97) 100%);
  border: 1.5px solid rgba(92,64,51,0.22);
  box-shadow: 0 6px 24px rgba(0,0,0,0.18), inset 0 1px 0 rgba(255,255,255,0.68), 0 0 18px var(--card-glow);
}
.totem-card-face--front .atc-animal {
  position: relative; z-index: 1;
  font-size: 2.8rem; line-height: 1;
  font-family: 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', 'Segoe UI Symbol', sans-serif;
  margin-bottom: 6px;
  filter: drop-shadow(0 2px 5px rgba(0,0,0,0.12)) drop-shadow(0 0 14px var(--card-glow));
  animation: atEmojiReveal 0.5s ease-out 0.3s both;
}
@keyframes atEmojiReveal {
  from { opacity: 0; transform: scale(0.48) rotate(-8deg); }
  to   { opacity: 1; transform: scale(1) rotate(0deg); }
}
.totem-card-face--front .atc-name {
  position: relative; z-index: 1;
  font-weight: 800; font-size: 0.9rem;
  letter-spacing: 0.02em;
  color: var(--card-primary);
  text-align: center; line-height: 1.2; padding: 0 8px;
}
.totem-card-face--front .atc-cat {
  position: relative; z-index: 1;
  margin-top: 4px; font-size: 0.62rem;
  color: var(--card-primary); opacity: 0.7;
  letter-spacing: 0.05em;
}
.totem-card-face--front .atc-aura {
  position: absolute;
  width: 72%; height: 52%;
  top: 16%; left: 50%;
  transform: translateX(-50%);
  border-radius: 50%;
  background: radial-gradient(circle at center, var(--card-glow) 0%, transparent 68%);
  opacity: 0.48; pointer-events: none; z-index: 0;
  animation: atAuraPulse 3.6s ease-in-out infinite;
}
@keyframes atAuraPulse {
  0%,100% { opacity: 0.38; transform: translateX(-50%) scale(1); }
  50%      { opacity: 0.68; transform: translateX(-50%) scale(1.1); }
}

/*  뒤집힌 카드 글로우  */
.totem-draw-card.is-revealed {
  box-shadow: 0 0 0 2px rgba(45,80,22,0.5), 0 0 22px var(--at-fire), 0 0 40px rgba(200,255,180,0.12), 0 6px 22px rgba(0,0,0,0.28);
  border-radius: var(--at-radius);
}
.totem-draw-card.is-revealed::after {
  content: "";
  position: absolute; inset: -3px;
  border-radius: calc(var(--at-radius) + 3px);
  pointer-events: none;
  background:
    radial-gradient(circle at 32% 30%, rgba(200,255,180,0.14), transparent 52%),
    radial-gradient(circle at 68% 70%, rgba(200,255,180,0.10), transparent 48%);
  animation: atFirefly 2.8s ease-in-out infinite;
  z-index: 3;
}
@keyframes atFirefly {
  0%,100% { opacity: 0.62; }
  50%      { opacity: 1; }
}

/* 파티클 버스트 */
.totem-burst {
  position: absolute;
  width: 7px; height: 7px;
  border-radius: 50%;
  pointer-events: none;
  animation: atBurst 0.72s ease-out forwards;
}
@keyframes atBurst {
  from { transform: translate(0,0) scale(1); opacity: 0.9; }
  to   { transform: translate(var(--tx),var(--ty)) scale(0.1); opacity: 0; }
}
.totem-parallax-zone { transition: transform 0.22s ease; }

/* ═══ 결과 스테이지 ═══ */
.totem-result-stage.is-active {
  animation: atResultIn 0.5s cubic-bezier(0.34,1.56,0.64,1) forwards;
}
@keyframes atResultIn {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
.totem-result-container {
  max-width: 660px; margin: 0 auto;
  display: flex; flex-direction: column; gap: 0;
}
.totem-result-header      { text-align: center; margin-bottom: 24px; }
.totem-result-title {
  margin: 0 0 16px;
  font-size: 1.72rem; font-weight: 800; letter-spacing: 0.04em;
  color: var(--at-moon);
  text-shadow: 0 0 28px var(--at-lav-gl);
  line-height: 1.3;
}

/* 플로우 스트립 */
.totem-flow-strip, .totem-flow-strip--compact {
  display: flex; align-items: center;
  justify-content: center; flex-wrap: wrap;
  gap: 8px 12px; padding: 12px 16px;
  border-radius: var(--at-radius);
  border: 1px solid rgba(92,64,51,0.42);
  background: rgba(40,28,14,0.28);
}
.totem-flow-node {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 13px; border-radius: var(--at-pill);
  border: 1px solid rgba(92,64,51,0.34);
  background: rgba(40,28,14,0.42);
  transition: transform 0.2s, box-shadow 0.2s;
}
.totem-flow-node:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,0.3); }
.totem-flow-icon  { font-size: 1.08rem; font-family: 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', 'Segoe UI Symbol', sans-serif; filter: drop-shadow(0 0 6px var(--at-fire)); }
.totem-flow-label { font-size: 0.72rem; color: var(--at-beige); opacity: 0.88; }
.totem-flow-name  { font-size: 0.84rem; font-weight: 700; color: var(--at-moon); }
.totem-flow-arrow { color: var(--at-lav); opacity: 0.75; margin: 0 2px; }

/*  결과 카드 섹션  */
.totem-result-card-section {
  display: flex; justify-content: center; margin-bottom: 28px;
}
.totem-result-cards { display: grid; gap: 14px; justify-items: center; width: 100%; }
.totem-result-cards--1 { grid-template-columns: 1fr; max-width: 140px; margin: 0 auto; }
.totem-result-cards--3 { grid-template-columns: repeat(3, 1fr); max-width: 440px; margin: 0 auto; }
.totem-result-cards--5 { grid-template-columns: repeat(3, 1fr); max-width: 460px; margin: 0 auto; }

.totem-result-card {
  position: relative; overflow: hidden;
  width: 100%; aspect-ratio: 2 / 3;
  border-radius: var(--at-radius);
  border: 1.5px solid rgba(92,64,51,0.26);
  background:
    radial-gradient(circle at 50% 36%, var(--card-glow) 0%, transparent 58%),
    linear-gradient(165deg, var(--card-particle) 0%, rgba(255,255,255,0.99) 100%);
  box-shadow: 0 10px 30px rgba(0,0,0,0.28), 0 0 16px var(--card-glow), inset 0 1px 0 rgba(255,255,255,0.55);
  opacity: 0; transform: translateY(22px);
  animation: atResultCardUp 0.62s cubic-bezier(0.34,1.56,0.64,1) forwards;
}
.totem-result-card--1 { animation-delay: 0.04s; }
.totem-result-card--2 { animation-delay: 0.1s; }
.totem-result-card--3 { animation-delay: 0.17s; }
.totem-result-card--4 { animation-delay: 0.24s; }
.totem-result-card--5 { animation-delay: 0.31s; }
@keyframes atResultCardUp {
  to { opacity: 1; transform: translateY(0); }
}
.totem-result-card-inner {
  position: relative; z-index: 1;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  height: 100%; padding: 14px 10px; gap: 4px;
}
.totem-rc-aura {
  position: absolute; inset: 0; border-radius: inherit;
  background: radial-gradient(circle at 50% 36%, var(--card-glow) 0%, transparent 62%);
  opacity: 0.42; pointer-events: none;
  animation: atAuraPulse 4s ease-in-out infinite;
}
.totem-result-card-emoji { font-size: 2.5rem; line-height: 1; font-family: 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', 'Segoe UI Symbol', sans-serif; filter: drop-shadow(0 2px 6px rgba(0,0,0,0.1)) drop-shadow(0 0 14px var(--card-glow)); }
.totem-result-card-name  { font-weight: 700; font-size: 0.9rem; text-align: center; line-height: 1.2; color: var(--card-primary); }
.totem-result-card-slot  { font-size: 0.66rem; color: var(--card-primary); opacity: 0.72; letter-spacing: 0.05em; text-align: center; }

/*  결과 텍스트 패널  */
.totem-result-content { display: flex; flex-direction: column; gap: 18px; }
.totem-panel-float {
  border-radius: var(--at-radius-lg);
  border: 1px solid rgba(92,64,51,0.42);
  background: linear-gradient(176deg, rgba(40,28,14,0.65), rgba(55,38,22,0.75));
  box-shadow: 0 6px 26px rgba(0,0,0,0.32), inset 0 1px 0 rgba(232,220,200,0.08);
  padding: 22px 20px 24px;
  color: var(--at-beige);
  position: relative;
}
.totem-panel-float::before {
  content: "🌿";
  position: absolute; top: 14px; left: 14px;
  font-size: 1rem; opacity: 0.6;
  filter: drop-shadow(0 0 5px var(--at-fire));
}
.totem-panel-float h4 {
  padding-left: 28px; margin-bottom: 12px;
  color: var(--at-moon); font-size: 0.82rem;
  font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase;
}
.totem-panel-float p, .totem-panel-float li { font-size: 1rem; line-height: 1.82; color: var(--at-beige); }
.totem-panel-float ul { margin: 8px 0 0 20px; padding: 0; }
.totem-consult-list { display: flex; flex-direction: column; gap: 18px; }
.totem-guidance-card {
  position: relative; overflow: hidden;
  border-radius: var(--at-radius-lg);
  border: 1px solid rgba(92,64,51,0.38);
  background: linear-gradient(176deg, rgba(40,28,14,0.55), rgba(55,38,22,0.65));
  box-shadow: 0 6px 22px rgba(0,0,0,0.28), inset 0 1px 0 rgba(232,220,200,0.06);
  padding: 22px;
  opacity: 0; transform: translateY(18px);
  animation: atCardIn 0.58s cubic-bezier(0.34,1.56,0.64,1) forwards;
}
@keyframes atCardIn {
  to { opacity: 1; transform: translateY(0); }
}
.totem-guidance-aura {
  position: absolute; width: 190px; height: 190px;
  border-radius: 999px; top: -55px; right: -44px;
  background: radial-gradient(circle at center, var(--aura-color), transparent 65%);
  opacity: 0.1; pointer-events: none;
  animation: atAuraPulse 4.4s ease-in-out infinite;
}
.totem-guidance-head {
  display: flex; align-items: center; gap: 14px;
  margin-bottom: 16px; padding-bottom: 12px;
  border-bottom: 1px solid rgba(92,64,51,0.38);
}
.totem-guidance-animal {
  width: 52px; height: 52px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px;
  font-family: 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', 'Segoe UI Symbol', sans-serif;
  background: rgba(40,68,24,0.22);
  border: 1px solid rgba(232,220,200,0.26);
  box-shadow: 0 0 14px var(--at-lav-gl), inset 0 1px 0 rgba(255,255,255,0.04);
}
.totem-guidance-slot { margin: 0; font-size: 0.68rem; letter-spacing: 0.1em; color: var(--at-beige); text-transform: uppercase; opacity: 0.88; }
.totem-guidance-name { margin: 4px 0 0; font-size: 1.22rem; font-weight: 700; color: var(--at-moon); }
.totem-guidance-section { margin-top: 14px; }
.totem-guidance-section h4 { margin: 0 0 8px; color: var(--at-moon); font-size: 0.78rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; }
.totem-guidance-section p, .totem-guidance-section li { margin: 0; font-size: 1rem; line-height: 1.82; color: var(--at-beige); }
.totem-guidance-section ul { margin: 0; padding-left: 20px; }
.totem-ritual-toggle { margin-top: 12px; border-top: 1px dashed rgba(232,220,200,0.2); padding-top: 10px; }
.totem-ritual-toggle summary { cursor: pointer; color: var(--at-moon); font-weight: 700; font-size: 0.82rem; }
.totem-ritual-toggle p { margin-top: 8px; color: var(--at-beige); line-height: 1.74; opacity: 0.92; }
.totem-result-actions {
  display: flex; flex-wrap: wrap; justify-content: center;
  gap: 10px; margin-top: 24px;
}

/*  환경 테마  */
.animal-totem-overlay.env-ground .animal-totem-panel {
  background: linear-gradient(162deg, rgba(45,80,22,0.12), rgba(92,64,51,0.08));
}
.animal-totem-overlay.env-air .animal-totem-panel {
  background: linear-gradient(162deg, rgba(70,50,30,0.16), rgba(184,169,201,0.08));
}
.animal-totem-overlay.env-water .animal-totem-panel {
  background: linear-gradient(162deg, rgba(45,80,22,0.1), rgba(92,64,51,0.1));
}

/*  반응형  */
@media (max-width: 900px), (hover: none) and (pointer: coarse) {
  .animal-totem-overlay { backdrop-filter: none; -webkit-backdrop-filter: none; }
}
@media (max-width: 820px) {
  .animal-totem-shell  { margin: 12px auto; padding: 0 12px max(20px, env(safe-area-inset-bottom)); }
  .animal-totem-panel  { padding: 16px 14px; }
  .totem-canvas-wrap   { height: 280px; }
  .totem-stump-wrap    { padding: 20px 12px 24px; min-height: 160px; }
  .totem-result-title  { font-size: 1.46rem; }
  .totem-result-cards--3, .totem-result-cards--5 { grid-template-columns: repeat(3, 1fr); max-width: 360px; gap: 10px; }
  .totem-panel-float, .totem-guidance-card { padding: 18px 16px; }
  .totem-result-actions { display: grid; grid-template-columns: 1fr; }
  .totem-btn { width: 100%; min-height: 48px; }
  .animal-totem-close { width: 44px; height: 44px; min-width: 44px; min-height: 44px; }
  .totem-draw-card { width: 90px; height: 135px; }
  .totem-card-grid--organic { gap: 12px 14px; }
}
@media (max-width: 480px) {
  .totem-draw-card { width: 80px; height: 120px; }
  .totem-card-grid--organic { gap: 10px 10px; }
  .totem-result-cards--3, .totem-result-cards--5 { grid-template-columns: repeat(3, 1fr); max-width: 300px; gap: 8px; }
  .totem-result-card-emoji  { font-size: 1.9rem; }
  .totem-result-card-name   { font-size: 0.8rem; }
  .totem-card-face--back .atc-glyph { font-size: 1.6rem; }
  .totem-card-face--front .atc-animal { font-size: 2.2rem; }
}
@media (max-width: 420px) {
  .totem-mode-grid  { grid-template-columns: 1fr; gap: 12px; }
  .totem-mode-btn   { padding-left: 18px; }
  .totem-mode-icon  { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .animal-totem-stage,.totem-draw-card-inner,.totem-parallax-zone,
  .totem-rune,.totem-animal-figure,.totem-burst,.totem-card-face--back,
  .totem-mode-badge,.totem-btn--spread,.totem-result-card,
  .totem-guidance-card,.totem-card-face--back .atc-glyph,
  .totem-card-face--front .atc-aura,.totem-rc-aura {
    animation: none !important; transition: none !important; opacity: 1 !important; transform: none !important;
  }
  .totem-draw-card-inner { transform: none !important; }
  .totem-draw-card.is-revealed .totem-draw-card-inner { transform: rotateY(180deg) !important; }
}