* {
  box-sizing: border-box;
  touch-action: manipulation;
}

body {
  margin: 0;
  background: #0e0e0e;
  color: #f44336;
  font-family: system-ui, sans-serif;
  text-align: center;
}

header img {
  max-width: 90px;
  margin: 0 auto 4px;
  display: block;
}

.instruction {
  font-size: 14px;
  color: #aaa;
  margin-bottom: 6px;
}

/* CANVAS */
canvas {
  display: block;
  margin: 0 auto;
  background: #1a1a1a;
  border: 4px solid #f44336;
}

/* CONTROLS — hidden on desktop */
.controls {
  display: none;
}

@media (max-width: 768px) {
  .controls {
    position: fixed;
    bottom: 15px;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .controls .middle {
    display: flex;
  }

.controls button {
  width: 72px;
  height: 72px;
  font-size: 28px;
  margin: 6px;
  border-radius: 14px;

  background: linear-gradient(145deg, #1b1b1b, #0f0f0f);
  border: 2px solid #f44336;

  color: #fff;
  box-shadow:
    inset 0 0 6px rgba(0,0,0,0.8),
    0 0 10px rgba(244,67,54,0.25);

  transition: transform 0.05s ease,
              background 0.1s ease,
              box-shadow 0.1s ease;
}

.controls button:active {
  background: #f44336;
  color: #000;
  transform: scale(0.92);

  box-shadow:
    inset 0 0 12px rgba(0,0,0,0.8),
    0 0 14px rgba(244,67,54,0.6);
}


  .instruction {
    display: none;
  }

  #game {
    width: 300px !important;
    height: 400px !important;
  }
}

@media (max-width: 420px) {
  .controls button {
    width: 56px;
    height: 56px;
    font-size: 22px;
    margin: 4px;
    border-radius: 12px;
  }
}

/* OVERLAYS */
.win-screen {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.92);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 999;
}

.win-screen img {
  width: 120px;
  margin-bottom: 20px;
  filter: drop-shadow(0 0 14px #f44336);
}

.win-screen button {
  padding: 14px 28px;
  font-size: 18px;
  background: #f44336;
  color: #000;
  border: none;
  border-radius: 10px;
}

.intro-sub {
  color: #ccc;
  font-size: 14px;
  margin-bottom: 20px;
}

.hidden {
  display: none;
}

/* SHAKE */
@keyframes shake {
  0% { transform: translate(0,0); }
  25% { transform: translate(-6px,4px); }
  50% { transform: translate(6px,-4px); }
  75% { transform: translate(-4px,6px); }
  100% { transform: translate(0,0); }
}

.shake {
  animation: shake 0.3s;
}

/* WIN ANIMATION */
@keyframes winPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.1) rotate(-2deg); }
  100% { transform: scale(1); }
}

.win-anim {
  animation: winPulse 0.6s ease-in-out infinite;
}
