/* ═══════════════════════════════════════════════════════════════
   Normativa LasVegasRP — Libro Interactivo
   Tema: Oscuro elegante con dorados
   ═══════════════════════════════════════════════════════════════ */

:root {
  /* Paleta */
  --gold:        #c9a84c;
  --gold-bright: #e6c45c;
  --gold-dark:   #8b6914;
  --gold-glow:   rgba(201, 168, 76, 0.4);

  --bg-deep:     #0a0a14;
  --bg-dark:     #15151f;
  --bg-mid:      #1f1f2e;
  --bg-page:     #f6f0e0;
  --bg-page-2:   #f1ead7;

  --paper:       #f8f3e3;
  --paper-edge:  #d9cfa6;
  --paper-shadow: rgba(0, 0, 0, 0.6);

  --text:        #2a2418;
  --text-soft:   #4a4030;
  --text-muted:  #6a5d44;

  --accent-red:  #c0392b;
  --accent-blue: #2c4a6e;

  --shadow-deep: 0 30px 80px rgba(0, 0, 0, 0.7);
  --shadow-soft: 0 10px 30px rgba(0, 0, 0, 0.4);

  /* Fuentes */
  --font-display: 'Cinzel', 'Playfair Display', Georgia, serif;
  --font-body:    'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono:    'JetBrains Mono', 'Courier New', monospace;
}

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

html, body {
  height: 100%;
  width: 100%;
  overflow: hidden;
  font-family: var(--font-body);
  color: #e8e8ef;
  background: var(--bg-deep);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  user-select: none;
}

body {
  background:
    radial-gradient(ellipse 70% 50% at 50% 0%, rgba(201, 168, 76, 0.08) 0%, transparent 60%),
    radial-gradient(ellipse 80% 60% at 50% 100%, rgba(60, 30, 80, 0.15) 0%, transparent 70%),
    linear-gradient(160deg, var(--bg-deep) 0%, var(--bg-dark) 50%, var(--bg-deep) 100%);
}

/* ─── Fondo decorativo ─── */
.bg-decor {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
.bg-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.25;
  animation: float 18s ease-in-out infinite;
}
.bg-glow-1 {
  width: 600px; height: 600px;
  background: var(--gold);
  top: -100px; left: -150px;
}
.bg-glow-2 {
  width: 500px; height: 500px;
  background: var(--accent-red);
  bottom: -100px; right: -100px;
  animation-delay: -9s;
}
@keyframes float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(40px, -30px) scale(1.05); }
  66% { transform: translate(-30px, 40px) scale(0.95); }
}

/* ─── Loader ─── */
.loader {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: var(--bg-deep);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}
.loader.hidden {
  opacity: 0;
  visibility: hidden;
}
.loader-spinner {
  width: 60px;
  height: 60px;
  border: 3px solid rgba(201, 168, 76, 0.15);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
.loader-text {
  font-family: var(--font-display);
  color: var(--gold);
  letter-spacing: 0.2em;
  font-size: 0.9rem;
  text-transform: uppercase;
}

/* ─── Stage del libro ─── */
.book-stage {
  position: relative;
  z-index: 1;
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
}

.book {
  filter: drop-shadow(var(--shadow-deep));
}

/* ─── Página: base ─── */
.page {
  background: var(--paper);
  background-image:
    linear-gradient(180deg, var(--paper) 0%, var(--bg-page-2) 100%);
  color: var(--text);
  font-family: var(--font-body);
  position: relative;
  overflow: hidden;
  border: 1px solid var(--paper-edge);
}

.page::after {
  /* Textura sutil de papel */
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 20% 30%, rgba(139, 105, 20, 0.03) 0%, transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(139, 105, 20, 0.03) 0%, transparent 50%);
  pointer-events: none;
}

/* Páginas izquierdas tienen sombra hacia el lomo */
.page--left::before {
  content: '';
  position: absolute;
  right: 0; top: 0;
  width: 50px; height: 100%;
  background: linear-gradient(to left, rgba(0, 0, 0, 0.18), transparent);
  pointer-events: none;
  z-index: 2;
}
.page--right::before {
  content: '';
  position: absolute;
  left: 0; top: 0;
  width: 50px; height: 100%;
  background: linear-gradient(to right, rgba(0, 0, 0, 0.18), transparent);
  pointer-events: none;
  z-index: 2;
}

/* Contenido scrolleable */
.page-content {
  position: relative;
  z-index: 1;
  padding: 26px 36px 38px;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
}

.page-content::-webkit-scrollbar { width: 6px; }
.page-content::-webkit-scrollbar-track { background: transparent; }
.page-content::-webkit-scrollbar-thumb {
  background: rgba(139, 105, 20, 0.3);
  border-radius: 3px;
}

/* Encabezado de página */
.page-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 8px;
  margin-bottom: 14px;
  border-bottom: 2px solid var(--gold);
  position: relative;
}
.page-header::after {
  content: '';
  position: absolute;
  bottom: -5px;
  left: 0;
  width: 50px;
  height: 1px;
  background: var(--gold-dark);
}
.page-icon {
  font-size: 1.5rem;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.1));
}
.page-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.2rem;
  color: var(--text);
  letter-spacing: 0.02em;
  line-height: 1.2;
  flex: 1;
}

/* Folio (número de página al pie) */
.page-folio {
  position: absolute;
  bottom: 12px;
  left: 0;
  right: 0;
  text-align: center;
  font-family: var(--font-display);
  font-size: 0.75rem;
  color: var(--text-muted);
  letter-spacing: 0.15em;
}

/* ─── Tipografía del contenido ─── */
.page-content p {
  margin-bottom: 0.6em;
  line-height: 1.45;
  font-size: 0.88rem;
  color: var(--text-soft);
}

.page-content h3 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1rem;
  color: var(--gold-dark);
  margin: 1em 0 0.35em;
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(139, 105, 20, 0.2);
  letter-spacing: 0.02em;
}

.page-content h4 {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text);
  margin: 0.7em 0 0.25em;
}

.page-content ul {
  list-style: none;
  margin: 0.25em 0 0.6em;
  padding-left: 0.2em;
}
.page-content ul li {
  position: relative;
  padding: 2px 0 2px 18px;
  line-height: 1.4;
  font-size: 0.85rem;
  color: var(--text-soft);
}
.page-content ul li::before {
  content: '◆';
  position: absolute;
  left: 0;
  top: 3px;
  color: var(--gold-dark);
  font-size: 0.65rem;
}
.page-content ul ul {
  margin-top: 0.2em;
  margin-bottom: 0.2em;
}
.page-content ul ul li::before {
  content: '◇';
  font-size: 0.55rem;
  color: var(--text-muted);
}

.page-content strong { color: var(--text); font-weight: 700; }

.page-content code {
  font-family: var(--font-mono);
  font-size: 0.86em;
  background: rgba(139, 105, 20, 0.1);
  color: var(--gold-dark);
  padding: 1px 7px;
  border-radius: 4px;
  border: 1px solid rgba(139, 105, 20, 0.2);
  font-weight: 500;
}

.page-content em { color: var(--text-muted); font-style: italic; }

/* Notas y warnings */
.page-content .note,
.page-content p.note {
  background: linear-gradient(90deg, rgba(201, 168, 76, 0.12), rgba(201, 168, 76, 0.02));
  border-left: 3px solid var(--gold);
  padding: 7px 11px;
  margin: 8px 0;
  border-radius: 0 5px 5px 0;
  font-size: 0.82rem;
  color: var(--text-soft);
  font-style: italic;
}

.page-content .warn {
  background: linear-gradient(90deg, rgba(192, 57, 43, 0.12), rgba(192, 57, 43, 0.02));
  border-left: 3px solid var(--accent-red);
  padding: 7px 11px;
  margin: 8px 0;
  border-radius: 0 5px 5px 0;
  font-size: 0.82rem;
  color: var(--text);
  font-weight: 500;
}

/* Tag pills (conductas prohibidas) */
.page-content .tag-pill {
  background: rgba(255, 255, 255, 0.4);
  border: 1px solid rgba(139, 105, 20, 0.15);
  border-radius: 6px;
  padding: 7px 11px;
  margin: 5px 0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}
.page-content .tag-pill .tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--accent-red);
  background: rgba(192, 57, 43, 0.08);
  padding: 1px 6px;
  border-radius: 3px;
  margin-right: 5px;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
}
.page-content .tag-pill strong {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--text);
  font-size: 0.92rem;
}
.page-content .tag-pill p {
  margin: 3px 0 0;
  font-size: 0.82rem;
  color: var(--text-soft);
  line-height: 1.4;
}

/* Tabla de alertas */
.page-content table.alertas-table {
  width: 100%;
  border-collapse: collapse;
  margin: 10px 0;
  background: rgba(255, 255, 255, 0.4);
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  font-size: 0.78rem;
}
.alertas-table th {
  background: var(--bg-mid);
  color: var(--gold-bright);
  padding: 7px 9px;
  font-family: var(--font-display);
  font-weight: 600;
  text-align: center;
  letter-spacing: 0.04em;
  font-size: 0.78rem;
  border-bottom: 2px solid var(--gold);
}
.alertas-table td {
  padding: 6px 9px;
  border-bottom: 1px solid rgba(139, 105, 20, 0.1);
  color: var(--text-soft);
  text-align: center;
}
.alertas-table tr:nth-child(even) td { background: rgba(201, 168, 76, 0.05); }
.alertas-table tr:last-child td { border-bottom: none; }

/* Lista de dos columnas (zonas seguras) */
.page-content .two-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 20px;
}
.page-content .two-cols ul { margin: 0; }
.page-content .two-cols ul li::before { display: none; }
.page-content .two-cols ul li { padding-left: 2px; font-size: 0.83rem; padding-top: 2px; padding-bottom: 2px; }

/* Índice clickeable */
.page-content .toc-list {
  list-style: none;
  padding: 0;
  margin: 4px 0;
}
.page-content .toc-list li {
  padding: 7px 12px;
  margin: 3px 0;
  background: rgba(255, 255, 255, 0.4);
  border: 1px solid rgba(139, 105, 20, 0.15);
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.85rem;
  color: var(--text-soft);
  font-weight: 500;
}
.page-content .toc-list li::before { display: none; }
.page-content .toc-list li:hover {
  background: rgba(201, 168, 76, 0.18);
  border-color: var(--gold);
  color: var(--text);
  transform: translateX(4px);
  box-shadow: 0 2px 8px rgba(201, 168, 76, 0.2);
}

.footer-credit {
  margin-top: 2em;
  font-family: var(--font-display);
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  letter-spacing: 0.1em;
  line-height: 1.8;
}

/* ─── Tapa del libro ─── */
.cover {
  background:
    radial-gradient(ellipse at center, var(--bg-mid) 0%, var(--bg-dark) 60%, var(--bg-deep) 100%);
  color: #fff;
  position: relative;
  overflow: hidden;
  border: 1px solid var(--gold-dark);
}
.cover::before {
  content: '';
  position: absolute;
  inset: 18px;
  border: 1px solid var(--gold-dark);
  pointer-events: none;
  z-index: 1;
}
.cover::after {
  content: '';
  position: absolute;
  inset: 24px;
  border: 1px solid var(--gold);
  pointer-events: none;
  z-index: 1;
}
.cover-inner {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 40px;
  text-align: center;
}
.cover-logo {
  width: 200px;
  height: auto;
  margin-bottom: 30px;
  filter: drop-shadow(0 4px 30px var(--gold-glow));
}
.cover-title {
  font-family: var(--font-display);
  font-size: 2.4rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--gold-bright);
  margin-bottom: 10px;
  text-shadow: 0 0 20px rgba(201, 168, 76, 0.4);
}
.cover-subtitle {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-style: italic;
  color: #c8c4b8;
  letter-spacing: 0.15em;
  margin-bottom: 40px;
}
.cover-divider {
  width: 80px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  margin: 20px auto;
}
.cover-version {
  font-family: var(--font-display);
  font-size: 0.85rem;
  letter-spacing: 0.25em;
  color: var(--gold);
  text-transform: uppercase;
  margin-top: 10px;
}
.cover-staff {
  position: absolute;
  bottom: 50px;
  left: 0;
  right: 0;
  font-family: var(--font-display);
  font-size: 0.75rem;
  letter-spacing: 0.3em;
  color: var(--text-muted);
  text-transform: uppercase;
}
.cover-hint {
  position: absolute;
  bottom: 18px;
  left: 0;
  right: 0;
  font-size: 0.72rem;
  color: var(--gold-dark);
  letter-spacing: 0.1em;
  opacity: 0.7;
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 0.9; }
}

/* Contraportada */
.back-cover {
  background:
    radial-gradient(ellipse at center, var(--bg-dark) 0%, var(--bg-deep) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gold-dark);
  font-family: var(--font-display);
  letter-spacing: 0.2em;
  position: relative;
  border: 1px solid var(--gold-dark);
}
.back-cover::before {
  content: '';
  position: absolute;
  inset: 18px;
  border: 1px solid var(--gold-dark);
}
.back-cover .seal {
  font-size: 4rem;
  filter: drop-shadow(0 0 20px var(--gold-glow));
}

/* Página interior (la del reverso de la tapa, blanca/decorativa) */
.endpaper {
  background:
    repeating-linear-gradient(45deg,
      rgba(139, 105, 20, 0.04) 0px,
      rgba(139, 105, 20, 0.04) 1px,
      transparent 1px,
      transparent 14px),
    var(--bg-page);
  display: flex;
  align-items: center;
  justify-content: center;
}
.endpaper-inner {
  text-align: center;
  color: var(--text-muted);
  font-family: var(--font-display);
  font-style: italic;
  font-size: 0.9rem;
  padding: 40px;
  letter-spacing: 0.05em;
  line-height: 1.8;
}
.endpaper-inner::before,
.endpaper-inner::after {
  content: '❦';
  display: block;
  color: var(--gold-dark);
  font-size: 1.8rem;
  margin: 14px 0;
}

/* ─── Controles ─── */
.controls {
  position: fixed;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: rgba(15, 15, 25, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(201, 168, 76, 0.25);
  border-radius: 50px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(201, 168, 76, 0.08) inset;
  opacity: 0;
  transition: opacity 0.5s ease;
}
.controls.visible { opacity: 1; }

.ctrl-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid rgba(201, 168, 76, 0.25);
  background: rgba(201, 168, 76, 0.08);
  color: var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  outline: none;
}
.ctrl-btn:hover {
  background: rgba(201, 168, 76, 0.2);
  border-color: var(--gold);
  color: var(--gold-bright);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(201, 168, 76, 0.25);
}
.ctrl-btn:active { transform: translateY(0); }
.ctrl-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}
.ctrl-btn-secondary {
  width: 32px; height: 32px;
  background: transparent;
  border-color: rgba(201, 168, 76, 0.15);
  color: rgba(201, 168, 76, 0.7);
}

.page-indicator {
  display: flex;
  align-items: center;
  gap: 3px;
  font-family: var(--font-display);
  font-size: 0.85rem;
  color: var(--gold-bright);
  letter-spacing: 0.05em;
  min-width: 60px;
  justify-content: center;
}
.page-indicator .sep { opacity: 0.5; margin: 0 2px; }

/* ─── Hint inicial ─── */
.hint {
  position: fixed;
  top: 28px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  padding: 10px 22px;
  background: rgba(15, 15, 25, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(201, 168, 76, 0.2);
  border-radius: 30px;
  font-size: 0.82rem;
  color: rgba(232, 232, 239, 0.8);
  letter-spacing: 0.02em;
  opacity: 0;
  transition: opacity 0.5s ease;
  pointer-events: none;
}
.hint.visible { opacity: 1; }
.hint.fade-out { opacity: 0; }
.hint kbd {
  display: inline-block;
  padding: 2px 7px;
  margin: 0 2px;
  background: rgba(201, 168, 76, 0.15);
  border: 1px solid rgba(201, 168, 76, 0.3);
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--gold-bright);
  font-weight: 600;
}

/* ─── Responsive ─── */
@media (max-width: 768px) {
  .page-content { padding: 30px 28px 50px; }
  .page-title { font-size: 1.15rem; }
  .page-content p, .page-content ul li { font-size: 0.9rem; }
  .page-content h3 { font-size: 1rem; }
  .cover-title { font-size: 1.6rem; }
  .cover-logo { width: 130px; }
  .controls { bottom: 16px; padding: 8px 14px; gap: 8px; }
  .ctrl-btn { width: 38px; height: 38px; }
  .ctrl-btn-secondary { width: 34px; height: 34px; }
  .hint { font-size: 0.72rem; padding: 8px 14px; top: 16px; }
  .page-content .two-cols { grid-template-columns: 1fr; }
}
