/* ==========================================================================
   TAROT MÍSTICO & ARCANOS - ESTILOS PRINCIPALES
   ========================================================================== */

:root {
  --bg-deep: #060609;
  --bg-surface: #0f0e15;
  --bg-card: #15141f;
  --bg-glass: rgba(18, 16, 26, 0.78);
  --bg-glass-strong: rgba(13, 11, 20, 0.92);

  --gold: #e8c464;
  --gold-light: #fff0b3;
  --gold-dark: #8c6a1e;
  --gold-border: rgba(232, 196, 100, 0.35);
  --gold-glow: rgba(232, 196, 100, 0.28);

  --ink: #1e1509;
  --text-main: #f5f3ec;
  --text-muted: #a69e90;
  --text-gold: #edd285;
  --accent-purple: #7948b8;
  --accent-red: #c2413a;
  --accent-blue: #3b82f6;

  --font-serif: "Cormorant Garamond", Georgia, serif;
  --font-display: "Cinzel", "Cormorant Garamond", serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  --card-w: 160px;
  --card-ratio: 5 / 8;
  --radius-card: 12px;
  --radius-panel: 16px;
  --trans-smooth: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  --trans-bounce: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

html, body {
  width: 100%;
  min-height: 100%;
  background-color: var(--bg-deep);
  color: var(--text-main);
  font-family: var(--font-serif);
  font-size: 17px;
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Fondo Místico con Nebulosa y Estrellas */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background: 
    radial-gradient(circle at 50% 20%, rgba(76, 40, 115, 0.22) 0%, transparent 55%),
    radial-gradient(circle at 85% 75%, rgba(184, 134, 30, 0.12) 0%, transparent 45%),
    radial-gradient(ellipse at 50% 100%, #151120 0%, var(--bg-deep) 70%);
  pointer-events: none;
  z-index: -2;
}

#canvas-stars {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  opacity: 0.65;
}

/* ==========================================================================
   HEADER Y NAVEGACIÓN
   ========================================================================== */
.header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(8, 7, 12, 0.85);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(232, 196, 100, 0.18);
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  text-decoration: none;
}

.brand-icon {
  width: 34px;
  height: 34px;
  filter: drop-shadow(0 0 8px rgba(232, 196, 100, 0.5));
}

.brand-text h1 {
  font-family: var(--font-display);
  font-size: 1.3rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  background: linear-gradient(135deg, #fff0b3 0%, #e8c464 50%, #ab822e 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin: 0;
  font-weight: 700;
}

.brand-text p {
  font-size: 0.75rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-top: -2px;
}

.nav-tabs {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(255, 255, 255, 0.04);
  padding: 0.3rem;
  border-radius: 40px;
  border: 1px solid rgba(232, 196, 100, 0.15);
}

.tab-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-display);
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  padding: 0.45rem 1rem;
  border-radius: 30px;
  cursor: pointer;
  transition: var(--trans-smooth);
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.tab-btn:hover {
  color: var(--gold-light);
  background: rgba(232, 196, 100, 0.08);
}

.tab-btn.active {
  background: linear-gradient(135deg, rgba(232, 196, 100, 0.25) 0%, rgba(140, 106, 30, 0.3) 100%);
  color: var(--gold-light);
  border: 1px solid rgba(232, 196, 100, 0.4);
  box-shadow: 0 0 14px rgba(232, 196, 100, 0.2);
}

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

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid rgba(232, 196, 100, 0.2);
  background: rgba(255, 255, 255, 0.03);
  color: var(--gold);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--trans-smooth);
}

.icon-btn:hover {
  background: rgba(232, 196, 100, 0.15);
  box-shadow: 0 0 10px rgba(232, 196, 100, 0.3);
  transform: translateY(-2px);
}

/* ==========================================================================
   CONTENEDOR DE VISTAS (SPA)
   ========================================================================== */
.main-view {
  display: none;
  width: 100%;
  max-width: 1300px;
  margin: 0 auto;
  padding: 1.5rem;
  min-height: calc(100vh - 75px);
}

.main-view.active {
  display: block;
  animation: fadeIn 0.4s ease-out;
}

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

/* ==========================================================================
   VISTA 1: EL ALTAR DE TIRADAS (3D RITUAL)
   ========================================================================== */
.altar-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.8rem;
  position: relative;
}

/* Selector de Tiradas */
.spread-modes {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
  width: 100%;
  max-width: 900px;
}

.mode-card {
  flex: 1 1 170px;
  background: rgba(21, 20, 31, 0.65);
  border: 1px solid rgba(232, 196, 100, 0.18);
  border-radius: var(--radius-panel);
  padding: 0.9rem 1rem;
  cursor: pointer;
  transition: var(--trans-smooth);
  text-align: center;
  backdrop-filter: blur(8px);
  position: relative;
  overflow: hidden;
}

.mode-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 0%, rgba(232, 196, 100, 0.15), transparent 70%);
  opacity: 0;
  transition: opacity 0.3s;
}

.mode-card:hover {
  border-color: rgba(232, 196, 100, 0.45);
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.mode-card:hover::before {
  opacity: 1;
}

.mode-card.active {
  border-color: var(--gold);
  background: rgba(36, 31, 48, 0.75);
  box-shadow: 0 0 20px rgba(232, 196, 100, 0.25);
}

.mode-icon {
  font-size: 1.6rem;
  margin-bottom: 0.3rem;
  display: block;
}

.mode-title {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--gold-light);
  letter-spacing: 0.05em;
  margin-bottom: 0.2rem;
}

.mode-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.25;
}

/* Barra de Intención / Pregunta */
.intention-box {
  width: 100%;
  max-width: 680px;
  position: relative;
  display: flex;
  align-items: center;
}

.intention-input {
  width: 100%;
  background: rgba(16, 14, 24, 0.8);
  border: 1px solid rgba(232, 196, 100, 0.25);
  border-radius: 30px;
  padding: 0.75rem 1.5rem;
  font-family: var(--font-serif);
  font-size: 1.05rem;
  font-style: italic;
  color: var(--text-main);
  outline: none;
  transition: var(--trans-smooth);
}

.intention-input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 16px rgba(232, 196, 100, 0.25);
  background: rgba(22, 19, 33, 0.9);
}

.intention-input::placeholder {
  color: #7d7568;
}

/* ==========================================================================
   ESCENARIO 3D DEL MAZO Y ALTAR
   ========================================================================== */
.stage-3d {
  position: relative;
  width: 100%;
  max-width: 960px;
  min-height: 380px;
  perspective: 1200px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}

/* Partículas mágicas de interacción */
.fx-layer {
  position: absolute;
  left: 50%;
  top: 45%;
  width: 0;
  height: 0;
  pointer-events: none;
  z-index: 20;
}

.fx-sparkle {
  position: absolute;
  width: var(--s, 6px);
  height: var(--s, 6px);
  margin: -3px;
  background: #fff8d6;
  border-radius: 50%;
  box-shadow: 0 0 10px 2px rgba(232, 196, 100, 0.9);
}

.fx-sparkle.star {
  border-radius: 0;
  clip-path: polygon(50% 0, 60% 40%, 100% 50%, 60% 60%, 50% 100%, 40% 60%, 0 50%, 40% 40%);
}

/* El Altar Místico (Pedestal base) */
.altar-pedestal {
  position: absolute;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  width: min(85vw, 440px);
  height: 100px;
  pointer-events: none;
  z-index: 1;
}

.altar-glow {
  position: absolute;
  left: 50%;
  top: 5px;
  transform: translateX(-50%);
  width: 90%;
  height: 45px;
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(232, 196, 100, 0.5) 0%, transparent 70%);
  animation: altarPulse 4s ease-in-out infinite;
}

@keyframes altarPulse {
  0%, 100% { opacity: 0.35; transform: translateX(-50%) scale(0.92); }
  50% { opacity: 0.65; transform: translateX(-50%) scale(1.05); }
}

.altar-disk {
  position: absolute;
  inset: 10px 0 0 0;
  border-radius: 50%;
  background: radial-gradient(ellipse at 50% 40%, #2f2a3a 0%, #15131c 70%, #0a090e 100%);
  border: 1px solid rgba(232, 196, 100, 0.4);
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.8), inset 0 0 25px rgba(232, 196, 100, 0.2);
}

.altar-disk::before {
  content: "";
  position: absolute;
  inset: 12px 14%;
  border-radius: 50%;
  border: 1px dashed rgba(232, 196, 100, 0.45);
}

/* El Mazo 3D Apilado */
.deck-3d-wrapper {
  position: relative;
  z-index: 5;
  transform-style: preserve-3d;
  cursor: pointer;
  transition: transform 0.6s cubic-bezier(0.2, 0.8, 0.3, 1);
  margin-bottom: 25px;
}

.deck-stack {
  position: relative;
  width: var(--card-w);
  aspect-ratio: var(--card-ratio);
  transform-style: preserve-3d;
  animation: deckFloat 5s ease-in-out infinite;
}

@keyframes deckFloat {
  0%, 100% { transform: translateY(0px) rotateX(16deg) rotateY(-8deg); }
  50% { transform: translateY(-14px) rotateX(20deg) rotateY(4deg); }
}

/* Capas simulando grosor de 78 cartas */
.deck-layer {
  position: absolute;
  inset: 0;
  border-radius: var(--radius-card);
  background: linear-gradient(135deg, #1b1710, #362912);
  border: 1px solid rgba(232, 196, 100, 0.3);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
  pointer-events: none;
}

.deck-layer:nth-child(1) { transform: translateZ(-3px) translateY(2px); }
.deck-layer:nth-child(2) { transform: translateZ(-6px) translateY(4px); }
.deck-layer:nth-child(3) { transform: translateZ(-9px) translateY(6px); }
.deck-layer:nth-child(4) { transform: translateZ(-12px) translateY(8px); }
.deck-layer:nth-child(5) { transform: translateZ(-15px) translateY(10px); }

/* Carta superior del mazo */
.deck-top-card {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: var(--radius-card);
  overflow: hidden;
  box-shadow: 
    0 15px 35px rgba(0, 0, 0, 0.7),
    0 0 25px rgba(232, 196, 100, 0.35),
    inset 0 0 0 1px rgba(255, 240, 180, 0.6);
  background: linear-gradient(145deg, #7d5d18, #e9c866 28%, #fff1b8 48%, #c9983a 68%, #6f5114);
}

.card-back-design {
  position: absolute;
  inset: 7px;
  border: 1.5px solid rgba(56, 38, 6, 0.85);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at 50% 50%, rgba(255, 245, 200, 0.35) 0%, transparent 75%);
}

.card-back-svg {
  width: 82%;
  opacity: 0.9;
  filter: drop-shadow(0 0 2px rgba(255, 255, 255, 0.4));
}

/* Efecto Foil Holográfico */
.foil-glare {
  position: absolute;
  inset: 0;
  pointer-events: none;
  mix-blend-mode: color-dodge;
  opacity: 0.5;
  background: 
    radial-gradient(circle at var(--mx, 50%) var(--my, 50%), rgba(255, 255, 255, 0.95), transparent 45%),
    conic-gradient(from calc(var(--mx, 50%) * 3.6deg) at var(--mx, 50%) var(--my, 50%), #ff7ad9, #7af0ff, #fff59a, #9aff9a, #ff7ad9);
  transition: opacity 0.3s;
}

/* ==========================================================================
   BOTONES DE RITUAL (BARAJAR, CORTAR, ABANICO)
   ========================================================================== */
.ritual-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
  margin-top: 1rem;
  z-index: 10;
  flex-wrap: wrap;
}

.ritual-btn {
  background: linear-gradient(135deg, rgba(35, 30, 48, 0.9) 0%, rgba(20, 17, 28, 0.95) 100%);
  border: 1px solid var(--gold-border);
  color: var(--gold-light);
  font-family: var(--font-display);
  font-size: 0.9rem;
  letter-spacing: 0.08em;
  padding: 0.65rem 1.25rem;
  border-radius: 30px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: var(--trans-smooth);
  backdrop-filter: blur(8px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
}

.ritual-btn:hover {
  border-color: var(--gold);
  background: linear-gradient(135deg, rgba(50, 42, 68, 0.95) 0%, rgba(30, 25, 42, 0.95) 100%);
  box-shadow: 0 0 18px rgba(232, 196, 100, 0.3);
  transform: translateY(-2px);
}

.ritual-btn:active {
  transform: translateY(1px);
}

.ritual-btn.primary {
  background: linear-gradient(135deg, #8c6a1e 0%, #caa038 50%, #e8c464 100%);
  color: #1a1205;
  font-weight: 700;
  border: none;
  box-shadow: 0 4px 20px rgba(232, 196, 100, 0.4);
}

.ritual-btn.primary:hover {
  background: linear-gradient(135deg, #a67e24 0%, #dbb042 50%, #fff0b3 100%);
  box-shadow: 0 0 25px rgba(232, 196, 100, 0.6);
}

/* ==========================================================================
   DESPLIEGUE EN ABANICO 3D (FAN RIBBON)
   ========================================================================== */
.fan-container {
  display: none;
  width: 100%;
  max-width: 1100px;
  position: relative;
  z-index: 15;
  flex-direction: column;
  align-items: center;
  margin-top: 1rem;
}

.fan-container.active {
  display: flex;
  animation: fadeIn 0.5s ease-out;
}

.fan-instructions {
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: var(--gold-light);
  letter-spacing: 0.08em;
  text-align: center;
  margin-bottom: 1.5rem;
  text-shadow: 0 0 12px rgba(232, 196, 100, 0.4);
}

.fan-scroll-track {
  width: 100%;
  overflow-x: auto;
  overflow-y: visible;
  padding: 40px 20px 30px 20px;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: -35px; /* Overlap cards */
  scrollbar-width: thin;
  scrollbar-color: var(--gold-dark) transparent;
  perspective: 1000px;
}

.fan-scroll-track::-webkit-scrollbar {
  height: 6px;
}

.fan-scroll-track::-webkit-scrollbar-thumb {
  background: var(--gold-dark);
  border-radius: 3px;
}

.fan-card {
  flex: 0 0 100px;
  height: 160px;
  border-radius: 8px;
  position: relative;
  cursor: pointer;
  transform-style: preserve-3d;
  transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.3, 1), box-shadow 0.25s;
  margin-right: -48px;
  box-shadow: -4px 4px 12px rgba(0, 0, 0, 0.6);
  user-select: none;
}

.fan-card:hover {
  transform: translateY(-28px) scale(1.15) rotateZ(0deg) !important;
  z-index: 50 !important;
  box-shadow: 0 12px 28px rgba(232, 196, 100, 0.4);
}

.fan-card.picked {
  opacity: 0;
  pointer-events: none;
  transform: translateY(-100px) scale(0.5);
  transition: all 0.5s ease-in;
}

/* ==========================================================================
   TAPETE DE TIRADA (SPREAD MAT & SLOTS)
   ========================================================================== */
.spread-mat {
  width: 100%;
  max-width: 1050px;
  margin-top: 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

.slots-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.8rem;
  width: 100%;
}

.card-slot {
  flex: 0 1 200px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.slot-label {
  font-family: var(--font-display);
  font-size: 0.85rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
  text-align: center;
  border-bottom: 1px solid rgba(232, 196, 100, 0.25);
  padding-bottom: 0.25rem;
  width: 100%;
}

.slot-box {
  width: 170px;
  aspect-ratio: var(--card-ratio);
  border-radius: var(--radius-card);
  border: 1.5px dashed rgba(232, 196, 100, 0.3);
  background: rgba(20, 18, 30, 0.4);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  perspective: 1200px;
  transition: var(--trans-smooth);
}

.slot-box.filled {
  border: none;
  background: transparent;
}

.slot-placeholder {
  color: rgba(232, 196, 100, 0.4);
  font-size: 2rem;
  animation: pulse 2.5s infinite;
}

/* Carta Colocada en el Tapete */
.mat-card {
  position: absolute;
  inset: 0;
  border-radius: var(--radius-card);
  transform-style: preserve-3d;
  transition: transform 1.2s cubic-bezier(0.16, 0.84, 0.24, 1);
  cursor: pointer;
}

.mat-card:hover {
  filter: drop-shadow(0 0 12px rgba(232, 196, 100, 0.4));
}

.mat-card.revealed {
  transform: rotateY(180deg);
}

.mat-card.revealed.is-reversed {
  transform: rotateY(180deg) rotateZ(180deg);
}

/* Caras del naipe */
.mat-card-face {
  position: absolute;
  inset: 0;
  border-radius: var(--radius-card);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  overflow: hidden;
}

.mat-card-face.back {
  background: linear-gradient(145deg, #7d5d18, #e9c866 28%, #fff1b8 48%, #c9983a 68%, #6f5114);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6), inset 0 0 0 1px rgba(255, 240, 180, 0.5);
}

.mat-card-face.front {
  transform: rotateY(180deg);
  background: #0f0d14;
  border: 1.5px solid var(--gold);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.8), 0 0 20px rgba(232, 196, 100, 0.3);
  display: flex;
  flex-direction: column;
}

.front-art {
  width: 100%;
  height: 68%;
  object-fit: contain;
  padding: 4px;
  border-bottom: 1px solid rgba(232, 196, 100, 0.35);
  background: #0d0b14;
}

.front-info {
  padding: 0.45rem 0.6rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  flex: 1;
  background: linear-gradient(180deg, #181522 0%, #0d0b13 100%);
  text-align: center;
}

.front-num {
  font-family: var(--font-display);
  font-size: 0.75rem;
  color: var(--gold);
  font-weight: 700;
  letter-spacing: 0.1em;
}

.front-name {
  font-family: var(--font-display);
  font-size: 0.85rem;
  color: var(--text-main);
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 1px 0;
}

.front-orient {
  font-size: 0.7rem;
  color: var(--gold-light);
  font-style: italic;
  display: inline-block;
  padding: 1px 6px;
  border-radius: 10px;
  background: rgba(232, 196, 100, 0.12);
  align-self: center;
}

.front-orient.reversed {
  color: #ff9d9d;
  background: rgba(255, 100, 100, 0.15);
}

/* ==========================================================================
   PANEL DE SÍNTESIS Y ACCIONES DE LECTURA
   ========================================================================== */
.spread-summary-box {
  display: none;
  width: 100%;
  max-width: 820px;
  background: rgba(18, 16, 26, 0.85);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(232, 196, 100, 0.3);
  border-radius: var(--radius-panel);
  padding: 1.5rem 1.8rem;
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.6), 0 0 25px rgba(232, 196, 100, 0.15);
  animation: fadeIn 0.5s ease-out;
}

.spread-summary-box.active {
  display: block;
}

.summary-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(232, 196, 100, 0.2);
  padding-bottom: 0.75rem;
  margin-bottom: 1rem;
}

.summary-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  color: var(--gold-light);
  letter-spacing: 0.08em;
}

.elements-balance {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.elem-badge {
  font-size: 0.75rem;
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
}

.summary-body {
  font-size: 1.05rem;
  color: #ded9cd;
  line-height: 1.6;
  margin-bottom: 1.2rem;
}

.summary-actions {
  display: flex;
  gap: 0.8rem;
  justify-content: flex-end;
  flex-wrap: wrap;
}

/* ==========================================================================
   VISTA 2: EL GRIMORIO (CATÁLOGO DE 78 CARTAS)
   ========================================================================== */
.grimorio-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.2rem;
  margin-bottom: 2rem;
}

.grimorio-header h2 {
  font-family: var(--font-display);
  font-size: 2rem;
  letter-spacing: 0.12em;
  color: var(--gold-light);
  text-transform: uppercase;
}

.grimorio-search-bar {
  width: 100%;
  max-width: 550px;
  position: relative;
}

.search-input {
  width: 100%;
  background: rgba(20, 18, 30, 0.85);
  border: 1px solid var(--gold-border);
  border-radius: 30px;
  padding: 0.7rem 1.4rem;
  color: var(--text-main);
  font-family: var(--font-serif);
  font-size: 1.05rem;
  outline: none;
  transition: var(--trans-smooth);
}

.search-input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 14px rgba(232, 196, 100, 0.25);
}

.grimorio-filters {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
}

.filter-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(232, 196, 100, 0.15);
  color: var(--text-muted);
  font-family: var(--font-display);
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  padding: 0.4rem 0.9rem;
  border-radius: 20px;
  cursor: pointer;
  transition: var(--trans-smooth);
}

.filter-btn:hover {
  color: var(--gold-light);
  border-color: rgba(232, 196, 100, 0.4);
}

.filter-btn.active {
  background: rgba(232, 196, 100, 0.2);
  color: var(--gold-light);
  border-color: var(--gold);
}

/* Cuadrícula del Grimorio */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(145px, 1fr));
  gap: 1.25rem;
  width: 100%;
}

.catalog-card {
  background: rgba(21, 19, 31, 0.7);
  border: 1px solid rgba(232, 196, 100, 0.2);
  border-radius: var(--radius-card);
  overflow: hidden;
  cursor: pointer;
  transition: var(--trans-smooth);
  display: flex;
  flex-direction: column;
  position: relative;
}

.catalog-card:hover {
  transform: translateY(-6px);
  border-color: var(--gold);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.7), 0 0 18px rgba(232, 196, 100, 0.25);
}

.catalog-card-img {
  width: 100%;
  aspect-ratio: 5/7;
  object-fit: contain;
  padding: 6px;
  background: #0d0b14;
  border-bottom: 1px solid rgba(232, 196, 100, 0.25);
}

.catalog-card-info {
  padding: 0.5rem 0.6rem;
  text-align: center;
}

.catalog-card-num {
  font-family: var(--font-display);
  font-size: 0.7rem;
  color: var(--gold);
  letter-spacing: 0.08em;
}

.catalog-card-name {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.catalog-card-suit {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-style: italic;
}

/* ==========================================================================
   VISTA 3: DIARIO DE LECTURAS
   ========================================================================== */
.journal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(232, 196, 100, 0.2);
  padding-bottom: 1rem;
  margin-bottom: 1.5rem;
}

.journal-header h2 {
  font-family: var(--font-display);
  font-size: 1.8rem;
  color: var(--gold-light);
  letter-spacing: 0.08em;
}

.journal-list {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.journal-entry {
  background: rgba(20, 18, 30, 0.75);
  border: 1px solid rgba(232, 196, 100, 0.2);
  border-radius: var(--radius-panel);
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  transition: var(--trans-smooth);
}

.journal-entry:hover {
  border-color: rgba(232, 196, 100, 0.4);
}

.journal-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.journal-question {
  font-size: 1.15rem;
  font-style: italic;
  color: var(--gold-light);
}

.journal-cards-row {
  display: flex;
  gap: 1rem;
  overflow-x: auto;
  padding: 0.5rem 0;
}

.journal-mini-card {
  flex: 0 0 90px;
  text-align: center;
}

.journal-mini-img {
  width: 90px;
  height: 140px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--gold-border);
}

.journal-mini-name {
  font-size: 0.75rem;
  margin-top: 0.25rem;
  font-family: var(--font-display);
}

/* ==========================================================================
   VISTA 4: GUÍA Y FILOSOFÍA DEL TAROT
   ========================================================================== */
.guide-container {
  max-width: 860px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.guide-section {
  background: rgba(20, 18, 30, 0.7);
  border: 1px solid rgba(232, 196, 100, 0.2);
  border-radius: var(--radius-panel);
  padding: 1.5rem 2rem;
}

.guide-section h3 {
  font-family: var(--font-display);
  font-size: 1.4rem;
  color: var(--gold-light);
  margin-bottom: 0.8rem;
  border-bottom: 1px solid rgba(232, 196, 100, 0.2);
  padding-bottom: 0.4rem;
}

.guide-section p {
  color: #ded9cd;
  margin-bottom: 0.8rem;
  line-height: 1.7;
}

.guide-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.guide-box {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(232, 196, 100, 0.15);
  border-radius: 10px;
  padding: 1rem;
}

.guide-box h4 {
  font-family: var(--font-display);
  color: var(--gold);
  margin-bottom: 0.4rem;
}

/* ==========================================================================
   MODAL DE DETALLE DE CARTA (VISOR 3D & SIGNIFICADO)
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 3, 7, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease-out;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.card-detail-modal {
  width: 100%;
  max-width: 920px;
  max-height: 90vh;
  background: rgba(18, 16, 26, 0.95);
  border: 1.5px solid var(--gold);
  border-radius: var(--radius-panel);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.9), 0 0 35px rgba(232, 196, 100, 0.25);
  overflow-y: auto;
  position: relative;
  display: flex;
  flex-direction: row;
  gap: 2rem;
  padding: 2.2rem;
  transform: translateY(20px) scale(0.96);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.active .card-detail-modal {
  transform: translateY(0) scale(1);
}

.modal-close-btn {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid rgba(232, 196, 100, 0.3);
  background: rgba(255, 255, 255, 0.05);
  color: var(--gold-light);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  transition: var(--trans-smooth);
}

.modal-close-btn:hover {
  background: rgba(232, 196, 100, 0.2);
  transform: rotate(90deg);
}

.modal-card-visual {
  flex: 0 0 280px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.modal-card-frame {
  width: 250px;
  aspect-ratio: var(--card-ratio);
  border-radius: var(--radius-card);
  overflow: hidden;
  border: 2px solid var(--gold);
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.8), 0 0 30px rgba(232, 196, 100, 0.35);
  position: relative;
  transition: transform 0.6s ease;
}

.modal-card-frame.inverted {
  transform: rotate(180deg);
}

.modal-card-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 8px;
  background: #0d0b14;
}

.modal-card-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.modal-header-meta {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.modal-card-title {
  font-family: var(--font-display);
  font-size: 2rem;
  color: var(--gold-light);
  line-height: 1.15;
}

.modal-badge {
  font-size: 0.75rem;
  font-family: var(--font-display);
  letter-spacing: 0.08em;
  padding: 0.25rem 0.7rem;
  border-radius: 20px;
  background: rgba(232, 196, 100, 0.15);
  border: 1px solid rgba(232, 196, 100, 0.3);
  color: var(--gold-light);
}

.modal-section-title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  color: var(--gold);
  letter-spacing: 0.06em;
  margin-bottom: 0.3rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.modal-section-text {
  font-size: 1.02rem;
  color: #ded8cb;
  line-height: 1.6;
}

.keywords-highlight {
  background: rgba(232, 196, 100, 0.08);
  border-left: 3px solid var(--gold);
  padding: 0.6rem 1rem;
  border-radius: 0 8px 8px 0;
  font-style: italic;
  color: var(--gold-light);
}

/* ==========================================================================
   RESPONSIVE DESIGN (MÓVILES Y PANTALLAS PEQUEÑAS)
   ========================================================================== */
@media (max-width: 860px) {
  .header {
    flex-wrap: wrap;
    padding: 0.6rem 1rem;
  }
  
  .nav-tabs {
    order: 3;
    width: 100%;
    justify-content: center;
    overflow-x: auto;
  }
  
  .card-detail-modal {
    flex-direction: column;
    padding: 1.5rem;
  }
  
  .modal-card-visual {
    flex: auto;
  }
  
  .modal-card-frame {
    width: 200px;
  }
  
  .slots-grid {
    gap: 1rem;
  }
  
  .slot-box {
    width: 130px;
  }
}
