/* ===========================================
   NODEOS V33 GAME INTERFACE - Simple Terminal Style
   =========================================== */

/*This file controls the in-game HUD and interface.
   I made it super simple because CSS always overwhelms me.
   Each section does ONE thing and is clearly labeled. */

/* ===========================================
   BASIC LAYOUT - Full screen game
   =========================================== */

/*Body with padding for NodeOS border.
   Use 85vh so it fits in any browser without scrolling. */
body {
  margin: 0;
  padding: 20px;
  background: #000;
  font-family: "Courier New", monospace;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

/*Game container - bigger with minimal margins */
#game {
  width: min(98vw, 1920px);
  height: 90vh;
  aspect-ratio: 16 / 9;
  position: relative;
  background: #000;
  border: 4px solid var(--nodeos-color);
  box-sizing: border-box;
}

/*Canvas takes most of the space, small margin for UI */
canvas#view {
  width: calc(100%);
  height: calc(100%);
  image-rendering: pixelated;
  background: #000;
  cursor: crosshair;
  display: block;
}

/* ===========================================
   HUD PANELS - Terminal windows on game screen
   =========================================== */

/*The HUD container covers the whole screen
   but doesn't block mouse clicks (pointer-events: none) */
.hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
}

/*Status panel - bigger to show all bars and allow more */
.hud .panel {
  position: absolute;
  left: 10px;
  bottom: 10px;
  background: #000;
  border: 2px solid var(--nodeos-color);
  color: var(--nodeos-node-color);
  padding: 15px;
  font-family: "Courier New", monospace;
  font-size: 14px;
  min-width: 260px;
  max-height: 220px;
  overflow-y: auto;
  pointer-events: auto;
}

/*Controls panel goes bottom-right.
   Using multiple selectors to override any conflicts */
.help,
.hud .help,
div.help {
  position: absolute !important;
  right: 10px !important;
  bottom: 10px !important;
  background: #000 !important;
  border: 2px solid var(--nodeos-color) !important;
  color: var(--nodeos-node-color) !important;
  padding: 10px !important;
  font-family: "Courier New", monospace !important;
  font-size: 14px !important;
  text-align: left !important;
  pointer-events: auto;
}

/* ===========================================
   STATUS BARS - Health and Ammo
   =========================================== */

/*Status bar rows - just simple flex layout */
.hud .row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 5px 0;
}

/*The progress bars themselves.
   Keep them simple - black background, colored fill */
.bar {
  width: 120px;
  height: 14px;
  background: #000;
  border: 1px solid var(--nodeos-color);
  position: relative;
  overflow: hidden;
}

/*The colored fill inside the bars.
   Green for ammo, red for health when low */
.bar > i {
  display: block;
  height: 100%;
  background: var(--nodeos-color);
  transition: width 0.3s;
}

/*When health is low, make the bar red */
.bar.warn > i {
  background: #ff0000;
}

/* ===========================================
  MINIMAP - Bottom center
  =========================================== */

.minimap {
  position: absolute !important;
  bottom: 10px !important;
  left: 50% !important;
  transform: translateX(-50%) !important;
  top: auto !important;
  right: auto !important;
  border: 2px solid var(--nodeos-color) !important;
  background: #000 !important;
  display: none !important;
}

/*When minimap is visible (M key pressed),
   this class gets added by JavaScript */
.minimap.visible {
  display: block !important;
}

/* Collapsible log across the top inside #game */
.game-log {
  position: absolute;
  top: 10px;
  left: 10px;
  right: 7%;
  max-height: calc(100% - 120px);
  background: #000
    radial-gradient(
      ellipse at center,
      rgba(0, 255, 0, 0.05) 40%,
      #000 90%,
      #000
    );
  border: 5px solid #333;
  color: var(--nodeos-node-color);
  font-family: "Courier New", monospace;
  font-size: 20px;
  padding: 8px 10px 10px 10px;
  box-sizing: border-box;
  pointer-events: auto;
}

.game-log .log-items {
  max-height: 25vh;
  overflow-y: auto;
  text-align: center; /* Center the log text */
}

.game-log .log-items div {
  margin-bottom: 2px;
  line-height: 1.3;
}

/* Collapsed state: show only last 3 lines and maintain full width */
.game-log.collapsed {
  right: 7%;
}
.game-log.collapsed .log-items {
  max-height: 3.9em; /* ~3 lines */
  overflow: hidden;
  mask-image: linear-gradient(180deg, #000 10%, transparent);
}

/* Log handle button */
.log-handle {
  z-index: 1000;
  position: absolute;
  top: -2px;
  left: -2px;
  font-size: 20px;
  background: #000;
  color: var(--nodeos-node-color);
  border: 2px solid var(--nodeos-color);
  font-family: inherit;
  padding: 6px 6px;
  cursor: pointer;
}

/* ===========================================
   CROSSHAIR - Center aim reticle
   =========================================== */

/*Enhanced crosshair in center of screen */
.crosshair {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  color: var(--nodeos-color);
  font-size: 30px;
}

/* ===========================================
   BUTTONS - Simple terminal style
   =========================================== */

/*Footer buttons (Reset, Toggle Minimap)
   Style them like terminal commands */
.btn {
  background: #000;
  border: 1px solid var(--nodeos-color);
  color: var(--nodeos-node-color);
  padding: 8px 16px;
  font-family: "Courier New", monospace;
  cursor: pointer;
  margin-right: 10px;
}

.btn:hover {
  background: var(--nodeos-color);
  color: #000;
}

/*Footer bar at bottom with terminal styling */
footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #000;
  border-top: 1px solid var(--nodeos-color);
  padding: 10px;
  text-align: center;
}

/* ===========================================
   REMOVE COMPLEX STUFF
   =========================================== */

/*Hide the header completely for cleaner look */
header {
  display: none;
}

/*Remove all the fancy effects and decorations */
*::before,
*::after {
  display: none;
}

/*Override any text shadows or fancy effects */
* {
  text-shadow: none !important;
  box-shadow: none !important;
}

/* Restore essential shadows only where needed */
.hud .panel,
.help {
  box-shadow: 0 0 10px rgba(0, 255, 0, 0.3) !important;
}

/* Override the display: none for crosshair pseudo-elements */
.crosshair i::before,
.crosshair i::after {
  display: block !important;
}

/* ===========================================
   GAME OVER TERMINAL POPUP - Soul Disconnected
   =========================================== */

/* Full screen overlay - initially hidden */
.game-over-popup {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  background: rgba(0, 0, 0, 0.95) !important;
  display: none !important;
  align-items: center !important;
  justify-content: center !important;
  z-index: 999999 !important;
  opacity: 0 !important;
  transition: opacity 0.5s ease-in !important;
  pointer-events: none !important;
  box-sizing: border-box !important;
}

/* When popup is shown */
.game-over-popup.show {
  display: flex !important;
  opacity: 1 !important;
  pointer-events: auto !important;
}

/* Terminal window styling */
.terminal-popup {
  background: #000;
  border: 3px solid var(--nodeos-color);
  color: var(--nodeos-node-color);
  font-family: "Courier New", monospace;
  width: 600px;
  max-width: 90vw;
  box-shadow: 0 0 20px rgba(0, 255, 0, 0.5), inset 0 0 20px rgba(0, 255, 0, 0.1);
  animation: terminalGlow 0.6s ease-in;
}

/* Terminal header bar */
.terminal-header {
  background: var(--nodeos-color);
  color: #000;
  padding: 8px 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: bold;
  font-size: 12px;
}

.terminal-error {
  color: #000;
  background: #ff0000;
  padding: 2px 8px;
  border-radius: 2px;
  font-size: 10px;
  animation: errorBlink 1s infinite;
}

/* Terminal body content */
.terminal-body {
  padding: 20px;
  min-height: 200px;
}

/* Status lines styling */
.disconnect-message {
  margin-bottom: 30px;
}

.status-line {
  font-size: 14px;
  margin: 8px 0;
  color: var(--nodeos-node-color);
  opacity: 1;
}

/* Fade-in animations for different lines */
.fade-in-1 {
  animation: fadeInLine 0.8s ease-in 1s both;
  color: #ff4444;
  font-weight: bold;
  font-size: 16px;
}

.fade-in-2 {
  animation: fadeInLine 0.6s ease-in 1.8s both;
  color: #ffaa44;
}

.fade-in-3 {
  animation: fadeInLine 0.6s ease-in 2.4s both;
  color: #ff6666;
}

.fade-in-4 {
  animation: fadeInLine 0.8s ease-in 3s both;
  color: var(--nodeos-color);
  font-size: 16px;
}

/* Terminal button styling */
.terminal-buttons {
  text-align: center;
  margin-top: 20px;
  opacity: 0;
  animation: fadeInLine 0.6s ease-in 3.8s both;
}

.terminal-btn {
  background: #000;
  border: 2px solid var(--nodeos-color);
  color: var(--nodeos-node-color);
  padding: 12px 24px;
  font-family: "Courier New", monospace;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s ease;
  text-transform: uppercase;
  letter-spacing: 1px;
  text-decoration: none;
  display: inline-block;
  text-align: center;
}

.terminal-btn:hover {
  background: var(--nodeos-color);
  color: #000;
  box-shadow: 0 0 10px rgba(0, 255, 0, 0.8);
  transform: translateY(-1px);
}

.terminal-btn:active {
  transform: translateY(0);
}

/* Animations */
@keyframes terminalGlow {
  0% {
    opacity: 0;
    transform: scale(0.8);
    box-shadow: 0 0 5px rgba(0, 255, 0, 0.2);
  }
  100% {
    opacity: 1;
    transform: scale(1);
    box-shadow: 0 0 20px rgba(0, 255, 0, 0.5),
      inset 0 0 20px rgba(0, 255, 0, 0.1);
  }
}

@keyframes fadeInLine {
  0% {
    opacity: 0;
    transform: translateX(-10px);
  }
  100% {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes errorBlink {
  0%,
  50% {
    opacity: 1;
  }
  51%,
  100% {
    opacity: 0.6;
  }
}

/* Game paused overlay effect */
.game-paused #view {
  filter: brightness(0.3) contrast(0.8);
}

.game-paused .hud {
  opacity: 0.3;
}
