﻿.taro-fortune-root {
  --bg-0: #f5f7fb;
  --bg-1: #e9edf4;
  --ink: #0a0f1c;
  --subtle: #5d6476;
  --line: rgba(8, 14, 30, 0.08);
  --glass: rgba(255, 255, 255, 0.72);
  margin: 20px auto;
  max-width: 700px;
  padding: 22px;
  border-radius: 24px;
  border: 1px solid var(--line);
  background: radial-gradient(140% 110% at 100% 0%, #f7fbff 0%, var(--bg-0) 45%, var(--bg-1) 100%);
  box-shadow: 0 20px 44px rgba(8, 17, 32, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.75);
  color: var(--ink);
  font-family: "Nanum Gothic", "Noto Sans KR", "Segoe UI", sans-serif;
}
.taro-fortune-title { margin: 0; font-size: clamp(1.3rem, 2vw, 2rem); }
.taro-fortune-subtitle { margin-top: 6px; color: var(--subtle); }

.taro-fortune-stage { display: none; }
.taro-fortune-stage.is-active { display: block; }
.taro-stage-analyzing.is-active {
  display: flex;
  align-items: center;
}
.taro-stage-start { text-align: center; padding: 18px 0 12px; }
.taro-stage-analyzing {
  text-align: center;
  padding: 26px 0 18px;
  min-height: 500px;
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  box-sizing: border-box;
}

.taro-fortune-cards-single { display: grid; justify-items: center; margin-top: 8px; }
.taro-fortune-cards-single .taro-card { width: min(100%, 300px); touch-action: none; will-change: transform; }

.taro-progress-wrap {
  margin: 6px 0 10px;
  min-height: 34px;
}
.taro-progress-head { display: flex; justify-content: space-between; color: var(--subtle); font-size: 0.87rem; margin-bottom: 4px; }
.taro-progress-bar { height: 7px; border-radius: 999px; background: rgba(15, 23, 42, 0.12); overflow: hidden; }
.taro-progress-fill { display: block; width: 0; height: 100%; background: linear-gradient(90deg, #111827, #3b485f); transition: width 0.2s ease; }

.taro-answer-controls { display: flex; justify-content: center; gap: 10px; margin-top: 12px; }
.taro-progress-guides { margin-top: 10px; text-align: center; }
.taro-progress-guides p { margin: 2px 0; color: var(--subtle); font-size: 0.84rem; }
.taro-answer-btn,
.taro-stage-start-button,
.taro-result-button,
.taro-restart-button {
  border: 0;
  border-radius: 999px;
  padding: 10px 16px;
  color: #fff;
  font-weight: 700;
  background: linear-gradient(115deg, #111827, #1f2937 38%, #364152);
  box-shadow: 0 8px 18px rgba(16, 24, 40, 0.2);
  cursor: pointer;
}
.taro-answer-no { background: linear-gradient(115deg, #334155, #475569); }
.taro-restart-button { margin-left: 8px; background: linear-gradient(115deg, #475569, #64748b); }
.taro-answer-btn.is-pressed { transform: translateY(1px) scale(0.98); filter: brightness(1.06); }
.taro-result-button.is-disabled { opacity: .55; cursor: not-allowed; box-shadow: none; }

.taro-start-card-wrap { display: grid; justify-items: center; gap: 8px; margin-bottom: 12px; }
.taro-start-card-slot {
  position: relative;
  width: min(100%, 300px);
  aspect-ratio: 3 / 5;
}
.taro-start-card-wrap .taro-start-card {
  position: absolute;
  inset: 0;
  width: 100%;
  z-index: 2;
}
.taro-start-hint, .taro-start-relief { margin: 0; color: var(--subtle); font-size: 0.86rem; }
.taro-start-loading {
  position: absolute;
  inset: 0;
  width: 100%;
  opacity: 0;
  pointer-events: none;
  transform: none;
  transition: opacity .18s ease, transform .18s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  z-index: 3;
}
.taro-start-loading.is-visible {
  opacity: 1;
  transform: none;
}
.taro-start-loading-text {
  margin: 0 0 8px;
  color: #16233a;
  font-weight: 700;
  font-size: .88rem;
  min-height: 21px;
}
.taro-start-loading-bar {
  width: min(240px, 82%);
  height: 6px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.12);
  overflow: hidden;
}
.taro-start-loading-fill {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, #0f172a, #334155);
  transition: width .16s linear;
}

.taro-analyzing-text {
  margin: 0 0 10px;
  color: #16233a;
  font-weight: 700;
  min-height: 24px;
  display: flex;
  align-items: center;
}
.taro-analyzing-dots {
  display: inline-flex;
  gap: 6px;
  margin-bottom: 10px;
  min-height: 10px;
  align-items: center;
}
.taro-analyzing-dots span {
  width: 6px; height: 6px; border-radius: 999px; background: #334155; opacity: .35;
  animation: analyzingDots 0.9s ease-in-out infinite;
}
.taro-analyzing-dots span:nth-child(2) { animation-delay: .15s; }
.taro-analyzing-dots span:nth-child(3) { animation-delay: .3s; }
.taro-analyzing-bar {
  width: min(280px, 80%);
  height: 6px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.12);
  margin: 0 auto;
  overflow: hidden;
  min-height: 6px;
}
.taro-analyzing-fill { display: block; width: 0; height: 100%; background: linear-gradient(90deg, #0f172a, #334155); transition: width .16s linear; }

.taro-result-preview { display: grid; justify-items: center; margin-bottom: 8px; }
.taro-result-card { width: min(100%, 300px); }
.taro-result-preview { cursor: pointer; }
.taro-result-preview.is-disabled { cursor: not-allowed; opacity: .9; }
.taro-result-preview .taro-content { text-align: center; }
.taro-result-title { margin: 0 0 6px; font-size: 1.05rem; text-align: center; color: #0f172a; }
.taro-result-cta-text { margin: 0; font-weight: 800; color: #1d4ed8; text-decoration: underline; }
.taro-stage-complete .taro-complete-text { margin: 0 0 10px; color: var(--subtle); text-align: center; }
.taro-stage-complete { min-height: 300px; }

.taro-card { border: 0; background: transparent; padding: 0; }
.taro-card-inner {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 3 / 5;
  border-radius: 20px;
  transform-style: preserve-3d;
  transition: transform 0.42s cubic-bezier(0.19, 1, 0.22, 1);
  box-shadow: 0 14px 26px rgba(18, 32, 57, 0.2), 0 2px 6px rgba(0, 0, 0, 0.08);
}
.taro-card.is-open .taro-card-inner { transform: rotateY(180deg); }
.taro-card-face {
  position: absolute;
  inset: 0;
  border-radius: 20px;
  overflow: hidden;
  backface-visibility: hidden;
  background-size: cover;
  background-position: center;
}
.taro-card-front { transform: rotateY(180deg); }
.taro-card.no-flip .taro-card-inner { transform: none !important; }
.taro-card.no-flip .taro-card-back { display: none; }
.taro-card.no-flip .taro-card-front { transform: none; }
.taro-back-overlay,
.taro-front-overlay { position: absolute; inset: 0; z-index: 2; background: linear-gradient(185deg, rgba(6,12,20,0.12), rgba(6,8,12,0.72)); }
.taro-prism {
  position: absolute;
  inset: -45%;
  z-index: 3;
  background: linear-gradient(110deg, rgba(255,255,255,0.05) 18%, rgba(255,107,129,0.3) 32%, rgba(92,245,255,0.26) 48%, rgba(255,201,107,0.34) 64%, rgba(255,255,255,0.05) 78%);
  mix-blend-mode: screen;
  opacity: .62;
  transform: rotate(12deg) translateX(-18%);
  animation: prismFlow 6s ease-in-out infinite alternate;
}
.taro-content {
  position: absolute;
  left: 12px; right: 12px; bottom: 12px;
  z-index: 5;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.22);
  background: var(--glass);
  backdrop-filter: blur(12px);
  padding: 10px;
}
.taro-swipe-indicator {
  position: absolute;
  top: 12px;
  z-index: 6;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .3px;
  color: #fff;
  opacity: 0;
  transform: translateY(-6px) scale(.94);
  transition: opacity .12s ease, transform .12s ease;
  pointer-events: none;
}
.taro-swipe-yes { right: 12px; background: rgba(16, 185, 129, .9); }
.taro-swipe-no { left: 12px; background: rgba(239, 68, 68, .9); }
.taro-card.show-yes .taro-swipe-yes,
.taro-card.show-no .taro-swipe-no {
  opacity: 1;
  transform: translateY(0) scale(1);
}
.taro-content h3 { margin: 0 0 5px; font-size: .96rem; line-height: 1.25; }
.taro-content p { margin: 0; color: #141d33; font-size: .84rem; line-height: 1.4; }
.taro-fortune-footer { margin-top: 12px; color: var(--subtle); font-size: .86rem; text-align: center; }

@keyframes prismFlow { 0% { transform: rotate(10deg) translateX(-24%);} 100% { transform: rotate(18deg) translateX(16%);} }
@keyframes analyzingDots { 0%, 100% { opacity: .35; transform: translateY(0);} 50% { opacity: 1; transform: translateY(-2px);} }

@media (max-width: 700px) {
  .taro-fortune-root { padding: 16px; border-radius: 18px; }
  .taro-fortune-cards-single .taro-card { width: min(100%, 232px); }
  .taro-start-card-slot { width: min(100%, 232px); }
  .taro-result-card { width: min(100%, 232px); }
  .taro-prism {
    inset: -95%;
    opacity: .54;
    transform: rotate(10deg) translateX(-10%);
    animation: none;
  }
  .taro-content { opacity: 0.8; }
  .taro-content h3 { font-size: .9rem; }
  .taro-content p { font-size: .8rem; }
  .taro-answer-controls { gap: 8px; }
  .taro-answer-btn { min-width: 120px; min-height: 44px; }
  .taro-progress-wrap { margin: 6px 0 10px; min-height: 34px; }
  .taro-stage-analyzing { min-height: 387px; }
  .taro-stage-complete { min-height: 270px; }
}

@media (max-width: 420px) {
  .taro-fortune-root { padding: 14px; }
  .taro-fortune-cards-single .taro-card { width: min(100%, 216px); }
  .taro-start-card-slot { width: min(100%, 216px); }
  .taro-result-card { width: min(100%, 216px); }
  .taro-content { left: 10px; right: 10px; bottom: 10px; padding: 9px; }
  .taro-stage-analyzing { min-height: 360px; }
}
