.library__header {
  display: flex;
  flex-direction: column;
  gap: var(--inline-space-half);
}

.library__title {
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1.2;
  display: none;
}

.panel {
  --panel-width: 50ch;
  --panel-padding: 1em;

  inline-size: var(--panel-width);
  margin: calc(var(--navbar-height) - var(--block-space)) auto var(--block-space);
  max-inline-size: 100vw;
  padding: var(--panel-padding);

  @media (min-width: 120ch) {
    --panel-padding: 2em;

    box-shadow:
      0 0 0 1px oklch(var(--lch-always-black) / 0.02),
      0 .2em 1.6em -0.8em oklch(var(--lch-always-black) / 0.2),
      0 .4em 2.4em -1em oklch(var(--lch-always-black) / 0.3),
      0 .4em .8em -1.2em oklch(var(--lch-always-black) / 0.4),
      0 .8em 1.2em -1.6em oklch(var(--lch-always-black) / 0.5),
      0 1.2em 1.6em -2em oklch(var(--lch-always-black) / 0.6);
    background-color: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 0.8em;
  }
}

.panel--wide {
  --panel-width: 80ch;
}

.panel__button {
  inset-block-start: var(--block-space);
  inset-inline-start: var(--block-space);
  position: absolute;
}

.library {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: var(--block-space-double);
  overflow-y: auto;
  padding: var(--block-space-double) var(--inline-space);
  margin-top: 40px;
}

.library__section {
  display: flex;
  flex-direction: column;
  padding: var(--block-space) var(--inline-space);
}

.library__section-title {
  font-size: 1.6rem;
  font-weight: 600;
}

.library__card {
  display: flex;
  flex-direction: column;
  gap: var(--block-space);
  padding-top: 2px;
  padding-bottom: 4px;
}

.library__videos {
  display: flex;
  flex-direction: column;
  gap: var(--block-space-double);
}



.library__iframe {
  position: relative;
  padding-block-start: var(--library-aspect, 56.25%);
}

.library__iframe > iframe {
  aspect-ratio: 16 / 9;
  border: 0;
  border-radius: 0.8em;
  position: absolute;
  inset: 0;
  inline-size: 100%;
  block-size: 100%;
}

.library__actions {
  display: flex;
  gap: var(--inline-space);
}

.library__download-dialog {
  --width: 32rem;
  min-block-size: 18rem;

  @media (max-width: 120ch) {
    --width: calc(100vw - 2rem);
    max-inline-size: calc(100vw - 1rem);
    margin: 0.5rem;
  }
}

.library__download-header {
  display: flex;
  flex-direction: column;
  gap: var(--inline-space-half);
  padding: 1.5rem 1.5rem 1rem;

  @media (max-width: 120ch) {
    padding: 1rem 1rem 0.75rem;
  }
}

.library__download-title {
  font-size: 1.25rem;
  font-weight: 600;

  @media (max-width: 120ch) {
    font-size: 1.1rem;
  }
}

.library__download-subtitle {
  color: var(--color-text-lighter);
  font-size: 0.95rem;

  @media (max-width: 120ch) {
    font-size: 0.9rem;
  }
}

.library__download-body {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-block-size: 12rem;
  padding: 0 1.5rem 1.5rem;

  @media (max-width: 120ch) {
    gap: 0.75rem;
    padding: 0 1rem 1rem;
  }
}

.library__download-loading {
  align-items: center;
  color: var(--color-text-lighter);
  display: flex;
  font-size: 0.95rem;
  gap: 0.75rem;
  justify-content: center;
  min-block-size: 5rem;

  @media (max-width: 120ch) {
    flex-direction: column;
    gap: 0.5rem;
    text-align: center;
  }
}

.library__download-loading-text {
  flex: 1;

  @media (max-width: 120ch) {
    flex: none;
  }
}

.library__download-error {
  color: var(--color-text-lighter);
  font-size: 0.95rem;
  min-block-size: 5rem;
  text-align: center;
}

.library__download-loading .spinner {
  block-size: 1.75rem;
  color: currentColor;
  inline-size: 1.75rem;

  @media (max-width: 120ch) {
    block-size: 1.5rem;
    inline-size: 1.5rem;
  }
}

.library__download-error[hidden] {
  display: none;
}

.library__download-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin: 0;
  padding: 0;
  list-style: none;

  @media (max-width: 120ch) {
    gap: 0.5rem;
  }
}

.library__download-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--color-border);
  border-radius: 0.75rem;

  @media (max-width: 120ch) {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
    padding: 0.75rem;
  }
}

.library__download-meta {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;

  @media (max-width: 120ch) {
    align-items: center;
    text-align: center;
  }
}

.library__download-quality {
  font-weight: 600;
}

.library__download-details {
  color: var(--color-text-lighter);
  font-size: 0.9rem;
}

.library__download-link {
  --btn-border-radius: 999px;
  --btn-padding: 0.45rem 1rem;
  text-decoration: none;

  @media (max-width: 120ch) {
    inline-size: 100%;
    justify-content: center;
  }
}

.library__download-fallback {
  display: inline-flex;
  flex-direction: column;
  gap: 0.2rem;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1rem;
  border: 1px solid var(--color-border);
  border-radius: 0.75rem;
  text-decoration: none;
  color: inherit;
  transition: all 0.15s ease;
  min-width: fit-content;

  @media (max-width: 120ch) {
    inline-size: 100%;
    padding: 0.75rem;
  }
}

.library__download-fallback:hover {
  background-color: var(--color-background-hover);
  border-color: var(--color-border-hover);
}

.library__download-fallback-text {
  font-weight: 600;
  text-align: center;
}

.library__download-fallback-size {
  color: var(--color-text-lighter);
  font-size: 0.9rem;
  text-align: center;
}

.library__download-fallback[hidden] {
  display: none;
}

