:root {
  --ink: #f4f4f1;
  --dim: rgba(244, 244, 241, 0.62);
  --hit: #ff3d6e;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --grotesk: "Helvetica Neue", Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: #000;
  color: var(--ink);
  overflow: hidden;
}

#stage {
  position: fixed;
  inset: 0;
}

/* The camera only feeds the hand tracking. It is never shown. */
#cam {
  position: absolute;
  width: 2px;
  height: 2px;
  opacity: 0;
  pointer-events: none;
}

#gl, #marks {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

#gl { opacity: 0; transition: opacity 1.6s ease; }
#stage.grown #gl { opacity: 1; }
#marks { pointer-events: none; }

.tag {
  position: absolute;
  margin: 0;
  font: 11px/1.4 var(--mono);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--dim);
  white-space: nowrap;
}

#title { top: 20px; left: 24px; color: var(--ink); }
#readout { top: 20px; right: 24px; text-align: right; }
#hint { bottom: 20px; left: 50%; transform: translateX(-50%); }

/* Split view: the camera, in black and white, sits above the garden. */
#stage.split #cam.live {
  opacity: 1;
  object-fit: cover;
  transform: scaleX(-1);
  filter: grayscale(1) contrast(1.2) brightness(0.85);
}

#views {
  top: 14px;
  left: 108px;
  display: flex;
  gap: 4px;
  border: 0;
  padding: 0;
}

#views[hidden] { display: none; }
#views legend, #views input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  opacity: 0;
}
#views label { cursor: pointer; padding: 6px 8px; }
#views label:has(input:disabled) { cursor: default; opacity: 0.4; }
#views label:has(input:disabled):hover span { color: var(--dim); }
#views span { padding-bottom: 3px; border-bottom: 1px solid transparent; }
#views input:checked + span { color: var(--ink); border-bottom-color: var(--ink); }
#views label:hover span { color: var(--ink); }
#views input:focus-visible + span { outline: 1px solid var(--ink); outline-offset: 4px; }

#stage.split #start { bottom: auto; height: var(--top); }

#start {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 18px;
  padding: 24px;
  text-align: center;
}

#start[hidden] { display: none; }
/* The Begin layer covers the stage, so only its button takes clicks and the view switch above stays usable. */
#start { pointer-events: none; }
#start > * { pointer-events: auto; }

#begin {
  appearance: none;
  border: 1px solid var(--ink);
  background: rgba(0, 0, 0, 0.55);
  color: var(--ink);
  font: 400 clamp(44px, 9vw, 112px)/1 var(--grotesk);
  letter-spacing: -0.04em;
  padding: 0.18em 0.5em 0.24em;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

#begin:hover, #begin:focus-visible {
  background: var(--ink);
  color: #000;
  outline: none;
}

#begin:focus-visible { box-shadow: 0 0 0 3px #000, 0 0 0 4px var(--ink); }
#begin:disabled { opacity: 0.4; cursor: default; }

#status {
  margin: 0;
  max-width: 34ch;
  font: 11px/1.5 var(--mono);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--dim);
}

@media (max-width: 600px) {
  #title { top: 14px; left: 16px; }
  #views { top: 8px; left: auto; right: 8px; transform: none; }
  #readout { top: auto; bottom: 44px; right: auto; left: 16px; text-align: left; }
  #hint { bottom: 16px; left: 16px; transform: none; }
}

/* The recorder, only with ?record. It sits outside the stage, so it never shows up in the film. */
#rec {
  position: fixed;
  right: 16px;
  bottom: 16px;
  appearance: none;
  background: #000;
  border: 1px solid var(--dim);
  color: var(--ink);
  padding: 8px 12px;
  cursor: pointer;
}
#rec[hidden] { display: none; }
#rec.on { border-color: var(--hit); color: var(--hit); }
#rec:focus-visible { outline: 1px solid var(--ink); outline-offset: 3px; }

/* About: the garden at rest, with a few words in the middle. */
#about {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 18px;
  padding: 24px;
  text-align: center;
  pointer-events: none;
  background: radial-gradient(ellipse 46% 40% at 50% 50%, rgba(0, 0, 0, 0.72), rgba(0, 0, 0, 0) 100%);
}
#about[hidden] { display: none; }
#about h1 {
  position: relative;
  isolation: isolate;
  margin: 0;
  /* Tall enough lines that the g's tail stays inside the lit area. */
  font: 400 clamp(40px, 6vw, 80px)/1.25 var(--grotesk);
  letter-spacing: -0.04em;
  /* Soft edges, as if the letters were made of light too. */
  filter: blur(0.35px);
  /* Lit from inside like a flower: hottest in the middle, falling off softly to the ends. */
  color: transparent;
  background: radial-gradient(ellipse 58% 150% at 50% 60%, #fff 0%, #f6f4fa 40%, rgba(218, 214, 232, 0.72) 100%);
  -webkit-background-clip: text;
  background-clip: text;
}
/* The glow is the word itself, blurred behind it, so it follows every letter instead of sitting on top as an edge. */
#about h1::before,
#about h1::after {
  content: attr(data-text) / "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}
#about h1::before { color: #f7f2ff; filter: blur(9px); opacity: 0.72; }
#about h1::after { color: #c9b4f2; filter: blur(30px); opacity: 0.6; }
#about p {
  margin: 0;
  max-width: 34em;
  font: 400 16px/1.5 var(--grotesk);
  color: var(--ink);
  text-shadow: 0 0 18px #000;
}
#about .made {
  max-width: none;
  font: 11px/1.7 var(--mono);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--dim);
}
