:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #080a12;
  color: #f5f7fb;
}

* {
  box-sizing: border-box;
}

html,
body,
#app {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  background:
    radial-gradient(circle at 22% 18%, rgba(43, 187, 255, 0.18), transparent 24rem),
    radial-gradient(circle at 78% 72%, rgba(255, 72, 173, 0.14), transparent 22rem),
    #080a12;
}

#app {
  position: relative;
}

#game-canvas {
  position: fixed;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

#hud {
  position: fixed;
  top: 16px;
  left: 16px;
  right: 16px;
  z-index: 3;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  max-width: 720px;
  pointer-events: none;
}

.hud-block {
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid rgba(180, 223, 255, 0.24);
  background: rgba(8, 10, 18, 0.58);
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(14px);
  border-radius: 8px;
}

.hud-label {
  display: block;
  color: #8fb8d8;
  font-size: 11px;
  letter-spacing: 0;
}

.hud-block strong {
  display: block;
  margin-top: 3px;
  font-size: 18px;
  line-height: 1;
  color: #ffffff;
}

#meter {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 18px;
  z-index: 3;
  height: 10px;
  border: 1px solid rgba(146, 207, 255, 0.24);
  background: rgba(8, 10, 18, 0.5);
  border-radius: 999px;
  overflow: hidden;
  pointer-events: none;
}

#xp {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #53d5ff, #ffe66b, #ff5daf);
  box-shadow: 0 0 20px rgba(83, 213, 255, 0.48);
  transition: width 160ms ease;
}

.panel {
  position: fixed;
  left: 50%;
  top: 50%;
  z-index: 4;
  width: min(460px, calc(100vw - 32px));
  transform: translate(-50%, -50%);
  padding: 28px;
  border: 1px solid rgba(177, 221, 255, 0.25);
  border-radius: 8px;
  background: rgba(7, 10, 18, 0.74);
  box-shadow: 0 26px 80px rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(18px);
  text-align: center;
}

.panel.hidden {
  display: none;
}

.panel h1,
.panel h2 {
  margin: 0;
  font-size: clamp(36px, 8vw, 68px);
  line-height: 0.92;
  letter-spacing: 0;
}

.panel h2 {
  font-size: clamp(32px, 7vw, 56px);
}

.panel p {
  margin: 16px auto 22px;
  max-width: 34ch;
  color: #b7c7d8;
  font-size: 15px;
  line-height: 1.5;
}

.panel button {
  width: min(100%, 220px);
  height: 46px;
  border: 0;
  border-radius: 8px;
  background: linear-gradient(135deg, #4ee4ff, #ffe66b 52%, #ff62bb);
  color: #10131d;
  font-weight: 800;
  letter-spacing: 0;
  cursor: pointer;
  box-shadow: 0 14px 40px rgba(83, 213, 255, 0.25);
}

.panel button:focus-visible {
  outline: 3px solid rgba(255, 255, 255, 0.8);
  outline-offset: 3px;
}

#final-score {
  color: #ffffff;
  font-size: 22px;
  font-weight: 700;
}

#touch-stick {
  position: fixed;
  left: 22px;
  bottom: 42px;
  z-index: 3;
  width: 92px;
  height: 92px;
  border: 1px solid rgba(196, 226, 255, 0.18);
  border-radius: 50%;
  background: rgba(12, 16, 26, 0.2);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
}

#touch-stick.active {
  opacity: 1;
}

#touch-stick span {
  position: absolute;
  left: 31px;
  top: 31px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 0 24px rgba(83, 213, 255, 0.5);
}

@media (max-width: 680px) {
  #hud {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    top: 10px;
    left: 10px;
    right: 10px;
  }

  .hud-block {
    padding: 8px 9px;
  }

  .panel {
    padding: 24px 20px;
  }
}
