:root {
  --bg-color: #050608;
  --text-color: #f1f5f9;
  --accent-color: #fafaf9;
  --glass-bg: rgba(0, 0, 0, 0.85);
  --glass-border: rgba(255, 255, 255, 0.15);
  --accent-faint: rgba(250, 250, 249, 0.5);
  --accent-glow: rgba(250, 250, 249, 0.1);
}

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

body {
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  background-color: var(--bg-color);
  color: var(--text-color);
  line-height: 1.5;
  height: 100vh;
  width: 100vw;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden; 
}

#terminal-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  opacity: 0.6;
  pointer-events: none;
  transition: all 0.5s ease;
}

#terminal-bg canvas {
  display: block;
}

/* Dimming Effect Logic */
body:has(#terminal:hover) #terminal-bg {
  opacity: 0.4;
  filter: blur(6px);
}

.hud-wrapper {
  position: relative;
  z-index: 10;
  width: 90vw;
  height: 85vh;
}

/* SINGLE MODULE LAYOUT */
.hud-wrapper.single-module-layout {
  display: flex;
  justify-content: center;
  align-items: center;
}

/* BRIEFING MODE STYLES */
.briefing-mode {
  overflow-y: auto;
  height: auto;
}

.briefing-mode .hud-wrapper {
  height: auto;
  min-height: 100vh;
  padding: 4rem 0;
  display: block; /* Overwrite flex for scrolling */
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
}

.briefing-container {
  height: auto;
  min-height: 80vh;
  padding: 3rem;
}

.back-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--accent-faint);
  text-decoration: none;
  font-size: 0.75rem;
  font-weight: 800;
  margin-bottom: 1.5rem;
  transition: all 0.2s ease;
  text-transform: uppercase;
}

.back-link:hover {
  color: var(--accent-color);
  transform: translateX(-5px);
}

.back-link i {
  width: 14px;
  height: 14px;
}

.briefing-content {
  margin-top: 2.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.briefing-content h3 {
  font-size: 1.1rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--accent-color);
  margin-top: 1.5rem;
  border-left: 2px solid var(--accent-color);
  padding-left: 1.25rem;
}

.impact-text {
  font-size: 1.15rem;
  color: #fff;
  line-height: 1.7;
  border-bottom: 1px solid var(--glass-border);
  padding-bottom: 2rem;
  margin-bottom: 1rem;
}

.closing-statement {
  margin-top: 3rem;
  padding: 2rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--accent-faint);
  font-style: italic;
  color: var(--accent-color);
  line-height: 1.6;
}

#terminal {
  width: 100%;
  max-width: 800px;
  height: 100%;
  padding: 2.5rem;
  display: flex;
  flex-direction: column;
}

#terminal-header {
  margin-bottom: 2rem;
  border-bottom: 1px solid var(--glass-border);
  padding-bottom: 1rem;
}

#terminal-history {
  flex: 1;
  overflow-y: auto;
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  scrollbar-width: thin;
  scrollbar-color: var(--accent-faint) transparent;
}

#terminal-history p {
  font-size: 0.95rem;
  color: #e2e8f0;
  line-height: 1.6;
}

#terminal-prompt {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding-top: 1rem;
  border-top: 1px solid var(--glass-border);
}

.prompt-user {
  color: var(--accent-color);
  font-weight: 800;
  font-size: 0.9rem;
  white-space: nowrap;
}

#command-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: #fff;
  font-family: inherit;
  font-size: 0.95rem;
  caret-color: var(--accent-color);
}

#terminal-history a {
  color: var(--accent-color);
  text-decoration: none;
  border-bottom: 1px solid var(--accent-faint);
  transition: all 0.2s ease;
  font-weight: 700;
}

#terminal-history a:hover {
  color: #fff;
  border-bottom-color: var(--accent-color);
  text-shadow: 0 0 10px var(--accent-color);
  background: rgba(255, 255, 255, 0.05);
}

.terminal-line {
  line-height: 1.6;
  opacity: 0;
  animation: fadeIn 0.3s forwards;
  white-space: pre-wrap;
  word-break: break-all;
}

@keyframes fadeIn {
  to { opacity: 1; }
}

.terminal-error { color: #f87171; }
.terminal-success { color: #4ade80; }
.terminal-info { color: var(--accent-faint); }

.hud-module {
  position: relative;
  pointer-events: auto;
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  padding: 1.75rem;
  transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.module-meta {
  position: absolute;
  top: -0.6rem;
  left: 1rem;
  font-size: 0.65rem;
  color: var(--accent-color);
  background: #111;
  padding: 0 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  border: 1px solid var(--glass-border);
  z-index: 20;
}

.hud-module::before,
.hud-module::after {
  content: '';
  position: absolute;
  width: 15px;
  height: 15px;
  border: 2px solid var(--accent-color);
  opacity: 0.8;
}

.hud-module::before { top: -2px; left: -2px; border-right: none; border-bottom: none; }
.hud-module::after { bottom: -2px; right: -2px; border-left: none; border-top: none; }

header h1 {
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--accent-color);
  text-transform: uppercase;
  letter-spacing: -0.02em;
  margin-bottom: 0.25rem;
}

.subtitle {
  font-size: 0.85rem;
  color: var(--accent-faint);
  font-weight: 500;
}

/* Accessibility & SEO Utilities */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* MOBILE FALLBACK */
@media (max-width: 768px) {
  body {
    height: auto;
    overflow-y: auto;
    align-items: flex-start;
  }
  
  .hud-wrapper.single-module-layout {
    width: 95vw;
    height: auto;
    margin: 2rem auto;
  }

  #terminal {
    padding: 1.5rem;
    height: auto;
  }

  header h1 {
    font-size: 1.8rem;
  }

  .briefing-container {
    padding: 1.5rem;
  }
}
