:root {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color-scheme: light dark;
  --bg: #101114;
  --panel: #1b1d22;
  --panel-2: #24272e;
  --text: #f6f7f9;
  --muted: #a8adb8;
  --accent: #79a9ff;
  --danger: #ff8f8f;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); min-height: 100vh; }
button, input, select { font: inherit; }
button {
  border: 0; border-radius: .7rem; padding: .7rem 1rem;
  background: var(--accent); color: #08152b; font-weight: 700; cursor: pointer;
}
button.secondary { background: var(--panel-2); color: var(--text); }
button.danger { background: var(--danger); color: #1a1a1a; }
button:disabled { opacity: .55; cursor: wait; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.message { min-height: 1.4rem; color: var(--danger); }

.center-card {
  width: min(420px, calc(100% - 2rem)); margin: 10vh auto;
  background: var(--panel); border-radius: 1.2rem; padding: 2rem;
}
label { display: grid; gap: .4rem; margin: 1rem 0; }
input, select {
  width: 100%; border: 1px solid #3c404a; border-radius: .65rem;
  background: var(--panel-2); color: var(--text); padding: .75rem;
}
.topbar {
  position: sticky; top: 0; z-index: 4; display: flex; justify-content: space-between;
  gap: 1rem; align-items: center; padding: 1rem 1.2rem;
  background: rgba(16,17,20,.95); border-bottom: 1px solid #2c2f36;
}
.top-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.badge { color: var(--muted); margin-left: .5rem; }
main { max-width: 1400px; margin: 0 auto; padding: 1rem 1.2rem 8rem; }
.tabs { display: flex; gap: .5rem; margin: .5rem 0 1rem; }
.tab { background: var(--panel-2); color: var(--text); }
.tab.active { background: var(--accent); color: #08152b; }
.toolbar { display: flex; gap: .7rem; margin-bottom: 1rem; }
.toolbar input { max-width: 520px; }

.library-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1rem;
}
.media-card {
  background: var(--panel); border: 1px solid #2d3038; border-radius: 1rem;
  overflow: hidden; display: grid; grid-template-rows: 150px auto;
}
.cover {
  background: linear-gradient(145deg, #30333b, #1f2127);
  display: grid; place-items: center; overflow: hidden; color: var(--muted);
}
.cover img { width: 100%; height: 100%; object-fit: cover; }
.card-body { padding: .9rem; display: grid; gap: .35rem; }
.card-title { font-weight: 750; }
.card-meta { color: var(--muted); min-height: 1.3rem; font-size: .92rem; }
.card-actions { display: flex; gap: .45rem; margin-top: .5rem; }
.card-actions button { padding: .55rem .7rem; flex: 1; }
.progress { height: .35rem; border-radius: 99px; overflow: hidden; background: #343842; }
.progress > span { display: block; height: 100%; background: var(--accent); }

.player {
  position: fixed; inset: auto 0 0; z-index: 5;
  background: rgba(27,29,34,.98); border-top: 1px solid #343741;
  display: grid; grid-template-columns: minmax(180px, 1fr) minmax(280px, 2fr) auto 100px;
  gap: 1rem; align-items: center; padding: .8rem 1rem;
}
.player-title { display: grid; overflow: hidden; }
.player-title span { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
audio { width: 100%; }
dialog {
  width: min(560px, calc(100% - 2rem)); border: 1px solid #3a3d46;
  border-radius: 1rem; background: var(--panel); color: var(--text); padding: 1.2rem;
}
dialog::backdrop { background: rgba(0,0,0,.65); }
.dialog-actions { display: flex; justify-content: flex-end; margin-top: 1rem; }
.playlist-choice { display: flex; justify-content: space-between; gap: .6rem; padding: .55rem 0; }
.user-row { padding: .5rem 0; border-bottom: 1px solid #343741; }

@media (max-width: 760px) {
  .player { grid-template-columns: 1fr; }
  .topbar { align-items: flex-start; }
  .library-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
}

.book-header {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  margin: 0 0 1.2rem;
  padding: 1rem;
  background: var(--panel);
  border: 1px solid #2d3038;
  border-radius: 1rem;
}
.book-header h1 { margin: 0 0 .25rem; font-size: 1.4rem; }
.book-header p { margin: 0; }
.audiobook-card { cursor: pointer; }
.chapter-list { display: grid; gap: .65rem; }
.chapter-row {
  display: grid;
  grid-template-columns: 3rem minmax(0, 1fr) auto;
  align-items: center;
  gap: 1rem;
  padding: .8rem 1rem;
  background: var(--panel);
  border: 1px solid #2d3038;
  border-radius: .85rem;
}
.chapter-number {
  display: grid;
  place-items: center;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 50%;
  background: var(--panel-2);
  color: var(--muted);
  font-weight: 700;
}
.chapter-info { display: grid; gap: .3rem; min-width: 0; }
.chapter-info strong,
.chapter-info span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chapter-info span { color: var(--muted); font-size: .9rem; }
.chapter-row .progress { max-width: 420px; }

@media (max-width: 620px) {
  .book-header { display: grid; }
  .chapter-row { grid-template-columns: 2.5rem minmax(0, 1fr); }
  .chapter-row > button { grid-column: 1 / -1; }
}

.content-layout {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  gap: 1.2rem;
  align-items: start;
}
.content-main { min-width: 0; }
.side-navigation {
  position: sticky;
  top: 5.2rem;
  display: grid;
  gap: .35rem;
  padding: 1rem;
  background: var(--panel);
  border: 1px solid #2d3038;
  border-radius: 1rem;
}
.side-navigation h2 { margin: 0 0 .5rem; font-size: 1.05rem; }
.side-nav-item {
  width: 100%;
  text-align: left;
  background: transparent;
  color: var(--muted);
  padding: .75rem .8rem;
}
.side-nav-item:hover { background: var(--panel-2); color: var(--text); }
.side-nav-item.active { background: var(--panel-2); color: var(--text); }
.music-group-card { cursor: pointer; }
.music-track-list { display: grid; gap: .65rem; }
.music-track-card {
  grid-template-columns: 76px minmax(0, 1fr);
  grid-template-rows: none;
  min-height: 76px;
}
.music-track-card .cover { min-height: 76px; }
.music-track-card .card-body {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}
.music-track-card .card-title,
.music-track-card .card-meta,
.music-track-card .progress { grid-column: 1; }
.music-track-card .card-actions { grid-column: 2; grid-row: 1 / 4; margin: 0; }

@media (max-width: 780px) {
  .content-layout { grid-template-columns: 1fr; }
  .side-navigation {
    position: static;
    display: flex;
    overflow-x: auto;
    padding: .55rem;
  }
  .side-navigation h2 { display: none; }
  .side-nav-item { width: auto; white-space: nowrap; }
}

@media (max-width: 560px) {
  .music-track-card { grid-template-columns: 58px minmax(0, 1fr); }
  .music-track-card .card-body { grid-template-columns: 1fr; }
  .music-track-card .card-actions { grid-column: 1; grid-row: auto; }
}

.playlist-navigation { display: grid; gap: .25rem; margin-top: .35rem; padding-top: .55rem; border-top: 1px solid #343741; }
.playlist-navigation::before { content: "Playlists"; color: var(--muted); font-size: .8rem; padding: .25rem .8rem; text-transform: uppercase; letter-spacing: .05em; }
.player-actions { display: flex; gap: .45rem; }
.player-actions button { white-space: nowrap; padding: .55rem .7rem; }
.author-group-card { cursor: pointer; }
@media (max-width: 900px) {
  .player { grid-template-columns: 1fr; }
  .player-actions { justify-content: center; }
}


/* Klare Rückmeldung für Lieblingslieder */
button.favorite-active {
  font-weight: 700;
  color: #f5b301;
  border-color: currentColor;
}
button[aria-pressed="true"] {
  transform: translateY(-1px);
}

/* Mobile-first refinements */
html { -webkit-text-size-adjust: 100%; }
body { overflow-x: hidden; }
button, input, select { min-height: 44px; }
button { touch-action: manipulation; }

@media (max-width: 760px) {
  body { padding-bottom: env(safe-area-inset-bottom); }
  main {
    width: 100%;
    padding: .65rem .65rem 15.5rem;
  }

  .topbar {
    position: sticky;
    top: 0;
    padding: .7rem .75rem;
    gap: .55rem;
    align-items: center;
  }
  .topbar > div:first-child {
    min-width: 0;
    display: grid;
    gap: .1rem;
  }
  .topbar > div:first-child strong {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: .98rem;
  }
  .badge { margin-left: 0; font-size: .78rem; }
  .top-actions { gap: .35rem; justify-content: flex-end; }
  .top-actions button {
    min-height: 38px;
    padding: .45rem .6rem;
    font-size: .82rem;
  }

  .tabs {
    position: sticky;
    top: 4.15rem;
    z-index: 3;
    margin: 0 -.65rem .55rem;
    padding: .45rem .65rem;
    background: rgba(16,17,20,.97);
    border-bottom: 1px solid #2c2f36;
  }
  .tabs .tab { flex: 1; padding: .6rem .7rem; }

  .content-layout { display: block; }
  .side-navigation {
    position: sticky;
    top: 7.55rem;
    z-index: 2;
    display: flex;
    gap: .35rem;
    margin: 0 0 .65rem;
    padding: .4rem;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scrollbar-width: none;
    border-radius: .8rem;
  }
  .side-navigation::-webkit-scrollbar { display: none; }
  .side-navigation h2,
  .playlist-navigation::before { display: none; }
  .side-nav-item {
    flex: 0 0 auto;
    width: auto;
    min-height: 40px;
    padding: .5rem .7rem;
    font-size: .86rem;
    white-space: nowrap;
  }
  .playlist-navigation {
    display: contents;
    border: 0;
    margin: 0;
    padding: 0;
  }

  .toolbar {
    display: grid;
    grid-template-columns: minmax(0,1fr) auto;
    gap: .45rem;
    margin-bottom: .65rem;
  }
  .toolbar input { min-width: 0; max-width: none; }
  .toolbar button { padding-inline: .7rem; }

  .library-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: .65rem;
  }
  .media-card,
  .audiobook-card,
  .music-group-card,
  .author-group-card {
    grid-template-columns: 92px minmax(0,1fr);
    grid-template-rows: auto;
    min-height: 92px;
    border-radius: .8rem;
  }
  .media-card > .cover {
    min-height: 92px;
    height: 100%;
  }
  .card-body {
    min-width: 0;
    padding: .7rem;
    gap: .25rem;
  }
  .card-title,
  .card-meta {
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .card-title { font-size: .98rem; }
  .card-meta { min-height: 0; font-size: .82rem; }
  .card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;
    margin-top: .35rem;
  }
  .card-actions button {
    flex: 1 1 auto;
    min-height: 38px;
    padding: .4rem .55rem;
    font-size: .8rem;
  }
  .audiobook-card .card-actions button[data-action="resume"] { flex-basis: 100%; }

  .book-header {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: .55rem;
    padding: .7rem;
    margin-bottom: .65rem;
  }
  .book-header > div { grid-column: 1 / -1; min-width: 0; }
  .book-header h1 {
    font-size: 1.15rem;
    overflow-wrap: anywhere;
  }
  .book-header button { min-height: 40px; padding: .45rem .65rem; font-size: .82rem; }

  .chapter-list,
  .music-track-list { gap: .45rem; }
  .chapter-row {
    grid-template-columns: 2.2rem minmax(0,1fr) auto;
    gap: .55rem;
    padding: .6rem;
  }
  .chapter-number { width: 2rem; height: 2rem; font-size: .8rem; }
  .chapter-info strong { font-size: .9rem; }
  .chapter-info span { font-size: .78rem; }
  .chapter-row > button {
    grid-column: auto;
    min-height: 38px;
    padding: .4rem .55rem;
    font-size: .8rem;
  }

  .music-track-card {
    grid-template-columns: 64px minmax(0,1fr);
    min-height: 72px;
  }
  .music-track-card > .cover { min-height: 72px; }
  .music-track-card .card-body {
    display: grid;
    grid-template-columns: minmax(0,1fr) auto;
    gap: .25rem .4rem;
  }
  .music-track-card .card-actions {
    grid-column: 1 / -1;
    grid-row: auto;
  }

  .player {
    inset: auto 0 0;
    grid-template-columns: minmax(0,1fr) auto;
    gap: .45rem .6rem;
    padding: .55rem .65rem calc(.55rem + env(safe-area-inset-bottom));
    box-shadow: 0 -8px 24px rgba(0,0,0,.35);
  }
  .player-title {
    grid-column: 1;
    font-size: .86rem;
  }
  .player-title strong,
  .player-title span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .player audio {
    grid-column: 1 / -1;
    height: 42px;
  }
  .player-actions {
    grid-column: 1;
    justify-content: flex-start;
    min-width: 0;
  }
  .player-actions button {
    min-height: 38px;
    padding: .4rem .55rem;
    font-size: .78rem;
  }
  .speed {
    grid-column: 2;
    grid-row: 1;
    align-self: start;
  }
  .speed label {
    display: flex;
    align-items: center;
    gap: .3rem;
    margin: 0;
    font-size: 0;
  }
  .speed label::before { content: "Tempo"; font-size: .72rem; color: var(--muted); }
  .speed select { width: 68px; min-height: 38px; padding: .35rem; }

  dialog {
    width: calc(100% - 1rem);
    max-height: calc(100dvh - 1rem);
    overflow: auto;
    padding: 1rem;
  }
}

@media (max-width: 430px) {
  .topbar { align-items: flex-start; }
  .top-actions button#scanButton,
  .top-actions button#adminButton { font-size: 0; width: 38px; padding: .35rem; }
  .top-actions button#scanButton::before { content: "↻"; font-size: 1rem; }
  .top-actions button#adminButton::before { content: "⚙"; font-size: 1rem; }
  .top-actions button#logoutButton { font-size: .78rem; }

  .media-card,
  .audiobook-card,
  .music-group-card,
  .author-group-card { grid-template-columns: 78px minmax(0,1fr); min-height: 78px; }
  .media-card > .cover { min-height: 78px; }

  .chapter-row { grid-template-columns: 1.9rem minmax(0,1fr); }
  .chapter-row > button { grid-column: 1 / -1; }

  .player-actions #currentPlaylistButton { font-size: 0; }
  .player-actions #currentPlaylistButton::after { content: "+ Playlist"; font-size: .76rem; }
}


/* Zentrierte Cover und reine Icon-Schaltflächen */
.icon-button {
  display: inline-grid;
  place-items: center;
  min-width: 44px;
  padding-inline: .72rem;
  font-size: 1.15rem;
  line-height: 1;
}
.media-card {
  padding-top: .85rem;
}
.media-card > .cover {
  width: min(170px, calc(100% - 1.7rem));
  aspect-ratio: 1 / 1;
  height: auto;
  min-height: 0;
  justify-self: center;
  border-radius: .8rem;
}
.audiobook-card > .cover,
.author-group-card > .cover {
  width: min(132px, calc(100% - 1.7rem));
  aspect-ratio: 2 / 3;
}
.cover img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}
.card-actions { justify-content: center; }
.card-actions .icon-button { flex: 0 0 44px; }
.chapter-row > .icon-button { min-width: 46px; }

@media (max-width: 760px) {
  .media-card,
  .audiobook-card,
  .music-group-card,
  .author-group-card {
    padding-top: 0;
  }
  .media-card > .cover,
  .audiobook-card > .cover,
  .music-group-card > .cover,
  .author-group-card > .cover {
    width: 76px;
    height: 76px;
    min-height: 76px;
    aspect-ratio: 1 / 1;
    margin: 0;
    align-self: center;
    justify-self: center;
    border-radius: .65rem;
  }
  .music-track-card > .cover {
    width: 64px;
    height: 64px;
    min-height: 64px;
  }
  .tabs .icon-button { flex: 1; }
  .side-nav-item.icon-button { min-width: 46px; width: 46px; padding: .5rem; }
}


/* Ausgeschriebene Navigation */
.side-nav-item {
  display: flex;
  align-items: center;
  gap: .65rem;
}
.side-nav-item > span:first-child {
  width: 1.35rem;
  flex: 0 0 1.35rem;
  text-align: center;
}

/* Begonnene Hörbücher zuerst */
.audiobook-library .library-section-title {
  grid-column: 1 / -1;
  margin: .4rem 0 0;
  font-size: 1.15rem;
}
.audiobook-card.currently-playing {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}
.playing-badge {
  width: fit-content;
  padding: .2rem .5rem;
  border-radius: 999px;
  background: var(--accent);
  color: #08152b;
  font-size: .72rem;
  font-weight: 800;
}

/* Erweiterter Player mit Kapitelsteuerung */
.player {
  grid-template-columns: auto minmax(160px, 1fr) minmax(280px, 2fr) auto auto 100px;
}
.player-expand { order: -2; }
.player-cover-wrap {
  display: none;
  overflow: hidden;
  border-radius: .8rem;
  background: var(--panel-2);
}
.player-cover { width: 100%; height: 100%; object-fit: cover; display: block; }
.chapter-navigation {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
}
.player-title-line {
  display: flex;
  align-items: baseline;
  gap: .4rem;
  min-width: 0;
}
.player-title-line strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chapter-position {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: .82rem;
  white-space: nowrap;
}
.chapter-navigation button { cursor: pointer; }
.chapter-navigation button.is-disabled { opacity: .35; cursor: pointer; }

.player-play-pause {
  width: 46px;
  min-width: 46px;
  height: 46px;
  padding: 0;
  border-radius: 50%;
  font-size: 1.15rem;
  display: inline-grid;
  place-items: center;
}
.player-fullscreen .player-play-pause {
  width: 58px;
  min-width: 58px;
  height: 58px;
  font-size: 1.4rem;
}

.player.player-fullscreen {
  inset: 0;
  width: 100%;
  height: 100dvh;
  z-index: 50;
  display: grid;
  grid-template-columns: minmax(0, 460px);
  grid-template-rows: auto minmax(0, 1fr) auto auto auto auto;
  justify-content: center;
  align-content: center;
  gap: 1rem;
  padding: max(1rem, env(safe-area-inset-top)) 1.2rem max(1rem, env(safe-area-inset-bottom));
  overflow-y: auto;
}
.player-fullscreen .player-expand {
  position: fixed;
  top: max(.8rem, env(safe-area-inset-top));
  right: .8rem;
  z-index: 51;
}
.player-fullscreen .player-cover-wrap {
  display: block;
  width: min(72vw, 390px);
  aspect-ratio: 1 / 1;
  justify-self: center;
}
.player-fullscreen .player-title { text-align: center; font-size: 1.05rem; }
.player-fullscreen .player-title strong { font-size: 1.35rem; }
.player-fullscreen audio { width: 100%; }
.player-fullscreen .player-actions,
.player-fullscreen .chapter-navigation { justify-self: center; }
.player-fullscreen .speed { justify-self: center; }
body.player-is-fullscreen { overflow: hidden; }

@media (max-width: 900px) {
  .player:not(.player-fullscreen) {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }
  .player:not(.player-fullscreen) .player-title { grid-column: 2; }
  .player:not(.player-fullscreen) .player-expand { grid-column: 1; grid-row: 1; }
  .player:not(.player-fullscreen) .speed { grid-column: 3; grid-row: 1; }
  .player:not(.player-fullscreen) audio { grid-column: 1 / -1; }
  .player:not(.player-fullscreen) .chapter-navigation { grid-column: 1 / -1; }
  .player:not(.player-fullscreen) .player-actions { grid-column: 1 / -1; justify-content: center; }
}

@media (max-width: 760px) {
  .side-nav-item { width: auto !important; min-width: max-content !important; }
  .audiobook-library .library-section-title { font-size: 1rem; margin-top: .6rem; }
  .player:not(.player-fullscreen) {
    grid-template-columns: auto minmax(0,1fr) auto;
    padding-bottom: calc(.55rem + env(safe-area-inset-bottom));
  }
  .player-fullscreen .player-cover-wrap {
    width: min(82vw, 360px);
  }
}

/* Alle Cover und Vorschaubilder konsequent quadratisch darstellen */
.media-card > .cover,
.audiobook-card > .cover,
.music-group-card > .cover,
.music-track-card > .cover,
.author-group-card > .cover,
.player-cover-wrap {
  aspect-ratio: 1 / 1;
}

.audiobook-card > .cover,
.author-group-card > .cover {
  width: min(132px, calc(100% - 1.7rem));
  height: auto;
}

.cover img,
.player-cover {
  width: 100%;
  height: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  object-position: center;
}


/* Eigene Wiedergabeposition statt nativer Audio-Steuerung */
.player audio {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
.playback-progress {
  display: grid;
  grid-template-columns: auto minmax(120px, 1fr) auto;
  align-items: center;
  gap: .65rem;
  min-width: 0;
}
.time-label {
  min-width: 3.3rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-size: .8rem;
  text-align: center;
}
#playbackPositionSlider {
  --played: 0%;
  width: 100%;
  height: 28px;
  margin: 0;
  padding: 0;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  touch-action: pan-y;
}
#playbackPositionSlider::-webkit-slider-runnable-track {
  height: 7px;
  border-radius: 999px;
  background: linear-gradient(to right, var(--accent) 0 var(--played), #444852 var(--played) 100%);
}
#playbackPositionSlider::-moz-range-track {
  height: 7px;
  border-radius: 999px;
  background: #444852;
}
#playbackPositionSlider::-moz-range-progress {
  height: 7px;
  border-radius: 999px;
  background: var(--accent);
}
#playbackPositionSlider::-webkit-slider-thumb {
  width: 20px;
  height: 20px;
  margin-top: -6.5px;
  border: 3px solid var(--panel);
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 2px 8px rgba(0,0,0,.45);
  appearance: none;
  -webkit-appearance: none;
}
#playbackPositionSlider::-moz-range-thumb {
  width: 17px;
  height: 17px;
  border: 3px solid var(--panel);
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 2px 8px rgba(0,0,0,.45);
}
#playbackPositionSlider:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 999px;
}
.speed select {
  min-width: 64px;
  cursor: pointer;
  font-weight: 700;
  text-align: center;
}

/* Navigationstexte auch auf kleinen Displays immer anzeigen */
.side-nav-item > span:last-child {
  display: inline !important;
  visibility: visible !important;
  opacity: 1 !important;
}

@media (max-width: 900px) {
  .player:not(.player-fullscreen) .playback-progress { grid-column: 1 / -1; }
}
@media (max-width: 760px) {
  .playback-progress { gap: .35rem; }
  .time-label { min-width: 2.8rem; font-size: .72rem; }
  #playbackPositionSlider { min-width: 0; }
  .speed select { width: 62px; min-width: 62px; min-height: 38px; padding: .35rem .2rem; }
  .side-nav-item { display: inline-flex !important; }
}
.player-fullscreen .playback-progress { width: min(92vw, 620px); }

@media (max-width: 760px) { .speed label::before { content: none !important; } }

/* Player-Redesign v13 */
.player {
  position: fixed;
  inset: auto 0 0;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas:
    "top"
    "title"
    "nav"
    "chapter"
    "progress"
    "actions";
  gap: .55rem;
  align-items: center;
  padding: .85rem 1rem calc(.9rem + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, rgba(24,27,34,.98), rgba(14,16,22,.99));
  border-top: 1px solid rgba(122, 130, 148, .22);
  box-shadow: 0 -12px 36px rgba(0, 0, 0, .34);
  backdrop-filter: blur(16px);
}
.player-top-controls {
  grid-area: top;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: .7rem;
}
.player-top-controls .player-expand,
.player-top-controls .speed select {
  min-height: 44px;
  border-radius: 1rem;
}
.player-top-controls .player-expand {
  width: 44px;
  min-width: 44px;
  padding: 0;
  display: inline-grid;
  place-items: center;
}
.player-top-controls .speed {
  width: auto;
}
.player-top-controls .speed select {
  width: auto;
  min-width: 72px;
  padding: .6rem .85rem;
  border: 0;
  background: rgba(34, 38, 48, .96);
  color: var(--text);
  font-weight: 800;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.06);
}
.player-title {
  grid-area: title;
  display: grid;
  gap: .2rem;
  min-width: 0;
  text-align: center;
}
.player-title strong {
  font-size: 1.05rem;
  font-weight: 800;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.player-title span {
  color: var(--muted);
  font-size: .95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chapter-navigation {
  grid-area: nav;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
}
.chapter-navigation button {
  width: 50px;
  min-width: 50px;
  height: 50px;
  padding: 0;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  font-size: 1rem;
  background: rgba(38, 42, 53, .94);
  color: var(--text);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.05);
}
.chapter-navigation button:hover {
  filter: brightness(1.08);
}
.player-play-pause {
  width: 68px !important;
  min-width: 68px !important;
  height: 68px !important;
  font-size: 1.55rem !important;
  background: linear-gradient(180deg, #8ab3ff, #6d98f7) !important;
  color: white !important;
  box-shadow: 0 10px 22px rgba(58, 99, 195, .3) !important;
}
.chapter-position {
  grid-area: chapter;
  justify-self: center;
  text-align: center;
  min-height: 1.1rem;
  color: var(--muted);
  font-size: .92rem;
}
.playback-progress {
  grid-area: progress;
  width: min(100%, 720px);
  justify-self: center;
  background: transparent;
  padding: 0;
  border: 0;
  box-shadow: none;
}
.time-label {
  min-width: 3.1rem;
  text-align: center;
  color: #c3c8d3;
}
#playbackPositionSlider {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  min-width: 0;
  height: 28px;
  margin: 0;
  padding: 0;
  border: 0 !important;
  outline: 0;
  border-radius: 0;
  background: transparent !important;
  box-shadow: none !important;
  cursor: pointer;
}
#playbackPositionSlider::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(to right, var(--accent) 0 var(--played), rgba(255,255,255,.18) var(--played) 100%);
}
#playbackPositionSlider::-moz-range-track {
  height: 6px;
  border-radius: 999px;
  background: rgba(255,255,255,.18);
}
#playbackPositionSlider::-moz-range-progress {
  height: 6px;
  border-radius: 999px;
  background: var(--accent);
}
#playbackPositionSlider::-webkit-slider-thumb {
  width: 18px;
  height: 18px;
  margin-top: -6px;
  border: 0;
  border-radius: 50%;
  background: #8db2ff;
  box-shadow: 0 2px 8px rgba(0,0,0,.38);
  appearance: none;
  -webkit-appearance: none;
}
#playbackPositionSlider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border: 0;
  border-radius: 50%;
  background: #8db2ff;
  box-shadow: 0 2px 8px rgba(0,0,0,.38);
}
#playbackPositionSlider:focus-visible {
  outline: none;
}
.player-actions {
  grid-area: actions;
  justify-content: center;
  display: flex;
  gap: .6rem;
}
.player-actions button {
  min-height: 40px;
  padding: .55rem .8rem;
  background: rgba(38, 42, 53, .92);
  color: var(--text);
}
.player-cover-wrap {
  display: none;
}
.player.player-fullscreen {
  inset: 0;
  min-height: 100dvh;
  border-top: 0;
  grid-template-columns: minmax(0, 580px);
  grid-template-areas:
    "top"
    "cover"
    "title"
    "nav"
    "chapter"
    "progress"
    "actions";
  justify-content: center;
  align-content: start;
  padding: max(1rem, env(safe-area-inset-top)) 1.2rem max(1rem, env(safe-area-inset-bottom));
  gap: 1rem;
  overflow-y: auto;
  background:
    radial-gradient(circle at top, rgba(74, 110, 214, .14), transparent 36%),
    linear-gradient(180deg, #0f1320 0%, #090b12 100%);
}
.player.player-fullscreen::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(255,255,255,.03), transparent 16%, transparent 84%, rgba(255,255,255,.02));
}
.player-fullscreen .player-top-controls {
  position: sticky;
  top: 0;
  z-index: 2;
}
.player-fullscreen .player-cover-wrap {
  grid-area: cover;
  display: block;
  width: min(72vw, 390px);
  justify-self: center;
  border-radius: 1.55rem;
  overflow: hidden;
  background: #1f2531;
  box-shadow: 0 22px 48px rgba(0, 0, 0, .36);
}
.player-fullscreen .player-cover {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}
.player-fullscreen .player-title {
  gap: .35rem;
  padding-inline: .5rem;
}
.player-fullscreen .player-title strong {
  font-size: clamp(1.65rem, 4.6vw, 2.65rem);
  white-space: normal;
  text-wrap: balance;
  overflow: visible;
}
.player-fullscreen .player-title span {
  font-size: clamp(1rem, 2.9vw, 1.45rem);
}
.player-fullscreen .chapter-navigation {
  gap: 1.35rem;
}
.player-fullscreen .chapter-navigation button {
  width: 72px;
  min-width: 72px;
  height: 72px;
  font-size: 1.25rem;
}
.player-fullscreen .player-play-pause {
  width: 104px !important;
  min-width: 104px !important;
  height: 104px !important;
  font-size: 2.15rem !important;
}
.player-fullscreen .chapter-position {
  font-size: 1.05rem;
}
.player-fullscreen .playback-progress {
  width: min(92vw, 680px);
}
.player-fullscreen .time-label {
  font-size: .95rem;
}
.player-fullscreen .player-actions {
  gap: .8rem;
}
.player-fullscreen .player-actions button {
  min-height: 44px;
  padding: .7rem .95rem;
  border-radius: .95rem;
}
body.player-is-fullscreen {
  overflow: hidden;
}
@media (max-width: 760px) {
  .player {
    padding-inline: .85rem;
  }
  .player-title strong {
    font-size: 1rem;
  }
  .player-title span {
    font-size: .88rem;
  }
  .chapter-navigation {
    gap: .8rem;
  }
  .chapter-navigation button {
    width: 46px;
    min-width: 46px;
    height: 46px;
  }
  .player-play-pause {
    width: 62px !important;
    min-width: 62px !important;
    height: 62px !important;
  }
  .playback-progress {
    width: 100%;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: .45rem;
  }
  .time-label {
    min-width: 2.75rem;
    font-size: .74rem;
  }
  .player-actions button {
    min-height: 38px;
    padding: .5rem .72rem;
  }
  .player-fullscreen .player-cover-wrap {
    width: min(84vw, 360px);
  }
  .player-fullscreen .chapter-navigation button {
    width: 64px;
    min-width: 64px;
    height: 64px;
  }
  .player-fullscreen .player-play-pause {
    width: 92px !important;
    min-width: 92px !important;
    height: 92px !important;
  }
}

/* Player-Refinement v14 */
.player {
  --cover-rgb: 121, 169, 255;
  background:
    radial-gradient(circle at 50% -20%, rgba(var(--cover-rgb), .16), transparent 38%),
    linear-gradient(180deg, rgba(24,27,34,.98), rgba(14,16,22,.99));
}
.player.player-fullscreen {
  background:
    radial-gradient(circle at 50% 10%, rgba(var(--cover-rgb), .24), transparent 38%),
    linear-gradient(180deg, #0f1320 0%, #090b12 100%);
}
.player-fullscreen .player-cover-wrap {
  box-shadow:
    0 24px 52px rgba(0, 0, 0, .42),
    0 0 0 1px rgba(255,255,255,.05),
    0 0 42px rgba(var(--cover-rgb), .14);
}
.player-play-pause {
  background: linear-gradient(180deg, rgba(var(--cover-rgb), .98), rgba(var(--cover-rgb), .76)) !important;
  box-shadow: 0 10px 22px rgba(var(--cover-rgb), .3) !important;
}
.seek-button {
  font-size: .92rem !important;
  font-weight: 800;
  letter-spacing: -.02em;
}
.chapter-meta {
  grid-area: chapter;
  display: grid;
  justify-items: center;
  gap: .15rem;
}
.chapter-position {
  min-height: 1.1rem;
}
.current-chapter-label {
  max-width: min(92vw, 520px);
  color: #d2d7e1;
  font-size: .82rem;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.player-actions {
  gap: .8rem;
}
.player-action-icon {
  width: 42px;
  min-width: 42px;
  height: 42px;
  padding: 0 !important;
  border-radius: 999px !important;
  display: inline-grid;
  place-items: center;
  font-size: 1.05rem;
  background: rgba(38, 42, 53, .92) !important;
  color: var(--text) !important;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.05);
}
.player-action-icon.favorite-active {
  color: #ffd76f !important;
}
.player-fullscreen .current-chapter-label {
  max-width: min(88vw, 640px);
  font-size: .95rem;
  color: #dde2ec;
}
.player-fullscreen .player-action-icon {
  width: 48px;
  min-width: 48px;
  height: 48px;
  font-size: 1.12rem;
}
@media (max-width: 760px) {
  .chapter-navigation {
    gap: .55rem;
    flex-wrap: nowrap;
  }
  .seek-button {
    font-size: .82rem !important;
  }
  .current-chapter-label {
    max-width: 88vw;
    font-size: .76rem;
  }
  .player-action-icon {
    width: 38px;
    min-width: 38px;
    height: 38px;
    font-size: .98rem;
  }
}

/* Player-Korrekturen v15 */
.player-title,
.player-title strong,
.player-title span,
.chapter-meta,
.chapter-position,
.playback-progress,
.time-label {
  text-align: center;
}

.player-fullscreen .player-top-controls {
  position: static;
  width: 100%;
  min-height: 46px;
  margin-bottom: .35rem;
  padding-inline: .1rem;
}
.player-fullscreen .player-expand {
  position: static !important;
  top: auto !important;
  right: auto !important;
}
.player-fullscreen .player-cover-wrap {
  margin-top: 0;
}

.chapter-navigation button {
  width: 44px;
  min-width: 44px;
  height: 44px;
  font-size: .92rem;
}
.player-play-pause {
  width: 58px !important;
  min-width: 58px !important;
  height: 58px !important;
  font-size: 1.35rem !important;
}
.player-fullscreen .chapter-navigation {
  gap: .8rem;
  width: 100%;
  justify-content: center;
}
.player-fullscreen .chapter-navigation button {
  width: 56px;
  min-width: 56px;
  height: 56px;
  font-size: 1rem;
}
.player-fullscreen .player-play-pause {
  width: 78px !important;
  min-width: 78px !important;
  height: 78px !important;
  font-size: 1.7rem !important;
}
.player-fullscreen .player-title,
.player-fullscreen .player-title strong,
.player-fullscreen .player-title span,
.player-fullscreen .chapter-meta,
.player-fullscreen .chapter-position {
  text-align: center;
  justify-items: center;
}
.current-chapter-label {
  display: none !important;
}

@media (max-width: 760px) {
  .player-fullscreen {
    padding-inline: .8rem;
  }
  .player-fullscreen .player-top-controls {
    min-height: 44px;
    margin-bottom: .55rem;
  }
  .player-fullscreen .chapter-navigation {
    gap: .42rem;
  }
  .player-fullscreen .chapter-navigation button {
    width: 46px;
    min-width: 46px;
    height: 46px;
    font-size: .88rem;
  }
  .player-fullscreen .player-play-pause {
    width: 68px !important;
    min-width: 68px !important;
    height: 68px !important;
    font-size: 1.5rem !important;
  }
  .seek-button {
    font-size: .76rem !important;
  }
}

/* Player-Korrekturen v16 */
.chapter-meta {
  min-height: 1.4rem;
}
.chapter-position {
  display: block;
  width: 100%;
  font-size: .96rem;
  font-weight: 600;
  color: #cbd1dc;
}
.player.player-fullscreen {
  grid-template-columns: minmax(0, 430px);
  gap: .85rem;
}
.player-fullscreen .player-cover-wrap {
  width: min(56vw, 300px);
  max-width: 100%;
  justify-self: center;
}
.player-fullscreen .player-title {
  margin-top: -.1rem;
}
.player-fullscreen .chapter-meta {
  margin-top: -.15rem;
}
@media (max-width: 760px) {
  .player.player-fullscreen {
    grid-template-columns: minmax(0, 390px);
    gap: .72rem;
  }
  .player-fullscreen .player-cover-wrap {
    width: min(64vw, 260px);
  }
  .chapter-position {
    font-size: .92rem;
  }
}

/* Verfeinerte obere Player-Leiste v17 */
.player-top-controls {
  width: 100%;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: .55rem;
}
.player-top-controls .speed select,
.player-top-controls .player-expand {
  height: 42px;
  min-height: 42px;
  border-radius: 999px;
  background: rgba(31, 35, 44, .82);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, .08);
  box-shadow:
    0 6px 18px rgba(0, 0, 0, .18),
    inset 0 1px 0 rgba(255, 255, 255, .035);
  backdrop-filter: blur(10px);
}
.player-top-controls .speed select {
  width: auto;
  min-width: 68px;
  padding: 0 1.85rem 0 .9rem;
  font-size: .95rem;
  font-weight: 800;
  text-align: center;
  cursor: pointer;
}
.player-top-controls .player-expand {
  width: 42px;
  min-width: 42px;
  padding: 0;
  font-size: 1.05rem;
  line-height: 1;
  display: inline-grid;
  place-items: center;
}
.player-top-controls .speed select:hover,
.player-top-controls .player-expand:hover {
  background: rgba(42, 47, 58, .9);
  border-color: rgba(255, 255, 255, .12);
}
.player-top-controls .speed select:focus-visible,
.player-top-controls .player-expand:focus-visible {
  outline: 2px solid rgba(var(--cover-rgb), .8);
  outline-offset: 2px;
}
.player-fullscreen .player-top-controls {
  min-height: 44px;
  margin: 0 0 .2rem;
}
.player-fullscreen .player-top-controls .speed select,
.player-fullscreen .player-top-controls .player-expand {
  background: rgba(27, 31, 39, .76);
}
@media (max-width: 760px) {
  .player-top-controls {
    gap: .45rem;
  }
  .player-top-controls .speed select,
  .player-top-controls .player-expand {
    height: 40px;
    min-height: 40px;
  }
  .player-top-controls .speed select {
    min-width: 64px;
    padding-inline: .75rem 1.7rem;
    font-size: .9rem;
  }
  .player-top-controls .player-expand {
    width: 40px;
    min-width: 40px;
  }
}

/* Kapitelposition sicher zentrieren v18 */
.chapter-meta {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.chapter-meta .chapter-position {
  width: 100%;
  margin: 0 auto;
  text-align: center;
  justify-self: center;
  align-self: center;
}


/* Mini-Player-Redesign v19 */
.player:not(.player-fullscreen) {
  grid-template-columns: 44px minmax(0, 1fr) 76px;
  grid-template-areas:
    "top-left title top-right"
    "nav nav nav"
    "chapter chapter chapter"
    "progress progress progress";
  gap: .55rem .75rem;
  align-items: center;
  padding: .75rem .9rem calc(.75rem + env(safe-area-inset-bottom));
  border-top-left-radius: 1rem;
  border-top-right-radius: 1rem;
}
.player:not(.player-fullscreen) .player-top-controls {
  display: contents;
}
.player:not(.player-fullscreen) .player-expand {
  grid-area: top-left;
  justify-self: start;
  width: 40px;
  min-width: 40px;
  height: 40px;
  border-radius: 999px;
  padding: 0;
}
.player:not(.player-fullscreen) .speed {
  grid-area: top-right;
  justify-self: end;
}
.player:not(.player-fullscreen) .speed select {
  min-width: 68px;
  min-height: 40px;
  padding: .45rem .75rem;
  border-radius: 999px;
}
.player:not(.player-fullscreen) .player-title {
  grid-area: title;
  align-self: center;
  gap: .12rem;
  padding: 0 .2rem;
}
.player:not(.player-fullscreen) .player-title strong {
  font-size: 1rem;
  line-height: 1.15;
}
.player:not(.player-fullscreen) .player-title span {
  font-size: .84rem;
}
.player:not(.player-fullscreen) .chapter-navigation {
  grid-area: nav;
  justify-self: center;
  gap: .65rem;
  width: 100%;
}
.player:not(.player-fullscreen) .chapter-navigation button {
  width: 42px;
  min-width: 42px;
  height: 42px;
  font-size: .88rem;
}
.player:not(.player-fullscreen) .player-play-pause {
  width: 56px !important;
  min-width: 56px !important;
  height: 56px !important;
  font-size: 1.25rem !important;
}
.player:not(.player-fullscreen) .chapter-meta {
  grid-area: chapter;
  width: 100%;
  margin-top: -.05rem;
}
.player:not(.player-fullscreen) .chapter-position {
  width: 100%;
  text-align: center;
  font-size: .95rem;
}
.player:not(.player-fullscreen) .playback-progress {
  grid-area: progress;
  width: 100%;
  max-width: none;
  margin-top: .05rem;
}
.player:not(.player-fullscreen) .player-actions {
  display: none;
}
.player:not(.player-fullscreen) .time-label {
  min-width: 2.8rem;
  font-size: .78rem;
}

@media (max-width: 760px) {
  .player:not(.player-fullscreen) {
    grid-template-columns: 40px minmax(0, 1fr) 70px;
    gap: .5rem .55rem;
    padding-inline: .75rem;
  }
  .player:not(.player-fullscreen) .player-expand {
    width: 38px;
    min-width: 38px;
    height: 38px;
  }
  .player:not(.player-fullscreen) .speed select {
    min-width: 64px;
    min-height: 38px;
    padding: .4rem .65rem;
  }
  .player:not(.player-fullscreen) .player-title strong {
    font-size: .96rem;
  }
  .player:not(.player-fullscreen) .player-title span {
    font-size: .8rem;
  }
  .player:not(.player-fullscreen) .chapter-navigation {
    gap: .45rem;
  }
  .player:not(.player-fullscreen) .chapter-navigation button {
    width: 40px;
    min-width: 40px;
    height: 40px;
    font-size: .82rem;
  }
  .player:not(.player-fullscreen) .player-play-pause {
    width: 52px !important;
    min-width: 52px !important;
    height: 52px !important;
    font-size: 1.15rem !important;
  }
  .player:not(.player-fullscreen) .chapter-position {
    font-size: .9rem;
  }
  .player:not(.player-fullscreen) .time-label {
    min-width: 2.55rem;
    font-size: .74rem;
  }
}


/* Mini-Player maximal vereinfacht v20 */
.player-title-main {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: .35rem;
  min-width: 0;
}
.chapter-position-compact {
  display: none;
  color: var(--muted);
  font-size: .82rem;
  white-space: nowrap;
  flex: 0 0 auto;
}
.player:not(.player-fullscreen) {
  grid-template-columns: 40px minmax(0, 1fr);
  grid-template-areas:
    "top-left title"
    "nav nav";
  gap: .55rem .75rem;
  padding: .7rem .85rem calc(.75rem + env(safe-area-inset-bottom));
}
.player:not(.player-fullscreen) .player-top-controls {
  display: contents;
}
.player:not(.player-fullscreen) .player-expand {
  grid-area: top-left;
  justify-self: start;
  align-self: center;
  width: 38px;
  min-width: 38px;
  height: 38px;
  border-radius: 999px;
  padding: 0;
}
.player:not(.player-fullscreen) .speed,
.player:not(.player-fullscreen) #seekBackwardButton,
.player:not(.player-fullscreen) #seekForwardButton,
.player:not(.player-fullscreen) .playback-progress,
.player:not(.player-fullscreen) .player-actions,
.player:not(.player-fullscreen) .chapter-meta,
.player:not(.player-fullscreen) #nowSubtitle {
  display: none !important;
}
.player:not(.player-fullscreen) .player-title {
  grid-area: title;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  text-align: center;
  gap: 0;
}
.player:not(.player-fullscreen) .player-title-main {
  max-width: 100%;
}
.player:not(.player-fullscreen) .player-title strong {
  font-size: .98rem;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.player:not(.player-fullscreen) .chapter-position-compact {
  display: inline;
}
.player:not(.player-fullscreen) .chapter-navigation {
  grid-area: nav;
  justify-self: center;
  gap: .7rem;
  width: 100%;
}
.player:not(.player-fullscreen) .chapter-navigation button {
  width: 42px;
  min-width: 42px;
  height: 42px;
  font-size: .9rem;
}
.player:not(.player-fullscreen) .player-play-pause {
  width: 54px !important;
  min-width: 54px !important;
  height: 54px !important;
  font-size: 1.2rem !important;
}
@media (max-width: 760px) {
  .player:not(.player-fullscreen) {
    grid-template-columns: 36px minmax(0, 1fr);
    gap: .45rem .55rem;
    padding-inline: .72rem;
  }
  .player:not(.player-fullscreen) .player-expand {
    width: 36px;
    min-width: 36px;
    height: 36px;
  }
  .player:not(.player-fullscreen) .player-title strong {
    font-size: .94rem;
  }
  .player:not(.player-fullscreen) .chapter-position-compact {
    font-size: .78rem;
  }
  .player:not(.player-fullscreen) .chapter-navigation {
    gap: .5rem;
  }
  .player:not(.player-fullscreen) .chapter-navigation button {
    width: 40px;
    min-width: 40px;
    height: 40px;
    font-size: .84rem;
  }
  .player:not(.player-fullscreen) .player-play-pause {
    width: 50px !important;
    min-width: 50px !important;
    height: 50px !important;
    font-size: 1.1rem !important;
  }
}

/* Mobile Hauptmenü und kompakte Kartenaktionen v21 */
.mobile-menu-button {
  display: none;
}

@media (max-width: 760px) {
  .audiobook-card .card-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: .35rem;
    width: 100%;
  }
  .audiobook-card .card-actions button,
  .audiobook-card .card-actions button[data-action="resume"] {
    min-width: 0;
    width: 100%;
    min-height: 38px;
    padding: .4rem .35rem;
    flex: none;
  }

  .mobile-menu-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    width: 100%;
    min-height: 42px;
    margin: 0 0 .55rem;
    padding: .55rem .8rem;
    border-radius: .8rem;
    background: var(--panel);
    color: var(--text);
    box-shadow: inset 0 0 0 1px #2d3038;
  }
  .mobile-menu-button > span:first-child {
    font-size: 1.15rem;
    line-height: 1;
  }

  .content-layout > .side-navigation {
    display: none !important;
    position: static;
    margin: 0 0 .65rem;
    padding: .45rem;
    overflow: visible;
    flex-wrap: wrap;
    background: var(--panel);
  }
  .content-layout.mobile-menu-open > .side-navigation:not(.hidden) {
    display: flex !important;
  }
  .content-layout.mobile-menu-open > .side-navigation:not(.hidden) .side-nav-item {
    flex: 1 1 calc(50% - .35rem);
    justify-content: center;
    min-width: 130px;
  }
  .content-layout.mobile-menu-open .playlist-navigation {
    display: contents;
  }
}

/* Mobile Topbar-Menü v22 */
.topbar-menu-button {
  display: none;
}

@media (max-width: 760px) {
  .topbar {
    position: sticky;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
  }
  .topbar-menu-button {
    display: inline-grid;
    place-items: center;
    width: 42px;
    min-width: 42px;
    height: 42px;
    padding: 0;
    border-radius: .8rem;
    font-size: 1.25rem;
  }
  .topbar .top-actions {
    display: none;
    grid-column: 1 / -1;
    width: 100%;
    margin-top: .55rem;
    padding-top: .55rem;
    border-top: 1px solid #2d3038;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: .4rem;
  }
  .topbar .top-actions.mobile-open {
    display: grid;
  }
  .topbar .top-actions button {
    width: 100%;
    min-width: 0;
    min-height: 42px;
    justify-content: center;
  }

  /* Das Inhaltsmenü bleibt sichtbar; nur die Topbar wird eingeklappt. */
  .mobile-menu-button {
    display: none !important;
  }
  .content-layout > .side-navigation:not(.hidden) {
    display: flex !important;
    position: sticky;
    margin: 0 0 .65rem;
    padding: .4rem;
    overflow-x: auto;
    flex-wrap: nowrap;
  }
  .content-layout > .side-navigation:not(.hidden) .side-nav-item {
    flex: 0 0 auto;
    min-width: max-content;
    justify-content: flex-start;
  }
  .content-layout .playlist-navigation {
    display: contents;
  }
}
