:root {
  color-scheme: dark;
  --bg: #171022;
  --text: #f6f2ff;
  --muted: #a99eb9;
  --accent: #c4ff43;
  --line: #ffffff20;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  font: inherit;
}

.page {
  background: var(--bg);
  color: var(--text);
  font-family: Arial, sans-serif;
  height: 100dvh;
  display: grid;
  grid-template-rows: 72px minmax(0, 1fr) 88px;
  overflow: hidden;
}

.header,
.footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 0 36px;
}

.header {
  border-bottom: 1px solid var(--line);
}

.brand {
  color: var(--text);
  font-size: 25px;
  font-weight: 900;
  letter-spacing: -1.5px;
  text-decoration: none;
}

.eyebrow {
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 2px;
}

.menuButton,
.arrow,
.fullscreen,
.close,
.filter,
.retry {
  color: var(--text);
  background: transparent;
  border: 1px solid var(--line);
  cursor: pointer;
}

.menuButton {
  border-radius: 24px;
  padding: 12px 18px;
  font-size: 12px;
}

.main {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 0;
  padding: 16px 36px 0;
}

.stage {
  position: relative;
  aspect-ratio: 16 / 9;
  width: min(100%, calc((100dvh - 176px) * 16 / 9));
  background: #211330;
  overflow: hidden;
  box-shadow: 0 12px 50px #0004;
}

.slideImage {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.slideEnter {
  animation: reveal 220ms ease-out;
}

@keyframes reveal {
  from {
    opacity: 0.3;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.mediaLayer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.videoPlay,
.videoPlayer {
  position: absolute;
  pointer-events: auto;
  border: 0;
}

.videoPlay {
  color: white;
  background: transparent;
  cursor: pointer;
  font-size: 32px;
}

.videoPlayer {
  background: black;
  object-fit: contain;
}

.location {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 220px;
}

.sectionName {
  font-size: 13px;
}

.progress {
  height: 2px;
  background: var(--line);
  flex: 1;
  margin: 0 28px;
}

.progressFill {
  height: 100%;
  background: var(--accent);
  width: 1.7857%;
  transition: width 220ms ease;
}

.controls {
  display: flex;
  align-items: center;
  gap: 14px;
}

.arrow,
.fullscreen,
.close {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 21px;
}

.counter {
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.total {
  color: var(--muted);
}

.arrow:disabled {
  opacity: 0.25;
  cursor: default;
}

.menuButton:hover,
.arrow:enabled:hover,
.fullscreen:hover,
.close:hover,
.filter:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.menuButton:focus-visible,
.arrow:focus-visible,
.fullscreen:focus-visible,
.close:focus-visible,
.filter:focus-visible,
.card:focus-visible,
.videoPlay:focus-visible,
.retry:focus-visible,
.brand:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

.catalog {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--line);
  width: min(1280px, 94vw);
  max-height: 90dvh;
  padding: 32px;
  border-radius: 12px;
}

.catalog::backdrop {
  background: #080410df;
  backdrop-filter: blur(12px);
}

.catalogHeader {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.catalogTitle {
  margin: 10px 0 24px;
  font-size: 36px;
  letter-spacing: -1px;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 28px;
}

.filter {
  padding: 9px 13px;
  border-radius: 20px;
  font-size: 12px;
}

.filterActive {
  color: var(--bg);
  background: var(--accent);
  border-color: var(--accent);
}

.grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 22px 16px;
}

.card {
  background: transparent;
  border: 0;
  padding: 0;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.thumbnail {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
  border-radius: 4px;
  border: 1px solid var(--line);
}

.cardLabel {
  display: block;
  margin-top: 8px;
  font-size: 11px;
  line-height: 1.4;
  color: var(--muted);
}

.retry {
  position: absolute;
  inset: 40% 20%;
  background: var(--bg);
  padding: 16px;
}

@media (max-width: 700px) {
  .page {
    grid-template-rows: 60px minmax(0, 1fr) 80px;
  }

  .header,
  .footer {
    padding: 0 16px;
    gap: 12px;
  }

  .progress,
  .eyebrow {
    display: none;
  }

  .main {
    padding: 8px 0;
  }

  .stage {
    width: min(100%, calc((100dvh - 156px) * 16 / 9));
  }

  .location {
    min-width: 0;
  }

  .sectionName {
    font-size: 11px;
  }

  .controls {
    gap: 8px;
  }

  .catalog {
    padding: 20px;
  }

  .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (prefers-reduced-motion: reduce) {
  .slideEnter {
    animation: none;
  }

  .progressFill {
    transition: none;
  }
}

.playIcon {
  display: inline-grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: #171022d9;
  color: var(--accent);
  border: 1px solid #ffffff80;
  padding-left: 4px;
  font-size: 24px;
}

.playIcon:hover {
  background: #171022;
}

.videoForeground {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
}

.videoLink {
  position: absolute;
  pointer-events: auto;
  z-index: 3;
}

.videoLink:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 4px;
}

.pageImmersive {
  grid-template-rows: minmax(0, 1fr) calc(56px + env(safe-area-inset-bottom));
}

.headerImmersive,
.locationImmersive {
  display: none;
}

.mainImmersive {
  padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left);
}

.stageImmersive {
  width: min(100%, calc((100dvh - 56px - env(safe-area-inset-top) - env(safe-area-inset-bottom)) * 16 / 9));
}

.footerImmersive {
  justify-content: flex-end;
  padding: 0 max(16px, env(safe-area-inset-right)) env(safe-area-inset-bottom) max(16px, env(safe-area-inset-left));
}

.orientationHint {
  position: fixed;
  top: max(16px, env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  width: max-content;
  max-width: calc(100vw - 32px);
  padding: 10px 14px;
  border-radius: 8px;
  color: var(--text);
  background: #171022e6;
  font-size: 13px;
  text-align: center;
  pointer-events: none;
  z-index: 4;
}

@media (max-width: 900px),
(pointer: coarse) {
  .pageImmersive {
    grid-template-rows: minmax(0, 1fr);
  }

  .mainImmersive {
    padding-bottom: env(safe-area-inset-bottom);
  }

  .stageImmersive {
    width: min(100%, calc((100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom)) * 16 / 9));
  }

  .footerImmersive {
    position: fixed;
    left: 50%;
    bottom: max(12px, env(safe-area-inset-bottom));
    transform: translateX(-50%);
    z-index: 3;
    width: max-content;
    max-width: calc(100vw - 32px);
    padding: 8px 12px;
    border: 1px solid var(--line);
    border-radius: 32px;
    background: #17102280;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
  }

  .progressImmersive {
    display: none;
  }
}
