/* ============ TAROT — MYSTICAL THEME ============ */

.tarot-page {
  background: linear-gradient(170deg, #0d0b2e 0%, #141038 40%, #1a1040 70%, #0d0b2e 100%);
  color: #d4c5b0;
  overflow: hidden;
  position: relative;
}
.tarot-page::before {
  content: '';
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 600px 400px at 30% 20%, rgba(100,80,160,0.08) 0%, transparent 70%),
    radial-gradient(ellipse 500px 300px at 70% 70%, rgba(80,60,140,0.06) 0%, transparent 70%);
  pointer-events: none; z-index: 0;
}

/* ── Back button ── */
.tarot-back {
  position: fixed; top: 16px; left: 16px; z-index: 90;
  width: 36px; height: 36px; border-radius: 50%;
  background: rgba(255,255,255,0.06);
  backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  text-decoration: none;
  border: 1px solid rgba(196,168,130,0.12);
}
.tarot-back svg {
  width: 16px; height: 16px; fill: none;
  stroke: rgba(196,168,130,0.6); stroke-width: 1.5;
  stroke-linecap: round; stroke-linejoin: round;
}

/* ── Scenes ── */
.t-scene {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  opacity: 0; pointer-events: none;
  transition: opacity 0.5s ease, transform 0.5s ease;
  transform: translateY(12px);
  z-index: 1;
  overflow: hidden;
}
.t-scene.active {
  opacity: 1; pointer-events: auto;
  transform: translateY(0);
  z-index: 2;
}

/* ── Common elements ── */
.t-header {
  text-align: center;
  padding: 60px 24px 24px;
  flex-shrink: 0;
}
.t-step {
  font-family: 'EB Garamond', serif;
  font-size: 10px; letter-spacing: 4px;
  color: rgba(196,168,130,0.5);
  margin-bottom: 12px;
}
.t-scene-title {
  font-family: 'Noto Serif SC', serif;
  font-size: 22px; font-weight: 300;
  color: #e0d4c4; letter-spacing: 2px;
  margin-bottom: 8px;
}
.t-scene-sub {
  font-size: 12px; font-weight: 300;
  color: rgba(196,168,130,0.5);
  letter-spacing: 1px;
}

.t-back-link {
  display: flex; align-items: center; gap: 4px;
  justify-content: center;
  padding: 16px; margin-top: auto;
  font-family: 'EB Garamond', serif;
  font-size: 13px; letter-spacing: 1px;
  color: rgba(196,168,130,0.4);
  background: none; border: none; cursor: pointer;
  flex-shrink: 0;
  padding-bottom: calc(16px + var(--safe-bottom));
}

/* Buttons */
.t-btn {
  display: block; width: 200px; margin: 0 auto;
  padding: 12px 0; border-radius: 24px;
  font-family: 'Noto Serif SC', serif;
  font-size: 14px; letter-spacing: 2px;
  cursor: pointer; border: none;
  transition: all 0.3s;
}
.t-btn-gold {
  background: linear-gradient(135deg, #c4a882, #a8906a);
  color: #1a1040;
  box-shadow: 0 4px 20px rgba(196,168,130,0.25);
}
.t-btn-gold:active { transform: scale(0.97); }
.t-btn-ghost {
  background: none;
  color: rgba(196,168,130,0.5);
  border: 1px solid rgba(196,168,130,0.15);
  margin-top: 12px;
}
.t-btn-ghost:active { background: rgba(196,168,130,0.05); }

/* ============ WELCOME ============ */
.tw-stars {
  position: absolute; inset: 0;
  z-index: 0; pointer-events: none;
}

.tw-content {
  position: relative; z-index: 2;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  flex: 1; padding: 80px 24px 40px;
  text-align: center;
}

.tw-moon {
  width: 80px; height: 80px;
  margin-bottom: 28px;
  animation: moonFloat 6s ease-in-out infinite;
}
@keyframes moonFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.tw-en-top {
  font-family: 'EB Garamond', serif;
  font-size: 9px; letter-spacing: 6px;
  text-transform: uppercase;
  color: rgba(196,168,130,0.35);
  margin-bottom: 12px;
  animation: glTextIn 0.8s ease 0.2s both;
}

.tw-title {
  font-family: 'Noto Serif SC', serif;
  font-size: 28px; font-weight: 300;
  color: #e8ddd0; letter-spacing: 4px;
  line-height: 1.6; margin-bottom: 6px;
  animation: glTextIn 0.8s ease 0.4s both;
}
.tw-title span {
  font-family: 'Cormorant Garamond', serif;
  font-size: 20px; font-weight: 300;
  letter-spacing: 6px;
  color: rgba(196,168,130,0.7);
}

.tw-en-bottom {
  font-family: 'Pinyon Script', cursive;
  font-size: 18px;
  color: rgba(196,168,130,0.4);
  margin-bottom: 16px;
  animation: glTextIn 0.8s ease 0.6s both;
}

@keyframes glTextIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.tw-sub {
  font-size: 12px; font-weight: 300;
  color: rgba(196,168,130,0.45);
  line-height: 2; letter-spacing: 1.5px;
  margin-bottom: 24px;
  animation: glTextIn 0.8s ease 0.8s both;
}

.tw-ornament {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 32px;
}
.tw-line {
  width: 40px; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(196,168,130,0.3), transparent);
}

/* Floating decorative cards */
.tw-floating-cards {
  position: absolute; inset: 0;
  pointer-events: none; z-index: 1;
  overflow: hidden;
}
.tw-fcard {
  position: absolute;
  width: 52px; height: 78px;
  border-radius: 5px;
  background: linear-gradient(145deg, #1e1650, #140e38);
  border: 1px solid rgba(196,168,130,0.15);
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}
.tw-fcard::before {
  content: '';
  position: absolute; inset: 4px;
  border: 0.5px solid rgba(196,168,130,0.1);
  border-radius: 3px;
}
.tw-fcard::after {
  content: '✦';
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; color: rgba(196,168,130,0.15);
}
.tw-fcard-1 {
  top: 15%; right: -8px;
  transform: rotate(15deg);
  animation: fcard1 8s ease-in-out infinite;
}
.tw-fcard-2 {
  bottom: 22%; left: -6px;
  transform: rotate(-12deg);
  animation: fcard2 9s ease-in-out infinite;
}
.tw-fcard-3 {
  top: 35%; left: 8%;
  transform: rotate(-25deg);
  opacity: 0.5;
  animation: fcard3 7s ease-in-out infinite;
}
@keyframes fcard1 {
  0%, 100% { transform: rotate(15deg) translateY(0); }
  50% { transform: rotate(18deg) translateY(-10px); }
}
@keyframes fcard2 {
  0%, 100% { transform: rotate(-12deg) translateY(0); }
  50% { transform: rotate(-15deg) translateY(-8px); }
}
@keyframes fcard3 {
  0%, 100% { transform: rotate(-25deg) translateY(0); opacity: 0.5; }
  50% { transform: rotate(-22deg) translateY(-6px); opacity: 0.6; }
}

/* ============ TOPIC SELECTION ============ */
.tt-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 0 24px;
  flex: 1; overflow-y: auto;
  align-content: start;
  -webkit-overflow-scrolling: touch;
}

.tt-card {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(196,168,130,0.1);
  border-radius: 14px;
  padding: 20px 14px;
  text-align: center; cursor: pointer;
  transition: all 0.3s;
  position: relative; overflow: hidden;
}
.tt-card::before {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at 50% 30%, rgba(196,168,130,0.05) 0%, transparent 70%);
  opacity: 0; transition: opacity 0.3s;
}
.tt-card:active::before { opacity: 1; }
.tt-card:active {
  transform: scale(0.97);
  border-color: rgba(196,168,130,0.3);
}

.tt-icon {
  font-size: 24px;
  color: rgba(196,168,130,0.5);
  margin-bottom: 10px;
  line-height: 1;
}
.tt-name {
  font-size: 14px; font-weight: 400;
  color: #e0d4c4;
  letter-spacing: 1px;
  margin-bottom: 4px;
}
.tt-desc {
  font-size: 10px; font-weight: 300;
  color: rgba(196,168,130,0.4);
  letter-spacing: 0.5px;
}

/* ============ SPREAD SELECTION ============ */
.tsp-list {
  padding: 0 24px;
  flex: 1; overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.tsp-card {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(196,168,130,0.1);
  border-radius: 14px;
  padding: 20px;
  margin-bottom: 14px;
  cursor: pointer;
  transition: all 0.3s;
  position: relative;
}
.tsp-card:active {
  transform: scale(0.98);
  border-color: rgba(196,168,130,0.3);
}

.tsp-top {
  display: flex; align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.tsp-name {
  font-size: 16px; font-weight: 400;
  color: #e0d4c4; letter-spacing: 1px;
}
.tsp-count {
  font-family: 'EB Garamond', serif;
  font-size: 11px; letter-spacing: 2px;
  color: rgba(196,168,130,0.4);
}
.tsp-desc {
  font-size: 12px; font-weight: 300;
  color: rgba(196,168,130,0.45);
  line-height: 1.6; letter-spacing: 0.5px;
}
.tsp-layout {
  display: flex; gap: 6px;
  margin-top: 14px; justify-content: center;
}
.tsp-slot {
  width: 24px; height: 36px;
  border-radius: 3px;
  border: 1px solid rgba(196,168,130,0.2);
  background: rgba(196,168,130,0.04);
}
.tsp-slot-label {
  font-size: 8px; text-align: center;
  color: rgba(196,168,130,0.3);
  margin-top: 4px;
  font-family: 'EB Garamond', serif;
  letter-spacing: 0.5px;
}

/* ============ DRAW ============ */
.td-top {
  text-align: center;
  padding: 60px 24px 16px;
  flex-shrink: 0;
}
.td-hint {
  font-size: 13px; font-weight: 300;
  color: rgba(196,168,130,0.5);
  letter-spacing: 1px;
  margin-bottom: 8px;
}
.td-counter {
  font-family: 'EB Garamond', serif;
  font-size: 12px; letter-spacing: 2px;
  color: rgba(196,168,130,0.35);
}

.td-area {
  flex: 1;
  position: relative;
  overflow: hidden;
  padding: 0 12px;
}

.td-selected {
  display: flex; gap: 8px;
  justify-content: center;
  padding: 12px 24px calc(20px + var(--safe-bottom));
  min-height: 70px;
  flex-shrink: 0;
}

/* Card fan */
.td-fan-card {
  position: absolute;
  width: 56px; height: 84px;
  border-radius: 5px;
  cursor: pointer;
  transition: transform 0.3s ease, box-shadow 0.3s;
  transform-origin: bottom center;
}
.td-fan-card:hover,
.td-fan-card:active {
  z-index: 10 !important;
  filter: brightness(1.2);
}
.td-fan-card.picked {
  transition: all 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
  opacity: 0; pointer-events: none;
}

/* Card back pattern */
.card-back-face {
  width: 100%; height: 100%;
  border-radius: 5px;
  background: linear-gradient(145deg, #1e1650 0%, #140e38 50%, #1a1248 100%);
  border: 1.5px solid rgba(196,168,130,0.25);
  position: relative; overflow: hidden;
  box-shadow: 0 2px 12px rgba(0,0,0,0.3);
}
.card-back-face::before {
  content: '';
  position: absolute; inset: 5px;
  border: 0.5px solid rgba(196,168,130,0.15);
  border-radius: 3px;
}
.card-back-face::after {
  content: '';
  position: absolute; inset: 8px;
  border: 0.5px solid rgba(196,168,130,0.08);
  border-radius: 2px;
  background:
    radial-gradient(circle at 50% 50%, rgba(196,168,130,0.06) 0%, transparent 60%);
}
.card-back-star {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  z-index: 1;
}
.card-back-star svg {
  width: 20px; height: 20px;
}

/* Corner ornaments on card back */
.card-back-corner {
  position: absolute; width: 8px; height: 8px; z-index: 1;
}
.card-back-corner svg { width: 100%; height: 100%; }
.card-back-corner.tl { top: 10px; left: 10px; }
.card-back-corner.tr { top: 10px; right: 10px; transform: rotate(90deg); }
.card-back-corner.bl { bottom: 10px; left: 10px; transform: rotate(-90deg); }
.card-back-corner.br { bottom: 10px; right: 10px; transform: rotate(180deg); }

/* Mini selected card in draw scene */
.td-mini-card {
  width: 40px; height: 60px;
  border-radius: 4px;
  border: 1px solid rgba(196,168,130,0.2);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  font-size: 8px; color: rgba(196,168,130,0.5);
  background: rgba(196,168,130,0.05);
  animation: miniIn 0.4s ease;
}
.td-mini-card .mini-glyph {
  font-size: 14px; margin-bottom: 2px;
}
@keyframes miniIn {
  from { opacity: 0; transform: scale(0.5) translateY(-10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

/* ============ RESULT ============ */
.tr-scroll {
  flex: 1; overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 60px 24px calc(24px + var(--safe-bottom));
}

.tr-head {
  text-align: center;
  margin-bottom: 28px;
}
.tr-badge {
  font-family: 'EB Garamond', serif;
  font-size: 10px; letter-spacing: 3px;
  color: rgba(196,168,130,0.4);
  margin-bottom: 8px;
}
.tr-title {
  font-family: 'Noto Serif SC', serif;
  font-size: 20px; font-weight: 300;
  color: #e0d4c4; letter-spacing: 2px;
}

.tr-cards-row {
  display: flex; gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

/* Result card */
.tr-card {
  width: 90px;
  text-align: center;
  animation: trCardIn 0.6s ease both;
}
.tr-card:nth-child(2) { animation-delay: 0.15s; }
.tr-card:nth-child(3) { animation-delay: 0.3s; }
.tr-card:nth-child(4) { animation-delay: 0.45s; }
.tr-card:nth-child(5) { animation-delay: 0.6s; }

@keyframes trCardIn {
  from { opacity: 0; transform: translateY(20px) rotateY(90deg); }
  60% { transform: translateY(0) rotateY(-5deg); }
  to { opacity: 1; transform: translateY(0) rotateY(0); }
}

.tr-card-face {
  width: 90px; height: 135px;
  border-radius: 7px;
  position: relative; overflow: hidden;
  margin: 0 auto 8px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}
.tr-card-face.reversed {
  transform: rotate(180deg);
}
.tr-card-inner {
  width: 100%; height: 100%;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 10px 6px;
  position: relative;
}
.tr-card-inner::before {
  content: '';
  position: absolute; inset: 4px;
  border: 0.5px solid rgba(196,168,130,0.2);
  border-radius: 4px;
}
.tr-card-inner::after {
  content: '';
  position: absolute; inset: 7px;
  border: 0.5px solid rgba(196,168,130,0.08);
  border-radius: 3px;
}

.tr-card-numeral {
  font-family: 'Cormorant Garamond', serif;
  font-size: 10px; font-weight: 400;
  color: rgba(196,168,130,0.6);
  letter-spacing: 2px;
  margin-bottom: 6px;
  position: relative; z-index: 1;
}
.tr-card-glyph {
  font-size: 32px;
  line-height: 1;
  margin-bottom: 8px;
  position: relative; z-index: 1;
  filter: drop-shadow(0 0 8px rgba(196,168,130,0.3));
}
.tr-card-name-cn {
  font-size: 12px; font-weight: 400;
  letter-spacing: 2px;
  color: rgba(255,255,255,0.8);
  position: relative; z-index: 1;
}
.tr-card-name-en {
  font-family: 'EB Garamond', serif;
  font-size: 8px; font-style: italic;
  color: rgba(196,168,130,0.4);
  letter-spacing: 1px;
  margin-top: 2px;
  position: relative; z-index: 1;
}

.tr-card-label {
  font-size: 10px;
  color: rgba(196,168,130,0.5);
  letter-spacing: 1px;
  margin-bottom: 4px;
}
.tr-card-orient {
  font-family: 'EB Garamond', serif;
  font-size: 9px;
  color: rgba(196,168,130,0.35);
  letter-spacing: 1px;
}

/* Interpretation */
.tr-interp {
  min-height: 100px;
  margin-bottom: 24px;
}

.tr-loading {
  text-align: center;
  padding: 32px 0;
}
.tr-orb {
  width: 40px; height: 40px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 40%,
    rgba(196,168,130,0.2) 0%,
    rgba(100,80,160,0.15) 50%,
    transparent 70%
  );
  border: 1px solid rgba(196,168,130,0.15);
  animation: orbPulse 2s ease-in-out infinite;
}
@keyframes orbPulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 20px rgba(196,168,130,0.1); }
  50% { transform: scale(1.1); box-shadow: 0 0 30px rgba(196,168,130,0.2); }
}
.tr-loading p {
  font-size: 13px; font-weight: 300;
  color: rgba(196,168,130,0.45);
  letter-spacing: 1px;
}

.tr-text {
  font-size: 14px; font-weight: 300;
  line-height: 2; letter-spacing: 0.5px;
  color: rgba(212,197,176,0.85);
  white-space: pre-wrap;
}

.tr-actions {
  text-align: center;
  padding: 8px 0 16px;
}

/* ============ CHAT ============ */
.tc-bar {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px;
  padding-top: calc(14px + env(safe-area-inset-top, 0px));
  border-bottom: 1px solid rgba(196,168,130,0.08);
  flex-shrink: 0;
}
.tc-bar-back {
  background: none; border: none;
  color: rgba(196,168,130,0.5);
  cursor: pointer; padding: 4px;
}
.tc-bar-title {
  font-size: 14px; font-weight: 400;
  color: #e0d4c4; letter-spacing: 1px;
}

.tc-msgs {
  flex: 1; overflow-y: auto;
  padding: 16px;
  -webkit-overflow-scrolling: touch;
  display: flex; flex-direction: column;
  gap: 12px;
}

.tc-msg {
  max-width: 80%;
  padding: 12px 16px;
  border-radius: 14px;
  font-size: 13px; font-weight: 300;
  line-height: 1.8; letter-spacing: 0.3px;
  animation: msgIn 0.3s ease;
}
@keyframes msgIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.tc-msg-user {
  align-self: flex-end;
  background: rgba(196,168,130,0.12);
  border: 1px solid rgba(196,168,130,0.15);
  color: #e0d4c4;
}
.tc-msg-ai {
  align-self: flex-start;
  background: rgba(100,80,160,0.1);
  border: 1px solid rgba(100,80,160,0.12);
  color: rgba(212,197,176,0.85);
  white-space: pre-wrap;
}
.tc-msg-system {
  align-self: center;
  font-size: 11px;
  color: rgba(196,168,130,0.35);
  text-align: center;
  letter-spacing: 1px;
  padding: 4px 12px;
}

.tc-thinking {
  align-self: flex-start;
  padding: 12px 18px;
  display: flex; gap: 5px;
}
.tc-thinking span {
  width: 5px; height: 5px; border-radius: 50%;
  background: rgba(196,168,130,0.3);
  animation: dotPulse 1.2s ease-in-out infinite;
}
.tc-thinking span:nth-child(2) { animation-delay: 0.2s; }
.tc-thinking span:nth-child(3) { animation-delay: 0.4s; }
@keyframes dotPulse {
  0%, 60%, 100% { opacity: 0.3; transform: scale(0.8); }
  30% { opacity: 1; transform: scale(1.1); }
}

.tc-input-row {
  display: flex; gap: 8px;
  padding: 12px 16px calc(12px + var(--safe-bottom));
  border-top: 1px solid rgba(196,168,130,0.08);
  flex-shrink: 0;
}
.tc-input {
  flex: 1; padding: 10px 16px;
  border-radius: 20px;
  border: 1px solid rgba(196,168,130,0.15);
  background: rgba(255,255,255,0.04);
  color: #e0d4c4;
  font-family: 'Noto Serif SC', serif;
  font-size: 13px; outline: none;
}
.tc-input::placeholder { color: rgba(196,168,130,0.3); }
.tc-input:focus { border-color: rgba(196,168,130,0.3); }

.tc-send {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: rgba(196,168,130,0.15);
  border: 1px solid rgba(196,168,130,0.2);
  color: rgba(196,168,130,0.6);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; flex-shrink: 0;
  transition: all 0.2s;
}
.tc-send:active {
  background: rgba(196,168,130,0.25);
  transform: scale(0.95);
}

/* ============ TAROT CARD FACE COLORS ============ */

/* Major Arcana gradient backgrounds */
.card-bg-major {
  background: linear-gradient(160deg, var(--card-c1) 0%, var(--card-c2) 100%);
}
.card-bg-wands {
  background: linear-gradient(160deg, #3a1818 0%, #5a2020 50%, #3a1818 100%);
}
.card-bg-cups {
  background: linear-gradient(160deg, #142040 0%, #1a3060 50%, #142040 100%);
}
.card-bg-swords {
  background: linear-gradient(160deg, #1a1a24 0%, #2a2a3a 50%, #1a1a24 100%);
}
.card-bg-pentacles {
  background: linear-gradient(160deg, #142014 0%, #1a3a1a 50%, #142014 100%);
}

