/* GLOBAL */

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

:root {
  --bg: #050507;
  --bg-alt: #0b0b10;
  --red: #ff1b2d;
  --red-soft: #b31222;
  --red-dim: #5a0b13;
  --text: #f5f5f5;
  --text-dim: #888;
  --grid: rgba(255, 0, 40, 0.12);
  --accent: #ff3355;
  --panel-border: rgba(255, 0, 40, 0.4);
  --shadow: 0 0 24px rgba(0, 0, 0, 0.9);
  --font-main: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", "Fira Code", "Consolas", monospace;
}

html,
body {
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at top, #151520 0, #050507 55%, #000 100%);
  color: var(--text);
  font-family: var(--font-main);
  overflow: hidden;
}

/* BOOT OVERLAY */

#boot-overlay {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at center, #150008 0, #020103 60%, #000 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 999;
  color: var(--text);
  text-align: center;
}

#boot-logo {
  font-size: 2.8rem;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: var(--red);
  margin-bottom: 0.75rem;
}

#boot-subtitle {
  font-size: 0.9rem;
  color: var(--text-dim);
  margin-bottom: 2rem;
}

#boot-progress {
  width: 320px;
  height: 4px;
  background: #111;
  overflow: hidden;
  border-radius: 999px;
  box-shadow: var(--shadow);
  margin-bottom: 1rem;
}

.boot-bar {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #ff3355, #ff1b2d, #ff6b6b);
  animation: boot-fill 4s ease-out forwards;
}

#boot-status {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-top: 0.5rem;
}

/* CAVE AMBIENT */

#cave-ambient {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(90deg, var(--grid) 1px, transparent 1px),
    linear-gradient(0deg, var(--grid) 1px, transparent 1px);
  background-size: 80px 80px;
  mix-blend-mode: screen;
  opacity: 0.18;
  pointer-events: none;
  animation: grid-drift 40s linear infinite;
}

/* MAIN LAYOUT */

#batcomputer {
  position: absolute;
  top: 2.5vh;
  left: 2vw;
  right: 2vw;
  height: 55vh;
  display: grid;
  grid-template-columns: 1.1fr 1.1fr;
  gap: 1.5rem;
}

.monitor {
  background: linear-gradient(145deg, #050509, #090910);
  border: 1px solid var(--panel-border);
  box-shadow: var(--shadow);
  padding: 0.75rem;
  display: grid;
  grid-template-rows: auto repeat(4, 1fr);
  gap: 0.75rem;
  position: relative;
  overflow: hidden;
}

.monitor::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at top left, rgba(255, 0, 40, 0.18), transparent 55%);
  opacity: 0.4;
  pointer-events: none;
}

.monitor-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--text-dim);
}

.monitor-title {
  color: var(--red);
}

.monitor-status {
  color: var(--text-dim);
}

/* PANELS */

.panel {
  background: radial-gradient(circle at top, #101018 0, #050507 70%);
  border: 1px solid var(--panel-border);
  border-radius: 4px;
  padding: 0.5rem 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  position: relative;
  overflow: hidden;
}

.panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255, 0, 40, 0.12), transparent 60%);
  opacity: 0.4;
  pointer-events: none;
}

.panel-title {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--text-dim);
  margin-bottom: 0.1rem;
}

.panel-body {
  flex: 1;
  font-size: 0.78rem;
  color: var(--text);
  overflow: hidden;
}

/* LOWER CONSOLE */

#lower-console {
  position: absolute;
  left: 2vw;
  right: 2vw;
  bottom: 24vh;
  height: 18vh;
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr;
  gap: 1rem;
}

/* TERMINAL */

#terminal-section {
  position: absolute;
  left: 2vw;
  right: 2vw;
  bottom: 2vh;
  height: 18vh;
  background: radial-gradient(circle at top, #101018 0, #050507 70%);
  border: 1px solid var(--panel-border);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  font-family: var(--font-mono);
}

#terminal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.35rem 0.6rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--text-dim);
  border-bottom: 1px solid rgba(255, 0, 40, 0.25);
}

#terminal-status {
  color: var(--red);
}

#terminal-output {
  flex: 1;
  padding: 0.4rem 0.6rem;
  font-size: 0.78rem;
  color: var(--text);
  overflow-y: auto;
}

#terminal-input-row {
  display: flex;
  align-items: center;
  padding: 0.35rem 0.6rem;
  border-top: 1px solid rgba(255, 0, 40, 0.25);
}

.prompt-label {
  color: var(--red);
  margin-right: 0.4rem;
  font-size: 0.8rem;
}

#terminal-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.8rem;
}

/* AI MODULE PANEL */

#ai-module-panel {
  position: absolute;
  top: 2.5vh;
  right: 2vw;
  width: 260px;
  height: 200px;
  z-index: 50;
}

.hidden {
  display: none;
}

/* UTILITY */

.text-dim {
  color: var(--text-dim);
}

.badge {
  display: inline-block;
  padding: 0.05rem 0.35rem;
  border-radius: 999px;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  border: 1px solid var(--panel-border);
}

/* THREAT COLORS */

.threat-low {
  color: #4caf50;
}

.threat-moderate {
  color: #ffc107;
}

.threat-high {
  color: #ff5722;
}

.threat-critical {
  color: #ff1744;
}

/* RECOVERY HUD */

.recovery-score-block {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.recovery-score-circle {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 2px solid rgba(255, 59, 59, 0.7);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 1.1rem;
  color: #fff;
  background: radial-gradient(circle at top, #2a0a10 0, #050507 70%);
  box-shadow: 0 0 18px rgba(255, 0, 40, 0.35);
}

.recovery-score-circle span {
  font-size: 0.6rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.recovery-meta {
  flex: 1;
  font-size: 0.75rem;
}

.recovery-meta-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.recovery-meta-mode {
  font-size: 0.85rem;
  color: var(--red);
  margin-top: 0.15rem;
}

.recovery-meta-message {
  font-size: 0.72rem;
  color: var(--text-dim);
  margin-top: 0.2rem;
}

/* ANIMATIONS */

@keyframes boot-fill {
  0% {
    width: 0%;
  }
  100% {
    width: 100%;
  }
}

@keyframes grid-drift {
  0% {
    background-position: 0 0, 0 0;
  }
  100% {
    background-position: 80px 80px, 80px 80px;
  }
}

@keyframes pulse-soft {
  0% {
    opacity: 0.4;
  }
  50% {
    opacity: 0.9;
  }
  100% {
    opacity: 0.4;
  }
}

@keyframes flicker {
  0%,
  19%,
  21%,
  23%,
  25%,
  54%,
  56%,
  100% {
    opacity: 1;
  }
  20%,
  24%,
  55% {
    opacity: 0.4;
  }
}

/* SCROLLBARS */

#terminal-output::-webkit-scrollbar,
.panel-body::-webkit-scrollbar {
  width: 6px;
}

#terminal-output::-webkit-scrollbar-thumb,
.panel-body::-webkit-scrollbar-thumb {
  background: rgba(255, 0, 40, 0.4);
  border-radius: 999px;
}

/* RESPONSIVE */

@media (max-width: 1100px) {
  #batcomputer {
    grid-template-columns: 1fr;
    height: 50vh;
  }

  #lower-console {
    grid-template-columns: 1fr;
    height: 24vh;
    bottom: 26vh;
  }

  #terminal-section {
    height: 22vh;
  }
}
