/* grid-v2b's stage, plus the glass ball. */
:root {
  --bg: #e3e3e3;
  --ball: 200px;       /* set from ball.js */
  --ball-margin: 28px;
}

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
}

.stage {
  position: fixed;
  inset: 0;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.stage.is-dragging { cursor: grabbing; }

.stage canvas {
  display: block;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 500ms ease;
}
.stage.is-ready canvas { opacity: 1; }

/* ---- The ball ------------------------------------------------------------- */

.ball {
  position: fixed;
  right: var(--ball-margin);
  bottom: calc(var(--ball-margin) + env(safe-area-inset-bottom, 0px));
  width: var(--ball);
  height: var(--ball);
  border-radius: 50%;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  outline: none;
  z-index: 10;
}
.ball.is-dragging { cursor: grabbing; }

.ball:focus-visible { outline: 2px solid rgb(0 0 0 / 0.4); outline-offset: 4px; }

/* Glass: frosted fallback first; Chromium also understands the SVG lens and
   replaces it with real refraction (other browsers drop that declaration). */
.ball-glass {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  backdrop-filter: blur(1.5px) saturate(1.15);
  -webkit-backdrop-filter: blur(1.5px) saturate(1.15);
}
.ball-glass.has-lens { backdrop-filter: url(#lens); }

.ball-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
}

/* Direction hints: four small chevrons that appear on hover. */
.ball-hint {
  position: absolute;
  width: 8px;
  height: 8px;
  border-top: 1.5px solid rgb(0 0 0 / 0.5);
  border-left: 1.5px solid rgb(0 0 0 / 0.5);
  opacity: 0;
  transition: opacity 200ms ease;
  pointer-events: none;
}
.ball:hover .ball-hint, .ball:focus-visible .ball-hint { opacity: 1; }
.ball.is-dragging .ball-hint { opacity: 0; }
.ball-hint--up    { top: -14px;  left: 50%; transform: translateX(-50%) rotate(45deg); }
.ball-hint--down  { bottom: -14px; left: 50%; transform: translateX(-50%) rotate(225deg); }
.ball-hint--left  { left: -14px; top: 50%; transform: translateY(-50%) rotate(-45deg); }
.ball-hint--right { right: -14px; top: 50%; transform: translateY(-50%) rotate(135deg); }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

@media (max-width: 600px) {
  :root { --ball-margin: 18px; }
}

