:root {
  --bg: #081226;
  --panel: #101e36;
  --accent: #84f4d0;
  --accent-text: #05231f;
  --muted: #b8c8de;
  --page-glow: rgba(116, 238, 211, 0.17);
}

body {
  background:
    radial-gradient(circle at 12% 6%, rgba(87, 216, 211, 0.18), transparent 25rem),
    radial-gradient(circle at 86% 12%, rgba(190, 132, 255, 0.13), transparent 23rem),
    linear-gradient(180deg, #0a1730, #050a17);
}

.stage,
.side-panel,
.camera-card,
.control-card {
  border-color: rgba(179, 223, 255, 0.16);
  background: rgba(11, 24, 44, 0.9);
}

.stage {
  aspect-ratio: 25 / 16;
  min-height: 0;
  box-shadow:
    0 0 0 1px rgba(132, 244, 208, 0.025),
    0 30px 85px rgba(0, 0, 0, 0.32);
}

#game-canvas {
  min-height: 0;
  background: #071127;
  cursor: pointer;
  outline: none;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

#game-canvas:focus-visible {
  box-shadow: inset 0 0 0 3px rgba(132, 244, 208, 0.66);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.hop-hud {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.55rem;
  padding: 0.75rem;
  color: #fff;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.hop-hud__stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.hop-stat {
  min-width: 4.7rem;
  border: 1px solid rgba(211, 236, 255, 0.17);
  border-radius: 8px;
  background: rgba(4, 13, 31, 0.7);
  padding: 0.42rem 0.62rem;
  backdrop-filter: blur(8px);
}

.hop-stat small {
  display: block;
  color: #9eb4ce;
  font-size: 0.58rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.hop-stat strong {
  display: block;
  margin-top: 0.08rem;
  font-size: clamp(0.84rem, 1.7vw, 1.06rem);
  letter-spacing: 0.02em;
}

.hop-stat--combo strong {
  color: #ffe89d;
}

.hud-restart {
  min-height: 2.35rem;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: rgba(5, 15, 34, 0.72);
  color: #dcecff;
  cursor: pointer;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  padding: 0 0.72rem;
  pointer-events: auto;
  text-transform: uppercase;
}

.hud-restart:hover {
  border-color: rgba(132, 244, 208, 0.55);
  color: #fff;
}

.charge-panel {
  position: absolute;
  right: 0.8rem;
  bottom: 0.75rem;
  left: 0.8rem;
  border: 1px solid rgba(207, 235, 255, 0.17);
  border-radius: 8px;
  background: rgba(5, 15, 34, 0.78);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.2);
  padding: 0.62rem 0.75rem 0.58rem;
  backdrop-filter: blur(9px);
}

.charge-panel__copy {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  margin-bottom: 0.45rem;
  color: #eaf5ff;
  font-size: clamp(0.66rem, 1.35vw, 0.82rem);
  font-weight: 900;
}

.charge-panel__state[data-tone="charging"] {
  color: #ffe58e;
}

.charge-panel__state[data-tone="air"] {
  color: #a5e8ff;
}

.charge-panel__state[data-tone="perfect"] {
  color: #96ffd9;
}

.charge-panel__state[data-tone="danger"] {
  color: #ff9daf;
}

.charge-panel__target {
  color: #aac0d8;
  text-align: right;
}

.charge-track {
  position: relative;
  height: 0.68rem;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.09);
}

.charge-zone,
.charge-perfect-zone,
.charge-fill,
.charge-ideal {
  position: absolute;
  top: 0;
  bottom: 0;
}

.charge-zone {
  z-index: 1;
  border-radius: 999px;
  background: rgba(88, 221, 185, 0.18);
}

.charge-perfect-zone {
  z-index: 2;
  background: rgba(255, 229, 126, 0.34);
}

.charge-fill {
  left: 0;
  z-index: 3;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #56cfe1, #8fffcf 58%, #ffe584 82%, #ff819a);
  box-shadow: 0 0 14px rgba(116, 238, 211, 0.35);
  transition: width 35ms linear;
}

.charge-ideal {
  z-index: 4;
  width: 2px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 0 7px #fff;
}

.charge-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 0.28rem;
  color: #718ba7;
  font-size: 0.54rem;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.overlay-card {
  width: min(470px, calc(100% - 1.4rem));
  border-color: rgba(132, 244, 208, 0.27);
  background: rgba(6, 15, 33, 0.94);
  backdrop-filter: blur(12px);
}

.overlay-card h1,
.overlay-card h2 {
  color: #f7fbff;
}

.overlay-card .eyebrow {
  margin: 0 0 0.42rem;
  color: #87f4d1;
  font-size: 0.67rem;
  font-weight: 900;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.how-to {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.45rem;
  margin: 1rem 0;
}

.how-to span,
.result-grid > div {
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
  padding: 0.58rem 0.35rem;
}

.how-to small,
.result-grid small {
  display: block;
  color: #8fa7c1;
  font-size: 0.58rem;
  font-weight: 900;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.how-to strong,
.result-grid strong {
  display: block;
  margin-top: 0.2rem;
  color: #f6fbff;
  font-size: 0.82rem;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.45rem;
  margin: 1rem 0;
}

.overlay-note {
  margin-top: 0.75rem !important;
  margin-bottom: 0 !important;
  font-size: 0.78rem;
  opacity: 0.78;
}

.overlay-button:focus-visible,
.hud-restart:focus-visible,
.home-link:focus-visible {
  outline: 3px solid rgba(132, 244, 208, 0.58);
  outline-offset: 3px;
}

.control-note {
  margin-bottom: 0 !important;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 0.8rem;
  font-size: 0.81rem;
}

@media (max-width: 980px) {
  .stage {
    min-height: 0;
  }
}

@media (max-width: 620px) {
  .stage {
    aspect-ratio: auto;
    min-height: min(500px, calc(100svh - 1rem));
  }

  #game-canvas {
    min-height: 0;
  }

  .hop-hud {
    padding: 0.42rem;
  }

  .hop-hud__stats {
    gap: 0.25rem;
  }

  .hop-stat {
    min-width: 3.7rem;
    padding: 0.3rem 0.4rem;
  }

  .hop-stat small {
    font-size: 0.49rem;
  }

  .hud-restart {
    min-height: 2rem;
    padding-inline: 0.48rem;
  }

  .charge-panel {
    right: 0.45rem;
    bottom: 0.42rem;
    left: 0.45rem;
    padding: 0.46rem 0.52rem;
  }

  .charge-panel__copy {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.18rem;
  }

  .charge-panel__target {
    text-align: left;
  }

  .overlay-card {
    max-height: calc(100% - 1rem);
    overflow-y: auto;
    padding: 1rem;
    overscroll-behavior: contain;
  }

  .overlay-card p {
    font-size: 0.84rem;
  }

  .how-to {
    gap: 0.25rem;
    margin: 0.72rem 0;
  }

  .how-to span {
    padding-inline: 0.18rem;
  }
}

@media (max-width: 390px) {
  .hop-stat--best {
    display: none;
  }

  .how-to strong {
    font-size: 0.7rem;
  }
}
