@monospace: Consolas, Menlo, 'Bitstream Vera Sans Mono', monospace;

div.ap-player {
  div.ap-control-bar {
    width: 100%;
    height: 32px;
    display: flex;
    justify-content: space-between;
    align-items: stretch;
    color: var(--term-color-foreground);
    box-sizing: content-box;
    line-height: 1;
    position: absolute;
    bottom: 0;
    left: 0;
    opacity: 0;
    transition: opacity 0.15s linear;
    user-select: none;
    border-top: 2px solid color-mix(in oklab, var(--term-color-background) 80%, var(--term-color-foreground));
    z-index: 30;

    * {
      box-sizing: inherit;
    }
  }
}

div.ap-control-bar {
  svg.ap-icon {
    path {
      fill: var(--term-color-foreground);
    }
  }

  span.ap-button {
    display: flex;
    flex: 0 0 auto;
    cursor: pointer;
  }

  span.ap-playback-button {
    width: 12px;
    height: 12px;
    padding: 10px;
    margin: 0 0 0 2px;

    svg {
      height: 12px;
      width: 12px;
    }
  }

  span.ap-timer {
    display: flex;
    flex: 0 0 auto;
    min-width: 50px;
    margin: 0 10px;
    height: 100%;
    text-align: center;
    font-size: 13px;
    line-height: 100%;
    cursor: default;

    span {
      font-family: @monospace;
      font-size: inherit;
      font-weight: 600;
      margin: auto;
    }

    .ap-time-remaining {
      display: none;
    }

    &:hover {
      .ap-time-elapsed {
        display: none;
      }

      .ap-time-remaining {
        display: flex;
      }
    }
  }

  .ap-progressbar {
    display: block;
    flex: 1 1 auto;
    height: 100%;
    padding: 0 10px;

    .ap-bar {
      display: block;
      position: relative;
      cursor: default;
      height: 100%;
      font-size: 0;

      .ap-gutter {
        display: block;
        position: absolute;
        top: 15px;
        left: 0;
        right: 0;
        height: 3px;
      }

      .ap-gutter-empty {
        background-color: color-mix(in oklab, var(--term-color-foreground) 20%, var(--term-color-background));
      }

      .ap-gutter-full {
        width: 100%;
        transform-origin: left center;
        background-color: var(--term-color-foreground);
        border-radius: 3px;
      }
    }
  }

  &.ap-seekable {
    .ap-progressbar {
      .ap-bar {
        cursor: pointer;
      }
    }
  }

  .ap-fullscreen-button {
    width: 14px;
    height: 14px;
    padding: 9px;
    margin: 0 2px 0 4px;

    svg {
      width: 14px;
      height: 14px;
    }

    svg.ap-icon-fullscreen-on {
      display: inline;
    }

    svg.ap-icon-fullscreen-off {
      display: none;
    }

    .ap-tooltip {
      right: 5px;
      left: initial;
      transform: none;
    }
  }

  .ap-kbd-button {
    height: 14px;
    padding: 9px;
    margin: 0 0 0 4px;

    svg {
      width: 26px;
      height: 14px;
    }

    .ap-tooltip {
      right: 5px;
      left: initial;
      transform: none;
    }
  }

  .ap-speaker-button {
    width: 19px;
    padding: 6px 9px;
    margin: 0 0 0 4px;
    position: relative;

    svg {
      width: 19px;
    }

    .ap-tooltip {
      left: -50%;
      transform: none;
    }
  }
}

div.ap-wrapper {
  &.ap-hud .ap-control-bar {
    opacity: 1;
  }

  &:fullscreen {
    .ap-fullscreen-button {
      svg.ap-icon-fullscreen-on {
        display: none;
      }

      svg.ap-icon-fullscreen-off {
        display: inline;
      }
    }
  }
}

span.ap-progressbar span.ap-marker-container {
  display: block;
  top: 0;
  bottom: 0;
  width: 21px;
  position: absolute;
  margin-left: -10px;
}

span.ap-marker-container span.ap-marker {
  display: block;
  top: 13px;
  bottom: 12px;
  left: 7px;
  right: 7px;
  background-color: color-mix(in oklab, var(--term-color-foreground) 33%, var(--term-color-background));
  position: absolute;
  transition: top 0.1s, bottom 0.1s, left 0.1s, right 0.1s, background-color 0.1s;
  border-radius: 50%;
}

span.ap-marker-container span.ap-marker.ap-marker-past {
  background-color: var(--term-color-foreground);
}

span.ap-marker-container span.ap-marker:hover,
span.ap-marker-container:hover span.ap-marker {
  background-color: var(--term-color-foreground);
  top: 11px;
  bottom: 10px;
  left: 5px;
  right: 5px;
}
