.rewind-container {
  border-radius: var(--d-border-radius);
  box-sizing: border-box;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;

  h1,
  h2 {
    font-size: 24px;
  }

  &.-fullscreen {
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    width: calc(100vw - (100vw - 100%) + 2px);
    height: 100vh;
    position: fixed;
    background: rgb(var(--secondary-rgb), 0.5);
    backdrop-filter: blur(4.9px);
    padding: 2em;

    .rewind {
      max-width: 1020px;
    }

    @media (width <= 768px) {
      padding: 0;
    }
  }
}

.rewind {
  width: 100vw;
  height: 100vh;
  max-height: 100%;
  border-radius: 30px;
  container-type: size;
  position: relative;
  overflow: hidden;

  @media (width <= 768px) {
    border: none;
    border-radius: 0;
  }

  &::before,
  &::after {
    display: block;
    pointer-events: none;
    content: "";
    position: absolute;
  }

  &::before {
    width: 100%;
    height: 2px;
    z-index: 3;
    background: rgb(0 0 0 / 0.3);
    opacity: 0.75;
    animation: scanline 6s linear infinite;
  }

  &::after {
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 2;
    background: linear-gradient(
      to bottom,
      transparent 50%,
      rgb(0 0 0 / 0.1) 51%
    );
    background-size: 100% 4px;
    animation: scanlines 1s steps(60) infinite;
  }
}

@keyframes scanline {
  0% {
    transform: translate3d(0, 200000%, 0);
  }
}

@keyframes scanlines {
  0% {
    background-position: 0 50%;
  }
}

.rewind__scroll-wrapper {
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--rewind-black);
  height: 100%;
  width: 100%;
  position: relative;
  display: flex;
  flex-direction: column;
  padding-bottom: var(--safe-area-inset-bottom);
  padding-top: 2em;
}

// specific to override core
.btn.no-text.--special-kbd {
  position: absolute;
  top: 15px;
  right: 24px;
  background-color: #ede9d4;
  border-color: #d7d1b0 #c5bfa0 #d7d1b0 #c5bfa0;
  border-width: 1px 5px 7px 4px;
  box-shadow: -1px 1px 0 1px #c0b99b;
  z-index: 3;
  border-radius: 6px;
  transition:
    transform 0.1s ease,
    box-shadow 0.1s ease;
  transform: skew(3deg);
  font-size: var(--font-down-1);

  .d-icon {
    color: #333;
  }

  .discourse-no-touch & {
    &:hover {
      filter: brightness(0.95);

      .d-icon {
        color: var(--rewind-grey);
      }
    }

    &:active {
      box-shadow: none;
      transform: skew(3deg) translateX(-1px) translateY(1px);
    }
  }
}

.rewind__prev-btn {
  position: absolute;
  bottom: 5px;
  left: 5px;
  z-index: 1;
}

.rewind__next-btn {
  position: absolute;
  bottom: 5px;
  right: 5px;
  z-index: 1;
}

.rewind-loader {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  height: 100cqh;
  gap: 1em;
  box-sizing: border-box;
  background: var(--rewind-black);

  &__text {
    font-weight: 700;
    font-size: var(--font-up-2);
    color: var(--rewind-green);
  }

  .spinner {
    border-color: var(--rewind-white);
    border-right-color: transparent;
  }
}
