* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #0a0e14;
  font-family: "Baloo 2", "Arial Rounded MT Bold", system-ui, sans-serif;
}

#glcanvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

#video { display: none; }

/* ---- HUD ---- */
.hud {
  position: fixed;
  z-index: 10;
  color: rgba(255, 255, 255, 0.85);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.5);
  user-select: none;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.hud.tl { top: 18px; left: 20px; }
.hud.bl { bottom: 18px; left: 20px; line-height: 1.8; }
.hud.br { bottom: 18px; right: 20px; text-align: right; }

.hud .title {
  font-weight: 800;
  font-size: 15px;
  letter-spacing: 0.22em;
}
.hud .sub {
  margin-top: 4px;
  opacity: 0.65;
}

body.ui-hidden .hud,
body.ui-hidden #gui { opacity: 0; pointer-events: none; }

/* ---- control panel ---- */
#gui {
  position: fixed;
  z-index: 15;
  top: 16px;
  right: 16px;
  width: 232px;
  color: rgba(255, 255, 255, 0.9);
  font-size: 11px;
  letter-spacing: 0.06em;
  background: rgba(16, 22, 32, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 14px;
  backdrop-filter: blur(16px) saturate(1.3);
  -webkit-backdrop-filter: blur(16px) saturate(1.3);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  user-select: none;
  transition: opacity 0.3s ease;
}
#gui .gui-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  font-weight: 800;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  cursor: pointer;
}
#gui .gui-header:hover { background: rgba(255, 255, 255, 0.06); }
#gui .gui-body { padding: 4px 14px 12px; }
#gui.collapsed .gui-body { display: none; }
#gui .gui-row {
  display: grid;
  grid-template-columns: 82px 1fr 34px;
  align-items: center;
  gap: 8px;
  margin: 7px 0;
}
#gui .gui-row label {
  opacity: 0.85;
  text-transform: lowercase;
  white-space: nowrap;
  overflow: hidden;
}
#gui .gui-row output {
  text-align: right;
  font-variant-numeric: tabular-nums;
  opacity: 0.7;
}
#gui input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 3px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.25);
  outline: none;
  cursor: pointer;
}
#gui input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
  border: none;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.45);
}
#gui input[type="range"]::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
  border: none;
}
#gui .gui-select-row { grid-template-columns: 82px 1fr; }
#gui .gui-select-row select {
  width: 100%;
  padding: 5px 8px;
  font-family: inherit;
  font-size: 10px;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.9);
  background: rgba(255, 255, 255, 0.10);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 7px;
  outline: none;
  cursor: pointer;
}
#gui .gui-select-row select option {
  background: #141a26;
  color: #fff;
}

#gui .gui-reset {
  display: block;
  width: 100%;
  margin-top: 10px;
  padding: 7px 0;
  font-family: inherit;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.85);
  background: rgba(255, 255, 255, 0.10);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  cursor: pointer;
}
#gui .gui-reset:hover { background: rgba(255, 255, 255, 0.18); }

/* ---- text input ---- */
#textbox {
  position: fixed;
  z-index: 10;
  left: 50%;
  bottom: 34px;
  transform: translateX(-50%);
  width: min(480px, calc(100vw - 48px));
  transition: opacity 0.3s ease;
}

#textInput {
  width: 100%;
  padding: 14px 22px;
  font-family: inherit;
  font-weight: 800;
  font-size: 17px;
  letter-spacing: 0.06em;
  text-align: center;
  color: #fff;
  background: rgba(255, 255, 255, 0.10);
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  outline: none;
  backdrop-filter: blur(18px) saturate(1.4);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.35);
  transition: background 0.2s ease, border-color 0.2s ease;
}
#textInput::placeholder { color: rgba(255, 255, 255, 0.55); }
#textInput:focus {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.5);
}

/* ---- fingertip cursors (thumb + index) ---- */
.hand-dot {
  position: fixed;
  z-index: 12;
  top: 0;
  left: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s ease;
}
.hand-dot.visible { opacity: 1; }
.hand-dot .ring {
  width: 30px;
  height: 30px;
  margin: -15px 0 0 -15px;
  border: 2px solid rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  /* --fp: fist-hold progress, fills the ring like a timer */
  background: conic-gradient(
    rgba(255, 255, 255, 0.85) calc(var(--fp, 0) * 1turn),
    rgba(255, 255, 255, 0.08) 0
  );
  box-shadow:
    0 2px 12px rgba(0, 0, 0, 0.4),
    inset 0 1px 4px rgba(255, 255, 255, 0.4);
  transition: transform 0.12s ease;
}
.hand-dot.pinch .ring {
  transform: scale(0.7);
  background: rgba(255, 255, 255, 0.55);
}
.hand-dot.fist .ring {
  transform: scale(calc(1.4 + var(--fp, 0) * 1.2));
}

/* ---- overlay ---- */
.overlay {
  position: fixed;
  z-index: 20;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  transition: opacity 0.4s ease;
}
.overlay.hidden { opacity: 0; pointer-events: none; }

.overlay-card {
  padding: 12px 22px;
  text-align: center;
  color: rgba(255, 255, 255, 0.9);
  background: rgba(20, 26, 38, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 16px;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.overlay-title {
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.overlay-body {
  margin-top: 6px;
  font-size: 12px;
  line-height: 1.6;
  opacity: 0.75;
}
