*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
  font-family: "Press Start 2P", cursive;
  color: #fff;
  background: #87c9f4;
}

body {
  position: relative;
}

canvas {
  display: block;
  position: fixed;
  inset: 0;
  z-index: 0;
}

.app-shell {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 2;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: max(12px, env(safe-area-inset-top)) 16px 8px;
  pointer-events: none;
}

.brand-mark {
  font-family: "Nunito", system-ui, sans-serif;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.92);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

.score-panel {
  display: flex;
  gap: 8px;
}

.score-box {
  min-width: 72px;
  padding: 6px 10px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.35);
  text-align: center;
}

.score-label {
  display: block;
  font-size: 8px;
  opacity: 0.85;
  margin-bottom: 4px;
}

.score-value {
  display: block;
  font-size: 14px;
}

button {
  outline: none;
  cursor: pointer;
  border: none;
  box-shadow: 3px 5px 0 0 rgba(0, 0, 0, 0.75);
}

.overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.55);
  pointer-events: auto;
}

.overlay.hidden {
  display: none;
}

.overlay-card {
  text-align: center;
  padding: 24px 28px;
  border-radius: 12px;
  background: rgba(20, 24, 32, 0.92);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}

.overlay-card h2 {
  margin: 0 0 12px;
  font-size: 18px;
}

.overlay-card p {
  margin: 0 0 18px;
  font-size: 12px;
}

#retry {
  background-color: #e74c3c;
  color: #fff;
  padding: 14px 28px;
  font-family: inherit;
  font-size: 12px;
}

#controlls.hidden {
  display: none !important;
}

#controlls {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  pointer-events: none;
}

#controlls div {
  display: grid;
  grid-template-columns: 50px 50px 50px;
  grid-template-rows: auto auto;
  gap: 10px;
  margin-bottom: max(20px, env(safe-area-inset-bottom));
  pointer-events: auto;
}

#controlls button {
  width: 100%;
  background-color: #fff;
  border: 1px solid #d0d0d0;
}

#controlls button:first-of-type {
  grid-column: 1 / -1;
}

#controlls svg path {
  fill: #333;
}

.hint {
  position: absolute;
  left: 50%;
  bottom: max(120px, calc(env(safe-area-inset-bottom) + 100px));
  transform: translateX(-50%);
  z-index: 1;
  margin: 0;
  font-size: 8px;
  text-align: center;
  max-width: 90vw;
  opacity: 0.85;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
  pointer-events: none;
}

.desktop-hint {
  display: none;
}

.mobile-hint {
  display: block;
}

@media (min-width: 768px) {
  .desktop-hint {
    display: block;
  }

  .mobile-hint {
    display: none;
  }

  #controlls {
    display: none;
  }

  .hint {
    bottom: 24px;
  }
}
