:root {
  --bg: #fdf3f9;
  --bg2: #f6e9f8;
  --panel: rgba(255, 255, 255, 0.72);
  --panel2: rgba(255, 255, 255, 0.92);
  --text: #5a4a6e;
  --muted: #9d8fb4;
  --gold: #c76a9e;
  --purple: #9a7fc9;
  --border: rgba(196, 168, 220, 0.4);
  --shadow: 0 14px 36px rgba(168, 120, 200, 0.16);
  --card-filter: brightness(1.1) saturate(0.82) sepia(0.13) hue-rotate(-14deg) contrast(0.96);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { height: 100%; }
body { min-height: 100%; }

body {
  font-family: "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", sans-serif;
  color: var(--text);
  background:
    radial-gradient(340px 210px at 16% 20%, rgba(255, 255, 255, 0.9), transparent 70%),
    radial-gradient(440px 250px at 84% 26%, rgba(255, 255, 255, 0.75), transparent 72%),
    radial-gradient(320px 190px at 38% 82%, rgba(255, 255, 255, 0.6), transparent 72%),
    radial-gradient(380px 230px at 72% 90%, rgba(255, 255, 255, 0.55), transparent 72%),
    radial-gradient(1100px 720px at 10% -10%, #ffe2f1 0%, transparent 55%),
    radial-gradient(1000px 700px at 92% -6%, #d7efff 0%, transparent 55%),
    radial-gradient(900px 680px at 50% 108%, #e9dcff 0%, transparent 62%),
    linear-gradient(180deg, #fdf7fc 0%, #f7f2ff 44%, #eef8ff 100%);
  background-attachment: fixed;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

body.no-scroll { overflow: hidden; }

/* ---------- 헤더 ---------- */
.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: rgba(255, 251, 254, 0.72);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.85);
  box-shadow: 0 6px 24px rgba(170, 130, 200, 0.1);
}
.app-title {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  background: linear-gradient(100deg, #e488b6, #b391e0 48%, #7fb9e8);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  cursor: pointer;
  padding: 0;
  transition: opacity 0.15s ease;
}
.app-title:hover { opacity: 0.8; }
.app-title:active { opacity: 0.65; }

.header-actions { display: flex; align-items: center; gap: 8px; }
.btn-stamp-small { padding: 7px 10px; font-size: 0.8rem; }
@media (max-width: 400px) {
  .app-header { padding: 12px 14px; }
  .app-title { font-size: 1rem; }
  .header-actions { gap: 6px; }
  .header-actions .btn-ghost { padding: 7px 9px; font-size: 0.8rem; }
}

/* ---------- 레이아웃 ---------- */
.app-main {
  position: relative;
  z-index: 1;
  max-width: 1080px;
  margin: 0 auto;
  padding: 24px 16px 80px;
}
.view { display: none; }
.view.active { display: block; animation: fadeIn 0.35s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- 버튼 ---------- */
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }

.btn-primary {
  display: block;
  width: 100%;
  max-width: 340px;
  margin: 28px auto 0;
  padding: 14px 20px;
  border-radius: 14px;
  font-size: 1rem;
  font-weight: 700;
  color: #4a3a5e;
  background: linear-gradient(135deg, #f9bbd4, #dcc4f3 55%, #bcdcf5);
  box-shadow: 0 12px 30px rgba(214, 150, 205, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.7);
  transition: transform 0.15s ease, filter 0.15s ease, box-shadow 0.15s ease;
}
.btn-primary:hover { transform: translateY(-2px); filter: brightness(1.04); box-shadow: 0 16px 36px rgba(214, 150, 205, 0.42); }
.btn-primary:active { transform: translateY(0); }

.btn-view-reading { display: none; margin-top: 16px; }

.btn-ghost {
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 0.9rem;
  color: var(--text);
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--border);
  transition: background 0.15s ease, border-color 0.15s ease;
}
.btn-ghost:hover { background: #fff; border-color: rgba(200, 160, 220, 0.7); }

.dice-icon { width: 18px; height: 18px; display: inline-block; vertical-align: -3px; margin-right: 7px; filter: drop-shadow(0 1px 1px rgba(150, 100, 170, 0.25)); }
.ico { width: 18px; height: 18px; display: inline-block; vertical-align: -3px; margin-right: 6px; filter: drop-shadow(0 1px 1px rgba(150, 100, 170, 0.2)); }
.fortune-ico { width: 1.9rem; height: 1.9rem; display: block; }

/* ---------- 홈 ---------- */
.hero { text-align: center; padding: 28px 0 18px; }
.hero h1 {
  font-size: clamp(1.4rem, 6vw, 2rem);
  letter-spacing: 1px;
  word-break: keep-all;
  line-height: 1.25;
  background: linear-gradient(100deg, #e488b6, #b391e0 48%, #7fb9e8);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}
.hero p { color: var(--muted); margin-top: 6px; font-size: clamp(0.82rem, 3.4vw, 0.95rem); word-break: keep-all; }

.fortune-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin: 18px auto 0;
  max-width: 560px;
}

.fortune-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 22px 12px;
  min-height: 150px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.66);
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 10px 26px rgba(170, 130, 200, 0.1);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}
.fortune-card:hover {
  transform: translateY(-4px);
  border-color: rgba(210, 170, 230, 0.9);
  box-shadow: 0 16px 34px rgba(190, 140, 220, 0.22);
}
.fortune-emoji { font-size: 1.9rem; }
.fortune-name { font-size: 1.1rem; font-weight: 700; }
.fortune-sub { font-size: 0.8rem; color: var(--muted); }

.footnote { text-align: center; color: var(--muted); font-size: 0.78rem; margin-top: 26px; }
.legal-links { text-align: center; margin-top: 8px; font-size: 0.8rem; }
.legal-links a { color: var(--muted); text-decoration: none; }
.legal-links a:hover { color: var(--purple); text-decoration: underline; }
.legal-links span { color: var(--muted); margin: 0 6px; }

/* ---------- 운세 결과 ---------- */
.reading-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.reading-head > :first-child { min-width: 0; }
.reading-head h2 { font-size: 1.5rem; color: var(--gold); }
.reading-period { color: var(--muted); font-size: 0.9rem; }
.reading-actions { display: flex; gap: 8px; flex-shrink: 0; }

@media (max-width: 480px) {
  .reading-head { gap: 10px; align-items: center; }
  .reading-head h2 { font-size: 1.3rem; }
  .reading-period { font-size: 0.76rem; }
  .reading-actions { gap: 6px; }
  .reading-actions .btn-ghost { padding: 9px 14px; font-size: 0.9rem; }
  .reading-actions .dice-icon { width: 17px; height: 17px; margin-right: 6px; }
}
.reading-intro {
  margin: 0 0 16px;
  font-size: 1.12rem;
  font-weight: 700;
  color: var(--gold);
  line-height: 1.6;
  letter-spacing: -0.01em;
  text-align: center;
}
.reading-body { display: flex; flex-direction: column; gap: 12px; }
.narration-card {
  max-width: 620px;
  width: 100%;
  margin-left: auto;
  margin-right: auto;
  padding: 16px 18px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 8px 22px rgba(168, 120, 200, 0.08);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
  text-align: left;
}
.narration-card:hover {
  background: #fff;
  transform: translateY(-1px);
  box-shadow: 0 10px 26px rgba(168, 120, 200, 0.14);
}
.narration-card-tag {
  display: inline-block;
  margin-bottom: 8px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--purple);
  letter-spacing: 0.02em;
}
.narration-line {
  margin: 0;
  font-size: 1rem;
  line-height: 1.9;
  color: var(--text);
  word-break: keep-all;
  overflow-wrap: anywhere;
}
.narration-line + .narration-line { margin-top: 4px; }
.reading-summary {
  max-width: 620px;
  width: 100%;
  margin: 14px auto 0;
  padding: 18px 18px 16px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(253, 243, 249, 0.9));
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: 0 10px 26px rgba(168, 120, 200, 0.1);
  text-align: center;
}
.summary-head {
  margin-bottom: 10px;
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--purple);
}
.summary-line {
  margin: 0;
  font-size: 0.98rem;
  line-height: 1.9;
  color: var(--text);
  word-break: keep-all;
  overflow-wrap: anywhere;
  text-align: left;
}
.summary-line + .summary-line { margin-top: 6px; }
.tap-hint { color: var(--muted); font-size: 0.82rem; margin: 16px 0 6px; }
.card-detail-btn { margin-top: 8px; font-size: 0.8rem; padding: 6px 12px; }
.modal-story { color: var(--text); font-size: 0.95rem; margin: 6px 0; line-height: 1.75; }

.cards-grid {
  display: grid;
  gap: 14px;
  justify-content: center;
  align-items: start;
  margin-top: 18px;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}
.cards-grid[data-count="1"] { grid-template-columns: min(230px, 100%); }
.cards-grid[data-count="3"] { grid-template-columns: repeat(3, minmax(0, 1fr)); max-width: 560px; margin-left: auto; margin-right: auto; }
.cards-grid[data-count="4"] { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 360px; margin-left: auto; margin-right: auto; }
.cards-grid[data-count="6"] { grid-template-columns: repeat(3, minmax(0, 1fr)); max-width: 560px; margin-left: auto; margin-right: auto; }
.cards-grid[data-count="5"] { grid-template-columns: repeat(3, minmax(0, 1fr)); max-width: 560px; margin-left: auto; margin-right: auto; }
.cards-grid[data-count="12"] { grid-template-columns: repeat(4, minmax(0, 1fr)); max-width: 640px; margin-left: auto; margin-right: auto; }
.cards-grid[data-count="10"] {
  position: relative;
  width: 340px;
  height: 700px;
  margin: 18px auto 0;
  display: block;
}
.cards-grid[data-count="10"] .card-slot { position: absolute; width: 72px; }
.cards-grid[data-count="10"] .card-slot:nth-child(1) { left: 90px; top: 210px; }
.cards-grid[data-count="10"] .card-slot:nth-child(2) { left: 90px; top: 210px; z-index: 4; }
.cards-grid[data-count="10"] .card-slot:nth-child(2) .card-inner { transform: rotate(90deg); }
.cards-grid[data-count="10"] .card-slot:nth-child(2) .card-inner.flipped { transform: rotate(90deg) rotateY(180deg); }
.cards-grid[data-count="10"] .card-slot:nth-child(3) { left: 90px; top: 380px; }
.cards-grid[data-count="10"] .card-slot:nth-child(4) { left: 90px; top: 40px; }
.cards-grid[data-count="10"] .card-slot:nth-child(5) { left: 8px; top: 210px; }
.cards-grid[data-count="10"] .card-slot:nth-child(6) { left: 172px; top: 210px; }
.cards-grid[data-count="10"] .card-slot:nth-child(7) { left: 262px; top: 540px; }
.cards-grid[data-count="10"] .card-slot:nth-child(8) { left: 262px; top: 370px; }
.cards-grid[data-count="10"] .card-slot:nth-child(9) { left: 262px; top: 200px; }
.cards-grid[data-count="10"] .card-slot:nth-child(10) { left: 262px; top: 30px; }
.cards-grid[data-count="10"] .card-info { margin-top: 4px; }
.cards-grid[data-count="10"] .card-pos {
  font-size: 0.62rem;
  letter-spacing: 0;
  line-height: 1.2;
  padding: 2px 5px;
  background: rgba(255, 252, 255, 0.92);
  border: 1px solid rgba(196, 168, 220, 0.35);
  border-radius: 6px;
  display: inline-block;
  white-space: nowrap;
}
.cards-grid[data-count="10"] .card-name { font-size: 0.7rem; }
.cards-grid[data-count="10"] .card-slot:nth-child(2) .card-info {
  position: absolute;
  left: 50%;
  top: -24px;
  transform: translateX(-50%);
  margin-top: 0;
}
.premium-section { margin: 26px 0 4px; }
.premium-head { text-align: center; font-size: 1.05rem; font-weight: 800; color: var(--gold); margin-bottom: 4px; }
.premium-sub { text-align: center; font-size: 0.82rem; color: var(--muted); margin-bottom: 14px; }
.premium-grid { display: grid; gap: 12px; grid-template-columns: repeat(3, minmax(0, 1fr)); max-width: 560px; margin: 0 auto; }
.premium-card { position: relative; }
.lock-badge { position: absolute; top: 8px; right: 10px; font-size: 0.85rem; }
.context-input { width: 100%; min-height: 96px; margin: 0 0 14px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--border); background: rgba(255, 255, 255, 0.8); font-size: 0.95rem; color: var(--text); resize: vertical; font-family: inherit; line-height: 1.6; }
.context-input:focus { outline: none; border-color: var(--purple); box-shadow: 0 0 0 3px rgba(154, 127, 201, 0.15); }
.context-input[type="date"], .context-input[type="month"], .context-input[type="number"] { min-height: 50px; }
#inquiry-title { min-height: 46px; resize: none; }
.context-week-hint { text-align: center; font-size: 0.85rem; color: var(--purple); font-weight: 700; margin: -6px 0 14px; }
.btn-premium-badge { font-size: 1.05rem; padding: 6px 10px; border-radius: 999px; background: rgba(255, 214, 236, 0.7); border: 1px solid rgba(199, 106, 158, 0.35); cursor: default; }
.premium-compare { display: flex; gap: 10px; margin: 14px 0 16px; }
.pc-col { flex: 1; padding: 12px 10px; border-radius: 12px; background: rgba(255, 255, 255, 0.6); border: 1px solid var(--border); text-align: center; }
.pc-col.pc-pro { background: linear-gradient(160deg, rgba(246, 239, 255, 0.95), rgba(253, 243, 249, 0.95)); border-color: rgba(199, 106, 158, 0.4); box-shadow: 0 6px 18px rgba(168, 120, 200, 0.14); }
.pc-title { font-weight: 800; font-size: 0.95rem; margin-bottom: 8px; color: var(--text); }
.pc-pro .pc-title { color: var(--purple); }
.pc-item { font-size: 0.78rem; color: var(--muted); margin: 5px 0; line-height: 1.4; }
.btn-premium-later { width: 100%; margin-top: 8px; font-size: 0.85rem; }
.premium-note { font-size: 0.74rem; color: var(--muted); text-align: center; margin: -4px 0 12px; line-height: 1.5; word-break: keep-all; }
.premium-disclaimer { font-size: 0.72rem; color: var(--muted); text-align: center; margin: 0 0 14px; line-height: 1.55; word-break: keep-all; opacity: 0.9; }
.profile-badge { margin-top: 8px; font-size: 0.78rem; font-weight: 700; color: var(--muted); }
.profile-badge.premium { color: var(--gold); }
.btn-ai-reading { display: block; width: 100%; max-width: 420px; margin: 16px auto 0; padding: 13px 18px; font-size: 0.98rem; font-weight: 700; color: #fff; background: linear-gradient(135deg, #c9a6ee, #e79ec9); border: none; border-radius: 999px; box-shadow: 0 10px 24px rgba(168, 120, 200, 0.28); cursor: pointer; }
.btn-ai-reading:disabled { opacity: 0.6; cursor: wait; }
.ai-reading {
  margin-top: 18px;
  padding: 22px 18px 26px;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 12% 6%, rgba(255, 232, 246, 0.95), transparent 58%),
    radial-gradient(circle at 88% 94%, rgba(228, 222, 255, 0.9), transparent 58%),
    linear-gradient(160deg, #fffdfe 0%, #faf3ff 52%, #fff5fb 100%);
  border: 1px solid rgba(199, 106, 158, 0.28);
  border-radius: 22px;
  box-shadow: 0 18px 50px rgba(168, 120, 200, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.95);
}
.ai-reading::before {
  content: "✦";
  position: absolute;
  top: 9px;
  right: 14px;
  font-size: 0.9rem;
  color: rgba(199, 106, 158, 0.6);
  animation: aiTwinkle 2.6s ease-in-out infinite;
  pointer-events: none;
}
.ai-reading::after {
  content: "✧";
  position: absolute;
  bottom: 10px;
  left: 14px;
  font-size: 0.8rem;
  color: rgba(154, 127, 201, 0.55);
  animation: aiTwinkle 3.4s ease-in-out infinite 0.8s;
  pointer-events: none;
}
.ai-reading-head { font-size: 0.92rem; font-weight: 800; color: var(--purple); margin-bottom: 12px; text-align: center; position: relative; z-index: 1; }
.ai-reading-head::after {
  content: "";
  display: block;
  width: 56px;
  height: 2px;
  margin: 8px auto 0;
  border-radius: 2px;
  background: linear-gradient(90deg, transparent, rgba(199, 106, 158, 0.55), transparent);
}
.ai-reading-body { font-size: 1.02rem; line-height: 2; color: var(--text); word-break: keep-all; overflow-wrap: anywhere; text-align: left; position: relative; z-index: 1; max-width: 600px; margin-left: auto; margin-right: auto; letter-spacing: 0.1px; }
.ai-paragraph { margin: 0; }
.ai-paragraph + .ai-paragraph { margin-top: 14px; }
.ai-section-head { font-weight: 800; color: var(--purple); font-size: 1.02rem; margin: 22px 0 8px; text-align: center; letter-spacing: 0.3px; }
.ai-feedback { position: relative; z-index: 1; margin-top: 18px; padding-top: 14px; border-top: 1px dashed rgba(199, 106, 158, 0.3); text-align: center; }
.ai-fb-label { display: block; font-size: 0.82rem; color: var(--muted); margin-bottom: 8px; }
.ai-fb-btn { margin: 0 4px; padding: 7px 14px; font-size: 0.85rem; font-weight: 700; border-radius: 999px; border: 1px solid rgba(199, 106, 158, 0.35); background: rgba(255, 255, 255, 0.7); color: var(--text); cursor: pointer; }
.ai-fb-btn:hover { background: rgba(246, 239, 255, 0.9); }
.ai-fb-btn:disabled { opacity: 0.6; cursor: default; }
.ai-para-in { animation: aiFadeIn 0.95s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
@keyframes aiFadeIn {
  from { opacity: 0; transform: translateY(10px); filter: blur(6px); }
  to { opacity: 1; transform: translateY(0); filter: blur(0); }
}
@keyframes aiTwinkle {
  0%, 100% { opacity: 0.35; transform: scale(0.9) rotate(0deg); }
  50% { opacity: 1; transform: scale(1.18) rotate(12deg); }
}
.ai-shine {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  border-radius: inherit;
  z-index: 2;
}
.ai-shine::before {
  content: "";
  position: absolute;
  top: -25%;
  bottom: -25%;
  left: -45%;
  width: 40%;
  background: linear-gradient(100deg, transparent 0%, rgba(255, 255, 255, 0.9) 42%, rgba(255, 210, 235, 0.55) 50%, transparent 58%);
  transform: skewX(-16deg);
  filter: blur(1px);
  opacity: 0;
}
.ai-shine::after {
  content: "✦ ✧ ✦ ✧";
  position: absolute;
  top: 44%;
  left: -20%;
  letter-spacing: 22px;
  font-size: 0.85rem;
  color: rgba(199, 106, 158, 0.85);
  white-space: nowrap;
  text-shadow: 0 0 6px rgba(255, 214, 236, 0.9);
  opacity: 0;
}
.ai-shine.play::before { animation: aiShineSweep 1.7s cubic-bezier(0.4, 0, 0.2, 1); }
.ai-shine.play::after { animation: aiShineTrail 1.7s cubic-bezier(0.4, 0, 0.2, 1); }
@keyframes aiShineSweep {
  0% { left: -45%; opacity: 0; }
  15% { opacity: 1; }
  100% { left: 135%; opacity: 0; }
}
@keyframes aiShineTrail {
  0% { left: -25%; opacity: 0; }
  18% { opacity: 1; }
  85% { opacity: 1; }
  100% { left: 118%; opacity: 0; }
}

.card-slot {
  width: 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  perspective: 1200px;
}

/* 카드 뒤집기 */
.card-inner {
  position: relative;
  width: 100%;
  aspect-ratio: 11 / 19;
  transform-style: preserve-3d;
  transition: transform 0.6s cubic-bezier(0.4, 0.1, 0.2, 1);
  cursor: pointer;
}
.card-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 12px 30px rgba(170, 120, 200, 0.22);
}
.card-front {
  transform: rotateY(180deg);
  background: #000;
}
.card-front img { width: 100%; height: 100%; object-fit: cover; display: block; filter: var(--card-filter); }
.card-front::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255, 196, 224, 0.16), rgba(255, 236, 248, 0.10));
  pointer-events: none;
}
.card-back {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.9);
  background:
    radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.9) 0 30%, transparent 31%),
    repeating-linear-gradient(45deg, #f9d9ea 0 9px, #e7dcfb 9px 18px);
}
.card-back-star { font-size: 2.6rem; color: #fff; text-shadow: 0 0 18px rgba(200, 150, 235, 0.9); }

.card-inner.flipped { transform: rotateY(180deg); }

.card-info { margin-top: 12px; text-align: center; }
.card-pos {
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--gold);
  font-weight: 700;
}
.card-name { font-weight: 700; font-size: 1.05rem; margin-top: 2px; }
.badge-rev {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 6px;
  color: #8a5f9e;
  background: rgba(180, 140, 220, 0.22);
  vertical-align: 1px;
}
.card-kw { color: var(--purple); font-size: 0.82rem; margin-top: 4px; }
.card-summary { color: var(--muted); font-size: 0.86rem; margin-top: 6px; }

/* 상세 목록 */
.detail-list { list-style: none; margin-top: 10px; }
.detail-list li { font-size: 0.86rem; color: var(--text); padding: 6px 0; border-bottom: 1px solid rgba(196, 168, 220, 0.35); }
.detail-list li:last-child { border-bottom: none; }
.detail-list b { color: var(--gold); margin-right: 6px; }
.detail-list li.advice { color: var(--text); }

/* ---------- 도감 ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0; }
.chip {
  padding: 7px 15px;
  border-radius: 999px;
  font-size: 0.86rem;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.66);
  border: 1px solid var(--border);
  transition: all 0.15s ease;
}
.chip:hover { color: var(--text); }
.chip.active { color: #fff; background: linear-gradient(135deg, #e79ac0, #b79ae0); border-color: transparent; font-weight: 700; box-shadow: 0 8px 20px rgba(200, 140, 210, 0.3); }

.library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 14px;
}
.lib-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
  padding: 8px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.66);
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 8px 20px rgba(170, 130, 200, 0.1);
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.lib-card:hover { transform: translateY(-3px); border-color: rgba(210, 170, 230, 0.9); box-shadow: 0 14px 28px rgba(190, 140, 220, 0.22); }
.lib-card .lib-img {
  width: 100%;
  aspect-ratio: 11/19;
  object-fit: cover;
  border-radius: 8px;
  filter: var(--card-filter);
  opacity: 0;
  transition: opacity 0.5s ease;
}
.lib-card .lib-img.loaded { opacity: 1; }
.lib-placeholder {
  position: absolute;
  top: 8px;
  left: 8px;
  right: 8px;
  aspect-ratio: 11/19;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #fde7f2, #ecd9fb 45%, #fde7f2);
  background-size: 220% 220%;
  animation: libShimmer 1.6s ease-in-out infinite;
  transition: opacity 0.3s ease;
  pointer-events: none;
}
.lib-placeholder.hidden { opacity: 0; }
.lib-spark {
  display: inline-block;
  font-size: 1.6rem;
  color: #e79ac0;
  animation: libSpark 1.1s ease-in-out infinite;
  filter: drop-shadow(0 0 6px rgba(231, 154, 192, 0.7));
}
@keyframes libShimmer {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
@keyframes libSpark {
  0%, 100% { transform: scale(0.75) rotate(0deg); opacity: 0.55; }
  50% { transform: scale(1.15) rotate(20deg); opacity: 1; }
}
.lib-card .lib-name { font-size: 0.78rem; color: var(--text); }

/* ---------- 모달 ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(90, 66, 120, 0.34);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.modal.active { display: flex; }
.modal-box {
  position: relative;
  width: 100%;
  max-width: 720px;
  max-height: 90vh;
  overflow-y: auto;
  border-radius: 22px;
  background: rgba(255, 252, 255, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 24px 60px rgba(150, 110, 190, 0.28);
  padding: 22px;
}
.modal-close-bottom {
  display: block;
  width: 100%;
  margin-top: 20px;
  padding: 12px 16px;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--purple);
  background: rgba(246, 239, 255, 0.9);
  border: 1px solid rgba(199, 106, 158, 0.3);
  border-radius: 12px;
  cursor: pointer;
}
.modal-close-bottom:active { background: rgba(240, 230, 255, 1); }
.modal-close {
  position: absolute;
  top: 12px;
  right: 14px;
  font-size: 1.2rem;
  color: var(--muted);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(245, 235, 250, 0.9);
}
.modal-close:hover { color: var(--text); }

.modal-layout { display: flex; gap: 20px; flex-direction: column; }
@media (min-width: 640px) {
  .modal-layout { flex-direction: row; align-items: flex-start; }
  .modal-img { width: 260px; flex: 0 0 auto; }
}
.modal-img { width: 200px; max-width: 70vw; margin: 0 auto; border-radius: 12px; box-shadow: 0 16px 36px rgba(170, 120, 200, 0.28); filter: var(--card-filter); }
.modal-content { flex: 1; }
.modal-content h3 { font-size: 1.4rem; color: var(--gold); }
.modal-en { color: var(--muted); font-style: italic; }
.modal-arcana { font-size: 0.82rem; color: var(--purple); margin-top: 2px; }

.toggle { display: inline-flex; margin: 12px 0 4px; border-radius: 10px; overflow: hidden; border: 1px solid var(--border); }
.toggle button { padding: 7px 16px; font-size: 0.85rem; color: var(--muted); background: rgba(255, 255, 255, 0.7); }
.toggle button.active { color: #fff; background: linear-gradient(135deg, #e79ac0, #b79ae0); font-weight: 700; }

.modal-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.tag {
  font-size: 0.78rem;
  padding: 3px 10px;
  border-radius: 999px;
  color: #8a5f9e;
  background: rgba(180, 140, 220, 0.16);
  border: 1px solid rgba(180, 140, 220, 0.32);
}
.modal-summary { color: var(--text); font-size: 0.95rem; margin-bottom: 6px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(16px);
  background: rgba(255, 252, 255, 0.95);
  color: var(--text);
  padding: 10px 18px;
  border-radius: 12px;
  border: 1px solid var(--border);
  box-shadow: 0 12px 30px rgba(160, 120, 200, 0.22);
  font-size: 0.88rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 200;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.search-input {
  width: 100%;
  margin: 14px 0 2px;
  padding: 11px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.72);
  color: var(--text);
  font-size: 0.92rem;
  font-family: inherit;
}
.search-input:focus { outline: none; border-color: var(--purple); background: #fff; }
.search-input::placeholder { color: var(--muted); }

/* 셔플 / 카드 오픈 플로우 */
.shuffle-bar { position: absolute; top: 191px; left: 0; right: 0; margin: 0; text-align: center; z-index: 4; }
.shuffle-bar .btn-primary { margin: 0 auto; }
.reading-hint { color: var(--muted); font-size: 0.88rem; margin-top: 10px; }

.reading-narrative { display: none; margin-top: 22px; scroll-margin-top: 70px; }
.reading-narrative.show { display: block; animation: narrativeIn 1.2s cubic-bezier(0.22, 0.61, 0.36, 1) both; }
@keyframes narrativeIn {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

.card-slot.pre-deal { display: none; }
.cards-grid.shuffling .card-slot {
  animation: cardDeal 0.9s cubic-bezier(0.22, 0.61, 0.36, 1) both;
}
@keyframes cardDeal {
  0% { opacity: 0; transform: translateY(34px) rotate(-4deg); }
  55% { opacity: 1; transform: translateY(-10px) rotate(2deg); }
  100% { opacity: 1; transform: translateY(0) rotate(0); }
}

/* 셔플 덱 */
.reading-stage { position: relative; min-height: 240px; }
.shuffle-deck {
  position: absolute;
  top: 0;
  left: 50%;
  width: 230px;
  height: 150px;
  margin-left: -115px;
  visibility: hidden;
  z-index: 3;
  cursor: pointer;
}
#btn-reveal-all { display: none; margin: 14px auto 0; }
.deck-card {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 180px;
  height: 126px;
  margin: -63px 0 0 -90px;
  will-change: transform;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 12px 28px rgba(170, 120, 200, 0.24);
  background:
    radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.9) 0 30%, transparent 31%),
    repeating-linear-gradient(45deg, #f9d9ea 0 9px, #e7dcfb 9px 18px);
}
.shuffle-deck.shuffling .deck-card.from-left {
  animation: riffleL 1.1s cubic-bezier(0.16, 0.84, 0.32, 1) both;
}
.shuffle-deck.shuffling .deck-card.from-right {
  animation: riffleR 1.1s cubic-bezier(0.16, 0.84, 0.32, 1) both;
}
@keyframes riffleL {
  0%   { transform: translate(0, 0) rotate(0deg); }
  28%  { transform: translate(-16px, -9px) rotate(-10deg); }
  62%  { transform: translate(-6px, -3px) rotate(-3deg); }
  100% { transform: translate(0, 0) rotate(0deg); }
}
@keyframes riffleR {
  0%   { transform: translate(0, 0) rotate(0deg); }
  28%  { transform: translate(16px, -9px) rotate(10deg); }
  62%  { transform: translate(6px, -3px) rotate(3deg); }
  100% { transform: translate(0, 0) rotate(0deg); }
}

/* ---------- 드림코어 배경 (무지개 / 구름 / 별) ---------- */
.dream-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.rainbow-wrap {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 46vmin;
  overflow: hidden;
}
.rainbow {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 96vmin;
  height: 96vmin;
  border-radius: 50%;
  background: radial-gradient(circle closest-side,
    transparent 0 52%,
    #e0cff7 52% 56%,
    #bcddf8 56% 60%,
    #c9f2d1 60% 64%,
    #fdf0b4 64% 68%,
    #ffd8b5 68% 72%,
    #ffc0d2 72% 76%,
    transparent 76%);
  opacity: 0.5;
  filter: blur(1.5px);
  animation: rainbowBreathe 16s ease-in-out infinite;
}

.cloud { position: absolute; animation: cloudDrift 46s ease-in-out infinite alternate; }
.cloud-1 { top: 8%; left: -6%; }
.cloud-2 { top: 15%; right: -8%; animation-duration: 60s; animation-delay: -14s; }
.cloud-3 { top: 55%; left: 5%; animation-duration: 56s; animation-delay: -26s; }
.cloud-4 { top: 74%; right: 2%; animation-duration: 66s; animation-delay: -38s; }

.cloud-body {
  position: relative;
  display: block;
  width: 200px;
  height: 64px;
  background: rgba(255, 255, 255, 0.78);
  border-radius: 64px;
  filter: blur(4px);
}
.cloud-body::before,
.cloud-body::after {
  content: "";
  position: absolute;
  bottom: 0;
  background: inherit;
  border-radius: 50%;
}
.cloud-body::before { width: 84px; height: 84px; left: 26px; bottom: 8px; }
.cloud-body::after { width: 108px; height: 108px; right: 22px; bottom: 10px; }

.cloud-1 .cloud-body { transform: scale(0.85); opacity: 0.9; }
.cloud-2 .cloud-body { transform: scale(1.2); }
.cloud-3 .cloud-body { transform: scale(0.62); opacity: 0.55; }
.cloud-4 .cloud-body { transform: scale(0.9); opacity: 0.65; }

.spark {
  position: absolute;
  color: rgba(255, 255, 255, 0.95);
  text-shadow: 0 0 14px rgba(255, 190, 230, 0.95);
  font-size: 1.5rem;
  line-height: 1;
  animation: sparkTwinkle 5.5s ease-in-out infinite;
}
.spark-1 { top: 26%; left: 14%; }
.spark-2 { top: 60%; right: 12%; font-size: 1.1rem; animation-delay: -2s; }
.spark-3 { top: 40%; right: 24%; font-size: 0.9rem; animation-delay: -3.5s; }

@keyframes cloudDrift {
  from { transform: translateX(-16px); }
  to   { transform: translateX(28px); }
}
@keyframes sparkTwinkle {
  0%, 100% { opacity: 0.15; transform: scale(0.75); }
  50%      { opacity: 1; transform: scale(1.2); }
}
@keyframes rainbowBreathe {
  0%, 100% { opacity: 0.42; }
  50%      { opacity: 0.62; }
}

/* 타로카드 뜻과 역사 */
.btn-about {
  display: block;
  width: 100%;
  max-width: 340px;
  margin: 14px auto 0;
  padding: 12px 20px;
  font-size: 0.95rem;
  font-weight: 600;
}
.btn-badge {
  display: inline-block;
  margin-left: 6px;
  min-width: 18px;
  height: 18px;
  line-height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: #e0568f;
  color: #fff;
  font-size: 0.68rem;
  font-weight: 800;
  text-align: center;
  vertical-align: 1px;
}
.about-content { margin-top: 8px; }
.about-block {
  margin: 14px 0;
  padding: 18px;
  background: rgba(255, 255, 255, 0.66);
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 16px;
  box-shadow: 0 10px 26px rgba(170, 130, 200, 0.1);
}
.about-block h3 { font-size: 1.1rem; color: var(--gold); margin-bottom: 8px; }
.about-block p { font-size: 0.96rem; line-height: 1.85; color: var(--text); }
.about-block p + p { margin-top: 10px; }
.about-list { list-style: none; margin-top: 8px; }
.about-list li {
  font-size: 0.95rem;
  line-height: 1.8;
  color: var(--text);
  padding: 6px 0;
  border-bottom: 1px solid rgba(196, 168, 220, 0.28);
}
.about-list li:last-child { border-bottom: none; }
.about-list b { color: var(--purple); }

/* 분야 선택 */
.area-picker {
  margin: 14px 0 0;
  text-align: center;
  max-height: 120px;
  overflow: hidden;
  transition: opacity 0.45s ease, max-height 0.45s ease, margin-top 0.45s ease;
}
.area-label { font-size: 0.85rem; color: var(--muted); display: block; margin-bottom: 8px; }
.area-chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }

/* 오늘의 카드 */
.today-card-wrap { margin: 6px 0 0; text-align: center; }
.today-label { font-size: 0.85rem; color: var(--muted); margin-bottom: 8px; }
.today-card {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 0 auto;
  padding: 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.66);
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 10px 26px rgba(170, 130, 200, 0.1);
  text-align: left;
  max-width: 440px;
  width: 100%;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.today-card:hover { transform: translateY(-3px); box-shadow: 0 16px 34px rgba(190, 140, 220, 0.22); }
.today-card img { width: 84px; aspect-ratio: 11/19; object-fit: cover; border-radius: 10px; flex: 0 0 auto; }
.today-card-info { display: flex; flex-direction: column; }
.today-card-name { font-weight: 700; font-size: 1.05rem; color: var(--gold); }
.today-card-meaning { font-size: 0.85rem; color: var(--muted); line-height: 1.6; margin-top: 4px; }

/* 지난 운세 */
.history-list { margin-top: 8px; display: flex; flex-direction: column; gap: 12px; }
.history-empty { color: var(--muted); font-size: 0.9rem; text-align: center; padding: 30px 0; }
.history-item { position: relative; }
.history-open {
  display: block;
  width: 100%;
  text-align: left;
  padding: 14px 46px 14px 16px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.66);
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 8px 20px rgba(170, 130, 200, 0.1);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.history-open:hover { transform: translateY(-2px); box-shadow: 0 14px 28px rgba(190, 140, 220, 0.22); }
.history-del {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.history-del:hover { color: #d84a4a; border-color: rgba(216, 74, 74, 0.5); }
.history-top { display: flex; align-items: center; gap: 8px; }
.history-type { font-weight: 700; color: var(--text); font-size: 0.98rem; }
.history-area { font-size: 0.72rem; color: #fff; background: linear-gradient(135deg, #e79ac0, #b79ae0); padding: 2px 8px; border-radius: 999px; }
.history-label { font-size: 0.82rem; color: var(--muted); margin-top: 4px; }
.history-cards { font-size: 0.9rem; color: var(--text); margin-top: 6px; line-height: 1.5; }

/* 출석 스탬프 */
.stamp-section {
  margin-top: 20px;
  padding: 18px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.66);
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 10px 26px rgba(170, 130, 200, 0.1);
}
.stamp-head { display: flex; align-items: center; justify-content: flex-start; gap: 10px; margin-bottom: 12px; }
.stamp-title { font-weight: 700; font-size: 1rem; color: var(--text); }
.stamp-count { font-size: 0.85rem; font-weight: 700; color: var(--gold); }
.stamp-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; max-width: 320px; margin: 0 auto 14px; }
.stamp {
  display: flex; align-items: center; justify-content: center;
  aspect-ratio: 1; border-radius: 50%;
  font-size: 0.8rem; font-weight: 700; color: var(--muted);
  background: rgba(255, 255, 255, 0.7);
  border: 1px dashed var(--border);
}
.stamp.filled {
  color: #fff;
  background: linear-gradient(135deg, #e79ac0, #b79ae0);
  border: 1px solid transparent;
  box-shadow: 0 4px 12px rgba(200, 140, 210, 0.35);
}
.btn-checkin { margin-top: 0; }
.stamp-msg { text-align: center; font-size: 0.8rem; color: var(--muted); margin-top: 8px; }
.stamp-sub { font-size: 0.84rem; color: var(--muted); text-align: center; line-height: 1.5; margin-bottom: 14px; }
.stamp-notice { font-size: 0.72rem; color: var(--muted); text-align: center; margin-top: 10px; opacity: 0.85; }
.modal-box-small { max-width: 390px; }

/* 풀이 아래 CTA */
.reading-cta { margin: 24px auto 0; max-width: 420px; }
.reading-disclaimer { text-align: center; color: var(--muted); font-size: 0.74rem; line-height: 1.6; margin: 20px auto 4px; max-width: 520px; word-break: keep-all; }
.btn-share-bottom { margin-top: 0; width: 100%; max-width: none; font-size: 1.05rem; padding: 15px 20px; }
.reading-cta-row { display: flex; gap: 10px; margin-top: 12px; }
.reading-cta-row .btn-ghost {
  flex: 1; padding: 12px 14px; font-size: 0.95rem; font-weight: 600;
  background: linear-gradient(135deg, #f9d6e7, #e4d3f8);
  border: 1px solid rgba(210, 170, 230, 0.7);
  color: #5a4a6e;
}

/* 상담 예약 */
.consult-intro { color: var(--muted); font-size: 0.9rem; margin-top: 8px; }
.consult-list { margin-top: 14px; display: flex; flex-direction: column; gap: 14px; }
.consult-card {
  padding: 18px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.66);
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 10px 26px rgba(170, 130, 200, 0.1);
}
.consult-top { display: flex; align-items: center; gap: 12px; }
.consult-avatar {
  width: 52px; height: 52px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.6rem;
  background: linear-gradient(135deg, #f9d6e7, #e4d3f8);
  flex: 0 0 auto;
}
.consult-info { flex: 1; min-width: 0; }
.consult-name { font-weight: 700; font-size: 1.1rem; color: var(--text); }
.consult-ai-badge {
  display: inline-block;
  vertical-align: 1px;
  margin-left: 4px;
  padding: 1px 7px;
  border-radius: 999px;
  background: linear-gradient(135deg, #e79ac0, #b79ae0);
  color: #fff;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.5px;
}
.consult-specialty { font-size: 0.82rem; color: var(--muted); margin-top: 2px; }
.consult-avail { display: flex; align-items: center; gap: 5px; flex: 0 0 auto; }
.consult-dot { width: 10px; height: 10px; border-radius: 50%; }
.consult-dot.on { background: #4cd97b; box-shadow: 0 0 8px rgba(76, 217, 123, 0.7); }
.consult-dot.off { background: #f26d6d; box-shadow: 0 0 8px rgba(242, 109, 109, 0.7); }
.consult-status { font-size: 0.78rem; font-weight: 700; }
.consult-status.on { color: #2eaf5b; }
.consult-status.off { color: #d84a4a; }
.consult-desc { font-size: 0.92rem; color: var(--text); line-height: 1.7; margin: 10px 0; }
.consult-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.consult-bottom { display: flex; align-items: center; justify-content: space-between; padding-top: 10px; border-top: 1px solid rgba(196, 168, 220, 0.3); }
.consult-price { font-weight: 700; font-size: 1.05rem; color: var(--gold); }
.consult-rating { font-size: 0.85rem; color: var(--muted); }
.btn-pay {
  display: block;
  width: 100%;
  margin-top: 12px;
  padding: 12px 16px;
  border: none;
  border-radius: 12px;
  font-size: 0.95rem;
  font-weight: 700;
  color: #4a3a5e;
  background: linear-gradient(135deg, #f9bbd4, #dcc4f3 55%, #bcdcf5);
  box-shadow: 0 10px 24px rgba(214, 150, 205, 0.32);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.btn-pay:active { transform: scale(0.98); }
.btn-pay-cancel { color: #d84a4a; background: rgba(255, 235, 238, 0.9); box-shadow: none; border: 1px solid rgba(216, 74, 74, 0.3); }
.btn-pay.reserved {
  background: linear-gradient(135deg, #cfe8d4, #bfe3cc);
  color: #2e7d4f;
  box-shadow: none;
  cursor: default;
  opacity: 0.9;
}
.consult-left {
  margin-top: 8px;
  text-align: center;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--gold);
}
.btn-extend {
  margin-top: 8px;
  background: linear-gradient(135deg, #fde7f2, #ecd9fb);
  color: #a0557e;
  box-shadow: none;
  font-size: 0.85rem;
  padding: 10px 14px;
}
.btn-end {
  margin-top: 8px;
  background: rgba(255, 255, 255, 0.7);
  color: var(--muted);
  box-shadow: none;
  font-size: 0.85rem;
  padding: 10px 14px;
  border: 1px solid var(--border);
}
.auth-wrap { position: relative; display: flex; align-items: center; gap: 6px; }
.btn-auth-login { font-size: 0.82rem; padding: 7px 11px; }
.btn-avatar {
  width: 34px;
  height: 34px;
  padding: 2px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.8);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(170, 130, 200, 0.2);
}
.auth-avatar { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; }
.auth-dropdown {
  position: absolute;
  top: 42px;
  right: 0;
  min-width: 150px;
  padding: 10px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid rgba(210, 170, 230, 0.6);
  box-shadow: 0 12px 30px rgba(150, 110, 190, 0.25);
  z-index: 50;
  text-align: left;
}
.auth-dropdown-name {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text);
  padding: 4px 6px 8px;
  border-bottom: 1px solid rgba(210, 170, 230, 0.4);
  margin-bottom: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.auth-logout {
  display: block;
  width: 100%;
  padding: 8px 6px;
  border: none;
  border-radius: 8px;
  background: transparent;
  font-size: 0.85rem;
  color: #d84a4a;
  text-align: left;
  cursor: pointer;
}
.auth-logout:hover { background: rgba(216, 74, 74, 0.08); }
.profile-card {
  margin-top: 8px;
  padding: 22px 18px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.66);
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 10px 26px rgba(170, 130, 200, 0.1);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
}
.profile-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid #fff;
  box-shadow: 0 4px 14px rgba(170, 130, 200, 0.3);
  background: #f3e9fb;
}
.profile-name { font-weight: 700; font-size: 1.2rem; color: var(--text); }
.profile-email { font-size: 0.85rem; color: var(--muted); }
.profile-stamp {
  margin-top: 16px;
  padding: 18px 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.66);
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 10px 26px rgba(170, 130, 200, 0.1);
}
.profile-section-title { font-size: 1rem; font-weight: 700; color: var(--text); margin: 0 0 10px; }
.profile-stamp-count { font-size: 1.3rem; font-weight: 800; color: var(--gold); text-align: center; margin-bottom: 10px; }
.profile-stamp-progress {
  height: 12px;
  border-radius: 999px;
  background: rgba(220, 196, 243, 0.4);
  overflow: hidden;
  margin-bottom: 10px;
}
.profile-stamp-bar {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, #e79ac0, #b79ae0);
  transition: width 0.4s ease;
}
.profile-stamp-msg { font-size: 0.82rem; color: var(--muted); text-align: center; margin: 0; }
.profile-coupon {
  margin-top: 16px;
  padding: 18px 16px;
  border-radius: 16px;
  text-align: center;
  background: linear-gradient(135deg, #fff6e0, #ffe4f0);
  border: 1px dashed var(--gold);
  box-shadow: 0 10px 26px rgba(210, 150, 90, 0.14);
}
.profile-coupon-desc { font-size: 0.85rem; color: var(--text); margin: 0 0 10px; }
.profile-coupon-terms { font-size: 0.75rem; color: var(--muted); margin: 0 0 10px; }
.profile-coupon-code {
  display: inline-block;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 1px;
  color: #8a5a20;
  background: #fff;
  border: 1px solid rgba(200, 150, 80, 0.4);
  margin-bottom: 12px;
}
.btn-profile-logout { margin-top: 16px; width: 100%; color: #d84a4a; border-color: rgba(216, 74, 74, 0.4); }

/* 프로필 섹션 (마이페이지) */
.profile-box {
  margin-top: 16px;
  padding: 18px 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.66);
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 10px 26px rgba(170, 130, 200, 0.1);
}
.profile-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 12px 12px;
  margin-top: 6px;
  border-radius: 12px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 600;
  font-family: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s ease;
}
.profile-row:hover { background: rgba(249, 214, 231, 0.35); }
.btn-danger { color: #d84a4a; }
.btn-danger-outline { color: #d84a4a; border-color: rgba(216, 74, 74, 0.35); }
.plan-line { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 2px 0 12px; }
.plan-grade { font-size: 1.05rem; font-weight: 800; color: var(--gold); }
.plan-credit { font-size: 0.84rem; color: var(--muted); }
.btn-plan-subscribe { margin: 0; max-width: none; }
.btn-plan-subscribed { display: block; width: 100%; margin-top: 0; padding: 13px 20px; border-radius: 14px; text-align: center; font-weight: 700; color: var(--gold); background: rgba(255, 255, 255, 0.6); cursor: default; opacity: 0.9; }
.chat-timer { font-size: 0.82rem; color: var(--gold); font-weight: 700; }
.chat-messages {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  min-height: 320px;
  max-height: 52vh;
  overflow-y: auto;
  background: rgba(255, 255, 255, 0.55);
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.9);
}
.chat-msg { display: flex; flex-direction: column; max-width: 78%; }
.chat-msg.mine { align-self: flex-end; align-items: flex-end; }
.chat-msg.theirs { align-self: flex-start; align-items: flex-start; }
.chat-meta { font-size: 0.7rem; color: var(--muted); margin-bottom: 2px; }
.chat-bubble {
  padding: 9px 13px;
  border-radius: 14px;
  font-size: 0.92rem;
  line-height: 1.5;
  color: var(--text);
  background: #fff;
  box-shadow: 0 2px 8px rgba(170, 130, 200, 0.12);
  white-space: pre-wrap;
  word-break: break-word;
}
.chat-msg.mine .chat-bubble {
  background: linear-gradient(135deg, #f9bbd4, #dcc4f3);
  color: #4a3a5e;
}
.chat-typing-dots { display: flex; align-items: center; gap: 5px; min-width: 46px; min-height: 20px; }
.chat-typing-dots span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #c9b6dd;
  animation: typingBlink 1.2s infinite ease-in-out;
}
.chat-typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.chat-typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingBlink {
  0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-4px); }
}
.chat-input-row {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}
.chat-input {
  flex: 1;
  padding: 12px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fff;
  font-size: 0.95rem;
  outline: none;
}
.chat-input:focus { border-color: rgba(210, 170, 230, 0.9); }
.chat-input:disabled { background: #f3eef7; color: var(--muted); }
.btn-chat-send {
  padding: 0 20px;
  border: none;
  border-radius: 999px;
  font-size: 0.95rem;
  font-weight: 700;
  color: #4a3a5e;
  background: linear-gradient(135deg, #f9bbd4, #dcc4f3 55%, #bcdcf5);
  box-shadow: 0 6px 18px rgba(214, 150, 205, 0.32);
  cursor: pointer;
}
.btn-chat-send:disabled { opacity: 0.5; cursor: default; }
.btn-chat-image { padding: 0 16px; font-size: 1.2rem; border: 1px solid var(--border); border-radius: 999px; background: #fff; cursor: pointer; }
.btn-chat-end { color: #d84a4a; border-color: rgba(216, 74, 74, 0.4); font-size: 0.85rem; padding: 9px 14px; }
.btn-chat-refill { font-size: 0.85rem; padding: 9px 14px; }
.chat-bubble-img { padding: 4px; }
.chat-bubble-img img { max-width: 260px; max-height: 340px; border-radius: 10px; display: block; }
.chat-action { margin-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.chat-action .btn-primary,
.chat-action .btn-ghost {
  width: 100%;
  max-width: none;
  margin: 0;
  text-align: center;
}
.chat-waiting, .chat-ended {
  text-align: center;
  padding: 12px;
  border-radius: 12px;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.7);
  border: 1px dashed var(--border);
}
.dashboard-list { margin-top: 8px; display: flex; flex-direction: column; gap: 12px; }
.dashboard-sec-head { font-size: 1rem; font-weight: 800; color: var(--text); margin: 22px 0 4px; display: flex; align-items: center; gap: 8px; }
.dashboard-sec-head:first-of-type { margin-top: 6px; }
.inquiry-count { font-size: 0.72rem; font-weight: 700; color: #fff; background: #e0568f; border-radius: 999px; padding: 2px 9px; }
.inquiry-card {
  padding: 14px 16px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.66);
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 8px 20px rgba(170, 130, 200, 0.1);
}
.inquiry-card.done { opacity: 0.6; }
.inquiry-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.inquiry-title { font-weight: 700; color: var(--text); font-size: 0.95rem; }
.inquiry-meta { font-size: 0.76rem; color: var(--muted); margin-top: 2px; }
.inquiry-body { font-size: 0.88rem; color: var(--text); margin-top: 8px; white-space: pre-wrap; word-break: break-word; }
.inquiry-done-btn { margin-top: 10px; width: auto; padding: 7px 12px; font-size: 0.8rem; }
.inquiry-done-tag { font-size: 0.78rem; font-weight: 700; color: var(--muted); white-space: nowrap; }
.inquiry-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.inquiry-del-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: #b9a9c9;
  font-size: 0.95rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, color 0.15s ease;
}
.inquiry-del-btn:hover { background: rgba(216, 74, 74, 0.12); color: #d84a4a; }
.dashboard-empty, .dashboard-loading { color: var(--muted); text-align: center; padding: 30px 0; font-size: 0.9rem; }
.dashboard-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.66);
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 8px 20px rgba(170, 130, 200, 0.1);
}
.dashboard-info { min-width: 0; }
.dashboard-name { font-weight: 700; color: var(--text); font-size: 0.95rem; }
.dashboard-status { font-size: 0.8rem; color: var(--muted); margin-top: 2px; }
.dashboard-card .btn-pay { margin-top: 0; width: auto; padding: 9px 14px; font-size: 0.85rem; }
.dashboard-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.dashboard-close {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: #b9a9c9;
  font-size: 0.95rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, color 0.15s ease;
}
.dashboard-close:hover { background: rgba(216, 74, 74, 0.12); color: #d84a4a; }

/* 다시뽑기 페이드 전환 */
@keyframes redrawFade {
  from { opacity: 0; }
  to { opacity: 1; }
}
#view-reading.redraw-fade { animation: redrawFade 0.85s ease; }

/* 타로 뜻과 역사 - 마법책 UI */
.book {
  position: relative;
  width: 100%;
  max-width: 800px;
  margin: 30px auto 0;
  aspect-ratio: 3 / 2;
  perspective: 2400px;
}
.book::before {
  content: "";
  position: absolute;
  inset: -10px;
  border-radius: 22px;
  background: linear-gradient(135deg, #f6c8e0, #dcc4f3 50%, #bcdcf5);
  z-index: -1;
  box-shadow: 0 30px 70px rgba(150, 110, 190, 0.35);
}
.book::after {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 17px;
  border: 2px solid rgba(255, 255, 255, 0.85);
  pointer-events: none;
}
.book-pages {
  position: absolute;
  inset: 0;
  display: flex;
  border-radius: 13px;
  overflow: hidden;
  background: #fdf7fc;
  box-shadow: inset 0 0 44px rgba(200, 160, 220, 0.18);
}
.book-pages::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 30px;
  transform: translateX(-50%);
  background: linear-gradient(90deg, transparent, rgba(200, 160, 220, 0.4) 42%, rgba(180, 130, 210, 0.7) 50%, rgba(200, 160, 220, 0.4) 58%, transparent);
  z-index: 2;
  pointer-events: none;
}
.book-page { flex: 1 1 50%; position: relative; min-width: 0; overflow: hidden; }
.book-left { background: linear-gradient(180deg, #fffdf8, #fdf2fb); }
.book-right { background: #f7edf9; }
.book-img { width: 100%; height: 100%; object-fit: cover; display: block; transition: opacity 0.4s ease; }
.book-img.img-fade { opacity: 0; }
.book-content {
  position: absolute;
  inset: 0;
  padding: 34px 32px 46px;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  transition: opacity 0.35s ease;
}
.book-content h3 {
  font-size: 1.35rem;
  color: var(--gold);
  margin: 0 0 18px;
  font-family: Georgia, "Times New Roman", "Noto Serif KR", serif;
  text-align: center;
  letter-spacing: 0.5px;
}
.book-content h3::after {
  content: "";
  display: block;
  width: 46px;
  height: 2px;
  margin: 10px auto 0;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}
.book-text {
  font-size: 1.05rem;
  line-height: 1.95;
  color: var(--text);
  text-align: justify;
  font-family: "Noto Serif KR", Georgia, "Times New Roman", serif;
}
.book-text::first-letter {
  font-size: 2.5em;
  font-weight: 700;
  color: var(--gold);
  float: left;
  line-height: 0.85;
  margin: 6px 8px 0 0;
}
.book-ornament {
  position: absolute;
  color: rgba(199, 106, 158, 0.55);
  font-size: 0.9rem;
  z-index: 2;
  pointer-events: none;
}
.book-ornament-tl { top: 12px; left: 16px; }
.book-ornament-br { bottom: 10px; right: 16px; }
.book-page-num {
  position: absolute;
  bottom: 12px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 0.75rem;
  color: var(--muted);
  font-family: Georgia, serif;
  letter-spacing: 2px;
  z-index: 2;
}
.book-content.pre-fade { opacity: 0; }
.book-flip {
  position: absolute;
  top: 0;
  width: 50%;
  height: 100%;
  transform-style: preserve-3d;
  -webkit-transform-style: preserve-3d;
  z-index: 6;
  pointer-events: none;
  display: none;
  will-change: transform;
}
.book-flip.on-right { right: 0; transform-origin: left center; }
.book-flip.on-left { left: 0; transform-origin: right center; }
.book-flip-face { position: absolute; inset: 0; overflow: hidden; transition: opacity 0.15s ease; }
.book-flip-front { transform: rotateY(0deg) translateZ(1px); opacity: 1; }
.book-flip.on-right .book-flip-face { border-radius: 0 13px 13px 0; }
.book-flip.on-left .book-flip-face { border-radius: 13px 0 0 13px; }
.book-flip-front img { width: 100%; height: 100%; object-fit: cover; display: block; }
.book-flip-text {
  display: none;
  position: absolute;
  inset: 0;
  padding: 30px 26px;
  background: linear-gradient(180deg, #fffdf8, #fdf2fb);
  font-size: 0.98rem;
  line-height: 1.85;
  color: var(--text);
  text-align: justify;
  font-family: "Noto Serif KR", Georgia, serif;
}
.book-flip-front.is-text img { display: none; }
.book-flip-front.is-text .book-flip-text { display: block; }
.book-flip-back { transform: rotateY(180deg) translateZ(1px); opacity: 0; background: linear-gradient(180deg, #fdf7fc, #f7edf9); }
.book-flip.flip-fwd { display: block; animation: flipFwd 0.7s ease-in-out forwards; }
.book-flip.flip-back { display: block; animation: flipBack 0.7s ease-in-out forwards; }
@keyframes flipFwd {
  from { transform: rotateY(0deg); }
  to { transform: rotateY(-180deg); }
}
@keyframes flipBack {
  from { transform: rotateY(0deg); }
  to { transform: rotateY(180deg); }
}
.book-nav { display: flex; align-items: center; justify-content: center; gap: 18px; margin-top: 26px; }
.book-indicator { font-size: 0.9rem; color: var(--muted); font-weight: 700; letter-spacing: 2px; }
.book-nav button:disabled { opacity: 0.35; cursor: default; }
.book.book-open { animation: bookOpen 0.6s ease; }
@keyframes bookOpen {
  from { opacity: 0; transform: translateY(12px) scale(0.96); }
  to { opacity: 1; transform: none; }
}
@keyframes bookTurnMobile {
  0% { opacity: 0.4; }
  100% { opacity: 1; }
}
@media (max-width: 640px) {
  .book { aspect-ratio: auto; }
  .book-pages { position: relative; inset: auto; flex-direction: column; }
  .book-pages::before { display: none; }
  .book-page { flex: none; overflow: visible; }
  .book-right { order: -1; height: 300px; border-bottom: 1px solid rgba(200, 160, 220, 0.35); }
  .book-content { position: relative; padding: 24px 20px 42px; }
  .book-flip { display: none !important; }
  .book.turning-fwd .book-pages,
  .book.turning-back .book-pages { animation: bookTurnMobile 0.45s ease; }
}

/* ---------- 약관 / 개인정보처리방침 페이지 ---------- */
.legal-page { max-width: 760px; margin: 0 auto; padding: 20px 16px 64px; }
.legal-card {
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 30px 24px;
  word-break: keep-all;
}
.legal-card h1 { font-size: 1.55rem; color: var(--text); margin-bottom: 4px; }
.legal-meta { color: var(--muted); font-size: 0.85rem; margin-bottom: 8px; }
.legal-updated { color: var(--muted); font-size: 0.82rem; margin-bottom: 22px; }
.legal-card h2 { font-size: 1.08rem; color: var(--purple); margin: 28px 0 10px; padding-top: 4px; }
.legal-card h3 { font-size: 0.95rem; color: var(--gold); margin: 18px 0 6px; }
.legal-card p { font-size: 0.92rem; color: var(--text); margin-bottom: 8px; line-height: 1.75; }
.legal-card ul, .legal-card ol { padding-left: 20px; margin: 0 0 10px; }
.legal-card li { font-size: 0.92rem; color: var(--text); margin-bottom: 6px; line-height: 1.7; }
.legal-card table { width: 100%; border-collapse: collapse; margin: 8px 0 14px; font-size: 0.9rem; }
.legal-card th, .legal-card td { border: 1px solid var(--border); padding: 9px 10px; text-align: left; vertical-align: top; }
.legal-card th { background: rgba(249, 214, 231, 0.5); color: var(--gold); font-weight: 600; }
.legal-back { display: inline-block; margin-top: 22px; color: var(--purple); text-decoration: none; font-weight: 700; font-size: 0.98rem; }
.legal-back:hover { text-decoration: underline; }
