:root {
  color-scheme: dark;
  --bg: #000;
  --text: #fff;
  --focus: rgba(255, 255, 255, 0.7);
}

* {
  box-sizing: border-box;
}

html, body {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Noto Sans JP", "Poppins", "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
}

body > section {
  width: 100%;
  min-height: 100vh;
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Noto Sans JP", "Poppins", "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
}

#app {
  --stage-w: 100vw;
  --stage-h: 100dvh;
  position: relative;
  width: 100vw;
  height: 100dvh;
  margin: 0 auto;
  overflow: hidden;
  background: var(--bg);
}

#main-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
  z-index: 0;
}

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 2;
}

.overlay#overlay-end {
  transition: none;
  pointer-events: none;
}

.overlay#overlay-end.ready {
  pointer-events: auto;
}

.overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.end-fade {
  position: absolute;
  inset: 0;
  background: #000;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--fade-duration, 0.6s) ease;
  z-index: 3;
}

.end-fade.fade-in {
  opacity: 1;
}

.end-fade.fade-out {
  opacity: 0;
}

.overlay-media {
  position: relative;
  width: min(var(--stage-w), calc(var(--stage-h) * var(--aspect)));
  height: min(var(--stage-h), calc(var(--stage-w) / var(--aspect)));
}

.overlay-media img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
}

@media (max-width: 767px) {
  #main-video {
    inset: auto;
    top: 50%;
    left: 0;
    width: 100%;
    height: auto;
    aspect-ratio: 9 / 16;
    transform: translateY(-50%);
  }

  .overlay {
    align-items: center;
    justify-content: flex-start;
  }

  .overlay-media {
    width: 100%;
    height: calc(var(--stage-w) / var(--aspect));
  }

  #overlay-end {
    justify-content: center;
  }

  #overlay-end .overlay-media {
    width: calc(var(--stage-h) * var(--aspect));
    height: var(--stage-h);
  }
}

.end-image {
  opacity: 0;
  transition: opacity 0.7s ease;
}

.end-image.visible {
  opacity: 1;
}

.hotspot {
  position: absolute;
  background: rgba(255, 255, 255, 0.001);
  border: 2px solid transparent;
  border-radius: 999px;
  cursor: pointer;
}

.hotspot.rect {
  border-radius: 12px;
}

.hotspot:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.hotspot.selected {
  box-shadow: 0 0 0 6px rgb(255 231 0 / 50%);
}

#overlay-end .hotspot {
  border-radius: 999px;
}

#audio-off {
  left: 25%;
  top: 50%;
  width: 22%;
  height: 12%;
}

#audio-on {
  left: 53%;
  top: 50%;
  width: 22%;
  height: 12%;
}

#share-btn {
  left: 11%;
  top: 59%;
  width: 79%;
  height: 7.5%;
}

#official-btn {
  left: 10%;
  top: 75.5%;
  width: 80%;
  height: 6%;
}

#dl-btn {
  left: 10%;
  top: 83.5%;
  width: 80%;
  height: 6%;
}

.hidden {
  display: none;
}

.bne-footer {
  display: none;
  width: 100%;
  background: #f2f2f2;
  color: #222;
}

body.sp-footer-visible .bne-footer {
  display: block;
}

@media (min-width: 768px) {
  body {
    display: flex;
    align-items: stretch;
    justify-content: flex-start;
    padding: 0;
    flex-direction: column;
    gap: 0;
  }

  body > section {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 3rem;
  }

  #app {
    width: auto;
    height: 100%;
    max-width: 100vw;
    aspect-ratio: 9 / 16;
    border-radius: 24px;
    outline: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
  }

  #audio-off {
    left: 25%;
    top: 50%;
    width: 22%;
    height: 12%;
  }

  #audio-on {
    left: 53%;
    top: 50%;
    width: 22%;
    height: 12%;
  }

  #share-btn {
    left: 11%;
    top: 59%;
    width: 79%;
    height: 7.5%;
  }

  #official-btn {
    left: 10%;
    top: 75.5%;
    width: 80%;
    height: 6%;
  }

  #dl-btn {
    left: 10%;
    top: 83.5%;
    width: 80%;
    height: 6%;
  }

  .bne-footer {
    display: block;
  }
}
