/* System-Level Dashboard Override */
body.hud-mode, html.hud-mode {
  margin: 0; padding: 0;
  width: 100vw; height: 100vh;
  overflow: auto; /* Allow scrolling on small screens */
  background: #010409;
  font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
  color: #e8f1ff;
}

/* Global loading overlay hidden by default if not used */
.hud-mode .loading-screen { display: none !important; }

/* HUD Layout Grid */
.hud-container {
  position: absolute;
  top: 0; left: 0;
  width: 100vw;
  min-height: 100vh;
  z-index: 10;
  display: grid;
  grid-template-columns: min(380px, 25vw) 1fr min(380px, 25vw);
  grid-template-rows: 80px 1fr 40px;
  pointer-events: none; /* Let clicks pass to background 3D canvas */
}

/* Background canvas positioning */
.bg-canvas-container {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* Make interactive elements clickable */
.hud-header, .hud-panel, .hud-footer, .hud-center-interactive, .hud-nav {
  pointer-events: auto;
}

/* HUD Header */
.hud-header {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 40px;
  background: linear-gradient(180deg, rgba(2,9,20,0.95) 0%, rgba(2,9,20,0) 100%);
  border-bottom: 1px solid rgba(92, 200, 255, 0.15);
  box-shadow: 0 5px 20px rgba(0,0,0,0.3);
}

.hud-title {
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 2px;
  color: #fff;
  text-shadow: 0 0 15px rgba(92, 200, 255, 0.8);
  display: flex;
  align-items: center;
  gap: 15px;
}
.hud-title::before {
  content: '';
  display: block;
  width: 10px; height: 10px;
  background: #67f3c7;
  border-radius: 50%;
  box-shadow: 0 0 12px #67f3c7;
}
.hud-title span.sub {
  font-size: 12px;
  color: #5cc8ff;
  letter-spacing: 4px;
  opacity: 0.8;
  margin-left: 10px;
  font-weight: normal;
}

.hud-nav {
  display: flex;
  gap: 15px;
}
.hud-nav a {
  color: #9fb5d8;
  text-decoration: none;
  font-size: 14px;
  padding: 8px 18px;
  border: 1px solid rgba(92, 200, 255, 0.2);
  border-radius: 6px;
  background: rgba(12, 28, 54, 0.6);
  backdrop-filter: blur(5px);
  transition: all 0.3s cubic-bezier(0.25, 1, 0.5, 1);
  letter-spacing: 1px;
}
.hud-nav a:hover, .hud-nav a.active {
  color: #fff;
  background: rgba(92, 200, 255, 0.25);
  border-color: #5cc8ff;
  box-shadow: 0 0 20px rgba(92, 200, 255, 0.4);
  transform: translateY(-2px);
}

/* Side Layouts */
.hud-left {
  grid-column: 1;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  background: linear-gradient(90deg, rgba(2,9,20,0.9) 0%, rgba(2,9,20,0) 100%);
  overflow-y: auto;
  pointer-events: auto;
}
.hud-right {
  grid-column: 3;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  background: linear-gradient(270deg, rgba(2,9,20,0.9) 0%, rgba(2,9,20,0) 100%);
  overflow-y: auto;
  pointer-events: auto;
}

/* Hide scrollbars for side panels */
.hud-left::-webkit-scrollbar, .hud-right::-webkit-scrollbar { display: none; }

/* Cyberpunk Glassmorphism Panels */
.hud-panel {
  background: rgba(8, 20, 42, 0.55);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(92, 200, 255, 0.15);
  border-radius: 12px;
  padding: 20px;
  box-shadow: inset 0 0 30px rgba(92, 200, 255, 0.05), 0 10px 20px rgba(0,0,0,0.4);
  position: relative;
  overflow: hidden;
  transition: border-color 0.3s, box-shadow 0.3s;
}
.hud-panel:hover {
  border-color: rgba(92, 200, 255, 0.4);
  box-shadow: inset 0 0 30px rgba(92, 200, 255, 0.1), 0 10px 20px rgba(0,0,0,0.6);
}

/* Panel Corner Accents */
.hud-panel::before {
  content: '';
  position: absolute;
  top: 0; left: 0; width: 40px; height: 40px;
  border-top: 2px solid #5cc8ff;
  border-left: 2px solid #5cc8ff;
  border-top-left-radius: 12px;
  opacity: 0.8;
}
.hud-panel::after {
  content: '';
  position: absolute;
  bottom: 0; right: 0; width: 40px; height: 40px;
  border-bottom: 2px solid #67f3c7;
  border-right: 2px solid #67f3c7;
  border-bottom-right-radius: 12px;
  opacity: 0.8;
}

.panel-title {
  font-size: 15px;
  color: #fff;
  margin-bottom: 15px;
  text-transform: uppercase;
  letter-spacing: 2px;
  border-bottom: 1px solid rgba(92, 200, 255, 0.2);
  padding-bottom: 8px;
  display: flex;
  align-items: center;
  text-shadow: 0 0 8px rgba(92,200,255,0.5);
}
.panel-title::before {
  content: '■';
  color: #5cc8ff;
  font-size: 10px;
  margin-right: 8px;
}

/* Typography and Lists inside HUD */
.hud-text {
  font-size: 13px;
  color: #9fb5d8;
  line-height: 1.8;
}
.hud-text p { margin-top: 0; margin-bottom: 10px; }
.hud-text strong { color: #5cc8ff; }

.hud-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.hud-list li {
  margin-bottom: 12px;
  font-size: 13px;
  color: #cfe2ff;
  line-height: 1.6;
  position: relative;
  padding-left: 15px;
}
.hud-list li::before {
  content: '▸';
  position: absolute;
  left: 0; top: 0;
  color: #67f3c7;
}
.hud-list li strong {
  display: block;
  color: #fff;
  font-size: 14px;
  margin-bottom: 4px;
}

/* Metrics and Stats */
.hud-stat {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px dashed rgba(255,255,255,0.05);
}
.hud-stat:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.hud-stat .label { font-size: 13px; color: #7890b0; }
.hud-stat .value { 
  font-size: 26px; 
  font-weight: 900; 
  color: #5cc8ff; 
  font-family: monospace;
  text-shadow: 0 0 15px rgba(92, 200, 255, 0.4); 
}
.hud-stat .value.good { color: #67f3c7; text-shadow: 0 0 15px rgba(103, 243, 199, 0.4); }
.hud-stat .value.warn { color: #ffd166; text-shadow: 0 0 15px rgba(255, 209, 102, 0.4); }

/* Chart Containers */
.chart-container {
  width: 100%;
  height: 220px;
  position: relative;
  z-index: 2;
}

/* Center Content */
.hud-center {
  grid-column: 2;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  pointer-events: none; /* By default none, children can be auto */
}

/* Center Box for text/titles */
.center-hero-box {
  background: rgba(5, 12, 25, 0.4);
  backdrop-filter: blur(15px);
  border: 1px solid rgba(92, 200, 255, 0.5);
  border-top: 3px solid #5cc8ff;
  border-bottom: 3px solid #67f3c7;
  padding: 50px 80px;
  border-radius: 4px;
  text-align: center;
  box-shadow: 0 0 50px rgba(92, 200, 255, 0.2), inset 0 0 40px rgba(92, 200, 255, 0.1);
  pointer-events: auto;
  transform: translateY(-20px);
  animation: heroFloat 6s ease-in-out infinite;
  position: relative;
  overflow: hidden;
}
.center-hero-box::before {
  content: '';
  position: absolute;
  top: -50%; left: -50%;
  width: 200%; height: 200%;
  background: linear-gradient(45deg, transparent, rgba(103, 243, 199, 0.1), transparent);
  transform: rotate(45deg);
  animation: shine 4s linear infinite;
}
@keyframes shine {
  0% { transform: translateX(-100%) rotate(45deg); }
  100% { transform: translateX(100%) rotate(45deg); }
}
@keyframes heroFloat {
  0% { transform: translateY(-20px); box-shadow: 0 0 50px rgba(92, 200, 255, 0.2); }
  50% { transform: translateY(-10px); box-shadow: 0 0 70px rgba(103, 243, 199, 0.3); }
  100% { transform: translateY(-20px); box-shadow: 0 0 50px rgba(92, 200, 255, 0.2); }
}
.center-hero-box h1 {
  font-size: 56px;
  font-weight: 900;
  margin: 0 0 15px 0;
  color: #fff;
  text-shadow: 0 0 30px rgba(103, 243, 199, 0.8), 0 0 10px #5cc8ff;
  letter-spacing: 6px;
  position: relative;
  z-index: 1;
}
.center-hero-box p {
  font-size: 20px;
  color: #dff4ff;
  margin: 0;
  letter-spacing: 4px;
  text-transform: uppercase;
  position: relative;
  z-index: 1;
}
.center-hero-box .glow-btn {
  display: inline-block;
  margin-top: 40px;
  padding: 16px 40px;
  background: transparent;
  color: #67f3c7;
  font-weight: bold;
  border: 2px solid #67f3c7;
  border-radius: 2px;
  text-decoration: none;
  font-size: 18px;
  letter-spacing: 2px;
  box-shadow: 0 0 20px rgba(103, 243, 199, 0.3), inset 0 0 10px rgba(103, 243, 199, 0.2);
  transition: all 0.3s;
  text-transform: uppercase;
  position: relative;
  z-index: 1;
}
.center-hero-box .glow-btn:hover {
  transform: scale(1.05);
  background: rgba(103, 243, 199, 0.2);
  box-shadow: 0 0 40px rgba(103, 243, 199, 0.6), inset 0 0 20px rgba(103, 243, 199, 0.4);
  color: #fff;
}

/* Footer */
.hud-footer {
  grid-column: 1 / -1;
  grid-row: 3;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 12px;
  color: #4a6382;
  background: linear-gradient(0deg, rgba(2,9,20,0.9) 0%, rgba(2,9,20,0) 100%);
  letter-spacing: 2px;
  text-transform: uppercase;
}

/* Map Overlay Info (from map.html) */
.center-info {
  position: absolute;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(5, 12, 25, 0.7);
  border: 1px solid #5cc8ff;
  padding: 15px 30px;
  border-radius: 30px;
  display: flex;
  gap: 40px;
  backdrop-filter: blur(8px);
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  pointer-events: auto;
}
.center-info div {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.center-info .val { color: #fff; font-weight: bold; font-size: 20px; text-shadow: 0 0 10px #5cc8ff; }
.center-info .lbl { color: #67f3c7; font-size: 12px; letter-spacing: 1px; margin-top: 4px; }

/* Responsive Design for Small Screens */
@media (max-width: 1400px) {
  .hud-container {
    grid-template-columns: min(300px, 22vw) 1fr min(300px, 22vw);
  }
  .hud-header {
    padding: 0 20px;
  }
  .hud-title {
    font-size: 18px;
  }
  .hud-nav a {
    padding: 6px 12px;
    font-size: 12px;
  }
  .center-hero-box {
    padding: 30px 50px;
  }
  .center-hero-box h1 {
    font-size: 40px;
  }
  .center-hero-box p {
    font-size: 16px;
  }
}

@media (max-width: 1024px) {
  .hud-container {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto 1fr auto;
    min-height: auto;
  }
  body.hud-mode, html.hud-mode {
    overflow: auto;
  }
  .hud-header {
    flex-direction: column;
    gap: 15px;
    padding: 15px;
  }
  .hud-nav {
    flex-wrap: wrap;
    justify-content: center;
  }
  .hud-left, .hud-right {
    grid-column: 1;
    padding: 15px;
  }
  .hud-center {
    grid-column: 1;
    min-height: 400px;
  }
  .center-hero-box {
    padding: 30px 40px;
    max-width: 90%;
  }
  .center-hero-box h1 {
    font-size: 32px;
    letter-spacing: 3px;
  }
  .center-hero-box p {
    font-size: 14px;
    letter-spacing: 2px;
  }
  .center-info {
    flex-direction: column;
    gap: 15px;
    padding: 15px 20px;
  }
  .hud-footer {
    padding: 15px;
  }
}

@media (max-width: 768px) {
  .hud-title {
    font-size: 16px;
  }
  .hud-title span.sub {
    display: none;
  }
  .hud-nav a {
    padding: 5px 10px;
    font-size: 11px;
  }
  .center-hero-box {
    padding: 20px 30px;
  }
  .center-hero-box h1 {
    font-size: 24px;
    letter-spacing: 2px;
  }
  .center-hero-box p {
    font-size: 12px;
  }
  .center-hero-box .glow-btn {
    padding: 12px 24px;
    font-size: 14px;
    margin-top: 20px;
  }
  .hud-panel {
    padding: 15px;
  }
  .panel-title {
    font-size: 14px;
  }
  .hud-text {
    font-size: 12px;
  }
  .hud-list li {
    font-size: 12px;
  }
  .hud-stat .value {
    font-size: 20px;
  }
  .chart-container {
    height: 180px;
  }
}
