*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
  overflow: hidden;
  background: #0b1020;
  color: #eef2ff;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
  user-select: none;
}

#app {
  position: relative;
  width: 100%;
  height: 100%;
}

#game {
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
}

#hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: flex-start;
  gap: 0.5rem;
  padding: max(0.7rem, env(safe-area-inset-top)) max(0.85rem, env(safe-area-inset-right)) 0
    max(0.85rem, env(safe-area-inset-left));
  pointer-events: none;
  z-index: 2;
  font-variant-numeric: tabular-nums;
}

.hud-left {
  display: flex;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.hud-mid {
  justify-self: center;
}

.hud-right {
  display: flex;
  gap: 0.35rem;
  justify-content: flex-end;
  pointer-events: auto;
}

.hud-block {
  display: flex;
  flex-direction: column;
  min-width: 3.4rem;
}

.hud-block .label,
.shot-meter .label {
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0.55;
}

.hud-block span:last-child {
  font-size: 1.2rem;
  font-weight: 700;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.55);
}

.hud-block.highlight span:last-child {
  color: #a5b4fc;
  font-size: 1.45rem;
}

.shot-meter {
  min-width: 7.5rem;
  padding: 0.35rem 0.65rem 0.45rem;
  border-radius: 0.55rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(10, 14, 23, 0.55);
  backdrop-filter: blur(6px);
}

.meter-track {
  margin-top: 0.25rem;
  height: 0.35rem;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

.meter-fill {
  height: 100%;
  width: 0%;
  border-radius: 99px;
  background: linear-gradient(90deg, #38bdf8, #a78bfa);
  transition: width 0.05s linear;
}

.icon-btn {
  width: 2.45rem;
  height: 2.45rem;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 0.5rem;
  background: rgba(10, 14, 23, 0.55);
  color: #eef2ff;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  text-decoration: none;
  backdrop-filter: blur(6px);
}

.icon-btn:hover,
.icon-btn:focus-visible {
  border-color: rgba(167, 139, 250, 0.55);
  outline: none;
}

.float-fx {
  position: absolute;
  left: 50%;
  top: 42%;
  transform: translate(-50%, -50%);
  font-size: clamp(1.6rem, 6vw, 2.4rem);
  font-weight: 800;
  pointer-events: none;
  z-index: 3;
  text-shadow: 0 4px 24px rgba(0, 0, 0, 0.55);
  opacity: 0;
  transition: opacity 0.15s ease, transform 0.35s ease;
}

.float-fx.show {
  opacity: 1;
  transform: translate(-50%, -80%);
}

.float-fx.good {
  color: #86efac;
}

.float-fx.bad {
  color: #fca5a5;
}

.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 1.15rem;
  background: rgba(6, 9, 18, 0.74);
  z-index: 4;
}

.overlay[hidden] {
  display: none;
}

.panel {
  width: min(24rem, 100%);
  padding: 1.6rem 1.4rem 1.25rem;
  border-radius: 1rem;
  border: 1px solid rgba(129, 140, 248, 0.28);
  background: linear-gradient(160deg, rgba(22, 28, 52, 0.96), rgba(10, 14, 26, 0.98));
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
  text-align: center;
}

.eyebrow {
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #a5b4fc;
  opacity: 0.85;
  margin-bottom: 0.35rem;
}

.panel h1 {
  font-size: clamp(1.65rem, 5.5vw, 2.1rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(100deg, #818cf8, #e879f9, #38bdf8);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.subtitle {
  margin-top: 0.55rem;
  font-size: 0.9rem;
  line-height: 1.45;
  opacity: 0.72;
}

.final-score {
  margin-top: 0.85rem;
  font-size: 1.05rem;
  font-weight: 700;
}

.final-score[hidden] {
  display: none;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  justify-content: center;
  margin-top: 1.25rem;
}

.btn {
  min-width: 7.5rem;
  padding: 0.7rem 1.1rem;
  border-radius: 0.55rem;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  color: #eef2ff;
  font: inherit;
  font-weight: 650;
  font-size: 0.95rem;
  cursor: pointer;
}

.btn.primary {
  background: linear-gradient(135deg, #818cf8, #e879f9);
  border-color: transparent;
  color: #0b1020;
}

.btn:hover,
.btn:focus-visible {
  filter: brightness(1.06);
  outline: none;
}

.btn[hidden] {
  display: none;
}

.nav-home {
  margin-top: 0.85rem;
  font-size: 0.8rem;
}

.nav-home a {
  color: #a5b4fc;
  text-decoration: none;
}

.nav-home a:hover {
  text-decoration: underline;
}

.hint {
  margin-top: 0.9rem;
  font-size: 0.72rem;
  line-height: 1.5;
  opacity: 0.48;
}

.feature-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.4rem 0.75rem;
  margin-top: 0.85rem;
  font-size: 0.72rem;
  opacity: 0.7;
}

.version {
  margin-top: 0.95rem;
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  color: #818cf8;
  opacity: 0.55;
}

@media (max-width: 560px) {
  #hud {
    grid-template-columns: 1fr auto;
  }

  .hud-mid {
    grid-column: 1 / -1;
    order: 3;
    width: 100%;
  }

  .shot-meter {
    width: 100%;
  }
}
