.shorts-page {
  --shorts-player-max: 430px;
}

.shorts-hero {
  margin-bottom: 24px;
}

.shorts-hero__lead {
  margin: .7rem 0 0;
  max-width: 760px;
  color: var(--ldla-muted);
}

.shorts-app {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(330px, 420px);
  gap: 24px;
  align-items: start;
}

.shorts-player-card,
.shorts-list-card,
.shorts-help {
  padding: 22px;
}

.shorts-player-card {
  height: auto;
}

.shorts-list-card {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: auto;
  overflow: hidden;
}

.shorts-player-card__head,
.shorts-list-card__head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 16px;
}

.shorts-player-card__head h2,
.shorts-list-card__head h2,
.shorts-help h2 {
  margin: 0;
  font-size: 1.2rem;
  line-height: 1.4;
}

.shorts-position,
.shorts-list-count {
  flex: 0 0 auto;
  margin: .2rem 0 0;
  color: var(--ldla-muted);
  font-size: .9rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.shorts-viewer {
  min-width: 0;
}

.shorts-viewer:fullscreen,
.shorts-viewer:-webkit-full-screen {
  box-sizing: border-box;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  padding: 14px 18px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #000;
  overflow: hidden;
}

.shorts-viewer:fullscreen .shorts-player-wrap,
.shorts-viewer:-webkit-full-screen .shorts-player-wrap {
  flex: 0 1 auto;
  width: min(calc((100vh - 88px) * 9 / 16), calc(100vw - 28px));
  width: min(calc((100dvh - 88px) * 9 / 16), calc(100dvw - 28px));
  max-width: none;
  margin: 0 auto;
  border-radius: 0;
  box-shadow: none;
}

.shorts-viewer:fullscreen .shorts-controls,
.shorts-viewer:-webkit-full-screen .shorts-controls {
  flex: 0 0 auto;
  width: min(100%, 760px);
  margin-top: 10px;
  padding: 0;
}

.shorts-viewer:fullscreen .shorts-controls .ui-button,
.shorts-viewer:-webkit-full-screen .shorts-controls .ui-button {
  flex: 0 1 auto;
}

.shorts-viewer:fullscreen .shorts-status,
.shorts-viewer:-webkit-full-screen .shorts-status {
  width: min(100%, 760px);
  color: #fff;
}

.shorts-viewer:fullscreen .shorts-status.is-warning,
.shorts-viewer:-webkit-full-screen .shorts-status.is-warning {
  color: #fed7aa;
}

.shorts-viewer:fullscreen .shorts-status.is-error,
.shorts-viewer:-webkit-full-screen .shorts-status.is-error {
  color: #fecaca;
}

.shorts-player-wrap {
  position: relative;
  width: min(100%, var(--shorts-player-max));
  aspect-ratio: 9 / 16;
  margin-inline: auto;
  overflow: hidden;
  border-radius: 18px;
  background: #0f172a;
  box-shadow: 0 18px 42px rgba(15, 23, 42, .16);
}

.shorts-player,
.shorts-player iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

.shorts-status {
  margin-top: 8px;
  color: var(--ldla-muted);
  font-size: .9rem;
  text-align: center;
}

.shorts-status[hidden] {
  display: none;
}

.shorts-status.is-warning {
  color: #9a3412;
  font-weight: 800;
}

.shorts-status.is-error {
  color: #b91c1c;
  font-weight: 800;
}

.shorts-controls {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 8px;
}

@media (min-width: 768px) {
  .shorts-controls [data-play-pause] {
    inline-size: 7.5em;
    flex: 0 0 7.5em;
    white-space: nowrap;
  }
}

.shorts-repeat-button[aria-pressed="true"] {
  background: var(--ldla-soft);
  border-color: #9dbaf8;
  color: var(--ldla-blue-dark);
}

.shorts-resume {
  margin-top: 16px;
  padding: 14px;
  border: 1px solid #bfdbfe;
  border-radius: 14px;
  background: #eff6ff;
}

.shorts-resume p {
  margin: 0 0 10px;
  color: #1e3a8a;
  font-size: .9rem;
}

.shorts-list-note {
  margin: 0 0 14px;
  color: var(--ldla-muted);
  font-size: .9rem;
}

.shorts-list {
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--ldla-border);
  border-radius: 14px;
  background: #fff;
  scrollbar-gutter: stable;
}

.shorts-list-loading {
  margin: 0;
  padding: 22px;
  color: var(--ldla-muted);
}

.shorts-section-heading {
  position: sticky;
  top: 0;
  z-index: 2;
  margin: 0;
  padding: 9px 12px;
  border-top: 1px solid var(--ldla-border);
  border-bottom: 1px solid var(--ldla-border);
  background: #edf4ff;
  color: var(--ldla-blue-dark);
  font-size: .82rem;
  font-weight: 900;
}

.shorts-section:first-child .shorts-section-heading {
  border-top: 0;
}

.shorts-list-item {
  display: grid;
  grid-template-columns: 3.4em minmax(0, 1fr);
  gap: 10px;
  width: 100%;
  border: 0;
  border-bottom: 1px solid #edf1f7;
  padding: 10px 12px;
  background: #fff;
  color: var(--ldla-ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.shorts-list-item:last-child {
  border-bottom: 0;
}

.shorts-list-item:hover,
.shorts-list-item:focus-visible {
  background: #f8fbff;
  outline: none;
}

.shorts-list-item.is-selected {
  background: #eef4ff;
  box-shadow: inset 3px 0 0 var(--ldla-blue);
}

.shorts-list-item.is-playing {
  background: #e8f8ee;
  box-shadow: inset 3px 0 0 #16a34a;
}

.shorts-list-item.is-selected.is-playing {
  background: #e9f1ff;
  box-shadow: inset 3px 0 0 var(--ldla-blue);
}

.shorts-list-item__number {
  color: var(--ldla-muted);
  font-size: .82rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.shorts-list-item__title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: .93rem;
  font-weight: 700;
}

.shorts-list-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  margin-top: 14px;
}

.shorts-selected {
  margin: 0;
  min-width: 0;
  overflow: hidden;
  color: var(--ldla-muted);
  font-size: .88rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shorts-help {
  margin-top: 24px;
}

.shorts-help__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.shorts-help__grid > div {
  display: grid;
  gap: 4px;
  padding: 14px 16px;
  border-radius: 14px;
  background: #f8fafc;
}

.shorts-help__grid strong {
  color: var(--ldla-blue-dark);
}

.shorts-help__grid span {
  color: var(--ldla-muted);
  font-size: .9rem;
}

@media (max-width: 900px) {
  .shorts-app {
    grid-template-columns: 1fr;
  }

  .shorts-player-card,
  .shorts-list-card {
    height: auto;
  }

  .shorts-list {
    flex: none;
    height: 440px;
  }
}

@media (max-width: 767px) {
  .shorts-player-card,
  .shorts-list-card,
  .shorts-help {
    padding: 16px;
    border-radius: 16px;
  }

  .shorts-player-card__head,
  .shorts-list-card__head {
    gap: 10px;
  }

  .shorts-controls .ui-button {
    flex: 1 1 calc(50% - 10px);
  }

  .shorts-list {
    height: 400px;
  }

  .shorts-list-actions {
    grid-template-columns: 1fr;
  }

  .shorts-list-actions .ui-button {
    width: 100%;
  }

  .shorts-help__grid {
    grid-template-columns: 1fr;
  }
}

/* 388本目の再生完了時に表示する終了カード */
.shorts-complete-card {
  width: 100%;
  height: 100%;
  background: #f8fbff;
}

.shorts-complete-card[hidden],
.shorts-complete-actions[hidden],
.shorts-player[hidden] {
  display: none;
}

.shorts-complete-card img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.shorts-complete-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.shorts-complete-actions .ui-button {
  flex: 0 1 auto;
}

.shorts-viewer:fullscreen.is-complete .shorts-player-wrap,
.shorts-viewer:-webkit-full-screen.is-complete .shorts-player-wrap {
  width: min(calc((100vh - 154px) * 9 / 16), calc(100vw - 28px));
  width: min(calc((100dvh - 154px) * 9 / 16), calc(100dvw - 28px));
}

.shorts-viewer:fullscreen .shorts-complete-actions,
.shorts-viewer:-webkit-full-screen .shorts-complete-actions {
  flex: 0 0 auto;
  width: min(100%, 760px);
}

@media (max-width: 767px) {
  .shorts-complete-actions .ui-button {
    flex: 1 1 calc(50% - 10px);
  }
}
