/* Museo de las Ideas · Propuesta 5 · Explorador (prueba de concepto)
   Museo 2D en pixel art con la identidad de Placetopay: caminar, descubrir historias, rescatar ideas.
   La interfaz habla el mismo idioma que las ilustraciones: contorno azul marino, esquinas pixeladas
   y superficies blancas con sombra gris en la base, como los muebles de las salas. */

:root {
  --navy: #111827;
  --ink: #1f2937;
  --gray-700: #374151;
  --gray-600: #4b5563;
  --gray-500: #6b7280;
  --gray-300: #d1d5db;
  --gray-200: #e5e7eb;
  --gray-100: #f3f4f6;
  --gray-50: #f9fafb;
  --white: #ffffff;
  --orange: #ff6c0c;
  --orange-btn: #e8590c;
  --orange-hover: #f2660f;
  --orange-edge: #a83a06;
  --orange-deep: #c2410c;
  --orange-soft: #fc7f4f;
  --orange-tint: #fff1e7;
  --purple: #71357b;
  --purple-tint: #f5edf7;
  --aqua: #95d0d5;
  --aqua-deep: #0f766e;
  --aqua-tint: #e8f6f7;
  --green: #3f9a52;
  --green-tint: #eaf6ec;
  --display: 'Red Hat Display', system-ui, sans-serif;
  --text: 'Red Hat Text', system-ui, sans-serif;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --lift: drop-shadow(0 10px 16px rgb(17 24 39 / 0.24));
  --lift-lg: drop-shadow(0 20px 34px rgb(17 24 39 / 0.38));
  --lit: drop-shadow(0 0 2px rgb(255 255 255 / 0.95)) drop-shadow(0 0 5px rgb(255 236 214 / 0.9))
    drop-shadow(0 0 12px rgb(255 150 70 / 0.8)) drop-shadow(0 0 22px rgb(255 108 12 / 0.45));
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--navy);
  color: var(--ink);
  font: 500 16px/1.55 var(--text);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
::selection { background: var(--orange); color: var(--white); }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--orange); outline-offset: 5px; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Marco pixel ----------
   Contorno de un píxel de mundo (3–4 px) con esquinas escalonadas y base sombreada. */
.card, .sheet, .sheet-x, .niche, .q-area, .room, .atlas, .atlas-tag, .steps i, .sample-note, .tag, .hud-btn .n {
  --pf-c: var(--navy);
  --pf-w: 3px;
  --pf-base: var(--gray-200);
  border-radius: 0;
  box-shadow:
    calc(var(--pf-w) * -1) 0 0 0 var(--pf-c),
    var(--pf-w) 0 0 0 var(--pf-c),
    0 calc(var(--pf-w) * -1) 0 0 var(--pf-c),
    0 var(--pf-w) 0 0 var(--pf-c),
    inset 0 calc(var(--pf-w) * -1.35) 0 0 var(--pf-base);
}
.card { background: var(--white); color: var(--ink); }

/* ---------- Botones: bloques que se hunden al presionar ---------- */
.btn {
  --b-face: var(--orange-btn);
  --b-edge: var(--orange-edge);
  --b-c: var(--navy);
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 52px; padding: 0 24px 5px;
  border: 0; border-radius: 0;
  background: var(--b-face);
  color: var(--white);
  font: 800 19px/1 var(--display);
  letter-spacing: 0.005em;
  text-shadow: 0 1px 0 rgb(110 32 0 / 0.35);
  cursor: pointer;
  box-shadow:
    -3px 0 0 0 var(--b-c), 3px 0 0 0 var(--b-c), 0 -3px 0 0 var(--b-c), 0 3px 0 0 var(--b-c),
    inset 0 -5px 0 0 var(--b-edge), inset 0 3px 0 0 rgb(255 255 255 / 0.28);
  transition: transform 0.08s ease-out, box-shadow 0.08s ease-out, padding 0.08s ease-out;
}
.btn:hover { --b-face: var(--orange-hover); }
.btn:active {
  transform: translateY(3px);
  padding-bottom: 2px;
  box-shadow:
    -3px 0 0 0 var(--b-c), 3px 0 0 0 var(--b-c), 0 -3px 0 0 var(--b-c), 0 3px 0 0 var(--b-c),
    inset 0 -2px 0 0 var(--b-edge), inset 0 3px 0 0 rgb(0 0 0 / 0.06);
}
.btn svg { width: 12px; height: 12px; }
.btn.ghost { --b-face: var(--white); --b-edge: var(--gray-300); color: var(--navy); text-shadow: none; }
.btn.ghost:hover { --b-face: var(--gray-50); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* ---------- Escenario ---------- */
.stage {
  position: fixed; inset: 0;
  overflow: hidden;
  background: var(--navy);
  touch-action: manipulation;
}
.cam { position: absolute; left: 0; top: 0; will-change: transform; }
.scene { position: relative; width: var(--sw); height: var(--sh); }
.plate, .occ, .hl {
  position: absolute;
  user-select: none; -webkit-user-drag: none;
  pointer-events: none;
}
.plate { inset: 0; width: 100%; height: 100%; }
.occ, .hl { height: auto; }
.scene.crisp .plate, .scene.crisp .occ, .scene.crisp .hl { image-rendering: pixelated; }
.floor-hit { position: absolute; inset: 0; cursor: pointer; }

.sprite {
  position: absolute;
  translate: -50% -95.3%;
  image-rendering: pixelated;
  pointer-events: none;
}
.hero {
  width: var(--hero-w); height: var(--hero-w);
  background: url('../img/explorador/explorador.png') no-repeat;
  background-size: 400% 300%;
}
.hero.flip, .npc-sprite.flip { transform: scaleX(-1); }
.hero-shadow {
  position: absolute;
  width: calc(var(--hero-w) * 0.36); height: calc(var(--hero-w) * 0.1);
  translate: -50% -55%;
  border-radius: 50%;
  background: rgb(17 24 39 / 0.2);
  pointer-events: none;
}
.target-ring {
  position: absolute;
  width: calc(var(--hero-w) * 0.42); height: calc(var(--hero-w) * 0.19);
  translate: -50% -50%;
  border: 3px solid var(--orange);
  border-radius: 50%;
  opacity: 0;
  pointer-events: none;
  z-index: 1;
}
.target-ring.on { animation: ring 0.6s var(--ease-out); }
@keyframes ring { from { opacity: 1; scale: 0.6; } to { opacity: 0; scale: 1.25; } }

/* Salas en obra: cintas y barrera frente a los accesos cerrados */
.obra { position: absolute; pointer-events: none; }
.obra-cintas { overflow: visible; }
.cinta {
  position: absolute; left: -6%; right: -6%; top: 50%;
  height: 13%;
  background: repeating-linear-gradient(-45deg, #f5c400 0 18px, var(--navy) 18px 36px);
  box-shadow: 0 0 0 2px var(--navy), 0 6px 8px -2px rgb(17 24 39 / 0.35);
  image-rendering: pixelated;
}
.cinta.a { rotate: 24deg; }
.cinta.b { rotate: -20deg; top: 58%; }
.obra-prop { height: auto; image-rendering: pixelated; filter: drop-shadow(0 4px 2px rgb(17 24 39 / 0.25)); }

/* Puntos interactivos: piezas, puertas, personajes */
.spot {
  position: absolute;
  translate: -50% -100%;
  padding: 0; border: 0; background: none;
  cursor: pointer;
}
.spot img { display: block; width: 100%; height: auto; image-rendering: pixelated; pointer-events: none; }
.spot.piece { width: var(--piece-w); translate: -50% -92%; }
.spot.piece img { filter: drop-shadow(0 3px 2px rgb(17 24 39 / 0.25)); transition: translate 0.25s var(--ease-out), filter 0.18s; }
.spot.piece:hover img, .spot.piece.near img, .spot.piece:focus-visible img { translate: 0 -6%; }
.spot.npc { width: var(--hero-w); height: var(--hero-w); translate: -50% -95.3%; }
.npc-sprite {
  position: absolute; inset: 0;
  background-repeat: no-repeat; background-size: 400% 100%;
  image-rendering: pixelated;
  transition: filter 0.18s;
}
.npc-shadow {
  position: absolute; left: 50%; top: 95.3%;
  width: 36%; height: 10%;
  translate: -50% -55%;
  border-radius: 50%;
  background: rgb(17 24 39 / 0.2);
}
.spot.npc .badge { bottom: 92%; }
.spot.zone { translate: -50% -50%; }
.spot:focus-visible { outline: none; }

/* Contorno iluminado de lo que se puede tocar */
.hl { z-index: 4; opacity: 0; transition: opacity 0.18s, filter 0.18s; }
.hl.on { opacity: 1; filter: var(--lit) brightness(1.06); }
.spot.piece.lit img, .spot.piece.near img, .spot.piece:focus-visible img { filter: var(--lit) brightness(1.05); }
.spot.npc.lit .npc-sprite, .spot.npc.near .npc-sprite, .spot.npc:focus-visible .npc-sprite { filter: var(--lit); }

.badge {
  position: absolute; left: 50%; bottom: 100%;
  translate: -50% -6px;
  width: 30px; height: 30px;
  display: grid; place-items: center;
  pointer-events: none;
}
.badge svg { width: 30px; height: 30px; shape-rendering: crispEdges; filter: drop-shadow(0 2px 2px rgb(17 24 39 / 0.25)); }
body.talking .tag, body.talking .hint, body.talking .poc { opacity: 0 !important; }
.badge.new { animation: bob 1.2s steps(4) infinite; }
@keyframes bob { 50% { translate: -50% -12px; } }

.tag {
  --pf-w: 2px;
  position: absolute; left: 50%; bottom: calc(100% + 40px);
  translate: -50% 0;
  white-space: nowrap;
  padding: 7px 12px 8px;
  background: var(--white); color: var(--navy);
  font: 700 14px/1.2 var(--display);
  opacity: 0; pointer-events: none;
  transition: opacity 0.18s;
  filter: var(--lift);
  z-index: 5;
}
.spot:hover .tag, .spot.near .tag, .spot:focus-visible .tag { opacity: 1; }
.tag kbd {
  display: inline-grid; place-items: center;
  min-width: 20px; height: 20px; margin-right: 8px; padding: 0 5px 1px;
  background: var(--orange-btn); color: var(--white);
  box-shadow: inset 0 -2px 0 0 var(--orange-edge);
  font: 800 12px/1 var(--display);
}

/* ---------- Barra superior ---------- */
.hud {
  position: fixed; left: 0; right: 0; top: 0;
  z-index: 20;
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: max(18px, env(safe-area-inset-top)) 22px 0;
  pointer-events: none;
}
.hud > * { pointer-events: auto; }
.room-plate {
  display: flex; flex-direction: column; gap: 2px;
  padding: 10px 18px 13px;
  filter: var(--lift);
}
.room-plate b { font: 800 19px/1.15 var(--display); letter-spacing: -0.01em; color: var(--navy); }
.room-plate span { font: 500 13.5px/1.3 var(--text); color: var(--gray-600); }
.hud-btns { display: flex; gap: 14px; }
.hud-btn {
  display: inline-flex; align-items: center; gap: 9px;
  min-height: 44px; padding: 0 15px 3px;
  border: 0; cursor: pointer;
  font: 700 15px/1 var(--display); color: var(--navy);
  filter: var(--lift);
  transition: background-color 0.15s, transform 0.08s;
}
.hud-btn svg { width: 20px; height: 20px; shape-rendering: crispEdges; }
.hud-btn:hover { background: var(--orange-tint); }
.hud-btn:active { transform: translateY(2px); }
.hud-btn .n {
  --pf-w: 2px; --pf-c: var(--orange-deep); --pf-base: transparent;
  margin-left: 2px; padding: 3px 7px 4px;
  background: var(--orange-tint); color: var(--orange-deep);
  font: 800 13px/1 var(--display); font-variant-numeric: tabular-nums;
}

.hint {
  position: fixed; left: 22px; bottom: max(18px, env(safe-area-inset-bottom));
  z-index: 15;
  margin: 0; padding: 8px 14px 9px;
  font: 500 14px/1.35 var(--text);
  color: var(--white);
  background: rgb(17 24 39 / 0.88);
  box-shadow: -2px 0 0 0 rgb(17 24 39 / 0.88), 2px 0 0 0 rgb(17 24 39 / 0.88), 0 -2px 0 0 rgb(17 24 39 / 0.88), 0 2px 0 0 rgb(17 24 39 / 0.88);
  pointer-events: none;
}
.hint kbd { font: 800 13px/1 var(--display); color: var(--orange-soft); }
.poc {
  position: fixed; right: 22px; bottom: max(18px, env(safe-area-inset-bottom));
  z-index: 15; margin: 0; padding: 6px 12px 7px;
  background: rgb(17 24 39 / 0.7);
  box-shadow: -2px 0 0 0 rgb(17 24 39 / 0.7), 2px 0 0 0 rgb(17 24 39 / 0.7), 0 -2px 0 0 rgb(17 24 39 / 0.7), 0 2px 0 0 rgb(17 24 39 / 0.7);
  font: 600 13px/1.3 var(--display);
  color: rgb(255 255 255 / 0.88);
  pointer-events: none;
}

/* ---------- Pantalla de título ---------- */
.title {
  position: fixed; inset: 0; z-index: 40;
  display: grid; align-items: center;
  background: var(--gray-50) center / cover no-repeat;
}
.title::before {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(90deg, rgb(249 250 251 / 0.97) 0%, rgb(249 250 251 / 0.88) 34%, rgb(249 250 251 / 0) 58%);
}
.title-in {
  position: relative;
  max-width: 560px;
  margin-left: clamp(20px, 7vw, 120px);
  display: flex; flex-direction: column; align-items: flex-start; gap: 20px;
}
.title h1 {
  margin: 0;
  font: 800 clamp(46px, 6.2vw, 84px)/0.98 var(--display);
  letter-spacing: -0.03em;
  color: var(--navy);
  text-wrap: balance;
}
.title h1 em { font-style: normal; color: var(--orange); }
.title p { margin: 0; max-width: 34ch; font: 500 clamp(17px, 1.5vw, 20px)/1.55 var(--text); color: var(--gray-700); }
.title .quote { font-style: italic; color: var(--purple); font-weight: 600; }
.title .btn { min-height: 60px; padding: 0 32px 5px; font-size: 21px; margin-top: 10px; }
.title.out { animation: fadeOut 0.6s var(--ease-out) forwards; }
@keyframes fadeOut { to { opacity: 0; visibility: hidden; } }

/* ---------- Transición tipo iris ---------- */
.iris {
  position: fixed; z-index: 35;
  left: var(--ix, 50%); top: var(--iy, 50%);
  width: 0; height: 0;
  translate: -50% -50%;
  border-radius: 50%;
  box-shadow: 0 0 0 300vmax var(--navy);
  pointer-events: none;
}
.iris.open { width: 320vmax; height: 320vmax; }

.banner {
  --pf-w: 4px;
  position: fixed; left: 50%; top: 19%;
  z-index: 18;
  translate: -50% 0;
  padding: 16px 30px 20px;
  text-align: center;
  pointer-events: none;
  opacity: 0;
  filter: var(--lift-lg);
}
.banner b { display: block; font: 800 clamp(26px, 3vw, 36px)/1.1 var(--display); letter-spacing: -0.02em; color: var(--navy); }
.banner span { display: block; margin-top: 6px; font: 500 16px/1.45 var(--text); color: var(--gray-600); }
.banner.on { animation: banner 3.2s var(--ease-out) forwards; }
@keyframes banner {
  0% { opacity: 0; translate: -50% -12px; }
  12%, 80% { opacity: 1; translate: -50% 0; }
  100% { opacity: 0; translate: -50% -6px; }
}

/* ---------- Diálogo de personaje: caja de texto de juego ---------- */
.talk {
  --pf-w: 4px;
  position: fixed; left: 50%; bottom: max(28px, env(safe-area-inset-bottom));
  z-index: 30;
  width: min(780px, calc(100vw - 40px));
  translate: -50% 0;
  display: grid; grid-template-columns: auto 1fr; column-gap: 22px; align-items: start;
  padding: 28px 28px 18px 22px;
  filter: var(--lift-lg);
  cursor: pointer;
}
.talk:focus { outline: none; }
.talk .face {
  --pf-w: 3px;
  grid-row: span 3;
  width: 96px; height: 96px;
  background: var(--purple-tint) no-repeat;
  background-size: 997px 249px;
  background-position: -77px -22px;
  image-rendering: pixelated;
  box-shadow: -3px 0 0 0 var(--navy), 3px 0 0 0 var(--navy), 0 -3px 0 0 var(--navy), 0 3px 0 0 var(--navy), inset 0 -4px 0 0 #e6d6ea;
}
.talk .who {
  position: absolute; left: 18px; top: -19px;
  margin: 0; padding: 7px 13px 9px;
  background: var(--orange-btn); color: var(--white);
  font: 800 15px/1 var(--display);
  text-shadow: 0 1px 0 rgb(110 32 0 / 0.35);
  box-shadow: -3px 0 0 0 var(--navy), 3px 0 0 0 var(--navy), 0 -3px 0 0 var(--navy), 0 3px 0 0 var(--navy), inset 0 -3px 0 0 var(--orange-edge);
}
.talk .say { margin: 0; min-height: 3.2em; max-width: 58ch; font: 500 19px/1.6 var(--text); color: var(--navy); }
.talk .next {
  grid-column: 2; justify-self: end;
  display: inline-flex; align-items: center; gap: 7px;
  margin-top: 6px;
  font: 700 14px/1 var(--display); color: var(--gray-600);
}
.talk .next svg { width: 12px; height: 12px; color: var(--orange); animation: nudge 0.9s steps(2) infinite; }
@keyframes nudge { 50% { translate: 0 3px; } }
.talk-acts { grid-column: 2; display: flex; flex-wrap: wrap; gap: 16px 18px; margin-top: 14px; }

/* ---------- Paneles (fichas, pasaporte, plano, laboratorio) ---------- */
dialog.panel {
  width: min(700px, calc(100vw - 40px));
  max-height: min(88vh, 880px);
  padding: 0;
  border: 0;
  overflow: visible;
  background: transparent;
  color: var(--ink);
}
dialog.panel:focus, dialog.panel:focus-visible, .sheet:focus, .sheet:focus-visible { outline: none; }
dialog.panel::backdrop { background: rgb(17 24 39 / 0.58); }
dialog.panel[open] { animation: pop 0.28s var(--ease-out); }
@keyframes pop { from { opacity: 0; translate: 0 12px; } }
.sheet {
  --pf-w: 4px;
  max-height: min(88vh, 880px);
  overflow: auto;
  padding: 32px 36px 32px;
  background: var(--white);
  filter: var(--lift-lg);
  scrollbar-width: thin;
  scrollbar-color: var(--gray-300) transparent;
}
.sheet-x {
  position: absolute; right: 18px; top: 18px; z-index: 2;
  width: 40px; height: 40px;
  display: grid; place-items: center;
  padding: 0 0 3px; border: 0; cursor: pointer;
  background: var(--white);
  transition: background-color 0.15s, transform 0.08s;
}
.sheet-x svg { width: 14px; height: 14px; shape-rendering: crispEdges; }
.sheet-x:hover { background: var(--orange-tint); }
.sheet-x:active { transform: translateY(2px); }
.sheet h2 {
  margin: 0 52px 8px 0;
  font: 800 clamp(26px, 3vw, 31px)/1.12 var(--display);
  letter-spacing: -0.02em;
  color: var(--navy);
  text-wrap: balance;
}
.sheet .lede { margin: 0 0 24px; max-width: 58ch; font: 500 17px/1.62 var(--text); color: var(--gray-700); }

/* Encabezado con nicho: la pieza del museo enmarcada junto al título */
.sheet-head { display: grid; grid-template-columns: 96px 1fr; gap: 22px; align-items: center; margin: 0 0 26px; }
.sheet-head h2 { margin-bottom: 6px; }
.niche {
  --pf-base: #cfe7ea;
  width: 96px; height: 96px;
  display: grid; place-items: center;
  background: var(--aqua-tint);
}
.niche.lab { --pf-base: #cfe8d4; background: var(--green-tint); }
.niche img { width: 74%; image-rendering: pixelated; filter: drop-shadow(0 3px 0 rgb(17 24 39 / 0.12)); }
.meta-line { margin: 0 0 4px; font: 500 14.5px/1.5 var(--text); color: var(--gray-600); }
.meta-line:last-child { margin-bottom: 0; }
.sample-note {
  --pf-w: 2px; --pf-c: var(--gray-500); --pf-base: transparent;
  display: inline-block; margin-right: 10px; padding: 1px 7px 2px;
  background: var(--gray-50); color: var(--gray-700);
  font: 700 12px/1.4 var(--display);
  vertical-align: 1px;
}

/* Cédula: secciones con ícono pixel */
.facts { display: grid; gap: 0; margin: 0 0 30px; }
.fact { padding: 18px 0; }
.fact + .fact { border-top: 2px dashed var(--gray-200); }
.fact:first-child { padding-top: 4px; }
.fact dt { display: flex; align-items: center; gap: 10px; font: 700 15.5px/1.25 var(--display); color: var(--navy); }
.fact dt svg { width: 22px; height: 22px; flex: none; shape-rendering: crispEdges; }
.fact dd { margin: 8px 0 0 32px; max-width: 60ch; font: 500 17px/1.65 var(--text); color: var(--ink); }
.fact.why { margin-top: 6px; padding: 16px 18px 18px; border-top: 0; background: var(--purple-tint); }
.fact.why dt { color: var(--purple); }
.acts { display: flex; flex-wrap: wrap; gap: 16px 18px; align-items: center; }
.rescued-note { display: inline-flex; align-items: center; gap: 8px; font: 700 15px/1.3 var(--display); color: var(--green); }
.rescued-note img { width: 32px; height: 32px; image-rendering: pixelated; }

/* Misión de rescate */
.steps { list-style: none; margin: 0 0 26px; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.steps li { display: flex; align-items: center; gap: 10px; font: 700 14px/1.2 var(--display); color: var(--gray-500); }
.steps i {
  --pf-w: 2px; --pf-c: var(--gray-300); --pf-base: transparent;
  flex: none; width: 30px; height: 30px;
  display: grid; place-items: center;
  font: 800 14px/1 var(--display); font-style: normal;
  background: var(--gray-100); color: var(--gray-500);
}
.steps li.now { color: var(--navy); }
.steps li.now i { --pf-c: var(--navy); --pf-base: var(--orange-edge); background: var(--orange-btn); color: var(--white); }
.steps li.done { color: var(--gray-700); }
.steps li.done i { --pf-c: var(--navy); --pf-base: #2c7a3d; background: var(--green); color: var(--white); }
.q-label { display: block; margin: 0 0 8px; font: 800 22px/1.3 var(--display); letter-spacing: -0.01em; color: var(--navy); text-wrap: balance; }
.q-help { margin: 0 0 16px; font: 500 16px/1.55 var(--text); color: var(--gray-600); }
.q-area {
  --pf-base: transparent;
  display: block; width: 100%; min-height: 140px;
  padding: 14px 16px;
  border: 0; outline: none; resize: vertical;
  background: var(--white);
  color: var(--navy);
  font: 500 17px/1.6 var(--text);
  caret-color: var(--orange);
  transition: box-shadow 0.15s;
}
.q-area:focus {
  box-shadow: -3px 0 0 0 var(--orange), 3px 0 0 0 var(--orange), 0 -3px 0 0 var(--orange), 0 3px 0 0 var(--orange),
    0 0 0 9px rgb(255 108 12 / 0.16);
}
.q-area::placeholder { color: var(--gray-500); }
.q-foot { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 22px; flex-wrap: wrap; }
.q-count { font: 600 13px/1 var(--display); color: var(--gray-600); font-variant-numeric: tabular-nums; }
.q-err { margin: 12px 0 0; font: 700 15px/1.4 var(--text); color: #b42318; }

.stamp-big {
  display: grid; place-items: center; gap: 12px;
  padding: 10px 0 4px;
  text-align: center;
}
.stamp-big h2 { margin: 0 !important; }
.stamp-big .ink { width: 150px; height: 150px; animation: stampIn 0.55s cubic-bezier(0.2, 0.9, 0.25, 1); }
@keyframes stampIn { from { opacity: 0; scale: 1.8; rotate: -14deg; } to { opacity: 1; scale: 1; rotate: -6deg; } }

/* Sellos (pasaporte) */
.stamps { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 22px 14px; margin-top: 8px; }
.stamp-cell { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.stamp-cell b { font: 700 14.5px/1.2 var(--display); color: var(--navy); }
.stamp-cell small { font: 500 12.5px/1.35 var(--text); color: var(--gray-600); }
.ink {
  --c: var(--purple);
  position: relative;
  width: 92px; height: 92px;
  display: grid; place-items: center;
  border-radius: 50%;
  box-shadow: inset 0 0 0 3px var(--c), inset 0 0 0 7px var(--white), inset 0 0 0 9px var(--c);
  rotate: var(--r, -6deg);
}
.ink img { width: 60%; image-rendering: pixelated; }
.ink.empty { box-shadow: none; border: 2px dashed var(--gray-300); rotate: 0deg; background: var(--gray-50); }
.ink.empty span { font: 800 26px/1 var(--display); color: var(--gray-300); }
.ink.lock { opacity: 0.55; }
.stamp-reset { margin-top: 24px; display: flex; justify-content: flex-end; }
.linkish { border: 0; background: none; padding: 6px 0; cursor: pointer; font: 600 14px/1.2 var(--display); color: var(--gray-600); text-decoration: underline; text-underline-offset: 3px; }
.linkish:hover { color: var(--orange-deep); }

/* Lista de salas (en teléfono, debajo del plano) */
.map {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-areas:
    "imp rec esp olv"
    "ent ent val lab";
  gap: 16px;
  margin-top: 8px;
}
.room {
  --pf-w: 3px;
  display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between; gap: 6px;
  min-height: 108px; padding: 12px 12px 15px;
  border: 0; text-align: left; cursor: pointer;
  background: var(--white);
  color: var(--navy);
  transition: background-color 0.15s;
}
.room img { width: 40px; height: 40px; image-rendering: pixelated; }
.room b { font: 700 15px/1.2 var(--display); }
.room small { font: 500 12.5px/1.3 var(--text); color: var(--gray-600); }
.room.here { --pf-c: var(--orange-deep); background: var(--orange-tint); }
.room.locked { --pf-c: var(--gray-300); --pf-base: transparent; background: var(--gray-50); cursor: not-allowed; }
.room.locked img { opacity: 0.5; filter: grayscale(0.6); }
.room.locked b { color: var(--gray-600); }
.room:not(.locked):hover { background: var(--orange-tint); }

/* Laboratorio: filas separadas, sin tarjetas dentro de tarjetas */
.lab-list { display: grid; margin-top: 4px; }
.lab-item { padding: 22px 0; }
.lab-item + .lab-item { border-top: 2px dashed var(--gray-200); }
.lab-item:first-child { padding-top: 6px; }
.lab-head { display: grid; grid-template-columns: 52px 1fr; gap: 14px; align-items: center; margin-bottom: 4px; }
.lab-head img { width: 52px; height: 52px; image-rendering: pixelated; }
.lab-item h3 { margin: 0 0 2px; font: 800 20px/1.2 var(--display); letter-spacing: -0.01em; color: var(--navy); }
.lab-item .meta-line { margin: 0; }
.lab-q { margin: 16px 0 0 66px; }
.lab-q h4 { margin: 0 0 6px; font: 700 14.5px/1.25 var(--display); color: var(--purple); }
.lab-q ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.lab-q li { position: relative; padding-left: 16px; max-width: 60ch; font: 500 16px/1.6 var(--text); color: var(--ink); }
.lab-q li::before { content: ''; position: absolute; left: 0; top: 0.62em; width: 6px; height: 6px; background: var(--orange); }
.lab-q li i { display: inline-block; margin-left: 4px; padding: 0 6px; font: 700 11.5px/1.6 var(--display); font-style: normal; background: var(--gray-100); color: var(--gray-600); vertical-align: 1px; }
.lab-q li i.you { background: var(--orange-tint); color: var(--orange-deep); }
.lab-empty { margin: 8px 0 0; color: var(--gray-600); }

/* Aviso breve */
.toast {
  position: fixed; left: 50%; top: 90px; z-index: 45;
  translate: -50% 0;
  display: flex; align-items: center; gap: 12px;
  padding: 8px 18px 11px 10px;
  font: 500 16px/1.25 var(--text);
  filter: var(--lift-lg);
  opacity: 0; pointer-events: none;
  transition: opacity 0.3s, translate 0.4s var(--ease-out);
}
.toast b { font-family: var(--display); font-weight: 800; color: var(--navy); }
.toast img, .toast svg { width: 40px; height: 40px; image-rendering: pixelated; }
.toast.on { opacity: 1; translate: -50% 6px; }

/* ---------- Minimapa ---------- */
.minimap {
  position: fixed; right: 22px; bottom: calc(max(18px, env(safe-area-inset-bottom)) + 44px);
  z-index: 16;
  width: 244px;
  display: grid; gap: 7px;
  padding: 10px 11px 12px;
  border: 0;
  text-align: left; cursor: pointer;
  filter: var(--lift);
  transition: translate 0.2s var(--ease-out);
}
.minimap:hover { translate: 0 -2px; }
.minimap svg { display: block; width: 100%; height: auto; }
.mm-cap { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.mm-cap b { font: 800 13.5px/1.2 var(--display); color: var(--navy); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mm-open { font: 700 12px/1 var(--display); color: var(--gray-600); white-space: nowrap; }
.mm-open kbd { display: inline-grid; place-items: center; min-width: 18px; height: 18px; margin-left: 5px; padding-bottom: 1px; background: var(--navy); color: var(--white); font: 800 11px/1 var(--display); }
.mm-bg { fill: var(--gray-100); }
.mm-floor { fill: var(--white); stroke: var(--gray-300); }
.mm-obs { fill: var(--gray-200); }
.mm-door { fill: var(--orange); }
.mm-door.locked { fill: #e0b400; }
.mm-arrow { fill: none; stroke: var(--white); stroke-linecap: round; stroke-linejoin: round; }
.mm-label { font-family: var(--display); font-weight: 700; fill: var(--navy); }
.mm-label.locked { fill: var(--gray-600); }
.mm-piece { stroke: var(--navy); }
.mm-piece.new { fill: var(--orange); }
.mm-piece.read { fill: var(--white); }
.mm-piece.resc { fill: var(--green); }
.mm-npc { fill: var(--purple); stroke: var(--white); }
.mm-zone { fill: var(--aqua); }
.mm-view { fill: rgb(255 108 12 / 0.06); stroke: var(--orange); stroke-dasharray: 4 3; vector-effect: non-scaling-stroke; }
.mm-hero { fill: var(--orange); stroke: var(--white); }
.mm-pulse { fill: rgb(255 108 12 / 0.35); transform-box: fill-box; transform-origin: center; animation: mmPulse 1.6s var(--ease-out) infinite; }
@keyframes mmPulse { from { scale: 0.6; opacity: 1; } to { scale: 2.4; opacity: 0; } }

/* ---------- Plano general ---------- */
dialog.panel.wide { width: min(1080px, calc(100vw - 40px)); }
dialog.panel.wide .sheet { padding: 28px 32px 28px; }
.atlas {
  --pf-w: 4px; --pf-base: transparent;
  position: relative;
  margin: 6px auto 20px;
  overflow: hidden;
  background: var(--gray-50);
  aspect-ratio: 1420 / 900;
  width: min(calc(100% - 8px), calc((min(88vh, 880px) - 260px) * 1.578));
}
.atlas-img { position: absolute; inset: 0; width: 100%; height: 100%; display: block; user-select: none; }
.atlas-room {
  position: absolute; padding: 0; border: 0; background: transparent; cursor: pointer;
  transition: background-color 0.18s, box-shadow 0.18s;
}
.atlas-room:hover, .atlas-room:focus-visible { background: rgb(255 255 255 / 0.12); box-shadow: inset 0 0 0 4px var(--orange); outline: none; }
.atlas-room.here { box-shadow: inset 0 0 0 4px var(--orange); }
.atlas-room.locked { background: rgb(17 24 39 / 0.5); cursor: not-allowed; }
.atlas-room.locked:hover { box-shadow: inset 0 0 0 4px #e0b400; background: rgb(17 24 39 / 0.42); }
.atlas-tag {
  --pf-w: 2px;
  position: absolute; left: 12px; top: 12px;
  display: grid; gap: 1px;
  max-width: calc(100% - 24px);
  padding: 6px 11px 8px;
  background: var(--white);
  text-align: left; pointer-events: none;
}
.atlas-tag b { font: 800 14px/1.15 var(--display); color: var(--navy); }
.atlas-tag small { font: 500 12px/1.25 var(--text); color: var(--gray-600); }
.atlas-room.here .atlas-tag small { color: var(--orange-deep); font-weight: 700; }
.atlas-room.locked .atlas-tag { --pf-c: var(--gray-500); }
.atlas-tag.patio { translate: 12px 12px; left: auto; }
/* Salas en obra: dos cintas cruzadas sobre la sala */
.atlas-tape { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 0; }
.atlas-room .atlas-tag { z-index: 1; }
.atlas-tape i {
  position: absolute; left: -10%; right: -10%; top: 54%;
  height: 12%; min-height: 10px; max-height: 22px;
  background: repeating-linear-gradient(-45deg, #f5c400 0 12px, var(--navy) 12px 24px);
  box-shadow: 0 0 0 2px var(--navy), 0 4px 8px rgb(0 0 0 / 0.35);
  rotate: 14deg;
}
.atlas-tape i + i { rotate: -12deg; top: 62%; }
.atlas-dot {
  position: absolute; width: 14px; height: 14px; translate: -50% -50%;
  border-radius: 50%; box-shadow: 0 0 0 2px var(--navy), 0 2px 4px rgb(0 0 0 / 0.3);
  pointer-events: none;
}
.atlas-dot.new { background: var(--orange); }
.atlas-dot.read { background: var(--white); }
.atlas-dot.resc { background: var(--green); }
.atlas-you { position: absolute; translate: -50% -50%; pointer-events: none; display: grid; justify-items: center; }
.atlas-face {
  width: 46px; height: 46px; border-radius: 50%;
  background-color: var(--white);
  background-image: url("../img/explorador/explorador.png");
  background-repeat: no-repeat;
  background-size: 460px 345px; background-position: -34px -12px;
  image-rendering: pixelated;
  box-shadow: 0 0 0 3px var(--orange), 0 6px 14px -4px rgb(17 24 39 / 0.5);
  animation: you 1.6s var(--ease-out) infinite alternate;
}
.atlas-you-tag {
  margin-top: 5px; padding: 2px 8px 3px;
  background: var(--orange-btn); color: var(--white);
  box-shadow: -2px 0 0 0 var(--navy), 2px 0 0 0 var(--navy), 0 -2px 0 0 var(--navy), 0 2px 0 0 var(--navy);
  font: 800 12px/1.3 var(--display);
}
.atlas-you::after {
  content: ""; width: 12px; height: 6px; margin-top: 3px; border-radius: 50%;
  background: rgb(17 24 39 / 0.35);
}
@keyframes you { to { translate: 0 -5px; } }
.atlas-legend { display: flex; flex-wrap: wrap; gap: 10px 22px; margin: 0; padding: 0; list-style: none; font: 500 14.5px/1.3 var(--text); color: var(--gray-700); }
.atlas-legend li { display: inline-flex; align-items: center; gap: 8px; }
.lg { flex: none; width: 14px; height: 14px; border-radius: 50%; box-shadow: 0 0 0 2px var(--navy); }
.lg.you { background: var(--orange); box-shadow: 0 0 0 3px var(--orange-tint), 0 0 0 5px var(--orange); width: 12px; height: 12px; }
.lg.new { background: var(--orange); }
.lg.read { background: var(--white); }
.lg.resc { background: var(--green); }
.lg.obra { width: 22px; height: 10px; border-radius: 0; background: repeating-linear-gradient(-45deg, #f5c400 0 5px, var(--navy) 5px 10px); box-shadow: 0 0 0 2px var(--navy); }
dialog.panel.wide .map { display: none; }

/* ---------- Teléfono ---------- */
@media (max-width: 720px) {
  .hud { padding: max(12px, env(safe-area-inset-top)) 12px 0; gap: 8px; }
  .room-plate { padding: 8px 13px 11px; }
  .room-plate b { font-size: 16px; }
  .room-plate span { display: none; }
  .hud-btns { gap: 10px; }
  .hud-btn { padding: 0 11px 3px; }
  .hud-btn .lbl { display: none; }
  .hint { left: 12px; right: 12px; font-size: 13.5px; text-align: center; }
  .poc { display: none; }
  .title::before { background: linear-gradient(0deg, rgb(249 250 251 / 0.98) 0%, rgb(249 250 251 / 0.9) 50%, rgb(249 250 251 / 0) 78%); }
  .title { align-items: end; background-position: 72% center; }
  .title-in { margin: 0 20px max(36px, env(safe-area-inset-bottom)); gap: 16px; }
  .talk { grid-template-columns: 1fr; padding: 28px 18px 16px; width: calc(100vw - 28px); }
  .talk .face { display: none; }
  .talk .who { left: 14px; }
  .talk .next, .talk-acts { grid-column: 1; }
  .talk .say { font-size: 17px; }
  dialog.panel { width: calc(100vw - 28px); }
  .sheet { padding: 26px 20px 24px; }
  .sheet .lede { font-size: 16px; }
  .sheet-head { grid-template-columns: 1fr; gap: 14px; margin-bottom: 20px; }
  .niche { width: 64px; height: 64px; }
  .sheet h2 { font-size: 24px; margin-right: 0; }
  .sheet > h2 { margin-right: 50px; }
  .sheet-x { right: 14px; top: 14px; }
  .btn { font-size: 18px; padding: 0 16px 5px; }
  .acts .btn { flex: 1 1 auto; }
  .room-plate { max-width: 52vw; }
  .room-plate b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .fact dd { margin-left: 0; font-size: 16px; }
  .steps { gap: 8px; }
  .steps li { flex-direction: column; align-items: flex-start; gap: 6px; font-size: 12.5px; }
  .q-label { font-size: 20px; }
  .lab-q { margin-left: 0; }
  .map { grid-template-columns: repeat(2, 1fr); grid-template-areas: "ent ent" "imp rec" "esp olv" "val lab"; }
  .stamps { grid-template-columns: repeat(3, 1fr); gap: 16px 8px; }
  .ink { width: 78px; height: 78px; }
  .minimap { right: auto; left: 12px; top: calc(max(12px, env(safe-area-inset-top)) + 60px); bottom: auto; width: 150px; padding: 7px 8px 9px; gap: 5px; }
  .mm-cap b { font-size: 12px; }
  .mm-open { display: none; }
  dialog.panel.wide .sheet { padding: 24px 16px 22px; }
  .atlas-tag { left: 4px; top: 4px; padding: 3px 6px 4px; max-width: calc(100% - 8px); }
  .atlas-tag b { font-size: 10px; }
  .atlas-tag small, .atlas-tag.patio { display: none; }
  .atlas-dot { width: 8px; height: 8px; box-shadow: 0 0 0 1.5px var(--navy); }
  .atlas-face { width: 28px; height: 28px; background-size: 280px 210px; background-position: -21px -8px; box-shadow: 0 0 0 2px var(--orange); }
  .atlas-you-tag { display: none; }
  .atlas-legend { font-size: 13px; gap: 8px 14px; margin-bottom: 18px; }
  dialog.panel.wide .map { display: grid; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
