/* =========================================================
   Mobile Virtual Touch Controls & Rotation Prompt Styling
   ========================================================= */

/* Mobile Controls Overlay */
.mobile-controls {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 35;
  display: flex;
  box-sizing: border-box;
}

/* Left Touch Cluster: Analog Joystick */
.touch-cluster-left {
  position: absolute;
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  left: calc(24px + env(safe-area-inset-left, 0px));
  pointer-events: auto;
  touch-action: none;
}

.virtual-stick {
  width: 130px;
  height: 130px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(15, 23, 42, 0.6) 0%, rgba(30, 41, 59, 0.4) 100%);
  border: 2px solid rgba(0, 240, 255, 0.4);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5), inset 0 0 15px rgba(0, 240, 255, 0.2);
  position: relative;
  touch-action: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.virtual-stick-knob {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #67e8f9, #0284c7);
  box-shadow: 0 0 16px rgba(0, 240, 255, 0.8), 0 4px 10px rgba(0, 0, 0, 0.5);
  border: 2px solid #ffffff;
  pointer-events: none;
  transform: translate(0px, 0px);
  transition: transform 0.05s ease-out;
}

/* Right Touch Cluster: Action Buttons */
.touch-cluster-right {
  position: absolute;
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  right: calc(24px + env(safe-area-inset-right, 0px));
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
  touch-action: none;
}

.touch-action-row {
  display: flex;
  gap: 12px;
  align-items: center;
}

/* Touch Buttons Base */
.touch-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: none;
  outline: none;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  transition: transform 0.1s ease, box-shadow 0.1s ease, filter 0.1s ease;
}

.touch-btn:active,
.touch-btn.active {
  transform: scale(0.92);
  filter: brightness(1.2);
}

/* Big Fire Button */
.touch-btn-shoot {
  width: 82px;
  height: 82px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #38bdf8 0%, #0284c7 60%, #0369a1 100%);
  border: 3px solid #ffffff;
  box-shadow: 0 0 20px rgba(0, 240, 255, 0.7), 0 6px 14px rgba(0, 0, 0, 0.6);
  color: #ffffff;
}

.touch-btn-shoot .touch-icon {
  font-size: 32px;
  line-height: 1;
}

.touch-btn-shoot .touch-sub {
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 1px;
}

/* Mega Bomb Button */
.touch-btn-bomb {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #facc15 0%, #d97706 70%, #92400e 100%);
  border: 2px solid #ffffff;
  box-shadow: 0 0 16px rgba(250, 204, 21, 0.7), 0 4px 10px rgba(0, 0, 0, 0.5);
  color: #ffffff;
}
.touch-btn-bomb .touch-icon {
  font-size: 24px;
  line-height: 1;
}
.touch-btn-bomb .touch-sub {
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.5px;
}

/* Swap Weapon Button */
.touch-btn-sub {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #c084fc 0%, #7e22ce 70%, #581c87 100%);
  border: 2px solid #e9d5ff;
  box-shadow: 0 0 14px rgba(192, 132, 252, 0.6), 0 4px 10px rgba(0, 0, 0, 0.5);
  color: #ffffff;
}
.touch-btn-sub .touch-icon {
  font-size: 22px;
  line-height: 1;
}
.touch-btn-sub .touch-sub {
  font-size: 9px;
  font-weight: 900;
}

/* Top Quick Action Buttons (Pause & Sound) */
.touch-cluster-top {
  position: absolute;
  top: calc(14px + env(safe-area-inset-top, 0px));
  right: calc(18px + env(safe-area-inset-right, 0px));
  display: flex;
  gap: 10px;
  pointer-events: auto;
}

.touch-btn-tiny {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #ffffff;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(8px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}
.touch-btn-tiny:active {
  background: rgba(30, 41, 59, 0.95);
  transform: scale(0.92);
}

/* Portrait Device Rotation Prompt Overlay */
.rotate-prompt {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(8, 11, 20, 0.95);
  backdrop-filter: blur(20px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  box-sizing: border-box;
}

.rotate-card {
  background: rgba(15, 23, 42, 0.96);
  border: 2px solid rgba(0, 240, 255, 0.4);
  border-radius: 24px;
  padding: 30px 24px;
  max-width: 360px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  box-shadow: 0 15px 45px rgba(0, 0, 0, 0.8), 0 0 30px rgba(0, 240, 255, 0.2);
}

.rotate-icon {
  margin-bottom: 16px;
  animation: pulse-rotate 2s infinite ease-in-out;
}

@keyframes pulse-rotate {
  0%, 100% { transform: rotate(0deg) scale(1); }
  50% { transform: rotate(15deg) scale(1.08); }
}

.rotate-title {
  font-size: 24px;
  font-weight: 900;
  color: #00f0ff;
  margin-bottom: 8px;
}

.rotate-desc {
  font-size: 14px;
  color: #94a3b8;
  line-height: 1.5;
  margin-bottom: 22px;
}

.rotate-dismiss-btn {
  background: linear-gradient(90deg, #0284c7, #00f0ff);
  border: none;
  border-radius: 14px;
  color: #080b14;
  font-size: 16px;
  font-weight: 900;
  padding: 12px 28px;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(0, 240, 255, 0.4);
  outline: none;
}
.rotate-dismiss-btn:active {
  transform: scale(0.96);
}

/* =========================================================
   Responsive Breakpoints for Mobile Screens (< 768px / Landscape)
   ========================================================= */

@media (max-width: 840px), (max-height: 520px) {
  :root {
    --tv-safe-top: 14px;
    --tv-safe-bottom: 14px;
    --tv-safe-left: 18px;
    --tv-safe-right: 18px;
  }

  .menu-logo-title {
    font-size: 34px !important;
    margin-bottom: 2px !important;
  }
  .menu-logo-subtitle {
    font-size: 14px !important;
    letter-spacing: 4px !important;
    margin-bottom: 14px !important;
  }
  .same-window-badge {
    font-size: 11px !important;
    padding: 4px 10px !important;
    margin-bottom: 12px !important;
  }

  .menu-options {
    width: 95% !important;
    max-width: 360px !important;
    gap: 8px !important;
  }

  .tv-button {
    font-size: 15px !important;
    padding: 10px 16px !important;
    border-radius: 12px !important;
  }
  .btn-icon {
    font-size: 18px !important;
  }

  /* HUD Compact for Mobile */
  .hud-card {
    padding: 6px 10px !important;
    border-radius: 10px !important;
  }
  .player-avatar-icon {
    width: 28px !important;
    height: 28px !important;
    font-size: 12px !important;
  }
  .badge-label {
    font-size: 9px !important;
  }
  .badge-score {
    font-size: 18px !important;
  }
  .device-tag {
    font-size: 9px !important;
    padding: 2px 5px !important;
  }

  .timer-box {
    font-size: 20px !important;
    padding: 3px 14px !important;
  }
  .city-coverage-bar-container {
    width: 200px !important;
    height: 14px !important;
  }
  .coverage-text {
    font-size: 9px !important;
  }

  /* Hide weapon cards and bottom controller pills on mobile during gameplay to keep screen clear */
  .hud-bottom-bar .weapon-card,
  .hud-bottom-bar .control-pills-bar {
    display: none !important;
  }

  /* Smaller virtual touch controls for compact screens */
  .virtual-stick {
    width: 100px;
    height: 100px;
  }
  .virtual-stick-knob {
    width: 44px;
    height: 44px;
  }
  .touch-btn-shoot {
    width: 68px;
    height: 68px;
  }
  .touch-btn-shoot .touch-icon {
    font-size: 26px;
  }
  .touch-btn-bomb {
    width: 52px;
    height: 52px;
  }
  .touch-btn-bomb .touch-icon {
    font-size: 20px;
  }
  .touch-btn-sub {
    width: 46px;
    height: 46px;
  }
  .touch-btn-sub .touch-icon {
    font-size: 18px;
  }

  .results-card {
    padding: 18px 20px !important;
  }
  .results-winner {
    font-size: 24px !important;
    margin-bottom: 12px !important;
  }
  .results-stats-grid {
    gap: 8px !important;
    margin-bottom: 16px !important;
  }
  .stat-box {
    padding: 8px 10px !important;
  }
  .stat-title {
    font-size: 11px !important;
  }
  .stat-value {
    font-size: 20px !important;
  }
  .instructions-panel {
    padding: 16px 20px !important;
  }
  .instructions-panel h2 {
    font-size: 22px !important;
  }
  .instructions-grid {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }
}
