/* =========================================================================
   Neon Survivor: Cyber Void — Deluxe UI/UX Design System & Tokens v3.0
   High-End Cyberpunk Glassmorphic Interface with Tactile Micro-Interactions
   ========================================================================= */

:root {
  /* Base surfaces */
  --bg-void: #060913;
  --bg-panel: #0E1424;
  --bg-elevated: #161F36;
  --bg-glass: rgba(14, 20, 36, 0.88);
  --bg-glass-blur: blur(16px);

  /* Neon accents */
  --accent-cyan: #00F0FF;
  --accent-cyan-glow: rgba(0, 240, 255, 0.4);
  --accent-magenta: #FF2FD0;
  --accent-magenta-glow: rgba(255, 47, 208, 0.4);
  --accent-purple: #9D4EFF;
  --state-success: #39FF88;
  --state-warning: #FFB020;
  --state-danger: #FF3860;
  --state-legendary: linear-gradient(135deg, #FFD34D 0%, #FF7A00 100%);

  /* Typography Colors */
  --text-primary: #F5F7FF;
  --text-secondary: #9AA3C7;
  --text-disabled: #565D7A;

  /* Fonts */
  --font-display: 'Orbitron', -apple-system, sans-serif;
  --font-body: 'Rajdhani', -apple-system, sans-serif;
  --font-mono: 'Share Tech Mono', monospace;

  /* Rarity Colors */
  --rarity-common: #8C93A8;
  --rarity-uncommon: #39FF88;
  --rarity-rare: #00F0FF;
  --rarity-epic: #9D4EFF;
  --rarity-legendary: #FFB020;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-void);
  color: var(--text-primary);
  font-family: var(--font-body);
  touch-action: none;
}

#game-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 1;
}

#game-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* Glass Panels & Cyber Elevation */
.glass-card {
  background: var(--bg-glass);
  backdrop-filter: var(--bg-glass-blur);
  -webkit-backdrop-filter: var(--bg-glass-blur);
  border: 1px solid rgba(0, 240, 255, 0.28);
  box-shadow: 0 12px 40px 0 rgba(0, 0, 0, 0.75), 0 0 20px rgba(0, 240, 255, 0.15);
  border-radius: 18px;
  position: relative;
  overflow: hidden;
}

.glass-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent-cyan), transparent);
}

/* =========================================================================
   In-Game HUD — Mobile Ergonomic Layout
   ========================================================================= */

#hud-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 20;
  pointer-events: none;
  padding-top: max(12px, env(safe-area-inset-top, 12px));
  padding-bottom: max(14px, env(safe-area-inset-bottom, 14px));
  padding-left: max(14px, env(safe-area-inset-left, 14px));
  padding-right: max(14px, env(safe-area-inset-right, 14px));
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

/* Top Group: XP Bar & Stats Strip */
.hud-top-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  pointer-events: auto;
}

/* XP Bar Pill */
.xp-bar-container {
  width: 100%;
  height: 14px;
  background: rgba(6, 10, 20, 0.9);
  border: 1px solid rgba(0, 240, 255, 0.45);
  border-radius: 999px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 0 14px rgba(0, 240, 255, 0.25);
}

.xp-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-cyan), var(--state-success));
  box-shadow: 0 0 12px var(--accent-cyan);
  transition: width 0.15s ease-out;
}

.xp-level-badge {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-display);
  font-size: 9px;
  color: #fff;
  font-weight: 800;
  letter-spacing: 0.8px;
  text-shadow: 0 0 6px #000;
}

/* Top Stats Strip */
.hud-top-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.hud-stat-box {
  background: var(--bg-glass);
  backdrop-filter: var(--bg-glass-blur);
  -webkit-backdrop-filter: var(--bg-glass-blur);
  border: 1px solid rgba(255, 255, 255, 0.16);
  padding: 6px 14px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-primary);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
}

.gold-box {
  border-color: rgba(255, 176, 32, 0.6);
  color: var(--state-warning);
}

.hud-icon-btn {
  background: var(--bg-glass);
  backdrop-filter: var(--bg-glass-blur);
  -webkit-backdrop-filter: var(--bg-glass-blur);
  border: 1px solid rgba(0, 240, 255, 0.45);
  color: #fff;
  min-width: 48px;
  min-height: 48px;
  border-radius: 14px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 18px;
  cursor: pointer;
  box-shadow: 0 0 14px rgba(0, 240, 255, 0.25);
  transition: transform 0.1s ease, background 0.15s ease;
}

.hud-icon-btn:active {
  transform: scale(0.92);
  background: rgba(0, 240, 255, 0.25);
}

/* Tutorial / Alert Notification Pill */
.tutorial-banner {
  background: rgba(14, 20, 36, 0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--accent-cyan);
  border-radius: 12px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6), 0 0 16px rgba(0, 240, 255, 0.3);
  animation: pulse-glow 2.2s infinite ease-in-out;
}

@keyframes pulse-glow {
  0%, 100% { border-color: var(--accent-cyan); box-shadow: 0 0 12px rgba(0, 240, 255, 0.25); }
  50% { border-color: var(--accent-magenta); box-shadow: 0 0 22px rgba(255, 47, 208, 0.45); }
}

/* =========================================================================
   Bottom Dock — Inventory Slots & Health Bar
   ========================================================================= */

.hud-bottom-dock {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 100%;
  max-width: 100vw;
  padding: 0 6px 8px 6px;
  box-sizing: border-box;
  pointer-events: auto;
}

.hud-slots-tray {
  background: var(--bg-glass);
  backdrop-filter: var(--bg-glass-blur);
  -webkit-backdrop-filter: var(--bg-glass-blur);
  border: 1px solid rgba(255, 255, 255, 0.14);
  padding: 4px 8px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  max-width: 100%;
  box-sizing: border-box;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.55);
}

.slots-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.slots-label {
  font-family: var(--font-display);
  font-size: 7px;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  font-weight: 700;
}

.slots-row {
  display: flex;
  gap: 2px;
}

.slot-box {
  width: 22px;
  height: 22px;
  background: rgba(6, 10, 20, 0.7);
  border: 1px dashed rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 11px;
  position: relative;
  box-sizing: border-box;
}

@media (min-width: 480px) {
  .slot-box {
    width: 28px;
    height: 28px;
    font-size: 14px;
    border-radius: 6px;
  }
  .hud-slots-tray {
    padding: 6px 12px;
    gap: 10px;
  }
}

.slot-box.active {
  border-style: solid;
  border-color: var(--accent-cyan);
  background: rgba(0, 240, 255, 0.15);
  box-shadow: 0 0 6px rgba(0, 240, 255, 0.3);
}

.slot-box.evolved {
  border-style: solid;
  border-color: var(--accent-magenta);
  background: rgba(255, 47, 208, 0.2);
  box-shadow: 0 0 8px rgba(255, 47, 208, 0.4);
}

.slot-level-pip {
  position: absolute;
  bottom: 0px;
  right: 1px;
  font-family: var(--font-mono);
  font-size: 7px;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 0 3px #000;
}

/* Micro Player Health Bar */
.player-hp-dock {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-glass);
  backdrop-filter: var(--bg-glass-blur);
  -webkit-backdrop-filter: var(--bg-glass-blur);
  border: 1px solid rgba(255, 56, 96, 0.4);
  padding: 4px 12px;
  border-radius: 999px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
}

.hp-bar-track {
  width: 160px;
  height: 10px;
  background: rgba(6, 10, 20, 0.9);
  border: 1px solid rgba(255, 56, 96, 0.5);
  border-radius: 999px;
  overflow: hidden;
  box-shadow: 0 0 12px rgba(255, 56, 96, 0.25);
}

.hp-bar-fill {
  height: 100%;
  background: var(--state-danger);
  box-shadow: 0 0 10px var(--state-danger);
  transition: width 0.12s ease-out;
}

.hp-text {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--text-primary);
  text-shadow: 0 0 6px rgba(0, 0, 0, 0.8);
}

/* =========================================================================
   Screen Overlay & Main Menu (High-Tech Deluxe Redesign)
   ========================================================================= */

.screen-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 50;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 16px;
  box-sizing: border-box;
  background: radial-gradient(circle at center, rgba(14, 20, 36, 0.5) 0%, rgba(6, 9, 19, 0.95) 100%);
}

.menu-content {
  width: 100%;
  max-width: 440px;
  border-radius: 22px;
  padding: 28px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  border: 1px solid rgba(0, 240, 255, 0.35);
  box-shadow: 0 0 50px rgba(0, 240, 255, 0.15), 0 20px 50px rgba(0, 0, 0, 0.85);
}

.menu-logo-box {
  text-align: center;
  position: relative;
}

.brand-sub {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent-cyan);
  letter-spacing: 3px;
  text-transform: uppercase;
}

.game-title {
  font-family: var(--font-display);
  font-size: 2.3rem;
  font-weight: 900;
  color: #fff;
  letter-spacing: 2px;
  text-shadow: 0 0 24px rgba(0, 240, 255, 0.7);
  line-height: 1.1;
  margin: 4px 0 6px 0;
}

.brand-tag {
  font-family: var(--font-display);
  font-size: 10px;
  color: var(--accent-magenta);
  letter-spacing: 4px;
  font-weight: 800;
  text-shadow: 0 0 10px rgba(255, 47, 208, 0.5);
}

.menu-meta-display {
  display: flex;
  gap: 12px;
  width: 100%;
  justify-content: center;
}

.meta-pill {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.14);
  padding: 8px 14px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-family: var(--font-mono);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.menu-actions {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 9px;
}

/* =========================================================================
   Buttons & Tactile Feedback
   ========================================================================= */

.btn-play {
  width: 100%;
  min-height: 50px;
  background: linear-gradient(135deg, var(--accent-cyan) 0%, #0077ff 100%);
  border: none;
  padding: 14px 20px;
  border-radius: 14px;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 1.2px;
  color: #060913;
  cursor: pointer;
  box-shadow: 0 0 24px rgba(0, 240, 255, 0.45);
  transition: transform 0.1s ease, box-shadow 0.15s ease;
}

.btn-play:active {
  transform: scale(0.96);
  box-shadow: 0 0 35px rgba(0, 240, 255, 0.8);
}

.btn-secondary {
  width: 100%;
  min-height: 48px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.16);
  padding: 12px 18px;
  border-radius: 14px;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
  cursor: pointer;
  transition: transform 0.1s ease, background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.btn-secondary:active,
.btn-secondary:hover {
  background: rgba(0, 240, 255, 0.12);
  border-color: var(--accent-cyan);
  box-shadow: 0 0 16px rgba(0, 240, 255, 0.25);
  transform: scale(0.97);
}

.btn-danger {
  width: 100%;
  min-height: 48px;
  background: rgba(255, 56, 96, 0.15);
  border: 1px solid var(--state-danger);
  padding: 12px 18px;
  border-radius: 14px;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  color: var(--state-danger);
  cursor: pointer;
  transition: transform 0.1s ease;
}

.btn-danger:active {
  transform: scale(0.96);
}

.pulse-btn {
  animation: pulse-btn-glow 2.4s infinite ease-in-out;
}

@keyframes pulse-btn-glow {
  0%, 100% { box-shadow: 0 0 16px rgba(0, 240, 255, 0.35); }
  50% { box-shadow: 0 0 32px rgba(0, 240, 255, 0.8); }
}

.shake {
  animation: shake-btn 0.4s ease-in-out;
}

@keyframes shake-btn {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

/* Setting Controls */
.setting-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 48px;
  font-size: 14px;
}

.setting-select {
  background: #060913;
  border: 1px solid rgba(0, 240, 255, 0.35);
  color: #fff;
  padding: 8px 12px;
  border-radius: 8px;
  font-family: var(--font-body);
  font-size: 14px;
}

.setting-toggle-btn {
  background: #060913;
  border: 1px solid rgba(0, 240, 255, 0.35);
  color: #fff;
  padding: 8px 14px;
  border-radius: 8px;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  min-width: 90px;
}

.setting-toggle-btn.muted {
  border-color: var(--state-danger);
  color: var(--state-danger);
  background: rgba(255, 56, 96, 0.1);
}

/* Cyber-Dash HUD Button */
.hud-dash-container {
  position: absolute;
  bottom: 85px;
  right: 20px;
  z-index: 40;
}

.btn-cyber-dash {
  position: relative;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(14, 20, 36, 0.85);
  border: 2px solid var(--accent-cyan);
  box-shadow: 0 0 16px rgba(0, 240, 255, 0.4);
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  overflow: hidden;
  user-select: none;
  touch-action: manipulation;
  transition: transform 0.1s ease, box-shadow 0.15s ease;
}

.btn-cyber-dash:active {
  transform: scale(0.92);
  box-shadow: 0 0 24px var(--accent-cyan);
}

.dash-icon {
  font-size: 20px;
  line-height: 1;
}

.dash-label {
  font-family: var(--font-display);
  font-size: 9px;
  font-weight: 800;
  color: var(--accent-cyan);
  letter-spacing: 0.5px;
}

.dash-cd-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  transform-origin: bottom;
  transform: scaleY(0);
  pointer-events: none;
  transition: transform 0.05s linear;
}

/* Post-Run DPS Breakdown Styles */
.dps-breakdown-section {
  width: 100%;
  margin: 10px 0;
  background: rgba(6, 10, 20, 0.6);
  border: 1px solid rgba(0, 240, 255, 0.2);
  border-radius: 12px;
  padding: 10px 14px;
}

.dps-bar-item {
  margin-bottom: 8px;
}

.dps-bar-header {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  font-family: var(--font-display);
  color: var(--text-primary);
  margin-bottom: 3px;
}

.dps-bar-track {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  overflow: hidden;
}

.dps-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #00f0ff, #ff007f);
  border-radius: 3px;
}

.hidden {
  display: none !important;
}
