/* ===================================================================
   tarot.css  —  타로 '전용' 스타일만 (포털 공통은 portal.css)
   =================================================================== */

.tarot-head { text-align: center; margin-bottom: 4px; }
.tarot-head h1 {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin: 0 0 4px;
}
.tarot-head .tarot-date {
  font-size: 13px;
  color: var(--text-dim);
}
.tarot-head .tarot-date b { color: var(--app-accent); font-weight: 700; }

/* ---------- 모드 탭 (오늘의 카드 / 3장 스프레드) ---------- */
.tarot-tabs {
  display: flex;
  gap: 6px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px;
  margin: 16px auto 22px;
}
.tarot-tabs button {
  flex: 1;
  min-height: 40px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text-dim);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.tarot-tabs button.is-active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 0 rgba(255,255,255,.06) inset;
}
.tarot-tabs button:disabled { opacity: .4; cursor: default; }

/* ---------- 카드 무대 ---------- */
.card-stage {
  perspective: 1400px;
  width: min(72vw, 268px);
  margin: 0 auto;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  display: block;
}
.card-stage:disabled { cursor: default; }

.card {
  position: relative;
  width: 100%;
  aspect-ratio: 300 / 500;
  transform-style: preserve-3d;
  transition: transform .85s cubic-bezier(.2,.75,.25,1);
}
.card.is-flipped { transform: rotateY(180deg); }

.card__face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 14px 34px rgba(0,0,0,.55);
}
.card__face--front { transform: rotateY(180deg); }
.card__face .card-svg { display: block; width: 100%; height: 100%; }

/* 역방향이면 그림을 뒤집는다 (해설 글자는 아래에 똑바로 나온다) */
.card__face--front.is-reversed .card-svg { transform: rotate(180deg); }

/* 뽑기 전 살짝 떠 있는 느낌 */
.card-stage:not(.is-done) .card { animation: floaty 3.4s ease-in-out infinite; }
@keyframes floaty {
  0%, 100% { translate: 0 0; }
  50%      { translate: 0 -7px; }
}

.card-hint {
  text-align: center;
  margin: 16px 0 0;
  font-size: 14px;
  color: var(--text-dim);
}

/* ---------- 결과 ---------- */
.result { margin-top: 24px; }
.result[hidden] { display: none; }

.result__top { text-align: center; }
.result__badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .04em;
  padding: 4px 11px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--text-dim);
}
.result__badge.is-reversed {
  color: #ffb4b4;
  border-color: #6b3350;
  background: rgba(120,40,70,.25);
}
.result__name {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin: 10px 0 2px;
}
.result__name-en {
  font-family: Georgia, serif;
  font-size: 12px;
  letter-spacing: .16em;
  color: var(--app-accent);
  opacity: .85;
  text-transform: uppercase;
}

.keywords {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}
.keywords li {
  font-size: 13px;
  padding: 5px 11px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--text);
}

.reading {
  margin-top: 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 16px;
}
.reading__headline {
  font-size: 17px;
  font-weight: 700;
  line-height: 1.5;
  margin: 0 0 10px;
  color: var(--text);
}
.reading__body {
  font-size: 15px;
  margin: 0;
  color: #cfd2ee;
}
.reading__advice {
  margin: 16px 0 0;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
  font-size: 14.5px;
  color: var(--text);
}
.reading__advice b { color: var(--app-accent); }

.result__actions {
  display: flex;
  gap: 8px;
  margin-top: 18px;
}
.result__actions .pt-btn { flex: 1; }

/* ---------- 오류 (file:// 로 열었을 때 등) ---------- */
.tarot-error[hidden] { display: none; }
.tarot-error {
  border: 1px solid #6b3350;
  background: rgba(120,40,70,.2);
  border-radius: var(--radius);
  padding: 16px;
  font-size: 14px;
}
.tarot-error h2 { margin: 0 0 8px; font-size: 16px; }
.tarot-error code {
  background: #0b0e1a;
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--app-accent);
}

@media (min-width: 760px) {
  .card-stage { width: 300px; }
  .tarot-head h1 { font-size: 26px; }
}

/* ===================================================================
   [M3] 3장 스프레드 · 공유
   =================================================================== */

/* 친구 링크로 들어왔을 때 맨 위에 뜨는 배너 (바이럴 진입점) */
.shared-banner[hidden] { display: none; }
.shared-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 18px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--app-accent);
  border-radius: var(--radius);
  background: var(--surface);
}
.shared-banner p { margin: 0; font-size: 13.5px; color: var(--text); }
.shared-banner .pt-btn { min-height: 40px; padding: 0 14px; font-size: 13px; flex: 0 0 auto; }

/* ---------- 카드 세 장 ---------- */
.spread-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  align-items: start;
}
.spread-slot__label {
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-dim);
  margin-bottom: 6px;
  letter-spacing: .02em;
}
.card-stage--small { width: 100%; }
.card-stage--small .card__face { border-radius: 10px; box-shadow: 0 8px 18px rgba(0,0,0,.5); }

/* ---------- 흐름 한 줄 요약 ---------- */
.spread-flow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 0 0 20px;
  padding: 12px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-soft);
  font-size: 14px;
  color: var(--text-dim);
}
.spread-flow b { color: var(--text); font-weight: 700; }
.spread-flow i { font-style: normal; color: #ffb4b4; font-size: 11px; margin-left: 2px; }
.spread-flow em { font-style: normal; color: var(--app-accent); }

/* ---------- 카드별 해설 ---------- */
.reading-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
}
.reading-card__head {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 14px;
}
.reading-card__thumb { flex: 0 0 56px; width: 56px; }
.reading-card__thumb .card-svg {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 6px;
}
.reading-card__thumb .is-reversed .card-svg { transform: rotate(180deg); }
.reading-card__pos {
  font-size: 12px;
  font-weight: 700;
  color: var(--app-accent);
  letter-spacing: .04em;
}
.reading-card__name {
  margin: 2px 0 0;
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}
.reading-card__badge {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--text-dim);
}
.reading-card__badge.is-reversed {
  color: #ffb4b4;
  border-color: #6b3350;
  background: rgba(120,40,70,.25);
}
.keywords--tight { justify-content: flex-start; margin-top: 8px; }
.keywords--tight li { font-size: 12px; padding: 3px 8px; }
.reading-card .reading__headline { font-size: 16px; }
.reading-card .reading__body { font-size: 14.5px; }

/* ---------- 공유 ---------- */
.share-note[hidden] { display: none; }
.share-note {
  margin: 10px 0 0;
  font-size: 13px;
  color: var(--text-dim);
  text-align: center;
  word-break: break-all;
}

@media (min-width: 760px) {
  .spread-row { gap: 14px; }
  .reading-card__thumb { flex-basis: 72px; width: 72px; }
}

/* 한 바퀴 진행도 — 반복을 없앤 것을 재방문 이유로 보여준다 */
.cycle-note {
  display: inline-block;
  margin-top: 5px;
  font-size: 12px;
  color: var(--text-dim);
  opacity: .9;
}
.cycle-note b { color: var(--app-accent); }

/* ===================================================================
   [2026-09-17] 한 장씩 뒤집기 — 누르기 전과 후를 눈에 띄게 다르게
   =================================================================== */

/* 안 뒤집은 카드: 떠 있고, 금빛 테가 은은하게 숨 쉰다 = 누르고 싶게 */
.card-stage--small:not(.is-done) .card {
  animation: floaty 3.4s ease-in-out infinite;
}
.card-stage--small:not(.is-done) .card__face--back {
  box-shadow: 0 8px 18px rgba(0,0,0,.5), 0 0 0 0 rgba(255,209,102,.5);
  animation: waiting 2.6s ease-in-out infinite;
}
@keyframes waiting {
  0%, 100% { box-shadow: 0 8px 18px rgba(0,0,0,.5), 0 0 0 0 rgba(255,209,102,.45); }
  50%      { box-shadow: 0 8px 22px rgba(0,0,0,.55), 0 0 14px 2px rgba(255,209,102,.3); }
}
/* 슬롯마다 숨 쉬는 박자를 어긋나게 — 셋이 같이 뛰면 기계 같다 */
.spread-slot:nth-child(2) .card-stage--small:not(.is-done) .card__face--back { animation-delay: .5s; }
.spread-slot:nth-child(3) .card-stage--small:not(.is-done) .card__face--back { animation-delay: 1s; }
.spread-slot:nth-child(2) .card-stage--small:not(.is-done) .card { animation-delay: .4s; }
.spread-slot:nth-child(3) .card-stage--small:not(.is-done) .card { animation-delay: .8s; }

/* 뒤집은 카드는 조용해진다 */
.card-stage--small.is-done .card { animation: none; }
.card-stage--small.is-done .card__face { box-shadow: 0 8px 18px rgba(0,0,0,.5); }

/* 카드 아래 안내 — 누르기 전엔 '눌러서 펼치기', 뒤집으면 카드 이름 */
.spread-slot__cue {
  text-align: center;
  margin-top: 7px;
  font-size: 11px;
  line-height: 1.35;
  color: var(--app-accent);
  opacity: .75;
  min-height: 2.4em;
}
.card-stage--small.is-done ~ .spread-slot__cue {
  color: var(--text);
  opacity: 1;
  font-weight: 700;
}

/* 진행 상황 문구 */
#spread-hint b { color: var(--app-accent); }

/* 해설이 한 장씩 나타날 때 슥 올라오게 */
#spread-readings .reading-card { animation: rise .45s ease-out both; }
@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}
#spread-summary .spread-flow { animation: rise .45s ease-out both; margin-top: 4px; }

/* 오늘의 카드도 누르기 전엔 금빛이 숨 쉰다 (스프레드와 같은 신호)
   ⚠ 큰 카드는 그림자가 더 깊어서 키프레임을 따로 둔다 */
.card-stage:not(.card-stage--small):not(.is-done) .card__face--back {
  animation: waitingBig 2.6s ease-in-out infinite;
}
@keyframes waitingBig {
  0%, 100% { box-shadow: 0 14px 34px rgba(0,0,0,.55), 0 0 0 0 rgba(255,209,102,.4); }
  50%      { box-shadow: 0 14px 38px rgba(0,0,0,.6), 0 0 22px 3px rgba(255,209,102,.28); }
}
