.stage-open,
.stage-open body { overflow: hidden; }

.stage {
  --size: 48px;
  --type: min(var(--size), 9vw);
  --line: calc(var(--type) * 1.3);
  --cue-y: 28%;
  position: fixed;
  inset: 0;
  z-index: 100;
  overflow: hidden;
  background: #000;
  color: var(--text);
}

.stage[hidden],
.stage [hidden] { display: none !important; }

.stage-camera {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
  opacity: 0.35;
}

.stage:not(.with-camera) .stage-camera { display: none; }

.stage-read {
  position: absolute;
  inset: 0;
  overflow: hidden;
  mask-image: linear-gradient(to bottom, transparent 0, #000 12%, #000 calc(100% - 220px), transparent calc(100% - 140px));
}

.stage.mirror .stage-read { transform: scaleX(-1); }

.stage .script {
  position: absolute;
  top: var(--cue-y);
  right: max(var(--gutter), calc((100% - 1100px) / 2));
  left: max(calc(var(--gutter) + 18px), calc((100% - 1100px) / 2));
  font-size: var(--type);
  font-weight: 600;
  line-height: var(--line);
  letter-spacing: -0.01em;
  transition: transform 0.32s ease-out;
}

.stage[data-mode="fixed"] .script { transition: none; }

.stage-cue {
  position: absolute;
  top: calc(var(--cue-y) + var(--line) / 2 - 9px);
  left: max(calc(var(--gutter) - 6px), calc((100% - 1100px) / 2 - 24px));
  width: 12px;
  height: 18px;
  background: var(--text);
  clip-path: polygon(0 0, 100% 50%, 0 100%);
}

.stage .voice {
  top: 22px;
  right: 22px;
  width: 12px;
  height: 12px;
}

.stage-rec {
  position: absolute;
  top: 16px;
  left: 50%;
  padding: 4px 10px;
  transform: translateX(-50%);
  border-radius: 999px;
  background: var(--record);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.stage-notice {
  position: absolute;
  top: 56px;
  left: 50%;
  width: min(520px, calc(100% - 32px));
  padding: 12px 16px;
  transform: translateX(-50%);
  border-radius: 14px;
  background: rgba(40, 40, 42, 0.95);
  font-size: 15px;
  line-height: 1.4;
  text-align: center;
}

.stage .progress {
  right: var(--gutter);
  bottom: calc(112px + env(safe-area-inset-bottom));
  left: var(--gutter);
}

.stage-bar {
  position: absolute;
  right: 0;
  bottom: calc(24px + env(safe-area-inset-bottom));
  left: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 40px;
}

.stage button { border: 0; color: var(--text); cursor: pointer; }

.stage svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.stage-btn {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  background: none;
}

.stage-main {
  display: grid;
  place-items: center;
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: var(--text);
}

.stage-main svg { width: 28px; height: 28px; color: #000; fill: #000; }

.stage-main.is-record { border: 4px solid var(--text); background: none; }

.stage-main.is-record span {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--record);
  transition: all 0.2s ease;
}

.stage-main.is-record.is-playing span { width: 26px; height: 26px; border-radius: 6px; }

.stage-next {
  position: absolute;
  right: var(--gutter);
  bottom: calc(24px + env(safe-area-inset-bottom));
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
}

.stage-done {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: var(--gutter);
  background: rgba(0, 0, 0, 0.88);
  text-align: center;
}

.stage-done[hidden] { display: none; }

.stage-done-title { font-size: clamp(32px, 5vw, 48px); font-weight: 600; letter-spacing: -0.03em; }

.stage-done-stats { margin-top: 10px; color: var(--muted); font-size: 19px; font-variant-numeric: tabular-nums; }

.stage-done-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 32px; }

.stage-app { max-width: 26em; margin-top: 40px; color: var(--muted); font-size: 16px; line-height: 1.45; }

.stage-app a { color: var(--text); text-underline-offset: 3px; }

@media (max-width: 600px) {
  .stage { --cue-y: 22%; }
  .stage-bar { gap: 28px; }
}
