* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #07111a;
  color: #fff;
  font-family: Arial, Helvetica, sans-serif;
}

body {
  touch-action: none;
  user-select: none;
}

.game-shell {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 280px;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 48%, rgba(6, 182, 212, 0.12), transparent 36%),
    #07111a;
}

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

.hud {
  position: absolute;
  inset: 12px 12px auto;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  pointer-events: none;
}

.hud-group {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  max-width: 55%;
}

.hud-pill,
.status-panel {
  border: 1px solid rgba(255, 255, 255, 0.13);
  background: rgba(3, 12, 20, 0.76);
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(9px);
}

.hud-pill {
  margin: 0;
  border-radius: 999px;
  padding: 8px 12px;
  color: #94a3b8;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.hud-pill strong {
  margin-left: 4px;
  color: #67e8f9;
  font-size: 13px;
}

.wave-pill strong {
  margin-left: 0;
  color: #f0abfc;
}

.status-panel {
  width: min(250px, 42vw);
  border-radius: 14px;
  padding: 10px 12px;
}

.status-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: #94a3b8;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.status-row strong {
  color: #f8fafc;
}

.energy-row {
  margin-top: 8px;
}

.meter {
  height: 5px;
  margin-top: 5px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.09);
}

.meter span {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  transition: width 120ms linear, background-color 160ms ease;
}

.integrity-meter span {
  background: linear-gradient(90deg, #fb7185, #fbbf24, #4ade80);
}

.energy-meter span {
  background: linear-gradient(90deg, #8b5cf6, #22d3ee);
  box-shadow: 0 0 14px rgba(34, 211, 238, 0.55);
}

.combo,
.announcement {
  position: absolute;
  left: 50%;
  margin: 0;
  pointer-events: none;
  text-align: center;
  transform: translateX(-50%);
  text-shadow: 0 3px 18px #000;
}

.combo {
  bottom: 22px;
  color: #f0abfc;
  font-size: clamp(13px, 2vw, 18px);
  font-weight: 1000;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.announcement {
  top: 27%;
  width: 90%;
  color: #fff;
  font-size: clamp(22px, 5vw, 42px);
  font-weight: 1000;
  letter-spacing: -0.04em;
  opacity: 0;
  transition: opacity 180ms ease;
}

.announcement.visible {
  opacity: 1;
}

.overlay,
.pause-panel {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(3, 10, 17, 0.7);
  backdrop-filter: blur(7px);
  transition: opacity 180ms ease;
}

.overlay.hidden,
.pause-panel.hidden {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

.panel,
.pause-panel > div {
  width: min(520px, 100%);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 26px;
  background:
    linear-gradient(145deg, rgba(17, 44, 58, 0.96), rgba(20, 19, 55, 0.96));
  box-shadow: 0 28px 100px rgba(0, 0, 0, 0.48);
  text-align: center;
}

.panel {
  padding: clamp(22px, 5vw, 38px);
}

.pause-panel > div {
  width: min(330px, 100%);
  padding: 28px;
}

.kicker {
  margin: 0;
  color: #67e8f9;
  font-size: 10px;
  font-weight: 1000;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 10px 0 0;
  line-height: 0.95;
  letter-spacing: -0.055em;
  text-transform: uppercase;
}

h1 {
  font-size: clamp(36px, 9vw, 64px);
}

h2 {
  font-size: 40px;
}

#screen-copy,
.pause-panel p:last-child {
  margin: 16px auto 0;
  max-width: 400px;
  color: #cbd5e1;
  font-size: 14px;
  line-height: 1.6;
}

button {
  margin-top: 22px;
  border: 0;
  border-radius: 999px;
  padding: 13px 24px;
  background: #67e8f9;
  color: #07111a;
  font: inherit;
  font-size: 13px;
  font-weight: 1000;
  cursor: pointer;
  box-shadow: 0 12px 34px rgba(34, 211, 238, 0.24);
  transition: transform 150ms ease, background-color 150ms ease;
}

button:hover {
  transform: translateY(-2px);
  background: #fff;
}

button:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 4px;
}

.controls-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 22px;
}

.controls-grid p {
  display: grid;
  gap: 3px;
  margin: 0;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 12px;
  padding: 9px;
  background: rgba(255, 255, 255, 0.035);
  font-size: 10px;
}

.controls-grid strong {
  color: #f8fafc;
  text-transform: uppercase;
}

.controls-grid span {
  color: #94a3b8;
}

@media (max-width: 560px), (max-height: 430px) {
  .hud {
    inset: 7px 7px auto;
  }

  .hud-group {
    gap: 4px;
  }

  .hud-pill {
    padding: 6px 8px;
    font-size: 8px;
  }

  .hud-pill strong {
    font-size: 10px;
  }

  .status-panel {
    padding: 7px 9px;
  }

  .status-row {
    font-size: 7px;
  }

  .panel {
    padding: 18px 22px;
  }

  .controls-grid {
    margin-top: 14px;
  }
}

@media (max-height: 350px) {
  #screen-copy {
    margin-top: 10px;
    font-size: 12px;
  }

  button {
    margin-top: 12px;
    padding-block: 10px;
  }

  .controls-grid {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}
