:root {
  color-scheme: dark;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #06080d;
  color: #f7fbff;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: none;
}

button {
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 8px;
  background: #f6f7f8;
  color: #081018;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  min-height: 44px;
  padding: 0 18px;
}

button:hover,
button:focus-visible {
  background: #ffffff;
  outline: 2px solid #5fc7ff;
  outline-offset: 2px;
}

#game {
  display: block;
  width: 100vw;
  height: 100vh;
  background: #06080d;
  touch-action: none;
}

.hud {
  position: fixed;
  top: 14px;
  left: 50%;
  z-index: 3;
  display: grid;
  grid-template-columns: repeat(5, minmax(70px, 1fr));
  gap: 8px;
  width: min(680px, calc(100vw - 24px));
  transform: translateX(-50%);
  pointer-events: none;
}

.hud__stat {
  min-height: 50px;
  padding: 8px 10px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: rgba(5, 9, 15, 0.7);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07);
  backdrop-filter: blur(12px);
}

.hud__stat span {
  display: block;
  color: #9fb3c6;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.hud__stat strong {
  display: block;
  color: #f9fcff;
  font-size: clamp(18px, 3vw, 25px);
  line-height: 1.1;
}

.reticle {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 2;
  width: 20px;
  height: 20px;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.reticle::before,
.reticle::after {
  position: absolute;
  content: "";
  background: rgba(245, 254, 255, 0.86);
  box-shadow: 0 0 10px rgba(95, 199, 255, 0.9);
}

.reticle::before {
  top: 9px;
  left: 0;
  width: 20px;
  height: 2px;
}

.reticle::after {
  top: 0;
  left: 9px;
  width: 2px;
  height: 20px;
}

.damage {
  position: fixed;
  inset: 0;
  z-index: 2;
  background: radial-gradient(circle, transparent 46%, rgba(255, 35, 35, 0.52) 100%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
}

.damage.is-visible {
  opacity: 1;
}

.touch-controls {
  position: fixed;
  right: 18px;
  bottom: 18px;
  left: 18px;
  z-index: 3;
  display: none;
  align-items: end;
  justify-content: space-between;
  pointer-events: none;
}

.touch-pad {
  position: relative;
  width: 132px;
  height: 132px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 50%;
  background: rgba(5, 9, 15, 0.48);
  box-shadow:
    inset 0 0 24px rgba(255, 255, 255, 0.05),
    0 12px 36px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(10px);
  pointer-events: auto;
  touch-action: none;
}

.touch-pad__stick {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: rgba(246, 247, 248, 0.82);
  box-shadow: 0 0 18px rgba(95, 199, 255, 0.42);
  transform: translate(-50%, -50%);
}

.touch-actions {
  display: grid;
  grid-template-columns: 78px 96px;
  gap: 10px;
  align-items: end;
  pointer-events: auto;
}

.touch-button {
  min-width: 0;
  min-height: 62px;
  padding: 0 14px;
  border-radius: 8px;
  background: rgba(246, 247, 248, 0.9);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.34);
}

.touch-button--secondary {
  background: rgba(15, 22, 30, 0.78);
  color: #f7fbff;
}

.intro,
.game-over {
  position: fixed;
  inset: 0;
  z-index: 4;
  display: grid;
  grid-template-columns: minmax(280px, 0.86fr) minmax(260px, 1.14fr);
  gap: clamp(20px, 4vw, 52px);
  align-items: center;
  padding: clamp(22px, 5vw, 72px);
  background:
    linear-gradient(90deg, rgba(6, 8, 13, 0.98), rgba(6, 8, 13, 0.72) 52%, rgba(6, 8, 13, 0.9)),
    radial-gradient(circle at 72% 44%, rgba(134, 40, 44, 0.26), transparent 36%),
    #06080d;
}

.intro[hidden],
.game-over[hidden] {
  display: none;
}

.intro__copy {
  max-width: 620px;
}

.eyebrow {
  margin: 0 0 10px;
  color: #78d9ff;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  font-size: clamp(44px, 9vw, 112px);
  line-height: 0.9;
  letter-spacing: 0;
}

h2 {
  font-size: clamp(38px, 7vw, 82px);
}

.intro p:not(.eyebrow),
.game-over p:not(.eyebrow) {
  max-width: 54ch;
  margin: 18px 0 24px;
  color: #d5e0eb;
  font-size: clamp(16px, 2vw, 20px);
  line-height: 1.55;
}

.intro__reference {
  align-self: stretch;
  min-height: 360px;
  margin: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: #252a2f;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.46);
}

.intro__reference img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.game-over {
  grid-template-columns: minmax(280px, 620px);
  justify-content: center;
  text-align: center;
}

.game-over button {
  justify-self: center;
}

@media (max-width: 760px) {
  .hud {
    top: 8px;
    grid-template-columns: repeat(3, minmax(72px, 1fr));
  }

  .hud__stat {
    min-height: 44px;
    padding: 7px 8px;
  }

  .intro {
    grid-template-columns: 1fr;
    align-content: center;
    gap: 14px;
    padding: 18px;
  }

  .intro__reference {
    min-height: 220px;
    max-height: 36vh;
    order: -1;
  }
}

@media (pointer: coarse) {
  .touch-controls {
    display: flex;
  }
}

@media (max-width: 560px) {
  .hud {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 5px;
    width: calc(100vw - 12px);
  }

  .hud__stat {
    min-height: 42px;
    padding: 6px 5px;
  }

  .hud__stat span {
    font-size: 9px;
  }

  .hud__stat strong {
    font-size: 17px;
  }

  .intro,
  .game-over {
    padding: 14px;
  }

  h1,
  h2 {
    font-size: clamp(36px, 15vw, 62px);
  }

  .intro p:not(.eyebrow),
  .game-over p:not(.eyebrow) {
    margin: 12px 0 16px;
    font-size: 15px;
    line-height: 1.42;
  }

  .intro__reference {
    min-height: 190px;
    max-height: 30vh;
  }

  .touch-controls {
    right: 12px;
    bottom: max(12px, env(safe-area-inset-bottom));
    left: 12px;
  }

  .touch-pad {
    width: 116px;
    height: 116px;
  }

  .touch-pad__stick {
    width: 48px;
    height: 48px;
  }

  .touch-actions {
    grid-template-columns: 68px 84px;
    gap: 8px;
  }

  .touch-button {
    min-height: 56px;
    padding: 0 8px;
    font-size: 13px;
  }
}
