html, body {
  margin: 0;
  height: 100%;
  background: #000;
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  display: grid;
  place-items: center;
  font: 13px/1.35 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: #eee;
}

/* Stage keeps the iPad ratio (1180 / 820) and fits inside the window. */
#stage {
  position: relative;
  width: min(100vw, calc(100vh * 1180 / 820));
  width: min(100vw, calc(100dvh * 1180 / 820));
  aspect-ratio: 1180 / 820;
  overflow: hidden;
  background: #000;
  isolation: isolate;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  cursor: default;
}

#stage > * {
  position: absolute;
  pointer-events: none;
}

#bg {
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

#shade {
  inset: 0;
  background: #000;
  opacity: 0.55;
}

#ripple {
  inset: 0;
  width: 100%;
  height: 100%;
  mix-blend-mode: screen;
  visibility: hidden;
}

/* Reactive video and its rest frame share the same box, both Screen-blended (black disappears). */
#fx, #rest {
  mix-blend-mode: screen;
  object-fit: contain;
}

#rest { opacity: 1; }
#fx { opacity: 0; }

#zone {
  border-radius: 50%;
  border: 2px dashed rgba(255, 255, 255, 0.45);
  box-sizing: border-box;
}

/* Tuning panel (test tool only, hidden in kiosk mode). */
#gear {
  position: fixed;
  top: 10px;
  right: 10px;
  z-index: 10;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.5);
  font-size: 18px;
  cursor: pointer;
}

body.kiosk #gear { display: none; }

#panel {
  position: fixed;
  top: 54px;
  right: 10px;
  bottom: 10px;
  z-index: 10;
  width: 300px;
  overflow-y: auto;
  padding: 12px 14px 16px;
  border-radius: 14px;
  background: rgba(20, 20, 22, 0.86);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

#panel[hidden] { display: none; }

#panel h3 {
  margin: 14px 0 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #ED1C24;
}

#panel h3:first-child { margin-top: 0; }

#panel label {
  display: block;
  margin: 7px 0;
}

#panel .row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: #bbb;
}

#panel .row b {
  font-weight: 500;
  color: #fff;
  font-variant-numeric: tabular-nums;
}

#panel input[type=range] {
  width: 100%;
  margin: 3px 0 0;
  accent-color: #ED1C24;
}

#panel input[type=checkbox] { accent-color: #ED1C24; }

#panel select {
  width: 100%;
  margin-top: 3px;
  padding: 4px;
  border-radius: 6px;
  border: 1px solid #444;
  background: #222;
  color: #fff;
}

#panel .buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-top: 14px;
}

#panel button {
  padding: 8px 6px;
  border: 0;
  border-radius: 8px;
  background: #2b2b2e;
  color: #fff;
  font: inherit;
  cursor: pointer;
}

#panel button.primary { background: #ED1C24; }

#panel .meta {
  margin-top: 12px;
  color: #888;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}
