:root {
  color-scheme: dark;
  --ink: #10141f;
  --panel: rgba(16, 20, 31, 0.76);
  --panel-solid: #172033;
  --text: #fff7da;
  --muted: #bfc7d6;
  --coin: #ffd65a;
  --red: #d94d3c;
  --green: #4aa35f;
  --blue: #58a8d8;
  --pink: #ff5cad;
  --violet: #7f58ff;
  --line: rgba(255, 255, 255, 0.18);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow: hidden;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 18% 12%, rgba(255, 92, 173, 0.25), transparent 28%),
    radial-gradient(circle at 76% 8%, rgba(127, 88, 255, 0.22), transparent 24%),
    linear-gradient(180deg, #6ed6ff 0%, #cdeffd 56%, #52b670 56%, #286643 100%);
  color: var(--text);
}

button {
  border: 0;
  font: inherit;
  cursor: pointer;
}

.game-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 18px;
}

.stage-wrap {
  position: relative;
  width: min(100%, 1100px);
  aspect-ratio: 16 / 9;
  max-height: calc(100vh - 36px);
  border: 3px solid rgba(255, 255, 255, 0.72);
  border-radius: 8px;
  overflow: hidden;
  background: #6cc2e8;
  box-shadow: 0 24px 70px rgba(10, 20, 30, 0.4);
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: auto;
}

.hud {
  position: absolute;
  z-index: 3;
  top: 12px;
  left: 12px;
  right: 12px;
  min-height: 56px;
  display: grid;
  grid-template-columns: repeat(4, minmax(78px, 1fr)) auto;
  gap: 8px;
  align-items: stretch;
  pointer-events: none;
}

.hud > div,
.hud button,
.message {
  background: var(--panel);
  border: 1px solid var(--line);
  backdrop-filter: blur(8px);
}

.hud > div {
  border-radius: 8px;
  padding: 8px 12px;
}

.hud-label {
  display: block;
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.hud strong {
  display: block;
  margin-top: 2px;
  font-size: clamp(1.05rem, 2.7vw, 1.55rem);
  line-height: 1;
}

.hud button {
  min-width: 58px;
  border-radius: 8px;
  padding: 0 14px;
  color: var(--text);
  font-weight: 900;
  pointer-events: auto;
}

.message {
  position: absolute;
  z-index: 4;
  left: 50%;
  top: 50%;
  width: min(420px, calc(100% - 34px));
  transform: translate(-50%, -50%);
  border-radius: 8px;
  padding: 24px;
  text-align: center;
}

.message.hidden {
  display: none;
}

.message h1 {
  margin: 0 0 8px;
  font-size: clamp(2rem, 7vw, 4rem);
  line-height: 0.95;
  letter-spacing: 0;
}

.message p {
  margin: 0 0 18px;
  color: var(--muted);
  line-height: 1.45;
}

.message button {
  min-width: 124px;
  min-height: 44px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--pink), var(--violet));
  color: white;
  font-weight: 900;
}

.mobile-controls {
  position: absolute;
  z-index: 3;
  left: 12px;
  right: 12px;
  bottom: 12px;
  display: none;
  justify-content: space-between;
  pointer-events: none;
}

.mobile-controls button {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: rgba(16, 20, 31, 0.68);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 2rem;
  font-weight: 900;
  pointer-events: auto;
}

.mobile-controls button:last-child {
  margin-left: auto;
  background: rgba(255, 92, 173, 0.82);
}

@media (hover: none), (max-width: 760px) {
  body {
    overflow: auto;
  }

  .game-shell {
    align-items: start;
    padding: 10px;
  }

  .stage-wrap {
    width: 100%;
    max-height: none;
    margin-top: 8px;
  }

  .mobile-controls {
    display: flex;
  }

  .hud {
    grid-template-columns: repeat(4, minmax(0, 1fr)) 52px;
    top: 8px;
    left: 8px;
    right: 8px;
  }

  .hud > div {
    padding: 7px 8px;
  }

  .hud button {
    min-width: 52px;
    padding: 0;
  }
}
