/* ── Wider stage for the game canvas ── */
.subpage-wide { max-width: 900px; }

/* ── App wrapper ── */
.cube-app {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

/* ── Level picker ── */
.cube-levels {
  display: flex;
  gap: 8px;
}

.cube-level-btn {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 100px;
  padding: 7px 18px;
  font-size: 0.82rem;
  font-family: 'JetBrains Mono', monospace;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
}
.cube-level-btn:hover { color: var(--text); }
.cube-level-btn.active {
  border-color: var(--accent-border);
  color: var(--accent);
  background: var(--accent-dim);
}

/* ── Canvas + HUD ── */
.cube-canvas-wrap {
  position: relative;
  width: 100%;
  max-width: 820px;
  aspect-ratio: 16 / 10;
  border-radius: 12px;
  overflow: hidden;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
}

#cube-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.cube-hud {
  position: absolute;
  top: 14px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  align-items: baseline;
  gap: 10px;
  pointer-events: none;
  font-family: 'JetBrains Mono', monospace;
}

.cube-hud-time {
  font-size: 1.6rem;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 2px 8px rgba(0,0,0,0.6);
}

.cube-hud-best {
  font-size: 0.78rem;
  color: rgba(255,255,255,0.75);
  text-shadow: 0 1px 6px rgba(0,0,0,0.6);
}
.cube-hud-best:empty { display: none; }

/* ── Overlay (ready / fallen / won) ── */
.cube-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-align: center;
  padding: 24px;
  background: rgba(6, 10, 20, 0.6);
  backdrop-filter: blur(3px);
  transition: opacity 0.2s;
}
.cube-overlay.hidden { display: none; }

.cube-overlay-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: #fff;
}
.cube-overlay-title.success { color: #4ade80; }
.cube-overlay-title.fail    { color: #f87171; }

.cube-overlay-text {
  font-size: 0.9rem;
  color: rgba(255,255,255,0.85);
  max-width: 380px;
}

.cube-overlay .btn-primary {
  margin-top: 6px;
}

/* ── Touch controls (mobile) ── */
.cube-touch-controls {
  position: absolute;
  bottom: 16px;
  left: 0;
  right: 0;
  display: none;
  justify-content: space-between;
  padding: 0 16px;
  pointer-events: none;
}

.cube-touch-btn {
  pointer-events: auto;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.14);
  color: #fff;
  font-size: 1.2rem;
  backdrop-filter: blur(2px);
  transition: background 0.15s, transform 0.1s;
}
.cube-touch-btn:active { background: rgba(255,255,255,0.3); transform: scale(0.94); }

@media (hover: none) and (pointer: coarse) {
  .cube-touch-controls { display: flex; }
}
