/* Gravity Game: a 1080x1920 canvas, letterboxed and centered on a black page.
   Only the canvas is recorded; the small DOM controls here are for the player. */

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: #000;
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #e8f4ff;
  font-family: "Avenir Next", "Segoe UI", system-ui, -apple-system, sans-serif;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
}

/* The stage keeps a 9:16 box that fits the window height (or width on narrow screens). */
#stage {
  position: relative;
  flex: none;
  width: min(100vw, 56.25vh);
  height: min(177.7778vw, 100vh);
  width: min(100vw, 56.25dvh);
  height: min(177.7778vw, 100dvh);
  container-type: size;     /* cqw units below scale the DOM controls with the stage */
}

#game {
  display: block;
  width: 100%;
  height: 100%;
  background: #02030a;
  touch-action: none;
  cursor: crosshair;
}

#stage.state-title #game,
#stage.state-levelSelect #game,
#stage.state-levelComplete #game,
#stage.state-gameComplete #game { cursor: pointer; }

/* ---- Bottom control bar (DOM only, not recorded) ---- */
#controls {
  position: absolute;
  left: 2.5%;
  right: 12%;               /* leave the bottom-right corner for the recorder button */
  bottom: 1.2%;
  display: flex;
  gap: 1.2cqw;
  justify-content: flex-start;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

#controls button {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 0.8cqw;
  padding: 0.9cqw 1.6cqw;
  border: 1px solid rgba(56, 225, 255, 0.28);
  border-radius: 999px;
  background: rgba(6, 10, 30, 0.55);
  color: rgba(232, 244, 255, 0.82);
  font: 600 2.4cqw/1 "Avenir Next", "Segoe UI", system-ui, sans-serif;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

#controls button:hover {
  background: rgba(20, 40, 80, 0.75);
  border-color: rgba(56, 225, 255, 0.7);
  color: #fff;
}

#controls button:active { transform: scale(0.95); }
#controls button:focus { outline: none; }

#controls kbd,
#help kbd {
  display: inline-block;
  min-width: 1.6em;
  padding: 0.15em 0.35em;
  border-radius: 0.35em;
  background: rgba(56, 225, 255, 0.16);
  color: #38e1ff;
  font: 700 0.85em/1 ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  text-align: center;
  text-transform: none;
}

/* Hide the bar where it does not apply, or when the HUD is hidden for clean video. */
#stage.hud-hidden #controls,
#stage.state-title #controls,
#stage.state-levelSelect #controls,
#stage.state-gameComplete #controls { opacity: 0; }

#stage.hud-hidden #controls button,
#stage.state-title #controls button,
#stage.state-levelSelect #controls button,
#stage.state-gameComplete #controls button { pointer-events: none; }

/* ---- Help panel ---- */
#help {
  position: absolute;
  left: 8%;
  right: 8%;
  top: 14%;
  padding: 4cqw 5cqw;
  border: 1px solid rgba(56, 225, 255, 0.35);
  border-radius: 3cqw;
  background: rgba(4, 6, 20, 0.92);
  box-shadow: 0 0 6cqw rgba(56, 225, 255, 0.18);
  font-size: 2.9cqw;
  line-height: 1.35;
}

#help[hidden] { display: none; }

#help h2 {
  margin: 0 0 2.5cqw;
  font-size: 4.2cqw;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #38e1ff;
}

#help dl {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 1.1cqw 3cqw;
  margin: 0;
}

#help dt {
  font: 700 2.9cqw/1.35 ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color: #ffd84f;
}

#help dd { margin: 0; color: rgba(232, 244, 255, 0.85); }
#help p { margin: 3cqw 0 0; color: rgba(232, 244, 255, 0.6); }

/* ---- Toast (settings feedback; DOM only so it never shows up in videos) ---- */
#toast {
  position: absolute;
  left: 50%;
  top: 11.5%;
  transform: translate(-50%, -0.6cqw);
  padding: 1.2cqw 2.6cqw;
  border-radius: 999px;
  background: rgba(6, 10, 30, 0.85);
  border: 1px solid rgba(56, 225, 255, 0.4);
  color: #e8f4ff;
  font: 600 2.6cqw/1 "Avenir Next", "Segoe UI", system-ui, sans-serif;
  letter-spacing: 0.05em;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

#toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.noscript {
  color: #e8f4ff;
  font-family: system-ui, sans-serif;
}
