:root {
  --bg-dark: #070510;
  --bg-panel: rgba(20, 15, 38, 0.9);
  --bg-velvet: #120924;
  --gold: #d4af37;
  --gold-bright: #ffe27a;
  --gold-dim: #7d6523;
  --gold-glow: rgba(212, 175, 55, 0.45);
  --text-main: #f5f0e8;
  --text-muted: #b8b0cc;
  --rose-inv: #ff9e9e;
  --emerald-up: #7ee2b8;
  --card-w: clamp(82px, 24vw, 136px);
  --card-h: clamp(138px, 40vw, 230px);
}

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  background-color: var(--bg-dark);
  background-image:
    radial-gradient(ellipse at 50% 0%, rgba(95, 35, 155, 0.35) 0%, transparent 75%),
    radial-gradient(circle at 80% 85%, rgba(212, 175, 55, 0.1) 0%, transparent 55%),
    radial-gradient(circle at 20% 40%, rgba(50, 20, 90, 0.28) 0%, transparent 45%);
  color: var(--text-main);
  font-family: 'Spectral', Georgia, serif;
  font-size: 1.06rem;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}

/* Top Ritual Navigation & Stepper */
.top-nav {
  width: 100%;
  background: rgba(10, 7, 20, 0.92);
  border-bottom: 1px solid rgba(212, 175, 55, 0.25);
  backdrop-filter: blur(12px);
  padding: 0.6rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  position: sticky;
  top: 0;
  z-index: 500;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.brand-star {
  color: var(--gold-bright);
  font-size: 1.25rem;
  text-shadow: 0 0 10px var(--gold-glow);
}

.brand h1 {
  font-family: 'Cinzel Decorative', serif;
  font-size: clamp(1.18rem, 3.8vw, 1.48rem);
  color: var(--gold-bright);
  letter-spacing: 1.5px;
  text-shadow: 0 0 14px rgba(212, 175, 55, 0.4);
}

.stage-stepper {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-family: 'Cinzel', serif;
  font-size: clamp(0.82rem, 2.5vw, 0.9rem);
}

.step-pill {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.65rem;
  border-radius: 20px;
  color: var(--text-muted);
  border: 1px solid transparent;
  transition: all 0.3s ease;
}

.step-pill .step-num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
}

.step-pill.active {
  color: var(--gold-bright);
  border-color: var(--gold);
  background: rgba(212, 175, 55, 0.15);
  box-shadow: 0 0 12px rgba(212, 175, 55, 0.22);
}

.step-pill.active .step-num {
  background: var(--gold);
  color: #090612;
  font-weight: 700;
}

.step-pill.completed {
  color: var(--gold);
}

.step-pill.completed .step-num {
  background: rgba(212, 175, 55, 0.3);
  color: var(--gold-bright);
}

.step-divider {
  color: rgba(212, 175, 55, 0.35);
  font-size: 0.8rem;
}

/* Stage Container System */
.stage-view {
  display: none;
  width: 100%;
  flex: 1;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.stage-view.active {
  display: flex;
  flex-direction: column;
  align-items: center;
  opacity: 1;
  transform: translateY(0);
}

/* ==========================================
   STAGE 1: ENTRY POINT (INQUIRY & SETTINGS)
   ========================================== */
#stage-entry {
  justify-content: flex-start;
  padding: clamp(1.1rem, 3.5vw, 2.2rem) 0.9rem 3rem;
}

.sanctuary-hero {
  text-align: center;
  max-width: 640px;
  margin-bottom: clamp(1rem, 3vw, 1.5rem);
}

.sanctuary-emblem {
  font-size: clamp(1.8rem, 5vw, 2.3rem);
  color: var(--gold-bright);
  text-shadow: 0 0 24px var(--gold-glow);
  margin-bottom: 0.3rem;
  animation: floatSlow 4s ease-in-out infinite;
}

@keyframes floatSlow {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

.sanctuary-hero h2 {
  font-family: 'Cinzel Decorative', serif;
  font-size: clamp(1.55rem, 5.2vw, 2.35rem);
  color: var(--gold-bright);
  letter-spacing: 1.5px;
  margin-bottom: 0.45rem;
  line-height: 1.22;
  text-shadow: 0 0 20px rgba(212, 175, 55, 0.35);
}

.sanctuary-hero p {
  color: var(--text-muted);
  font-size: clamp(1.02rem, 3.2vw, 1.12rem);
  line-height: 1.55;
}

.entry-card {
  background: var(--bg-panel);
  border: 1px solid var(--gold-dim);
  border-radius: 16px;
  padding: clamp(1.15rem, 3.5vw, 2rem);
  width: 100%;
  max-width: 640px;
  backdrop-filter: blur(12px);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.7), inset 0 0 30px rgba(212, 175, 55, 0.05);
  display: flex;
  flex-direction: column;
  gap: 1.05rem;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.prompt-label {
  font-family: 'Cinzel', serif;
  font-size: clamp(1rem, 3vw, 1.08rem);
  color: var(--gold-bright);
  letter-spacing: 0.5px;
  line-height: 1.35;
}

.question-textarea {
  width: 100%;
  min-height: 86px;
  padding: 0.85rem 1rem;
  border-radius: 8px;
  background: rgba(8, 5, 16, 0.92);
  border: 1px solid rgba(212, 175, 55, 0.45);
  color: var(--text-main);
  font-size: 1.1rem;
  font-family: 'Spectral', serif;
  line-height: 1.5;
  resize: vertical;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.question-textarea:focus,
input[type="text"]:focus {
  border-color: var(--gold-bright);
  box-shadow: 0 0 14px rgba(212, 175, 55, 0.3);
}

/* Unified Expandable Accordions (Ideas, Spread Guide, AI Settings) */
.accordion-panel {
  border: 1px solid rgba(212, 175, 55, 0.28);
  border-radius: 10px;
  background: rgba(11, 8, 22, 0.68);
  overflow: hidden;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.accordion-panel[open] {
  border-color: rgba(212, 175, 55, 0.52);
  background: rgba(15, 11, 30, 0.88);
}

.accordion-panel summary {
  font-family: 'Cinzel', serif;
  font-size: clamp(0.95rem, 2.8vw, 1.02rem);
  color: var(--gold);
  padding: 0.8rem 1rem;
  cursor: pointer;
  user-select: none;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  line-height: 1.35;
}

.accordion-panel summary::-webkit-details-marker {
  display: none;
}

.accordion-panel summary::after {
  content: "▾";
  font-size: 1.05rem;
  color: var(--gold-bright);
  transition: transform 0.22s ease;
  flex-shrink: 0;
}

.accordion-panel[open] summary::after {
  transform: rotate(180deg);
}

.accordion-body {
  padding: 0.25rem 1rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

/* Expandable Question Ideas List */
.preset-list {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.preset-item {
  background: rgba(30, 21, 56, 0.75);
  border: 1px solid rgba(212, 175, 55, 0.3);
  border-radius: 8px;
  padding: 0.68rem 0.85rem;
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  transition: all 0.2s ease;
}

.preset-item:hover,
.preset-item:active {
  border-color: var(--gold-bright);
  background: rgba(212, 175, 55, 0.16);
}

.preset-item-title {
  font-family: 'Cinzel', serif;
  font-size: 0.86rem;
  color: var(--gold-bright);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.preset-item-question {
  font-family: 'Spectral', serif;
  font-size: 1.02rem;
  color: var(--text-main);
  line-height: 1.4;
}

.spread-preview-bar {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.5rem;
}

.spread-preview-item {
  text-align: center;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(212, 175, 55, 0.2);
  border-radius: 8px;
  padding: 0.5rem 0.35rem;
}

.spread-preview-item .sp-num {
  font-family: 'Cinzel', serif;
  font-size: 0.78rem;
  color: var(--gold);
  text-transform: uppercase;
}

.spread-preview-item .sp-name {
  font-family: 'Cinzel', serif;
  font-size: 0.96rem;
  color: var(--text-main);
  font-weight: 700;
  margin: 0.1rem 0;
}

.spread-preview-item .sp-sub {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.25;
}

.ai-settings-hint {
  font-size: 0.94rem;
  color: var(--text-muted);
  line-height: 1.45;
}

input[type="text"] {
  width: 100%;
  padding: 0.75rem 0.95rem;
  border-radius: 6px;
  background: rgba(8, 5, 16, 0.9);
  border: 1px solid rgba(212, 175, 55, 0.35);
  color: var(--text-main);
  font-size: 1.04rem;
  font-family: 'Spectral', serif;
  outline: none;
}

.masked-key-input {
  -webkit-text-security: disc;
  text-security: disc;
  letter-spacing: 1.5px;
}

.masked-key-input.unmasked {
  -webkit-text-security: none;
  text-security: none;
  letter-spacing: normal;
}

.api-row {
  display: flex;
  gap: 0.45rem;
  align-items: center;
}

.key-toggle-btn {
  background: rgba(24, 17, 44, 0.9);
  border: 1px solid var(--gold-dim);
  color: var(--gold);
  padding: 0.7rem 0.9rem;
  font-size: 1.05rem;
  border-radius: 6px;
  cursor: pointer;
}

.primary-gold-btn {
  width: 100%;
  max-width: 100%;
  background: linear-gradient(135deg, #9c6f19 0%, #d4af37 50%, #8c6214 100%);
  border: 1px solid var(--gold-bright);
  color: #0b0814;
  font-family: 'Cinzel', serif;
  font-weight: 700;
  padding: 0.95rem 1.1rem;
  border-radius: 8px;
  cursor: pointer;
  letter-spacing: 1px;
  text-transform: uppercase;
  font-size: clamp(0.94rem, 2.8vw, 1.05rem);
  line-height: 1.35;
  text-align: center;
  box-shadow: 0 6px 22px rgba(212, 175, 55, 0.3);
  transition: all 0.2s ease;
}

.primary-gold-btn:hover,
.primary-gold-btn:active {
  transform: translateY(-1px);
  filter: brightness(1.08);
  box-shadow: 0 8px 26px rgba(212, 175, 55, 0.48);
}

.secondary-btn {
  background: rgba(28, 20, 50, 0.88);
  border: 1px solid var(--gold-dim);
  color: var(--gold-bright);
  font-family: 'Cinzel', serif;
  font-size: clamp(0.86rem, 2.6vw, 0.94rem);
  padding: 0.58rem 0.85rem;
  border-radius: 6px;
  cursor: pointer;
  letter-spacing: 0.5px;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 0.35rem;
  max-width: 100%;
}

.secondary-btn:hover,
.secondary-btn:active {
  border-color: var(--gold-bright);
  background: rgba(212, 175, 55, 0.18);
}

/* ==========================================
   STAGE 2: VELVET TABLETOP & CARD DRAWING
   ========================================== */
#stage-draw {
  padding: 0.55rem 0.65rem 0.75rem;
  gap: 0.55rem;
  justify-content: space-between;
  height: calc(100dvh - 54px);
  max-height: calc(100dvh - 54px);
  overflow: hidden;
}

.table-hud {
  width: 100%;
  max-width: 1180px;
  background: rgba(18, 13, 34, 0.92);
  border: 1px solid rgba(212, 175, 55, 0.35);
  border-radius: 10px;
  padding: 0.6rem 0.9rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5);
  flex-shrink: 0;
}

.hud-prompt-info {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
  flex: 1;
}

.hud-target-title {
  font-family: 'Cinzel', serif;
  font-size: clamp(1rem, 3.2vw, 1.18rem);
  color: var(--gold-bright);
  line-height: 1.35;
}

.hud-target-desc {
  font-size: clamp(0.9rem, 2.2vw, 0.98rem);
  color: var(--text-muted);
  line-height: 1.35;
}

.hud-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

/* Velvet Tabletop Surface */
.velvet-table-wrapper {
  position: relative;
  width: 100%;
  max-width: 1180px;
  flex: 1;
  min-height: 200px;
  background:
    radial-gradient(circle at 50% 50%, rgba(58, 25, 98, 0.55) 0%, rgba(22, 10, 42, 0.92) 65%, #0b0516 100%);
  border: 1.5px solid rgba(212, 175, 55, 0.42);
  border-radius: 14px;
  box-shadow:
    inset 0 0 50px rgba(0, 0, 0, 0.9),
    0 8px 25px rgba(0, 0, 0, 0.65);
  overflow: hidden;
  user-select: none;
  touch-action: none;
}

.velvet-table-wrapper::before {
  content: "";
  position: absolute;
  inset: 12px;
  border: 1px dashed rgba(212, 175, 55, 0.14);
  border-radius: 10px;
  pointer-events: none;
}

.table-center-sigil {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 180px;
  height: 180px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 1px solid rgba(212, 175, 55, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  color: rgba(212, 175, 55, 0.08);
  font-size: 3.2rem;
  font-family: 'Cinzel Decorative', serif;
}

.table-hint-overlay {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(9, 6, 18, 0.86);
  border: 1px solid rgba(212, 175, 55, 0.28);
  padding: 0.3rem 0.85rem;
  border-radius: 999px;
  font-size: clamp(0.82rem, 2.4vw, 0.92rem);
  color: var(--text-muted);
  pointer-events: none;
  text-align: center;
  width: max-content;
  max-width: 94%;
  line-height: 1.25;
  z-index: 900;
}

/* Individual Physical Card on Velvet Table — Scales smoothly for mobile & desktop */
.table-card {
  position: absolute;
  width: clamp(46px, 12vw, 72px);
  height: clamp(78px, 20vw, 122px);
  left: 0;
  top: 0;
  border-radius: 5px;
  border: 1.5px solid var(--gold);
  background-color: #160f29;
  background-size: cover;
  background-position: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.78);
  cursor: grab;
  touch-action: none;
  will-change: transform;
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.table-card.dealing {
  transition: transform 0.6s cubic-bezier(0.2, 0.85, 0.25, 1), opacity 0.4s ease;
}

.table-card:hover:not(.dragging) {
  border-color: var(--gold-bright);
  box-shadow: 0 0 15px rgba(212, 175, 55, 0.75), 0 6px 16px rgba(0, 0, 0, 0.85);
}

.table-card.dragging {
  cursor: grabbing;
  border-color: #fff3b0;
  box-shadow: 0 18px 32px rgba(0, 0, 0, 0.92), 0 0 22px rgba(255, 226, 122, 0.85);
  transition: none !important;
}

.table-card.drawn-away {
  opacity: 0;
  pointer-events: none;
  transition: transform 0.35s ease, opacity 0.3s ease !important;
}

/* Bottom 5-Slot Drawn Tray — Always 5 columns so it fits on mobile without scrolling */
.drawn-tray {
  width: 100%;
  max-width: 1180px;
  background: rgba(16, 11, 30, 0.94);
  border: 1px solid rgba(212, 175, 55, 0.35);
  border-radius: 12px;
  padding: 0.5rem 0.55rem;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.45rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.65);
  flex-shrink: 0;
  transition: border-color 0.25s, box-shadow 0.25s;
}

.drawn-tray.drop-hover {
  border-color: var(--gold-bright);
  box-shadow: 0 0 24px rgba(212, 175, 55, 0.6);
}

.tray-slot {
  background: rgba(9, 6, 18, 0.78);
  border: 1px dashed rgba(212, 175, 55, 0.3);
  border-radius: 8px;
  padding: 0.45rem 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 76px;
  position: relative;
  transition: all 0.22s ease;
  overflow: hidden;
}

.tray-slot.active-target {
  border: 1.5px solid var(--gold-bright);
  background: rgba(212, 175, 55, 0.12);
  box-shadow: 0 0 14px rgba(212, 175, 55, 0.25);
}

.tray-slot.filled {
  border: 1px solid var(--gold);
  background: rgba(26, 18, 48, 0.88);
  cursor: pointer;
}

.tray-slot.filled:hover {
  border-color: var(--gold-bright);
}

.tray-thumb {
  width: 38px;
  height: 62px;
  border-radius: 4px;
  border: 1px solid var(--gold-dim);
  background: #0d0818;
  flex-shrink: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Cinzel', serif;
  color: var(--gold);
  font-size: 0.9rem;
  font-weight: 700;
}

.tray-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.tray-thumb.inverted img {
  transform: rotate(180deg);
}

.tray-meta {
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  min-width: 0;
  flex: 1;
}

.tray-pos-label {
  font-family: 'Cinzel', serif;
  font-size: 0.78rem;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tray-card-name {
  font-family: 'Cinzel', serif;
  font-size: 0.9rem;
  color: var(--text-main);
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tray-status {
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tray-status.inv {
  color: var(--rose-inv);
  font-style: italic;
}

.tray-status.up {
  color: var(--emerald-up);
}

/* ==========================================
   SPOTLIGHT REVEAL OVERLAY MODAL
   ========================================== */
.spotlight-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 3, 12, 0.88);
  backdrop-filter: blur(10px);
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0.75rem;
  opacity: 0;
  transition: opacity 0.28s ease;
}

.spotlight-overlay.open {
  display: flex;
  opacity: 1;
}

.spotlight-dialog {
  background: linear-gradient(145deg, rgba(28, 19, 52, 0.98) 0%, rgba(13, 9, 26, 0.99) 100%);
  border: 1.5px solid var(--gold);
  border-radius: 16px;
  max-width: 620px;
  width: 100%;
  max-height: 92dvh;
  overflow: hidden;
  padding: 0;
  box-shadow: 0 25px 70px rgba(0, 0, 0, 0.92), 0 0 36px rgba(212, 175, 55, 0.25);
  display: flex;
  flex-direction: column;
}

.spotlight-scroll-body {
  flex: 1;
  overflow-y: auto;
  padding: clamp(1rem, 3.5vw, 1.65rem);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.spotlight-sticky-footer {
  flex-shrink: 0;
  padding: 0.75rem clamp(1rem, 3.5vw, 1.65rem);
  background: rgba(12, 8, 24, 0.97);
  border-top: 1px solid rgba(212, 175, 55, 0.35);
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.6);
}

.spotlight-top-layout {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-areas:
    "card badge"
    "card header";
  gap: 0.55rem clamp(1rem, 3vw, 1.5rem);
  align-items: center;
}

/* 3D Flip Card inside Spotlight */
.spotlight-card-stage {
  grid-area: card;
  width: clamp(140px, 24vw, 175px);
  height: clamp(236px, 40vw, 296px);
  perspective: 1200px;
  flex-shrink: 0;
}

.spotlight-card-inner {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

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

.spotlight-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  border-radius: 10px;
  border: 2px solid var(--gold-bright);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.85);
  overflow: hidden;
  background: #100b1e;
}

.spotlight-back {
  background-size: cover;
  background-position: center;
}

.spotlight-front {
  transform: rotateY(180deg);
}

.spotlight-front img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.spotlight-front.inverted img {
  transform: rotate(180deg);
}

.spotlight-header-block {
  grid-area: header;
  align-self: start;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.45rem;
  min-width: 0;
}

.spotlight-details {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.spotlight-position-badge {
  grid-area: badge;
  justify-self: start;
  align-self: end;
  display: inline-flex;
  align-items: center;
  font-family: 'Cinzel', serif;
  font-size: clamp(0.8rem, 2.4vw, 0.88rem);
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--gold-bright);
  background: rgba(212, 175, 55, 0.15);
  border: 1px solid rgba(212, 175, 55, 0.45);
  padding: 0.3rem 0.8rem;
  border-radius: 999px;
}

.spotlight-card-title {
  font-family: 'Cinzel Decorative', serif;
  font-size: clamp(1.35rem, 4.5vw, 1.8rem);
  color: var(--gold-bright);
  line-height: 1.2;
}

.orientation-pill {
  font-family: 'Cinzel', serif;
  font-size: 0.84rem;
  padding: 0.24rem 0.65rem;
  border-radius: 6px;
  font-weight: 700;
  letter-spacing: 0.5px;
  display: inline-flex;
  align-items: center;
}

.orientation-pill.upright {
  background: rgba(46, 160, 115, 0.2);
  border: 1px solid var(--emerald-up);
  color: var(--emerald-up);
}

.orientation-pill.inverted {
  background: rgba(195, 65, 65, 0.22);
  border: 1px solid var(--rose-inv);
  color: var(--rose-inv);
}

.spotlight-arcana-sub {
  font-size: 0.96rem;
  color: var(--text-muted);
}

.spotlight-action-btn {
  width: 100%;
  padding: 0.9rem 1rem;
  font-size: clamp(0.92rem, 2.8vw, 1rem);
}

.spotlight-meaning-box {
  background: rgba(10, 7, 20, 0.78);
  border: 1px solid rgba(212, 175, 55, 0.3);
  border-left: 4px solid var(--gold-bright);
  border-radius: 8px;
  padding: 0.95rem 1.05rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.spotlight-meaning-label {
  font-family: 'Cinzel', serif;
  font-size: 0.86rem;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.spotlight-meaning-text {
  font-size: clamp(1.08rem, 3vw, 1.16rem);
  color: #f8f4ff;
  line-height: 1.5;
  font-weight: 600;
}

.spotlight-context-text {
  font-size: clamp(0.98rem, 2.8vw, 1.04rem);
  color: var(--text-muted);
  line-height: 1.55;
}

.spotlight-dual-meanings {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.7rem;
  font-size: 0.95rem;
  line-height: 1.45;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 8px;
  padding: 0.8rem 0.9rem;
}

.dual-col strong {
  display: block;
  font-family: 'Cinzel', serif;
  font-size: 0.84rem;
  margin-bottom: 0.2rem;
}

.dual-col.up-col strong { color: var(--emerald-up); }
.dual-col.inv-col strong { color: var(--rose-inv); }

/* ==========================================
   STAGE 3: 5-CARD CROSS & AI READING
   ========================================== */
#stage-reading {
  padding: 0.9rem 0.75rem 3.5rem;
  gap: 1.2rem;
}

.reading-stage-bar {
  width: 100%;
  max-width: 900px;
  background: rgba(18, 13, 34, 0.9);
  border: 1px solid rgba(212, 175, 55, 0.35);
  border-radius: 12px;
  padding: 0.85rem 1.05rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.7rem;
}

.querent-banner-text {
  min-width: 0;
  flex: 1 1 220px;
}

.stage3-nav-btns {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.querent-banner-label {
  font-family: 'Cinzel', serif;
  font-size: 0.82rem;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.querent-banner-question {
  font-size: clamp(1.08rem, 3.2vw, 1.25rem);
  color: var(--gold-bright);
  font-style: italic;
  line-height: 1.35;
}

/* 5-Card Cross Grid */
.cross-showcase {
  width: 100%;
  max-width: 900px;
  background: radial-gradient(ellipse at center, rgba(44, 22, 76, 0.45) 0%, rgba(13, 8, 24, 0.82) 100%);
  border: 1px solid rgba(212, 175, 55, 0.3);
  border-radius: 14px;
  padding: 1.15rem 0.5rem;
  box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.75);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.cross-showcase-hint {
  font-size: clamp(0.88rem, 2.5vw, 0.96rem);
  color: var(--text-muted);
  margin-bottom: 0.9rem;
  text-align: center;
  padding: 0 0.5rem;
  line-height: 1.35;
}

.cross-grid {
  display: grid;
  grid-template-columns: repeat(3, var(--card-w));
  grid-template-rows: repeat(3, auto);
  gap: 0.65rem clamp(0.45rem, 2.5vw, 1.5rem);
  justify-content: center;
  align-items: start;
}

.cross-grid.spread-5 #slot-4 { grid-column: 2; grid-row: 1; } /* Card 5 - Potential (Top) */
.cross-grid.spread-5 #slot-1 { grid-column: 1; grid-row: 2; } /* Card 2 - Present (Left) */
.cross-grid.spread-5 #slot-0 { grid-column: 2; grid-row: 2; } /* Card 1 - Past (Center) */
.cross-grid.spread-5 #slot-2 { grid-column: 3; grid-row: 2; } /* Card 3 - Future (Right) */
.cross-grid.spread-5 #slot-3 { grid-column: 2; grid-row: 3; } /* Card 4 - Causes (Bottom) */

.cross-grid.spread-3 {
  grid-template-columns: repeat(3, var(--card-w));
  grid-template-rows: auto;
}

.cross-grid.spread-1 {
  grid-template-columns: var(--card-w);
  grid-template-rows: auto;
}

.preset-item.active-spread {
  border-color: var(--gold-bright);
  background: linear-gradient(135deg, rgba(64, 38, 108, 0.72) 0%, rgba(28, 18, 52, 0.92) 100%);
  box-shadow: 0 0 14px rgba(212, 175, 55, 0.25);
}

.spread-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.spread-slot:hover {
  transform: translateY(-3px);
}

.slot-meta {
  margin-bottom: 0.3rem;
}

.slot-number {
  font-family: 'Cinzel', serif;
  font-size: clamp(0.74rem, 2.1vw, 0.8rem);
  color: var(--gold);
  letter-spacing: 0.8px;
  text-transform: uppercase;
}

.slot-title {
  font-family: 'Cinzel', serif;
  font-size: clamp(0.88rem, 2.6vw, 0.98rem);
  color: var(--text-main);
  font-weight: 700;
}

.card-frame {
  width: var(--card-w);
  height: var(--card-h);
  perspective: 1000px;
  position: relative;
}

.card-inner {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.75s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  border-radius: 7px;
}

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

.card-face {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border-radius: 7px;
  border: 1.5px solid var(--gold);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.75);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #110d20;
}

.card-back {
  background-size: cover;
  background-position: center;
}

.card-front {
  transform: rotateY(180deg);
  background: #000;
}

.card-front img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.card-front.inverted img {
  transform: rotate(180deg);
}

.card-caption {
  margin-top: 0.35rem;
  font-size: clamp(0.84rem, 2.4vw, 0.94rem);
  color: var(--gold-bright);
  font-weight: 600;
  line-height: 1.2;
}

.inv-tag {
  display: block;
  font-size: 0.76rem;
  color: var(--rose-inv);
  font-style: italic;
  font-weight: normal;
  margin-top: 0.1rem;
}

/* Reading Output Box */
.reading-output {
  width: 100%;
  max-width: 900px;
  background: rgba(18, 14, 34, 0.95);
  border: 1px solid var(--gold);
  border-radius: 16px;
  padding: clamp(1.15rem, 3.8vw, 2.2rem);
  box-shadow: 0 12px 45px rgba(0, 0, 0, 0.8);
  line-height: 1.72;
  overflow: hidden;
}

.reading-header {
  border-bottom: 1px solid var(--gold-dim);
  padding-bottom: 0.85rem;
  margin-bottom: 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.reading-title-group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.reading-header h2 {
  font-family: 'Cinzel Decorative', serif;
  color: var(--gold-bright);
  font-size: clamp(1.28rem, 4vw, 1.55rem);
}

.reading-header-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.reading-meta-tag {
  font-size: 0.82rem;
  color: var(--gold);
  border: 1px solid var(--gold-dim);
  padding: 0.24rem 0.65rem;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.35);
}

.overall-summary-box {
  background: linear-gradient(135deg, rgba(62, 33, 94, 0.52) 0%, rgba(30, 18, 56, 0.85) 100%);
  border: 1px solid var(--gold);
  border-left: 5px solid var(--gold-bright);
  border-radius: 10px;
  padding: 1.05rem 1.2rem;
  margin-bottom: 1.45rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.overall-summary-box h3 {
  font-family: 'Cinzel', serif;
  color: var(--gold-bright);
  font-size: 1.12rem;
  margin-bottom: 0.45rem;
}

.overall-summary-box p {
  color: #f7f3ff;
  font-size: clamp(1.04rem, 2.8vw, 1.12rem);
  line-height: 1.65;
  margin: 0;
}

.reading-content h3 {
  font-family: 'Cinzel', serif;
  color: var(--gold);
  margin-top: 1.35rem;
  margin-bottom: 0.35rem;
  font-size: 1.14rem;
  border-bottom: 1px solid rgba(212, 175, 55, 0.18);
  padding-bottom: 0.25rem;
}

.reading-content p {
  color: #dfd7ee;
  font-size: clamp(1.04rem, 2.8vw, 1.1rem);
  margin-bottom: 1rem;
  line-height: 1.68;
}

/* Follow-Up Question Thread & Form */
.followup-section {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px dashed rgba(212, 175, 55, 0.35);
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
}

.followup-thread {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.followup-exchange {
  background: rgba(26, 17, 48, 0.72);
  border: 1px solid rgba(212, 175, 55, 0.35);
  border-left: 4px solid var(--gold);
  border-radius: 10px;
  padding: 0.95rem 1.15rem;
}

.followup-q-badge {
  font-family: 'Cinzel', serif;
  font-size: 0.92rem;
  color: var(--gold-bright);
  margin-bottom: 0.45rem;
  font-weight: 600;
}

.followup-a-body p {
  color: #dfd7ee;
  font-size: clamp(1.02rem, 2.8vw, 1.08rem);
  margin-bottom: 0.75rem;
  line-height: 1.65;
}

.followup-a-body p:last-child {
  margin-bottom: 0;
}

.followup-form {
  background: rgba(12, 8, 24, 0.65);
  border: 1px solid rgba(212, 175, 55, 0.3);
  border-radius: 12px;
  padding: 0.95rem 1.05rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.followup-label {
  font-family: 'Cinzel', serif;
  font-size: 0.94rem;
  color: var(--gold-bright);
  letter-spacing: 0.4px;
}

.followup-input-row {
  display: flex;
  gap: 0.6rem;
  align-items: stretch;
}

.followup-input {
  flex: 1;
  min-width: 0;
  background: rgba(8, 5, 18, 0.9);
  border: 1px solid var(--gold-dim);
  border-radius: 8px;
  padding: 0.68rem 0.9rem;
  color: var(--text-main);
  font-family: 'Spectral', serif;
  font-size: 1.02rem;
}

.followup-input:focus {
  outline: none;
  border-color: var(--gold-bright);
  box-shadow: 0 0 10px rgba(212, 175, 55, 0.25);
}

.followup-submit-btn {
  width: auto;
  padding: 0.68rem 1.25rem;
  font-size: 0.95rem;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Bottom Action Bar in Stage 3 — Clean 2-col grid so buttons never overflow */
.reading-footer-actions {
  margin-top: 1.75rem;
  padding-top: 1.1rem;
  border-top: 1px solid rgba(212, 175, 55, 0.25);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.6rem;
  width: 100%;
}

.reading-footer-actions .footer-span-full {
  grid-column: 1 / -1;
}

.api-status-banner {
  padding: 0.8rem 1rem;
  border-radius: 8px;
  margin-bottom: 1.1rem;
  font-size: 0.96rem;
  display: none;
}

.api-status-banner.error {
  display: block;
  background: rgba(180, 40, 40, 0.22);
  border: 1px solid #ff6b6b;
  color: #ffd2d2;
}

.oracle-waiting-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem 1rem;
  gap: 0.55rem;
}

.oracle-spinner {
  font-size: 1.9rem;
  color: var(--gold-bright);
  animation: spinPulse 2.6s ease-in-out infinite;
  line-height: 1;
}

.loading-pulse {
  display: inline-block;
  animation: pulse 1.6s infinite;
  color: var(--gold-bright);
  font-family: 'Cinzel', serif;
  font-size: 1.12rem;
  font-weight: 600;
}

.oracle-waiting-sub {
  color: var(--text-muted);
  font-size: 0.98rem;
  font-style: italic;
}

@keyframes spinPulse {
  0% { transform: rotate(0deg) scale(0.92); opacity: 0.65; }
  50% { transform: rotate(180deg) scale(1.12); opacity: 1; }
  100% { transform: rotate(360deg) scale(0.92); opacity: 0.65; }
}

@keyframes pulse {
  0%, 100% { opacity: 0.35; }
  50% { opacity: 1; }
}

/* ==========================================
   MOBILE & SMALL SCREEN OPTIMIZATIONS
   ========================================== */
@media (max-width: 720px) {
  .spread-preview-bar {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Stack the Stage 2 HUD so the Draw Title gets 100% width and buttons sit neatly below */
  .table-hud {
    flex-direction: column;
    align-items: stretch;
    padding: 0.55rem 0.75rem;
    gap: 0.45rem;
  }

  .hud-prompt-info {
    text-align: center;
  }

  .hud-target-desc {
    display: none;
  }

  .hud-controls {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.45rem;
    width: 100%;
  }

  /* Compact vertical mini-slots in the 5-card tray so all 5 fit horizontally on phones */
  .tray-slot {
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 0.4rem 0.2rem;
    gap: 0.22rem;
    min-height: 84px;
  }

  .tray-thumb {
    width: 32px;
    height: 52px;
  }

  .tray-pos-label {
    font-size: 0.72rem;
  }

  .tray-card-name {
    font-size: 0.78rem;
    white-space: normal;
    line-height: 1.15;
    max-width: 100%;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }

  .tray-status {
    display: none;
  }

  .stage3-nav-btns {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr;
  }

  .reading-header-actions {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr;
  }

  .followup-input-row {
    flex-direction: column;
  }

  .followup-submit-btn {
    width: 100%;
  }

  /* On mobile/narrow screens: Badge on top -> Large Card in middle -> Title & Orientation underneath */
  .spotlight-top-layout {
    grid-template-columns: 1fr;
    grid-template-areas:
      "badge"
      "card"
      "header";
    justify-items: center;
    text-align: center;
    gap: 0.75rem;
  }

  .spotlight-position-badge {
    justify-self: center;
    align-self: center;
  }

  .spotlight-card-stage {
    width: min(56vw, 33dvh);
    height: calc(min(56vw, 33dvh) * 1.7);
  }

  .spotlight-header-block {
    align-items: center;
    text-align: center;
  }

  .spotlight-dual-meanings {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 440px) {
  .step-label-text {
    display: none;
  }
}
