:root {
  --bg-dark: #120713;
  --bg-gradient: radial-gradient(120% 90% at 50% 10%, #301026 0%, #1A0718 50%, #0F040E 100%);
  --surface: rgba(36, 13, 31, 0.75);
  --surface-solid: #220B1C;
  --surface-card: #2A0E24;
  --gold-primary: #F5D082;
  --gold-dark: #D49A3D;
  --gold-gradient: linear-gradient(135deg, #F9DE9E 0%, #E3AC50 50%, #C4872C 100%);
  --gold-border: rgba(245, 208, 130, 0.35);
  --rose-soft: #D68CA5;
  --rose-glow: rgba(214, 140, 165, 0.25);
  --text-primary: #FDF8F3;
  --text-muted: rgba(253, 248, 243, 0.72);
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-full: 999px;
  --font-serif: "Cormorant Garamond", Georgia, serif;
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

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

body {
  background: var(--bg-dark);
  background-image: var(--bg-gradient);
  background-attachment: fixed;
  color: var(--text-primary);
  font-family: var(--font-sans);
  min-height: 100vh;
  padding-bottom: 90px;
  overflow-x: hidden;
  user-select: none;
}

/* Header */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(18, 7, 19, 0.88);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(245, 208, 130, 0.18);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.brand-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--gold-gradient);
  display: grid;
  place-items: center;
  box-shadow: 0 4px 14px rgba(212, 154, 61, 0.4);
}

.brand-icon svg {
  width: 24px;
  height: 24px;
  fill: #240A1C;
}

.brand-text h1 {
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 700;
  line-height: 1.1;
  color: #fff;
  letter-spacing: 0.02em;
}

.brand-text span {
  font-size: 11px;
  color: var(--gold-primary);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 600;
}

.pwa-install-btn {
  background: rgba(245, 208, 130, 0.12);
  border: 1px solid var(--gold-primary);
  color: var(--gold-primary);
  font-size: 12px;
  font-weight: 700;
  padding: 7px 14px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.pwa-install-btn:active {
  transform: scale(0.96);
  background: var(--gold-primary);
  color: #240A1C;
}

/* Container */
.container {
  max-width: 540px;
  margin: 0 auto;
  padding: 16px 20px;
}

/* Tabs View */
.view-panel {
  display: none;
  animation: fadeIn 0.3s ease;
}

.view-panel.active {
  display: block;
}

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

/* Hero Section in Cartas */
.hero-card {
  text-align: center;
  margin-bottom: 20px;
}

.hero-card .subtitle {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--gold-primary);
  font-weight: 800;
}

.hero-card .title {
  font-family: var(--font-serif);
  font-size: 32px;
  font-weight: 700;
  line-height: 1.15;
  margin-top: 4px;
  color: #fff;
}

.hero-card .title em {
  font-style: normal;
  color: var(--gold-primary);
}

/* Categories Bar */
.cat-scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 12px;
  margin-bottom: 16px;
  scrollbar-width: none;
}

.cat-scroll::-webkit-scrollbar {
  display: none;
}

.cat-chip {
  flex: none;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(245, 208, 130, 0.22);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: var(--radius-full);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}

.cat-chip.active {
  background: var(--gold-gradient);
  color: #240A1C;
  border-color: transparent;
  font-weight: 800;
  box-shadow: 0 4px 14px rgba(212, 154, 61, 0.35);
}

/* 3D Flip Card Container */
.card-scene {
  perspective: 1000px;
  width: 100%;
  min-height: 410px;
  margin: 10px 0 24px;
  cursor: pointer;
}

.card-3d {
  width: 100%;
  min-height: 410px;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
  border-radius: var(--radius-lg);
}

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

.card-face {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border-radius: var(--radius-lg);
  padding: 22px 20px 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.65), 0 0 0 1px var(--gold-border);
}

/* Front Face */
.card-front {
  background: linear-gradient(160deg, #35132B 0%, #200A1A 60%, #150612 100%);
  border: 2px solid rgba(245, 208, 130, 0.4);
  align-items: center;
  justify-content: center;
  text-align: center;
}

.front-badge {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(245, 208, 130, 0.25) 0%, rgba(245, 208, 130, 0) 70%);
  border: 2px solid var(--gold-primary);
  display: grid;
  place-items: center;
  margin-bottom: 20px;
  box-shadow: 0 0 30px rgba(245, 208, 130, 0.35);
}

.front-badge svg {
  width: 44px;
  height: 44px;
  fill: var(--gold-primary);
}

.card-front h3 {
  font-family: var(--font-serif);
  font-size: 30px;
  color: #fff;
  margin-bottom: 8px;
}

.card-front p {
  font-size: 14px;
  color: var(--gold-primary);
  font-weight: 600;
  letter-spacing: 0.04em;
}

.front-tap {
  margin-top: 24px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.08);
  padding: 8px 18px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
}

/* Back Face */
.card-back {
  background: linear-gradient(165deg, #3A152F 0%, #220B1C 55%, #140511 100%);
  border: 2px solid var(--gold-primary);
  transform: rotateY(180deg);
  text-align: center;
}

.back-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.back-cat-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(245, 208, 130, 0.15);
  border: 1px solid var(--gold-primary);
  color: var(--gold-primary);
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.back-fav-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--gold-primary);
  padding: 4px;
}

.back-fav-btn svg {
  width: 24px;
  height: 24px;
  stroke: var(--gold-primary);
  fill: none;
  transition: all 0.2s;
}

.back-fav-btn.active svg {
  fill: var(--gold-primary);
}

.back-body {
  margin: auto 0;
  padding: 6px 0;
}

.back-quote {
  font-family: var(--font-serif);
  font-size: 23px;
  line-height: 1.35;
  color: #fff;
  font-weight: 600;
}

.back-subtext {
  margin-top: 10px;
  font-size: 13.5px;
  line-height: 1.4;
  color: var(--text-muted);
  font-style: italic;
}

.back-verse {
  margin-top: 10px;
  display: inline-block;
  background: rgba(245, 208, 130, 0.1);
  color: var(--gold-primary);
  font-size: 13px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: var(--radius-full);
}

.back-footer {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  margin-top: 8px;
  padding-bottom: 2px;
}

.back-tap-hint {
  font-size: 11px;
  color: var(--gold-primary);
  opacity: 0.85;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  background: rgba(245, 208, 130, 0.1);
  border: 1px solid rgba(245, 208, 130, 0.22);
  padding: 5px 14px;
  border-radius: var(--radius-full);
}

/* Card Action Buttons */
.card-actions {
  display: flex;
  gap: 12px;
  margin-top: 8px;
}

.btn-primary {
  flex: 1;
  background: var(--gold-gradient);
  color: #240A1C;
  font-size: 15px;
  font-weight: 800;
  padding: 14px 20px;
  border-radius: var(--radius-full);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 8px 24px rgba(212, 154, 61, 0.35);
  transition: all 0.2s;
}

.btn-primary:active {
  transform: scale(0.98);
}

.btn-secondary {
  flex: 1;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(245, 208, 130, 0.3);
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 700;
  padding: 14px 18px;
  border-radius: var(--radius-full);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s;
}

.btn-secondary:active {
  transform: scale(0.98);
  background: rgba(255, 255, 255, 0.14);
}

/* Botiquín SOS Cards */
.sos-grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.sos-card {
  background: var(--surface-card);
  border: 1px solid rgba(245, 208, 130, 0.22);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: all 0.2s;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
}

.sos-card:active {
  transform: scale(0.98);
  border-color: var(--gold-primary);
}

.sos-icon {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  flex: none;
  font-size: 24px;
}

.sos-card.red .sos-icon { background: rgba(239, 68, 68, 0.2); border: 1px solid #EF4444; }
.sos-card.yellow .sos-icon { background: rgba(245, 158, 11, 0.2); border: 1px solid #F59E0B; }
.sos-card.blue .sos-icon { background: rgba(59, 130, 246, 0.2); border: 1px solid #3B82F6; }
.sos-card.green .sos-icon { background: rgba(34, 197, 94, 0.2); border: 1px solid #22C55E; }
.sos-card.purple .sos-icon { background: rgba(168, 85, 247, 0.2); border: 1px solid #A855F7; }

.sos-info h4 {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 4px;
}

.sos-info p {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.35;
}

.sos-arrow {
  margin-left: auto;
  color: var(--gold-primary);
  font-size: 18px;
}

/* Modal SOS */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 3, 11, 0.85);
  backdrop-filter: blur(10px);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.active {
  display: flex;
  animation: fadeIn 0.25s ease;
}

.modal-content {
  background: linear-gradient(180deg, #2D0F25 0%, #1A0718 100%);
  border: 2px solid var(--gold-primary);
  border-radius: var(--radius-lg);
  max-width: 480px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  padding: 26px 22px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.8);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(245, 208, 130, 0.2);
  padding-bottom: 12px;
  margin-bottom: 18px;
}

.modal-header h3 {
  font-family: var(--font-serif);
  font-size: 24px;
  color: #fff;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 24px;
  cursor: pointer;
  padding: 4px;
}

.modal-body {
  font-size: 15px;
  line-height: 1.6;
}

.sos-step {
  background: rgba(255, 255, 255, 0.05);
  border-left: 3px solid var(--gold-primary);
  border-radius: 0 12px 12px 0;
  padding: 12px 14px;
  margin: 12px 0;
}

.sos-step b {
  color: var(--gold-primary);
  display: block;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
}

.prayer-box {
  background: rgba(245, 208, 130, 0.08);
  border: 1px dashed var(--gold-primary);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-top: 16px;
  font-family: var(--font-serif);
  font-size: 18px;
  line-height: 1.5;
  color: #fff;
}

/* Juego ¿Cuánto me conoces? */
.quiz-header {
  text-align: center;
  margin-bottom: 20px;
}

.round-chips {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin: 12px 0 18px;
}

.round-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(245, 208, 130, 0.3);
  color: var(--text-muted);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.round-btn.active {
  background: var(--gold-primary);
  color: #240A1C;
  font-weight: 800;
}

.quiz-card {
  background: var(--surface-card);
  border: 1px solid rgba(245, 208, 130, 0.3);
  border-radius: var(--radius-lg);
  padding: 24px 20px;
  margin-bottom: 16px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
}

.quiz-q-num {
  font-size: 12px;
  text-transform: uppercase;
  color: var(--gold-primary);
  font-weight: 800;
  letter-spacing: 0.1em;
}

.quiz-q-title {
  font-family: var(--font-serif);
  font-size: 24px;
  font-weight: 700;
  margin: 6px 0 18px;
  color: #fff;
}

.quiz-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.quiz-opt {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: all 0.18s;
  font-size: 14px;
}

.quiz-opt:active, .quiz-opt.selected {
  background: rgba(245, 208, 130, 0.18);
  border-color: var(--gold-primary);
  color: #fff;
  font-weight: 600;
}

.quiz-opt span.letter {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(245, 208, 130, 0.15);
  color: var(--gold-primary);
  font-weight: 800;
  display: grid;
  place-items: center;
  font-size: 13px;
  flex: none;
}

.quiz-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 16px;
}

/* Oración a Dos (8 Temas) */
.prayer-item {
  background: var(--surface-card);
  border: 1px solid rgba(245, 208, 130, 0.25);
  border-radius: var(--radius-md);
  margin-bottom: 12px;
  overflow: hidden;
  transition: all 0.2s;
}

.prayer-head {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
}

.prayer-head h4 {
  font-size: 16px;
  color: #fff;
  font-weight: 700;
}

.prayer-head span {
  font-size: 11px;
  color: var(--gold-primary);
  font-weight: 800;
  text-transform: uppercase;
  display: block;
  margin-bottom: 2px;
}

.prayer-content {
  display: none;
  padding: 0 20px 20px;
  border-top: 1px solid rgba(245, 208, 130, 0.12);
  font-size: 14px;
  line-height: 1.55;
  color: var(--text-muted);
}

.prayer-item.open .prayer-content {
  display: block;
  padding-top: 16px;
}

.prayer-item.open .prayer-head svg {
  transform: rotate(180deg);
}

/* Favoritas View */
.fav-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.fav-empty svg {
  width: 50px;
  height: 50px;
  fill: none;
  stroke: var(--gold-primary);
  margin-bottom: 12px;
}

.fav-card {
  background: var(--surface-card);
  border: 1px solid rgba(245, 208, 130, 0.25);
  border-radius: var(--radius-md);
  padding: 18px;
  margin-bottom: 12px;
  position: relative;
}

.fav-del {
  position: absolute;
  top: 12px;
  right: 12px;
  background: none;
  border: none;
  color: #EF4444;
  cursor: pointer;
  padding: 4px;
}

/* Bottom Navigation Bar */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(18, 7, 19, 0.94);
  backdrop-filter: blur(16px);
  border-top: 1px solid rgba(245, 208, 130, 0.2);
  display: flex;
  justify-content: space-around;
  padding: 8px 10px 14px;
}

.nav-item {
  background: none;
  border: none;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  padding: 6px 12px;
  border-radius: 12px;
  transition: all 0.2s;
}

.nav-item svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  transition: all 0.2s;
}

.nav-item.active {
  color: var(--gold-primary);
  font-weight: 800;
  background: rgba(245, 208, 130, 0.1);
}

.nav-item.active svg {
  stroke: var(--gold-primary);
}