:root {
  --bg1: #05041a;
  --bg2: #1d1252;
  --accent: #5bff6a;
  --pink: #29d9ff;
  --text: #eef2ff;
  --panel: rgba(8, 6, 32, 0.9);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  /* starfield: a few layers of tiny dots over a deep-space gradient */
  background:
    radial-gradient(1.5px 1.5px at 12% 18%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 72% 9%, #cfe8ff 50%, transparent 51%),
    radial-gradient(2px 2px at 88% 34%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 33% 56%, #ffd6f5 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 6% 78%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 56% 88%, #cfe8ff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 94% 72%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 45% 28%, #fff 50%, transparent 51%),
    radial-gradient(60% 40% at 80% 15%, rgba(255, 61, 139, 0.18), transparent 70%),
    radial-gradient(70% 50% at 10% 85%, rgba(41, 217, 255, 0.14), transparent 70%),
    radial-gradient(120% 80% at 50% 0%, var(--bg2), var(--bg1) 70%);
  background-color: var(--bg1);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

#app {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100vh;                       /* fallback */
  height: 100dvh;
  height: var(--app-h, 100dvh);        /* set from the visible viewport in main.js */
  width: 100%;
  max-width: calc(var(--app-h, 100dvh) * 0.6);
  margin: 0 auto;
  padding: max(8px, env(safe-area-inset-top)) 10px max(10px, env(safe-area-inset-bottom));
  touch-action: none;
}

#hud {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: end;
  gap: 8px;
  padding: 4px 4px 6px;
  position: relative;
}
.stat .label { font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; opacity: 0.75; }
.stat .label.small { letter-spacing: 0.04em; text-transform: none; margin-top: 2px; }
.stat .value { font-size: 22px; font-weight: 900; line-height: 1.05; }
.stat .value.big { font-size: 28px; color: var(--accent); text-shadow: 0 0 10px rgba(91, 255, 106, 0.55), 0 2px 0 #0d4a14; }
.stat.center { text-align: center; }
.stat.right { justify-self: end; text-align: right; }
#next { width: 72px; height: 60px; display: block; }

.buttons { position: absolute; top: 0; left: 50%; transform: translateX(-50%); display: flex; gap: 6px; }
button {
  font: inherit;
  color: var(--text);
  background: rgba(255, 255, 255, 0.12);
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-radius: 14px;
  padding: 10px 18px;
  font-weight: 800;
  cursor: pointer;
}
button.icon { padding: 2px 8px; font-size: 13px; border-radius: 10px; }
button.icon.off { opacity: 0.4; text-decoration: line-through; }
button.primary {
  background: linear-gradient(180deg, #9dff8f, #2fd24a);
  color: #052b0b;
  border-color: #d8ffd2;
  font-size: 20px;
  padding: 12px 36px;
  box-shadow: 0 4px 0 #13702a, 0 0 18px rgba(91, 255, 106, 0.45);
}
button:active { transform: translateY(2px); }

#incoming { height: 18px; display: flex; gap: 2px; align-items: center; justify-content: center; }
.rock { width: 12px; height: 12px; background: var(--rock) center / contain no-repeat; }
.rock.big { width: 18px; height: 18px; }

#stage {
  flex: 1;
  min-height: 0;
  display: flex;
  gap: 8px;
}
#board-wrap {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
/* Right-hand rail: the drop button sits low, where a right thumb rests. */
#rail {
  width: 64px;
  flex: none;
  position: relative;
}
#drop-btn {
  position: absolute;
  left: 0;
  top: 10%; /* replaced by JS: 5/6 of the way up the board */
  width: 64px;
  height: 92px;
  padding: 0;
  border-radius: 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: linear-gradient(180deg, #7cecff, #1597d6);
  border: 3px solid #d4f8ff;
  box-shadow: 0 5px 0 #0a4f7a, 0 0 16px rgba(41, 217, 255, 0.45);
  color: #fff;
  touch-action: none;
}
#drop-btn .arrow { font-size: 34px; line-height: 1; }
#drop-btn .txt { font-size: 12px; letter-spacing: 0.1em; font-weight: 900; }
#drop-btn.pressed, #drop-btn:active { transform: translateY(4px); box-shadow: 0 1px 0 #0a4f7a, 0 0 10px rgba(41, 217, 255, 0.45); }
#board {
  display: block;
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0) 30%),
    rgba(6, 5, 28, 0.78);
  box-shadow: 0 0 0 3px rgba(41, 217, 255, 0.6), 0 0 0 7px rgba(163, 91, 255, 0.35), 0 0 30px rgba(41, 217, 255, 0.25), 0 12px 30px rgba(0, 0, 0, 0.6);
}

#overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(3, 2, 18, 0.6);
  backdrop-filter: blur(3px);
  z-index: 5;
}
#overlay[hidden] { display: none; }
.panel {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  background: var(--panel);
  border: 3px solid rgba(41, 217, 255, 0.55);
  box-shadow: 0 0 24px rgba(41, 217, 255, 0.25);
  border-radius: 22px;
  padding: 24px 22px;
  width: min(88%, 340px);
  text-align: center;
}
#overlay[data-kind="title"] .only-title,
#overlay[data-kind="paused"] .only-paused,
#overlay[data-kind="over"] .only-over { display: flex; }

h1 {
  margin: 0;
  font-size: 52px;
  line-height: 0.9;
  font-weight: 900;
  color: var(--accent);
  text-shadow: 0 4px 0 #0d6b1f, 0 0 22px rgba(91, 255, 106, 0.55);
  transform: rotate(-3deg);
}
h2 { margin: 0; font-size: 32px; color: var(--accent); }
.sub { margin: 0; opacity: 0.85; }
.small { font-size: 13px; opacity: 0.8; margin: 0; }
.howto { list-style: none; padding: 0; margin: 0; font-size: 14px; line-height: 1.7; }
.howto b { color: var(--pink); }
.results { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%; }
.results div { background: rgba(255,255,255,0.07); border-radius: 12px; padding: 8px; display: flex; flex-direction: column; }
.results span { font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em; opacity: 0.7; }
.results b { font-size: 22px; }
