/* Brainrot Conquer — mobile controls & overlays */

:root {
  --bc-accent: #ff6b2c;
  --bc-accent-dark: #e05e1b;
  --bc-safe-top: env(safe-area-inset-top, 0px);
  --bc-safe-bottom: env(safe-area-inset-bottom, 0px);
  --bc-touch: 56px;
}

html, body {
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

canvas {
  touch-action: none;
}

/* In-game HUD */
#bc-mobile-hud {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9000;
  display: none;
}

body.bc-in-game #bc-mobile-hud {
  display: block;
}

#bc-pause-btn {
  position: fixed;
  top: calc(12px + var(--bc-safe-top));
  right: 12px;
  width: var(--bc-touch);
  height: var(--bc-touch);
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.25);
  background: rgba(15, 23, 42, 0.85);
  color: #fff;
  font-size: 22px;
  pointer-events: auto;
  z-index: 9001;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

#bc-skill-btn {
  position: fixed;
  bottom: calc(24px + var(--bc-safe-bottom));
  right: 20px;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, var(--bc-accent), var(--bc-accent-dark));
  color: #fff;
  font-weight: 800;
  font-size: 13px;
  pointer-events: auto;
  z-index: 9001;
  box-shadow: 0 6px 20px rgba(255, 107, 44, 0.45);
}

#bc-joystick {
  position: fixed;
  bottom: calc(24px + var(--bc-safe-bottom));
  left: 20px;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 2px solid rgba(255, 255, 255, 0.15);
  pointer-events: auto;
  z-index: 9001;
  display: none;
}

#bc-joystick.active {
  background: rgba(255, 107, 44, 0.2);
  border-color: rgba(255, 107, 44, 0.55);
}

#bc-controls-hint {
  position: fixed;
  top: calc(72px + var(--bc-safe-top));
  left: 50%;
  transform: translateX(-50%);
  max-width: min(92vw, 420px);
  padding: 10px 16px;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.92);
  color: #f8fafc;
  font-size: 14px;
  text-align: center;
  z-index: 9002;
  pointer-events: none;
  display: none;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

#bc-controls-hint.visible {
  display: block;
}

@media (pointer: coarse), (max-width: 768px) {
  #bc-joystick {
    display: block;
  }

  .uibox {
    max-width: 95vw !important;
    min-width: unset !important;
    margin: 16px auto 0 !important;
    padding: 24px 16px !important;
  }

  .logo img {
    width: min(280px, 85vw) !important;
  }

  #ui {
    backdrop-filter: blur(6px) !important;
  }
}

/* Pause overlay */
#brainrot-pause {
  position: fixed;
  inset: 0;
  background: rgba(8, 10, 15, 0.92);
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 12px;
  padding: 24px;
}

#brainrot-pause.visible {
  display: flex;
}

#brainrot-pause h2 {
  font-family: 'Orbitron', sans-serif;
  color: var(--bc-accent);
  margin: 0 0 16px;
  font-size: 28px;
}

#brainrot-pause button {
  min-width: 220px;
  min-height: 48px;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  font-family: 'Orbitron', sans-serif;
}

#pause-resume {
  background: linear-gradient(135deg, var(--bc-accent), var(--bc-accent-dark));
  color: #fff;
}

#pause-restart,
#pause-menu {
  background: rgba(255, 255, 255, 0.1);
  color: #e5e7eb;
  border: 1px solid rgba(255, 255, 255, 0.15) !important;
}

/* Combo toast */
#brainrot-combo {
  position: fixed;
  top: 20%;
  left: 50%;
  transform: translateX(-50%) scale(0.8);
  opacity: 0;
  font-family: 'Orbitron', sans-serif;
  font-size: 24px;
  color: #ffd700;
  text-shadow: 0 0 20px rgba(255, 200, 0, 0.8);
  z-index: 9500;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}

#brainrot-combo.show {
  opacity: 1;
  transform: translateX(-50%) scale(1.1);
}

#brainrot-streak-toast,
#brainrot-mission-toast {
  position: fixed;
  top: calc(60px + var(--bc-safe-top));
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid var(--bc-accent);
  color: #fff;
  padding: 10px 18px;
  border-radius: 12px;
  z-index: 9600;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
  font-size: 14px;
  max-width: 90vw;
  text-align: center;
}

#brainrot-streak-toast.show,
#brainrot-mission-toast.show {
  opacity: 1;
}

/* Missions panel (menu) */
#brainrot-missions {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 12px 16px;
  margin: 12px auto;
  max-width: 400px;
  font-size: 13px;
}

#brainrot-missions h3 {
  margin: 0 0 8px;
  font-family: 'Orbitron', sans-serif;
  color: var(--bc-accent);
  font-size: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

#brainrot-missions-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

#brainrot-missions-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  gap: 8px;
}

#brainrot-missions-list li.done {
  opacity: 0.55;
  text-decoration: line-through;
}

#brainrot-missions-list .coin {
  color: #ffd700;
  font-weight: 700;
  font-size: 12px;
}

#brainrot-missions-list .check {
  color: #4ade80;
}

#brainrot-streak-badge {
  background: var(--bc-accent);
  color: #fff;
  padding: 2px 8px;
  border-radius: 8px;
  font-size: 11px;
}

#brainrot-death-extra {
  display: none;
  text-align: center;
  color: #fbbf24;
  font-size: 14px;
  margin: 8px 0;
  padding: 0 16px;
}

#brainrot-death-extra.show {
  display: block;
}

#brainrot-continue-btn {
  display: inline-block;
  margin: 8px auto;
  padding: 10px 24px;
  background: linear-gradient(135deg, #22c55e, #16a34a);
  border: none;
  border-radius: 10px;
  color: #fff;
  font-weight: 700;
  font-family: 'Orbitron', sans-serif;
  cursor: pointer;
  font-size: 14px;
}

/* Performance: reduce blur during gameplay */
body.bc-in-game #ui {
  backdrop-filter: none !important;
}

body.bc-in-game #brainrot-continue-btn,
body.bc-in-game #brainrot-death-extra {
  display: none !important;
}

body:not(.bc-in-game) #brainrot-continue-btn.show-death {
  display: inline-block !important;
}
