* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --fondo: #04070a;
  --ventana: #0e1319;
  --borde: #2b3540;
  --barra: #1b222b;
  --texto: #cfd9e3;
  --tenue: #7d8b99;
  --rojo: #ff3b30;
  --verde: #3dff8f;
  --ambar: #ffb02e;
}

[hidden] {
  display: none !important;
}

html,
body {
  height: 100%;
}

body {
  background: var(--fondo);
  color: var(--texto);
  font-family: "Cascadia Code", "Consolas", "Courier New", monospace;
  overflow: hidden;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 999;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    rgba(255, 255, 255, 0.035) 0,
    rgba(255, 255, 255, 0.035) 1px,
    transparent 1px,
    transparent 3px
  );
}

#hud {
  position: fixed;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 10px;
  z-index: 75;
  font-size: 12px;
}

.hud-caja {
  background: rgba(8, 12, 16, 0.9);
  border: 1px solid var(--borde);
  padding: 6px 14px;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.hud-rojo {
  border-color: var(--rojo);
  color: #ff8a80;
}

.punto {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--rojo);
  margin-right: 8px;
  vertical-align: middle;
  animation: parpadeo 1s steps(1) infinite;
}

#boot {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: #020403;
  padding: 6vh 6vw;
  transition: opacity 0.5s ease;
}

#boot.ocultando {
  opacity: 0;
}

#boot-texto {
  color: var(--verde);
  font-size: clamp(12px, 1.5vw, 17px);
  line-height: 1.9;
  text-shadow: 0 0 8px rgba(61, 255, 143, 0.5);
  white-space: pre-wrap;
}

#boot-texto::after {
  content: "";
  display: inline-block;
  width: 0.6em;
  height: 1em;
  background: var(--verde);
  vertical-align: text-bottom;
  animation: parpadeo 0.8s steps(1) infinite;
}

#escritorio {
  position: fixed;
  inset: 0;
  background: radial-gradient(1200px 700px at 30% 20%, #0b1420, #04070a 60%);
}

.ventana {
  display: none;
  position: absolute;
  flex-direction: column;
  background: var(--ventana);
  border: 1px solid var(--borde);
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.7);
  max-height: 74vh;
}

.ventana.abierta {
  display: flex;
  animation: entra 0.25s ease-out;
}

.ventana-barra {
  display: flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(180deg, #232c36, #171e26);
  border-bottom: 1px solid var(--borde);
  padding: 8px 10px;
  cursor: move;
  user-select: none;
  touch-action: none;
}

.icono {
  width: 12px;
  height: 12px;
  flex: none;
}

.icono-verde {
  background: var(--verde);
  box-shadow: 0 0 8px rgba(61, 255, 143, 0.8);
}

.icono-naranja {
  background: var(--ambar);
  box-shadow: 0 0 8px rgba(255, 176, 46, 0.8);
}

.icono-rojo {
  background: var(--rojo);
  box-shadow: 0 0 8px rgba(255, 59, 48, 0.8);
}

.ventana-titulo {
  flex: 1;
  font-size: 12px;
  color: #9fb2c3;
  letter-spacing: 0.04em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ventana-acciones {
  display: flex;
  gap: 6px;
}

.ventana-acciones i {
  font-style: normal;
  font-size: 11px;
  color: var(--tenue);
  border: 1px solid var(--borde);
  width: 18px;
  height: 16px;
  display: grid;
  place-items: center;
  cursor: default;
}

.ventana-acciones i.cierra:hover {
  color: #fff;
  background: var(--rojo);
  border-color: var(--rojo);
}

.ventana-cuerpo {
  padding: 12px 14px;
  font-size: 12.5px;
  line-height: 1.65;
  overflow: hidden;
}

.ventana-cuerpo.terminal {
  background: #050907;
}

#v-fuentes {
  left: 4%;
  top: 8%;
  width: min(470px, 92vw);
}

#v-extraccion {
  right: 4%;
  top: 12%;
  width: min(500px, 94vw);
}

#v-sql {
  left: 16%;
  top: 46%;
  width: min(430px, 92vw);
}

#v-backup {
  right: 7%;
  top: 52%;
  width: min(450px, 92vw);
}

.linea {
  white-space: pre-wrap;
  word-break: break-all;
}

.terminal .linea {
  color: var(--verde);
  text-shadow: 0 0 6px rgba(61, 255, 143, 0.35);
}

.linea-ok {
  color: var(--verde);
  font-weight: 700;
}

.linea-alerta {
  color: #ff6b61;
  background: rgba(255, 59, 48, 0.12);
  border-left: 3px solid var(--rojo);
  padding-left: 6px;
}

.linea-borrado {
  color: #66717c;
  text-decoration: line-through;
}

.linea-propio {
  color: #fff;
  background: rgba(255, 59, 48, 0.4);
  font-weight: 700;
  padding-left: 6px;
}

.lista {
  margin-top: 8px;
  max-height: 240px;
  overflow: hidden;
}

.ruta {
  color: var(--ambar);
  font-size: 12px;
  word-break: break-all;
}

.barra {
  height: 16px;
  background: #0a0e13;
  border: 1px solid var(--borde);
  margin: 10px 0 6px;
}

.barra i {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--ambar), var(--rojo));
  transition: width 0.3s linear;
}

.barra-meta {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--tenue);
}

.contador {
  font-size: clamp(26px, 4vw, 44px);
  font-weight: 700;
  color: var(--rojo);
  text-shadow: 0 0 18px rgba(255, 59, 48, 0.5);
}

.subtexto {
  font-size: 11px;
  color: var(--tenue);
  letter-spacing: 0.06em;
}

.aviso-titulo {
  background: linear-gradient(180deg, #c62828, #8e0f0f);
  color: #ffe9e7;
  padding: 10px 14px;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.1em;
  margin: -12px -14px 14px;
}

.aviso-texto {
  font-size: 14.5px;
  line-height: 1.75;
  color: #ffe9e7;
}

.aviso-nota {
  margin-top: 12px;
  color: #a17c78;
  font-size: 12px;
}

#barra-tareas {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: 42px;
  background: rgba(10, 14, 19, 0.97);
  border-top: 1px solid var(--borde);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  z-index: 60;
  font-size: 12px;
}

.tb-inicio {
  border: 1px solid var(--borde);
  background: #131a22;
  padding: 6px 14px;
  letter-spacing: 0.05em;
}

#tb-ventanas {
  display: flex;
  gap: 6px;
  flex: 1;
  overflow: hidden;
}

.tb-app {
  font-family: inherit;
  font-size: 11px;
  color: var(--texto);
  background: #101720;
  border: 1px solid var(--borde);
  padding: 6px 12px;
  cursor: pointer;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tb-app:hover {
  background: #1a232e;
}

#tb-derecha {
  display: flex;
  gap: 16px;
  align-items: center;
  color: var(--tenue);
}

.tb-rec {
  color: var(--rojo);
  animation: parpadeo 1.4s steps(1) infinite;
  letter-spacing: 0.08em;
}

#tb-reloj {
  font-variant-numeric: tabular-nums;
}

#v-alerta {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: none;
  place-items: center;
  background: rgba(0, 0, 0, 0.45);
}

.alerta-dialogo {
  width: min(640px, 92vw);
  background: #12161c;
  border: 1px solid var(--rojo);
  box-shadow: 0 0 70px rgba(255, 59, 48, 0.4);
}

.temblar {
  animation: temblor 0.35s linear 2;
}

.alerta-barra {
  background: linear-gradient(180deg, #c62828, #8e0f0f);
  color: #ffe9e7;
  padding: 11px 16px;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.1em;
}

.alerta-cuerpo {
  padding: 24px 22px;
  font-size: clamp(14px, 1.7vw, 17px);
  line-height: 1.75;
  color: #ffe9e7;
}

.alerta-pie {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 0 22px 20px;
}

.alerta-pie button {
  font-family: inherit;
  font-size: 13px;
  padding: 9px 22px;
  background: #1a2029;
  color: var(--texto);
  border: 1px solid var(--borde);
  cursor: pointer;
  letter-spacing: 0.05em;
}

.alerta-pie button:hover {
  background: var(--rojo);
  border-color: var(--rojo);
  color: #fff;
}

#rescate {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: none;
  place-items: center;
  text-align: center;
  padding: 24px;
  background: radial-gradient(ellipse at center, #1a0000 0%, #000 72%);
}

.rescate-tarjeta {
  max-width: 780px;
}

.rescate-senal {
  width: 74px;
  height: 74px;
  margin: 0 auto 22px;
  border: 4px solid var(--rojo);
  border-radius: 50%;
  color: var(--rojo);
  font-size: 44px;
  font-weight: 700;
  display: grid;
  place-items: center;
  text-shadow: 0 0 16px rgba(255, 59, 48, 0.8);
  box-shadow: 0 0 34px rgba(255, 59, 48, 0.45);
}

#rescate h1 {
  font-size: clamp(26px, 5.5vw, 56px);
  color: var(--rojo);
  letter-spacing: 0.06em;
  text-shadow: 0 0 26px rgba(255, 59, 48, 0.65);
  animation: latido 1.6s ease-in-out infinite;
}

.rescate-mensaje {
  margin-top: 22px;
  font-size: clamp(13px, 1.6vw, 16px);
  line-height: 1.8;
  color: #ffd9d5;
}

.rescate-contador {
  margin-top: 26px;
  font-size: clamp(44px, 9vw, 96px);
  font-weight: 700;
  color: #fff;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 30px rgba(255, 255, 255, 0.35);
}

.rescate-nota {
  margin-top: 8px;
  font-size: 12px;
  color: #a17c78;
  letter-spacing: 0.05em;
}

#fin {
  position: fixed;
  inset: 0;
  z-index: 92;
  display: grid;
  place-items: center;
  background: #000;
}

.fin-texto {
  color: #3a4753;
  font-size: 13px;
  letter-spacing: 0.25em;
  text-transform: lowercase;
}

#expirado {
  position: fixed;
  inset: 0;
  z-index: 95;
  display: grid;
  place-items: center;
  text-align: center;
  background: #0b0e11;
}

.expirado-texto {
  color: #8b97a3;
  font-size: clamp(15px, 2.4vw, 19px);
  line-height: 2.2;
}

.expirado-texto span {
  display: block;
  font-size: 12.5px;
  color: #4d5865;
}

@keyframes entra {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes parpadeo {
  50% {
    opacity: 0.15;
  }
}

@keyframes temblor {
  0%,
  100% {
    transform: translateX(0);
  }
  20% {
    transform: translateX(-8px);
  }
  40% {
    transform: translateX(8px);
  }
  60% {
    transform: translateX(-6px);
  }
  80% {
    transform: translateX(6px);
  }
}

@keyframes latido {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.03);
  }
}

@media (max-width: 760px) {
  #hud {
    font-size: 10px;
    gap: 6px;
  }

  .hud-caja {
    padding: 5px 8px;
  }

  #v-fuentes,
  #v-extraccion,
  #v-sql,
  #v-backup {
    left: 3vw;
    right: auto;
    width: 94vw;
  }

  #v-fuentes {
    top: 5%;
  }

  #v-extraccion {
    top: 25%;
  }

  #v-sql {
    top: 45%;
  }

  #v-backup {
    top: 65%;
  }

  .ventana-cuerpo {
    font-size: 11.5px;
  }
}

/* Tablero del incidente */
#escritorio {
  background:
    radial-gradient(circle at 48% 42%, rgba(131, 17, 31, .2), transparent 34%),
    radial-gradient(circle at 70% 20%, rgba(20, 69, 98, .16), transparent 37%),
    #060a0e;
  isolation: isolate;
}

.fondo-grid {
  position: absolute;
  inset: 0;
  opacity: .34;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(90, 124, 145, .12) 1px, transparent 1px),
    linear-gradient(90deg, rgba(90, 124, 145, .12) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: radial-gradient(circle at center, black, transparent 80%);
}

.panel-central {
  position: absolute;
  z-index: 30;
  top: 10%;
  left: 50%;
  transform: translateX(-50%);
  width: min(610px, 54vw);
  padding: 0 24px 18px;
  border: 1px solid #34414a;
  background: linear-gradient(155deg, rgba(24, 31, 39, .95), rgba(7, 12, 17, .96));
  box-shadow: 0 22px 80px rgba(0, 0, 0, .55), 0 0 50px rgba(207, 30, 43, .09);
}

.panel-central::before {
  content: "";
  display: block;
  height: 3px;
  margin: 0 -24px;
  background: linear-gradient(90deg, #ff493d, #ff9e38 55%, transparent);
}

.panel-etiqueta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 20px;
  color: #ff9e92;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .15em;
}

.panel-derecha { margin-left: auto; color: #ff5e54; }

.panel-titulo {
  margin-top: 18px;
  color: #f3f7fa;
  font-size: clamp(25px, 2.9vw, 42px);
  font-weight: 800;
  letter-spacing: -.055em;
  line-height: 1.08;
}

.panel-titulo span { color: #ff6259; }

.panel-actividad {
  display: grid;
  gap: 5px;
  min-height: 93px;
  margin-top: 16px;
  padding: 12px 14px;
  border: 1px solid rgba(255, 80, 69, .75);
  background: linear-gradient(110deg, rgba(116, 12, 24, .48), rgba(28, 10, 16, .74));
  box-shadow: inset 3px 0 #ff5148, 0 0 24px rgba(255, 59, 48, .13);
}

.panel-actividad > span {
  color: #ffb1a5;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .16em;
}

.panel-actividad strong {
  color: #fff;
  font-size: clamp(17px, 2vw, 25px);
  line-height: 1.1;
  text-shadow: 0 0 18px rgba(255, 91, 73, .42);
}

.panel-actividad small {
  color: #b8c7cf;
  font-size: 11px;
  overflow-wrap: anywhere;
}

.panel-descripcion {
  max-width: 460px;
  margin-top: 12px;
  color: #91a3af;
  font: 14px/1.6 "Segoe UI", Arial, sans-serif;
}

.panel-metricas {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 25px;
}

.panel-metricas > div {
  min-width: 0;
  padding: 12px 13px;
  border: 1px solid #2e3942;
  background: #0d151c;
}

.panel-metricas small {
  display: block;
  color: #718898;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .09em;
}

.panel-metricas strong {
  display: block;
  margin-top: 8px;
  color: #eff4f6;
  font-size: clamp(23px, 2.5vw, 36px);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.panel-metricas span {
  display: block;
  margin-top: 5px;
  color: #738696;
  font-size: 10px;
}

.panel-cuenta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  padding: 13px 15px;
  border: 1px solid rgba(255, 98, 89, .55);
  background: rgba(81, 15, 22, .38);
}

.panel-cuenta span {
  color: #ffaaa2;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .14em;
}

.panel-cuenta strong {
  color: #fff1ee;
  font: 700 clamp(25px, 3vw, 39px)/1 Consolas, monospace;
  font-variant-numeric: tabular-nums;
  letter-spacing: .02em;
  text-shadow: 0 0 18px rgba(255, 75, 61, .4);
}

.panel-pie {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
  color: #718898;
  font-size: 10px;
  letter-spacing: .05em;
}

.panel-pie span:first-child { color: #ff675c; }

#hud {
  width: min(800px, calc(100% - 20px));
  justify-content: center;
}

.hud-caja {
  background: rgba(10, 17, 23, .96);
  box-shadow: 0 6px 24px rgba(0, 0, 0, .28);
}

.ventana {
  border-color: #33424b;
  box-shadow: 0 18px 60px rgba(0, 0, 0, .7), 0 0 0 1px rgba(255, 255, 255, .025) inset;
}

.ventana-barra {
  background: linear-gradient(180deg, #27313a, #1b252d);
  padding: 9px 11px;
}

#v-fuentes { left: 3%; top: 14%; width: min(390px, 30vw); }
#v-extraccion { right: 3%; top: 17%; width: min(410px, 31vw); }
#v-sql { left: 7%; top: 54%; width: min(360px, 29vw); }
#v-backup { right: 5%; top: 58%; width: min(350px, 28vw); }
#v-ddos { left: 35%; top: 53%; width: min(430px, 36vw); }

.ddos-estado {
  color: #ff8b79;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .05em;
}

.ddos-estado .punto { width: 6px; height: 6px; }
.ddos-numeros { display: flex; align-items: baseline; gap: 9px; margin-top: 8px; }
.ddos-numeros strong { color: #ff5148; font-size: 32px; font-variant-numeric: tabular-nums; }
.ddos-numeros span { color: #8297a5; font-size: 11px; }

.ddos-barras {
  display: flex;
  align-items: end;
  gap: 3px;
  height: 45px;
  margin: 8px 0;
  padding: 0 2px;
  border-bottom: 1px solid #40505a;
}

.ddos-barras i {
  flex: 1;
  height: 10%;
  background: linear-gradient(0deg, #a6202a, #ff7350);
  transition: height .35s ease;
}

.ddos-lista { color: #8ca0ac; font-size: 10px; }
.ddos-lista span { color: #ff6155; font-weight: 700; }

#v-alerta:not([hidden]), #rescate:not([hidden]) { display: grid; }

@media (max-width: 900px) {
  .panel-central { width: min(560px, 72vw); }
  #v-fuentes, #v-extraccion, #v-sql, #v-backup, #v-ddos { width: min(380px, 44vw); }
}

@media (max-width: 700px) {
  body { overflow: auto; }
  #escritorio { position: relative; min-height: 100vh; overflow-y: auto; padding: 48px 12px 70px; }
  .panel-central { position: relative; top: auto; left: auto; transform: none; width: 100%; padding: 0 16px 16px; margin-bottom: 12px; }
  .panel-central::before { margin: 0 -16px; }
  .panel-metricas { gap: 5px; }
  .panel-metricas > div { padding: 8px; }
  .panel-metricas small { font-size: 8px; }
  .panel-etiqueta { font-size: 9px; }
  .panel-cuenta { align-items: start; flex-direction: column; }
  .panel-derecha { display: none; }
  .ventana, .ventana.abierta {
    position: relative;
    left: auto !important;
    right: auto !important;
    top: auto !important;
    width: 100% !important;
    max-height: none;
    margin-bottom: 10px;
  }
  .ventana-cuerpo { max-height: 160px; overflow: hidden; }
  #hud { font-size: 9px; }
  .hud-caja { overflow: hidden; text-overflow: ellipsis; }
  #barra-tareas { height: 35px; }
  #tb-ventanas { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
