/* =========================================
   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;
  }
}

/* ==============================================================
   MOBILE TOUCH CONTROLS & LANDSCAPE ORIENTATION - v16.02
   ============================================================== */

/* Prevent default behaviors on mobile */
html, body {
  touch-action: none;
  overflow: hidden;
  position: fixed;
  width: 100%;
  height: 100%;
}

/* Orientation Warning Screen */
#orientation-warning {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: #000;
  z-index: 999999;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  color: #0f0;
  font-family: "Share Tech Mono", monospace;
  text-align: center;
}

#orientation-warning .rotate-icon {
  width: 80px;
  height: 80px;
  border: 4px solid #0f0;
  border-radius: 12px;
  margin-bottom: 20px;
  position: relative;
  animation: rotate-phone 2.5s ease-in-out infinite;
  box-shadow: 0 0 20px rgba(0, 255, 0, 0.4);
}

#orientation-warning .rotate-icon::after {
  content: '';
  position: absolute;
  bottom: 6px;
  left: 50%;
  transform: translateX(-50%);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #0f0;
}

#orientation-warning h2 {
  font-size: 1.8rem;
  margin-bottom: 10px;
  text-shadow: 0 0 10px #0f0;
  background: transparent;
  padding: 0;
}

#orientation-warning p {
  color: #888;
  font-size: 1rem;
  max-width: 320px;
}

@keyframes rotate-phone {
  0% { transform: rotate(0deg); }
  30%, 70% { transform: rotate(90deg); }
  100% { transform: rotate(90deg); }
}

/* Show warning on mobile portrait viewports */
@media (max-width: 900px) and (orientation: portrait) {
  #orientation-warning {
    display: flex !important;
  }
}

/* Touch Controls Wrapper */
#touch-controls-container {
  display: none; /* Auto-shown in mobile_controls.js if touch device detected */
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 25000;
}

/* Virtual Joysticks */
.virtual-joystick-base {
  position: absolute;
  width: 100px;
  height: 100px;
  background: rgba(0, 20, 0, 0.35);
  border: 2px solid rgba(0, 255, 0, 0.4);
  border-radius: 50%;
  pointer-events: auto;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 15px rgba(0, 255, 0, 0.2);
  display: none; /* Dynamic display on touch */
}

.virtual-joystick-handle {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 44px;
  height: 44px;
  background: rgba(0, 255, 0, 0.85);
  border: 2px solid #fff;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
  transition: transform 0.05s ease-out;
}

/* Left & Right active zones for spawning joysticks */
#joystick-zone-left, #joystick-zone-right {
  position: absolute;
  bottom: 0;
  width: 50%;
  height: 80%;
  pointer-events: auto;
}

#joystick-zone-left { left: 0; }
#joystick-zone-right { right: 0; }

/* Mobile Action Panel (Bottom Right Corner) */
#mobile-action-panel {
  position: absolute;
  right: 15px;
  bottom: 15px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-end;
  pointer-events: auto;
}

/* Weapon Selection HUD for Mobile */
#mobile-weapon-selector {
  display: flex;
  gap: 8px;
  background: rgba(0, 0, 0, 0.7);
  padding: 6px;
  border-radius: 20px;
  border: 1px solid rgba(0, 255, 0, 0.3);
  box-shadow: 0 0 15px rgba(0, 255, 0, 0.25);
  margin-bottom: 5px;
}

.mobile-weapon-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1.5px solid rgba(0, 255, 0, 0.4);
  background: rgba(0, 15, 0, 0.9);
  color: #0f0;
  font-family: inherit;
  font-size: 11px;
  font-weight: bold;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  padding: 0;
  margin: 0;
  transition: all 0.15s ease;
  box-shadow: inset 0 0 5px rgba(0, 255, 0, 0.3);
}

.mobile-weapon-btn.active {
  background: #0f0;
  color: #000;
  border-color: #fff;
  box-shadow: 0 0 12px #0f0;
  transform: scale(1.1);
}

/* Large Round Interact & Dash Buttons */
.mobile-action-row {
  display: flex;
  gap: 15px;
}

.mobile-action-btn {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: rgba(255, 136, 62, 0.2);
  border: 2px solid #ff883e;
  color: #ff883e;
  font-family: inherit;
  font-weight: bold;
  font-size: 16px;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: 0 0 10px rgba(255, 136, 62, 0.3);
  margin: 0;
  padding: 0;
  transition: all 0.1s ease;
}

.mobile-action-btn:active {
  background: #ff883e;
  color: #000;
  box-shadow: 0 0 18px #ff883e;
  transform: scale(0.95);
}

/* System Overrides for Compact Layout */
@media (max-width: 900px) {
  #control-panel {
    width: 90%;
    max-height: 90vh;
    padding: 10px;
  }
  .hud-left, .hud-right {
    transform: scale(0.8);
  }
  .hud-left {
    top: 5px;
    left: 5px;
    transform-origin: top left;
  }
  .hud-right {
    top: 5px;
    right: 5px;
    transform-origin: top right;
  }
}

/* --- COOKIE & PWA OVERLAYS --- */

/* Cookie Consent Overlay */
#cookie-consent-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.9);
  z-index: 9999999;
  display: none;
  justify-content: center;
  align-items: center;
  pointer-events: auto;
}

#cookie-consent-overlay.active {
  display: flex;
}

/* PWA Install Banner Overlay (Bottom Center) */
#pwa-install-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0, 15, 0, 0.95);
  border-top: 2px solid #00ff00;
  box-shadow: 0 -5px 25px rgba(0, 255, 0, 0.2);
  z-index: 24000;
  display: none; /* Auto-shown in mobile_controls.js if browser reports installable */
  padding: 12px 20px;
  pointer-events: auto;
  animation: slide-up-banner 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.pwa-install-content {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 15px;
}

.pwa-install-text {
  font-family: "Share Tech Mono", monospace;
  color: #00ff00;
  font-size: 14px;
  font-weight: bold;
  letter-spacing: 1.5px;
  text-shadow: 0 0 5px rgba(0, 255, 0, 0.5);
}

#btn-pwa-install {
  background: #00ff00;
  color: #000;
  border: none;
  border-radius: 4px;
  padding: 6px 16px;
  font-family: inherit;
  font-size: 12px;
  font-weight: bold;
  cursor: pointer;
  margin: 0;
  box-shadow: 0 0 10px rgba(0, 255, 0, 0.4);
  transition: all 0.15s ease;
}

#btn-pwa-install:hover {
  background: #fff;
  box-shadow: 0 0 15px #fff;
}

#btn-pwa-close {
  background: transparent;
  color: #555;
  border: 1px solid #444;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-family: inherit;
  font-size: 11px;
  cursor: pointer;
  margin: 0;
  padding: 0;
  transition: all 0.1s ease;
}

#btn-pwa-close:hover {
  color: #ff0000;
  border-color: #ff0000;
}

@keyframes slide-up-banner {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

@media (max-width: 600px) {
  .pwa-install-content {
    flex-direction: column;
    text-align: center;
    gap: 8px;
  }
  .pwa-install-text {
    font-size: 12px;
  }
  #btn-pwa-install {
    width: 100%;
  }
  #btn-pwa-close {
    position: absolute;
    top: 8px;
    right: 8px;
  }
}


