/* LA HISTORIA: la casa, los diálogos, los finales y el terror */

/* ═══════════════════════════════════════════════════════════════════════════
   LA CASA
   Cuatro dibujos de la casa a las 03:33 (assets/casa) y, encima, en % del
   dibujo, lo que se mueve: el monitor, los relojes, la estática, la luz de
   debajo de las puertas, el grifo. El dibujo se ve entero y centrado (negro
   alrededor si la pantalla no tiene su forma). El nombre de cada cosa solo
   sale al pasar el ratón. Mirar algo lo enseña de cerca, a píxel gordo.
   ═══════════════════════════════════════════════════════════════════════════ */

.scene-container {
  position: absolute;
  inset: 0;
  /* por encima de las ventanas (100-199): al entrar en la casa no se ve el PC */
  z-index: 3000;
  background: #050505;
  overflow: hidden;
  cursor: var(--cursor-default), default;
  opacity: 1;
  container-type: size;
}

/* El dibujo, entero y centrado */
.scene-escenario {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(100cqw, calc(100cqh * 1376 / 768));
  height: min(100cqh, calc(100cqw * 768 / 1376));
  transform: translate(-50%, -50%);
  background-size: 100% 100%;
  background-repeat: no-repeat;
}
@media (min-width: 1500px) { .scene-escenario { image-rendering: pixelated; } }

/* Los bordes se van a negro */
.scene-escenario::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 5;
  background: radial-gradient(ellipse at 50% 48%, transparent 58%, rgba(0, 0, 0, 0.55) 100%);
}

/* ── Barrido de ruido al cambiar de sala ── */
.scene-wipe {
  position: absolute;
  inset: 0;
  z-index: 3300;
  opacity: 0;
  pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.05) 0 1px, rgba(0, 0, 0, 0.9) 1px 3px);
  transition: opacity 0.14s ease;
}
.scene-wipe.is-on { opacity: 1; }

/* ═══════════════════ Lo que se puede tocar ═══════════════════ */
.scene-zone {
  position: absolute;
  z-index: 6;
  border-radius: 3px;
  cursor: var(--cursor-pointer), pointer;
  transition: background 0.15s ease, box-shadow 0.15s ease;
}
.scene-zone:hover {
  background: rgba(200, 220, 255, 0.04);
  box-shadow: inset 0 0 0 1px rgba(220, 235, 255, 0.16);
}
.scene-zone-label {
  position: absolute;
  left: 50%;
  bottom: 6px;
  transform: translateX(-50%);
  white-space: nowrap;
  padding: 2px 7px;
  font: 11px 'Courier New', monospace;
  letter-spacing: 0.5px;
  color: rgba(235, 240, 255, 0.9);
  background: rgba(0, 0, 0, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.14);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}
.scene-zone:hover .scene-zone-label,
.scene-zone-hint .scene-zone-label { opacity: 1; }

/* La pista: lo que hay que mirar respira un poco */
.scene-zone-hint { animation: zona-pista 1.6s ease-in-out infinite; }
@keyframes zona-pista {
  0%, 100% { box-shadow: inset 0 0 0 1px rgba(200, 225, 255, 0.14), inset 0 0 10px rgba(160, 200, 255, 0.1); }
  50% { box-shadow: inset 0 0 0 2px rgba(200, 225, 255, 0.55), inset 0 0 24px rgba(160, 200, 255, 0.32); }
}

/* ═══════════════════ Lo que se mueve ═══════════════════ */
.vivo { position: absolute; z-index: 4; pointer-events: none; }
.vivo-recorte { background-repeat: no-repeat; }

/* El monitor respira; con un mensaje, su ventanita parpadea */
.vivo-brillo {
  position: absolute;
  inset: -35%;
  background: radial-gradient(ellipse at 50% 50%, rgba(170, 220, 255, 0.3), rgba(120, 180, 255, 0.1) 45%, transparent 70%);
  mix-blend-mode: screen;
  animation: respira 4s ease-in-out infinite;
}
@keyframes respira { 0%, 100% { opacity: 0.55; } 50% { opacity: 0.95; } 63% { opacity: 0.45; } 66% { opacity: 0.9; } }
.vivo-ventanita {
  position: absolute;
  left: 20%;
  top: 22%;
  width: 56%;
  height: 46%;
  background: #f3f5fb;
  border-top: 3px solid #2a58d6;
  box-shadow: 0 0 6px rgba(80, 130, 255, 0.8);
  opacity: 0;
}
.vivo-ventanita span { display: block; height: 9%; margin: 9% 12% 0; background: #9aa6c7; }
.scene-aviso .vivo-ventanita { animation: parpadeo 0.9s steps(1) 6; }
@keyframes parpadeo { 0% { opacity: 1; } 50% { opacity: 0; } }

/* Relojes: el despertador y el microondas */
.vivo-reloj, .vivo-micro { display: flex; align-items: center; justify-content: center; container-type: size; }
.vivo-reloj .vivo-texto {
  font: bold 80cqh/1 'Courier New', monospace;
  color: #ff3b30;
  text-shadow: 0 0 4px rgba(255, 40, 40, 0.9);
}
.vivo-micro {
  background: rgba(2, 24, 10, 0.9);
  border: 1px solid rgba(130, 230, 110, 0.4);
}
.vivo-micro .vivo-texto {
  font: bold min(74cqh, 27cqw)/1 'Courier New', monospace;
  white-space: nowrap;
  color: #bfffa2;
  text-shadow: 0 0 3px rgba(150, 255, 120, 0.9);
  animation: parpadeo 1s steps(1) infinite;
}
.vivo-micro--fijo .vivo-texto { animation: none; }
.vivo-micro--roto .vivo-texto { animation: roto 0.23s steps(2) infinite; color: #8fd77a; }
.vivo-micro--roto::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(115deg, transparent 45%, rgba(0, 0, 0, 0.92) 46%, rgba(0, 0, 0, 0.92) 50%, transparent 51%),
    linear-gradient(62deg, transparent 57%, rgba(0, 0, 0, 0.85) 58%, transparent 61%);
}
@keyframes roto { 0% { opacity: 0.9; transform: translateX(-4%); } 50% { opacity: 0.25; transform: translateX(5%); } }

/* La farola de la esquina (el día 2 parpadea) */
.vivo-farola {
  background: radial-gradient(circle at 50% 45%, rgba(255, 190, 90, 0.5), rgba(255, 160, 60, 0.16) 42%, transparent 70%);
  mix-blend-mode: screen;
}
.vivo-farola--parpadea { animation: farola 3.7s steps(1) infinite; }
@keyframes farola { 0%, 61%, 67%, 100% { opacity: 1; } 62%, 64% { opacity: 0.05; } 63% { opacity: 0.7; } 65%, 66% { opacity: 0.1; } }

/* La luz de debajo de la puerta: de vez en cuando pasa una sombra */
.vivo-puerta { overflow: hidden; }
.vivo-puerta--sombra::after {
  content: '';
  position: absolute;
  top: -40%;
  bottom: -40%;
  width: 38%;
  background: rgba(0, 0, 0, 0.88);
  filter: blur(2px);
  animation: sombra 1.6s linear forwards;
}
@keyframes sombra { from { left: -40%; } to { left: 105%; } }

/* Hundido: la cama (desde el día 2) y el cojín del sofá */
.vivo-hundido {
  border-radius: 50%;
  background: radial-gradient(ellipse at 50% 58%, rgba(0, 0, 0, 0.94) 0 28%, rgba(0, 0, 10, 0.78) 48%, rgba(0, 0, 20, 0.4) 63%, transparent 78%);
  box-shadow: inset 0 5px 0 rgba(0, 0, 0, 0.42), inset 0 -2px 0 rgba(110, 140, 190, 0.12);
}
.vivo-hundido--sofa { opacity: 0.8; }
.evento-hundirse { animation: hundirse 2.6s ease-out both; transform-origin: 50% 60%; }
@keyframes hundirse { 0% { opacity: 0; transform: scale(0.35); } 35% { opacity: 0.65; transform: scale(0.8); } 100% { opacity: 1; transform: scale(1); } }

/* Las paredes escritas (día 3) */
.vivo-pared { display: flex; flex-direction: column; justify-content: space-around; container-type: size; }
.vivo-linea {
  font: 22cqh/1 'Segoe Print', 'Bradley Hand', 'Comic Sans MS', cursive;
  color: rgba(165, 38, 38, 0.62);
  white-space: nowrap;
  letter-spacing: 0.06em;
  transform: rotate(-1deg);
}
.vivo-linea:nth-child(2) { transform: rotate(1.2deg) translateX(7%); }
.vivo-linea:nth-child(3) { transform: rotate(-0.6deg) translateX(2%); }
.vivo-linea:nth-child(4) { transform: rotate(0.8deg) translateX(9%); }
.evento-pared .vivo-linea { animation: escribirse 0.9s steps(18) both; }
.vivo-pared--sigue .vivo-linea { font-size: 30cqh; }
.vivo-pared--sigue .vivo-linea:last-child { animation: escribirse 2.8s steps(14) infinite; }
@keyframes escribirse { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }

/* El pasillo: la luz del cuarto, las rendijas, el baño, el marco */
.vivo-luz-cuarto {
  background: radial-gradient(ellipse at 30% 60%, rgba(90, 170, 255, 0.24), transparent 70%);
  mix-blend-mode: screen;
  animation: respira 4s ease-in-out infinite;
}
.scene-aviso .vivo-luz-cuarto { animation: aviso-luz 0.9s ease-in-out 6; }
@keyframes aviso-luz { 50% { opacity: 1; filter: brightness(2.6); } }
.vivo-rendija { mix-blend-mode: screen; }
.vivo-rendija--verde { background: linear-gradient(180deg, transparent, rgba(80, 220, 120, 0.55)); animation: respira 5s ease-in-out infinite; }
.vivo-rendija--tele { background: rgba(200, 220, 255, 0.5); animation: tele-luz 0.45s steps(2) infinite; }
@keyframes tele-luz { 0% { opacity: 0.3; } 50% { opacity: 0.95; } }
.vivo-bano { background: #000; box-shadow: 0 0 6px rgba(0, 0, 0, 0.9); }
.vivo-hoja {
  background: #e7e2d2 repeating-linear-gradient(180deg, transparent 0 9%, rgba(60, 60, 60, 0.45) 9% 11%);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.3);
  opacity: 0.5;
}

/* La cocina: el grifo, la nota, la taza, la luz por la puerta */
.vivo-gota::before {
  content: '';
  position: absolute;
  left: 22%;
  width: 56%;
  height: 9%;
  top: 0;
  border-radius: 50%;
  background: rgba(170, 230, 255, 0.95);
  animation: gota 2.6s ease-in infinite;
}
@keyframes gota { 0%, 55% { top: 0; opacity: 0; } 60% { top: 0; opacity: 1; } 92% { top: 88%; opacity: 1; } 100% { top: 90%; opacity: 0; } }
.vivo-nota { background: repeating-linear-gradient(180deg, transparent 0 22%, rgba(40, 40, 40, 0.5) 22% 27%); opacity: 0.6; }
.vivo-labios::before {
  content: '';
  position: absolute;
  inset: 25% 8% 30%;
  border-top: 2px solid rgba(195, 30, 60, 0.9);
  border-radius: 50% 50% 0 0 / 100% 100% 0 0;
}
.vivo-aviso-puerta { background: linear-gradient(90deg, rgba(110, 180, 255, 0), rgba(110, 180, 255, 0.75), rgba(110, 180, 255, 0)); opacity: 0; }
.scene-aviso .vivo-aviso-puerta { animation: aviso-puerta 0.9s ease-in-out 6; }
@keyframes aviso-puerta { 50% { opacity: 1; } }

/* El salón: la tele, la bombilla, el teléfono */
.vivo-tele { overflow: hidden; border-radius: 7%; background: #2a2f36; }
.vivo-ruido {
  position: absolute;
  inset: 0;
  background: url('../assets/casa/estatica.png') repeat;
  background-size: 64px 64px;
  image-rendering: pixelated;
  opacity: 0.8;
  animation: ruido 0.2s steps(1) infinite;
}
@keyframes ruido {
  0% { background-position: 0 0; }
  25% { background-position: -17px 23px; }
  50% { background-position: 31px -11px; }
  75% { background-position: 9px 37px; }
}
.vivo-silueta, .evento-silueta {
  position: absolute;
  left: 31%;
  width: 38%;
  top: 16%;
  height: 84%;
  filter: blur(1px);
  opacity: 0;
}
.vivo-silueta {
  background:
    radial-gradient(ellipse 28% 16% at 50% 19%, rgba(0, 0, 0, 0.9) 0 90%, transparent 100%),
    radial-gradient(ellipse 50% 42% at 50% 88%, rgba(0, 0, 0, 0.9) 0 90%, transparent 100%);
  animation: silueta 4.2s ease-in-out 0.6s infinite;
}
@keyframes silueta { 0%, 50%, 100% { opacity: 0; } 60%, 85% { opacity: 0.8; } }
.vivo-letras, .evento-letras { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 4%; container-type: size; }
.vivo-letras span, .evento-letras span {
  font: bold 34cqh/1 'Courier New', monospace;
  color: rgba(12, 12, 12, 0.88);
  text-shadow: 0 0 6px rgba(255, 255, 255, 0.6);
  opacity: 0;
}
.vivo-letras span { animation: letra 3.4s ease-in-out infinite; }
@keyframes letra { 0%, 100% { opacity: 0; filter: blur(4px); } 35%, 65% { opacity: 1; filter: blur(0); } }
.vivo-tele--cuadro { background: #000; }
.vivo-cuadro {
  position: absolute;
  left: 38%;
  top: 34%;
  width: 24%;
  height: 32%;
  background: #fff;
  box-shadow: 0 0 12px rgba(255, 255, 255, 0.8);
  animation: cuadro 2.8s steps(1) infinite;
}
@keyframes cuadro { 0%, 40%, 47%, 100% { opacity: 1; } 42%, 45% { opacity: 0; } }
.vivo-bombilla {
  background: radial-gradient(circle, rgba(255, 140, 40, 0.85) 0 16%, rgba(255, 110, 20, 0.22) 34%, transparent 60%);
  mix-blend-mode: screen;
  animation: bombilla 3s ease-in-out infinite;
}
@keyframes bombilla { 50% { opacity: 0.5; } }
.vivo-telefono--suena { animation: suena 0.09s linear infinite; }
@keyframes suena { 0% { transform: translate(-1px, 0) rotate(-2deg); } 50% { transform: translate(1px, 0) rotate(2deg); } }

/* ═══════════════════ Sucesos (scene_event) ═══════════════════ */
.evento { z-index: 5; }
.evento-reflejo { background: #000; animation: reflejo 3.6s steps(1) both; }
@keyframes reflejo {
  0% { opacity: 0; } 6% { opacity: 1; } 9% { opacity: 0; } 14% { opacity: 1; } 16% { opacity: 0.2; }
  22%, 70% { opacity: 1; } 74% { opacity: 0; } 78% { opacity: 0.9; } 80%, 100% { opacity: 0; }
}
.evento-silueta {
  background:
    radial-gradient(ellipse 28% 16% at 50% 20%, rgba(150, 190, 230, 0.55) 0 90%, transparent 100%),
    radial-gradient(ellipse 50% 42% at 50% 88%, rgba(150, 190, 230, 0.5) 0 90%, transparent 100%);
  filter: blur(1.5px);
  animation: reflejo-silueta 3.6s linear both;
}
@keyframes reflejo-silueta { 0%, 26% { opacity: 0; } 32%, 64% { opacity: 1; } 70%, 100% { opacity: 0; } }
.evento-nombre { background: #15181d; border-radius: 7%; overflow: hidden; }
.evento-letras span { animation: letra-evento 4.4s ease-in-out both; }
@keyframes letra-evento { 0% { opacity: 0; filter: blur(5px); } 20% { opacity: 1; filter: blur(0); } 75% { opacity: 1; filter: blur(0); } 100% { opacity: 0; filter: blur(6px); } }

/* ═══════════════════ Mirar algo de cerca ═══════════════════ */
.scene-examine-overlay {
  position: absolute;
  inset: 0;
  z-index: 3100;
  background: rgba(0, 0, 0, 0.88);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  cursor: var(--cursor-pointer), pointer;
  animation: examine-fade 0.25s ease;
}
@keyframes examine-fade { 0% { opacity: 0; } 100% { opacity: 1; } }
.scene-cerca-marco {
  position: relative;
  max-width: 86vw;
  max-height: 74vh;
  overflow: hidden;
  box-shadow: 0 0 0 2px #000, 0 0 0 3px rgba(255, 255, 255, 0.08), 0 20px 60px rgba(0, 0, 0, 0.8);
}
.scene-cerca-img { position: absolute; inset: 0; background-repeat: no-repeat; image-rendering: pixelated; }
.scene-cerca .vivo-reloj .vivo-texto, .scene-cerca .vivo-micro .vivo-texto { text-shadow: 0 0 10px currentColor; }
.scene-examine-hint {
  color: rgba(255, 255, 255, 0.3);
  font: 11px 'Courier New', monospace;
  animation: hint-pulse 2.2s ease-in-out infinite;
}
@keyframes hint-pulse { 0%, 100% { opacity: 0.45; } 50% { opacity: 1; } }

/* Lo escrito: la nota de la nevera, el papel del marco, la hoja del día 3 */
.escrito {
  position: absolute;
  z-index: 7;
  left: 50%;
  top: 50%;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.6);
  filter: brightness(0.82);
}
.escrito--nota {
  width: 46%;
  min-height: 34%;
  padding: 7% 7%;
  transform: translate(-50%, -50%) rotate(-3deg);
  background: #e6da8c;
  color: #2c2a6a;
  font: clamp(14px, 2.4vw, 30px)/1.3 'Segoe Print', 'Bradley Hand', 'Comic Sans MS', cursive;
}
.escrito--tuya { font-family: 'Lucida Handwriting', 'Brush Script MT', 'Segoe Script', cursive; color: #1e1e1e; transform: translate(-50%, -50%) rotate(2deg); }
.escrito--papel {
  width: 68%;
  padding: 4% 5%;
  transform: translate(-50%, -38%) rotate(2deg);
  background: #f0ece1;
  color: #262626;
  font: clamp(13px, 1.6vw, 22px)/1.45 'Segoe Print', 'Bradley Hand', 'Comic Sans MS', cursive;
}
.escrito--papel::before {
  content: '';
  position: absolute;
  top: -7%;
  left: 40%;
  width: 20%;
  height: 14%;
  background: rgba(232, 232, 205, 0.6);
  transform: rotate(-4deg);
}
.escrito--hoja {
  width: 54%;
  padding: 3% 5%;
  transform: translate(-50%, -50%) rotate(-1deg);
  background: #ebeae4;
  color: #222;
  font: clamp(11px, 1.25vw, 17px)/1.5 'Courier New', monospace;
}
.escrito-linea--vacia, .escrito-linea--lapiz { border-bottom: 1px solid #666; }
.escrito-linea--lapiz { font-family: 'Segoe Print', 'Bradley Hand', cursive; color: #5a5a5a; }

/* ═══════════════════════════════════════════════════════════════════════════
   Diálogos y finales (antes narrative.css)
   ═══════════════════════════════════════════════════════════════════════════ */



/* ── Decisiones del jugador (scene_choice) ── */
.scene-choice-overlay {
  position: absolute;
  inset: 0;
  z-index: 90000;
  background: #050505;
  display: flex;
  align-items: center;
  justify-content: center;
}

.scene-choice-panel {
  width: min(92vw, 520px);
  max-height: 86vh;
  overflow-y: auto;
  background: #c0c0c0;
  border: 2px solid #fff;
  border-right-color: #404040;
  border-bottom-color: #404040;
  outline: 1px solid #0a0a0a;
  box-shadow: 8px 8px 0 rgba(0, 0, 0, 0.6);
  padding: 14px 16px 16px;
  font-family: 'Tahoma', 'Courier New', monospace;
  animation: scene-choice-panel-in 0.22s ease-out;
}

@keyframes scene-choice-panel-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

.scene-choice-title {
  background: linear-gradient(90deg, #000080, #1084d0);
  color: #fff;
  font-size: 12px;
  font-weight: bold;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 5px 8px;
  margin: -14px -16px 12px;
}

.scene-choice-speaker {
  color: #8a2a2a;
  font-size: 12px;
  font-weight: bold;
  letter-spacing: 1px;
  margin-bottom: 6px;
}

.scene-choice-text {
  color: #1a1a1a;
  font-size: 15px;
  line-height: 1.5;
  white-space: pre-wrap;
  margin-bottom: 6px;
}

.scene-choice-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.scene-choice-btn {
  font-family: 'Tahoma', 'Courier New', monospace;
  font-size: 14px;
  color: #111;
  text-align: left;
  background: #d4d0c8;
  border: 2px solid #fff;
  border-right-color: #404040;
  border-bottom-color: #404040;
  padding: 8px 12px;
  cursor: var(--cursor-pointer), pointer;
}

.scene-choice-btn:hover {
  background: #e8e4dc;
  color: #000080;
}

.scene-choice-btn:active {
  border: 2px solid #404040;
  border-right-color: #fff;
  border-bottom-color: #fff;
}

/* ═══════════════════════════════════════════════════════════════════════════
   LA TARJETA DE FINAL
   Cuando la historia se acaba, no se acaba de golpe: sale el nombre del final,
   el epílogo se escribe solo y te dice cuántos finales llevas vistos. Desde
   ahí puedes volver al menú o quedarte en el escritorio a seguir mirando.
   ═══════════════════════════════════════════════════════════════════════════ */
.ending-overlay {
  position: absolute;
  inset: 0;
  /* la tarjeta del final tapa todo: ventanas, barra de tareas y avisos */
  z-index: 96000;
  background: #050505;
  opacity: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ending-panel {
  animation: ending-panel-entra 0.45s ease-out;
}

@keyframes ending-panel-entra {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

.ending-panel {
  max-width: 620px;
  padding: 34px 40px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  background: rgba(6, 6, 6, 0.9);
  box-shadow: 0 0 90px rgba(0, 0, 0, 0.9) inset;
  font-family: 'Courier New', monospace;
  text-align: center;
}

.ending-kicker {
  color: rgba(0, 255, 65, 0.5);
  font-size: 11px;
  letter-spacing: 6px;
}

.ending-name {
  color: #e8e8e8;
  font-size: 25px;
  letter-spacing: 2px;
  margin: 10px 0 22px;
  text-shadow: 0 0 18px rgba(0, 255, 120, 0.18);
}

.ending-text { min-height: 4.5em; }

.ending-line {
  color: rgba(206, 206, 206, 0.82);
  font-size: 14px;
  line-height: 1.9;
  min-height: 1.9em;
}

.ending-foot {
  margin-top: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  opacity: 0;
  transition: opacity 0.5s ease;
}
.ending-foot.visible { opacity: 1; }

.ending-count {
  flex: 1 1 auto;
  text-align: left;
  color: rgba(255, 255, 255, 0.32);
  font-size: 11px;
}

.ending-btn {
  background: #c0c0c0;
  border: 2px solid;
  border-color: #ffffff #404040 #404040 #ffffff;
  color: #000;
  font-family: 'MS Sans Serif', Tahoma, sans-serif;
  font-size: 11px;
  padding: 3px 10px;
  cursor: var(--cursor-pointer), pointer;
}
.ending-btn:active { border-color: #404040 #ffffff #ffffff #404040; }

/* ── La lista de finales del menú ── */
.title-endings-menu { max-height: 78vh; overflow-y: auto; }
.endings-marcador {
  font-family: 'Courier New', monospace;
  font-size: 12px;
  color: rgba(0, 255, 65, 0.6);
  text-align: center;
  padding: 4px 0 12px;
}
.endings-fila {
  display: grid;
  grid-template-columns: 22px minmax(140px, 0.9fr) minmax(170px, 1.1fr);
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border: 0;
  border-bottom: 1px solid #d4d0c8;
  background: #fff;
  margin-bottom: 0;
  font-family: 'MS Sans Serif', Tahoma, Verdana, sans-serif;
  font-size: 12px;
  color: #404040;
}
.endings-fila--visto { border-color: #b8cfb8; color: #102010; background: #edf5ed; }
.endings-marca { color: #808080; text-align: center; font-weight: bold; }
.endings-fila--visto .endings-marca { color: #207020; }
.endings-nombre { text-align: left; }
.endings-pista { color: #505050; font-size: 11px; text-align: left; line-height: 1.35; }
.endings-fila--visto .endings-pista { color: #407040; }
.title-endings-menu .endings-marcador {
  padding: 0 0 8px;
  color: #000;
  font: 12px 'MS Sans Serif', Tahoma, Verdana, sans-serif;
  text-align: left;
}
@media (max-width: 520px) {
  .endings-fila { grid-template-columns: 22px minmax(0, 1fr); }
  .endings-pista { grid-column: 2; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   Terror (antes horror.css)
   ═══════════════════════════════════════════════════════════════════════════ */

.glitch {
  animation: glitch-skew 0.3s infinite linear;
}

@keyframes glitch-skew {
  0% { transform: skew(0deg); }
  20% { transform: skew(2deg); }
  40% { transform: skew(-1deg); }
  60% { transform: skew(0.5deg); }
  80% { transform: skew(-2deg); }
  100% { transform: skew(0deg); }
}

.glitch-scanlines {
  pointer-events: none;
  position: absolute;
  inset: 0;
  z-index: 9995;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.12) 2px,
    rgba(0, 0, 0, 0.12) 4px
  );
}

.glitch-flash {
  position: absolute;
  inset: 0;
  z-index: 9997;
  background: #fff;
  opacity: 0;
  pointer-events: none;
}

.glitch-flash-active {
  animation: glitch-flash 0.1s ease-out;
}

@keyframes glitch-flash {
  0% { opacity: 0.9; }
  100% { opacity: 0; }
}

.glitch-vignette {
  position: absolute;
  inset: 0;
  z-index: 9994;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 70%, rgba(0, 0, 0, 0.25) 100%);
}

.glitch-canvas {
  position: absolute;
  inset: 0;
  z-index: 9996;
  pointer-events: none;
  mix-blend-mode: screen;
  opacity: 0.7;
}

#game {
  transition: filter 0.05s linear;
}

/* ── Horror Blackout Overlay ── */
.horror-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: #000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  /* Se inserta solo durante el aviso: la capa negra es opaca desde el
     inicio y el pulso lo hacen las letras, nunca el wallpaper de detrás. */
  opacity: 1;
  transition: none;
  pointer-events: none;
}

.horror-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.horror-overlay-line {
  color: #ff0000;
  font-family: 'Courier New', Consolas, monospace;
  font-size: 28px;
  font-weight: bold;
  text-shadow: 0 0 12px rgba(255, 0, 0, 0.6), 0 0 30px rgba(255, 0, 0, 0.2);
  text-align: center;
  max-width: 80%;
  animation: horror-pulse 1.2s ease-in-out infinite;
}

.horror-overlay-sub {
  color: #cc0000;
  font-family: 'Courier New', Consolas, monospace;
  font-size: 14px;
  text-shadow: 0 0 6px rgba(200, 0, 0, 0.3);
  text-align: center;
  max-width: 70%;
  opacity: 0.7;
}

.horror-overlay-line.corrupted {
  animation: horror-glitch 0.15s infinite;
  letter-spacing: -2px;
}

@keyframes horror-pulse {
  0%, 100% { opacity: 1; text-shadow: 0 0 12px rgba(255,0,0,0.6); }
  50% { opacity: 0.4; text-shadow: 0 0 25px rgba(255,0,0,0.9), 0 0 50px rgba(255,0,0,0.3); }
}

@keyframes horror-glitch {
  0% { transform: translate(-2px, 0) skewX(-1deg); }
  20% { transform: translate(2px, -1px) skewX(1deg); }
  40% { transform: translate(-1px, 1px) skewX(0deg); }
  60% { transform: translate(1px, 2px) skewX(-1deg); }
  80% { transform: translate(-2px, -1px) skewX(1deg); }
  100% { transform: translate(0, 1px) skewX(0deg); }
}

/* ── CMD Window ── */
.window-cmd .window-content {
  background: #0a0a0a;
  padding: 0;
}

.cmd-output {
  margin: 0;
  padding: 10px;
  background: #0a0a0a;
  color: #00ff00;
  font-family: 'Courier New', 'Consolas', monospace;
  font-size: 13px;
  line-height: 1.4;
  height: 100%;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
  border: 1px inset #222;
  box-sizing: border-box;
  user-select: text;
  cursor: var(--cursor-text), text;
}

.cmd-output::-webkit-scrollbar {
  width: 8px;
}

.cmd-output::-webkit-scrollbar-track {
  background: #050505;
}

.cmd-output::-webkit-scrollbar-thumb {
  background: #00ff00;
  border: 1px solid #003300;
}

.window-cmd .window-titlebar {
  background: linear-gradient(90deg, #001100, #002200, #001100);
  border-bottom: 1px solid #00ff00;
}

.window-cmd .window-title {
  color: #00ff00;
  text-shadow: 0 0 4px rgba(0,255,0,0.3);
}

.window-cmd .window-btn-close {
  background: #0a0a0a;
  border: 1px solid #00ff00;
  color: #00ff00;
}

.window-cmd .window-btn-close:hover {
  background: #003300;
}

/* ── SLEEP OVERLAY TEXT ── */

/* Lo que se oye desde otra habitación (el Messenger que suena en el cuarto) */
.scene-desc.scene-desc--aviso { color: #ffe680; }
