/* style.css */

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

body, html {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: #050508;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  display: flex;
  justify-content: center;
  align-items: center;
}

#game-container {
  position: absolute;
  width: 1280px;
  height: 720px;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) scale(var(--game-scale, 1));
  transform-origin: center center;
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: #050508;
  overflow: hidden;
}

/* UI Screen Overlays */
.overlay-screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(5, 5, 8, 0.88);
  backdrop-filter: blur(4px);
  z-index: 50;
  display: flex;
  justify-content: center;
  align-items: center;
}

.menu-box {
  background: rgba(15, 16, 24, 0.95);
  border: 2px solid #00ffcc;
  box-shadow: 0 0 20px rgba(0, 255, 204, 0.3);
  padding: 35px 45px;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 500px;
  width: 90%;
  text-align: center;
}

/* Orientation Overlay Styling (Reference Match) */
#orientation-overlay {
  background: rgba(5, 5, 8, 0.96);
  z-index: 1000;
  pointer-events: auto;
}

.orientation-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  text-align: center;
  padding: 30px;
}

.phone-rotate-icon {
  animation: phoneRotatePulse 2s ease-in-out infinite alternate;
  margin-bottom: 10px;
}

.phone-outline {
  width: 90px;
  height: 54px;
  border: 3px solid #ffffff;
  border-radius: 8px;
  position: relative;
  background: rgba(0, 255, 204, 0.05);
  box-shadow: 0 0 15px rgba(0, 255, 204, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
}

.phone-screen {
  width: 70px;
  height: 38px;
  border: 1.5px solid rgba(255, 255, 255, 0.6);
  border-radius: 4px;
}

.phone-speaker {
  position: absolute;
  top: 6px;
  left: 10px;
  width: 10px;
  height: 2px;
  background: #fff;
  border-radius: 1px;
}

.phone-home-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #fff;
}

@keyframes phoneRotatePulse {
  0% { transform: rotate(0deg) scale(1); }
  50% { transform: rotate(-90deg) scale(1.05); }
  100% { transform: rotate(-90deg) scale(1); }
}

.orientation-title {
  color: #ffffff;
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: 3px;
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

.orientation-desc {
  color: #c0ceea;
  font-size: 0.95rem;
  letter-spacing: 1px;
}

/* Single-Screen Arcade Manual Box */
.manual-box {
  max-width: 900px;
  width: 95%;
  max-height: 660px;
  height: 92%;
  padding: 15px 22px;
  box-sizing: border-box;
  overflow-y: auto;
  justify-content: space-between;
}

.manual-header h2 {
  color: #00ffcc;
  font-size: 1.5rem;
  letter-spacing: 2px;
  margin-bottom: 4px;
}

.manual-intro {
  color: #c0ceea;
  font-size: 0.82rem;
  line-height: 1.25;
  margin-bottom: 12px;
}

.manual-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  width: 100%;
  margin-bottom: 12px;
}

.manual-section {
  background: rgba(0, 255, 204, 0.03);
  border: 1px solid rgba(0, 255, 204, 0.25);
  border-radius: 8px;
  padding: 10px 12px;
  text-align: left;
}

.manual-section-title {
  color: #00ffcc;
  font-size: 0.85rem;
  letter-spacing: 1.5px;
  border-bottom: 1px solid rgba(0, 255, 204, 0.2);
  padding-bottom: 4px;
  margin-bottom: 8px;
}

.manual-block {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.78rem;
  color: #d1d9e6;
  line-height: 1.25;
}

.manual-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.badge {
  background: rgba(0, 255, 204, 0.2);
  border: 1px solid #00ffcc;
  color: #00ffcc;
  font-size: 0.7rem;
  font-weight: bold;
  padding: 2px 6px;
  border-radius: 4px;
  white-space: nowrap;
}

.highlight-row {
  color: #ffcc00;
  font-weight: 600;
}

.manual-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.item-desc {
  font-size: 0.75rem;
  line-height: 1.2;
}

.item-desc strong {
  color: #ffffff;
}

.enemy-list {
  gap: 8px;
}

.enemy-icon {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
  border: 1.5px solid #fff;
}

.std-enemy { background: #ff3344; }
.armored-swatches { display: flex; gap: 3px; flex-shrink: 0; }
.arm-yellow { background: #e6b800; }
.arm-green { background: #28a745; }
.arm-blue { background: #007bff; }
.arm-violet { background: #8a2be2; }

.hostage-item {
  border-top: 1px dashed rgba(255, 255, 255, 0.15);
  padding-top: 6px;
}
.hostage-icon {
  background: #1a0d18;
  border-color: #28a745;
  position: relative;
}
.hostage-icon::after {
  content: 'H';
  color: #ff3366;
  font-size: 10px;
  font-weight: bold;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.perk-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.perk-icon {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: bold;
  flex-shrink: 0;
  color: #000;
}

.p-life { background: #00e664; color: #fff; }
.p-timer { background: #ffb700; }
.p-mg { background: #ff00ff; color: #fff; }
.p-mult { background: #00e5ff; }

.compact-text p {
  margin-bottom: 4px;
}
.compact-text strong {
  color: #00ffcc;
}

.txt-yellow { color: #e6b800; font-weight: bold; }
.txt-green { color: #28a745; font-weight: bold; }
.txt-blue { color: #007bff; font-weight: bold; }
.txt-violet { color: #8a2be2; font-weight: bold; }
.txt-red { color: #ff3366; font-weight: bold; }

@media (max-width: 650px) {
  .manual-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .manual-box {
    padding: 12px 16px;
  }
  .manual-header h2 {
    font-size: 1.2rem;
  }
  .manual-intro {
    font-size: 0.72rem;
    margin-bottom: 6px;
  }
  .manual-section {
    padding: 6px 8px;
  }
  .item-desc, .manual-block {
    font-size: 0.7rem;
  }
}

.game-title {
  color: #00ffcc;
  font-size: clamp(2.2rem, 5vw, 3.5rem);
  letter-spacing: 4px;
  margin-bottom: 30px;
  text-shadow: 0 0 15px rgba(0, 255, 204, 0.6);
}

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

.menu-btn {
  background: rgba(0, 255, 204, 0.1);
  border: 2px solid #00ffcc;
  color: #ffffff;
  padding: 12px 24px;
  font-size: 1.2rem;
  font-weight: bold;
  letter-spacing: 2px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.menu-btn:hover {
  background: rgba(0, 255, 204, 0.3);
  box-shadow: 0 0 10px #00ffcc;
  transform: translateY(-2px);
}

.menu-btn:active {
  transform: translateY(0);
}

.menu-btn:disabled {
  opacity: 0.4;
  border-color: #666;
  color: #888;
  cursor: not-allowed;
  box-shadow: none;
}

/* Modal Content Styles */
.modal-box h2 {
  color: #00ffcc;
  font-size: 1.8rem;
  margin-bottom: 20px;
  letter-spacing: 2px;
}

.instruction-content {
  color: #ddd;
  text-align: left;
  font-size: 1rem;
  line-height: 1.6;
  margin-bottom: 25px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.instruction-content strong {
  color: #00ffcc;
}

/* Leaderboard Table */
.leaderboard-table-wrapper {
  width: 100%;
  max-height: 280px;
  overflow-y: auto;
  margin-bottom: 25px;
  border: 1px solid rgba(0, 255, 204, 0.3);
  border-radius: 6px;
}

#leaderboard-table {
  width: 100%;
  border-collapse: collapse;
  color: #fff;
  font-size: 1.1rem;
}

#leaderboard-table th {
  background: #0d1520;
  color: #00ffcc;
  padding: 10px;
  text-align: center;
  position: sticky;
  top: 0;
  z-index: 2;
}

#leaderboard-table td {
  padding: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  text-align: center;
}

#leaderboard-table tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.03);
}

/* Arcade Name Entry */
.arcade-box {
  border-color: #ffcc00;
  box-shadow: 0 0 25px rgba(255, 204, 0, 0.4);
}

.arcade-title {
  color: #ffcc00 !important;
  font-size: 2rem !important;
}

.arcade-subtitle {
  color: #ffffff;
  font-size: 1.1rem;
  margin-bottom: 20px;
  letter-spacing: 2px;
}

.arcade-input-container {
  margin-bottom: 25px;
}

#arcade-name-input {
  background: #000;
  border: 2px solid #ffcc00;
  color: #ffcc00;
  font-size: 2.5rem;
  font-weight: bold;
  text-align: center;
  width: 160px;
  letter-spacing: 12px;
  padding: 5px 10px;
  border-radius: 6px;
  outline: none;
  text-transform: uppercase;
}

/* Pause Menu Styling */
.pause-title {
  color: #00ffcc;
  font-size: 2.5rem;
  letter-spacing: 3px;
  margin-bottom: 20px;
  text-shadow: 0 0 15px rgba(0, 255, 204, 0.6);
}

/* Game Over Screen Pop-In Animation */
.game-over-header {
  color: #ff3344;
  font-size: 2.5rem;
  letter-spacing: 3px;
  margin-bottom: 20px;
  text-shadow: 0 0 15px rgba(255, 51, 68, 0.6);
}

.game-over-stats {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 25px;
  background: rgba(0, 0, 0, 0.3);
  padding: 15px;
  border-radius: 6px;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  font-size: 1.2rem;
  font-weight: bold;
}

.stat-label {
  color: #aaa;
}

.stat-val {
  color: #00ffcc;
}

.pop-in {
  animation: modalPopIn 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes modalPopIn {
  0% {
    opacity: 0;
    transform: scale(0.6);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

/* Borderless Top HUD Container */
#hud {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 70px;
  background: transparent;
  border-bottom: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 10;
  color: #ffffff;
  padding: 0 25px;
  pointer-events: none;
}

.hud-item {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.hud-left {
  align-items: flex-start;
}

.hud-center {
  align-items: center;
}

.hud-right {
  flex-direction: row;
  gap: 20px;
  align-items: center;
}

.hud-subgroup {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

/* Bottom HUD Layer */
#bottom-hud {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 100px;
  pointer-events: none;
  z-index: 10;
}

.hud-item.hud-lives {
  position: absolute;
  bottom: 25px;
  left: 25px;
  align-items: flex-start;
}

.hud-item.hud-combo {
  position: absolute;
  bottom: 25px;
  left: 50%;
  transform: translateX(-50%);
  align-items: center;
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.2s ease;
}

.hud-item.hud-combo.combo-active {
  opacity: 1;
}

.hud-item.hud-combo.combo-break {
  animation: comboBreakEffect 0.35s ease-out;
}

@keyframes comboBreakEffect {
  0% {
    opacity: 1;
    transform: translateX(-50%) scale(1.15);
    filter: drop-shadow(0 0 12px #ff1a3c);
  }
  25% {
    opacity: 0.8;
    transform: translateX(-50%) scale(0.95);
    filter: drop-shadow(0 0 18px #ff0000);
  }
  50% {
    opacity: 1;
    transform: translateX(-50%) scale(1.05);
  }
  100% {
    opacity: 0;
    transform: translateX(-50%) scale(0.9);
    filter: none;
  }
}

.hud-item.hud-multiplier {
  position: absolute;
  bottom: 120px;
  left: 50%;
  transform: translateX(-50%);
  align-items: center;
  margin-bottom: 6px;
  z-index: 12;
  transition: opacity 0.2s ease;
}

.multiplier-badge {
  display: flex;
  align-items: center;
  gap: 6px;
}

.mult-icon {
  font-size: 1.1rem;
  font-weight: 900;
  color: #00e5ff;
  text-shadow: 0 0 10px #00e5ff;
}

.mult-title {
  font-size: 0.95rem;
  font-weight: 800;
  color: #00e5ff;
  letter-spacing: 1.5px;
  text-shadow: 0 0 8px rgba(0, 229, 255, 0.6);
}

#multiplier-bar {
  width: 180px;
  height: 8px;
  background-color: rgba(15, 25, 35, 0.8);
  border-radius: 4px;
  margin-top: 4px;
  overflow: hidden;
  border: 1.5px solid #00e5ff;
  box-shadow: 0 0 8px rgba(0, 229, 255, 0.4);
}

#multiplier-bar-fill {
  width: 100%;
  height: 100%;
  background-color: #00ffff;
  box-shadow: 0 0 10px #00ffff;
  transition: width 0.1s linear;
}

.hud-item.hud-ammo {
  position: absolute;
  bottom: 25px;
  right: 25px;
  align-items: flex-end;
}

/* HUD Typography */
#hud .hud-label {
  font-size: 0.95rem;
  color: #00ffcc;
  letter-spacing: 1.5px;
  font-weight: 700;
  text-shadow: 0 0 6px rgba(0, 255, 204, 0.4);
}

#hud .hud-value {
  font-size: 1.75rem;
  font-weight: bold;
  text-shadow: 0 0 8px rgba(255, 255, 255, 0.3);
}

#bottom-hud .hud-label {
  font-size: 1.2rem;
  color: #00ffcc;
  letter-spacing: 2px;
  font-weight: 700;
  text-shadow: 0 0 8px rgba(0, 255, 204, 0.5);
}

#bottom-hud .hud-value {
  font-size: 2.2rem;
  font-weight: bold;
}

.hud-item.hud-combo #combo-val {
  color: #ffffff;
}

.mg-ammo-symbol {
  font-size: 1.8rem;
  margin-right: 6px;
  color: #00e5ff;
  filter: drop-shadow(0 0 8px #00e5ff);
}

.mg-ammo-count {
  color: #00e5ff !important;
  font-size: 2.2rem;
  font-weight: bold;
  text-shadow: 0 0 12px rgba(0, 229, 255, 0.7);
}

.hud-icons {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 4px;
}

.heart-icon {
  color: #ff3344;
  font-size: 2.8rem;
  line-height: 1;
  filter: drop-shadow(0 0 8px #ff0033);
}

.heart-icon.empty {
  color: #38181e;
  filter: none;
}

.bullet-icon {
  display: inline-block;
  width: 18px;
  height: 40px;
  background: #00ffcc;
  border-radius: 5px 5px 2px 2px;
  box-shadow: 0 0 10px #00ffcc;
}

.bullet-icon.empty {
  background: #12302b;
  box-shadow: none;
}

#combo-bar {
  width: 180px;
  height: 12px;
  background-color: #222533;
  border-radius: 6px;
  margin-top: 6px;
  overflow: hidden;
  border: 1.5px solid rgba(0, 255, 204, 0.4);
}

#combo-bar-fill {
  width: 0%;
  height: 100%;
  background-color: #ffcc00;
  transition: width 0.1s linear;
}

#reload-prompt {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #ff1a3c;
  font-weight: 900;
  font-size: clamp(3rem, 10vw, 7rem);
  letter-spacing: 12px;
  text-shadow: 0 0 25px rgba(255, 26, 60, 0.8), 0 0 10px #000000;
  pointer-events: none;
  z-index: 15;
  animation: reloadPulse 0.8s ease-in-out infinite alternate;
}

.hidden {
  display: none !important;
}

@keyframes reloadPulse {
  from {
    opacity: 0.40;
    transform: translate(-50%, -50%) scale(0.96);
  }
  to {
    opacity: 0.95;
    transform: translate(-50%, -50%) scale(1.04);
  }
}

#gameCanvas {
  display: block;
  touch-action: none;
  cursor: crosshair;
  width: 100%;
  height: 100%;
}

#touch-reload-btn {
  position: absolute;
  bottom: 110px;
  right: 25px;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background-color: rgba(0, 255, 204, 0.25);
  border: 2px solid #00ffcc;
  color: #00ffcc;
  font-weight: bold;
  font-size: 0.9rem;
  z-index: 10;
  display: none;
  justify-content: center;
  align-items: center;
}

#touch-reload-btn.visible {
  display: flex;
}

#touch-reload-btn:active {
  background-color: rgba(0, 255, 204, 0.5);
}

#touch-pause-btn {
  position: absolute;
  top: 75px;
  right: 25px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background-color: rgba(0, 255, 204, 0.25);
  border: 2px solid #00ffcc;
  color: #00ffcc;
  font-weight: bold;
  font-size: 0.75rem;
  z-index: 12;
  display: none;
  justify-content: center;
  align-items: center;
}

#touch-pause-btn.visible {
  display: flex;
}

#touch-pause-btn:active {
  background-color: rgba(0, 255, 204, 0.5);
}