/* ============================================================
   loading.css — 월하 로딩 화면 (명리학 무드)
   3가지 시안 공용 스타일 + 누락돼 있던 모든 키프레임 정의
   변수: --wl-k (속도 배수) · --wl-glow (글로우 세기) · --wl-accent (액센트 그라데)
   ============================================================ */

.wl-load {
  --wl-k: 1;                 /* 속도 배수 (작을수록 빠름) */
  --wl-glow: 1;              /* 글로우 세기 */
  --wl-accent: var(--grad);  /* 액센트 그라데이션 */
  --wl-accent-1: #7C5CFF;
  --wl-accent-2: #F56FA7;

  flex: 1;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 24px 22px 30px;
  position: relative;
  overflow: hidden;
}

/* 은은한 배경 후광 — 모든 시안 공통 */
.wl-load::before {
  content: "";
  position: absolute;
  width: 360px; height: 360px;
  top: 36%; left: 50%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(124,92,255,0.16), rgba(245,111,167,0.07) 42%, transparent 70%);
  opacity: var(--wl-glow);
  filter: blur(6px);
  animation: wl-breathe-bg calc(7s * var(--wl-k)) ease-in-out infinite;
  pointer-events: none;
}

/* 무대 (히어로 비주얼 영역) */
.wl-stage {
  position: relative;
  z-index: 2;
  width: 240px;
  height: 240px;
  display: grid;
  place-items: center;
  margin-bottom: 14px;
}

/* ---------------- 공통 하단 메타 ---------------- */
.wl-meta {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}
.wl-eyebrow {
  font-size: 10.5px;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--primary);
  opacity: 0.9;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.wl-eyebrow::before,
.wl-eyebrow::after {
  content: "";
  width: 16px; height: 1px;
  background: linear-gradient(90deg, transparent, var(--primary-2));
}
.wl-eyebrow::after { background: linear-gradient(90deg, var(--primary-2), transparent); }

.wl-msg {
  font-family: var(--serif);
  font-size: 18.5px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.01em;
  text-align: center;
  min-height: 26px;
  animation: wl-msg-in 0.5s ease both;
}
.wl-sub {
  font-size: 11.5px;
  color: var(--text-faint);
  margin-top: 7px;
  letter-spacing: 0.04em;
}

/* 4단계 세그먼트 진행바 */
.wl-steps {
  display: flex;
  gap: 6px;
  margin-top: 22px;
}
.wl-seg {
  width: 34px; height: 3px;
  border-radius: 99px;
  background: var(--track);
  overflow: hidden;
  position: relative;
}
.wl-seg::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 99px;
  background: var(--wl-accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.7s cubic-bezier(.4,0,.2,1);
}
.wl-seg.done::after { transform: scaleX(1); }
.wl-seg.active::after {
  transform: scaleX(1);
  animation: wl-seg-fill calc(1.4s * var(--wl-k)) linear;
}
.wl-count {
  margin-top: 12px;
  font-size: 10.5px;
  letter-spacing: 0.14em;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}

/* 단계 문구 숨김 (tweak) */
.wl-load.no-steps .wl-eyebrow,
.wl-load.no-steps .wl-msg,
.wl-load.no-steps .wl-sub,
.wl-load.no-steps .wl-count { display: none; }
.wl-load.no-steps .wl-steps { margin-top: 30px; }

/* ============================================================
   시안 A — 오행 순환 (Five Elements Orbit)
   ============================================================ */
.wl-orbit { position: relative; width: 220px; height: 220px; }

.wl-orbit-glow {
  position: absolute; inset: -6px;
  border-radius: 50%;
  background: conic-gradient(from 0deg,
    rgba(124,92,255,0.0), rgba(124,92,255,0.16), rgba(245,111,167,0.16),
    rgba(91,147,240,0.14), rgba(124,92,255,0.0));
  filter: blur(14px);
  opacity: var(--wl-glow);
  animation: wl-spin calc(13s * var(--wl-k)) linear infinite;
}
.wl-orbit-ring {
  position: absolute; inset: 18px;
  border-radius: 50%;
  border: 1px dashed rgba(124,92,255,0.28);
  animation: wl-spin calc(40s * var(--wl-k)) linear infinite reverse;
}
.wl-orbit-ring.inner {
  inset: 46px;
  border-color: rgba(245,111,167,0.22);
  animation-duration: calc(28s * var(--wl-k));
  animation-direction: normal;
}

.wl-orbit-spin {
  position: absolute; inset: 0;
  animation: wl-spin calc(22s * var(--wl-k)) linear infinite;
}
.wl-arm {
  position: absolute; top: 50%; left: 50%;
  width: 0; height: 0;
  transform: rotate(var(--ang)) translateY(-86px);
}
.wl-deg {
  position: absolute;
  transform: translate(-50%, -50%) rotate(calc(-1 * var(--ang)));
}
.wl-elem-chip {
  width: 42px; height: 42px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 600;
  color: var(--ec);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: 0 6px 18px -8px rgba(89,63,180,0.22);
  animation:
    wl-spin calc(22s * var(--wl-k)) linear infinite reverse,
    wl-elem-pulse calc(5s * var(--wl-k)) ease-in-out infinite;
  will-change: transform, box-shadow;
}
.wl-elem-chip::before {
  content: "";
  position: absolute;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--ec);
  top: -3px;
  box-shadow: 0 0 10px var(--ec);
  opacity: 0.85;
}

.wl-orbit-core {
  position: absolute;
  top: 50%; left: 50%;
  width: 88px; height: 88px;
  margin: -44px 0 0 -44px;
  border-radius: 50%;
  background: var(--wl-accent);
  display: grid;
  place-items: center;
  font-family: var(--serif);
  font-size: 40px;
  color: #fff;
  box-shadow:
    0 0 calc(46px * var(--wl-glow)) rgba(124,92,255,0.55),
    0 0 calc(90px * var(--wl-glow)) rgba(245,111,167,0.28),
    inset 0 2px 10px rgba(255,255,255,0.35);
  animation: wl-breathe calc(3.4s * var(--wl-k)) ease-in-out infinite;
}
.wl-orbit-core::after {
  content: "";
  position: absolute;
  top: 16px; right: 18px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: rgba(255,255,255,0.5);
  filter: blur(1px);
}

/* ============================================================
   시안 B — 만세력 세우기 (Four Pillars)
   ============================================================ */
.wl-manse {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}
.wl-pillars {
  display: grid;
  grid-template-columns: repeat(4, 52px);
  gap: 10px;
  position: relative;
}
.wl-pillar {
  position: relative;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: 0 8px 22px -12px rgba(89,63,180,0.2);
  overflow: hidden;
  animation: wl-pillar-in calc(4.4s * var(--wl-k)) ease-in-out infinite;
}
.wl-pillar.day {
  border-color: rgba(124,92,255,0.5);
  box-shadow: 0 12px 30px -12px rgba(124,92,255,0.5);
}
.wl-p-label {
  font-size: 9.5px;
  letter-spacing: 0.18em;
  color: var(--text-faint);
  font-weight: 700;
  text-align: center;
  padding-top: 8px;
}
.wl-p-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 6px 0;
}
.wl-p-cell + .wl-p-cell { border-top: 1px solid var(--line); }
.wl-p-han {
  font-family: var(--serif);
  font-size: 25px;
  line-height: 1;
  font-weight: 600;
  color: var(--hc, var(--text));
}
.wl-p-ko { font-size: 9px; color: var(--text-dim); }

/* 쓸려 지나가는 빛 (만세력을 '세우는' 느낌) */
.wl-pillars::after {
  content: "";
  position: absolute;
  top: -8px; bottom: -8px;
  width: 64px;
  left: 0;
  background: linear-gradient(90deg, transparent, rgba(124,92,255,0.18), rgba(245,111,167,0.12), transparent);
  filter: blur(3px);
  opacity: var(--wl-glow);
  animation: wl-sweep calc(2.8s * var(--wl-k)) ease-in-out infinite;
  pointer-events: none;
}
/* 일간 위 작은 표식 */
.wl-day-mark {
  position: absolute;
  top: -10px; left: 50%;
  transform: translateX(-50%);
  font-size: 9px;
  letter-spacing: 0.1em;
  color: var(--primary);
  font-weight: 700;
  white-space: nowrap;
}

/* 서예 같은 진행 라인 */
.wl-brush {
  width: 178px; height: 2px;
  border-radius: 99px;
  background: var(--track);
  overflow: hidden;
}
.wl-brush span {
  display: block; height: 100%;
  border-radius: 99px;
  background: var(--wl-accent);
  transform-origin: left;
  animation: wl-brush calc(4.4s * var(--wl-k)) ease-in-out infinite;
}

/* ============================================================
   시안 C — 달무리 (Moon halo)
   ============================================================ */
.wl-moonwrap { position: relative; width: 220px; height: 220px; display: grid; place-items: center; }

.wl-halo {
  position: absolute;
  top: 50%; left: 50%;
  width: 84px; height: 84px;
  margin: -42px 0 0 -42px;
  border-radius: 50%;
  border: 1.5px solid rgba(124,92,255,0.5);
  opacity: 0;
  animation: wl-halo calc(3.6s * var(--wl-k)) cubic-bezier(.2,.6,.3,1) infinite;
}
.wl-halo.h2 { animation-delay: calc(1.2s * var(--wl-k)); border-color: rgba(168,107,240,0.5); }
.wl-halo.h3 { animation-delay: calc(2.4s * var(--wl-k)); border-color: rgba(245,111,167,0.5); }

/* 별자리 점선 링 */
.wl-constel {
  position: absolute; inset: 8px;
  animation: wl-spin calc(34s * var(--wl-k)) linear infinite;
}
.wl-star {
  position: absolute;
  width: var(--s, 3px); height: var(--s, 3px);
  border-radius: 50%;
  background: var(--primary-2);
  top: 50%; left: 50%;
  transform: rotate(var(--ang)) translateY(-100px);
  box-shadow: 0 0 8px rgba(124,92,255,0.7);
  animation: wl-twinkle calc(2.6s * var(--wl-k)) ease-in-out infinite;
  animation-delay: var(--d, 0s);
}

.wl-moon {
  position: relative;
  width: 84px; height: 84px;
  border-radius: 50%;
  background: var(--wl-accent);
  box-shadow:
    0 0 calc(42px * var(--wl-glow)) rgba(124,92,255,0.5),
    0 0 calc(84px * var(--wl-glow)) rgba(245,111,167,0.26),
    inset -6px -8px 18px rgba(91,63,180,0.32),
    inset 4px 4px 12px rgba(255,255,255,0.4);
  animation: wl-breathe calc(4s * var(--wl-k)) ease-in-out infinite;
}
.wl-moon::after {
  content: "";
  position: absolute;
  top: 14px; right: 16px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: rgba(255,255,255,0.55);
  filter: blur(1px);
}

/* ============================================================
   KEYFRAMES (원래 누락돼 있던 것 전부 포함)
   ============================================================ */
@keyframes wl-spin { to { transform: rotate(360deg); } }

@keyframes wl-breathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.055); }
}
@keyframes wl-breathe-bg {
  0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: var(--wl-glow); }
  50% { transform: translate(-50%, -50%) scale(1.12); opacity: calc(var(--wl-glow) * 0.7); }
}
@keyframes wl-elem-pulse {
  0%, 100% { box-shadow: 0 6px 18px -8px rgba(89,63,180,0.22); }
  50% { box-shadow: 0 6px 16px -6px var(--ec); filter: brightness(1.04); }
}
@keyframes wl-msg-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}
@keyframes wl-seg-fill { from { transform: scaleX(0); } to { transform: scaleX(1); } }

@keyframes wl-pillar-in {
  0% { opacity: 0.35; transform: translateY(8px); }
  18%, 78% { opacity: 1; transform: none; }
  100% { opacity: 0.35; transform: translateY(8px); }
}
@keyframes wl-sweep {
  0% { left: -64px; opacity: 0; }
  20% { opacity: var(--wl-glow); }
  80% { opacity: var(--wl-glow); }
  100% { left: 100%; opacity: 0; }
}
@keyframes wl-brush {
  0% { transform: scaleX(0); }
  60%, 100% { transform: scaleX(1); }
}
@keyframes wl-halo {
  0% { transform: scale(0.55); opacity: 0; }
  18% { opacity: calc(0.7 * var(--wl-glow)); }
  100% { transform: scale(2.5); opacity: 0; }
}
@keyframes wl-twinkle {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .wl-load *, .wl-load::before { animation: none !important; }
}
