:root {
  color-scheme: dark;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: #000;
}

* { box-sizing: border-box; }

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #000;
}

button { font: inherit; }

.stage {
  position: relative;
  width: min(100vw, calc(100dvh * 9 / 16));
  height: 100dvh;
  margin: 0 auto;
  overflow: hidden;
  background: #000;
  isolation: isolate;
}

.video-stack,
.video-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.video-layer {
  z-index: 0;
  object-fit: cover;
  opacity: 0;
  pointer-events: none;
}

.video-layer.is-active {
  z-index: 1;
  opacity: 1;
}

.loading-screen {
  position: absolute;
  z-index: 20;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 28px;
  background: #080808;
  transition: opacity 220ms ease, visibility 220ms ease;
}

.loading-screen.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loading-screen.needs-tap { cursor: pointer; }
.loading-card { width: min(100%, 300px); }

.loading-title {
  margin: 0 0 18px;
  text-align: center;
  color: rgba(255, 255, 255, .92);
  font-size: 16px;
  font-weight: 650;
  letter-spacing: .04em;
}

.loading-screen.needs-tap .loading-title {
  padding: 13px 18px;
  border: 1px solid rgba(255, 255, 255, .72);
  border-radius: 999px;
}

.load-track,
.playback-track {
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, .2);
}

.load-track { height: 4px; }

.load-track span,
.playback-track span {
  display: block;
  width: var(--progress, 0%);
  height: 100%;
  border-radius: inherit;
  background: #fff;
  transition: width 90ms linear;
}

.load-percent {
  margin: 9px 0 0;
  text-align: center;
  color: rgba(255, 255, 255, .58);
  font-size: 12px;
}

.arrow-button {
  position: absolute;
  z-index: 10;
  top: 50%;
  display: grid;
  width: 48px;
  height: 64px;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, .38);
  color: #fff;
  background: rgba(0, 0, 0, .42);
  backdrop-filter: blur(8px);
  transform: translateY(-50%);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.arrow-left {
  left: 0;
  border-left: 0;
  border-radius: 0 16px 16px 0;
}

.arrow-right {
  right: 0;
  border-right: 0;
  border-radius: 16px 0 0 16px;
}

.arrow-button svg {
  width: 28px;
  height: 28px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.arrow-button:active:not(:disabled) { transform: translateY(-50%) scale(.95); }
.arrow-button:focus-visible { outline: 2px solid #fff; outline-offset: -4px; }

.arrow-button:disabled {
  border-color: rgba(255, 255, 255, .12);
  color: rgba(255, 255, 255, .25);
  background: rgba(25, 25, 25, .48);
  cursor: default;
}

.switching-tip {
  position: absolute;
  z-index: 11;
  top: calc(50% - 56px);
  left: 50%;
  padding: 7px 12px;
  border-radius: 999px;
  color: rgba(255, 255, 255, .88);
  background: rgba(0, 0, 0, .58);
  font-size: 12px;
  opacity: 0;
  transform: translate(-50%, -6px);
  transition: 160ms ease;
  pointer-events: none;
}

.switching-tip.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.playback-panel {
  position: absolute;
  z-index: 10;
  right: 13%;
  bottom: max(9%, calc(env(safe-area-inset-bottom) + 34px));
  left: 13%;
  padding: 11px 13px 13px;
  border: 1px solid rgba(255, 255, 255, .2);
  border-radius: 14px;
  background: rgba(0, 0, 0, .42);
  backdrop-filter: blur(8px);
}

.video-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  color: rgba(255, 255, 255, .82);
  font-size: 11px;
}

.video-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.video-index { flex: 0 0 auto; color: rgba(255, 255, 255, .58); }
.playback-track { height: 5px; }

@media (prefers-reduced-motion: reduce) {
  .loading-screen,
  .switching-tip { transition: none; }
}
