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

html, body {
  height: 100%;
  background: #070d16;
  color: #dCE6F2;
  font-family: "Avenir Next", "Segoe UI", system-ui, -apple-system, sans-serif;
  overflow: hidden;
}

#app {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

#stage {
  position: relative;
  width: min(100%, 1100px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

canvas#game {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  display: block;
  border-radius: 14px;
  background: #0a1626;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .65), 0 0 0 1px rgba(150, 200, 255, .12);
  image-rendering: auto;
  touch-action: manipulation;
  cursor: pointer;
}

#hint {
  font-size: 13px;
  letter-spacing: .04em;
  color: #64809f;
  text-align: center;
  user-select: none;
}

/* ---------- controls row ---------- */
#controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
}

#btnFull {
  font: 600 12px/1 "Avenir Next", "Segoe UI", system-ui, sans-serif;
  letter-spacing: .04em;
  color: #9fd0f0;
  background: rgba(16, 34, 54, .85);
  border: 1px solid rgba(130, 190, 240, .3);
  border-radius: 7px;
  padding: 7px 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background .15s, border-color .15s, color .15s;
}

#btnFull:hover {
  background: rgba(28, 58, 88, .95);
  border-color: rgba(150, 215, 255, .6);
  color: #dff0ff;
}

#btnFull:active { transform: translateY(1px); }

#fullIcon { font-size: 14px; line-height: 1; }

/* ---------- fullscreen ---------- */
/* Written as separate rules, not a selector list: an unknown pseudo-class in a
   grouped selector invalidates the whole rule in some browsers. */
#stage:fullscreen {
  width: 100vw;
  height: 100vh;
  max-width: none;
  padding: 0;
  gap: 0;
  justify-content: center;
  background: #070d16;
}
#stage:-webkit-full-screen {
  width: 100vw;
  height: 100vh;
  max-width: none;
  padding: 0;
  gap: 0;
  justify-content: center;
  background: #070d16;
}

/* Fill the screen but keep 16:9 - never letterbox-stretch the canvas. */
#stage:fullscreen canvas#game {
  width: min(100vw, calc(100vh * 16 / 9));
  max-height: 100vh;
  border-radius: 0;
  box-shadow: none;
}
#stage:-webkit-full-screen canvas#game {
  width: min(100vw, calc(100vh * 16 / 9));
  max-height: 100vh;
  border-radius: 0;
  box-shadow: none;
}

/* Controls float over the bottom edge and fade back until hovered. */
#stage:fullscreen #controls {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 12px;
  opacity: .25;
  transition: opacity .2s;
}
#stage:-webkit-full-screen #controls {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 12px;
  opacity: .25;
  transition: opacity .2s;
}
#stage:fullscreen #controls:hover { opacity: 1; }
#stage:-webkit-full-screen #controls:hover { opacity: 1; }
