:root {
  color-scheme: light;
  --page-bg: #f3f5f8;
  --image-bg: #ffffff;
  --text: #111827;
  --mobile-page-width: 430px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  scroll-behavior: smooth;
  background: var(--page-bg);
}

body {
  width: 100%;
  min-height: 100%;
  margin: 0;
  overflow-x: hidden;
  background: var(--page-bg);
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision;
  touch-action: pan-y pinch-zoom;
}

main {
  width: 100%;
  min-height: 100vh;
  padding: 0 0 env(safe-area-inset-bottom);
  overflow-x: hidden;
}

.image-wrap {
  width: min(100vw, var(--mobile-page-width));
  max-width: var(--mobile-page-width);
  margin: 0 auto;
  overflow: hidden;
  background: var(--image-bg);
}

.image-slice,
.video-slot {
  display: grid;
  width: 100%;
  margin: 0;
  background-position: center;
  background-repeat: no-repeat;
  background-size: 100% 100%;
}

.image-slice {
  background-color: var(--image-bg);
  background-image: var(--slice-720);
  aspect-ratio: var(--slice-ratio-720);
  user-select: none;
}

.video-slot {
  position: relative;
  place-items: center;
  aspect-ratio: var(--video-ratio, 16 / 3);
  border: 0;
  background: #000000;
  background-image:
    linear-gradient(rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0.1)),
    var(--poster);
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  cursor: pointer;
}

.video-slot video {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: #000000;
  object-fit: contain;
}

.video-slot.is-playing {
  background-image: none;
}

.video-volume {
  position: absolute;
  right: 10px;
  bottom: 20px;
  z-index: 3;
  display: flex;
  height: 18px;
  align-items: center;
  gap: 6px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(4px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.video-slot.is-controls-visible .video-volume,
.video-volume:focus-within {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.video-volume-button {
  position: relative;
  display: grid;
  width: 18px;
  height: 18px;
  place-items: center;
  border: 0;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.2);
  color: #ffffff;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.video-volume-button::before {
  content: "";
  width: 10px;
  height: 9px;
  background: currentColor;
  clip-path: polygon(0 32%, 34% 32%, 76% 0, 76% 100%, 34% 68%, 0 68%);
}

.video-slot.is-muted .video-volume-button::after {
  content: "";
  position: absolute;
  width: 12px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  transform: rotate(-45deg);
}

.video-volume-slider {
  --volume-progress: 65%;
  display: block;
  width: 54px;
  height: 16px;
  margin: 0;
  padding: 0;
  border: 0;
  background:
    linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.88) 0 var(--volume-progress),
      rgba(255, 255, 255, 0.24) var(--volume-progress) 100%
    )
    center / 100% 2px no-repeat;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

.video-volume-slider::-webkit-slider-runnable-track {
  height: 16px;
  background: transparent;
}

.video-volume-slider::-webkit-slider-thumb {
  width: 6px;
  height: 6px;
  margin-top: 5px;
  border-radius: 999px;
  background: #ffffff;
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.35);
  -webkit-appearance: none;
}

.video-volume-slider::-moz-range-track {
  height: 16px;
  background: transparent;
}

.video-volume-slider::-moz-range-thumb {
  width: 6px;
  height: 6px;
  border: 0;
  border-radius: 999px;
  background: #ffffff;
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.35);
}

.video-scrubber {
  --scrub-progress: 0%;
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 2;
  display: block;
  width: 100%;
  height: 16px;
  margin: 0;
  padding: 0;
  border: 0;
  background:
    linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.9) 0 var(--scrub-progress),
      rgba(255, 255, 255, 0.28) var(--scrub-progress) 100%
    )
    center / calc(100% - 20px) 2px no-repeat;
  accent-color: #ffffff;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: translateY(4px);
  -webkit-appearance: none;
  appearance: none;
  transition: opacity 160ms ease, transform 160ms ease;
}

.video-slot.is-controls-visible .video-scrubber,
.video-slot.is-scrubbing .video-scrubber {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.video-scrubber::-webkit-slider-runnable-track {
  height: 16px;
  border-radius: 999px;
  background: transparent;
}

.video-scrubber::-webkit-slider-thumb {
  width: 7px;
  height: 7px;
  margin-top: 4.5px;
  border-radius: 999px;
  background: #ffffff;
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.35);
  -webkit-appearance: none;
}

.video-scrubber::-moz-range-track {
  height: 16px;
  border-radius: 999px;
  background: transparent;
}

.video-scrubber::-moz-range-thumb {
  width: 7px;
  height: 7px;
  border: 0;
  border-radius: 999px;
  background: #ffffff;
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.35);
}

.test-badge {
  position: fixed;
  top: max(8px, env(safe-area-inset-top));
  left: max(8px, calc((100vw - var(--mobile-page-width)) / 2 + 8px), env(safe-area-inset-left));
  z-index: 30;
  padding: 5px 8px;
  border: 1px solid rgba(17, 24, 39, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  color: #111827;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.16);
  backdrop-filter: blur(8px);
  pointer-events: none;
}

.top-button {
  position: fixed;
  right: max(12px, calc((100vw - var(--mobile-page-width)) / 2 + 12px), env(safe-area-inset-right));
  bottom: max(12px, env(safe-area-inset-bottom));
  z-index: 20;
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  background: rgba(17, 24, 39, 0.58);
  color: #ffffff;
  font-size: 0;
  line-height: 1;
  text-decoration: none;
  box-shadow: none;
  opacity: 0.86;
  backdrop-filter: blur(8px);
  transition: opacity 160ms ease, background-color 160ms ease, transform 160ms ease;
}

.top-button::before {
  content: "";
  width: 9px;
  height: 9px;
  border-top: 2px solid currentColor;
  border-left: 2px solid currentColor;
  transform: translateY(4px) rotate(45deg);
}

.top-button:hover,
.top-button:focus-visible {
  background: rgba(17, 24, 39, 0.74);
  opacity: 1;
  transform: translateY(-1px);
}

.top-button:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.92);
  outline-offset: 3px;
}

@supports (width: 100dvw) {
  .image-wrap {
    width: min(100dvw, var(--mobile-page-width));
  }
}

@media (min-width: 431px) {
  :root {
    --page-bg: #000000;
  }
}

@media (min-resolution: 1.5dppx), (min-width: 541px) {
  .image-slice {
    aspect-ratio: var(--slice-ratio-1080);
    background-image: var(--slice-1080);
  }
}

@media (max-width: 640px) {
  .top-button {
    width: 34px;
    height: 34px;
  }
}
