/* ===============================================================
   SELENE-7 · SOBRECALENTAMIENTO DEL ORDENADOR (../comun/reinicio.js)
   El terminal de emergencia copia el aspecto del mini reto
   del terminal antes del 05-10: fósforo verde, barrido y viñeta de CRT.
   =============================================================== */
.rei-velo {
  --rei-fosforo: #5ff5b8;
  --rei-fosforo-2: #d6ffec;
  --rei-tenue: #3a9e78;
  --rei-cian: #62dcff;
  --rei-ambar: #ffb13d;
  --rei-rojo: #ff4d4d;
  --rei-naranja: #ff9d3d;
  --rei-mono: "JetBrains Mono", Consolas, "Cascadia Mono", monospace;
  --rei-ui: "Barlow Semi Condensed", "Bahnschrift SemiCondensed", "Segoe UI", sans-serif;
  position: fixed; inset: 0; z-index: 10000; display: flex; align-items: center; justify-content: center; padding: 16px;
  background: rgba(1, 4, 9, .88); backdrop-filter: blur(4px);
  opacity: 0; transition: opacity .4s;
}
.rei-velo.visible { opacity: 1; }
body.rei-abierto { overflow: hidden; overscroll-behavior: none; }   /* sin «tirar para recargar» en táctil */

.rei-marco {
  position: relative; display: flex; flex-direction: column; width: min(980px, 100%); min-width: 0; height: min(640px, 100%);
  background: rgba(5, 12, 21, .96); border: 1px solid rgba(255, 77, 77, .45);
  box-shadow: 0 0 0 1px rgba(255, 77, 77, .12), 0 30px 80px rgba(0, 0, 0, .6), 0 0 60px rgba(255, 77, 77, .12);
  animation: rei-calor 1.6s ease-in-out infinite;
}
.rei-velo.templado .rei-marco { border-color: rgba(255, 177, 61, .45); animation: none; }
.rei-velo.frio .rei-marco { border-color: rgba(95, 245, 184, .35); box-shadow: 0 30px 80px rgba(0, 0, 0, .6); }
@keyframes rei-calor { 50% { box-shadow: 0 0 0 1px rgba(255, 77, 77, .3), 0 30px 80px rgba(0, 0, 0, .6), 0 0 90px rgba(255, 77, 77, .28); } }

.rei-titulo {
  flex: none; display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 14px;
  border-bottom: 1px solid rgba(126, 206, 255, .13);
  font: 500 11.5px/1 var(--rei-ui); letter-spacing: .24em; color: #c3dcef; white-space: nowrap; overflow: hidden;
}
.rei-idx { padding: 3px 5px 2px; border-radius: 1px; background: var(--rei-rojo); color: #1a0303; font: 700 9.5px/1 var(--rei-mono); letter-spacing: .04em; }
.rei-velo.frio .rei-idx { background: var(--rei-fosforo); color: #02140c; }
.rei-sep { color: #5a768c; letter-spacing: 0; }
.rei-sub { color: var(--rei-rojo); overflow: hidden; text-overflow: ellipsis; }
.rei-velo.templado .rei-sub { color: var(--rei-ambar); }
.rei-velo.frio .rei-sub { color: var(--rei-fosforo); }
.rei-temp { margin-left: auto; display: flex; align-items: center; gap: 8px; font: 600 12px/1 var(--rei-mono); letter-spacing: .06em; color: var(--rei-rojo); }
.rei-temp i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; box-shadow: 0 0 8px currentColor; animation: rei-latido .5s infinite; }
.rei-velo.templado .rei-temp { color: var(--rei-ambar); }
.rei-velo.frio .rei-temp { color: var(--rei-fosforo); }
.rei-velo.frio .rei-temp i { animation: none; }
@keyframes rei-latido { 50% { opacity: .25; } }

.rei-monitor { flex: 1; min-height: 0; display: flex; padding: 16px; background: linear-gradient(rgba(10, 22, 30, .55), rgba(4, 10, 16, .55)); }
.rei-crt {
  position: relative; flex: 1; min-height: 0; overflow: hidden; border-radius: 16px; cursor: text;
  background: radial-gradient(ellipse at 50% 42%, #04160e 0%, #020b07 65%, #010503 100%);
  border: 1px solid #1c4636;
  box-shadow: 0 0 0 7px #0a1714, 0 0 0 8px rgba(95, 245, 184, .16), inset 0 0 60px rgba(0, 0, 0, .9), 0 0 50px rgba(60, 255, 170, .05);
}
.rei-pantalla {
  position: absolute; inset: 0; overflow-y: auto; overflow-x: hidden; padding: 18px 22px 22px;
  font: 400 clamp(13px, 1.25vw, 18px)/1.5 var(--rei-mono); color: var(--rei-fosforo); text-shadow: 0 0 6px rgba(95, 245, 184, .45);
  scrollbar-width: thin; scrollbar-color: #1d4a36 transparent;
}
.rei-cristal {
  position: absolute; inset: 0; pointer-events: none; border-radius: inherit;
  background:
    repeating-linear-gradient(0deg, rgba(0, 0, 0, .24) 0 1px, transparent 1px 3px),
    radial-gradient(ellipse at center, transparent 58%, rgba(0, 0, 0, .55) 100%);
}
.rei-cristal::after {
  content: ""; position: absolute; left: 0; right: 0; height: 22%; top: -22%;
  background: linear-gradient(transparent, rgba(95, 245, 184, .045), transparent);
  animation: rei-barrido 7s linear infinite;
}
@keyframes rei-barrido { to { top: 100%; } }

.rei-l { white-space: pre-wrap; overflow-wrap: anywhere; min-height: 1.5em; }
.rei-tit { color: #b8f2ff; letter-spacing: .12em; text-shadow: 0 0 8px rgba(98, 220, 255, .5); }
.rei-error { color: #ff7373; text-shadow: 0 0 6px rgba(255, 77, 77, .5); }
.rei-aviso { color: #ffc66b; text-shadow: 0 0 6px rgba(255, 177, 61, .45); }
.rei-tenue { color: var(--rei-tenue); text-shadow: none; }
.rei-ok { color: #8dffc4; }
.rei-eco { color: var(--rei-fosforo-2); }
.rei-barra { white-space: pre; overflow: hidden; color: var(--rei-ambar); text-shadow: 0 0 6px rgba(255, 177, 61, .45); font-size: 1.15em; }
.rei-velo.frio .rei-barra { color: #8dffc4; text-shadow: 0 0 6px rgba(95, 245, 184, .5); }
.rei-check { color: #8dffc4; }
.rei-prompt { color: var(--rei-fosforo-2); }
.rei-cursor { background: var(--rei-fosforo); box-shadow: 0 0 8px rgba(95, 245, 184, .7); animation: rei-parpadeo 1.06s steps(1) infinite; }
@keyframes rei-parpadeo { 50% { background: transparent; box-shadow: none; } }
.rei-entrada { position: fixed; left: 0; bottom: 0; width: 1px; height: 1px; opacity: 0; border: 0; padding: 0; font-size: 16px; pointer-events: none; }

.rei-pie { flex: none; display: flex; gap: 22px; flex-wrap: wrap; padding: 9px 16px 10px; border-top: 1px solid rgba(126, 206, 255, .13); font: 500 10px/1 var(--rei-ui); letter-spacing: .2em; color: #5a768c; text-transform: uppercase; }
.rei-pie span:last-child { margin-left: auto; color: var(--rei-ambar); }
.rei-pie kbd { display: inline-block; min-width: 20px; margin-right: 5px; padding: 3px 5px 2px; border: 1px solid rgba(126, 206, 255, .28); border-radius: 2px; font: 500 10px/1 var(--rei-mono); text-align: center; color: #9bb6cc; }

/* ---------- Pantalla de arranque: TANG OS ---------- */
.rei-tangos {
  position: absolute; inset: 0; z-index: 2; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  background: radial-gradient(ellipse at 50% 45%, #1a0e04 0%, #080401 60%, #020100 100%);
  animation: rei-encender .7s ease-out both;
}
.rei-tangos[hidden] { display: none; }
@keyframes rei-encender { 0% { opacity: 0; transform: scaleY(.02); filter: brightness(3); } 40% { opacity: 1; transform: scaleY(.02); } 100% { transform: none; filter: none; } }
.rei-huella {
  width: clamp(90px, 16vh, 150px); aspect-ratio: 223 / 256;
  background: var(--rei-naranja);
  -webkit-mask: url(tang-paw.png) center / contain no-repeat; mask: url(tang-paw.png) center / contain no-repeat;
  filter: drop-shadow(0 0 16px rgba(255, 157, 61, .55));
  animation: rei-aparecer 1s .35s both;
}
.rei-os {
  font: 700 clamp(40px, 8vw, 84px)/1 var(--rei-mono); letter-spacing: .12em; padding-left: .12em; color: var(--rei-naranja);
  text-shadow: 0 0 18px rgba(255, 157, 61, .6), 0 0 44px rgba(255, 157, 61, .25);
  animation: rei-aparecer 1s .7s both;
}
.rei-os span { margin-left: .4em; color: #ffe2c2; }
.rei-version { padding: 0 16px; font: 500 clamp(10px, 1.1vw, 13px)/1.5 var(--rei-ui); letter-spacing: .32em; color: #b0764a; text-align: center; animation: rei-aparecer 1s 1.1s both; }
.rei-puntos { display: flex; gap: 10px; margin-top: 12px; animation: rei-aparecer .6s 1.4s both; }
.rei-puntos i { width: 8px; height: 8px; border-radius: 50%; background: var(--rei-naranja); box-shadow: 0 0 8px var(--rei-naranja); animation: rei-latido 1s infinite; }
.rei-puntos i:nth-child(2) { animation-delay: .2s; }
.rei-puntos i:nth-child(3) { animation-delay: .4s; }
@keyframes rei-aparecer { from { opacity: 0; transform: translateY(8px); } }

/* ---------- Aviso con cada error ---------- */
.rei-toast {
  position: fixed; top: 74px; left: 50%; z-index: 9999; transform: translateX(-50%);
  display: flex; align-items: center; gap: 12px; padding: 10px 16px 10px 12px;
  background: rgba(20, 10, 4, .94); border: 1px solid rgba(255, 177, 61, .55); box-shadow: 0 12px 40px rgba(0, 0, 0, .5);
  font: 500 10px/1.3 "Barlow Semi Condensed", "Bahnschrift SemiCondensed", "Segoe UI", sans-serif; letter-spacing: .14em; color: #ffc66b;
  animation: rei-toast 3.6s both; pointer-events: none;
}
.rei-toast b { display: block; font-size: 12px; letter-spacing: .2em; font-weight: 600; }
.rei-toast small { display: block; margin-top: 3px; font-size: 11px; letter-spacing: .06em; color: #e8c9a0; }
.rei-toast.critico { border-color: rgba(255, 77, 77, .7); color: #ff8a8a; }
.rei-termo { position: relative; width: 8px; height: 30px; border: 1px solid currentColor; border-radius: 4px; overflow: hidden; }
.rei-termo i { position: absolute; left: 0; right: 0; bottom: 0; background: currentColor; box-shadow: 0 0 8px currentColor; }
@keyframes rei-toast { 0% { opacity: 0; transform: translate(-50%, -10px); } 8%, 88% { opacity: 1; transform: translate(-50%, 0); } 100% { opacity: 0; transform: translate(-50%, -6px); } }

/* ---------- La penalización, al volver al reto: aviso, y el reloj en rojo con «+1:00» ---------- */
.rei-toast.penal { border-color: rgba(255, 77, 77, .7); color: #ff8a8a; }
.rei-pen-n { font: 700 22px/1 "JetBrains Mono", Consolas, "Cascadia Mono", monospace; letter-spacing: .02em; color: #ff4d4d; text-shadow: 0 0 12px rgba(255, 77, 77, .6); }
.rei-penalizado { position: relative; transform-origin: left center; animation: rei-golpe 2.6s ease-out both; }
@keyframes rei-golpe {
  0%, 10% { color: #ff4d4d; text-shadow: 0 0 14px rgba(255, 77, 77, .9); transform: scale(1.15); }
  30%, 75% { color: #ff4d4d; text-shadow: 0 0 10px rgba(255, 77, 77, .6); transform: none; }
}
.rei-mas {
  position: absolute; left: 0; top: 100%; margin-top: 6px; white-space: nowrap; pointer-events: none;
  font-size: 16px; font-weight: 700; color: #ff4d4d; text-shadow: 0 0 10px rgba(255, 77, 77, .6);
  animation: rei-mas 2.6s ease-out forwards;
}
@keyframes rei-mas { 0% { opacity: 0; transform: scale(1.5); } 12%, 70% { opacity: 1; transform: none; } 100% { opacity: 0; transform: translateY(12px); } }
@media (prefers-reduced-motion: reduce) {
  .rei-penalizado { animation: none; color: #ff4d4d; }
  .rei-mas { animation: none; }
}

@media (max-width: 600px) {
  .rei-velo { padding: 8px; }
  .rei-monitor { padding: 10px; }
  .rei-sub, .rei-sep { display: none; }
  .rei-pantalla { padding: 14px; }
  .rei-barra { font-size: .8em; }
  .rei-pie span:last-child { margin-left: 0; }
}

/* ---------- La pantalla se calienta (antes del sobrecalentamiento) ---------- */
.rei-calor { position: fixed; inset: 0; z-index: 9990; pointer-events: none; overflow: hidden; --rei-fuerza: 0; }
.rei-calor::before, .rei-calor::after { content: ""; position: absolute; top: 0; bottom: 0; width: 22vw; max-width: 320px; opacity: 0; transition: opacity 1.2s; }
.rei-calor::before { left: 0; background: linear-gradient(90deg, rgba(255, 40, 30, .55), rgba(255, 60, 30, .18) 40%, transparent); }
.rei-calor::after { right: 0; background: linear-gradient(270deg, rgba(255, 40, 30, .55), rgba(255, 60, 30, .18) 40%, transparent); }
.rei-calor[data-nivel="1"]::before, .rei-calor[data-nivel="1"]::after { opacity: calc(.35 + .35 * var(--rei-fuerza)); animation: rei-respira 3.2s ease-in-out infinite; }
.rei-calor[data-nivel="2"]::before, .rei-calor[data-nivel="2"]::after { opacity: .9; animation: rei-respira 1.1s ease-in-out infinite; }
.rei-calor[data-nivel="2"] { box-shadow: inset 0 0 0 2px rgba(255, 60, 40, .5), inset 0 0 90px rgba(255, 30, 20, .35); animation: rei-borde 1.1s ease-in-out infinite; }
@keyframes rei-respira { 50% { filter: brightness(.55); } }
@keyframes rei-borde { 50% { box-shadow: inset 0 0 0 2px rgba(255, 60, 40, .15), inset 0 0 60px rgba(255, 30, 20, .15); } }

.rei-chispa {
  position: absolute; width: 11px; height: 2px; margin-top: -1px; border-radius: 2px;
  background: linear-gradient(90deg, rgba(255, 150, 50, 0), #ffd36b 60%, #fffbe6);
  box-shadow: 0 0 6px 1px rgba(255, 150, 40, .8);
  transform: rotate(var(--rot));
  animation: rei-chispa 600ms cubic-bezier(.2, .7, .4, 1) forwards;
}
.rei-chispa.izq { left: 0; }
.rei-chispa.der { right: 0; }
@keyframes rei-chispa {
  0% { transform: translate(0, 0) rotate(var(--rot)) scaleX(.4); opacity: 1; }
  25% { transform: translate(calc(var(--dx) * .3), calc(var(--dy) * .2)) rotate(var(--rot)) scaleX(1.6); }
  75% { opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) rotate(var(--rot)) scaleX(.5); opacity: 0; }
}

/* Luz de alerta: una baliza roja que parpadea */
.rei-baliza {
  position: absolute; left: 50%; bottom: 18px; transform: translate(-50%, 20px); opacity: 0; transition: opacity .4s, transform .4s;
  display: flex; align-items: center; gap: 10px; padding: 7px 14px 7px 9px; border: 1px solid rgba(255, 77, 77, .7); border-radius: 20px;
  background: rgba(30, 4, 4, .9); box-shadow: 0 8px 30px rgba(0, 0, 0, .5);
  font: 600 11px/1 "Barlow Semi Condensed", "Bahnschrift SemiCondensed", "Segoe UI", sans-serif; letter-spacing: .24em; color: #ff8a8a;
}
.rei-baliza i { width: 14px; height: 14px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #ffd0d0, #ff2a2a 55%, #8a0000); box-shadow: 0 0 10px 3px rgba(255, 40, 40, .9), 0 0 30px 8px rgba(255, 40, 40, .45); animation: rei-baliza .7s steps(1) infinite; }
.rei-calor[data-nivel="2"] .rei-baliza { opacity: 1; transform: translate(-50%, 0); }
@keyframes rei-baliza { 50% { background: #4a0606; box-shadow: none; } }

@media (prefers-reduced-motion: reduce) {
  .rei-calor[data-nivel]::before, .rei-calor[data-nivel]::after, .rei-calor[data-nivel="2"] { animation: none; }
  .rei-chispa { display: none; }
}

/* ---------- El Tang especial, dormido en TANG OS (solo la primera vez) ---------- */
.rei-tangos.con-tang .rei-puntos { visibility: hidden; }
.rei-tang-caja { position: absolute; left: 0; right: 0; bottom: 4%; display: flex; flex-direction: column; align-items: center; gap: 6px; animation: rei-aparecer .6s both; }
.rei-tang-txt { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 0 16px; text-align: center; font: 500 clamp(11px, 1.2vw, 14px)/1.4 var(--rei-ui); letter-spacing: .08em; color: #e8c9a0; }
.rei-tang-txt b { font-size: 1.15em; letter-spacing: .22em; color: #ffe2c2; }
.rei-tang-txt .rei-tang-premio { color: #ffd257; text-shadow: 0 0 14px rgba(255, 210, 87, .7); }
.rei-tang { position: relative; width: clamp(96px, 16vh, 150px); aspect-ratio: 1; padding: 0; border: 0; border-radius: 50%; background: none; cursor: pointer; animation: rei-siesta 2.6s ease-in-out infinite; }
.rei-tang img { width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 0 12px rgba(255, 157, 61, .45)); pointer-events: none; }
.rei-tang:not(:disabled)::after { content: ""; position: absolute; inset: -6px; border: 2px dashed rgba(255, 210, 87, .7); border-radius: 50%; animation: girar-rei 9s linear infinite; }
.rei-tang:hover img, .rei-tang:focus-visible img { filter: drop-shadow(0 0 18px rgba(255, 210, 87, .9)); }
.rei-tang:focus-visible { outline: none; }
.rei-zzz { position: absolute; right: -8px; top: -6px; font: 700 14px/1 var(--rei-mono); font-style: normal; color: #ffe2c2; opacity: .8; animation: rei-latido 1.6s infinite; pointer-events: none; }
.rei-tang.despierto { animation: rei-salto .6s cubic-bezier(.3, 1.6, .5, 1); cursor: default; }
.rei-tang.despierto img { filter: drop-shadow(0 0 22px rgba(255, 210, 87, 1)); }
.rei-tang.despierto .rei-zzz { display: none; }
@keyframes rei-siesta { 50% { transform: scale(1.03, .97); } }
@keyframes rei-salto { 40% { transform: translateY(-26px) scale(1.08); } }
@keyframes girar-rei { to { transform: rotate(360deg); } }
.rei-tangos.con-tang { justify-content: flex-start; padding-top: 5%; }
.rei-tangos.con-tang .rei-huella { width: clamp(60px, 10vh, 100px); }
.rei-tangos.con-tang .rei-os { font-size: clamp(34px, 6vw, 64px); }

/* ---------- La consola de TANG OS (pantalla de inicio · opciones) ---------- */
.rei-consola .rei-marco { border-color: rgba(255, 157, 61, .45); box-shadow: 0 30px 80px rgba(0, 0, 0, .6), 0 0 60px rgba(255, 157, 61, .1); animation: none; }
.rei-consola .rei-idx { background: var(--rei-naranja); color: #1a0c02; }
.rei-consola .rei-sub { color: var(--rei-naranja); }
.rei-consola .rei-pie span:last-child { color: #5a768c; margin-left: 0; }
.rei-x { margin-left: auto; width: 26px; height: 26px; display: grid; place-items: center; padding: 0; border: 1px solid rgba(126, 206, 255, .28); border-radius: 2px; background: none; color: #9bb6cc; font: 400 13px/1 var(--rei-mono); cursor: pointer; }
.rei-x:hover, .rei-x:focus-visible { color: #fff; border-color: var(--rei-naranja); outline: none; }
.rei-cabecera { display: table; margin: 8px auto 18px; text-align: center; }
.rei-logo {
  margin: 0; text-align: left; white-space: pre; line-height: 1.02; color: var(--rei-naranja);
  font-family: "Cascadia Mono", Consolas, Menlo, "DejaVu Sans Mono", "Liberation Mono", monospace;
  font-size: clamp(9px, 1.55vw, 20px);
  text-shadow: 0 0 8px rgba(255, 157, 61, .6), 0 0 22px rgba(255, 157, 61, .25);
}
.rei-logo.ascii { font-family: var(--rei-mono); line-height: 1.15; }
.rei-lema { margin-top: 12px; font-size: 1.15em; letter-spacing: .42em; padding-left: .42em; color: var(--rei-fosforo); }
