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

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  min-height: 100%;
  overflow: hidden;
  font-family: Arial, Helvetica, sans-serif;
  background:
    radial-gradient(circle at top, #1d4ed8 0%, #020617 45%, #000 100%);
  color: #fff;
  touch-action: none;
}

#gameShell {
  width: 100vw;
  height: 100vh;
  max-width: 540px;
  margin: 0 auto;
  padding: env(safe-area-inset-top) 12px env(safe-area-inset-bottom);
  display: flex;
  flex-direction: column;
  gap: 10px;
  background:
    linear-gradient(180deg, rgba(37,99,235,0.22), rgba(0,0,0,0.15)),
    #020617;
  position: relative;
}

.topHud {
  height: 72px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding-top: 8px;
  flex-shrink: 0;
}

.hudCard {
  background: rgba(15, 23, 42, 0.92);
  border: 1px solid rgba(96, 165, 250, 0.35);
  border-radius: 16px;
  padding: 9px 8px;
  text-align: center;
  box-shadow: 0 8px 25px rgba(0,0,0,0.28);
}

.hudCard span {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #93c5fd;
  margin-bottom: 3px;
}

.hudCard strong {
  display: block;
  font-size: 22px;
  line-height: 1;
  color: #fff;
}

.gameFrame {
  position: relative;
  flex: 1;
  min-height: 0;
  border-radius: 24px;
  overflow: hidden;
  background: #111827;
  border: 2px solid rgba(96,165,250,0.45);
  box-shadow:
    0 18px 55px rgba(0,0,0,0.55),
    inset 0 0 0 1px rgba(255,255,255,0.05);
}

canvas {
  width: 100%;
  height: 100%;
  display: block;
  background: #111827;
}

.overlayScreen {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at top, rgba(59,130,246,0.45), rgba(2,6,23,0.92) 48%, rgba(0,0,0,0.96) 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
  z-index: 10;
}

.hidden {
  display: none;
}

.gameLogo {
  font-size: clamp(36px, 10vw, 62px);
  font-weight: 900;
  line-height: 0.9;
  letter-spacing: -2px;
  color: #fff;
  text-shadow:
    0 0 18px rgba(59,130,246,0.8),
    0 8px 0 rgba(0,0,0,0.35);
}

.gameSubLogo {
  font-size: clamp(32px, 9vw, 56px);
  font-weight: 900;
  line-height: 1;
  margin-bottom: 12px;
  color: #facc15;
  text-shadow:
    0 0 18px rgba(250,204,21,0.7),
    0 7px 0 rgba(0,0,0,0.35);
}

.gameLogo.danger {
  color: #fb7185;
  text-shadow:
    0 0 18px rgba(244,63,94,0.8),
    0 8px 0 rgba(0,0,0,0.35);
}

.overlayScreen p {
  max-width: 320px;
  font-size: 15px;
  line-height: 1.5;
  color: #dbeafe;
  margin: 14px 0 22px;
}

.mainBtn {
  border: 0;
  border-radius: 999px;
  padding: 15px 34px;
  font-size: 18px;
  font-weight: 800;
  color: #06111f;
  background: linear-gradient(180deg, #facc15, #f97316);
  box-shadow:
    0 12px 0 #9a3412,
    0 20px 35px rgba(0,0,0,0.35);
  cursor: pointer;
  text-transform: uppercase;
}

.mainBtn:active {
  transform: translateY(6px);
  box-shadow:
    0 6px 0 #9a3412,
    0 12px 25px rgba(0,0,0,0.35);
}

.miniHelp {
  margin-top: 24px;
  font-size: 12px;
  color: #93c5fd;
  background: rgba(15,23,42,0.7);
  border: 1px solid rgba(147,197,253,0.22);
  padding: 10px 14px;
  border-radius: 999px;
}

.finalScore {
  font-size: 58px;
  font-weight: 900;
  color: #facc15;
  margin: -8px 0 18px;
  text-shadow: 0 0 18px rgba(250,204,21,0.75);
}

.bottomControls {
  height: 78px;
  display: grid;
  grid-template-columns: 1fr 86px 1fr;
  gap: 10px;
  flex-shrink: 0;
  padding-bottom: 8px;
}

.controlBtn {
  border: 0;
  border-radius: 22px;
  color: #fff;
  font-size: 36px;
  font-weight: 900;
  background:
    linear-gradient(180deg, rgba(37,99,235,1), rgba(30,64,175,1));
  box-shadow:
    0 9px 0 #1e3a8a,
    0 16px 28px rgba(0,0,0,0.4);
  cursor: pointer;
}

.controlBtn:active {
  transform: translateY(5px);
  box-shadow:
    0 4px 0 #1e3a8a,
    0 10px 20px rgba(0,0,0,0.35);
}

.centerBtn {
  font-size: 28px;
  background:
    linear-gradient(180deg, rgba(15,23,42,1), rgba(2,6,23,1));
  box-shadow:
    0 9px 0 #000,
    0 16px 28px rgba(0,0,0,0.4);
}

@media (min-width: 768px) {
  body {
    background:
      radial-gradient(circle at center, #1e40af 0%, #020617 52%, #000 100%);
  }

  #gameShell {
    border-left: 1px solid rgba(96,165,250,0.18);
    border-right: 1px solid rgba(96,165,250,0.18);
  }
}

@media (max-height: 650px) {
  .topHud {
    height: 58px;
  }

  .hudCard {
    padding: 6px 8px;
    border-radius: 12px;
  }

  .hudCard strong {
    font-size: 18px;
  }

  .bottomControls {
    height: 62px;
  }

  .controlBtn {
    font-size: 28px;
    border-radius: 17px;
  }

  .gameLogo {
    font-size: 34px;
  }

  .gameSubLogo {
    font-size: 32px;
  }
}