@import url("https://fonts.googleapis.com/css2?family=Sniglet:wght@400;800&display=swap");

:root {
  color-scheme: dark;
  --font-main: "Sniglet", Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-family: var(--font-main);
  background: #020006;
  --cyan: #35f6ff;
  --pink: #ff2eea;
  --lime: #7dff49;
  --gold: #ffe044;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

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

body {
  background:
    radial-gradient(circle at 50% 30%, rgba(255, 46, 234, 0.28), transparent 25%),
    radial-gradient(circle at 82% 24%, rgba(53, 246, 255, 0.22), transparent 24%),
    radial-gradient(circle at 18% 80%, rgba(255, 224, 68, 0.14), transparent 25%),
    linear-gradient(135deg, #030009 0%, #13002e 45%, #00030a 100%);
}

body::before,
body::after {
  position: fixed;
  inset: -20%;
  z-index: 0;
  pointer-events: none;
  content: "";
  opacity: 0.46;
  background:
    repeating-linear-gradient(62deg, transparent 0 28px, rgba(53, 246, 255, 0.11) 29px, transparent 31px),
    repeating-linear-gradient(-38deg, transparent 0 42px, rgba(255, 46, 234, 0.1) 43px, transparent 45px);
  filter: blur(0.2px);
  animation: energy-pan 12s linear infinite;
}

body::after {
  opacity: 0.22;
  transform: scale(1.2) rotate(12deg);
  animation-duration: 19s;
  animation-direction: reverse;
}

@keyframes energy-pan {
  from {
    transform: translate3d(-3%, -2%, 0) rotate(0deg);
  }
  to {
    transform: translate3d(3%, 2%, 0) rotate(360deg);
  }
}

.app {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: 0;
}

.game-shell {
  position: relative;
  width: min(100vw, calc(100vh * 9 / 16), 520px);
  height: min(100vh, calc(100vw * 16 / 9));
  max-height: 100vh;
  overflow: hidden;
  background: #030009;
  box-shadow:
    0 0 60px rgba(53, 246, 255, 0.24),
    0 0 120px rgba(255, 46, 234, 0.2),
    inset 0 0 48px rgba(255, 255, 255, 0.05);
}

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

.hud {
  position: absolute;
  top: max(12px, env(safe-area-inset-top));
  left: 0;
  right: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  pointer-events: none;
}

.score {
  justify-self: center;
  min-width: 92px;
  padding: 7px 14px;
  color: white;
  font-size: clamp(22px, 4.8vh, 34px);
  font-weight: 800;
  line-height: 1;
  text-align: center;
  text-shadow:
    0 0 4px rgba(255, 255, 255, 0.45),
    0 0 10px rgba(53, 246, 255, 0.45),
    0 0 18px rgba(255, 46, 234, 0.38);
}

.level-mark {
  justify-self: start;
  display: grid;
  min-width: 0;
  height: auto;
  padding: 0;
  place-items: center;
  color: #fff;
  font-size: clamp(18px, 3.8vh, 26px);
  font-weight: 900;
  line-height: 1;
  background: transparent;
  box-shadow: none;
  text-shadow:
    0 0 5px rgba(255, 255, 255, 0.46),
    0 0 12px rgba(53, 246, 255, 0.34);
}

.lives {
  position: absolute;
  top: max(12px, env(safe-area-inset-top));
  right: 8px;
  justify-self: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  min-width: 18px;
  min-height: 0;
  padding-right: 0;
}

.life {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 32% 28%, #ffffff 0 16%, #d8ecff 21%, #9ea8c7 42%, #4b516c 68%, #111525 100%);
  box-shadow:
    inset -3px -4px 6px rgba(0, 0, 0, 0.5),
    0 0 7px rgba(255, 255, 255, 0.42);
}

.screen {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
  background: radial-gradient(circle at 50% 58%, rgba(255, 46, 234, 0.16), transparent 34%);
}

.start-screen {
  justify-content: flex-start;
  gap: 14px;
  padding: max(48px, 8vh, env(safe-area-inset-top)) 0 24px;
  background:
    radial-gradient(circle at 50% 22%, rgba(255, 46, 234, 0.13), transparent 30%),
    linear-gradient(180deg, rgba(3, 0, 9, 0.28) 0%, rgba(3, 0, 9, 0.06) 42%, rgba(3, 0, 9, 0) 100%);
}

.logo {
  position: relative;
  display: grid;
  gap: 0;
  color: white;
  font-size: clamp(42px, 9vh, 76px);
  font-weight: 1000;
  line-height: 0.82;
  letter-spacing: 0;
  text-align: center;
  filter: drop-shadow(0 0 9px rgba(53, 246, 255, 0.48)) drop-shadow(0 0 18px rgba(255, 46, 234, 0.38));
}

.logo span {
  display: block;
  transform: skew(-7deg);
  text-shadow:
    1px 1px 0 rgba(255, 255, 255, 0.45),
    -2px 0 0 rgba(53, 246, 255, 0.44),
    2px 0 0 rgba(255, 46, 234, 0.44);
  clip-path: polygon(0 8%, 22% 2%, 26% 20%, 39% 5%, 47% 18%, 60% 0, 67% 16%, 80% 4%, 100% 12%, 96% 100%, 75% 94%, 67% 100%, 49% 91%, 43% 100%, 24% 92%, 15% 100%, 0 92%);
}

.play-button,
.resume-button,
.restart-button {
  display: grid;
  width: 92px;
  height: 92px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 50%;
  color: white;
  background:
    radial-gradient(circle, rgba(255, 255, 255, 0.86) 0 5%, transparent 7%),
    radial-gradient(circle at 50% 50%, rgba(53, 246, 255, 0.36), rgba(255, 46, 234, 0.24) 58%, transparent 70%);
  box-shadow:
    0 0 24px rgba(53, 246, 255, 0.9),
    0 0 60px rgba(255, 46, 234, 0.6),
    inset 0 0 24px rgba(255, 255, 255, 0.2);
}

.play-button::before,
.resume-button::before {
  display: none;
  width: 34px;
  height: 42px;
  margin-left: 8px;
  background: #030009;
  border: 0;
  clip-path: polygon(0 0, 100% 50%, 0 100%);
  filter: none;
  content: "";
}

.play-button,
.resume-button {
  background: #fff;
  border: 0;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cpath fill='black' fill-rule='evenodd' d='M50 0a50 50 0 1 1 0 100A50 50 0 0 1 50 0ZM38 29v42l31-21-31-21Z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cpath fill='black' fill-rule='evenodd' d='M50 0a50 50 0 1 1 0 100A50 50 0 0 1 50 0ZM38 29v42l31-21-31-21Z'/%3E%3C/svg%3E") center / contain no-repeat;
  filter:
    drop-shadow(0 0 14px rgba(255, 255, 255, 0.9))
    drop-shadow(0 0 34px rgba(53, 246, 255, 0.62))
    drop-shadow(0 0 56px rgba(255, 46, 234, 0.42));
  box-shadow:
    0 0 28px rgba(255, 255, 255, 0.95),
    0 0 72px rgba(53, 246, 255, 0.72),
    0 0 116px rgba(255, 46, 234, 0.48),
    inset 0 0 14px rgba(255, 255, 255, 0.75);
}

.restart-button {
  font-size: 36px;
}

.pause-logo {
  font-size: clamp(34px, 7vh, 62px);
}

.restart-button {
  color: #030009;
  background: #fff;
  border: 0;
  filter:
    drop-shadow(0 0 14px rgba(255, 255, 255, 0.82))
    drop-shadow(0 0 32px rgba(53, 246, 255, 0.52))
    drop-shadow(0 0 52px rgba(255, 46, 234, 0.34));
  box-shadow:
    0 0 26px rgba(255, 255, 255, 0.82),
    0 0 64px rgba(53, 246, 255, 0.55),
    inset 0 0 14px rgba(255, 255, 255, 0.72);
}

.start-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
}

.icon-button {
  width: 44px;
  height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 50%;
  background: rgba(5, 10, 26, 0.62);
  box-shadow: 0 0 18px rgba(53, 246, 255, 0.42);
}

.icon-button::before {
  display: block;
  color: #fff;
  font-size: 21px;
  line-height: 40px;
  text-align: center;
  content: "🔊";
}

.icon-button.muted::before {
  content: "🔇";
}

.message-layer {
  position: absolute;
  inset: 0;
  z-index: 9;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: clamp(38px, 9vh, 82px);
  font-weight: 1000;
  text-align: center;
  text-shadow:
    0 0 6px rgba(255, 255, 255, 0.5),
    0 0 16px rgba(53, 246, 255, 0.48),
    0 0 32px rgba(255, 46, 234, 0.4);
  pointer-events: none;
}

.pause-title,
.game-over-title,
.complete-title {
  color: #fff;
  font-size: clamp(40px, 8vh, 74px);
  font-weight: 1000;
  text-shadow:
    0 0 8px rgba(255, 255, 255, 0.48),
    0 0 20px rgba(255, 46, 234, 0.45);
}

.final-score {
  color: white;
  font-size: clamp(28px, 6vh, 48px);
  font-weight: 900;
  text-shadow: 0 0 13px rgba(53, 246, 255, 0.45);
}

.orientation-warning {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 32px;
  color: white;
  font-size: 30px;
  font-weight: 1000;
  text-align: center;
  background: rgba(1, 0, 5, 0.94);
  text-shadow: 0 0 12px rgba(53, 246, 255, 0.48);
}

.hidden {
  display: none !important;
}

button {
  cursor: pointer;
}

@media (orientation: landscape) and (max-height: 620px) and (pointer: coarse) {
  .orientation-warning {
    display: grid !important;
  }
}
