/* Galaxy War — base styles (fullscreen-friendly, HUD aligned with Planet Destroyer) */

html, body {
  margin: 0;
  padding: 0;
  background: #050510;
  color: #ffffff;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  touch-action: none;
  height: 100%;
  min-height: 100%;
}

html {
  min-height: 100dvh;
}

body {
  min-height: 100dvh;
  position: relative;
  overflow: hidden;
}

.container {
  width: 100%;
  min-height: 100dvh;
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: 0;
  box-sizing: border-box;
  position: relative;
}

/* Match Ball Jump / Planet Destroyer: 48px from WebView top */
#hud {
  position: absolute;
  top: 48px;
  left: calc(20px + env(safe-area-inset-left, 0px));
  right: calc(20px + env(safe-area-inset-right, 0px));
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  grid-template-rows: auto auto;
  row-gap: 4px;
  align-items: center;
  z-index: 20;
  pointer-events: none;
}

#pause-wrap {
  grid-column: 3;
  grid-row: 2;
  justify-self: end;
  align-self: start;
  pointer-events: auto;
}

.container.sr-game-over #pause-wrap {
  visibility: hidden;
  pointer-events: none;
}

#pause-btn {
  width: 36px;
  height: 36px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
  color: #fff;
  -webkit-tap-highlight-color: transparent;
}

#pause-btn:active {
  transform: scale(0.96);
  opacity: 0.92;
}

#pause-btn .icon-play {
  display: none;
}

#pause-btn.is-paused .icon-pause {
  display: none;
}

#pause-btn.is-paused .icon-play {
  display: block;
}

#hud-center {
  grid-column: 2;
  grid-row: 1;
  justify-self: center;
  align-self: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

#score-wrap {
  min-width: 6ch;
  font-size: clamp(1.5rem, 5.5vw, 2.5rem);
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  text-align: center;
  color: #ffffff;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.8);
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#score-wrap.pulse {
  animation: gwScoreBounce 0.3s ease-out;
}

#score-wrap.pulse-big {
  animation: gwScoreBounceBig 0.48s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes gwScoreBounce {
  0% { transform: scale(1.1); color: #a78bfa; }
  50% { transform: scale(1.35); color: #fff; }
  100% { transform: scale(1.25); color: #ffffff; }
}

@keyframes gwScoreBounceBig {
  0% { transform: scale(1); color: #fde68a; }
  40% { transform: scale(1.26); color: #fff; }
  100% { transform: scale(1); color: #ffffff; }
}

#lives-wrap {
  grid-column: 3;
  grid-row: 1;
  justify-self: end;
  align-self: center;
  display: flex;
  align-items: center;
  gap: 6px;
}

.life-icon {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ef4444;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
  transition: transform 0.2s, color 0.2s, filter 0.2s;
}

.life-icon svg {
  width: 34px;
  height: 34px;
}

.life-icon.lost {
  color: rgba(255, 255, 255, 0.25);
  filter: none;
  transform: scale(0.85);
}

#lives-wrap.last-life .life-icon:not(.lost) {
  animation: gwLastLifePulse 0.8s ease-in-out infinite;
  filter: drop-shadow(0 0 8px rgba(239, 68, 68, 0.9));
}

@keyframes gwLastLifePulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.15); opacity: 0.9; }
}

.game-container {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100dvh;
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
}

#game-canvas {
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  object-fit: cover;
  object-position: center center;
  border-radius: 0;
  background: #0a0a18;
  touch-action: none;
}
