/* ============================================================================
   EL CERRAJERO DE LAVAPIÉS — ESTÉTICA NOIR DE POSGUERRA (1939–1955)
   Paleta: Carbón de Madrid, Latón Envejecido, Acero Forjado, Carmesí DGS
   ============================================================================ */
:root {
  --bg-deep: #0c0a08;
  --bg-surface: #15120f;
  --bg-elevated: #1e1915;
  --bg-panel: #191512;
  --border-subtle: rgba(200, 155, 75, 0.2);
  --border-strong: rgba(200, 155, 75, 0.48);

  --brass: #c89b4b;
  --brass-bright: #ecc06c;
  --brass-dim: #7c5e2c;
  --steel: #8fa3b0;
  --steel-dark: #374149;
  --crimson: #a8332a;
  --crimson-soft: rgba(168, 51, 42, 0.22);
  --emerald: #4e8c6a;

  --text-main: #ede4d4;
  --text-muted: #b0a390;
  --text-dim: #7f7363;

  --font-display: 'Cinzel', Georgia, serif;
  --font-literary: 'Cormorant Garamond', Georgia, serif;
  --font-typewriter: 'Special Elite', 'Courier New', monospace;
  --font-ui: 'Inter', system-ui, -apple-system, sans-serif;

  --radius: 10px;
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.72);
}

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

html, body {
  margin: 0;
  padding: 0;
  background: radial-gradient(circle at 50% 0%, #1d1712 0%, var(--bg-deep) 70%);
  color: var(--text-main);
  font-family: var(--font-ui);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

/* Sutil grano cinematográfico */
.noir-grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 999;
  opacity: 0.045;
  background-image: radial-gradient(rgba(255, 240, 210, 0.5) 1px, transparent 0);
  background-size: 4px 4px;
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fadeInUp 0.42s ease-out both; }

/* ============================================================================
   HUD SUPERIOR
   ============================================================================ */
.hud {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(12, 10, 8, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-subtle);
}

.hud-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0.65rem 1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.hud-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: none;
  border: none;
  color: var(--text-main);
  cursor: pointer;
  text-align: left;
  padding: 0.2rem 0.4rem;
  border-radius: 6px;
  transition: background 0.2s;
}
.hud-brand:hover { background: rgba(200, 155, 75, 0.1); }
.brand-key {
  font-size: 1.6rem;
  color: var(--brass);
  line-height: 1;
}
.hud-brand strong {
  display: block;
  font-family: var(--font-display);
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  color: var(--brass-bright);
}
.hud-brand small {
  display: block;
  font-size: 0.72rem;
  color: var(--text-muted);
  letter-spacing: 0.08em;
}

.hud-meters {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.meter-chip {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 0.32rem 0.65rem;
  min-width: 115px;
}
.meter-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.7rem;
  color: var(--text-muted);
  gap: 0.5rem;
}
.meter-top strong { color: var(--text-main); font-size: 0.76rem; }
.meter-track {
  height: 5px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 99px;
  overflow: hidden;
  margin-top: 0.25rem;
}
.meter-fill { height: 100%; border-radius: 99px; transition: width 0.4s ease; }
.meter-fill.danger { background: linear-gradient(90deg, #a8332a, #e05a47); }
.meter-fill.gold { background: linear-gradient(90deg, #9c7432, #ecc06c); }

.moral-chip { min-width: 130px; }
.moral-chip > strong {
  display: block;
  font-size: 0.78rem;
  color: var(--brass-bright);
  margin-top: 0.05rem;
}

.hud-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.hud-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  padding: 0.42rem 0.7rem;
  border-radius: 7px;
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: all 0.2s;
}
.hud-btn:hover {
  border-color: var(--brass);
  background: rgba(200, 155, 75, 0.14);
}
.hud-btn-amazon {
  background: rgba(200, 155, 75, 0.16);
  border-color: var(--brass);
  color: var(--brass-bright);
}
.count-pill {
  background: var(--brass);
  color: #140f08;
  font-weight: 700;
  font-size: 0.68rem;
  padding: 0.05rem 0.38rem;
  border-radius: 99px;
}

/* ============================================================================
   CONTENEDOR PRINCIPAL Y BOTONES
   ============================================================================ */
.game-stage {
  max-width: 1020px;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
}

.eyebrow {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--brass);
  margin-bottom: 0.45rem;
}

.btn-primary, .btn-secondary, .btn-ghost, .btn-amazon, .btn-micro {
  font-family: var(--font-ui);
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
}

.btn-primary {
  background: linear-gradient(135deg, #b88738, #e0b25c);
  color: #151009;
  border: 1px solid #f1ca7b;
  padding: 0.72rem 1.25rem;
  font-size: 0.92rem;
  box-shadow: 0 6px 20px rgba(200, 155, 75, 0.22);
}
.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 10px 26px rgba(200, 155, 75, 0.35);
}
.btn-primary:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-main);
  border: 1px solid var(--border-strong);
  padding: 0.7rem 1.15rem;
  font-size: 0.9rem;
}
.btn-secondary:hover:not(:disabled) {
  background: rgba(200, 155, 75, 0.14);
  border-color: var(--brass-bright);
}
.btn-secondary:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid rgba(255, 255, 255, 0.14);
  padding: 0.68rem 1rem;
  font-size: 0.86rem;
}
.btn-ghost:hover { color: var(--text-main); border-color: var(--brass); }

.btn-amazon {
  background: linear-gradient(135deg, #d8962e, #f5b942);
  color: #171006;
  border: 1px solid #ffd479;
  padding: 0.85rem 1.45rem;
  font-size: 0.98rem;
  font-weight: 700;
  box-shadow: 0 10px 28px rgba(232, 165, 55, 0.3);
}
.btn-amazon:hover { transform: translateY(-2px); box-shadow: 0 14px 34px rgba(245, 185, 66, 0.45); }

.btn-lg { padding: 0.88rem 1.55rem; font-size: 1rem; }

.btn-micro {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-main);
  border: 1px solid var(--border-strong);
  padding: 0.5rem 0.85rem;
  font-size: 0.88rem;
  min-width: 60px;
}
.btn-micro:hover { background: rgba(200, 155, 75, 0.18); border-color: var(--brass-bright); }
.btn-micro:active { transform: scale(0.96); }

/* ============================================================================
   PANTALLA DE PORTADA (TITLE HERO)
   ============================================================================ */
.title-hero {
  background: linear-gradient(180deg, rgba(28, 23, 18, 0.92), rgba(14, 11, 9, 0.96));
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 2.2rem;
  box-shadow: var(--shadow-lg);
}

.title-hero-grid {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 2.2rem;
  align-items: center;
}

.title-cover-wrap { text-align: center; }

.book-cover-3d {
  width: 100%;
  max-width: 280px;
  border-radius: 8px;
  border: 1px solid rgba(236, 192, 108, 0.4);
  box-shadow: -10px 18px 40px rgba(0, 0, 0, 0.82), 0 0 0 1px rgba(255,255,255,0.06);
  transition: transform 0.35s ease;
}
.book-cover-3d:hover { transform: translateY(-4px) rotate(-0.8deg); }
.book-cover-3d.small-cover { max-width: 190px; }

.cover-ribbon {
  display: inline-block;
  margin-top: 0.85rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--brass-bright);
  border: 1px solid var(--border-strong);
  padding: 0.25rem 0.7rem;
  border-radius: 99px;
  background: rgba(200, 155, 75, 0.1);
}

.hero-title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4.2vw, 3rem);
  line-height: 1.1;
  margin: 0.2rem 0 0.5rem;
  color: #f6ebd6;
  text-shadow: 0 4px 20px rgba(0, 0, 0, 0.65);
}

.hero-author {
  font-family: var(--font-literary);
  font-size: 1.25rem;
  color: var(--brass-bright);
  margin: 0 0 1rem;
}

.hero-lead {
  font-size: 1rem;
  color: var(--text-muted);
  margin: 0 0 1.4rem;
}

.hero-pillars {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.6rem;
}

.pillar {
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 0.7rem 0.8rem;
}
.pillar strong {
  display: block;
  font-size: 0.82rem;
  color: var(--brass-bright);
  margin-bottom: 0.2rem;
}
.pillar span {
  display: block;
  font-size: 0.76rem;
  color: var(--text-muted);
  line-height: 1.35;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 1.3rem;
}

.hero-amazon-strip {
  padding-top: 1rem;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  font-size: 0.84rem;
  color: var(--text-muted);
}
.amazon-inline-link {
  color: var(--brass-bright);
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px dashed var(--brass);
}
.amazon-inline-link:hover { color: #ffe0a3; border-bottom-style: solid; }

/* ============================================================================
   ESCENAS NARRATIVAS
   ============================================================================ */
.scene-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

.scene-media {
  position: relative;
  min-height: 310px;
  background-size: cover;
  background-repeat: no-repeat;
  display: flex;
  align-items: flex-end;
}

.scene-media-overlay {
  width: 100%;
  padding: 4.5rem 1.8rem 1.4rem;
  background: linear-gradient(180deg, rgba(12, 10, 8, 0.08) 0%, rgba(12, 10, 8, 0.72) 55%, var(--bg-surface) 100%);
}

.scene-meta-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-bottom: 0.45rem;
}

.tag-act, .tag-loc {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.24rem 0.65rem;
  border-radius: 99px;
  background: rgba(12, 10, 8, 0.78);
  border: 1px solid var(--border-strong);
  color: var(--brass-bright);
}
.tag-loc { color: var(--text-main); border-color: rgba(255, 255, 255, 0.2); }

.scene-title {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 3vw, 2.2rem);
  margin: 0;
  color: #f8efdf;
}

.scene-body { padding: 1.2rem 1.8rem 2rem; }

.speaker-chip {
  display: inline-block;
  font-size: 0.8rem;
  color: var(--text-muted);
  background: rgba(200, 155, 75, 0.08);
  border-left: 3px solid var(--brass);
  padding: 0.28rem 0.75rem;
  border-radius: 0 6px 6px 0;
  margin-bottom: 1rem;
}
.speaker-chip strong { color: var(--brass-bright); }

.story-prose {
  font-family: var(--font-literary);
  font-size: 1.26rem;
  line-height: 1.68;
  color: #ece3d2;
}
.story-prose p { margin: 0 0 1rem; }

.risk-callout {
  background: rgba(168, 51, 42, 0.14);
  border: 1px solid rgba(224, 90, 71, 0.36);
  border-left: 4px solid #d14c3f;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-size: 0.88rem;
  color: #f0cbc4;
  margin: 1.2rem 0 1.4rem;
}

.choices-stack {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1.2rem;
}
.centered-choices { align-items: center; margin-top: 1.6rem; }

.choice-btn {
  text-align: left;
  background: linear-gradient(135deg, rgba(34, 28, 22, 0.95), rgba(22, 18, 14, 0.98));
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 1rem 1.2rem;
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.choice-btn:hover {
  border-color: var(--brass-bright);
  background: linear-gradient(135deg, rgba(52, 40, 26, 0.96), rgba(28, 22, 16, 0.98));
  transform: translateX(4px);
}
.choice-main { font-size: 0.98rem; font-weight: 600; color: #f6ecd9; }
.choice-hint { font-size: 0.78rem; color: var(--brass); letter-spacing: 0.02em; }

/* ============================================================================
   EXPEDIENTE OFICIAL DE LA DGS (PAPEL MECANOGRAFIADO LIMPIO)
   ============================================================================ */
.dossier-stage {
  max-width: 780px;
  margin: 0 auto;
}
.dossier-intro { text-align: center; margin-bottom: 1.5rem; }
.dossier-intro h2 { font-family: var(--font-display); font-size: 1.9rem; margin: 0.2rem 0 0.8rem; }
.dossier-intro p { font-family: var(--font-literary); font-size: 1.2rem; color: var(--text-muted); }

.dgs-paper {
  position: relative;
  background: linear-gradient(160deg, #e5d7b8 0%, #d4c19c 100%);
  color: #1f1a14;
  font-family: var(--font-typewriter);
  padding: 2rem 2.2rem;
  border-radius: 4px;
  box-shadow: 0 22px 55px rgba(0, 0, 0, 0.78), inset 0 0 60px rgba(90, 62, 28, 0.28);
  border: 1px solid #a6906a;
}

.dgs-stamp {
  position: absolute;
  top: 1.3rem;
  right: 1.4rem;
  border: 3px solid #96221b;
  color: #96221b;
  padding: 0.25rem 0.65rem;
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.14em;
  transform: rotate(7deg);
  opacity: 0.85;
}

.dgs-header {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  border-bottom: 2px solid #3a3025;
  padding-bottom: 0.85rem;
  font-size: 0.82rem;
}
.dgs-ref { text-align: right; }

.dgs-headline {
  text-align: center;
  font-size: 1.15rem;
  margin: 1.25rem 0;
  letter-spacing: 0.06em;
  text-decoration: underline;
}

.dgs-fields { margin: 0; display: grid; gap: 0.55rem; font-size: 0.9rem; }
.dgs-fields > div { display: grid; grid-template-columns: 185px 1fr; gap: 0.6rem; }
.dgs-fields dt { font-weight: 700; }
.dgs-fields dd { margin: 0; }

.dgs-quote {
  margin: 1.25rem 0;
  padding: 0.85rem 1rem;
  background: rgba(31, 26, 20, 0.08);
  border-left: 3px solid #7d1f1a;
  font-style: italic;
  font-size: 0.9rem;
}

.dgs-signature {
  text-align: right;
  margin-top: 1.2rem;
  font-size: 0.8rem;
}
.dgs-signature em {
  display: block;
  font-family: var(--font-literary);
  font-size: 1.65rem;
  color: #202840;
  margin-top: 0.2rem;
}

/* ============================================================================
   MOTOR DE PUZLES MECÁNICOS (ACERO Y LATÓN)
   ============================================================================ */
.puzzle-mount-area { margin-top: 1.5rem; }

.puzzle-shell {
  position: relative;
  background: linear-gradient(180deg, #1b1714 0%, #110f0d 100%);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  padding: 1.35rem;
  box-shadow: inset 0 1px 0 rgba(255, 228, 175, 0.12), 0 14px 36px rgba(0, 0, 0, 0.55);
}

.puzzle-header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 0.9rem;
  margin-bottom: 1.15rem;
  padding-bottom: 0.9rem;
  border-bottom: 1px solid var(--border-subtle);
}

.puzzle-badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 0.2rem 0.58rem;
  border-radius: 99px;
  background: rgba(200, 155, 75, 0.16);
  color: var(--brass-bright);
  border: 1px solid var(--border-strong);
}
.danger-badge {
  background: rgba(168, 51, 42, 0.24);
  color: #f49b90;
  border-color: rgba(224, 90, 71, 0.5);
}

.puzzle-title {
  font-family: var(--font-display);
  font-size: 1.22rem;
  margin: 0.35rem 0 0.2rem;
  color: #f6ecd8;
}
.puzzle-sub { margin: 0; font-size: 0.85rem; color: var(--text-muted); }

.puzzle-meter-pill {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 0.45rem 0.85rem;
  text-align: right;
  min-width: 130px;
}
.puzzle-meter-pill span { display: block; font-size: 0.68rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.08em; }
.puzzle-meter-pill strong { font-size: 1.05rem; color: var(--brass-bright); }
.danger-pill strong { color: #ef7464; }

.tactile-readout {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-left: 3px solid var(--steel);
  border-radius: 7px;
  padding: 0.68rem 0.9rem;
  font-size: 0.87rem;
  color: var(--text-main);
  margin: 0.85rem 0;
  min-height: 2.8rem;
}
.tactile-readout.warm { border-left-color: var(--brass); color: #f4ddb0; }
.tactile-readout.hot { border-left-color: #6bd490; background: rgba(78, 140, 106, 0.16); color: #d6f7e1; }
.tactile-readout.danger { border-left-color: #e05a47; background: rgba(168, 51, 42, 0.18); color: #ffd1ca; }

.puzzle-actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
  margin-top: 0.9rem;
}

.puzzle-hint-box {
  margin-top: 0.85rem;
  background: rgba(200, 155, 75, 0.1);
  border: 1px dashed var(--brass);
  border-radius: 8px;
  padding: 0.72rem 0.95rem;
  font-size: 0.84rem;
  color: #f3dfb8;
}

/* --- PUZLE 1: ARCÓN TOLEDANO --- */
.wards-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.8rem;
  margin-bottom: 1.1rem;
}
.ward-card {
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--border-subtle);
  border-radius: 9px;
  padding: 0.8rem;
  text-align: center;
  transition: all 0.25s;
}
.ward-card.active { border-color: var(--brass-bright); background: rgba(200, 155, 75, 0.08); }
.ward-card.solved { border-color: var(--emerald); background: rgba(78, 140, 106, 0.14); }
.ward-label { font-family: var(--font-display); font-size: 0.85rem; color: var(--brass-bright); margin-bottom: 0.5rem; }
.ward-chamber {
  position: relative;
  height: 68px;
  background: #0c0a09;
  border: 1px solid #3c342b;
  border-radius: 6px;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.ward-plate {
  width: 56%;
  height: 36px;
  background: linear-gradient(180deg, #7f8d96, #3d454a);
  border: 1px solid #a2b1ba;
  border-radius: 4px 4px 0 0;
  transition: transform 0.14s ease-out;
}
.ward-card.solved .ward-plate { background: linear-gradient(180deg, #ecc06c, #9a702c); border-color: #ffe2a4; }
.ward-notch {
  position: absolute;
  top: 8px;
  left: 12%;
  right: 12%;
  height: 2px;
  background: rgba(236, 192, 108, 0.55);
}
.ward-status { font-size: 0.74rem; color: var(--text-muted); margin-top: 0.45rem; }

.tactile-gauge-box { margin-bottom: 0.9rem; }
.gauge-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}
.gauge-sweet { color: var(--brass-bright); font-weight: 600; }
.gauge-track {
  position: relative;
  height: 22px;
  background: #0d0b09;
  border: 1px solid var(--border-strong);
  border-radius: 99px;
  overflow: hidden;
}
.gauge-zone {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 42%;
  width: 16%;
  background: rgba(236, 192, 108, 0.28);
  border-left: 1px solid var(--brass);
  border-right: 1px solid var(--brass);
}
.gauge-needle {
  position: absolute;
  top: 2px;
  bottom: 2px;
  width: 8px;
  margin-left: -4px;
  background: var(--steel);
  border-radius: 99px;
  left: 50%;
  transition: left 0.08s linear, background 0.15s;
}
.gauge-needle.in-zone { background: #74e39a; box-shadow: 0 0 12px #74e39a; }

.slider-control-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.slider-control-row input[type="range"] {
  flex: 1;
  accent-color: var(--brass-bright);
  height: 8px;
  cursor: pointer;
}

/* --- PUZLE 2: CILINDRO AZBE (5 PERNOS + LÍNEA DE CORTE) --- */
.shear-legend {
  font-size: 0.76rem;
  color: var(--brass-bright);
  margin-bottom: 0.45rem;
  text-align: center;
}
.azbe-cutaway {
  position: relative;
  background: linear-gradient(180deg, #2d2316 0%, #1a140d 50%, #271f14 100%);
  border: 2px solid #755b30;
  border-radius: 10px;
  padding: 1rem 0.75rem;
  overflow: hidden;
}

.shear-line-bar {
  position: absolute;
  left: 0;
  right: 0;
  top: 98px;
  height: 2px;
  background: linear-gradient(90deg, transparent, #f5cb73, #f5cb73, transparent);
  box-shadow: 0 0 10px rgba(245, 203, 115, 0.7);
  z-index: 5;
  pointer-events: none;
}
.shear-line-bar span {
  position: absolute;
  right: 10px;
  top: -17px;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: #f5cb73;
  background: rgba(16, 12, 8, 0.85);
  padding: 0.08rem 0.4rem;
  border-radius: 4px;
}

.pins-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.6rem;
}

.pin-column {
  background: rgba(12, 10, 8, 0.55);
  border: 1px solid rgba(200, 155, 75, 0.22);
  border-radius: 8px;
  padding: 0.55rem 0.35rem;
  color: var(--text-main);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: all 0.2s;
}
.pin-column:hover { border-color: var(--brass); }
.pin-column.selected { border-color: var(--brass-bright); box-shadow: 0 0 0 2px rgba(236, 192, 108, 0.28); }
.pin-column.set { border-color: var(--emerald); background: rgba(78, 140, 106, 0.16); }

.pin-chamber {
  position: relative;
  width: 34px;
  height: 155px;
  background: #0d0b09;
  border: 1px solid #4d3d25;
  border-radius: 5px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.pin-spring {
  position: absolute;
  top: 0;
  width: 14px;
  height: 36px;
  background: repeating-linear-gradient(180deg, #6e7982 0px, #6e7982 2px, transparent 2px, transparent 6px);
  opacity: 0.55;
}

.pin-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: transform 0.18s ease-out;
}
.pin-driver {
  width: 20px;
  height: 46px;
  background: linear-gradient(90deg, #6c7a84, #a4b5c2, #536069);
  border-radius: 3px 3px 1px 1px;
}
.pin-gap {
  width: 24px;
  height: 4px;
  background: #050505;
  border-top: 1px solid #f5cb73;
  border-bottom: 1px solid #f5cb73;
}
.pin-key {
  width: 20px;
  height: 48px;
  background: linear-gradient(90deg, #9d7630, #f0c56c, #8a6423);
  border-radius: 1px 1px 4px 4px;
}

.pin-num { font-size: 0.76rem; font-weight: 700; margin-top: 0.45rem; color: var(--brass-bright); }
.pin-tag { font-size: 0.68rem; color: var(--text-muted); margin-top: 0.12rem; }

/* --- PUZLES 3, 4B y 5B: DIALES DE CAJAS FUERTES + ESTETOSCOPIO --- */
.safe-workspace {
  display: grid;
  grid-template-columns: 290px 1fr;
  gap: 1.4rem;
  align-items: center;
}

.dial-column {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.9rem;
}

.dial-steps-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.45rem;
  width: 100%;
}
.disc-pill {
  flex: 1;
  min-width: 68px;
  text-align: center;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: 7px;
  padding: 0.32rem 0.4rem;
}
.disc-pill span { display: block; font-size: 0.65rem; color: var(--text-muted); text-transform: uppercase; }
.disc-pill strong { display: block; font-size: 0.76rem; color: var(--text-main); }
.disc-pill.active { border-color: var(--brass-bright); background: rgba(200, 155, 75, 0.14); }
.disc-pill.solved { border-color: var(--emerald); background: rgba(78, 140, 106, 0.18); }
.disc-pill.solved strong { color: #84e5a7; }

.safe-dial-frame {
  position: relative;
  width: 215px;
  height: 215px;
  border-radius: 50%;
  background: radial-gradient(circle, #2a2f34 0%, #14171a 75%);
  border: 5px solid #4d565e;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.7), inset 0 0 20px rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.fichet-frame { border-color: #9e7a3c; background: radial-gradient(circle, #302619 0%, #16110b 75%); }
.gruber-frame { border-color: #556b5d; }

.safe-dial-frame.dial-dragging,
.safe-dial-wheel.dial-dragging {
  cursor: grabbing !important;
  border-color: var(--brass-bright) !important;
  box-shadow:
    0 0 0 3px rgba(236, 192, 108, 0.45),
    0 0 26px rgba(236, 192, 108, 0.35),
    0 12px 30px rgba(0, 0, 0, 0.75),
    inset 0 0 20px rgba(0, 0, 0, 0.85) !important;
}
.safe-dial-frame.dial-dragging .safe-dial-wheel,
.safe-dial-wheel.dial-dragging {
  transition: none !important;
}

.dial-pointer {
  position: absolute;
  top: -13px;
  left: 50%;
  transform: translateX(-50%);
  color: #e65745;
  font-size: 1.1rem;
  text-shadow: 0 2px 6px rgba(0,0,0,0.8);
  z-index: 4;
}

.safe-dial-wheel {
  width: 178px;
  height: 178px;
  border-radius: 50%;
  background: repeating-conic-gradient(from -3deg, #32393f 0deg 2deg, #1b2024 2deg 6deg);
  border: 3px solid #7d8b96;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.14s cubic-bezier(0.22, 1, 0.36, 1);
}
.brass-wheel {
  background: repeating-conic-gradient(from -3deg, #8e6c32 0deg 2deg, #2b2112 2deg 6deg);
  border-color: #e2b866;
}
.alpha-wheel {
  background: repeating-conic-gradient(from -6deg, #4b574e 0deg 3deg, #1a201c 3deg 13.84deg);
  border-color: #9bb3a2;
}

.dial-inner-cap {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 3;
  width: 112px;
  height: 112px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #2a241d, #0f0d0a);
  border: 2px solid var(--brass);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.85), 0 4px 14px rgba(0, 0, 0, 0.65);
  pointer-events: none;
}
.dial-brand { font-size: 0.56rem; letter-spacing: 0.14em; color: var(--brass); }
.dial-number { font-family: var(--font-display); font-size: 2rem; color: #f6ebd5; line-height: 1.1; }
.dial-year { font-size: 0.62rem; color: var(--text-muted); letter-spacing: 0.1em; }

.dial-controls {
  display: flex;
  gap: 0.42rem;
  flex-wrap: wrap;
  justify-content: center;
}

.stethoscope-box {
  background: #0e0c0a;
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 0.9rem;
}
.scope-header {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  color: var(--brass);
  margin-bottom: 0.55rem;
}
.dir-ok { color: var(--text-main); font-weight: 600; }

.stethoscope-box canvas {
  width: 100%;
  height: 115px;
  background: radial-gradient(circle at 50% 50%, #141918 0%, #090b0a 100%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  display: block;
}

.alert-bar-wrap {
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 99px;
  margin-top: 0.6rem;
  overflow: hidden;
}
.alert-bar-fill { height: 100%; background: linear-gradient(90deg, #c89b4b, #df4e3d); transition: width 0.3s; }

/* --- PUZLE 4A: GORJAS GRUBER --- */
.gruber-wards-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.gruber-ward {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 0.65rem;
  text-align: center;
}
.gruber-ward.aligned { border-color: var(--emerald); background: rgba(78, 140, 106, 0.14); }
.gruber-levels { display: flex; flex-direction: column; gap: 0.3rem; margin-bottom: 0.4rem; }
.g-slot {
  height: 26px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.76rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
}
.g-slot.target-slot { border-color: rgba(236, 192, 108, 0.55); border-style: dashed; color: var(--brass); }
.g-slot.filled { background: linear-gradient(90deg, #916d2f, #e0b25c); color: #161008; font-weight: 700; border-style: solid; }
.gruber-ward.aligned .g-slot.filled { background: linear-gradient(90deg, #3c7d57, #6bd490); }

.levers-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.6rem;
}
.lever-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 0.65rem 0.5rem;
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.18s;
}
.lever-btn:hover { background: rgba(200, 155, 75, 0.16); border-color: var(--brass-bright); transform: translateY(-1px); }
.lever-btn strong { display: block; font-size: 0.84rem; color: var(--brass-bright); }
.lever-btn span { display: block; font-size: 0.72rem; color: var(--text-muted); margin-top: 0.15rem; }

.acid-dots { display: flex; gap: 0.5rem; margin-top: 0.6rem; }
.acid-dot {
  flex: 1;
  height: 8px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(224, 90, 71, 0.25);
}
.acid-dot.lit { background: #e05241; box-shadow: 0 0 10px #e05241; }
.acid-vial-label { color: #8ad6a2; font-weight: 600; }

/* --- PUZLE 5: BIBLIOTECA Y CEBOS --- */
.library-spots-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(175px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.spot-card {
  text-align: left;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  padding: 0.9rem;
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.2s;
}
.spot-card:hover:not(:disabled) { border-color: var(--brass-bright); background: rgba(200, 155, 75, 0.12); }
.spot-card.checked { opacity: 0.5; cursor: default; }
.spot-card.found { border-color: #6bd490; background: rgba(78, 140, 106, 0.22); }
.spot-card strong { display: block; font-size: 0.9rem; color: var(--brass-bright); margin-bottom: 0.2rem; }
.spot-card span { font-size: 0.76rem; color: var(--text-muted); }

.gate-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 0.55rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}
.dot-cebo, .dot-real {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-right: 0.3rem;
}
.dot-cebo { background: #e07a5f; }
.dot-real { background: #f2c15a; }

.puzzle-retry-overlay {
  position: absolute;
  inset: 0;
  background: rgba(10, 8, 6, 0.92);
  backdrop-filter: blur(5px);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  z-index: 20;
}
.retry-card {
  max-width: 440px;
  text-align: center;
  background: var(--bg-elevated);
  border: 1px solid rgba(224, 90, 71, 0.55);
  border-radius: 12px;
  padding: 1.6rem;
}
.retry-card h4 { font-family: var(--font-display); font-size: 1.35rem; margin: 0.6rem 0; color: #f6d4cd; }
.retry-card p { font-size: 0.9rem; color: var(--text-muted); margin-bottom: 1.2rem; }

/* ============================================================================
   EPÍLOGO CLIFFHANGER Y CONVERSIÓN A AMAZON
   ============================================================================ */
.epilogue-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  padding: 2rem;
  box-shadow: var(--shadow-lg);
}
.epilogue-banner { text-align: center; max-width: 760px; margin: 0 auto 1.6rem; }
.epilogue-title { font-family: var(--font-display); font-size: clamp(1.6rem, 3.4vw, 2.4rem); margin: 0.3rem 0 0.7rem; color: #f8efdf; }
.epilogue-sub { font-family: var(--font-literary); font-size: 1.22rem; color: var(--text-muted); margin: 0; }

.rank-certificate {
  background: linear-gradient(145deg, rgba(200, 155, 75, 0.12), rgba(20, 16, 12, 0.96));
  border: 1px solid var(--brass);
  border-radius: 12px;
  padding: 1.5rem;
  text-align: center;
  margin-bottom: 1.8rem;
}
.rank-badge { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.16em; color: var(--brass-bright); }
.rank-title { font-family: var(--font-display); font-size: 1.85rem; margin: 0.35rem 0 0.6rem; color: #fff5e1; }
.rank-desc { max-width: 680px; margin: 0 auto 1.2rem; color: var(--text-muted); font-size: 0.95rem; }

.rank-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.7rem;
  margin-bottom: 1.1rem;
}
.r-stat {
  background: rgba(0, 0, 0, 0.32);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 0.65rem;
}
.r-stat strong { display: block; font-size: 1.05rem; color: var(--brass-bright); }
.r-stat span { font-size: 0.72rem; color: var(--text-muted); }

.rank-share-row { display: flex; flex-direction: column; align-items: center; gap: 0.65rem; }
.rank-share-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.6rem;
  width: 100%;
}
.btn-social {
  font-family: var(--font-ui);
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.86rem;
  padding: 0.68rem 1rem;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.42rem;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, background 0.18s ease;
  border: 1px solid transparent;
}
.btn-social:hover:not(:disabled) { transform: translateY(-1px); }
.btn-social:disabled { opacity: 0.6; cursor: wait; }

.btn-download-card {
  background: linear-gradient(135deg, #b88738, #e6b860);
  color: #161006;
  border-color: #f6d48a;
  box-shadow: 0 6px 18px rgba(200, 155, 75, 0.25);
}
.btn-download-card:hover:not(:disabled) {
  box-shadow: 0 10px 24px rgba(236, 192, 108, 0.4);
}

.btn-whatsapp {
  background: linear-gradient(135deg, #1b6b3c, #249251);
  color: #f4fff7;
  border-color: rgba(112, 224, 156, 0.48);
  box-shadow: 0 6px 16px rgba(30, 128, 70, 0.22);
}
.btn-whatsapp:hover {
  background: linear-gradient(135deg, #217e47, #2aa65c);
  box-shadow: 0 10px 22px rgba(37, 163, 90, 0.34);
}

.btn-x {
  background: linear-gradient(135deg, #1c1d21, #0d0e11);
  color: #f5f5f7;
  border-color: rgba(255, 255, 255, 0.26);
}
.btn-x:hover {
  border-color: rgba(255, 255, 255, 0.6);
  background: linear-gradient(135deg, #27292f, #14151a);
}

.btn-copy-share {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-main);
  border-color: var(--border-strong);
}
.btn-copy-share:hover {
  background: rgba(200, 155, 75, 0.16);
  border-color: var(--brass-bright);
}

.share-feedback { font-size: 0.82rem; color: #8be6a9; min-height: 1.2rem; text-align: center; }

.paris-teaser-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.8rem;
}
.plan-figure {
  margin: 0;
  background: #0d0b09;
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  overflow: hidden;
}
.plan-figure img { width: 100%; height: 240px; object-fit: cover; display: block; }
.plan-figure figcaption {
  padding: 0.55rem 0.8rem;
  font-size: 0.78rem;
  color: var(--brass-bright);
  text-align: center;
}

.amazon-showcase {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 1.8rem;
  align-items: center;
  background: linear-gradient(135deg, rgba(42, 31, 18, 0.65), rgba(16, 13, 10, 0.98));
  border: 1px solid var(--brass);
  border-radius: 14px;
  padding: 1.6rem;
  margin-bottom: 1.5rem;
}
.amazon-cover-col { text-align: center; }
.amazon-copy-col h3 { font-family: var(--font-display); font-size: 1.75rem; margin: 0.2rem 0 0.25rem; }
.amazon-author { color: var(--brass-bright); margin: 0 0 0.8rem; font-size: 0.95rem; }
.amazon-hook { font-size: 0.96rem; color: #f2e6cf; margin: 0 0 0.75rem; }
.amazon-blurb { font-size: 0.88rem; color: var(--text-muted); margin: 0 0 1.2rem; }
.amazon-small { font-size: 0.75rem; color: var(--text-dim); margin: 0.55rem 0 0; }

.epilogue-footer-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
}

/* ============================================================================
   MODO LIBRE DE CAJAS
   ============================================================================ */
.freemode-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 1.6rem;
}
.freemode-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.2rem;
}
.freemode-header h2 { font-family: var(--font-display); margin: 0.2rem 0 0.35rem; }
.freemode-header p { margin: 0; color: var(--text-muted); font-size: 0.92rem; }

.freemode-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.75rem;
}
.freemode-item {
  text-align: left;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 0.9rem;
  color: var(--text-main);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  transition: all 0.2s;
}
.freemode-item:hover, .freemode-item.active {
  border-color: var(--brass-bright);
  background: rgba(200, 155, 75, 0.11);
}
.freemode-item strong { font-size: 0.94rem; color: #f6ebd5; }
.freemode-item small { font-size: 0.76rem; color: var(--text-muted); }
.freemode-status { font-size: 0.76rem; font-weight: 600; color: var(--brass-bright); margin-top: auto; }

.freemode-item-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
}
.freemode-item-bonus {
  background: linear-gradient(145deg, rgba(200, 155, 75, 0.13), rgba(168, 51, 42, 0.09), rgba(18, 14, 11, 0.95));
  border-color: rgba(236, 192, 108, 0.55);
  box-shadow: inset 0 1px 0 rgba(255, 232, 178, 0.18), 0 8px 22px rgba(0, 0, 0, 0.35);
}
.freemode-item-bonus:hover,
.freemode-item-bonus.active {
  border-color: #ffd780;
  background: linear-gradient(145deg, rgba(236, 192, 108, 0.22), rgba(168, 51, 42, 0.14), rgba(22, 17, 12, 0.98));
}
.bonus-ribbon {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.16rem 0.5rem;
  border-radius: 99px;
  background: linear-gradient(135deg, #c89b4b, #f0c56c);
  color: #161006;
}
.bonus-badge {
  background: rgba(168, 51, 42, 0.22);
  color: #ffd5a8;
  border-color: rgba(236, 192, 108, 0.55);
}

.paris-teaser-card {
  background: linear-gradient(155deg, rgba(44, 32, 18, 0.85), rgba(20, 15, 11, 0.96));
  border-color: var(--brass);
  border-left: 4px solid var(--brass-bright);
}
.paris-teaser-note {
  margin: 0.85rem 0 0;
  font-size: 0.86rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ============================================================================
   FEEDBACK TÁCTIL Y ATAJOS DE TECLADO EN PUZLES
   ============================================================================ */
@keyframes shakeError {
  0%, 100% { transform: translateX(0); }
  16% { transform: translateX(-7px); }
  32% { transform: translateX(6px); }
  48% { transform: translateX(-5px); }
  64% { transform: translateX(4px); }
  80% { transform: translateX(-2px); }
}

@keyframes unlockFlash {
  0% {
    box-shadow: 0 0 0 0 rgba(236, 192, 108, 0.78), inset 0 0 0 rgba(236, 192, 108, 0.45);
    border-color: #ffe39e;
  }
  45% {
    box-shadow: 0 0 38px 6px rgba(236, 192, 108, 0.52), inset 0 0 34px rgba(236, 192, 108, 0.24);
    border-color: #fff0c2;
  }
  100% {
    box-shadow: inset 0 1px 0 rgba(255, 228, 175, 0.12), 0 14px 36px rgba(0, 0, 0, 0.55);
    border-color: var(--border-strong);
  }
}

.shake-error {
  animation: shakeError 0.42s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
  border-color: rgba(224, 90, 71, 0.85) !important;
  box-shadow: 0 0 22px rgba(224, 90, 71, 0.28), 0 14px 36px rgba(0, 0, 0, 0.55) !important;
}

.unlock-flash {
  animation: unlockFlash 0.85s ease-out both;
}

.puzzle-kbd-hint {
  margin-top: 0.75rem;
  padding-top: 0.65rem;
  border-top: 1px dashed rgba(200, 155, 75, 0.2);
  font-size: 0.74rem;
  color: var(--text-dim);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
  line-height: 1.45;
}
.puzzle-kbd-hint kbd {
  font-family: var(--font-ui);
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--brass-bright);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(200, 155, 75, 0.34);
  border-radius: 4px;
  padding: 0.05rem 0.36rem;
}

/* ============================================================================
   MODALES: FRAGMENTO LITERARIO, MAPA DE MADRID, CUADERNO Y LA NOVELA
   ============================================================================ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(6, 5, 4, 0.85);
  backdrop-filter: blur(6px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  overflow-y: auto;
}

.modal-box {
  width: 100%;
  max-width: 760px;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--bg-elevated);
  border: 1px solid var(--brass);
  border-radius: 14px;
  padding: 1.6rem;
  box-shadow: var(--shadow-lg);
}

.modal-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.1rem;
}
.modal-top-bar h3 { font-family: var(--font-display); margin: 0.2rem 0 0; font-size: 1.4rem; }
.modal-close-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1rem;
}
.modal-close-btn:hover { background: var(--crimson); border-color: var(--crimson); }

.literary-card {
  background: linear-gradient(155deg, #241e17, #17130f);
  border: 1px solid var(--border-strong);
  border-left: 4px solid var(--brass);
  border-radius: 8px;
  padding: 1.15rem 1.3rem;
  margin: 1rem 0;
}
.literary-card.compact { margin: 0.7rem 0; padding: 0.95rem 1.1rem; }
.literary-ch { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.12em; color: var(--brass); }
.literary-card h4 { font-family: var(--font-display); margin: 0.25rem 0 0.6rem; font-size: 1.08rem; }
.literary-card blockquote {
  margin: 0;
  font-family: var(--font-literary);
  font-size: 1.18rem;
  font-style: italic;
  color: #f3ead9;
  line-height: 1.58;
}
.literary-sig { text-align: right; font-size: 0.8rem; color: var(--text-muted); margin-top: 0.7rem; }

.reward-modal h3 { font-family: var(--font-display); margin: 0.2rem 0 0.3rem; font-size: 1.45rem; }
.reward-meta { color: #8ce4aa; font-size: 0.88rem; margin: 0 0 0.6rem; }
.modal-actions-row { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; margin-top: 1.2rem; }

/* MAPA DE MADRID */
.madrid-map-canvas {
  position: relative;
  height: 350px;
  background: radial-gradient(circle at 50% 50%, #241d15 0%, #14100c 100%);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 1rem;
}
.madrid-svg { position: absolute; inset: 0; width: 100%; height: 100%; }

.map-pin {
  position: absolute;
  transform: translate(-50%, -50%);
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  z-index: 2;
}
.pin-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--brass-bright);
  border: 2px solid #16110b;
  box-shadow: 0 0 12px rgba(236, 192, 108, 0.85);
}
.map-pin.locked .pin-dot { background: #4c463f; box-shadow: none; }
.pin-name {
  font-size: 0.68rem;
  font-weight: 600;
  color: #f5ead6;
  background: rgba(12, 10, 8, 0.88);
  border: 1px solid var(--border-subtle);
  padding: 0.14rem 0.42rem;
  border-radius: 4px;
  white-space: nowrap;
}
.map-pin.locked .pin-name { color: var(--text-dim); }

.map-detail-box {
  background: rgba(0, 0, 0, 0.32);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 0.9rem 1rem;
  font-size: 0.88rem;
}
.map-detail-box strong { color: var(--brass-bright); display: block; margin-bottom: 0.3rem; }
.map-detail-box p { margin: 0; color: var(--text-muted); }

/* CUADERNO / GLOSARIO */
.codex-tabs { display: flex; gap: 0.5rem; margin-bottom: 1rem; border-bottom: 1px solid var(--border-subtle); padding-bottom: 0.65rem; }
.tab-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  padding: 0.48rem 0.9rem;
  border-radius: 7px;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
}
.tab-btn.active { background: rgba(200, 155, 75, 0.18); border-color: var(--brass); color: var(--brass-bright); }

.glossary-item {
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  padding: 0.75rem 0;
}
.g-cat { font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.12em; color: var(--brass); }
.glossary-item h4 { margin: 0.15rem 0 0.3rem; font-size: 0.98rem; color: #f6ecd9; }
.glossary-item p { margin: 0; font-size: 0.86rem; color: var(--text-muted); }

.locked-entry {
  padding: 0.75rem 0.95rem;
  margin: 0.5rem 0;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px dashed rgba(255, 255, 255, 0.12);
  font-size: 0.82rem;
  color: var(--text-dim);
}

.book-modal-grid {
  display: grid;
  grid-template-columns: 195px 1fr;
  gap: 1.3rem;
  align-items: start;
}

.site-footer {
  text-align: center;
  padding: 1.2rem 1rem 2rem;
  font-size: 0.8rem;
  color: var(--text-dim);
}
.site-footer a { color: var(--brass); text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }

/* ============================================================================
   RESPONSIVE (MÓVIL Y TABLET)
   ============================================================================ */
@media (max-width: 820px) {
  .title-hero { padding: 1.35rem; }
  .title-hero-grid,
  .safe-workspace,
  .amazon-showcase,
  .paris-teaser-grid,
  .book-modal-grid {
    grid-template-columns: 1fr;
  }
  .hero-pillars { grid-template-columns: 1fr; }
  .rank-stats-grid { grid-template-columns: repeat(2, 1fr); }
  .scene-media { min-height: 230px; }
  .scene-body { padding: 1rem 1.15rem 1.5rem; }
  .dgs-paper { padding: 1.35rem; }
  .dgs-fields > div { grid-template-columns: 1fr; gap: 0.15rem; }
  .dgs-stamp { position: static; display: inline-block; margin-bottom: 0.8rem; transform: none; }
  .levers-grid { grid-template-columns: repeat(2, 1fr); }
  .pins-grid { gap: 0.35rem; }
  .pin-chamber { width: 28px; height: 140px; }
  .hud-meters { width: 100%; justify-content: space-between; }
  .meter-chip { flex: 1; min-width: 95px; }
}

/* ============================================================================
   RESPONSIVE MÓVILES PEQUEÑOS (375px – 520px)
   ============================================================================ */
@media (max-width: 520px) {
  .hud-inner {
    padding: 0.5rem 0.65rem;
    gap: 0.45rem;
  }
  .hud-brand strong { font-size: 0.86rem; }
  .hud-brand small { font-size: 0.66rem; }
  .hud-meters { gap: 0.4rem; }
  .meter-chip {
    padding: 0.26rem 0.48rem;
    min-width: 0;
  }
  .moral-chip { min-width: 100%; }
  .hud-actions {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.35rem;
  }
  .hud-btn {
    justify-content: center;
    padding: 0.42rem 0.45rem;
    font-size: 0.74rem;
    white-space: nowrap;
  }

  .game-stage { padding: 0.95rem 0.65rem 2.2rem; }
  .title-hero { padding: 1.15rem 1rem; border-radius: 12px; }
  .book-cover-3d { max-width: 210px; }
  .hero-actions { flex-direction: column; align-items: stretch; }
  .hero-actions button { width: 100%; }

  .scene-media { min-height: 205px; }
  .scene-media-overlay { padding: 3rem 1rem 1rem; }
  .scene-body { padding: 0.95rem 0.95rem 1.35rem; }
  .story-prose { font-size: 1.12rem; line-height: 1.62; }
  .choice-btn { padding: 0.85rem 0.95rem; }

  .puzzle-shell { padding: 0.95rem 0.8rem; }
  .puzzle-meter-pill {
    width: 100%;
    text-align: left;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  .puzzle-actions-row { flex-direction: column; align-items: stretch; }
  .puzzle-actions-row > button,
  .puzzle-actions-row > a { width: 100%; }

  .wards-row { gap: 0.45rem; }
  .ward-card { padding: 0.55rem 0.35rem; }
  .ward-label { font-size: 0.74rem; }
  .slider-control-row { flex-wrap: wrap; gap: 0.45rem; }
  .slider-control-row .btn-micro { flex: 1; }

  .azbe-cutaway { padding: 0.8rem 0.35rem; }
  .pins-grid { gap: 0.25rem; }
  .pin-column { padding: 0.4rem 0.15rem; }
  .pin-chamber { width: 24px; height: 124px; }
  .pin-driver, .pin-key { width: 16px; }
  .pin-gap { width: 20px; }
  .pin-num { font-size: 0.68rem; }
  .pin-tag { font-size: 0.6rem; text-align: center; }

  .safe-dial-frame { width: 192px; height: 192px; }
  .safe-dial-wheel { width: 158px; height: 158px; }
  .dial-inner-cap { width: 98px; height: 98px; }
  .dial-number { font-size: 1.7rem; }
  .dial-controls { gap: 0.35rem; width: 100%; }
  .dial-controls .btn-micro { flex: 1 1 22%; min-width: 52px; padding: 0.48rem 0.4rem; font-size: 0.82rem; }
  .disc-pill { min-width: 60px; }

  .gruber-wards-grid { grid-template-columns: repeat(2, 1fr); gap: 0.55rem; }

  .epilogue-card { padding: 1.15rem 0.9rem; border-radius: 12px; }
  .rank-certificate { padding: 1.15rem 0.85rem; }
  .rank-title { font-size: 1.45rem; }
  .rank-share-actions { flex-direction: column; }
  .rank-share-actions .btn-social { width: 100%; min-height: 44px; }
  .amazon-showcase { padding: 1.15rem 0.95rem; gap: 1.2rem; }
  .amazon-cta-row .btn-amazon { width: 100%; text-align: center; padding: 0.85rem 1rem; font-size: 0.92rem; }
  .epilogue-footer-actions { flex-direction: column; }
  .epilogue-footer-actions button { width: 100%; }

  .freemode-card { padding: 1.1rem 0.85rem; }
  .freemode-list { grid-template-columns: 1fr; }

  .modal-backdrop { padding: 0.55rem; }
  .modal-box { padding: 1.1rem 0.95rem; max-height: 92vh; }
  .modal-actions-row { flex-direction: column; align-items: stretch; }
  .modal-actions-row > button,
  .modal-actions-row > a { width: 100%; }
  .codex-tabs { flex-direction: column; }
  .tab-btn { width: 100%; text-align: center; }
  .madrid-map-canvas { height: 290px; }
  .pin-name { font-size: 0.6rem; padding: 0.1rem 0.32rem; }
}
