/* ==========================================================================
   🔮 오늘의 타로 — 유리 + 금빛 느낌 (기존 크리스털 타로 카드와 같은 분위기)
   ========================================================================== */

.tr-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000010;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 12px;
  background: rgba(3, 6, 18, 0.62);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity 0.3s ease;
}
.tr-overlay.active { opacity: 1; }

.tr-panel {
  position: relative;
  width: 100%;
  max-width: 460px;
  max-height: 94vh;
  max-height: 94dvh;
  overflow-y: auto;
  padding: 22px 16px 18px;
  text-align: center;
  background: linear-gradient(165deg, rgba(40, 54, 118, 0.80) 0%, rgba(16, 22, 60, 0.86) 100%);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(236, 198, 92, 0.48);
  border-radius: 26px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.75), 0 0 35px rgba(236, 198, 92, 0.2), inset 0 1px 2px rgba(255, 255, 255, 0.3);
  color: #f1f5f9;
}

.tr-close {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 32px;
  height: 32px;
  border: 1px solid rgba(236, 198, 92, 0.4);
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.5);
  color: #f8e9b0;
  font-size: 15px;
  cursor: pointer;
}

.tr-badge {
  display: inline-block;
  padding: 3px 12px;
  border-radius: 999px;
  border: 1px solid rgba(236, 198, 92, 0.5);
  background: rgba(236, 198, 92, 0.12);
  color: #f4dc8a;
  font-size: 11px;
  letter-spacing: 1.5px;
}

.tr-title {
  margin: 12px 0 4px;
  font-size: 19px;
  font-weight: 800;
  color: #fdf3d0;
  text-shadow: 0 0 14px rgba(236, 198, 92, 0.35);
  word-break: keep-all;
}

.tr-sub {
  margin: 0 8px 4px;
  font-size: 13px;
  line-height: 1.55;
  color: #cbd5e1;
  word-break: keep-all;
}

/* ---------- 부채꼴 카드 뒷면 ---------- */
.tr-deck {
  position: relative;
  height: 262px;
  margin: 8px 0 0;
}

.tr-back {
  position: absolute;
  left: 50%;
  bottom: 46px;
  width: 64px;
  height: 104px;
  margin-left: -32px;
  padding: 0;
  border-radius: 9px;
  border: 1.5px solid rgba(236, 198, 92, 0.75);
  background:
    radial-gradient(circle at 50% 50%, rgba(236, 198, 92, 0.22) 0 14%, transparent 15%),
    radial-gradient(circle at 20% 22%, rgba(252, 232, 160, 0.8) 0 1.5px, transparent 2px),
    radial-gradient(circle at 78% 30%, rgba(252, 232, 160, 0.7) 0 1.5px, transparent 2px),
    radial-gradient(circle at 30% 80%, rgba(252, 232, 160, 0.7) 0 1.5px, transparent 2px),
    radial-gradient(circle at 74% 76%, rgba(252, 232, 160, 0.8) 0 1.5px, transparent 2px),
    linear-gradient(160deg, #1e2a5a 0%, #0b1230 60%, #19113f 100%);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.55), 0 0 12px rgba(236, 198, 92, 0.18), inset 0 0 0 3px rgba(11, 18, 48, 0.9), inset 0 0 0 4px rgba(236, 198, 92, 0.28);
  transform-origin: 50% 140%;
  transform: rotate(var(--tr-angle)) translateY(var(--tr-lift));
  cursor: pointer;
  transition: transform 0.28s ease, opacity 0.45s ease, box-shadow 0.28s ease;
  animation: trDeal 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.tr-back-star {
  color: #f4dc8a;
  font-size: 22px;
  text-shadow: 0 0 10px rgba(236, 198, 92, 0.9);
  pointer-events: none;
}

.tr-back:hover,
.tr-back:focus-visible {
  transform: rotate(var(--tr-angle)) translateY(calc(var(--tr-lift) - 20px));
  box-shadow: 0 14px 26px rgba(0, 0, 0, 0.6), 0 0 22px rgba(236, 198, 92, 0.55), inset 0 0 0 3px rgba(11, 18, 48, 0.9), inset 0 0 0 4px rgba(236, 198, 92, 0.5);
  outline: none;
}

.tr-back.tr-chosen {
  transform: rotate(0deg) translateY(-70px) scale(1.25);
  box-shadow: 0 0 34px rgba(236, 198, 92, 0.9);
  z-index: 5;
}
.tr-back.tr-dim { opacity: 0; transform: rotate(var(--tr-angle)) translateY(40px); }

@keyframes trDeal {
  from { opacity: 0; transform: rotate(0deg) translateY(60px) scale(0.7); }
  to   { opacity: 1; transform: rotate(var(--tr-angle)) translateY(var(--tr-lift)); }
}

/* ---------- 뽑힌 카드 (뒤집히는 3D) ---------- */
.tr-reveal {
  position: relative;
  display: none;
  justify-content: center;
  margin: 14px 0 6px;
  perspective: 1000px;
}

.tr-card3d {
  position: relative;
  width: min(62vw, 220px);
  height: min(92vw, 322px);
  max-height: 322px;
  transform-style: preserve-3d;
  transform: rotateY(180deg);
  transition: transform 1s cubic-bezier(0.22, 1, 0.36, 1);
}
.tr-card3d.flipped { transform: rotateY(0deg); }

.tr-face {
  position: absolute;
  inset: 0;
  border-radius: 16px;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  overflow: hidden;
}

.tr-front-face {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 14px 10px;
  background: linear-gradient(165deg, rgba(36, 44, 96, 0.92), rgba(12, 17, 46, 0.96) 55%, rgba(34, 20, 70, 0.94));
  border: 2px solid rgba(236, 198, 92, 0.85);
  box-shadow: 0 0 30px rgba(236, 198, 92, 0.45), inset 0 0 0 4px rgba(11, 18, 48, 0.92), inset 0 0 0 5px rgba(236, 198, 92, 0.35);
}

.tr-sym {
  font-size: clamp(54px, 18vw, 76px);
  line-height: 1.1;
  filter: drop-shadow(0 0 14px rgba(236, 198, 92, 0.7));
}
.tr-name-ko {
  margin-top: 6px;
  font-size: 21px;
  font-weight: 800;
  color: #f8e9b0;
  word-break: keep-all;
}
.tr-name-en {
  font-size: 10.5px;
  letter-spacing: 2px;
  color: #a5b4fc;
}
.tr-keys {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px;
  margin-top: 8px;
}
.tr-key {
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(236, 198, 92, 0.14);
  border: 1px solid rgba(236, 198, 92, 0.35);
  color: #f4dc8a;
  font-size: 11px;
}

.tr-back-face {
  transform: rotateY(180deg);
  background:
    radial-gradient(circle at 50% 50%, rgba(236, 198, 92, 0.22) 0 12%, transparent 13%),
    linear-gradient(160deg, #1e2a5a, #0b1230 60%, #19113f);
  border: 2px solid rgba(236, 198, 92, 0.8);
  box-shadow: inset 0 0 0 4px rgba(11, 18, 48, 0.92), inset 0 0 0 5px rgba(236, 198, 92, 0.35);
}

/* 반짝이 */
.tr-spark {
  position: absolute;
  left: 50%;
  top: 50%;
  color: #f8e9b0;
  font-size: 16px;
  text-shadow: 0 0 10px rgba(236, 198, 92, 0.95);
  pointer-events: none;
  opacity: 0;
  animation: trSpark 1.3s ease-out forwards;
}
@keyframes trSpark {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.4); }
  25%  { opacity: 1; }
  100% { opacity: 0; transform: translate(calc(-50% + var(--tx)), calc(-50% + var(--ty))) scale(1.2); }
}

/* ---------- 한마디 글상자 ---------- */
.tr-message {
  display: none;
  margin: 10px 4px 0;
  padding: 14px 14px;
  min-height: 84px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(236, 198, 92, 0.28);
  text-align: left;
}
.tr-message-label {
  display: block;
  margin-bottom: 6px;
  font-size: 11.5px;
  color: #f4dc8a;
  letter-spacing: 1px;
}
.tr-message-text {
  margin: 0;
  font-size: 14.5px;
  line-height: 1.75;
  color: #f8fafc;
  word-break: keep-all;
}

/* ---------- 버튼 ---------- */
.tr-actions {
  display: none;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
  justify-content: center;
}
.tr-actions button {
  flex: 1 1 28%;
  min-width: 92px;
  padding: 10px 6px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid rgba(236, 198, 92, 0.45);
  color: #f8e9b0;
  background: rgba(15, 23, 42, 0.55);
}
.tr-actions .tr-btn-gold {
  background: linear-gradient(160deg, rgba(255,230,140,0.22) 0%, rgba(240,190,60,0.14) 100%);
  color: #fffaf0;
  text-shadow: 0 1px 3px rgba(0,0,0,0.85), 0 0 8px rgba(0,0,0,0.5);
  border: 1.5px solid rgba(255,236,170,0.8);
  box-shadow: 0 4px 14px rgba(0,0,0,0.25), inset 0 1px 2px rgba(255,255,255,0.8), inset 0 0 16px rgba(255,225,130,0.18);
}
.tr-actions .tr-btn-kakao {
  background: #fee500;
  color: #3b1e1e;
  border-color: transparent;
}

.tr-note {
  margin: 12px 4px 0;
  font-size: 11px;
  line-height: 1.5;
  color: #94a3b8;
}

/* 상단 버튼 / 결과 아래 버튼 */
.tarot-chip-btn { white-space: nowrap; }
.tr-bridge-btn {
  display: block;
  width: 100%;
  margin-top: 10px;
  padding: 12px 10px;
  border-radius: 14px;
  border: 1px solid rgba(236, 198, 92, 0.5);
  background: linear-gradient(135deg, rgba(99, 60, 180, 0.45), rgba(30, 41, 99, 0.55));
  color: #f8e9b0;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

@media (max-width: 380px) {
  .tr-deck { height: 244px; }
  .tr-back { width: 58px; height: 94px; margin-left: -29px; }
}
@media (prefers-reduced-motion: reduce) {
  .tr-back, .tr-card3d { transition: none; animation: none; }
}

/* 운세 유리창이 열려 있어도 상단 버튼(오늘의 타로 등)을 누를 수 있게 헤더를 유리창 위로 */
.ambient-header { z-index: 210; }

/* ===== 차분한 유리 톤 통일 ===== */
.tr-panel { background: linear-gradient(165deg, rgba(255,255,255,0.14) 0%, rgba(255,255,255,0.05) 100%); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border: 1px solid rgba(255,255,255,0.4); box-shadow: 0 24px 60px rgba(0,0,0,0.5), inset 0 1px 2px rgba(255,255,255,0.5); }
.tr-title, .tr-sub, .tr-message-text, .tr-note { text-shadow: 0 1px 3px rgba(0,0,0,0.8); }
.tr-actions button, .tr-actions .tr-btn-gold, .tr-actions .tr-btn-kakao, .tr-bridge-btn {
  background: linear-gradient(160deg, rgba(255,255,255,0.20), rgba(255,255,255,0.06)) !important;
  border: 1px solid rgba(232,212,160,0.65) !important;
  color: #fffaf0 !important;
  text-shadow: 0 1px 3px rgba(0,0,0,0.8);
  box-shadow: 0 4px 14px rgba(0,0,0,0.25), inset 0 1px 1px rgba(255,255,255,0.55) !important;
}
.tr-badge, .tr-key { background: rgba(255,255,255,0.08); border-color: rgba(232,212,160,0.5); color: #f3e7c4; }
.tr-title { color: #fffaf0; }


/* ===== 별자리 카드가 '쑹' 날아와 반짝 ===== */
.sc-fly { position: absolute; inset: 0; z-index: 30; display: flex; align-items: center; justify-content: center; pointer-events: none; }
.sc-card {
  position: relative; overflow: hidden;
  width: min(62vw, 230px); height: min(88vw, 330px); max-height: 330px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  padding: 16px 12px; text-align: center; border-radius: 18px;
  background: linear-gradient(165deg, rgba(255,255,255,0.20) 0%, rgba(255,255,255,0.06) 100%), rgba(12,18,48,0.55);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border: 1.5px solid rgba(232,212,160,0.9);
  box-shadow: 0 0 40px rgba(240,215,150,0.55), 0 18px 50px rgba(0,0,0,0.6), inset 0 1px 2px rgba(255,255,255,0.7);
  color: #fffaf0;
  animation: scSwoosh 1.1s cubic-bezier(0.2, 1.2, 0.3, 1) both, scFloat 3s ease-in-out 1.1s infinite;
}
.sc-sym { font-size: clamp(60px, 20vw, 86px); line-height: 1; filter: drop-shadow(0 0 16px rgba(255,230,160,0.9)); }
.sc-name { font-size: 22px; font-weight: 800; text-shadow: 0 1px 4px rgba(0,0,0,0.8); }
.sc-key { font-size: 12.5px; line-height: 1.5; color: #f3e7c4; text-shadow: 0 1px 3px rgba(0,0,0,0.8); word-break: keep-all; }
.sc-shine {
  position: absolute; top: -20%; left: -60%; width: 40%; height: 140%;
  background: linear-gradient(100deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0.55) 50%, rgba(255,255,255,0) 100%);
  transform: rotate(12deg); animation: scShine 2.2s ease-in-out 0.9s infinite;
}
.sc-fly.sc-out .sc-card { animation: scOut 0.55s ease-in both; }
@keyframes scSwoosh {
  0%   { opacity: 0; transform: translate(var(--sx), var(--sy)) scale(0.04) rotate(-220deg); }
  55%  { opacity: 1; }
  100% { opacity: 1; transform: translate(0, 0) scale(1) rotate(0deg); }
}
@keyframes scFloat { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes scShine { 0% { left: -60%; } 60%,100% { left: 130%; } }
@keyframes scOut { to { opacity: 0; transform: scale(1.12); } }
@media (prefers-reduced-motion: reduce) { .sc-card, .sc-shine { animation: none; } }
