:root {
  --night: #0b1220;
  --panel: #101a2b;
  --line: #22314d;
  --text: #cbd7ef;
  --faint: #8794b8;
  --accent: #93e9b3;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
}

body {
  background: radial-gradient(120% 120% at 50% 0%, #16223c 0%, var(--night) 60%);
  color: var(--text);
  font: 16px/1.4 ui-rounded, "Segoe UI", system-ui, -apple-system, sans-serif;
  overflow: hidden;
  -webkit-text-size-adjust: 100%;
}

#bg {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  display: block;
}

.hud {
  position: relative;
  z-index: 1;
  height: 100%;
  max-width: 40rem;
  margin: 0 auto;
  padding: 14px 16px calc(14px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 12px;
  align-items: stretch;
}

.bar {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
}

.level { margin: 0; font-weight: 600; }
.goal { margin: 0; color: var(--faint); }
.hint { margin: 0; min-height: 2.8em; color: var(--faint); }

.stage {
  position: relative;
  flex: 0 1 auto;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 0;
}

#board {
  width: min(92vw, 64vh, 40rem);
  height: auto;
  aspect-ratio: 1 / 1;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--night);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  cursor: pointer;
}

.controls { justify-content: center; }

button {
  min-height: 44px;
  min-width: 96px;
  padding: 10px 18px;
  font: inherit;
  font-size: 16px;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
}

button:hover { border-color: #31456b; }
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button:disabled { opacity: 0.45; cursor: default; }

button.primary {
  border-color: var(--accent);
  color: #0b1a12;
  background: var(--accent);
  font-weight: 600;
}

.banner {
  position: absolute;
  inset: auto 0 8% 0;
  margin: 0 auto;
  width: max-content;
  max-width: 90%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  border-radius: 16px;
  background: rgba(13, 21, 38, 0.94);
  border: 1px solid var(--line);
}

.banner[hidden] { display: none; }
.banner-text { margin: 0; font-weight: 600; }

.note { margin: 0; min-height: 1.4em; color: var(--faint); font-size: 12px; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
