/* The player uses the visible viewport; only its chapters sheet scrolls. */
html.m-player-mode,
body.m-player-mode {
  height: 100%;
  min-height: 0;
  overflow: hidden;
  overscroll-behavior: none;
  background: #111416;
}
body.m-player-mode { margin: 0; }
body.m-player-mode #app {
  height: 100vh;
  height: 100dvh;
  min-height: 0;
}
.m-player-shell,
.m-player-shell .m-main,
.m-player-shell .m-content-player {
  height: 100%;
  min-height: 0;
}
.m-player-shell { box-shadow: none; }
.m-player-shell .m-main { padding: 0; }
.m-player-shell .m-content-player {
  --player-gap: clamp(8px, 1.2vh, 14px);
  --player-gap: clamp(8px, 1.2dvh, 14px);
  padding: max(12px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
}
.m-player-shell .m-player {
  display: grid;
  grid-template-rows: 44px minmax(0, 1fr) auto auto auto auto;
  gap: var(--player-gap);
  height: 100%;
  min-height: 0;
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
}
.m-player-shell .m-player-top { margin: 0; gap: 12px; }
.m-player-shell .m-player-top > a,
.m-player-shell .m-player-top > button { width: 44px; height: 44px; min-width: 44px; }
.m-player-shell .m-player-top > span { text-align: center; font-size: 15px; }
.m-player-shell .m-player-cover {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  min-width: 0;
  width: 100%;
  max-width: none;
  margin: 0;
}
.m-player-shell .m-player-cover > .book-cover {
  display: block;
  width: auto;
  height: 100%;
  min-height: 0;
  max-width: min(80%, 280px);
  max-height: 420px;
  aspect-ratio: 2 / 3;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 10px 25px #0004;
}
.m-player-shell .m-player-info { min-width: 0; margin: 0; }
.m-player-shell .m-player-info h1 {
  font-size: clamp(20px, 6.2vw, 27px);
  line-height: 1.18;
  overflow-wrap: anywhere;
}
.m-player-shell .m-player-info > p { margin-top: 4px; font-size: 16px; line-height: 1.3; }
.m-player-shell .m-player-info h2 { margin-top: 6px; font-size: 13px; line-height: 1.3; }
.m-player-shell .m-player-timeline { margin: 0; }
.m-player-shell .m-player-timeline input {
  margin: 0;
  /* A transparent border provides a touch target around the thin progress line. */
  box-sizing: content-box;
  height: 4px;
  border: 10px solid transparent;
  border-left: 0;
  border-right: 0;
  background-clip: padding-box;
}
.m-player-shell .m-player-timeline > div { margin-top: 0; font-size: 12px; line-height: 1.3; }
.m-player-shell .m-play-controls { margin: 0; gap: clamp(26px, 10vw, 45px); }
.m-player-shell .m-main-play { width: 76px; height: 76px; flex-shrink: 0; background: var(--m-red); }
.m-player-shell .m-skip { width: 50px; height: 50px; flex-shrink: 0; }
.m-player-shell .m-player-tools { margin: 0; padding: 6px 0; }
.m-player-shell .m-player-tools > label,
.m-player-shell .m-player-tool { min-height: 56px; gap: 5px; padding: 0 4px; }
.m-player-shell .m-player-tools select { min-height: 28px; font-size: 22px; }
.m-player-shell .m-player-tool > svg { width: 24px; height: 24px; }
.m-player-shell .m-player-tools > label > span,
.m-player-shell .m-player-tool > span { font-size: 12px; line-height: 1.2; }
.m-player-shell .m-player-chapters {
  max-height: 80vh;
  max-height: 80dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-bottom: max(20px, env(safe-area-inset-bottom));
  -webkit-overflow-scrolling: touch;
}
.m-player-shell .m-player-chapters > header {
  position: sticky;
  top: -24px;
  z-index: 1;
  background: #1b1e21;
  padding: 8px 0;
}
@media (max-height: 600px) {
  .m-player-shell .m-content-player { --player-gap: 6px; padding-top: max(8px, env(safe-area-inset-top)); padding-bottom: max(10px, env(safe-area-inset-bottom)); }
  .m-player-shell .m-player { grid-template-rows: 44px minmax(0, 1fr) auto auto auto auto; }
  .m-player-shell .m-player-info h1 { font-size: 22px; }
  .m-player-shell .m-player-info > p { font-size: 14px; margin-top: 3px; }
  .m-player-shell .m-player-info h2 { font-size: 12px; margin-top: 4px; }
  .m-player-shell .m-player-timeline input { margin: 0; }
  .m-player-shell .m-main-play { width: 64px; height: 64px; }
  .m-player-shell .m-main-play svg { width: 28px; height: 28px; }
  .m-player-shell .m-skip { width: 46px; height: 46px; }
  .m-player-shell .m-player-tools { padding: 4px 0; }
  .m-player-shell .m-player-tools > label,
  .m-player-shell .m-player-tool { min-height: 50px; gap: 3px; }
  .m-player-shell .m-player-tools select { font-size: 20px; min-height: 24px; }
  .m-player-shell .m-player-tool > svg { width: 22px; height: 22px; }
}
@media (min-width: 560px) and (max-height: 600px) {
  .m-player-shell { max-width: none; }
  .m-player-shell .m-content-player { padding-left: max(20px, env(safe-area-inset-left)); padding-right: max(20px, env(safe-area-inset-right)); }
  .m-player-shell .m-player { max-width: 820px; grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr); grid-template-rows: 44px minmax(0, 1fr) auto auto auto; column-gap: 28px; }
  .m-player-shell .m-player-top { grid-column: 1 / -1; }
  .m-player-shell .m-player-cover { grid-column: 1; grid-row: 2 / 6; }
  .m-player-shell .m-player-cover > .book-cover { max-width: 100%; }
  .m-player-shell .m-player-info { grid-column: 2; align-self: center; }
  .m-player-shell .m-player-timeline,
  .m-player-shell .m-play-controls,
  .m-player-shell .m-player-tools { grid-column: 2; }
  .m-player-shell .m-player-info h1 { font-size: 20px; }
  .m-player-shell .m-main-play { width: 56px; height: 56px; }
  .m-player-shell .m-player-chapters { width: min(100%, 560px); }
}
