* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: Arial, Helvetica, sans-serif;
  background: #bfe9ff;
}

body {
  touch-action: none;
}

#game {
  width: 100%;
  height: 100vh;
  position: relative;
  overflow: hidden;
}

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

/* =========================
   HUD
========================= */

.hud {
  position: absolute;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);

  width: min(650px, 94%);

  display: flex;
  justify-content: space-between;
  gap: 10px;

  z-index: 10;
  pointer-events: none;
}

.hud-box {
  min-width: 120px;

  padding: 10px 18px;

  border-radius: 14px;

  background: rgba(255, 255, 255, 0.88);

  backdrop-filter: blur(8px);

  text-align: center;

  box-shadow:
    0 5px 20px rgba(0, 0, 0, 0.15);
}

.hud-box span {
  display: block;

  color: #4d6370;

  font-size: 12px;

  margin-bottom: 3px;
}

.hud-box strong {
  font-size: 22px;

  color: #152a35;
}

/* =========================
   SCREENS
========================= */

.screen {
  position: absolute;
  inset: 0;

  z-index: 30;

  display: flex;
  align-items: center;
  justify-content: center;

  background: rgba(12, 49, 70, 0.30);

  backdrop-filter: blur(5px);
}

.hidden {
  display: none !important;
}

/* =========================
   PANEL
========================= */

.panel {
  width: min(430px, 90%);

  padding: 35px 25px;

  border-radius: 25px;

  background: rgba(255, 255, 255, 0.96);

  text-align: center;

  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.25);
}

.emoji {
  font-size: 60px;

  margin-bottom: 8px;
}

.panel h1 {
  color: #173746;

  font-size: 38px;

  margin-bottom: 10px;
}

.panel h2 {
  color: #173746;

  font-size: 34px;

  margin-bottom: 10px;
}

.panel p {
  color: #647985;

  margin-bottom: 18px;

  font-size: 16px;
}

/* =========================
   INSTRUCTIONS
========================= */

.controls {
  display: grid;

  grid-template-columns: 1fr 1fr;

  gap: 8px;

  margin: 20px 0;
}

.controls div {
  padding: 12px;

  background: #eef8fc;

  border-radius: 10px;

  color: #395765;

  font-size: 14px;
}

.controls div:last-child {
  grid-column: span 2;
}

/* =========================
   BUTTONS
========================= */

button {
  border: 0;

  cursor: pointer;

  font-family: inherit;

  -webkit-tap-highlight-color: transparent;
}

#startBtn,
#restartBtn {
  width: 100%;

  padding: 16px 25px;

  border-radius: 14px;

  background: #1677ff;

  color: white;

  font-size: 17px;

  font-weight: 800;

  box-shadow: 0 7px 0 #0759c8;

  transition: transform 0.15s ease;
}

#startBtn:hover,
#restartBtn:hover {
  transform: translateY(-2px);
}

#startBtn:active,
#restartBtn:active {
  transform: translateY(4px);

  box-shadow: 0 3px 0 #0759c8;
}

#finalScore {
  display: block;

  font-size: 48px;

  color: #1677ff;

  margin: 5px 0 12px;
}

/* =========================
   MOBILE CONTROLS
========================= */

.mobile-controls {
  position: absolute;

  bottom: 25px;

  left: 0;
  right: 0;

  display: none;

  justify-content: space-between;

  padding: 0 25px;

  z-index: 20;

  pointer-events: none;
}

.mobile-controls button {
  width: 70px;
  height: 70px;

  border-radius: 50%;

  background: rgba(255, 255, 255, 0.82);

  color: #173746;

  font-size: 28px;

  font-weight: bold;

  box-shadow:
    0 5px 20px rgba(0, 0, 0, 0.2);

  pointer-events: auto;

  user-select: none;

  touch-action: manipulation;
}

.mobile-controls button:active {
  transform: scale(0.9);
}

/* =========================
   MOBILE
========================= */

@media (max-width: 700px) {

  .hud {
    top: 10px;

    width: 96%;
  }

  .hud-box {
    min-width: 0;

    flex: 1;

    padding: 8px 6px;
  }

  .hud-box span {
    font-size: 10px;
  }

  .hud-box strong {
    font-size: 18px;
  }

  .panel {
    padding: 25px 20px;
  }

  .panel h1 {
    font-size: 30px;
  }

  .emoji {
    font-size: 50px;
  }

  .mobile-controls {
    display: flex;
  }
}

@media (max-width: 420px) {

  .hud-box {
    padding: 7px 4px;
  }

  .hud-box strong {
    font-size: 16px;
  }

  .mobile-controls button {
    width: 62px;
    height: 62px;
  }

  .panel h1 {
    font-size: 27px;
  }
}
