/* =========================================
   ANTO BOYLE'S GAME 47 - STYLESHEET
   v9.72
   ========================================= */

:root {
  --bg: #050505;
  --panel: #111;
  --text: #0f0;
  --accent: #ff883e;
  --border: #333;
}

body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Share Tech Mono", monospace;
  height: 100vh;
  display: flex;
  overflow: hidden;
  -webkit-user-select: none;
  user-select: none; /* Prevent text selection dragging */
  -webkit-appearance: none;
  appearance: none;
}

/* --- LAYOUT --- */
#control-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 500px;
  max-height: 80vh;
  background: rgba(10, 10, 10, 0.95);
  border: 2px solid var(--accent);
  display: none; /* Hidden by default */
  flex-direction: column;
  padding: 20px;
  overflow-y: auto;
  box-shadow: 0 0 50px rgba(0, 0, 0, 0.8);
  z-index: 10000;
  border-radius: 8px;
}

#game-view {
  width: 100vw;
  height: 100vh;
  position: relative;
  background: #000;
  cursor: crosshair;
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* --- UI ELEMENTS --- */
h1 {
  margin: 0 0 10px 0;
  font-size: 1.4rem;
  color: var(--accent);
  border-bottom: 2px solid var(--border);
  padding-bottom: 5px;
}
h2 {
  margin: 15px 0 5px 0;
  font-size: 1rem;
  color: #fff;
  background: #222;
  padding: 2px 5px;
}

.control-group {
  margin-bottom: 10px;
  border-bottom: 1px dashed #222;
  padding-bottom: 5px;
}
.label-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  margin-bottom: 2px;
  color: #888;
}

input[type="range"] {
  width: 100%;
  height: 4px;
  background: #333;
  outline: none;
  -webkit-appearance: none;
  appearance: none; /* Added standard property */
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  background: var(--text);
  cursor: pointer;
  border-radius: 0;
}

.val-display {
  color: var(--text);
}

/* METRICS */
.metric {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
  margin-bottom: 2px;
}
.metric span:last-child {
  color: #fff;
}

/* --- NEW HUD STYLES --- */
#hud-layer {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  display: none; /* Hidden by default */
  flex-direction: row; /* Horizontal layout: Left Panel ... Right Panel */
  justify-content: space-between; /* Push panels to edges */
  align-items: flex-start; /* Align both to TOP */
  padding: 0; /* Stuck to edges */
  z-index: 20000;
}

.hud-panel {
  background: rgba(0, 0, 0, 0.85);
  padding: 8px;
  border-radius: 4px;
  border: 2px solid rgba(0, 255, 0, 0.4);
  color: #fff;
  font-family: "Share Tech Mono", monospace;
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-shadow: 0 0 20px rgba(0, 255, 0, 0.2);
}

/* v15.57: Square HUD - Top Left (220x220px) */
.hud-left {
  width: 220px;
  height: 220px;
  align-items: flex-start;
  position: fixed;
  top: 10px;
  left: 10px;
  overflow: hidden;
  padding: 10px;
}

/* v15.57: Square Minimap - Top Right (220x220px) */
/* v15.60: Removed border to prevent double outline */
.hud-right {
  width: 220px;
  height: 220px;
  align-items: center;
  justify-content: center;
  position: fixed;
  top: 10px;
  right: 10px;
  padding: 10px;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

/* v15.58: Ultra-compact text sizes for square HUD */
.hud-text-lg {
  font-size: 14px;
  font-weight: bold;
  line-height: 1.1;
  margin: 0;
}
.hud-text-md {
  font-size: 11px;
  color: #ddd;
  line-height: 1.1;
  margin: 0;
}
.hud-text-sm {
  font-size: 9px;
  color: #aaa;
  line-height: 1.1;
  margin: 0;
}

/* v15.58: Ultra-compact bars for square HUD */
.hud-bar-container {
  width: 100%;
  height: 8px;
  background: #440000;
  border: 1px solid #660000;
  margin-bottom: 2px;
}
.hud-bar-fill {
  height: 100%;
  background: #ff0000;
  width: 100%;
  transition: width 0.1s;
}

.hud-row {
  display: flex;
  justify-content: space-between;
  width: 100%;
}

/* v15.57: Square minimap canvas (200x200 inside 220x220 container) */
#minimap-canvas {
  width: 200px !important;
  height: 200px !important;
  border: 2px solid #0f0;
  background: rgba(0, 20, 0, 0.9);
  box-shadow: 0 0 15px rgba(0, 255, 0, 0.3);
}

/* v15.58: Compact ammo box styling */
.box-mines {
  background: rgba(40, 40, 0, 0.3);
  padding: 3px;
  border-radius: 2px;
  border: 1px solid rgba(255, 215, 0, 0.3);
  margin: 1px 0;
}

.bar-mines-container {
  background: #332200 !important;
  border-color: #554400 !important;
  height: 6px !important;
  margin-bottom: 1px !important;
}

.bar-mines-fill {
  background: linear-gradient(90deg, #ffaa00, #ffdd00) !important;
}

.text-gold {
  color: #ffd700;
  font-size: 10px !important;
}

/* Hide old Overlay Metrics if we have new HUD? */
.metric {
  display: none !important;
}
/* LOG */
#sys-log {
  height: 120px;
  background: #000;
  border: 1px solid #222;
  color: #666;
  font-size: 0.7rem;
  overflow-y: auto;
  padding: 5px;
  margin-top: auto;
}
.log-entry {
  margin-bottom: 2px;
  border-bottom: 1px solid #111;
}
.log-entry.warn {
  color: #f80;
}

/* OVERLAY */
#overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  background: rgba(0, 0, 0, 0.6);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s;
}
#overlay.active {
  opacity: 1;
  pointer-events: auto;
}
.msg-box {
  text-align: center;
  background: rgba(0, 0, 0, 0.9);
  border: 2px solid var(--accent);
  padding: 40px;
  transform: scale(0.9);
  transition: transform 0.3s;
}
#overlay.active .msg-box {
  transform: scale(1);
}

button {
  background: var(--accent);
  color: #000;
  border: none;
  padding: 10px 30px;
  font-family: inherit;
  font-size: 1.2rem;
  font-weight: bold;
  cursor: pointer;
  margin-top: 20px;
}
button:hover {
  background: #fff;
}

/* CRT SCANLINE EFFECT */
/* CRT SCANLINE EFFECT REMOVED (User Request v10.55) */
#game-view::after {
  display: none;
}

#drag-handle {
  width: 5px;
  background: #222;
  cursor: col-resize;
  flex-shrink: 0;
  transition: background 0.2s;
  z-index: 20;
}
#drag-handle:hover,
#drag-handle.active {
  background: var(--accent);
}

/* REDESIGNED DEBUG CONSOLE (v12.41) */
#debug-console {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 320px;
  background: rgba(5, 10, 5, 0.95);
  border-left: 2px solid #0f0;
  color: #0f0;
  font-family: "Share Tech Mono", monospace;
  z-index: 99999;
  padding: 0;
  display: flex;
  flex-direction: column;
  box-shadow: -10px 0 30px rgba(0, 0, 0, 0.8);
  transform: translateX(0);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

#debug-console.hidden {
  transform: translateX(330px);
}

.debug-header {
  background: #0f0;
  color: #000;
  padding: 8px 12px;
  font-weight: bold;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
}

.debug-actions button {
  background: #000;
  color: #0f0;
  border: 1px solid #000;
  margin: 0;
  padding: 2px 8px;
  font-size: 10px;
  cursor: pointer;
}

.debug-content {
  flex: 1;
  overflow-y: auto;
  padding: 15px;
}

.debug-section {
  margin-bottom: 20px;
  border-bottom: 1px solid rgba(0, 255, 0, 0.2);
  padding-bottom: 10px;
}

.debug-section h3 {
  font-size: 12px;
  color: #fff;
  margin: 0 0 10px 0;
  background: rgba(0, 255, 0, 0.1);
  padding: 4px;
}

.debug-row {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  margin-bottom: 6px;
}

.debug-row input[type="checkbox"] {
  accent-color: #0f0;
  cursor: pointer;
}

#debug-logs {
  max-height: 200px;
  overflow-y: auto;
  font-size: 9px;
  background: #000;
  padding: 5px;
  border: 1px solid #111;
}

.log-line {
  border-bottom: 1px solid #111;
  padding: 2px 0;
}

.log-err {
  color: #f00;
}
.log-warn {
  color: #ff0;
}

/* Helper Classes */
.btn-small {
  width: auto;
  padding: 2px 10px;
  font-size: 0.8rem;
}
.magenta-text {
  color: #f0f;
}
.checkbox-auto {
  width: auto;
  height: auto;
}
.stat-row {
  font-size: 0.8rem;
  color: #fff;
  margin-bottom: 2px;
}
.sub-label {
  font-size: 0.6rem;
  color: #666;
  width: 100%;
  text-align: right;
}

/* --- REFACTORED INLINE STYLES --- */
.easter-egg {
  display: none;
}

#start-screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #000;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #0f0;
  font-family: "Share Tech Mono", monospace;
}

#start-screen h3 {
  margin-top: 0;
  color: #555;
}
#start-screen p {
  color: #666;
  font-size: 12px;
  max-width: 400px;
  text-align: center;
}
#start-screen button {
  margin-top: 20px;
  padding: 15px 30px;
  font-size: 20px;
  background: #004400;
  color: #0f0;
  border: 2px solid #0f0;
  cursor: pointer;
  font-family: inherit;
}

/* HUD Text Colors */
.text-health {
  color: #ff4444;
}
.text-regen {
  width: 100%;
  text-align: right;
  color: #0f0;
}
.text-weapon {
  margin-top: 10px;
}
.text-gold {
  color: #ffff00;
}
.text-enemies {
  margin-top: 10px;
  color: #aaa;
}
.text-score {
  color: #aaa;
}
.text-time {
  margin-top: 10px;
}
.text-dmg-dealt {
  color: #ffaaaa;
}
.text-dmg-taken {
  color: #aaffaa;
}

.box-mines {
  width: 100%;
  display: none;
}
.bar-mines-container {
  height: 8px;
  background: #222;
  border-color: #444;
}
.bar-mines-fill {
  background: #0ff;
  width: 0%;
}

.canvas-minimap {
  border: 2px solid #0f0;
  background: #001100;
  box-shadow: 0 0 10px #0f0;
  border-radius: 4px;
}

/* --- GAME OVER SCREEN --- */
#game-over-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(40, 0, 0, 0.95); /* Deep Red Overlay */
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 20000;
  color: #fff;
}

#game-over-screen h1 {
  color: #ff0000;
  font-size: 4rem;
  text-shadow: 0 0 20px #ff0000;
  margin-bottom: 20px;
}

.stat-box {
  border: 2px solid #ff4444;
  padding: 30px;
  background: rgba(0, 0, 0, 0.8);
  min-width: 400px;
  box-shadow: 0 0 30px rgba(255, 0, 0, 0.2);
  margin-bottom: 30px;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  margin: 10px 0;
  font-size: 1.5rem;
  border-bottom: 1px solid #444;
  padding-bottom: 5px;
}

.stat-val {
  color: #ff883e;
  font-weight: bold;
}

#btn-restart {
  padding: 15px 50px;
  font-size: 2rem;
  background: #ff0000;
  color: #000;
  border: 2px solid #fff;
  cursor: pointer;
  font-family: inherit;
  font-weight: bold;
  text-transform: uppercase;
  transition: all 0.2s;
}

#btn-restart:hover {
  background: #fff;
  color: #ff0000;
  box-shadow: 0 0 30px #fff;
}

/* --- v15.20: TACTICAL LOADER --- */
#loader-container {
  margin: 20px auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
  z-index: 100;
}
#loader-clock {
  position: relative;
  width: 140px;
  height: 140px;
  display: flex;
  justify-content: center;
  align-items: center;
}
#loader-clock svg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}
#loader-bg {
  fill: none;
  stroke: rgba(0, 255, 0, 0.05);
  stroke-width: 4;
}
#loader-progress {
  fill: none;
  stroke: #00ff00;
  stroke-width: 6;
  stroke-dasharray: 283;
  stroke-dashoffset: 283;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  filter: drop-shadow(0 0 12px #00ff00);
}
#loader-text {
  font-family: "Share Tech Mono", monospace;
  font-size: 28px;
  color: #00ff00;
  text-shadow: 0 0 15px #00ff00;
  font-weight: bold;
  z-index: 10;
}
#loader-status {
  font-family: "Share Tech Mono", monospace;
  font-size: 14px;
  color: #00ff00;
  letter-spacing: 3px;
  text-transform: uppercase;
  text-align: center;
  animation: pulse-op 2s infinite;
  max-width: 400px;
}
@keyframes pulse-op {
  0%,
  100% {
    opacity: 1;
    text-shadow: 0 0 5px #0f0;
  }
  50% {
    opacity: 0.5;
    text-shadow: none;
  }
}

/* --- REFACTORING CLASSES --- */
.text-accent-force {
  color: var(--accent) !important;
}
.text-cyan-force {
  color: #00ffff !important;
}
.text-green-force {
  color: #00ff00 !important;
}
.hidden-init {
  display: none !important;
}

.flex-gap-small {
  display: flex !important;
  gap: 5px !important;
  margin-top: 5px !important;
}

.btn-debug-action {
  flex: 1 !important;
  margin: 0 !important;
  font-size: 0.8rem !important;
  padding: 5px !important;
}

.btn-debug-secondary {
  background: #444 !important;
}

.btn-toggle-magenta {
  padding: 2px 10px !important;
  font-size: 10px !important;
  background: var(--magenta) !important;
  color: #000 !important;
  font-weight: bold !important;
  border-radius: 4px !important;
}

.btn-pause-wide {
  width: 100% !important;
  background: #0f0 !important;
  margin-top: 10px !important;
}

#start-screen h1 {
  color: #0f0 !important;
  font-size: 3rem !important;
  margin-bottom: 5px !important;
  text-shadow: 0 0 20px #0f0 !important;
}

.btn-start-disabled {
  opacity: 0.3 !important;
  cursor: not-allowed !important;
}
