/* Da Gnome Pal on Mars — 2026 Modern Aesthetic Styling */
:root {
  --mars-bg-dark: #120505;
  --mars-bg-mid: #2b0b0b;
  --mars-accent-red: #ff3e3e;
  --mars-accent-orange: #ff8533;
  --mars-accent-gold: #ffc83b;
  --mars-accent-cyan: #00e5ff;
  --glass-bg: rgba(22, 10, 10, 0.72);
  --glass-border: rgba(255, 140, 90, 0.28);
  --glass-glow: rgba(255, 90, 40, 0.2);
  --text-main: #f5f0eb;
  --text-muted: #c4ada2;
}

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

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  color: var(--text-main);
  background: radial-gradient(circle at 50% 20%, #2e0d0d 0%, #170505 50%, #0a0202 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}

#game-wrap {
  width: 100vw;
  height: 100vh;
  max-width: 1280px;
  max-height: 720px;
  position: relative;
  margin: auto;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 16px 60px rgba(0, 0, 0, 0.8), 0 0 40px rgba(255, 70, 20, 0.15);
  background: #000;
}

#game-canvas {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: transparent;
}

/* ==========================================================================
   2026 Glassmorphic HUD
   ========================================================================== */
#hud {
  position: absolute;
  top: 14px;
  left: 16px;
  right: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  pointer-events: none;
  z-index: 100;
  gap: 12px;
}

.hud-panel {
  display: flex;
  align-items: center;
  background: var(--glass-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--glass-border);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  padding: 6px 14px;
  border-radius: 24px;
  pointer-events: auto;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.hud-label {
  font-family: 'Orbitron', monospace;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.5px;
  color: var(--mars-accent-gold);
  margin-right: 10px;
}

/* Life Helmets Indicator */
#lives-wrap {
  display: flex;
  align-items: center;
}

#lives {
  display: flex;
  gap: 8px;
  align-items: center;
}

.life-pod {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ff8a66, #b82b1d);
  border: 1.5px solid #ffccaa;
  box-shadow: 0 0 10px rgba(255, 100, 50, 0.6), inset 0 2px 4px rgba(255, 255, 255, 0.4);
  position: relative;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease, filter 0.3s ease;
}

.life-pod::after {
  content: '🧙';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 13px;
  line-height: 1;
}

.life-pod.lost {
  opacity: 0.25;
  filter: grayscale(100%);
  transform: scale(0.8);
  box-shadow: none;
}

/* Mars Progress Bar */
.hud-center {
  flex: 1;
  max-width: 440px;
}

#progress-wrap {
  display: flex;
  align-items: center;
  width: 100%;
  gap: 10px;
}

.progress-title {
  font-family: 'Orbitron', monospace;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 1.2px;
  color: var(--mars-accent-orange);
  white-space: nowrap;
}

#progress-bar-bg {
  flex: 1;
  height: 8px;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 8px;
  position: relative;
  border: 1px solid rgba(255, 150, 100, 0.2);
}

#progress-bar-fill {
  height: 100%;
  width: 0%;
  border-radius: 8px;
  background: linear-gradient(90deg, #ff5533, #ffaa00, #00e5ff);
  box-shadow: 0 0 12px rgba(255, 130, 40, 0.8);
  transition: width 0.1s linear;
}

#progress-gnome-pin {
  position: absolute;
  top: 50%;
  left: 0%;
  transform: translate(-50%, -50%);
  font-size: 14px;
  transition: left 0.1s linear;
  filter: drop-shadow(0 0 4px #ff6633);
}

#progress-target-pin {
  position: absolute;
  top: 50%;
  right: -6px;
  transform: translateY(-50%);
  font-size: 14px;
  filter: drop-shadow(0 0 6px #00e5ff);
  animation: targetPulse 1.8s infinite ease-in-out;
}

@keyframes targetPulse {
  0%, 100% { transform: translateY(-50%) scale(1); }
  50% { transform: translateY(-50%) scale(1.25); filter: drop-shadow(0 0 10px #00e5ff); }
}

#progress-dist {
  font-family: 'Orbitron', monospace;
  font-size: 10px;
  font-weight: 700;
  color: var(--mars-accent-cyan);
  min-width: 34px;
  text-align: right;
}

/* Stats / Controls */
#stats-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.stat-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: 'Orbitron', monospace;
  font-weight: 800;
  font-size: 13px;
  color: #ff9f80;
}

.stat-icon {
  font-size: 14px;
}

.hud-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.hud-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.1);
}

/* ==========================================================================
   Splash / Briefing Screen
   ========================================================================== */
#splash {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at center, rgba(30, 8, 8, 0.85) 0%, rgba(10, 2, 2, 0.96) 100%);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  z-index: 2000;
  transition: opacity 0.4s ease, visibility 0.4s ease;
  padding: 20px;
}

#splash-card {
  background: linear-gradient(135deg, rgba(42, 16, 16, 0.92) 0%, rgba(20, 6, 6, 0.96) 100%);
  border: 1px solid rgba(255, 120, 80, 0.35);
  border-radius: 20px;
  padding: 36px 40px;
  text-align: center;
  max-width: 540px;
  box-shadow: 0 20px 80px rgba(0, 0, 0, 0.7), 0 0 50px rgba(255, 60, 20, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.15);
  animation: cardEntrance 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes cardEntrance {
  from { opacity: 0; transform: translateY(24px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.splash-badge {
  display: inline-block;
  font-family: 'Orbitron', monospace;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 2px;
  color: var(--mars-accent-cyan);
  background: rgba(0, 229, 255, 0.1);
  border: 1px solid rgba(0, 229, 255, 0.3);
  padding: 4px 14px;
  border-radius: 12px;
  margin-bottom: 16px;
  text-shadow: 0 0 10px rgba(0, 229, 255, 0.5);
}

#splash-title {
  margin: 0;
  font-family: 'Orbitron', sans-serif;
  font-size: 40px;
  font-weight: 900;
  line-height: 1.05;
  letter-spacing: 1px;
  background: linear-gradient(180deg, #ffffff 0%, #ffd0b8 50%, #ff7347 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 4px 20px rgba(255, 80, 30, 0.5));
}

.title-sub {
  font-size: 28px;
  background: linear-gradient(180deg, #ffc83b 0%, #ff6633 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

#splash-sub {
  margin: 16px 0 24px 0;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.6;
}

/* Controls Guide */
.controls-guide {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}

.control-pill {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 8px 14px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}

.key-badge {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 6px;
  padding: 3px 8px;
  font-family: 'Orbitron', monospace;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.3);
}

.control-label {
  color: var(--mars-accent-gold);
  font-weight: 600;
}

/* Glow Button (2026 Cyber Gaming) */
.glow-button {
  position: relative;
  background: linear-gradient(135deg, #ff5533 0%, #e62200 100%);
  color: #ffffff;
  border: none;
  border-radius: 14px;
  padding: 14px 38px;
  font-family: 'Orbitron', sans-serif;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 1.5px;
  cursor: pointer;
  overflow: hidden;
  box-shadow: 0 8px 26px rgba(255, 60, 20, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.3);
  transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.2s ease;
}

.glow-button:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 12px 34px rgba(255, 60, 20, 0.65), inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.glow-button:active {
  transform: translateY(1px) scale(0.98);
  box-shadow: 0 4px 16px rgba(255, 60, 20, 0.4);
}

.btn-glow {
  position: absolute;
  inset: -100%;
  background: radial-gradient(circle at center, rgba(255, 255, 255, 0.4) 0%, transparent 60%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.glow-button:hover .btn-glow {
  opacity: 0.5;
}

/* ==========================================================================
   Overlays (Victory & Game Over)
   ========================================================================== */
#overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at center, rgba(20, 5, 5, 0.88) 0%, rgba(5, 1, 1, 0.98) 100%);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  z-index: 2100;
  padding: 20px;
}

#overlay-content {
  background: linear-gradient(135deg, rgba(38, 14, 14, 0.94) 0%, rgba(18, 5, 5, 0.98) 100%);
  border: 1px solid rgba(255, 120, 80, 0.35);
  border-radius: 20px;
  padding: 34px 40px;
  text-align: center;
  max-width: 520px;
  width: 100%;
  box-shadow: 0 20px 80px rgba(0, 0, 0, 0.8), 0 0 50px rgba(255, 70, 30, 0.25);
  animation: cardEntrance 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.overlay-status-badge {
  display: inline-block;
  font-family: 'Orbitron', monospace;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 2px;
  color: var(--mars-accent-gold);
  background: rgba(255, 200, 50, 0.12);
  border: 1px solid rgba(255, 200, 50, 0.35);
  padding: 4px 14px;
  border-radius: 12px;
  margin-bottom: 12px;
}

#overlay-title {
  margin: 0 0 10px 0;
  font-family: 'Orbitron', sans-serif;
  font-size: 28px;
  font-weight: 900;
  letter-spacing: 0.5px;
  background: linear-gradient(180deg, #ffffff 0%, #ffcbb3 60%, #ff7b52 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

#overlay-sub {
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.6;
  margin: 0 0 24px 0;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 28px;
}

.stat-card {
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 12px 8px;
}

.stat-card-num {
  font-family: 'Orbitron', monospace;
  font-size: 20px;
  font-weight: 800;
  color: var(--mars-accent-cyan);
  margin-bottom: 4px;
}

.stat-card-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--text-muted);
}

/* Game Over styling */
#game-wrap.game-over #overlay-content {
  border-color: rgba(255, 50, 50, 0.5);
  box-shadow: 0 20px 80px rgba(0, 0, 0, 0.8), 0 0 60px rgba(255, 20, 20, 0.35);
}

#game-wrap.game-over .overlay-status-badge {
  color: #ff4d4d;
  background: rgba(255, 40, 40, 0.15);
  border-color: rgba(255, 40, 40, 0.4);
}

/* ==========================================================================
   Touch Controls (Mobile / Tablet)
   ========================================================================== */
#touch-controls {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 16px;
  display: flex;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 1500;
  pointer-events: none;
}

.touch-cluster-left, .touch-cluster-right {
  display: flex;
  gap: 14px;
  pointer-events: auto;
}

.touch-btn {
  width: 66px;
  height: 66px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: #fff;
  font-family: 'Orbitron', monospace;
  font-size: 22px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  cursor: pointer;
  transition: transform 0.1s ease, background 0.1s ease, box-shadow 0.1s ease;
}

.touch-btn:active, .touch-btn.active {
  transform: scale(0.92);
  background: rgba(255, 85, 51, 0.5);
  border-color: #ff5533;
  box-shadow: 0 0 20px rgba(255, 85, 51, 0.6);
}

.touch-jump {
  width: 110px;
  font-size: 14px;
  letter-spacing: 1px;
  background: linear-gradient(135deg, rgba(255, 90, 40, 0.6) 0%, rgba(200, 30, 10, 0.7) 100%);
  border-color: rgba(255, 140, 90, 0.4);
}

.hidden {
  display: none !important;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  #game-wrap {
    border-radius: 0;
    max-width: 100vw;
    max-height: 100vh;
  }
  #splash-card, #overlay-content {
    padding: 24px 20px;
    margin: 12px;
  }
  #splash-title {
    font-size: 30px;
  }
  .title-sub {
    font-size: 20px;
  }
  .hud-center {
    max-width: 180px;
  }
  .progress-title {
    display: none;
  }
}
