* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  width: 100%;
  min-height: 100%;
}

body {
  min-height: 100vh;
  font-family: Arial, Helvetica, sans-serif;
  background:
    radial-gradient(circle at top, #1d1b4f 0%, #080816 45%, #020206 100%);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-x: hidden;
  touch-action: manipulation;
}

/* Loading Screen */

.loading-screen {
  position: fixed;
  inset: 0;
  z-index: 50;
  background:
    radial-gradient(circle at top, #171759 0%, #050514 55%, #020206 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  text-align: center;
  transition: opacity 0.35s ease, visibility 0.35s ease;
}

.loading-screen.hidden {
  opacity: 0;
  visibility: hidden;
}

.loading-screen h1 {
  font-size: clamp(42px, 8vw, 82px);
  color: #00f7ff;
  letter-spacing: 3px;
  text-shadow:
    0 0 12px #00f7ff,
    0 0 35px #ff4ffd;
}

.loading-screen p {
  color: rgba(255, 255, 255, 0.8);
  font-weight: bold;
}

.loading-bar {
  width: min(320px, 70vw);
  height: 12px;
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid rgba(0, 247, 255, 0.7);
  background: rgba(255, 255, 255, 0.08);
}

.loading-fill {
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, #00f7ff, #ff4ffd, #fff36b);
  animation: loadingPulse 1.2s ease-in-out infinite;
}

@keyframes loadingPulse {
  0% {
    transform: translateX(-100%);
  }

  100% {
    transform: translateX(100%);
  }
}

/* Layout */

.game-shell {
  width: min(96vw, 1080px);
  padding: 16px;
}

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.title-block h1 {
  font-size: clamp(28px, 5vw, 52px);
  letter-spacing: 2px;
  color: #00f7ff;
  text-shadow:
    0 0 8px #00f7ff,
    0 0 22px #0077ff;
}

.title-block p {
  color: #ff4ffd;
  font-weight: bold;
  letter-spacing: 1px;
}

.score-panel {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(0, 247, 255, 0.45);
  border-radius: 16px;
  padding: 10px 14px;
  min-width: 150px;
  text-align: right;
  box-shadow: 0 0 22px rgba(0, 247, 255, 0.18);
  font-size: 17px;
  line-height: 1.45;
}

.score-panel span {
  color: #fff36b;
  font-weight: bold;
}

.control-row {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-bottom: 12px;
}

/* Buttons */

button {
  cursor: pointer;
  border: none;
  border-radius: 999px;
  font-weight: bold;
  letter-spacing: 1px;
  color: #050514;
  background: linear-gradient(135deg, #00f7ff, #ff4ffd);
  box-shadow:
    0 0 14px rgba(0, 247, 255, 0.7),
    0 0 26px rgba(255, 79, 253, 0.35);
  transition: transform 0.12s ease, filter 0.12s ease;
}

button:hover {
  transform: scale(1.04);
  filter: brightness(1.12);
}

button:active {
  transform: scale(0.96);
}

.small-button {
  padding: 9px 15px;
  font-size: 14px;
}

.main-button {
  padding: 15px 34px;
  font-size: 19px;
}

/* Game Canvas */

.canvas-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 24px;
  overflow: hidden;
  border: 2px solid rgba(0, 247, 255, 0.8);
  box-shadow:
    0 0 18px rgba(0, 247, 255, 0.7),
    0 0 45px rgba(255, 79, 253, 0.25);
  background: #050514;
}

.canvas-wrap.shake {
  animation: shake 0.22s linear;
}

@keyframes shake {
  0% {
    transform: translate(0, 0);
  }

  20% {
    transform: translate(-7px, 4px);
  }

  40% {
    transform: translate(7px, -4px);
  }

  60% {
    transform: translate(-5px, -3px);
  }

  80% {
    transform: translate(5px, 3px);
  }

  100% {
    transform: translate(0, 0);
  }
}

canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* Menus */

.message-box {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  text-align: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.58);
  backdrop-filter: blur(6px);
}

.message-box.hidden {
  display: none;
}

.message-box h2 {
  font-size: clamp(38px, 7vw, 74px);
  color: #00f7ff;
  text-shadow:
    0 0 10px #00f7ff,
    0 0 30px #ff4ffd;
}

.subtitle {
  max-width: 660px;
  font-size: clamp(16px, 2.8vw, 22px);
  color: #ffffff;
}

.menu-card {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 18px;
  padding: 12px;
}

.menu-label {
  font-weight: bold;
  margin-bottom: 9px;
  color: #fff36b;
}

.skin-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.skin-button {
  padding: 9px 14px;
  font-size: 13px;
  background: rgba(255, 255, 255, 0.16);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow: none;
}

.skin-button.active {
  background: linear-gradient(135deg, #00f7ff, #fff36b);
  color: #050514;
}

.menu-tip {
  color: rgba(255, 255, 255, 0.75);
  font-size: 14px;
}

.paused-label {
  color: #fff36b;
}

/* Tap Button */

.tap-button {
  width: 100%;
  margin-top: 14px;
  padding: 18px;
  font-size: 22px;
}

.instructions {
  margin-top: 10px;
  color: rgba(255, 255, 255, 0.72);
  text-align: center;
  font-size: 14px;
}

.instructions p {
  margin: 3px 0;
}

/* Mobile */

@media (max-width: 650px) {
  body {
    align-items: flex-start;
  }

  .game-shell {
    width: 100vw;
    padding: 10px;
  }

  .top-bar {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
    gap: 8px;
  }

  .title-block h1 {
    font-size: 34px;
  }

  .score-panel {
    display: flex;
    justify-content: space-around;
    text-align: center;
    font-size: 15px;
    min-width: unset;
  }

  .control-row {
    justify-content: center;
  }

  .canvas-wrap {
    border-radius: 18px;
    aspect-ratio: 16 / 10;
  }

  .message-box {
    padding: 16px;
    gap: 10px;
  }

  .message-box h2 {
    font-size: 42px;
  }

  .subtitle {
    font-size: 15px;
  }

  .tap-button {
    padding: 20px;
    font-size: 24px;
  }

  .instructions {
    font-size: 13px;
  }
}

@media (max-height: 620px) {
  .title-block h1 {
    font-size: 28px;
  }

  .title-block p {
    display: none;
  }

  .tap-button {
    padding: 13px;
  }

  .instructions {
    display: none;
  }
}