:root {
  --bg: #05060a;
  --fg: #e9edf5;
  --muted: #8b93a7;
  --accent: #4f8cff;
  --error: #ff6b6b;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--fg);
  font: 14px/1.5 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

#stage {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: var(--bg);
  cursor: pointer;
}

#stage .media {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0;
  transition: opacity 320ms ease;
  will-change: opacity;
}

#stage .media.show {
  opacity: 1;
}

#stage .caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 48px 24px 24px;
  font-size: 15px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--fg);
  background: linear-gradient(to top, rgb(0 0 0 / 75%), transparent);
  pointer-events: none;
  opacity: 0;
  transition: opacity 320ms ease;
}

#stage .caption.show {
  opacity: 1;
}

.progress {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: rgb(255 255 255 / 10%);
  z-index: 20;
}

#progress-bar {
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width 120ms linear;
}

.idle {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 24px;
  background: var(--bg);
  transition: opacity 400ms ease;
  z-index: 10;
}

.idle[hidden] {
  display: none;
}

.idle-inner {
  max-width: 34ch;
}

.idle p {
  margin: 12px 0 0;
}

.muted {
  color: var(--muted);
  font-size: 12px;
}

.spinner {
  width: 34px;
  height: 34px;
  margin: 0 auto;
  border: 2px solid rgb(255 255 255 / 15%);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 900ms linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.unmute {
  position: fixed;
  top: max(16px, env(safe-area-inset-top));
  right: 16px;
  z-index: 30;
  padding: 8px 14px;
  border: 1px solid rgb(255 255 255 / 20%);
  border-radius: 999px;
  background: rgb(10 12 18 / 70%);
  backdrop-filter: blur(8px);
  color: var(--fg);
  font: inherit;
  cursor: pointer;
  transition: opacity 200ms ease;
}

.unmute[hidden] {
  display: none;
}

.hud {
  position: fixed;
  left: 12px;
  bottom: 14px;
  z-index: 30;
  display: flex;
  gap: 14px;
  padding: 6px 10px;
  border-radius: 8px;
  background: rgb(10 12 18 / 70%);
  color: var(--muted);
  font: 11px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace;
  pointer-events: none;
}

.hud[hidden] {
  display: none;
}

.hud .error {
  color: var(--error);
}
