:root {
  --glow-blue: #35b6ff;
  --glow-orange: #ff9b2f;
  --panel-bg: rgba(7, 13, 28, 0.74);
  --panel-border: rgba(97, 206, 255, 0.45);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: radial-gradient(circle at 50% 40%, #132246, #05080f 70%);
  color: #fff;
  overflow: hidden;
  touch-action: none;
}

#app {
  width: min(94vw, 980px);
  aspect-ratio: 9 / 16;
  margin: 1vh auto;
  position: relative;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 0 45px rgba(53, 182, 255, 0.3), inset 0 0 60px rgba(255, 170, 60, 0.18);
  border: 2px solid rgba(145, 234, 255, 0.33);
}

#game-container, canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.cabinet-frame {
  position: absolute; inset: 0; pointer-events: none;
  border: 22px solid rgba(64, 76, 104, 0.72);
  border-image: linear-gradient(135deg, rgba(255,146,46,0.9), rgba(72,163,255,0.7), rgba(255,145,44,0.8)) 1;
  box-shadow: inset 0 0 24px rgba(0, 204, 255, 0.25), inset 0 0 64px rgba(255, 149, 44, 0.2);
}

.hud { position: absolute; display: flex; z-index: 8; gap: 10px; width: 100%; padding: 10px; pointer-events: none; }
.hud.top { top: 0; justify-content: space-between; }
.hud.bottom { bottom: 0; justify-content: center; padding-bottom: 16px; }
.panel {
  min-width: 28%;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 6px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: inset 0 0 18px rgba(255, 163, 45, 0.22), 0 0 14px rgba(53, 182, 255, 0.25);
}
.label { font-size: 0.72rem; letter-spacing: 1.2px; opacity: 0.8; }
#score, #level, #lives { font-size: 1.65rem; color: #ffbd39; text-shadow: 0 0 8px rgba(255, 166, 0, 0.65); font-weight: 800; }
#lives { color: #ffb347; font-size: 1.3rem; }

.hud-side {
  position: absolute;
  left: 2%;
  top: 28%;
  z-index: 9;
  pointer-events: none;
}
.multiplier-ring {
  width: 96px;
  height: 96px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: radial-gradient(circle, rgba(255, 182, 38, 0.65), rgba(255, 130, 0, 0.1));
  border: 2px solid rgba(255, 203, 103, 0.75);
  box-shadow: 0 0 16px rgba(255, 161, 31, 0.8), inset 0 0 16px rgba(255, 202, 102, 0.5);
  animation: pulse 1.2s ease-in-out infinite;
}
#multiplier { font-size: 2rem; font-weight: 900; color: #ffd165; }

#powerups {
  display: flex;
  gap: 8px;
  background: rgba(7, 10, 20, 0.64);
  border: 1px solid rgba(70, 220, 255, 0.4);
  border-radius: 10px;
  min-height: 36px;
  padding: 6px 10px;
  min-width: 220px;
  justify-content: center;
}
.power-chip {
  padding: 4px 8px;
  border-radius: 14px;
  font-size: 0.8rem;
  font-weight: 700;
  background: rgba(60, 164, 255, 0.2);
  border: 1px solid rgba(95, 204, 255, 0.7);
}

.overlay {
  position: absolute;
  inset: 0;
  display: none;
  z-index: 20;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  background: radial-gradient(circle at 50% 25%, rgba(19, 40, 82, 0.82), rgba(3, 8, 20, 0.9));
  text-align: center;
  padding: 16px;
}
.overlay.visible { display: flex; }
.overlay h1, .overlay h2 {
  margin: 0 0 12px;
  color: #ffd06b;
  text-shadow: 0 0 20px rgba(255, 165, 0, 0.5);
}
.overlay p { opacity: 0.92; }
button {
  margin-top: 12px;
  border: 0;
  padding: 12px 24px;
  font-weight: 800;
  letter-spacing: 0.8px;
  border-radius: 999px;
  color: #07203f;
  background: linear-gradient(180deg, #90ecff, #2fc9ff);
  box-shadow: 0 0 16px rgba(73, 204, 255, 0.55);
  cursor: pointer;
}
button:hover { filter: brightness(1.08); }

.mobile-controls {
  position: absolute;
  z-index: 25;
  left: 10px;
  right: 10px;
  bottom: 70px;
  display: none;
  gap: 10px;
  align-items: center;
  justify-content: center;
}

.touch-btn {
  margin-top: 0;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  padding: 0;
  font-size: 1.5rem;
  font-weight: 900;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

.touch-btn--fire {
  width: 96px;
  border-radius: 999px;
  font-size: 1rem;
}

.touch-btn--pause {
  width: 52px;
  height: 52px;
  font-size: 1.2rem;
}

.flash { animation: flash 0.25s ease; }
@keyframes flash { from { filter: brightness(1.45); } to { filter: brightness(1); } }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06);} }

@media (max-width: 900px), (hover: none) {
  #app {
    width: min(100vw, 980px);
    margin: 0;
    border-radius: 0;
    border-width: 0;
    box-shadow: none;
  }

  .cabinet-frame {
    border-width: 10px;
  }

  .hud.top {
    padding: 8px;
    gap: 6px;
  }

  .panel {
    min-width: 32%;
    padding: 5px 8px;
  }

  #score, #level, #lives {
    font-size: 1.2rem;
  }

  .hud-side {
    top: 20%;
  }

  .multiplier-ring {
    width: 72px;
    height: 72px;
  }

  #multiplier {
    font-size: 1.5rem;
  }

  .mobile-controls {
    display: flex;
  }

  .overlay p {
    font-size: 0.92rem;
  }
}
