/* ==========================================================================
   CHISPAS MENTALES — SHOWCASE INTERACTIVO 3D MOBILE-FIRST
   Viewport: 100dvh estricto, sin scroll global, diseño táctil inmersivo
   ========================================================================== */

:root {
  --bg-dark: #070a14;
  --bg-card: rgba(15, 22, 38, 0.92);
  --border-subtle: rgba(255, 255, 255, 0.1);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --app-height: 100dvh;
  --active-color: #0ea5e9;
  --active-glow: rgba(14, 165, 233, 0.35);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

html, body {
  width: 100%;
  height: 100%;
  height: var(--app-height, 100vh);
  overflow: hidden;
  position: fixed;
  background-color: var(--bg-dark);
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  color: var(--text-main);
  touch-action: manipulation;
}

/* ==========================================================================
   CONTENEDOR MAESTRO (100dvh)
   ========================================================================== */
.chispas-app {
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

/* Iluminación de fondo reactiva a la categoría activa */
.ambient-glow {
  position: absolute;
  top: 15%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 380px;
  height: 380px;
  background: radial-gradient(circle, var(--active-glow) 0%, transparent 70%);
  filter: blur(50px);
  pointer-events: none;
  z-index: 1;
  transition: background 0.5s ease;
}

.grid-backdrop {
  position: absolute;
  inset: 0;
  background-image: 
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 32px 32px;
  pointer-events: none;
  z-index: 1;
}

/* ==========================================================================
   ENCABEZADO
   ========================================================================== */
.showcase-header {
  position: relative;
  z-index: 10;
  padding: calc(var(--safe-top) + 8px) 14px 4px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 7px;
}

.badge-spark {
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: #0f172a;
  background: linear-gradient(135deg, #fef08a 0%, #fbbf24 50%, #f59e0b 100%);
  padding: 3.5px 9px;
  border-radius: 999px;
  box-shadow: 0 2px 10px rgba(245, 158, 11, 0.35);
}

.badge-total {
  font-size: 10.5px;
  font-weight: 700;
  color: #38bdf8;
  background: rgba(14, 165, 233, 0.15);
  border: 1px solid rgba(14, 165, 233, 0.3);
  padding: 3px 8px;
  border-radius: 999px;
}

.sound-toggle-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  cursor: pointer;
  backdrop-filter: blur(8px);
}

.sound-toggle-btn.active {
  border-color: rgba(251, 191, 36, 0.4);
}

/* ==========================================================================
   SELECTOR DE LAS 4 CATEGORÍAS
   ========================================================================== */
.category-tabs {
  position: relative;
  z-index: 10;
  display: flex;
  gap: 6px;
  padding: 4px 12px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  flex-shrink: 0;
}

.category-tabs::-webkit-scrollbar {
  display: none;
}

.tab-btn {
  flex: 1;
  min-width: 78px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 6.5px 8px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #94a3b8;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.tab-btn:active {
  transform: scale(0.96);
}

.tab-btn.active {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.12);
  border-color: var(--cat-color);
  box-shadow: 0 0 14px var(--cat-color);
}

.tab-icon {
  font-size: 13px;
}

/* ==========================================================================
   BARRA DE MODO: TARJETAS VS FICHAS
   ========================================================================== */
.mode-switch-bar {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 14px;
  flex-shrink: 0;
}

.mode-pill-container {
  display: inline-flex;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 2px;
  border-radius: 999px;
}

.mode-pill {
  border: none;
  background: transparent;
  color: #94a3b8;
  font-size: 10.5px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.mode-pill.active {
  color: #0f172a;
  background: #ffffff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.preview-counter {
  font-size: 10.5px;
  font-weight: 800;
  color: #fcd34d;
  background: rgba(251, 191, 36, 0.12);
  border: 1px solid rgba(251, 191, 36, 0.25);
  padding: 2.5px 8px;
  border-radius: 6px;
}

/* ==========================================================================
   ÁREA CENTRAL DE PREVISUALIZACIÓN (STAGE 3D)
   ========================================================================== */
.showcase-stage {
  flex: 1;
  min-height: 0;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px 10px;
  perspective: 1400px;
  perspective-origin: 50% 50%;
  z-index: 5;
}

/* Zonas de navegación táctil izquierda/derecha */
.touch-nav-zone {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 14%;
  z-index: 25;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.touch-nav-prev { left: 0; }
.touch-nav-next { right: 0; }

.nav-chevron {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  opacity: 0.6;
  backdrop-filter: blur(8px);
  transition: all 0.2s ease;
}

.touch-nav-zone:active .nav-chevron {
  opacity: 1;
  transform: scale(1.1);
  background: var(--active-color);
  color: #0f172a;
}

/* --------------------------------------------------------------------------
   VISTA A: TARJETAS DE TRIVIA 3D
   -------------------------------------------------------------------------- */
.view-cards-container {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 6px 12px;
  touch-action: none;
}

.view-cards-container.active {
  display: flex;
}

.flashcard-3d-wrapper {
  position: relative;
  width: min(88vw, 325px);
  height: min(44vh, 290px);
  perspective: 1200px;
}

.flashcard-3d {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.5s cubic-bezier(0.2, 0.85, 0.25, 1);
  cursor: pointer;
}

.flashcard-3d.flipped {
  transform: rotateY(180deg);
}

.card-face {
  position: absolute;
  inset: 0;
  border-radius: 16px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.8),
              0 0 0 1px rgba(255, 255, 255, 0.12) inset;
}

.card-face-front {
  background: linear-gradient(165deg, #131b2e 0%, #0d1322 100%);
  border: 1px solid var(--border-subtle);
  z-index: 2;
  transform: rotateY(0deg);
}

.card-face-back {
  background: linear-gradient(165deg, #161e33 0%, #0c1220 100%);
  border: 1px solid rgba(16, 185, 129, 0.35);
  transform: rotateY(180deg);
  z-index: 1;
}

.card-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-tag {
  font-size: 9.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.1);
  color: #f1f5f9;
}

.card-tag-answer {
  background: rgba(16, 185, 129, 0.2);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.card-num-tag {
  font-size: 10px;
  font-weight: 800;
  font-family: monospace;
  color: #fbbf24;
  background: rgba(251, 191, 36, 0.12);
  padding: 2px 6px;
  border-radius: 4px;
}

.card-subtopic {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--active-color);
  letter-spacing: 0.2px;
  margin-top: 2px;
}

.card-question {
  font-size: 13.5px;
  font-weight: 800;
  line-height: 1.25;
  color: #ffffff;
  margin: 3px 0 6px;
}

/* Opciones A, B, C */
.card-options {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.option-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 5px 8px;
  font-size: 11.5px;
  transition: all 0.2s ease;
}

.opt-letter {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.1);
  font-weight: 900;
  font-size: 10.5px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fbbf24;
  flex-shrink: 0;
}

.opt-text {
  color: #e2e8f0;
  font-weight: 600;
  line-height: 1.2;
}

.card-flip-prompt {
  text-align: center;
  font-size: 9.5px;
  color: #94a3b8;
  letter-spacing: 0.3px;
  margin-top: 2px;
}

/* Cara trasera: Respuesta y Dato Curioso */
.answer-reveal-box {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: 10px;
  padding: 8px 12px;
}

.answer-label {
  font-size: 9.5px;
  font-weight: 800;
  text-transform: uppercase;
  color: #34d399;
}

.answer-badge {
  font-size: 14px;
  font-weight: 900;
  color: #ffffff;
}

.fact-box {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 8px 12px;
}

.fact-title {
  font-size: 10px;
  font-weight: 800;
  color: #fbbf24;
  margin-bottom: 2px;
}

.fact-text {
  font-size: 11px;
  color: #cbd5e1;
  line-height: 1.35;
}

/* --------------------------------------------------------------------------
   VISTA B: FICHAS DE RECORTE (TAMAÑO CARTA EN 3D)
   -------------------------------------------------------------------------- */
.view-sheets-container {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 4px 10px;
  touch-action: none;
}

.view-sheets-container.active {
  display: flex;
}

.sheet-flipper-3d-wrapper {
  position: relative;
  width: min(88vw, 320px);
  height: min(44vh, 290px);
  perspective: 1400px;
}

.sheet-paper-card {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 8px;
  background-color: #ffffff;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.85),
              0 0 0 1px rgba(255, 255, 255, 0.15);
  overflow: hidden;
  transform-style: preserve-3d;
  transition: transform 0.35s cubic-bezier(0.2, 0.9, 0.3, 1);
}

.sheet-cut-indicator {
  position: absolute;
  top: 6px;
  left: 6px;
  background: rgba(15, 23, 42, 0.75);
  color: #f1f5f9;
  font-size: 8px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  backdrop-filter: blur(4px);
  z-index: 10;
  pointer-events: none;
}

.sheet-shadow-fold {
  position: absolute;
  top: 0;
  left: 0;
  width: 18px;
  height: 100%;
  background: linear-gradient(to right, rgba(0,0,0,0.3) 0%, transparent 100%);
  pointer-events: none;
  z-index: 5;
}

.sheet-paper-card img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  pointer-events: none;
}

/* ==========================================================================
   BARRA INFORMATIVA DEL EBOOK
   ========================================================================== */
.ebook-info-bar {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px 14px 4px;
  flex-shrink: 0;
}

.ebook-title {
  font-size: 13px;
  font-weight: 800;
  color: #ffffff;
  line-height: 1.2;
}

.ebook-subtitle {
  font-size: 10px;
  color: #94a3b8;
  margin-top: 1px;
}

.ebook-format-tag {
  font-size: 9px;
  font-weight: 700;
  color: #a78bfa;
  background: rgba(168, 85, 247, 0.15);
  border: 1px solid rgba(168, 85, 247, 0.3);
  padding: 2.5px 6.5px;
  border-radius: 4px;
  white-space: nowrap;
}

/* ==========================================================================
   AVISO COMERCIAL DE APORTACIÓN (ESTRICTAMENTE SIN BOTONES)
   ========================================================================== */
.chat-payment-notice {
  position: relative;
  z-index: 15;
  background: rgba(13, 18, 32, 0.96);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-top: 1px solid rgba(251, 191, 36, 0.35);
  border-radius: 18px 18px 0 0;
  padding: 8px 14px calc(var(--safe-bottom) + 8px);
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-shadow: 0 -8px 25px rgba(0, 0, 0, 0.7);
  flex-shrink: 0;
}

.notice-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.notice-badge {
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: #0f172a;
  background: linear-gradient(135deg, #fef08a 0%, #fbbf24 50%, #f59e0b 100%);
  padding: 2.5px 8px;
  border-radius: 999px;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.35);
}

.combo-tag {
  font-size: 9.5px;
  font-weight: 700;
  color: #34d399;
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.35);
  padding: 2px 6px;
  border-radius: 4px;
}

.notice-main-text {
  font-size: 11.5px;
  color: #ffffff;
  line-height: 1.3;
}

.notice-main-text strong {
  color: #fde047;
}

.notice-details-text {
  font-size: 10px;
  color: #94a3b8;
  line-height: 1.35;
}

.notice-details-text strong {
  color: #e2e8f0;
}

.notice-details-text em {
  color: #38bdf8;
  font-style: normal;
}
