:root {
  --bg-1: #070a18;
  --bg-2: #101a3a;
  --accent: #7be07b;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  background: radial-gradient(120% 120% at 50% 0%, #14234e 0%, var(--bg-1) 55%, #05070f 100%);
  font-family: "Comic Neue", "Comic Sans MS", "Chalkboard SE", system-ui, sans-serif;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  user-select: none;
  -webkit-user-select: none;
}

@font-face {
  font-family: "Comic Neue";
  src: url("../assets/fonts/ComicNeue-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
}
@font-face {
  font-family: "Comic Neue";
  src: url("../assets/fonts/ComicNeue-Bold.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
}

#app {
  position: relative;
  height: 100vh;
  height: 100dvh;          /* mobile dynamic viewport (address bar aware) */
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Stage wraps the canvas + overlay controls and matches the canvas size. */
#stage {
  position: relative;
  flex: 0 0 auto;
  line-height: 0;
}

/* The 4:3 game area scales to fit any screen and letterboxes gracefully. */
#game {
  display: block;
  width: min(100vw, calc(100vh * 4 / 3));
  width: min(100vw, calc(100dvh * 4 / 3));  /* address-bar aware on mobile */
  height: auto;
  max-width: 100%;
  max-height: 100%;
  border-radius: 14px;
  box-shadow: 0 0 0 3px rgba(255,255,255,0.08), 0 24px 80px rgba(0,0,0,0.6), 0 0 60px rgba(123,224,123,0.15);
  background: #000;
  touch-action: none;
  outline: none;
}

/* Overlay controls — always anchored to the top-right corner of the game. */
.controls {
  position: absolute;
  top: calc(10px + env(safe-area-inset-top, 0px));
  right: calc(12px + env(safe-area-inset-right, 0px));
  display: flex;
  gap: 8px;
  z-index: 5;
}

.pause,
.mute {
  width: clamp(40px, 7vw, 50px);
  height: clamp(40px, 7vw, 50px);
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.25);
  background: rgba(10, 14, 28, 0.72);
  color: #fff;
  font-size: clamp(18px, 4vw, 22px);
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .12s ease, background .12s ease;
  touch-action: manipulation;
}
.pause:hover,
.mute:hover { transform: scale(1.08); background: rgba(30, 40, 70, 0.9); }
.pause:active,
.mute:active { transform: scale(0.96); }

#hint {
  position: absolute;
  bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
  padding: 7px 16px;
  border-radius: 999px;
  background: rgba(10, 14, 28, 0.55);
  color: rgba(255,255,255,0.75);
  font-size: 14px;
  letter-spacing: .2px;
  pointer-events: none;
  white-space: nowrap;
  max-width: 92vw;
  text-align: center;
  z-index: 4;
}
#hint b { color: #ffd66b; }

/* Smaller screens: smaller buttons + a compact, wrap-friendly hint. */
@media (max-width: 640px) {
  #hint {
    font-size: 12px;
    white-space: normal;
    max-width: 88vw;
  }
}
