:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  background: #0b1411;
  color: #f3f0e8;
  --bg: #0b1411;
  --glow: #234536;
  --accent: #e4b864;
  --accent-ink: #211808;
  --panel: #14231d;
  --panel-2: #1b3027;
  --border: #345646;
  --muted: #aab7b0;
}
:root[data-theme='classic'] {
  --bg: #111820;
  --glow: #304a65;
  --accent: #79b8ff;
  --accent-ink: #07131e;
  --panel: #192532;
  --panel-2: #223446;
  --border: #46647f;
  --muted: #b8c7d6;
}
:root[data-theme='cocoa'] {
  --bg: #1a100d;
  --glow: #70452e;
  --accent: #e2a36f;
  --accent-ink: #26130b;
  --panel: #2a1b16;
  --panel-2: #3b2720;
  --border: #76503c;
  --muted: #d0b8aa;
}
:root[data-theme='velvet'] {
  --bg: #160b19;
  --glow: #662a6a;
  --accent: #ed86ef;
  --accent-ink: #240627;
  --panel: #28142c;
  --panel-2: #3a1d40;
  --border: #754a7c;
  --muted: #d5b9d8;
}
:root[data-theme='midas'] {
  --bg: #0d0c08;
  --glow: #69500e;
  --accent: #f2c94c;
  --accent-ink: #211900;
  --panel: #201d12;
  --panel-2: #302b17;
  --border: #75652b;
  --muted: #d0c79d;
}
:root[data-theme='oasis'] {
  --bg: #071719;
  --glow: #147a79;
  --accent: #55ddd4;
  --accent-ink: #03201e;
  --panel: #0d292b;
  --panel-2: #143b3d;
  --border: #2f7475;
  --muted: #acd2d1;
}
:root[data-theme='winamp'] {
  --bg: #11120e;
  --glow: #63731a;
  --accent: #c7e33d;
  --accent-ink: #161b02;
  --panel: #24251d;
  --panel-2: #34362a;
  --border: #747958;
  --muted: #c8cbb7;
}
:root[data-theme='itunes'] {
  --bg: #0c1422;
  --glow: #276cc3;
  --accent: #64b5ff;
  --accent-ink: #061a2c;
  --panel: #17243a;
  --panel-2: #203553;
  --border: #4b719b;
  --muted: #bdcce0;
}
:root[data-theme='nintendo'] {
  --bg: #190b0c;
  --glow: #9d1720;
  --accent: #ff5a64;
  --accent-ink: #2b0508;
  --panel: #2d1518;
  --panel-2: #421e22;
  --border: #8b454b;
  --muted: #dfbec0;
}
:root[data-theme='xbox'] {
  --bg: #081207;
  --glow: #287d1c;
  --accent: #72d84b;
  --accent-ink: #0d2105;
  --panel: #142613;
  --panel-2: #203b1e;
  --border: #477a40;
  --muted: #b8d0b4;
}
:root[data-theme='rose'] {
  --bg: #190d13;
  --glow: #8d335b;
  --accent: #ff8fbd;
  --accent-ink: #31091a;
  --panel: #2b1721;
  --panel-2: #402230;
  --border: #81465f;
  --muted: #dfbdcb;
}
:root[data-theme='sunset'] {
  --bg: #1a0e09;
  --glow: #a34120;
  --accent: #ff8a42;
  --accent-ink: #321003;
  --panel: #2e1911;
  --panel-2: #46261a;
  --border: #8c5135;
  --muted: #e0c0ae;
}
:root[data-theme='ocean'] {
  --bg: #06141d;
  --glow: #08698e;
  --accent: #47c8f2;
  --accent-ink: #03202b;
  --panel: #0e2632;
  --panel-2: #153a4b;
  --border: #35748d;
  --muted: #b2d3df;
}
:root[data-theme='slate'] {
  --bg: #101216;
  --glow: #505b6d;
  --accent: #b7c5dc;
  --accent-ink: #111820;
  --panel: #20242b;
  --panel-2: #2c323c;
  --border: #5b6574;
  --muted: #c1c7d0;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at 80% 0, var(--glow) 0, transparent 35rem), var(--bg);
  padding-bottom: 9rem;
}
[hidden] {
  display: none !important;
}
#test-badge {
  position: fixed;
  z-index: 20;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  background: #ffd447;
  color: #171000;
  padding: 0.25rem 1rem;
  border-radius: 0 0 0.6rem 0.6rem;
  font-weight: 900;
}
#toast {
  position: fixed;
  z-index: 80;
  top: calc(env(safe-area-inset-top) + 1rem);
  left: 50%;
  transform: translateX(-50%);
  width: min(32rem, calc(100% - 2rem));
  padding: 0.85rem 1rem;
  border: 1px solid var(--accent);
  border-radius: 0.8rem;
  background: var(--panel);
  color: inherit;
  box-shadow: 0 0.8rem 2rem #0009;
  text-align: center;
  font-weight: 800;
}
#toast.error {
  border-color: #ff9c91;
  background: #54211d;
  color: #fff4f2;
}
header,
main {
  width: min(1120px, calc(100% - 2rem));
  margin: auto;
}
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 2rem 0 1rem;
}
.header-actions {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}
h1,
h2 {
  font-family: Georgia, serif;
  margin: 0.15rem 0;
}
h1 {
  font-size: clamp(1.8rem, 5vw, 3rem);
}
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.72rem;
  color: var(--accent);
  font-weight: 800;
  margin: 0;
}
.hero,
.panel {
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  border: 1px solid #345646;
  border-radius: 1.2rem;
  padding: clamp(1.4rem, 5vw, 3rem);
  box-shadow: 0 1rem 4rem #0005;
}
.hero {
  max-width: 48rem;
  margin: 8vh auto;
}
.hero h2 {
  font-size: clamp(2.4rem, 8vw, 5rem);
  line-height: 0.95;
}
button,
.button,
input,
select,
textarea {
  font: inherit;
}
.button,
button {
  border: 0;
  border-radius: 999px;
  padding: 0.75rem 1rem;
  cursor: pointer;
  touch-action: manipulation;
}
.button {
  display: inline-block;
  background: var(--accent);
  color: #211808;
  font-weight: 800;
  text-decoration: none;
}
.quiet,
nav button {
  background: #22362e;
  color: #fff;
}
.quiet:hover,
nav button.active {
  background: #345646;
}
nav {
  display: flex;
  gap: 0.5rem;
  overflow: auto;
  margin-bottom: 1.2rem;
}
.library-controls {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.75rem;
  align-items: start;
  margin-bottom: 1.2rem;
}
.toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) repeat(3, auto);
  gap: 0.65rem;
}
input,
select,
textarea {
  color: #fff;
  background: #13231c;
  border: 1px solid #436554;
  border-radius: 0.7rem;
  padding: 0.75rem;
}
.view-switcher {
  display: flex;
  padding: 0.25rem;
  border: 1px solid #365748;
  border-radius: 0.8rem;
  background: #101e18;
}
.view-switcher button {
  display: flex;
  gap: 0.35rem;
  align-items: center;
  padding: 0.55rem 0.7rem;
  background: transparent;
  color: var(--muted);
  border-radius: 0.55rem;
}
.view-switcher button.active {
  background: var(--accent);
  color: #211808;
}
.grid,
.covers .group-books {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
}
.card {
  text-align: left;
  background: #14231d;
  color: #fff;
  border: 1px solid #2f4d40;
  border-radius: 1rem;
  padding: 0;
  overflow: hidden;
  transition:
    transform 0.18s ease,
    border-color 0.18s ease,
    box-shadow 0.18s ease;
}
.card:focus-visible {
  transform: translateY(-5px);
  border-color: var(--accent);
  box-shadow: 0 1rem 2rem #0007;
}
/* Lift on hover only where a pointer really hovers. On a phone the hover state
   sticks after a tap, so the last card touched stayed 5px higher than its
   neighbours and the Icons no longer lined up. */
@media (hover: hover) {
  .card:hover {
    transform: translateY(-5px);
    border-color: var(--accent);
    box-shadow: 0 1rem 2rem #0007;
  }
}
.cover {
  width: 100%;
  aspect-ratio: 2/3;
  display: grid;
  place-items: center;
  object-fit: cover;
  background: linear-gradient(145deg, #315844, #172820);
  color: #d8cba7;
  font-family: Georgia, serif;
  font-size: 2rem;
  padding: 1rem;
  text-align: center;
}
.placeholder-cover {
  align-content: center;
  gap: 0.8rem;
  background: linear-gradient(135deg, #365f4d, #101d18 70%);
  box-shadow: inset -10px 0 18px #0004;
}
.placeholder-cover small {
  font-family: Inter, sans-serif;
  font-size: 0.7rem;
  color: #d7dfda;
}
.meta {
  padding: 1rem;
}
.meta p {
  color: var(--muted);
  margin: 0.35rem 0;
}
.meta .series-label {
  color: var(--accent);
}
.meta .read-summary {
  color: #bff0cf;
  font-weight: 700;
  font-size: 0.82rem;
  line-height: 1.35;
}
.progress {
  height: 0.3rem;
  background: #32483f;
  border-radius: 1rem;
  overflow: hidden;
}
.progress i {
  display: block;
  height: 100%;
  background: var(--accent);
}
.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: end;
  margin: 0.4rem 0 0.8rem;
}
.continue-section:not(:empty) {
  width: 100%;
  margin-bottom: 1.4rem;
}
.continue-strip {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  width: 100%;
  gap: 0.55rem;
  padding: 0 0 0.35rem;
}
.continue-card {
  width: 100%;
  display: grid;
  grid-template-columns: 50px minmax(0, 1fr) 2.8rem;
  gap: 0.65rem;
  align-items: center;
  padding: 0.5rem;
  text-align: left;
  color: #fff;
  background: #172820;
  border: 1px solid #345646;
  border-radius: 0.75rem;
  cursor: pointer;
}
.continue-card:hover,
.continue-card:focus-visible {
  border-color: var(--accent);
}
.continue-cover {
  width: 50px;
  height: 4.2rem;
  aspect-ratio: auto;
  object-fit: cover;
  padding: 0.2rem;
  border-radius: 0.35rem;
  font-size: 0.58rem;
}
.continue-card > span {
  display: block;
  min-width: 0;
  overflow: hidden;
}
.continue-strip strong {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  white-space: normal;
  line-height: 1.15;
}
.continue-strip small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  margin-top: 0.15rem;
}
.continue-strip i {
  display: block;
  height: 4px;
  background: #32483f;
  margin-top: 0.4rem;
  border-radius: 2rem;
  overflow: hidden;
}
.continue-strip b {
  display: block;
  height: 100%;
  background: var(--accent);
}
.book-group {
  grid-column: 1/-1;
  margin-bottom: 0.7rem;
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 1rem;
}
.book-group > summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  min-height: 4.3rem;
  padding: 0.75rem 1rem;
  cursor: pointer;
  list-style: none;
}
.book-group > summary::-webkit-details-marker {
  display: none;
}
.book-group > summary span:first-child {
  min-width: 0;
}
.book-group > summary small,
.book-group > summary strong {
  display: block;
}
.book-group > summary small {
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.65rem;
}
.book-group > summary strong {
  margin-top: 0.12rem;
  overflow: hidden;
  text-overflow: ellipsis;
  font:
    700 1.35rem Georgia,
    serif;
}
.book-group > summary::after {
  content: '›';
  color: var(--accent);
  font-size: 1.8rem;
  line-height: 1;
  transition: transform 0.18s ease;
}
.book-group[open] > summary::after {
  transform: rotate(90deg);
}
.group-count {
  color: var(--muted);
  margin-left: auto;
  white-space: nowrap;
}
.book-group .group-books {
  display: grid;
  gap: 1rem;
  padding: 0 1rem 1rem;
}
.list .book-group .group-books {
  gap: 0.4rem;
}
.list {
  display: grid;
  gap: 0.4rem;
}
.list-row {
  width: 100%;
  display: grid;
  grid-template-columns: 44px minmax(180px, 1fr) minmax(130px, 0.65fr) 90px 105px;
  gap: 1rem;
  align-items: center;
  text-align: left;
  color: #fff;
  background: #14231d;
  border: 1px solid #29483a;
  border-radius: 0.65rem;
  padding: 0.45rem 0.7rem;
}
.list-row:hover {
  border-color: #557968;
  background: #192d25;
}
.list-cover {
  width: 44px;
  aspect-ratio: 2/3;
  object-fit: cover;
  border-radius: 0.25rem;
  padding: 0.25rem;
  font-size: 0.45rem;
}
.list-main {
  min-width: 0;
}
.list-main strong,
.list-main small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.list-main small,
.list-series,
.list-duration {
  color: var(--muted);
}
.status-pill {
  justify-self: end;
  padding: 0.25rem 0.5rem;
  border-radius: 999px;
  background: #2d4439;
  text-transform: capitalize;
  font-size: 0.72rem;
}
.status-finished {
  background: #315c45;
  color: #bff0cf;
}
.status-listening {
  background: #594a29;
  color: #ffe4a6;
}
.shelves,
.shelves .group-books {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(145px, 1fr));
  column-gap: 0.35rem;
  row-gap: 3.6rem;
  padding: 0 1rem 2.2rem;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent 278px,
    #6b4025 278px,
    #9a633a 288px,
    #422616 300px,
    #1a0d08 306px
  );
  border-radius: 0.8rem;
}
.shelves .card {
  border-radius: 0.25rem 0.5rem 0.2rem 0.25rem;
  border: 0;
  box-shadow: 5px 8px 10px #0008;
  align-self: end;
}
.shelves .card:hover {
  transform: translateY(-8px) rotate(-1deg);
}
.shelves .card .meta {
  padding: 0.6rem;
}
.shelves .card .meta p {
  display: none;
}
.shelves .cover {
  font-size: 1.25rem;
}
.shelves .progress {
  margin-top: 0.4rem;
}
dialog {
  width: min(720px, calc(100% - 1rem));
  max-height: 90vh;
  overflow: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  background: #101d18;
  color: #fff;
  border: 1px solid #4b6e5c;
  border-radius: 1rem;
  padding: 1.5rem;
}
dialog::backdrop {
  background: #000b;
}
.close {
  float: right;
  background: transparent;
  color: white;
  font-size: 2rem;
}
.parts {
  display: grid;
  gap: 0.5rem;
}
.part {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #1b3027;
  padding: 0.75rem;
  border-radius: 0.7rem;
}
.part div {
  display: flex;
  gap: 0.5rem;
}
.part .part-order-group {
  display: flex;
  gap: 0.35rem;
  grid-column: 1 / -1;
}
.part .part-order-group .part-order {
  flex: 1;
  min-width: 2.75rem;
  font-size: 1.1rem;
}
.part .part-order:disabled {
  opacity: 0.35;
}
body:has(dialog[open]) {
  overflow: hidden;
  overscroll-behavior: none;
}
#player {
  position: fixed;
  z-index: 10;
  /* Centred with left, right and auto margins, not left:50% plus translateX(-50%): a transform on a fixed
     element is a known cause of iPhone Safari leaving it off its place while the toolbars move.
     --player-lift (public/viewport-pin.js) raises it when the visible area ends above the page's bottom. */
  left: 0.5rem;
  right: 0.5rem;
  margin: 0 auto;
  max-width: 900px;
  bottom: calc(1rem + var(--player-lift, 0px));
  background: #1b3027ee;
  backdrop-filter: blur(14px);
  border: 1px solid #4b6e5c;
  border-radius: 1rem;
  padding: 0.8rem;
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(220px, 2fr) auto auto;
  gap: 0.8rem;
  align-items: center;
}
audio {
  width: 100%;
}
#player span {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
}
.file input {
  display: none;
}
.panel label.goodreads-import-option {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-top: 0.9rem;
}
.goodreads-import-option input {
  width: 1.2rem;
  height: 1.2rem;
  margin: 0;
  padding: 0;
  flex: 0 0 auto;
}
.panel form {
  display: grid;
  gap: 1rem;
}
.panel label:not(.button) {
  display: grid;
  gap: 0.35rem;
}
.history {
  display: grid;
  gap: 0.6rem;
  margin-top: 1rem;
}
.history article {
  background: #14231d;
  border-radius: 0.8rem;
  padding: 1rem;
}
.shelf:not(:empty) {
  margin-bottom: 1.5rem;
}
@media (min-width: 651px) {
  #player {
    left: auto;
    right: 1rem;
    margin: 0;
    transform: none;
    width: min(420px, calc(100% - 2rem));
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.45rem;
    padding: 0.6rem;
    border-radius: 0.8rem;
  }
  #player > div {
    min-width: 0;
  }
  #player > div strong,
  #player > div span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  #player audio {
    grid-column: 1/-1;
    grid-row: 2;
    height: 2.2rem;
  }
  #player label,
  #player #bookmark {
    display: none;
  }
}
.metadata-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}
.metadata-grid label {
  display: grid;
  gap: 0.35rem;
}
.muted {
  color: var(--muted);
}
.cover-preview {
  width: 9rem;
  aspect-ratio: 2/3;
  object-fit: cover;
  border-radius: 0.7rem;
  box-shadow: 0 0.5rem 2rem #0008;
}
#upload-progress {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.75rem;
  align-items: center;
}
#upload-progress progress {
  width: 100%;
  accent-color: var(--accent);
}
.series-shelf {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(145px, 1fr));
  gap: 1rem;
  list-style: none;
  padding: 0;
}
.series-book {
  background: #192d25;
  border-radius: 0.8rem;
  overflow: hidden;
}
.series-book img {
  width: 100%;
  aspect-ratio: 2/3;
  object-fit: cover;
  background: #294638;
}
.series-book .book-spine {
  padding: 0.7rem;
}
.series-book button {
  max-width: 100%;
}
.match-tools {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}
.match-results {
  display: grid;
  gap: 0.75rem;
  margin-top: 1rem;
}
.match-card {
  display: grid;
  grid-template-columns: 72px 1fr auto;
  gap: 0.8rem;
  align-items: center;
  padding: 0.65rem;
  border: 1px solid #345646;
  border-radius: 0.8rem;
  background: #14231d;
}
.match-card img,
.match-cover-placeholder {
  width: 72px;
  aspect-ratio: 2/3;
  object-fit: cover;
  border-radius: 0.35rem;
  background: #294638;
}
.match-card p {
  margin: 0.2rem 0;
  color: var(--muted);
}
.match-card .button {
  white-space: nowrap;
}
.journal {
  margin-top: 1.5rem;
  border-top: 1px solid #345646;
  padding-top: 1rem;
}
.journal h3 {
  margin: 0.1rem 0;
  font:
    700 1.5rem Georgia,
    serif;
}
.journal-entry {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 0;
  border-bottom: 1px solid #29483a;
}
.journal-entry p {
  margin: 0.3rem 0;
  color: var(--muted);
}
.journal-entry blockquote {
  margin: 0.6rem 0 0;
  padding-left: 0.8rem;
  border-left: 3px solid var(--accent);
  white-space: pre-wrap;
}
.journal-entry > div:last-child {
  display: flex;
  gap: 0.4rem;
  align-items: start;
}
.danger {
  color: #ffb3a9;
}
.journal form {
  display: grid;
  gap: 0.8rem;
  margin-top: 1rem;
  padding: 1rem;
  background: #14231d;
  border-radius: 0.8rem;
}
.journal-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
}
.journal-fields label,
.journal form > label {
  display: grid;
  gap: 0.3rem;
}
.journal-actions {
  display: flex;
  gap: 0.5rem;
}
.reading-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.7rem;
  margin: 1rem 0;
}
.reading-stats article {
  display: grid;
  text-align: center;
  padding: 1rem;
  background: #14231d;
  border: 1px solid #2f4d40;
  border-radius: 0.8rem;
}
.reading-stats strong {
  font:
    700 2rem Georgia,
    serif;
  color: var(--accent);
}
.reading-stats span {
  color: var(--muted);
  font-size: 0.8rem;
}
.stats-heading {
  margin: 1rem 0 0.4rem;
  font-size: 1rem;
}
.stats-tabs {
  display: flex;
  border-bottom: 1px solid currentColor;
}
.stats-tabs button {
  flex: 1;
  min-height: 44px;
  padding: 0 0.25rem;
  background: none;
  border: 0;
  border-bottom: 4px solid transparent;
  border-radius: 0;
  box-shadow: none;
  color: inherit;
  font: inherit;
  opacity: 0.65;
  cursor: pointer;
}
.stats-tabs button[aria-selected='true'] {
  opacity: 1;
  font-weight: 700;
  border-bottom-color: var(--accent);
}
.stats-bars {
  list-style: none;
  margin: 0.8rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.5rem;
}
.stats-bars li {
  display: grid;
  grid-template-columns: 4.5rem 1fr 4.5rem;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.85rem;
}
.stats-bars i {
  display: block;
  height: 0.7rem;
  width: var(--bar);
  min-width: 2px;
  background: var(--accent);
  border-radius: 0.35rem;
}
.stats-bars b {
  text-align: right;
  font-weight: 600;
}
.badges {
  list-style: none;
  margin: 0.6rem 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.8rem 0.5rem;
}
.badge {
  display: grid;
  justify-items: center;
  gap: 0.15rem;
  text-align: center;
  opacity: 0.7;
}
.badge.earned {
  opacity: 1;
}
.badge-button {
  display: grid;
  justify-items: center;
  gap: 0.15rem;
  width: 100%;
  padding: 0;
  background: none;
  border: 0;
  border-radius: 0.4rem;
  box-shadow: none;
  color: inherit;
  font: inherit;
  text-align: center;
  text-transform: none;
  cursor: pointer;
}
.badge-dialog-head {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  margin: 0.4rem 0 0.8rem;
}
.badge-dialog-head h2,
.badge-dialog-head p {
  margin: 0;
}
.badge-dialog-head .badge-icon.earned {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 28%, transparent);
  filter: none;
}
.badge-dialog-head[data-tier='bronze'] .badge-icon {
  border-color: #c4864a;
}
.badge-dialog-head[data-tier='silver'] .badge-icon {
  border-color: #b9bec6;
}
.badge-dialog-head[data-tier='gold'] .badge-icon {
  border-color: #e8bf3f;
}
.badge-dialog-head[data-tier='platinum'] .badge-icon {
  border-color: #7fe3ee;
}
.badge-ladder {
  list-style: none;
  margin: 0.6rem 0;
  padding: 0;
  display: grid;
  gap: 0.35rem;
}
.badge-ladder li {
  display: flex;
  gap: 0.5rem;
  opacity: 0.65;
}
.badge-ladder li.reached {
  opacity: 1;
}
.badge-progress {
  font-weight: 700;
}
.badge strong {
  font-size: 0.85rem;
  line-height: 1.15;
}
.badge small {
  font-size: 0.72rem;
  line-height: 1.15;
}
.badge-icon {
  display: grid;
  place-items: center;
  width: 3.6rem;
  height: 3.6rem;
  border: 3px solid currentColor;
  border-radius: 50%;
  font-size: 1.6rem;
  filter: grayscale(1);
}
.badge.earned .badge-icon {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 28%, transparent);
  filter: none;
}
.badge[data-tier='bronze'] .badge-icon {
  border-color: #c4864a;
}
.badge[data-tier='silver'] .badge-icon {
  border-color: #b9bec6;
}
.badge[data-tier='gold'] .badge-icon {
  border-color: #e8bf3f;
}
.badge[data-tier='platinum'] .badge-icon {
  border-color: #7fe3ee;
  box-shadow: 0 0 0.6rem #7fe3ee88;
}
.listening-time .reading-stats {
  margin-top: 0.8rem;
}
.history-sortbar {
  display: flex;
  justify-content: space-between;
  align-items: end;
  padding: 0.75rem 0.25rem;
  border-bottom: 2px solid var(--border);
  text-transform: uppercase;
}
.history-sortbar strong {
  font:
    700 1.35rem Georgia,
    serif;
  text-transform: none;
}
.history-sortbar span {
  font-size: 0.72rem;
  color: var(--muted);
}
.history-sortbar b {
  color: var(--accent);
}
.history-period-heading {
  align-items: baseline;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  margin: 2rem 0 0.85rem;
  padding: 0 0.25rem 0.55rem;
}
.history-period-heading span {
  font:
    700 1.65rem Georgia,
    serif;
}
.history-period-heading small {
  color: var(--muted);
}
.history-entry {
  display: grid;
  grid-template-columns: 4.5rem minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: start;
  padding: 1rem 0.25rem;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.history-entry:hover,
.history-entry:focus-visible {
  background: color-mix(in srgb, var(--panel) 80%, var(--accent) 20%);
  outline: none;
}
.history-cover {
  width: 4.5rem;
  aspect-ratio: 2/3;
  background: var(--panel-2);
  display: grid;
  place-items: center;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.65rem;
}
.history-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.history-copy {
  display: grid;
  gap: 0.28rem;
  min-width: 0;
}
.history-copy > strong {
  font:
    700 1.15rem Georgia,
    serif;
}
.history-copy small {
  color: var(--muted);
}
.history-copy p {
  white-space: pre-wrap;
}
.history-rating {
  margin-top: 0.25rem;
}
.history-rating span {
  color: var(--muted);
}
.history-rating b {
  color: #f59a23;
  letter-spacing: 0.04em;
}
.history-more {
  display: grid;
  gap: 0.28rem;
  min-width: 0;
}
.history-entry:not(.expanded) .history-more {
  display: none;
}
/* Folds the card. Its own button, because tapping the card opens the book. 44px: a thumb target. */
.history-toggle {
  align-self: center;
  min-width: 44px;
  min-height: 44px;
  border: 0;
  border-radius: 0.6rem;
  background: transparent;
  color: var(--accent);
  font-size: 1.4rem;
  cursor: pointer;
}
.import-badge {
  padding: 0.25rem 0.5rem;
  background: #29483a;
  border-radius: 999px;
  font-size: 0.7rem;
}
.history-filters {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.4rem;
  padding: 0.7rem 0;
}
.history-filters button {
  display: flex;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.65rem 0.4rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--text);
}
.history-filters button.active {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}
.history-filters span {
  font-size: 0.75em;
  opacity: 0.8;
}
.history-empty {
  text-align: center;
  color: var(--muted);
  padding: 2rem;
}
.history-match-search {
  display: grid;
  gap: 0.35rem;
  margin: 1rem 0;
}
.history-match-results {
  display: grid;
  gap: 0.5rem;
  max-height: min(55vh, 30rem);
  overflow: auto;
  margin-bottom: 1rem;
  padding-right: 0.2rem;
}
.history-match-option {
  display: grid;
  grid-template-columns: 2.7rem minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.7rem;
  width: 100%;
  padding: 0.55rem;
  text-align: left;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 0.7rem;
  color: var(--text);
}
.history-match-option > span:nth-child(2) {
  display: grid;
  gap: 0.15rem;
  min-width: 0;
}
.history-match-option small {
  color: var(--muted);
  white-space: normal;
}
.history-match-option.selected {
  border: 2px solid var(--accent);
  background: color-mix(in srgb, var(--panel-2) 80%, var(--accent) 20%);
}
.history-match-cover {
  width: 2.7rem;
  aspect-ratio: 2/3;
  background: var(--panel);
  overflow: hidden;
}
.history-match-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.history-match-save {
  width: 100%;
}
@media (max-width: 850px) {
  .library-controls {
    grid-template-columns: 1fr;
  }
  .toolbar {
    grid-template-columns: 1fr 1fr;
  }
  .view-switcher {
    justify-self: start;
  }
  .view-switcher span {
    display: none;
  }
  .list-row {
    grid-template-columns: 44px 1fr auto;
  }
  .list-series,
  .list-duration {
    display: none;
  }
}
@media (max-width: 650px) {
  .toolbar,
  .metadata-grid,
  .journal-fields {
    grid-template-columns: 1fr;
  }
  .grid,
  .covers .group-books,
  .series-shelf {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .shelves,
  .shelves .group-books {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    padding-inline: 0.45rem;
    row-gap: 2.3rem;
    background-size: auto 225px;
  }
  .shelves .card .meta {
    padding: 0.4rem;
  }
  .shelves .card .meta strong {
    font-size: 0.72rem;
  }
  .match-card {
    grid-template-columns: 58px 1fr;
  }
  .match-card img,
  .match-cover-placeholder {
    width: 58px;
  }
  .match-card .button {
    grid-column: 1/-1;
  }
  #player {
    grid-template-columns: 1fr auto;
  }
  #player audio {
    grid-column: 1/-1;
    grid-row: 2;
  }
  #player label {
    display: none;
  }
  .cover {
    font-size: 1.05rem;
  }
  .view-switcher {
    width: 100%;
    justify-content: space-between;
  }
  .view-switcher button {
    flex: 1;
    justify-content: center;
  }
  .reading-stats {
    grid-template-columns: 1fr 1fr;
  }
  .journal-entry {
    display: block;
  }
  .journal-entry > div:last-child {
    margin-top: 0.7rem;
  }
}

.dropbox-panel {
  padding: clamp(1.1rem, 4vw, 2rem);
}
.upload-panel {
  margin-top: 1rem;
  padding: clamp(1.1rem, 4vw, 2rem);
  overflow: hidden;
}
.upload-panel summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  list-style: none;
}
.upload-panel summary::-webkit-details-marker {
  display: none;
}
.upload-panel summary small,
.upload-panel summary strong {
  display: block;
}
.upload-panel summary small {
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}
.upload-panel summary strong {
  margin-top: 0.15rem;
  font:
    700 clamp(1.5rem, 6vw, 2.2rem) Georgia,
    serif;
}
.upload-panel summary > span:last-child {
  font-size: 2rem;
}
.upload-panel[open] summary > span:last-child {
  transform: rotate(45deg);
}
.upload-panel input,
.upload-panel select,
.upload-panel textarea {
  width: 100%;
  min-width: 0;
}
.upload-panel input[type='file'] {
  overflow: hidden;
}
.upload-panel .metadata-grid {
  width: 100%;
  min-width: 0;
}
.dropbox-toolbar {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin: 1rem 0;
  padding: 0.65rem;
  background: #0e1a15;
  border: 1px solid #2f4d40;
  border-radius: 0.8rem;
}
.dropbox-picker {
  margin: 1rem 0;
  border: 1px solid #345646;
  border-radius: 0.8rem;
  overflow: hidden;
  background: #101d18;
}
.dropbox-picker summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem;
  cursor: pointer;
  list-style: none;
}
.dropbox-picker summary::-webkit-details-marker {
  display: none;
}
.dropbox-picker summary small,
.dropbox-picker summary strong {
  display: block;
}
.dropbox-picker summary small {
  color: var(--accent);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}
.dropbox-picker summary strong {
  margin-top: 0.12rem;
}
.dropbox-picker .disclosure {
  font-size: 1.5rem;
  transition: transform 0.2s ease;
}
.dropbox-picker[open] .disclosure {
  transform: rotate(180deg);
}
.dropbox-picker .dropbox-toolbar,
.dropbox-picker .dropbox-list {
  margin-inline: 0.7rem;
}
.dropbox-picker .dropbox-list {
  margin-bottom: 0.7rem;
}
.dropbox-toolbar button {
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  font-size: 1.25rem;
}
.dropbox-toolbar div,
.dropbox-toolbar small,
.dropbox-toolbar strong {
  display: block;
  min-width: 0;
}
.dropbox-toolbar small {
  color: var(--muted);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}
.dropbox-toolbar strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dropbox-list {
  display: grid;
  gap: 0.45rem;
  max-height: 26rem;
  overflow: auto;
  padding-right: 0.2rem;
}
.dropbox-folder {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.45rem;
  align-items: center;
  padding: 0.35rem;
  border: 1px solid #29483a;
  border-radius: 0.75rem;
  background: #14231d;
}
.folder-open {
  display: grid;
  grid-template-columns: 2rem minmax(0, 1fr) auto;
  gap: 0.6rem;
  align-items: center;
  min-width: 0;
  padding: 0.45rem;
  color: #fff;
  background: transparent;
  text-align: left;
  border-radius: 0.55rem;
}
.folder-open > span:nth-child(2),
.folder-open strong,
.folder-open small {
  display: block;
  min-width: 0;
}
.folder-open strong,
.folder-open small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.folder-open small {
  color: var(--muted);
  font-size: 0.72rem;
  margin-top: 0.12rem;
}
.folder-icon {
  color: var(--accent);
  font-size: 1.25rem;
}
.folder-select {
  background: #29483a;
  color: #fff;
  padding: 0.55rem 0.8rem;
}
.dropbox-selected {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 0.65rem 0 1rem;
}
.dropbox-selected article {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  max-width: 100%;
  padding: 0.45rem 0.5rem 0.45rem 0.7rem;
  background: #20382e;
  border: 1px solid #3b604f;
  border-radius: 999px;
}
.dropbox-selected span,
.dropbox-selected strong,
.dropbox-selected small {
  display: block;
  min-width: 0;
}
.dropbox-selected strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.8rem;
}
.dropbox-selected small {
  color: var(--muted);
  font-size: 0.65rem;
}
.dropbox-selected button {
  width: 1.8rem;
  height: 1.8rem;
  padding: 0;
}
.sync-explainer {
  margin: 1rem 0;
  padding: 0.9rem;
  background: #101d18;
  border-left: 3px solid var(--accent);
  border-radius: 0.25rem 0.7rem 0.7rem 0.25rem;
}
.sync-explainer p {
  margin: 0.3rem 0 0;
  color: var(--muted);
  line-height: 1.45;
}
.sync-status {
  display: grid;
  grid-template-columns: 1.7rem minmax(0, 1fr);
  gap: 0.7rem;
  align-items: start;
  width: 100%;
  min-width: 0;
  margin-top: 1rem;
  padding: 0.8rem;
  background: #101d18;
  border-radius: 0.7rem;
  overflow-wrap: break-word;
}
.sync-status > span {
  min-width: 0;
}
.sync-status strong,
.sync-status small {
  display: block;
}
.sync-status small {
  margin-top: 0.2rem;
  color: var(--muted);
}
.sync-details {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.45rem;
  margin: 0.75rem 0;
}
.sync-details div {
  padding: 0.55rem;
  background: #182a22;
  border-radius: 0.55rem;
}
.sync-details dt {
  color: var(--muted);
  font-size: 0.7rem;
}
.sync-details dd {
  margin: 0.1rem 0 0;
  color: var(--accent);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.sync-spinner {
  width: 1.25rem;
  height: 1.25rem;
  border: 2px solid #ffffff33;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: sync-spin 0.8s linear infinite;
}
.sync-status.complete {
  border: 1px solid #396c51;
}
.sync-status.error {
  display: block;
  width: 100%;
  color: #ffb3a9;
  white-space: normal;
}
.sync-status.reconnecting {
  border: 1px solid var(--border);
}
.sync-status.historical {
  opacity: 0.62;
  transform: scale(0.985);
  transform-origin: top center;
}
.sync-status.historical strong::before {
  content: 'Previous run · ';
  font-size: 0.72em;
  color: var(--muted);
}
.job-completed-at {
  margin-top: 0.45rem !important;
  font-weight: 700;
  color: var(--text) !important;
}
.import-help {
  margin: 0.85rem 0;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 0.8rem;
  background: var(--panel-2);
}
.import-help summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--accent);
}
.import-help ol {
  margin: 0.75rem 0 0;
  padding-left: 1.35rem;
}
.import-help li + li {
  margin-top: 0.45rem;
}
.import-help code {
  font-size: 0.9em;
}
.admin-job-actions {
  display: flex;
  gap: 0.65rem;
  flex-wrap: wrap;
}
.metadata-review-book {
  border: 1px solid var(--border);
  border-radius: 0.8rem;
  padding: 0.8rem;
  background: var(--panel-2);
}
.metadata-review-book > h3 {
  margin: 0.1rem 0;
}
.metadata-review-candidates {
  display: grid;
  gap: 0.6rem;
  margin-top: 0.7rem;
}
.metadata-review-candidate {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) auto;
  gap: 0.65rem;
  align-items: center;
  padding: 0.6rem;
  border: 1px solid var(--border);
  border-radius: 0.65rem;
}
.metadata-review-candidate img,
.metadata-review-candidate .match-cover-placeholder {
  width: 56px;
  aspect-ratio: 2/3;
  object-fit: cover;
}
.metadata-review-candidate p {
  margin: 0.15rem 0;
  color: var(--muted);
}
.clearable-field {
  position: relative;
  display: block;
  min-width: 0;
}
.clearable-field > input,
.clearable-field > textarea {
  width: 100%;
  padding-right: 2.8rem;
}
.clear-text-field {
  position: absolute;
  z-index: 2;
  top: 50%;
  right: 0.4rem;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #ffffff18;
  color: currentColor;
  font-size: 1.35rem;
  line-height: 1;
}
.clearable-textarea .clear-text-field {
  top: 0.45rem;
  transform: none;
}
.clearable-field input[type='search']::-webkit-search-cancel-button {
  display: none;
}
.metadata-review-section {
  display: grid;
  gap: 0.7rem;
  margin-bottom: 1.2rem;
}
.metadata-review-section > h3 {
  margin: 0;
}
.metadata-saved-book {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  width: 100%;
  padding: 0.85rem;
  text-align: left;
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  background: var(--panel-2);
  color: inherit;
}
.metadata-saved-book span:first-child {
  display: grid;
  gap: 0.2rem;
}
.metadata-saved-book small {
  color: var(--muted);
}
.metadata-saved-book span:last-child {
  font-size: 1.8rem;
  color: var(--accent);
}
.split-mode {
  display: grid;
  gap: 0.6rem;
}
.split-mode label {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
}
.split-mode label span {
  display: grid;
  gap: 0.15rem;
}
.split-mode small {
  color: var(--muted);
}
#split-separate-titles {
  display: grid;
  gap: 0.65rem;
}
@media (max-width: 520px) {
  .metadata-review-candidate {
    grid-template-columns: 48px minmax(0, 1fr);
  }
  .metadata-review-candidate .button {
    grid-column: 1/-1;
    width: 100%;
  }
}
@keyframes sync-spin {
  to {
    transform: rotate(360deg);
  }
}

#detail {
  padding: 0;
  border-radius: 1.1rem;
  overflow: auto;
}
#detail .close {
  position: sticky;
  z-index: 2;
  top: 0.7rem;
  float: right;
  margin: 0.7rem 0.7rem 0 0;
  width: 2.7rem;
  height: 2.7rem;
  padding: 0;
  border: 1px solid #ffffff22;
  border-radius: 50%;
  background: #0b1411e8;
}
#detail-content {
  padding: 1.35rem;
}
#detail-content > h2 {
  margin: 0.2rem 3.2rem 0.3rem 0;
  font-size: clamp(2rem, 8vw, 3.2rem);
  line-height: 1;
}
.book-description {
  color: var(--muted);
  line-height: 1.55;
}
.book-duration {
  margin: 0.5rem 0 1rem;
  color: var(--accent);
  font-weight: 700;
}
.book-file-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin: 0.75rem 0 1rem;
}
.book-file-actions .button {
  flex: 1 1 12rem;
  text-align: center;
}
.book-actions {
  display: flex;
  gap: 0.45rem;
  flex-wrap: nowrap;
  margin: 1rem 0;
}
/* One row, however many of the three are showing: they share the width. */
.book-actions button {
  flex: 1 1 auto;
  min-width: 0;
  padding: 0.6rem 0.45rem;
  font-size: 0.88rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.book-actions button[hidden] {
  display: none;
}
.archive-action,
.match-action,
.cover-action {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  margin-top: 1rem;
  padding: 0.8rem;
  background: #0d1814;
  border: 1px solid #29483a;
  border-radius: 0.75rem;
}
.archive-action strong,
.archive-action small,
.match-action strong,
.match-action small,
.cover-action strong,
.cover-action small {
  display: block;
}
.archive-action small,
.match-action small,
.cover-action small {
  margin-top: 0.2rem;
  color: var(--muted);
}
#detail .journal .section-heading {
  align-items: center;
  gap: 1rem;
}
.journal .section-heading button {
  flex: 0 0 auto;
}
@media (max-width: 650px) {
  .dropbox-folder {
    grid-template-columns: minmax(0, 1fr) auto;
  }
  .folder-open {
    grid-template-columns: 1.6rem minmax(0, 1fr) auto;
  }
  .folder-open small {
    display: none;
  }
  .dropbox-list {
    max-height: 22rem;
  }
  #detail {
    width: calc(100% - 0.75rem);
    max-height: 94vh;
  }
  #detail-content {
    padding: 1.1rem;
  }
  .archive-action {
    align-items: flex-start;
  }
  .archive-action button {
    flex: 0 0 auto;
  }
  #detail .journal .section-heading {
    align-items: flex-start;
  }
}

@media (max-width: 650px) {
  .part {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0.65rem;
    padding: 0.7rem;
  }
  .part > span {
    display: block;
    min-width: 0;
    font-size: 0.88rem;
    line-height: 1.35;
    overflow-wrap: anywhere;
    word-break: normal;
  }
  .part div {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.35rem;
    width: 100%;
    min-width: 0;
  }
  .part button,
  .part .button {
    min-width: 0;
    padding: 0.55rem 0.4rem;
    font-size: 0.75rem;
    line-height: 1.2;
    text-align: center;
    white-space: normal;
  }
  #player {
    bottom: calc(0.35rem + var(--player-lift, 0px));
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.4rem;
    padding: 0.6rem;
    border-radius: 0.8rem;
  }
  #player > div {
    min-width: 0;
  }
  #player > div strong,
  #player > div span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  #player audio {
    grid-column: 1/-1;
    grid-row: 2;
    height: 2.2rem;
  }
  #player #bookmark {
    display: none;
  }
}

/* Full vintage interface skins: these intentionally change shape, type and texture. */
:root[data-theme='winamp'] body {
  color: #d8ded0;
  background: #111 repeating-linear-gradient(90deg, #ffffff05 0 1px, transparent 1px 3px);
}
:root[data-theme='winamp'] .hero,
:root[data-theme='winamp'] .panel,
:root[data-theme='winamp'] dialog,
:root[data-theme='winamp'] .library-options,
:root[data-theme='winamp'] .book-group,
:root[data-theme='winamp'] #player {
  border: 3px ridge #777b83;
  border-radius: 1px;
  background: linear-gradient(135deg, #343642, #171820 55%, #282a34);
  box-shadow: 3px 3px 0 #050505;
}
:root[data-theme='winamp'] h1,
:root[data-theme='winamp'] h2,
:root[data-theme='winamp'] h3,
:root[data-theme='winamp'] .full-player-copy strong {
  font-family: 'Arial Narrow', Arial, sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
:root[data-theme='winamp'] .eyebrow,
:root[data-theme='winamp'] .meta p,
:root[data-theme='winamp'] small {
  color: #72f23b;
}
:root[data-theme='winamp'] nav,
:root[data-theme='winamp'] .view-switcher {
  padding: 3px;
  border: 2px ridge #777b83;
  border-radius: 0;
  background: #16171d;
}
:root[data-theme='winamp'] nav button,
:root[data-theme='winamp'] .view-switcher button,
:root[data-theme='winamp'] .quiet,
:root[data-theme='winamp'] .button {
  border: 2px outset #777b83;
  border-radius: 1px;
  background: linear-gradient(#4a4c58, #22232b);
  color: #e3e5dc;
  text-transform: uppercase;
  font-size: 0.78rem;
  box-shadow: none;
}
:root[data-theme='winamp'] nav button.active,
:root[data-theme='winamp'] .view-switcher button.active {
  color: #111;
  background: #b9d935;
  box-shadow: inset 0 0 0 1px #eaff6a;
}
:root[data-theme='winamp'] input,
:root[data-theme='winamp'] select,
:root[data-theme='winamp'] textarea {
  border: 2px inset #777b83;
  border-radius: 0;
  background: #050705;
  color: #62ff44;
  font-family: 'Courier New', monospace;
}
:root[data-theme='winamp'] .card,
:root[data-theme='winamp'] .list-row,
:root[data-theme='winamp'] .started-card {
  border: 2px ridge #686b74;
  border-radius: 0;
  background: #0b0d0b;
  color: #78ff49;
}
:root[data-theme='winamp'] .card .meta,
:root[data-theme='winamp'] .list-main {
  font-family: 'Courier New', monospace;
}
:root[data-theme='winamp'] .progress,
:root[data-theme='winamp'] .started-progress {
  height: 0.55rem;
  border: 1px inset #747780;
  border-radius: 0;
  background: repeating-linear-gradient(90deg, #111 0 7px, #30333a 7px 9px);
}
:root[data-theme='winamp'] .progress i,
:root[data-theme='winamp'] .started-progress i {
  background: repeating-linear-gradient(90deg, #48ff28 0 7px, #122f0b 7px 9px);
}
:root[data-theme='winamp'] #full-player::after {
  content: '60 170 310 600 1K 3K 6K 12K 14K 16K';
  display: block;
  width: min(34rem, 100%);
  margin: 1rem auto;
  padding: 2.2rem 0.4rem 0.4rem;
  border: 3px ridge #777b83;
  background:
    repeating-linear-gradient(90deg, transparent 0 8%, #c9df37 8% 8.7%, transparent 8.7% 10%),
    linear-gradient(#252731, #111218);
  color: #a9f22f;
  font:
    700 0.55rem 'Courier New',
    monospace;
  word-spacing: 1.15rem;
  text-align: center;
}

:root[data-theme='itunes'] body {
  color: #17202a;
  background: repeating-linear-gradient(0deg, #d7dbe0 0 1px, #eef1f4 1px 3px);
}
:root[data-theme='itunes'] .hero,
:root[data-theme='itunes'] .panel,
:root[data-theme='itunes'] dialog,
:root[data-theme='itunes'] .library-options,
:root[data-theme='itunes'] .book-group,
:root[data-theme='itunes'] #player {
  border: 1px solid #7c8792;
  border-radius: 0.45rem;
  background: linear-gradient(#f7f8f9, #c7ccd2);
  box-shadow:
    inset 0 1px #fff,
    0 2px 5px #65717d66;
  color: #17202a;
}
:root[data-theme='itunes'] h1,
:root[data-theme='itunes'] h2,
:root[data-theme='itunes'] h3 {
  font-family: Arial, sans-serif;
  color: #202932;
  text-shadow: 0 1px #fff;
}
:root[data-theme='itunes'] .eyebrow,
:root[data-theme='itunes'] .muted,
:root[data-theme='itunes'] small,
:root[data-theme='itunes'] .meta p {
  color: #4e6070;
}
:root[data-theme='itunes'] nav,
:root[data-theme='itunes'] .view-switcher {
  gap: 0;
  padding: 2px;
  border: 1px solid #89939d;
  border-radius: 0.45rem;
  background: linear-gradient(#fdfdfd, #bfc5cb);
  box-shadow: inset 0 1px #fff;
}
:root[data-theme='itunes'] nav button,
:root[data-theme='itunes'] .view-switcher button,
:root[data-theme='itunes'] .quiet,
:root[data-theme='itunes'] .button {
  border: 1px solid #87929d;
  border-radius: 0.35rem;
  background: linear-gradient(#fff, #c5cbd1);
  color: #253544;
  box-shadow: inset 0 1px #fff;
}
:root[data-theme='itunes'] nav button.active,
:root[data-theme='itunes'] .view-switcher button.active {
  border-color: #176bb1;
  background: linear-gradient(#78c6ff, #1986d6 52%, #0c6eb9 53%, #4eade9);
  color: #fff;
  text-shadow: 0 -1px #145b8f;
}
:root[data-theme='itunes'] input,
:root[data-theme='itunes'] select,
:root[data-theme='itunes'] textarea {
  border: 1px solid #778593;
  border-radius: 0.35rem;
  background: #fff;
  color: #18232d;
  box-shadow: inset 0 1px 3px #65717d44;
}
:root[data-theme='itunes'] .card,
:root[data-theme='itunes'] .list-row,
:root[data-theme='itunes'] .started-card {
  border: 1px solid #8e9aa5;
  border-radius: 0.35rem;
  background: #f7f9fb;
  color: #18232d;
  box-shadow: 0 2px 6px #52616f44;
}
:root[data-theme='itunes'] .card .meta {
  background: linear-gradient(#fff, #dce8f2);
}
:root[data-theme='itunes'] .book-group > summary,
:root[data-theme='itunes'] .series-group > summary {
  border-bottom: 1px solid #84909b;
  background: linear-gradient(#fafafa, #bec4ca);
}
:root[data-theme='itunes'] .group-books,
:root[data-theme='itunes'] .series-shelf {
  background: #d8efff;
}
:root[data-theme='itunes'] #player audio {
  filter: saturate(0.75);
}
:root[data-theme='itunes'] #full-player::before {
  content: '';
  position: fixed;
  z-index: -1;
  inset: 0;
  background: repeating-linear-gradient(0deg, #ffffff22 0 1px, #00000008 1px 3px);
  pointer-events: none;
}

:root[data-theme='nintendo'] body {
  color: #282725;
  background: #b9b7b0 repeating-linear-gradient(90deg, transparent 0 18px, #74736e22 18px 20px);
}
:root[data-theme='nintendo'] .hero,
:root[data-theme='nintendo'] .panel,
:root[data-theme='nintendo'] dialog,
:root[data-theme='nintendo'] .library-options,
:root[data-theme='nintendo'] .book-group,
:root[data-theme='nintendo'] #player {
  border: 4px solid #55544f;
  border-radius: 0.35rem;
  background: linear-gradient(165deg, #d8d6ce, #9d9b94);
  box-shadow:
    inset 0 0 0 3px #ece9df,
    5px 7px 0 #55544f;
  color: #282725;
}
:root[data-theme='nintendo'] .hero::before {
  content: '';
  display: block;
  height: 0.8rem;
  margin: -1rem -1rem 0.8rem;
  background: repeating-linear-gradient(90deg, #393a39 0 7%, #171817 7% 9%);
  border-bottom: 3px solid #77756f;
}
:root[data-theme='nintendo'] h1,
:root[data-theme='nintendo'] h2,
:root[data-theme='nintendo'] h3 {
  font-family: Arial, sans-serif;
  font-weight: 900;
  text-transform: uppercase;
  color: #3d3b38;
  letter-spacing: 0.04em;
}
:root[data-theme='nintendo'] .eyebrow {
  color: #a71925;
}
:root[data-theme='nintendo'] .muted,
:root[data-theme='nintendo'] small,
:root[data-theme='nintendo'] .meta p {
  color: #4d4b47;
}
:root[data-theme='nintendo'] nav,
:root[data-theme='nintendo'] .view-switcher {
  padding: 0.35rem;
  border: 4px solid #333;
  border-radius: 0.35rem;
  background: #555;
}
:root[data-theme='nintendo'] nav button,
:root[data-theme='nintendo'] .view-switcher button,
:root[data-theme='nintendo'] .quiet,
:root[data-theme='nintendo'] .button {
  border: 3px solid #5d5b57;
  border-radius: 0.28rem;
  background: #dedbd2;
  color: #262626;
  box-shadow: inset 0 -4px #8b8983;
  text-transform: uppercase;
  font-weight: 900;
}
:root[data-theme='nintendo'] nav button.active,
:root[data-theme='nintendo'] .view-switcher button.active,
:root[data-theme='nintendo'] .button {
  border-radius: 999px;
  background: #b11e2b;
  color: #fff;
  box-shadow:
    inset 0 -4px #72101a,
    0 0 0 2px #555;
}
:root[data-theme='nintendo'] input,
:root[data-theme='nintendo'] select,
:root[data-theme='nintendo'] textarea {
  border: 3px inset #85837d;
  border-radius: 0.15rem;
  background: #e8e5dc;
  color: #222;
}
:root[data-theme='nintendo'] .card,
:root[data-theme='nintendo'] .list-row,
:root[data-theme='nintendo'] .started-card {
  border: 5px solid #3d3d3b;
  border-radius: 0.15rem;
  background: #c8c5bc;
  color: #282725;
  box-shadow: inset 0 0 0 2px #ece9df;
}
:root[data-theme='nintendo'] .progress,
:root[data-theme='nintendo'] .started-progress {
  height: 0.65rem;
  border: 2px inset #777;
  border-radius: 0;
  background: #393939;
}
:root[data-theme='nintendo'] .progress i,
:root[data-theme='nintendo'] .started-progress i {
  background: #b11e2b;
}
:root[data-theme='nintendo'] #full-player::after {
  content: 'SELECT     START';
  display: block;
  width: min(17rem, 80%);
  margin: 1.5rem auto;
  padding: 0.35rem 1rem;
  border-radius: 999px;
  background: #777;
  color: #eee;
  font:
    900 0.7rem Arial,
    sans-serif;
  letter-spacing: 0.15em;
  text-align: center;
  box-shadow: inset 0 -3px #464646;
}

:root[data-theme='xbox'] body {
  color: #cfffaf;
  background-color: #020802;
  background-image:
    linear-gradient(#35e51b18 1px, transparent 1px),
    linear-gradient(90deg, #35e51b18 1px, transparent 1px),
    radial-gradient(circle at 20% 0, #1c5f16 0, transparent 35rem);
  background-size:
    34px 34px,
    34px 34px,
    auto;
}
:root[data-theme='xbox'] .hero,
:root[data-theme='xbox'] .panel,
:root[data-theme='xbox'] dialog,
:root[data-theme='xbox'] .library-options,
:root[data-theme='xbox'] .book-group,
:root[data-theme='xbox'] #player {
  border: 1px solid #4be82d;
  border-radius: 0;
  background: linear-gradient(120deg, #102b0dcc, #031003ee);
  box-shadow:
    inset 0 0 20px #36ff1b22,
    0 0 14px #23bc1455;
  clip-path: polygon(
    1rem 0,
    100% 0,
    100% calc(100% - 1rem),
    calc(100% - 1rem) 100%,
    0 100%,
    0 1rem
  );
  color: #cfffaf;
}
:root[data-theme='xbox'] h1,
:root[data-theme='xbox'] h2,
:root[data-theme='xbox'] h3 {
  font-family: 'Arial Narrow', Arial, sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #9aff5d;
  text-shadow: 0 0 10px #3cff18;
}
:root[data-theme='xbox'] .eyebrow,
:root[data-theme='xbox'] .muted,
:root[data-theme='xbox'] small,
:root[data-theme='xbox'] .meta p {
  color: #70d94e;
}
:root[data-theme='xbox'] nav,
:root[data-theme='xbox'] .view-switcher {
  padding: 0.35rem;
  border: 1px solid #41ce27;
  border-radius: 0;
  background: #041004cc;
  clip-path: polygon(0.7rem 0, 100% 0, calc(100% - 0.7rem) 100%, 0 100%);
}
:root[data-theme='xbox'] nav button,
:root[data-theme='xbox'] .view-switcher button,
:root[data-theme='xbox'] .quiet,
:root[data-theme='xbox'] .button {
  border: 1px solid #3dbb25;
  border-radius: 0;
  background: linear-gradient(100deg, #0d2a0a, #143d0e);
  color: #8af55b;
  box-shadow: inset 0 0 10px #4afa2922;
  clip-path: polygon(0.6rem 0, 100% 0, calc(100% - 0.6rem) 100%, 0 100%);
  text-transform: uppercase;
  font-weight: 800;
}
:root[data-theme='xbox'] nav button.active,
:root[data-theme='xbox'] .view-switcher button.active,
:root[data-theme='xbox'] .button {
  background: linear-gradient(90deg, #a8ef28, #5aac16);
  color: #092006;
  text-shadow: 0 1px #dfff7c;
  box-shadow: 0 0 16px #65e82a;
}
:root[data-theme='xbox'] input,
:root[data-theme='xbox'] select,
:root[data-theme='xbox'] textarea {
  border: 1px solid #42e729;
  border-radius: 0;
  background: #020b02cc;
  color: #9cff74;
  box-shadow: inset 0 0 12px #36e52133;
}
:root[data-theme='xbox'] .card,
:root[data-theme='xbox'] .list-row,
:root[data-theme='xbox'] .started-card {
  border: 1px solid #45d62b;
  border-radius: 0;
  background: linear-gradient(145deg, #112c0d, #030b03);
  color: #cfffaf;
  box-shadow: inset 0 0 18px #2de21922;
  clip-path: polygon(
    0.8rem 0,
    100% 0,
    100% calc(100% - 0.8rem),
    calc(100% - 0.8rem) 100%,
    0 100%,
    0 0.8rem
  );
}
:root[data-theme='xbox'] .progress,
:root[data-theme='xbox'] .started-progress {
  height: 0.55rem;
  border: 1px solid #3ce723;
  border-radius: 0;
  background: #020702;
  box-shadow: 0 0 8px #35f11e;
}
:root[data-theme='xbox'] .progress i,
:root[data-theme='xbox'] .started-progress i {
  background: linear-gradient(90deg, #b8f02d, #34de19);
}
:root[data-theme='xbox'] #full-player::after {
  content: 'X';
  display: grid;
  place-items: center;
  width: 5rem;
  height: 5rem;
  margin: 1.2rem auto;
  border: 2px solid #7df343;
  border-radius: 50%;
  background: radial-gradient(circle, #a9f032, #266e10 58%, #071007 60%);
  color: #092006;
  font:
    900 3rem Arial,
    sans-serif;
  box-shadow: 0 0 35px #4ded24;
}

/* Admin bulk book editing. */
.library-count-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: -0.45rem 0 0.9rem;
}
.library-count-row p {
  margin: 0;
  padding: 0.55rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel);
  color: var(--muted);
  font-weight: 800;
}
.library-count-row #bulk-select {
  margin: 0;
}
#bulk-select {
  margin: -0.45rem 0 0.9rem;
}
.bulk-editor {
  margin: 0 0 1.2rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 1rem;
  background: var(--panel);
}
.bulk-editor .section-heading {
  align-items: center;
}
.bulk-editor .section-heading > div:last-child {
  display: flex;
  gap: 0.4rem;
}
.bulk-editor form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
  margin-top: 0.8rem;
}
.bulk-editor label {
  display: grid;
  gap: 0.35rem;
}
.bulk-field {
  position: relative;
}
.bulk-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  width: 100%;
  padding: 0.45rem 0 0;
}
.bulk-suggestions[hidden] {
  display: none;
}
.bulk-suggestions button {
  min-height: 2.35rem;
  padding: 0.4rem 0.65rem;
  border: 1px solid #557365;
  border-radius: 999px;
  background: #14231d;
  color: var(--text);
  font-size: 0.82rem;
  text-align: left;
}
.bulk-field > span {
  display: flex;
  gap: 0.4rem;
  align-items: center;
  font-weight: 800;
}
.bulk-field input[type='checkbox'] {
  width: auto;
  accent-color: var(--accent);
}
.bulk-editor #bulk-apply,
.bulk-editor #bulk-result {
  align-self: end;
}
.card.bulk-selected,
.list-row.bulk-selected {
  position: relative;
  outline: 4px solid var(--accent);
  outline-offset: -4px;
  box-shadow:
    0 0 0 3px var(--accent-ink),
    0 0 18px var(--accent);
}
.card.bulk-selected::after,
.list-row.bulk-selected::after {
  content: '✓';
  position: absolute;
  z-index: 3;
  top: 0.55rem;
  right: 0.55rem;
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 900;
  box-shadow: 0 2px 8px #0008;
}
@media (max-width: 650px) {
  .bulk-editor form {
    grid-template-columns: 1fr;
  }
  .bulk-editor .section-heading {
    display: block;
  }
  .bulk-editor .section-heading > div:last-child {
    margin-top: 0.6rem;
  }
}
.user-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}
.user-options label {
  display: flex !important;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel-2);
}
.user-options input,
.upload-owner-confirm input {
  width: 1.1rem;
  height: 1.1rem;
  min-width: 1.1rem;
  margin: 0;
  padding: 0;
  accent-color: var(--accent);
}
.bulk-field fieldset,
.classification-editor fieldset {
  min-width: 0;
  margin: 0;
  border: 1px solid var(--border);
  border-radius: 0.8rem;
  padding: 0.7rem;
}
.classification-editor {
  margin-top: 1rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 1rem;
  background: var(--panel);
}
.classification-heading strong,
.classification-heading small {
  display: block;
}
.classification-heading small {
  margin-top: 0.3rem;
  color: var(--muted);
  line-height: 1.4;
}
.classification-editor form {
  display: grid;
  gap: 0.85rem;
  margin-top: 0.9rem;
}
.classification-genres {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.35rem;
}
.classification-genres input {
  width: 100%;
  min-width: 0;
}
.assignment-series-toggle {
  display: grid;
  grid-template-columns: 1.1rem minmax(0, 1fr);
  align-items: start;
  gap: 0.55rem;
  line-height: 1.35;
}
.assignment-series-toggle input {
  width: 1.1rem;
  height: 1.1rem;
  margin: 0.12rem 0 0;
  padding: 0;
  accent-color: var(--accent);
}
.upload-owner-confirm {
  display: flex !important;
  grid-template-columns: auto 1fr !important;
  align-items: center;
  gap: 0.5rem;
}
.recommended-score {
  color: var(--accent);
}

/* Keep the complete full-screen player inside Safari's dynamic phone viewport. */
@media (max-width: 650px) {
  #full-player {
    height: 100dvh;
    min-height: 0;
    overflow: hidden;
    padding: calc(env(safe-area-inset-top) + 0.45rem) 0.85rem
      calc(env(safe-area-inset-bottom) + 0.45rem);
  }
  .full-player-top {
    min-height: 2.5rem;
    margin: 0 auto 0.35rem;
  }
  .full-player-top button {
    padding: 0.4rem;
  }
  #full-cover {
    width: auto;
    max-width: min(64vw, 15rem);
    height: min(33dvh, 15rem);
    margin: 0 auto;
    padding: 0.2rem;
    border-radius: 0.55rem;
  }
  .full-part-navigation {
    margin: -0.3rem auto 0.35rem;
    gap: 0.4rem;
  }
  .full-part-navigation button {
    min-height: 2.25rem;
    padding: 0.35rem 0.55rem;
    font-size: 0.75rem;
  }
  .full-player-copy {
    margin: 0.5rem auto 0.25rem;
  }
  .full-player-copy strong {
    font-size: clamp(1.2rem, 5vw, 1.65rem);
    line-height: 1.05;
  }
  .full-player-copy span {
    margin-top: 0.15rem;
    font-size: 0.85rem;
  }
  #full-seek {
    margin: 0.4rem auto 0.1rem;
  }
  .full-time {
    font-size: 0.8rem;
  }
  .transport {
    gap: clamp(1.2rem, 12vw, 3.5rem);
    margin: 0.55rem auto;
  }
  .transport button {
    width: 3.1rem;
    height: 3.1rem;
    font-size: 1.7rem;
  }
  .transport button svg {
    width: 3rem;
    height: 3rem;
  }
  .transport .primary-play {
    width: 4rem;
    height: 4rem;
    font-size: 1.5rem;
  }
  .player-tools {
    margin: 0.45rem auto 0;
  }
  .player-tools button {
    min-width: 2.8rem;
    padding: 0.5rem 0.6rem;
  }
  :root[data-theme='winamp'] .transport,
  :root[data-theme='winamp'] .player-tools {
    padding: 0.25rem;
    border-width: 2px;
  }
  :root[data-theme='winamp'] #full-cover {
    border-width: 3px;
    box-shadow: 4px 4px 0 #000;
  }
  :root[data-theme='nintendo'] #full-cover {
    border-width: 4px;
    box-shadow: 0 0 0 2px #9c9990;
  }
  :root[data-theme='winamp'] #full-player::after,
  :root[data-theme='nintendo'] #full-player::after,
  :root[data-theme='xbox'] #full-player::after {
    display: none;
  }
}

@media (max-height: 700px) and (max-width: 650px) {
  #full-cover {
    height: min(27dvh, 11.5rem);
  }
  .full-player-top {
    min-height: 2rem;
  }
  .transport {
    margin: 0.35rem auto;
  }
  .player-tools {
    margin-top: 0.25rem;
  }
}
.started-list {
  display: grid;
  gap: 0.6rem;
  max-width: 48rem;
}
.current-reads-secondary {
  margin-top: 2rem;
}
.started-card {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) auto;
  gap: 0.8rem;
  align-items: center;
  width: 100%;
  min-height: 6.4rem;
  padding: 0.55rem;
  border: 1px solid #345646;
  border-radius: 0.8rem;
  background: #14231d;
  color: #fff;
  text-align: left;
}
.started-card:hover,
.started-card:focus-visible {
  border-color: var(--accent);
  background: #192d25;
}
.started-cover {
  width: 64px;
  height: 5.25rem;
  padding: 0.2rem;
  object-fit: contain;
  overflow: hidden;
  border-radius: 0.35rem;
  background: #20382e;
  font-size: 0.62rem;
}
.started-copy,
.started-copy strong,
.started-copy small {
  display: block;
  min-width: 0;
}
.started-copy strong,
.started-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.started-copy small {
  margin-top: 0.18rem;
  color: var(--muted);
}
.started-progress {
  display: block;
  height: 0.3rem;
  margin-top: 0.55rem;
  overflow: hidden;
  border-radius: 999px;
  background: #32483f;
}
.started-progress i {
  display: block;
  height: 100%;
  background: var(--accent);
}
.started-play {
  display: grid;
  place-items: center;
  width: 2.8rem;
  height: 2.8rem;
  padding: 0;
  border-radius: 50%;
  background: #1f7a45;
  color: #fff;
  font-size: 1.05rem;
  box-shadow:
    inset 0 -3px #104d2a,
    0 2px 7px #0005;
}
.started-play:hover,
.started-play:focus-visible {
  background: #2b9a5a;
  transform: scale(1.04);
}

/* Compact navigation and collapsible library controls. */
nav {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0;
  overflow: hidden;
  border: 1px solid #345646;
  border-radius: 0.75rem;
  background: #101e18;
}
nav button {
  min-width: 0;
  border-radius: 0;
  padding: 0.72rem 0.35rem;
  background: transparent;
  color: var(--muted);
  font-size: 0.86rem;
  white-space: normal;
}
nav button + button {
  border-left: 1px solid #29483a;
}
nav button.active {
  background: #345646;
  color: #fff;
  box-shadow: inset 0 -3px var(--accent);
}
.library-controls {
  display: block;
}
.library-controls > #search {
  width: 100%;
  margin-bottom: 0.65rem;
}
.library-options {
  border: 1px solid #365748;
  border-radius: 0.75rem;
  background: #101e18;
  overflow: hidden;
}
.library-options summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.65rem;
  padding: 0.72rem 0.85rem;
  cursor: pointer;
  list-style: none;
}
.library-options summary::-webkit-details-marker {
  display: none;
}
.library-options summary small,
.library-options summary strong {
  display: block;
}
.library-options summary small {
  color: var(--accent);
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}
.library-options summary em {
  display: block;
  margin-top: 0.18rem;
  color: var(--muted);
  font-size: 0.72rem;
  font-style: normal;
  font-weight: 500;
}
.library-options #active-filter-count {
  margin-left: auto;
  padding: 0.25rem 0.45rem;
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--accent);
  font-size: 0.68rem;
  font-weight: 800;
  white-space: nowrap;
}
.library-options summary > span:last-child {
  font-size: 1.35rem;
  transition: transform 0.2s ease;
}
.library-options[open] summary > span:last-child {
  transform: rotate(180deg);
}
.library-options .toolbar {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  padding: 0.7rem 0.7rem 0;
}
.library-options .view-switcher {
  margin: 0.7rem;
}
.library-options #clear-library-filters {
  margin: 0.6rem 0.7rem 0;
  padding: 0.45rem 0.7rem;
}

/* Artwork frames show the complete cover without cropping it. */
.cover,
.scroller-cover,
.continue-cover,
.list-cover,
.series-book img,
#full-cover {
  object-fit: contain;
  background: #1b3027;
}
.shelves .cover {
  object-fit: contain !important;
  padding: 0.25rem;
}

/* Series are collapsible shelves with clear progress and ordering controls. */
#series.history {
  gap: 1rem;
}
#series-search {
  width: 100%;
  margin: 0 0 0.85rem;
}
.series-group {
  overflow: hidden;
  background: #101e18;
  border: 1px solid #345646;
  border-radius: 1rem;
}
.series-group > summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  min-height: 4.5rem;
  padding: 0.75rem 1rem;
  cursor: pointer;
  list-style: none;
}
.series-group > summary::-webkit-details-marker {
  display: none;
}
.series-group > summary small,
.series-group > summary strong {
  display: block;
}
.series-group > summary small {
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.65rem;
}
.series-group > summary strong {
  margin-top: 0.15rem;
  font:
    700 1.35rem Georgia,
    serif;
}
.series-count {
  color: var(--muted);
  font-size: 0.78rem;
  white-space: nowrap;
}
.series-group .series-shelf {
  padding: 0 1rem 1rem;
  margin: 0;
}
.series-group > summary::after {
  content: '›';
  color: var(--accent);
  font-size: 1.8rem;
  line-height: 1;
  transition: transform 0.18s ease;
}
.series-group[open] > summary::after {
  transform: rotate(90deg);
}
.series-group > summary .series-count {
  margin-left: auto;
}

.series-external-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.55rem;
  align-items: center;
  width: 100%;
  padding: 0.8rem 1rem 1rem;
  text-align: center;
}

.series-external-links a,
.series-external-links button {
  min-height: 2.75rem;
}

.series-links-dialog {
  width: min(42rem, calc(100% - 1.5rem));
}

.series-link-provider + .series-link-provider {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.series-link-candidate {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  width: 100%;
  margin: 0.5rem 0;
  padding: 0.65rem 0.75rem;
  border: 1px solid transparent;
  border-radius: 1rem;
  background: color-mix(in srgb, var(--panel-2) 82%, transparent);
  text-align: left;
}

.series-link-candidate a {
  display: grid;
  min-width: 0;
  flex: 1;
  gap: 0.15rem;
  color: inherit;
  text-decoration: none;
}

.series-link-candidate a:hover strong,
.series-link-candidate a:focus-visible strong {
  color: var(--accent);
  text-decoration: underline;
}

.series-link-candidate small {
  display: block;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.series-link-candidate > button {
  flex: 0 0 auto;
}

.series-link-candidate.selected {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}
.series-link-provider-actions,
.series-order-preview-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 0.8rem;
}
.series-order-changes {
  display: grid;
  gap: 0.55rem;
}
.series-order-changes label {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 0.7rem;
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-radius: 0.9rem;
  background: color-mix(in srgb, var(--panel-2) 82%, transparent);
}
.series-order-changes input {
  width: 1.25rem;
  height: 1.25rem;
  margin: 0.15rem 0 0;
  padding: 0;
}
.series-order-changes span,
.series-order-changes small {
  display: block;
}
.series-order-changes small {
  margin-top: 0.2rem;
  color: var(--muted);
}
.series-order-preview details {
  margin-top: 0.85rem;
}
.series-book {
  display: grid;
  grid-template-rows: 12rem 1fr;
  min-width: 0;
  border: 1px solid #29483a;
}
.series-book {
  cursor: pointer;
  transition:
    border-color 0.15s ease,
    background 0.15s ease;
}
.series-book:hover,
.series-book:focus-visible {
  border-color: var(--accent);
  background: #20382e;
  outline: none;
}
.series-book img,
.series-cover-placeholder {
  width: 100%;
  height: 12rem;
  padding: 0.45rem;
  object-fit: contain;
  background: #20382e;
}
.series-cover-placeholder {
  display: grid;
  place-items: center;
  color: var(--muted);
}
.series-book .book-spine {
  position: relative;
  display: grid;
  gap: 0.35rem;
  align-content: start;
  padding: 0.7rem;
}
.series-number {
  position: absolute;
  top: -1.25rem;
  left: 0.55rem;
  min-width: 2rem;
  padding: 0.22rem 0.45rem;
  border-radius: 999px;
  background: var(--accent);
  color: #211808;
  text-align: center;
  font-weight: 900;
}
.series-book [data-open-series-book] {
  padding: 0;
  border-radius: 0;
  background: transparent;
  color: #fff;
  text-align: left;
  font-weight: 800;
}
.series-book small {
  color: var(--muted);
  text-transform: capitalize;
}
.series-order {
  display: flex;
  gap: 0.35rem;
  margin-top: 0.25rem;
}
.series-order button {
  padding: 0.35rem 0.65rem;
  background: #29483a;
  color: #fff;
}
.empty-state {
  grid-column: 1/-1;
  padding: 2rem;
  text-align: center;
  border: 1px dashed #436554;
  border-radius: 1rem;
  color: var(--muted);
}
@media (max-width: 650px) {
  nav {
    grid-template-columns: 0.9fr 0.9fr 1.35fr 0.75fr 1.15fr 0.7fr;
  }
  nav button {
    font-size: 0.75rem;
    padding: 0.68rem 0.2rem;
  }
  .library-options .toolbar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
  }
  .library-options .toolbar select {
    min-width: 0;
    padding: 0.62rem 0.55rem;
    font-size: 0.82rem;
  }
  .series-shelf {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .series-book {
    grid-template-rows: 9.5rem 1fr;
  }
  .series-book img,
  .series-cover-placeholder {
    height: 9.5rem;
  }
  #recommended-books {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.65rem;
  }
  #recommended-books .card {
    display: grid;
    grid-template-columns: 74px minmax(0, 1fr);
    min-height: 7rem;
  }
  #recommended-books .cover {
    width: 74px;
    height: 7rem;
    aspect-ratio: auto;
    padding: 0.25rem;
    overflow: hidden;
    font-size: 0.72rem;
  }
  #recommended-books .card .meta {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 7rem;
    padding: 0.65rem 0.75rem;
  }
  #recommended-books .card .meta strong,
  #recommended-books .card .meta p {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  #recommended-books .card .progress {
    margin-top: auto;
  }
}
@media (max-width: 380px) {
  .library-options .toolbar {
    grid-template-columns: 1fr;
  }
}

/* Five-button playback, card playback, and distraction-reduced car mode. */
.transport {
  width: min(38rem, 100%);
  justify-content: space-between;
  gap: 0.35rem;
}
.transport .part-jump {
  width: 3rem;
  height: 3rem;
  font-size: 1.3rem;
}
.transport button svg text {
  dominant-baseline: middle;
}
.transport button:disabled,
.car-transport button:disabled {
  opacity: 0.28;
}
.card {
  position: relative;
}
.card-play {
  position: absolute;
  z-index: 4;
  right: 0.55rem;
  top: 0.55rem;
  display: grid;
  place-items: center;
  width: 2.65rem;
  height: 2.65rem;
  padding: 0;
  border: 1px solid #ffffff44;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 1.05rem;
  box-shadow: 0 3px 10px #0008;
}
.skip-options {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.45rem;
  margin-top: 0.8rem;
}
.skip-options label {
  display: grid;
  place-items: center;
  gap: 0.3rem;
  padding: 0.65rem 0.3rem;
  border: 1px solid var(--border);
  border-radius: 0.7rem;
  background: var(--panel-2);
  font-weight: 800;
}
.skip-options input {
  width: 1.1rem;
  height: 1.1rem;
  margin: 0;
  accent-color: var(--accent);
}
#car-player {
  position: fixed;
  z-index: 80;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: calc(env(safe-area-inset-top) + 1.25rem) 1rem calc(env(safe-area-inset-bottom) + 1.25rem);
  background: #06121b;
  color: #fff;
  text-align: center;
  overscroll-behavior: none;
}
#car-player[hidden] {
  display: none;
}
#car-player .car-close {
  position: absolute;
  top: calc(env(safe-area-inset-top) + 0.75rem);
  left: 1rem;
  width: 3.25rem;
  height: 3.25rem;
  padding: 0;
  background: transparent;
  color: #fff;
  font-size: 2.5rem;
}
#car-player > img {
  width: min(52vw, 15rem);
  height: min(37dvh, 15rem);
  object-fit: contain;
  border-radius: 1rem;
  background: #10231c;
}
#car-player > strong {
  max-width: 36rem;
  font:
    700 clamp(1.45rem, 6vw, 2.25rem) Georgia,
    serif;
}
#car-player > span {
  max-width: 36rem;
  color: #a9b8c3;
  overflow-wrap: anywhere;
}
.car-transport {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  align-items: center;
  gap: clamp(0.35rem, 3vw, 1.5rem);
  width: min(44rem, 100%);
  margin-top: 1rem;
}
.car-transport button {
  display: grid;
  place-items: center;
  min-width: 0;
  height: clamp(4rem, 17vw, 6.5rem);
  padding: 0.2rem;
  background: transparent;
  color: #fff;
  font-size: clamp(1.25rem, 5vw, 2.3rem);
}
.car-transport .primary-play {
  height: clamp(5rem, 21vw, 8rem);
  border-radius: 50%;
  background: #fff;
  color: #102a43;
  font-size: clamp(2rem, 8vw, 3.5rem);
}
.car-transport #car-back,
.car-transport #car-forward {
  position: relative;
  font-size: clamp(2.7rem, 10vw, 4rem);
}
.car-skip-label {
  position: absolute;
  inset: 50% auto auto 50%;
  transform: translate(-50%, -48%);
  font-size: clamp(0.8rem, 3.5vw, 1.25rem);
  font-weight: 900;
}
@media (max-width: 650px) {
  .transport {
    gap: 0.15rem;
  }
  .transport button {
    width: 2.9rem;
    height: 2.9rem;
  }
  .transport .part-jump {
    width: 2.25rem;
    height: 2.25rem;
    font-size: 0.95rem;
  }
  .card-play {
    width: 2.4rem;
    height: 2.4rem;
  }
  .player-tools {
    gap: 0.1rem;
  }
  .player-tools button {
    min-width: 2.4rem;
    padding: 0.45rem 0.35rem;
  }
  .skip-options {
    grid-template-columns: repeat(2, 1fr);
  }
}

#full-player {
  position: fixed;
  z-index: 50;
  inset: 0;
  overflow: auto;
  padding: calc(env(safe-area-inset-top) + 1rem) 1.25rem calc(env(safe-area-inset-bottom) + 1.5rem);
  background: radial-gradient(circle at 50% 8%, #315844 0, #14231d 35%, #09100d 78%);
  color: #fff;
  overscroll-behavior: none;
}
.full-player-top {
  display: grid;
  grid-template-columns: 3rem 1fr 3rem;
  align-items: center;
  text-align: center;
  max-width: 38rem;
  margin: 0 auto 1rem;
}
.full-player-top button {
  padding: 0.65rem;
}
.full-part-navigation {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
  width: min(34rem, 100%);
  margin: -0.65rem auto 0.85rem;
}
.full-part-navigation button {
  min-height: 2.75rem;
  padding: 0.55rem 0.8rem;
  border: 1px solid #ffffff22;
  background: #162a22cc;
  color: var(--accent);
  font-size: 0.88rem;
  font-weight: 800;
}
.full-part-navigation button:first-child {
  text-align: left;
}
.full-part-navigation button:last-child {
  text-align: right;
}
.full-part-navigation button:disabled {
  opacity: 0.35;
}
#full-cover {
  display: block;
  width: min(68vw, 20rem);
  height: min(42vh, 27rem);
  aspect-ratio: 2/3;
  object-fit: contain;
  margin: 0 auto;
  padding: 0.35rem;
  border-radius: 1rem;
  background: linear-gradient(145deg, #315844, #172820);
  box-shadow: 0 1.5rem 4rem #0009;
}
.full-player-copy {
  max-width: 38rem;
  margin: 1.2rem auto 0.75rem;
  text-align: center;
}
.full-player-copy strong,
.full-player-copy span {
  display: block;
}
.full-player-copy strong {
  font:
    700 clamp(1.5rem, 6vw, 2.2rem) Georgia,
    serif;
}
.full-player-copy span {
  margin-top: 0.3rem;
  color: var(--muted);
}
#full-seek {
  display: block;
  width: min(38rem, 100%);
  margin: 1rem auto 0.25rem;
  padding: 0;
  accent-color: var(--accent);
}
.full-time {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  width: min(38rem, 100%);
  margin: auto;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.full-time span:last-child {
  text-align: right;
}
.transport {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: clamp(2rem, 14vw, 6rem);
  margin: 1.5rem auto;
}
.transport button {
  position: relative;
  width: 4rem;
  height: 4rem;
  padding: 0;
  background: transparent;
  color: var(--accent);
  font-size: 2.8rem;
}
.transport button svg {
  display: block;
  width: 3.75rem;
  height: 3.75rem;
  margin: auto;
  overflow: visible;
  fill: none;
  stroke: currentColor;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.transport button svg text {
  fill: currentColor;
  stroke: none;
  font:
    800 11px Inter,
    sans-serif;
  text-anchor: middle;
}
.transport .primary-play {
  width: 5rem;
  height: 5rem;
  background: var(--accent);
  color: #211808;
  font-size: 2rem;
}
.player-tools {
  display: flex;
  justify-content: space-around;
  width: min(34rem, 100%);
  margin: 1.25rem auto 0;
}
.player-tools button {
  min-width: 3.2rem;
  color: var(--accent);
  font-weight: 800;
}
.player-tools button small {
  display: block;
  margin-top: 0.15rem;
  color: var(--muted);
  font-size: 0.62rem;
}
#full-bookmark svg {
  display: block;
  width: 1.8rem;
  height: 1.8rem;
  margin: auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.chapters-dialog {
  width: min(42rem, calc(100% - 1rem));
  max-height: min(84dvh, 50rem);
  padding: 1.25rem;
}
.chapters-dialog h2 {
  margin: 0.15rem 0;
}
.chapter-list {
  display: grid;
  max-height: 65dvh;
  margin-top: 0.8rem;
  overflow: auto;
  border-top: 1px solid var(--border);
}
.chapter-row {
  display: grid;
  gap: 0.18rem;
  width: 100%;
  padding: 0.75rem 0.65rem;
  border: 0;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  background: transparent;
  color: inherit;
  text-align: left;
}
.chapter-row strong {
  font-size: 1rem;
}
.chapter-row small {
  color: var(--muted);
  font-size: 0.78rem;
  overflow-wrap: anywhere;
}
.chapter-row.current {
  border-left: 4px solid var(--accent);
  background: var(--panel-2);
  color: var(--accent);
}
#sleep-dialog {
  width: min(32rem, calc(100% - 1rem));
}
.finished-review-dialog {
  max-width: 30rem;
}
.finished-review-book {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.finished-review-book img {
  width: 4.5rem;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  border-radius: 0.55rem;
}
.finished-review-dialog fieldset {
  margin: 1.2rem 0;
  border: 0;
  padding: 0;
}
.finished-review-timing {
  display: grid;
  gap: 0.55rem;
}
.finished-review-timing > label {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 0.7rem;
  background: var(--panel-soft);
}
.finished-review-timing input[type='radio'] {
  width: 1.1rem;
  height: 1.1rem;
  margin: 0;
}
#finished-review-date-row {
  display: grid;
  gap: 0.35rem;
}
#finished-review-date-row input {
  width: 100%;
}
.finished-review-stars {
  display: flex;
  gap: 0.25rem;
}
.finished-review-stars button {
  border: 0;
  padding: 0.15rem;
  background: transparent;
  color: var(--muted);
  font-size: 2.35rem;
  line-height: 1;
}
.finished-review-stars button.active {
  color: #ffad33;
}
.finished-review-dialog textarea {
  width: 100%;
  margin-top: 0.35rem;
}
.finished-review-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1rem;
}
.sleep-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
  margin-top: 1rem;
}
.sleep-options button {
  min-height: 3.4rem;
}
.sleep-options [data-sleep-end],
.sleep-options [data-sleep-off] {
  grid-column: 1/-1;
}

/* Equal library cards and an uninterrupted Cover Flow animation. */
.covers,
.covers .group-books {
  align-items: stretch;
}
.covers .card {
  display: grid;
  grid-template-rows: auto 1fr;
  height: 100%;
}
.covers .card .meta {
  display: flex;
  flex-direction: column;
  min-height: 10.5rem;
}
.covers .card .progress {
  margin-top: auto;
}
.covers .cover {
  overflow: hidden;
}
.covers .placeholder-cover span {
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Book editing: compact series fields and source-labelled cover choices. */
.series-editor,
.metadata-editor {
  display: grid;
  gap: 0.8rem;
  margin-top: 1rem;
  padding: 1rem;
  border: 1px solid #345646;
  border-radius: 1rem;
  background: #101e18;
}
.series-editor > div strong,
.series-editor > div small,
.metadata-editor > div strong,
.metadata-editor > div small {
  display: block;
}
.series-editor > div small,
.metadata-editor > div small {
  margin-top: 0.25rem;
  color: var(--muted);
}
.series-editor form,
.metadata-editor form {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(7rem, 1fr);
  gap: 0.7rem;
  align-items: end;
}
.series-editor label,
.metadata-editor label {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.35rem;
  margin: 0;
  min-width: 0;
}
.series-editor input,
.metadata-editor input,
.metadata-editor textarea {
  width: 100%;
  min-width: 0;
}
.metadata-description {
  grid-column: 1/-1;
}
.series-editor-actions {
  display: flex;
  grid-column: 1/-1;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.series-editor #series-result,
.metadata-editor #metadata-result {
  grid-column: 1/-1;
  margin: 0;
}
.series-suggestions {
  display: flex;
  grid-column: 1/-1;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-top: -0.25rem;
  padding: 0.5rem;
  border: 1px solid #345646;
  border-radius: 0.7rem;
  background: #0b1712;
}
.series-suggestions button {
  padding: 0.48rem 0.7rem;
  border-radius: 0.55rem;
  background: #29483a;
  color: #fff;
  text-align: left;
}
.detail-tabs {
  display: flex;
  margin: 1rem 0;
  border: 1px solid #345646;
  border-radius: 0.75rem;
  overflow-x: auto;
}
.detail-tabs button {
  flex: 1 0 auto;
  min-width: 5rem;
  border-radius: 0;
  padding: 0.7rem 0.5rem;
  background: #14231d;
  color: var(--muted);
}
.detail-tabs button.active {
  background: #345646;
  color: #fff;
  box-shadow: inset 0 -3px var(--accent);
}
.detail-panel {
  min-width: 0;
}
.detail-panel[data-detail-panel='files'] > .parts {
  margin-top: 0.5rem;
}
.detail-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 1rem 0;
  border: 1px solid #345646;
  border-radius: 0.75rem;
  overflow: hidden;
}
.detail-tabs button {
  border-radius: 0;
  padding: 0.7rem 0.25rem;
  background: #14231d;
  color: var(--muted);
}
.detail-tabs button.active {
  background: #345646;
  color: #fff;
  box-shadow: inset 0 -3px var(--accent);
}
.detail-panel {
  min-width: 0;
}
.book-parts {
  margin: 0.75rem 0;
  border: 1px solid #345646;
  border-radius: 0.8rem;
  overflow: hidden;
}
.book-parts > summary {
  padding: 0.85rem;
  cursor: pointer;
  color: var(--accent);
  font-weight: 800;
}
.book-parts > .parts {
  padding: 0.65rem;
}
.cover-results {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr));
  gap: 0.7rem;
  max-height: min(28rem, 52vh);
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
  margin-top: 0.6rem;
}
.manual-cover-upload {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
  align-items: center;
  margin: 0.8rem 0;
  padding: 0.75rem;
  border: 1px solid #345646;
  border-radius: 0.75rem;
  background: #14231d;
}
.manual-cover-upload label.button {
  margin: 0;
  text-align: center;
  cursor: pointer;
}
.manual-cover-upload img {
  grid-row: span 2;
  width: 100%;
  max-height: 13rem;
  object-fit: contain;
  border-radius: 0.5rem;
  background: #20382e;
}
.manual-cover-upload p {
  grid-column: 1 / -1;
  margin: 0;
}
.status-action.selected,
.status-action[aria-pressed='true'] {
  color: #fff;
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 32%, #14231d);
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--accent) 55%, transparent);
}
@media (max-width: 34rem) {
  .manual-cover-upload {
    grid-template-columns: 1fr;
  }
  .manual-cover-upload img {
    grid-row: auto;
    max-height: 16rem;
  }
}
.cover-choice {
  display: grid;
  grid-template-rows: 11rem minmax(3.6rem, 1fr) auto;
  gap: 0.5rem;
  width: 100%;
  min-width: 0;
  overflow: hidden;
  padding: 0.55rem;
  border: 1px solid #345646;
  border-radius: 0.75rem;
  background: #14231d;
}
.cover-choice img {
  width: 100%;
  height: 11rem;
  padding: 0.2rem;
  object-fit: contain;
  border-radius: 0.35rem;
  background: #20382e;
}
.cover-choice > div {
  min-width: 0;
  overflow: hidden;
}
.cover-choice strong,
.cover-choice small {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cover-choice strong {
  white-space: nowrap;
}
.cover-choice small {
  margin-top: 0.2rem;
  color: var(--muted);
  font-size: 0.72rem;
  white-space: normal;
}
.cover-choice button {
  width: 100%;
  padding: 0.55rem;
}
#match-dialog {
  overflow-x: hidden;
}
#match-dialog .match-results,
#match-dialog .cover-results {
  width: 100%;
  min-width: 0;
}
#confirmation-dialog {
  width: min(28rem, calc(100% - 2rem));
  text-align: center;
}
#confirmation-dialog .close {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
}
#confirmation-dialog p:not(.eyebrow) {
  color: var(--muted);
  line-height: 1.45;
}
#file-move-dialog {
  width: min(34rem, calc(100% - 1rem));
}
#file-move-dialog label {
  display: grid;
  gap: 0.35rem;
  margin: 1rem 0;
}
#file-move-dialog select,
#file-move-dialog input {
  width: 100%;
}
#file-move-dialog hr {
  margin: 1.2rem 0;
  border: 0;
  border-top: 1px solid #345646;
}
#file-split-dialog {
  width: min(34rem, calc(100% - 1rem));
}
#file-split-dialog label {
  display: grid;
  gap: 0.35rem;
  margin: 1rem 0;
}
#file-split-dialog input {
  width: 100%;
}
.split-file-list {
  max-height: 9rem;
  overflow: auto;
  padding-left: 1.25rem;
  color: var(--muted);
}
.split-help {
  display: grid;
  gap: 0.7rem;
  margin: 0.5rem 0 0.8rem;
  padding: 0.85rem;
  border: 1px solid var(--border);
  border-radius: 0.8rem;
  background: var(--panel-2);
}
.split-help small {
  display: block;
  margin-top: 0.25rem;
  color: var(--muted);
  line-height: 1.4;
}
.split-help.selecting {
  border-color: var(--accent);
}
.split-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}
.split-actions span {
  margin-right: auto;
  color: var(--accent);
  font-weight: 800;
}
.split-file-choice {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0 0 0.5rem;
  padding: 0.5rem;
  border: 1px solid var(--accent);
  border-radius: 0.55rem;
  color: var(--accent);
  font-weight: 800;
}
.split-file-choice input {
  width: auto;
  accent-color: var(--accent);
}
.bookmarks {
  display: grid;
  gap: 0.7rem;
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #345646;
}
.bookmarks .section-heading {
  align-items: center;
}
.bookmarks .section-heading > small {
  color: var(--muted);
}
.bookmark-entry {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.4rem 0.65rem;
  align-items: center;
  padding: 0.55rem 0.65rem;
  border: 1px solid #345646;
  border-radius: 0.7rem;
  background: #14231d;
}
.bookmark-copy {
  min-width: 0;
}
.bookmark-entry strong,
.bookmark-entry small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bookmark-entry strong {
  font-size: 0.9rem;
}
.bookmark-entry small {
  margin-top: 0.12rem;
  color: var(--muted);
  font-size: 0.72rem;
}
.bookmark-entry small b {
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.bookmark-actions {
  display: flex;
  gap: 0.3rem;
}
.bookmark-entry button {
  padding: 0.4rem 0.55rem;
  font-size: 0.75rem;
}
.bookmark-note-toggle {
  grid-column: 1/-1;
  justify-self: start;
  padding: 0.15rem 0 !important;
  background: transparent !important;
  color: var(--muted);
  font-size: 0.75rem !important;
}
.bookmark-note-toggle::before {
  content: '▸ ';
}
.bookmark-note {
  grid-column: 1/-1;
  border-top: 1px solid #29483a;
  padding-top: 0.35rem;
}
.bookmark-note label {
  display: block;
  margin: 0.4rem 0;
}
.bookmark-note input {
  width: 100%;
  padding: 0.5rem;
}
.match-narrator,
.match-source {
  display: block;
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-size: 0.78rem;
}
.saved-match {
  display: grid;
  grid-template-columns: 5.5rem minmax(0, 1fr);
  align-items: center;
  gap: 0.8rem;
}
.saved-match-cover {
  width: 5.5rem;
  aspect-ratio: 2/3;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 0.5rem;
  background: #20382e;
  color: var(--muted);
  text-align: center;
}
.saved-match-cover img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.saved-match small {
  display: block;
  color: var(--muted);
  margin-top: 0.25rem;
}
.saved-match > button {
  grid-column: 1/-1;
}
.cover-action {
  display: grid;
  grid-template-columns: 5.5rem minmax(0, 1fr);
  align-items: center;
}
.cover-action > button {
  grid-column: 1/-1;
}
.shelves.grouped {
  display: block;
  padding: 0.35rem;
}
.shelves.grouped .book-group {
  display: block;
  margin-bottom: 0.55rem;
}
.shelves.grouped .book-group > summary {
  min-height: 3.55rem;
  padding: 0.45rem 0.75rem;
}
.shelves.grouped .book-group > summary strong {
  font-size: 1.12rem;
}
.shelves.grouped .group-books {
  width: 100%;
  grid-template-columns: repeat(auto-fill, minmax(145px, 1fr));
}

/* Device-local appearance and playback preferences. */
.settings-section {
  margin-top: 1.2rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 1rem;
  background: var(--panel);
}
.settings-section h3 {
  margin: 0.1rem 0;
}
.settings-section p {
  margin: 0.35rem 0 0;
  line-height: 1.45;
}
.settings-section.theme-collapsed > :not(h3) {
  display: none;
}
.settings-section > h3[role='button'] {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
}
.settings-section > h3[role='button']::after {
  content: '−';
  font-family: Inter, sans-serif;
}
.settings-section.theme-collapsed > h3[role='button']::after {
  content: '+';
}
.admin-panel,
.upload-panel {
  margin-top: 1rem;
}
.admin-panel > summary,
.upload-panel > summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  list-style: none;
}
.admin-panel > summary::-webkit-details-marker {
  display: none;
}
.admin-panel > summary small,
.admin-panel > summary strong {
  display: block;
}
.admin-panel > summary small {
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}
.admin-panel > summary strong {
  margin-top: 0.15rem;
  font:
    700 clamp(1.35rem, 5vw, 2rem) Georgia,
    serif;
}
.admin-panel > summary > span:last-child {
  font-size: 2rem;
}
.admin-panel[open] > summary > span:last-child {
  transform: rotate(45deg);
}
.precision-seek {
  position: relative;
  width: min(38rem, 100%);
  margin: 1rem auto 0.25rem;
}
.precision-seek #full-seek {
  width: 100%;
  margin: 0;
  touch-action: none;
}
.precision-seek output {
  position: absolute;
  left: 50%;
  bottom: 1.8rem;
  z-index: 2;
  transform: translateX(-50%);
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 800;
  white-space: nowrap;
  box-shadow: 0 0.25rem 1rem #0008;
}
.author-match-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: flex-end;
}
.unmatched-authors,
.author-record-results {
  display: grid;
  gap: 0.55rem;
  margin: 1rem 0;
}
.unmatched-authors button,
.author-record-results button {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.8rem;
  text-align: left;
  background: var(--panel-2);
  color: inherit;
  border: 1px solid var(--border);
  border-radius: 0.75rem;
}
.unmatched-authors button.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 35%, transparent);
}
.unmatched-authors strong,
.unmatched-authors small,
.author-record-results strong,
.author-record-results small {
  display: block;
}
.unmatched-authors small,
.author-record-results small {
  margin-top: 0.2rem;
  color: var(--muted);
}
#author-record-search {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.55rem;
  align-items: end;
}
#author-record-search label {
  display: grid;
  gap: 0.35rem;
}
#manual-author-dialog {
  width: min(38rem, calc(100% - 1rem));
}
.theme-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
  margin-top: 1rem;
}
.theme-options button {
  display: grid;
  grid-template-columns: 1.3rem 1fr auto;
  gap: 0.6rem;
  align-items: center;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 0.7rem;
  background: var(--panel-2);
  color: #fff;
  text-align: left;
}
.theme-options button i {
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 0.35rem;
  background: var(--choice-color, var(--accent));
  box-shadow: inset 0 0 0 1px #fff3;
}
.theme-options button b {
  visibility: hidden;
  color: var(--accent);
}
.theme-options button.selected {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}
.theme-options button.selected b {
  visibility: visible;
}
[data-theme-choice='default'] {
  --choice-color: #e4b864;
}
[data-theme-choice='classic'] {
  --choice-color: #79b8ff;
}
[data-theme-choice='cocoa'] {
  --choice-color: #e2a36f;
}
[data-theme-choice='velvet'] {
  --choice-color: #ed86ef;
}
[data-theme-choice='midas'] {
  --choice-color: #f2c94c;
}
[data-theme-choice='oasis'] {
  --choice-color: #55ddd4;
}
[data-theme-choice='winamp'] {
  --choice-color: #c7e33d;
}
[data-theme-choice='itunes'] {
  --choice-color: #64b5ff;
}
[data-theme-choice='nintendo'] {
  --choice-color: #ff5a64;
}
[data-theme-choice='xbox'] {
  --choice-color: #72d84b;
}
[data-theme-choice='rose'] {
  --choice-color: #ff8fbd;
}
[data-theme-choice='sunset'] {
  --choice-color: #ff8a42;
}
[data-theme-choice='ocean'] {
  --choice-color: #47c8f2;
}
[data-theme-choice='slate'] {
  --choice-color: #b7c5dc;
}

/* Brand-inspired retro player treatments. */
:root[data-theme='winamp'] body {
  font-family: 'Courier New', monospace;
}
:root[data-theme='winamp'] #full-player {
  background: repeating-linear-gradient(0deg, #202124 0 2px, #151619 2px 4px);
  color: #d8ded0;
}
:root[data-theme='winamp'] .full-player-top,
:root[data-theme='winamp'] .full-player-copy,
:root[data-theme='winamp'] .full-time {
  color: #9df12c;
  text-shadow: 0 0 5px #72e100;
}
:root[data-theme='winamp'] #full-cover {
  border: 5px ridge #6c7174;
  border-radius: 0;
  background: #090a0a;
  box-shadow: 8px 8px 0 #000;
}
:root[data-theme='winamp'] .transport,
:root[data-theme='winamp'] .player-tools {
  padding: 0.55rem;
  border: 3px outset #707579;
  background: linear-gradient(#3b3f42, #202326);
}
:root[data-theme='winamp'] .transport button,
:root[data-theme='winamp'] .player-tools button {
  border-radius: 2px;
  border: 2px outset #858b8f;
  background: #363a3d;
  color: #a9f22f;
}
:root[data-theme='winamp'] .transport .primary-play {
  background: #b8d638;
  color: #101500;
}
:root[data-theme='itunes'] #full-player {
  background: linear-gradient(180deg, #f8fafc 0, #cbd2da 12%, #edf1f5 55%, #b7bec7 100%);
  color: #17202a;
}
:root[data-theme='itunes'] .full-player-top,
:root[data-theme='itunes'] .full-player-copy span,
:root[data-theme='itunes'] .full-time {
  color: #405368;
}
:root[data-theme='itunes'] #full-cover {
  border: 1px solid #fff;
  border-radius: 0.45rem;
  background: #d5dbe2;
  box-shadow:
    0 12px 30px #30465a66,
    0 0 0 1px #768391;
}
:root[data-theme='itunes'] .transport .primary-play {
  border: 1px solid #1683d8;
  background: linear-gradient(#8ad3ff, #2697e8 48%, #0878cf 52%, #60bbf3);
  box-shadow:
    inset 0 1px #fff,
    0 2px 5px #4568;
}
:root[data-theme='itunes'] .player-tools button,
:root[data-theme='itunes'] .full-player-top button {
  background: linear-gradient(#fff, #c8ced6);
  border: 1px solid #8995a2;
  color: #1d78bc;
  box-shadow: inset 0 1px #fff;
}
:root[data-theme='nintendo'] body {
  font-family: 'Trebuchet MS', Arial, sans-serif;
}
:root[data-theme='nintendo'] #full-player {
  background: #c8c5bb;
  color: #242424;
  box-shadow: inset 0 0 0 10px #dedbd2;
}
:root[data-theme='nintendo'] #full-cover {
  border: 8px solid #5d5c58;
  border-radius: 0.5rem;
  background: #151515;
  box-shadow: 0 0 0 4px #9c9990;
}
:root[data-theme='nintendo'] .full-player-copy strong {
  font-family: Arial, sans-serif;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
:root[data-theme='nintendo'] .full-player-copy span,
:root[data-theme='nintendo'] .full-time {
  color: #4e4e4b;
}
:root[data-theme='nintendo'] .transport button,
:root[data-theme='nintendo'] .player-tools button,
:root[data-theme='nintendo'] .full-player-top button {
  border-radius: 0.35rem;
  background: #555;
  color: #f4f1e8;
  box-shadow: inset 0 -4px #30302f;
}
:root[data-theme='nintendo'] .transport .primary-play {
  border-radius: 50%;
  background: #b31e2b;
  color: #fff;
  box-shadow:
    inset 0 -5px #731019,
    0 0 0 5px #777;
}
:root[data-theme='nintendo'] .player-text-page {
  color: #fff8ed;
}
:root[data-theme='nintendo'] .player-text-page h2,
:root[data-theme='nintendo'] .player-text-page p,
:root[data-theme='nintendo'] .player-text-page strong,
:root[data-theme='nintendo'] .player-text-page span {
  color: inherit;
}
:root[data-theme='nintendo'] .player-text-page .eyebrow {
  color: #ff7b83;
}
:root[data-theme='xbox'] #full-player {
  background: radial-gradient(circle at 50% 20%, #294f18 0, #071007 38%, #020502 78%);
  color: #eef7e8;
}
:root[data-theme='xbox'] #full-cover {
  border: 2px solid #76e53c;
  border-radius: 0.2rem;
  background: #050805;
  box-shadow:
    0 0 28px #58d62688,
    0 0 0 6px #13250d;
  clip-path: polygon(4% 0, 96% 0, 100% 4%, 100% 96%, 96% 100%, 4% 100%, 0 96%, 0 4%);
}
:root[data-theme='xbox'] .full-player-copy strong {
  font-family: Arial, sans-serif;
  font-weight: 900;
  letter-spacing: 0.04em;
}
:root[data-theme='xbox'] .transport .primary-play {
  background: radial-gradient(circle at 40% 32%, #c6ff9c, #55c51d 45%, #237a0b);
  box-shadow: 0 0 22px #65e82a;
  color: #071703;
}
:root[data-theme='xbox'] .player-tools button {
  border: 1px solid #4da727;
  background: linear-gradient(#1d3517, #0b1809);
  box-shadow: inset 0 0 8px #73d84933;
  color: #8bef55;
}
.smart-rewind-setting {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}
.switch {
  flex: 0 0 auto;
}
.switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.switch span {
  display: block;
  position: relative;
  width: 3.4rem;
  height: 1.9rem;
  border-radius: 999px;
  background: #52615a;
  transition: background 0.2s;
}
.switch span::after {
  content: '';
  position: absolute;
  top: 0.2rem;
  left: 0.2rem;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.2s;
}
.switch input:checked + span {
  background: var(--accent);
}
.switch input:checked + span::after {
  transform: translateX(1.5rem);
}
.switch input:focus-visible + span {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

/* Make each palette affect the whole interface, not only the page background. */
.hero,
.panel,
.card,
.list-row,
.started-card,
.history article,
.journal form,
.match-card,
.series-book,
.bookmark-entry,
dialog,
.library-options,
.series-group,
.detail-tabs button,
#player {
  background-color: var(--panel);
}
.part,
.continue-card,
.view-switcher,
.sync-status,
.archive-action,
.match-action,
.cover-action,
input,
select,
textarea {
  background-color: var(--panel-2);
}
.hero,
.panel,
.card,
.list-row,
.started-card,
dialog,
.library-options,
.series-group,
.bookmark-entry,
#player {
  border-color: var(--border);
}
.button,
.view-switcher button.active,
.transport .primary-play,
.series-number {
  color: var(--accent-ink);
}
@media (max-width: 650px) {
  .theme-options {
    grid-template-columns: 1fr;
  }
  .header-actions button {
    padding: 0.65rem 0.75rem;
  }
}
@media (max-width: 650px) {
  .shelves .card {
    height: 12.8rem;
    grid-template-rows: 8.6rem 4.2rem;
  }
  .shelves .cover {
    width: 100%;
    height: 8.6rem;
    aspect-ratio: auto;
    object-fit: cover;
    overflow: hidden;
  }
  .shelves .placeholder-cover span {
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .shelves .card .meta {
    height: 4.2rem;
    overflow: hidden;
  }
  .shelves.grouped .group-books {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .saved-match {
    grid-template-columns: 4.5rem minmax(0, 1fr);
  }
  .saved-match-cover {
    width: 4.5rem;
  }
  .series-editor form,
  .metadata-editor form {
    grid-template-columns: 1fr;
  }
  .series-editor-actions,
  .series-editor #series-result,
  .metadata-description,
  .metadata-editor #metadata-result {
    grid-column: 1;
  }
  .cover-results {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Swipeable book information inside the full-screen player. */
body.full-player-open {
  position: fixed;
  left: 0;
  right: 0;
  width: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}
.full-book-pages {
  width: min(38rem, 100%);
  height: min(54vh, 34rem);
  margin: 0 auto;
  overflow: hidden;
  touch-action: pan-y;
  overscroll-behavior: none;
}
.player-pages-track {
  display: flex;
  width: 400%;
  height: 100%;
  transform: translateX(calc(var(--player-page) * -25%));
  transition: transform 0.32s cubic-bezier(0.22, 0.8, 0.24, 1);
}
.player-page {
  flex: 0 0 25%;
  min-width: 0;
  height: 100%;
  box-sizing: border-box;
}
.player-cover-page {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: clamp(1rem, 4vw, 1.6rem);
  border: 1px solid var(--border);
  border-radius: 1rem;
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  overflow: hidden;
}
.player-text-page {
  display: flex;
  flex-direction: column;
  padding: clamp(1rem, 4vw, 1.6rem);
  border: 1px solid var(--border);
  border-radius: 1rem;
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  overflow: hidden;
}
.player-text-page h2 {
  margin: 0.2rem 0 0.8rem;
}
.player-page-scroll {
  margin: 0;
  /* Vertical only (owner 2026-11-21: the summary box also scrolled sideways). A long unbreakable word, such as
     the web address a summary ends with, made the text wider than the box; it now wraps instead. */
  overflow-x: hidden;
  overflow-y: auto;
  overflow-wrap: anywhere;
  line-height: 1.55;
  white-space: pre-line;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  overscroll-behavior: contain;
}
.player-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
  margin: 0;
  overflow: auto;
}
.player-facts div {
  min-width: 0;
  padding: 0.7rem;
  border: 1px solid var(--border);
  border-radius: 0.7rem;
  background: #0002;
}
.player-facts dt {
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.player-facts dd {
  margin: 0.25rem 0 0;
  font-weight: 800;
  overflow-wrap: anywhere;
}
.player-page-dots {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin: 0.45rem auto 0.2rem;
}
.player-page-dots button {
  width: 0.55rem;
  height: 0.55rem;
  min-width: 0;
  padding: 0;
  border: 1px solid var(--accent);
  border-radius: 50%;
  background: transparent;
}
.player-page-dots button.active {
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
}
@media (max-width: 650px) {
  .full-book-pages {
    height: 47dvh;
  }
  .player-cover-page {
    padding: 0.8rem;
  }
  .player-cover-page #full-cover {
    height: min(31dvh, 15rem);
    max-height: 31dvh;
  }
  .player-cover-page .full-player-copy {
    margin: 0.5rem auto 0;
  }
  .player-text-page {
    padding: 0.8rem;
  }
  .player-facts {
    gap: 0.45rem;
  }
  .player-facts div {
    padding: 0.5rem;
  }
  .player-page-dots {
    margin: 0.25rem auto 0;
  }
}
@media (max-height: 700px) and (max-width: 650px) {
  .full-book-pages {
    height: 39dvh;
  }
  .player-cover-page #full-cover {
    height: min(24dvh, 10rem);
  }
  .player-text-page h2 {
    margin: 0.1rem 0 0.45rem;
  }
  .player-facts div {
    padding: 0.35rem;
  }
}
#question-dialog {
  width: min(28rem, calc(100% - 1rem));
  text-align: center;
}
#question-dialog p:not(.eyebrow) {
  color: var(--muted);
  line-height: 1.45;
}
.question-actions {
  display: flex;
  justify-content: center;
  gap: 0.65rem;
  margin-top: 1.2rem;
}
:root[data-theme='winamp'] #toast {
  border: 3px ridge #777b83;
  border-radius: 1px;
  background: linear-gradient(#343642, #171820);
  color: #a9f22f;
  font-family: 'Courier New', monospace;
  text-shadow: 0 0 5px #72e100;
}
:root[data-theme='itunes'] #toast {
  border: 1px solid #7c8792;
  border-radius: 0.45rem;
  background: linear-gradient(#f7f8f9, #c7ccd2);
  color: #17202a;
  box-shadow:
    inset 0 1px #fff,
    0 4px 12px #30465a66;
}
:root[data-theme='nintendo'] #toast {
  border: 4px solid #55544f;
  border-radius: 0.35rem;
  background: linear-gradient(#d8d6ce, #9d9b94);
  color: #282725;
  box-shadow:
    inset 0 0 0 3px #ece9df,
    5px 7px 0 #55544f;
  text-transform: uppercase;
}
:root[data-theme='xbox'] #toast {
  border: 1px solid #4be82d;
  border-radius: 0;
  background: linear-gradient(120deg, #102b0d, #031003);
  color: #cfffaf;
  box-shadow:
    inset 0 0 20px #36ff1b22,
    0 0 14px #23bc1455;
  clip-path: polygon(
    0.7rem 0,
    100% 0,
    100% calc(100% - 0.7rem),
    calc(100% - 0.7rem) 100%,
    0 100%,
    0 0.7rem
  );
}

/* Keep both player transport rows geometrically consistent across themes. */
#full-player .transport,
.car-transport {
  display: grid;
  grid-template-columns: 3.25rem 4rem 5rem 4rem 3.25rem;
  justify-content: center;
  align-items: center;
  gap: clamp(0.35rem, 2.5vw, 1rem);
  width: min(32rem, 100%);
  margin: 1.15rem auto;
}
#full-player .transport button,
.car-transport button {
  display: grid;
  place-items: center;
  width: 100%;
  min-width: 0;
  height: auto;
  aspect-ratio: 1;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--accent);
  box-shadow: none;
  font-size: 0;
  line-height: 1;
}
#full-player .transport button svg,
.car-transport button svg {
  display: block;
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: visible;
  fill: none;
  stroke: currentColor;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}
#full-player .transport button svg .solid-icon,
.car-transport button svg .solid-icon {
  fill: currentColor;
  stroke: none;
}
#full-player .transport button svg text,
.car-transport button svg text {
  fill: currentColor;
  stroke: none;
  font:
    800 12px Inter,
    Arial,
    sans-serif;
  text-anchor: middle;
  dominant-baseline: middle;
}
#full-player .transport .primary-play,
.car-transport .primary-play {
  width: 5rem;
  height: 5rem;
  aspect-ratio: 1;
  justify-self: center;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 2rem;
  box-shadow: 0 0.25rem 0.8rem #0005;
}
#full-player .transport button:disabled,
.car-transport button:disabled {
  opacity: 0.25;
}
.car-transport {
  margin-top: 0.75rem;
}
#car-player {
  gap: 0.8rem;
}
@media (max-width: 380px) {
  #full-player .transport,
  .car-transport {
    grid-template-columns: 2.75rem 3.5rem 4.5rem 3.5rem 2.75rem;
    gap: 0.2rem;
  }
  #full-player .transport .primary-play,
  .car-transport .primary-play {
    width: 4.5rem;
    height: 4.5rem;
  }
}
#full-player .player-tools {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.55rem;
  width: min(22rem, 100%);
  margin: 0.75rem auto 0;
}
#full-player .player-tools button {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 0.2rem;
  width: 100%;
  min-width: 0;
  min-height: 3.6rem;
  padding: 0.4rem 0.25rem;
}
#full-player .player-tools button small {
  display: block;
  font-size: 0.68rem;
  line-height: 1;
}
#full-player .transport .skip-control,
.car-transport .skip-control {
  position: relative;
}
#full-player .transport .skip-control .skip-ring,
.car-transport .skip-control .skip-ring {
  stroke-width: 3.25;
}
#full-player .transport .skip-control .skip-arrowhead,
.car-transport .skip-control .skip-arrowhead {
  fill: currentColor;
  stroke: none;
}
#full-player .transport .skip-number,
.car-transport .skip-number {
  fill: currentColor;
  stroke: none;
  font:
    800 12px Inter,
    Arial,
    sans-serif;
  text-anchor: middle;
  dominant-baseline: middle;
  pointer-events: none;
}

/* Navigation and dialog exits remain reachable while their content scrolls. */
#app > nav {
  position: sticky;
  z-index: 25;
  top: 0;
  margin-inline: -0.25rem;
  padding: 0.45rem 0.25rem;
  background: color-mix(in srgb, var(--panel) 90%, transparent);
  backdrop-filter: blur(14px);
}
dialog > .close {
  position: sticky;
  z-index: 10;
  top: 0;
  float: right;
  background: color-mix(in srgb, var(--panel) 88%, transparent);
  backdrop-filter: blur(12px);
}

/* Car mode favors large, glanceable controls over compact player geometry. */
.car-transport {
  grid-template-columns: 3.75rem 5.25rem 7rem 5.25rem 3.75rem;
  width: min(40rem, 100%);
  gap: clamp(0.2rem, 2vw, 1rem);
}
.car-transport .primary-play {
  width: 7rem !important;
  height: 7rem !important;
  font-size: 3rem !important;
}
@media (max-width: 430px) {
  .car-transport {
    grid-template-columns: 3rem 4.75rem 6.5rem 4.75rem 3rem;
  }
  .car-transport .primary-play {
    width: 6.5rem !important;
    height: 6.5rem !important;
  }
}
@media (max-width: 360px) {
  .car-transport {
    grid-template-columns: 2.6rem 4.25rem 5.75rem 4.25rem 2.6rem;
  }
  .car-transport .primary-play {
    width: 5.75rem !important;
    height: 5.75rem !important;
  }
}

/* Per-listener author preferences. */
#author-search {
  width: 100%;
  margin: 0.25rem 0 1rem;
}
.authors-list {
  display: grid;
  gap: 1rem;
}
.author-section {
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 1rem;
  background: var(--panel);
}
.author-section h3 {
  display: flex;
  justify-content: space-between;
  margin: 0 0 0.75rem;
}
.author-section h3 span {
  color: var(--muted);
  font-size: 0.9rem;
}
.author-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}
.author-card {
  display: grid;
  grid-template-columns: 5.5rem minmax(0, 1fr);
  grid-template-rows: 1fr auto;
  gap: 0.65rem;
  padding: 0.65rem;
  border: 1px solid var(--border);
  border-radius: 1rem;
  background: var(--panel-2);
  cursor: pointer;
  min-width: 0;
}
.author-portrait {
  grid-row: 1;
  width: 5.5rem;
  height: 8.5rem;
  border-radius: 0.75rem;
  overflow: hidden;
  background: linear-gradient(145deg, var(--accent), var(--panel));
  display: grid;
  place-items: center;
}
.author-portrait img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.author-portrait span {
  display: grid;
  place-items: center;
  width: 3.3rem;
  height: 3.3rem;
  border-radius: 50%;
  background: color-mix(in srgb, var(--panel) 72%, transparent);
  font-family: Georgia, serif;
  font-size: 1.25rem;
}
.author-card-copy {
  min-width: 0;
}
.author-card-name {
  display: flex;
  justify-content: space-between;
  gap: 0.35rem;
}
.author-card-name strong {
  font-family: Georgia, serif;
  font-size: 1.05rem;
}
.author-card-name i {
  color: var(--gold);
  font-style: normal;
}
.author-card-copy small {
  display: block;
  margin-top: 0.12rem;
  color: var(--muted);
  font-size: 0.76rem;
}
.author-card-copy p {
  margin: 0.5rem 0 0;
  font-size: 0.8rem;
}
.author-card-copy ul {
  display: grid;
  gap: 0.12rem;
  margin: 0.4rem 0 0;
  padding: 0;
  list-style: none;
  color: var(--muted);
  font-size: 0.75rem;
}
.author-card-copy li {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.author-card-copy li::before {
  content: '› ';
  color: var(--accent);
}
.author-view-all {
  margin: 0.45rem 0 0;
  padding: 0;
  background: transparent;
  color: var(--accent);
  font-size: 0.78rem;
  text-align: left;
}
.author-actions {
  grid-column: 1/-1;
  display: flex;
  gap: 0.4rem;
}
.author-actions button {
  flex: 1;
  padding: 0.42rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel);
  color: var(--muted);
  font-size: 0.75rem;
}
.author-actions button.active {
  border-color: var(--accent);
  color: var(--accent);
}
.author-card.hidden {
  opacity: 0.72;
}
@media (max-width: 620px) {
  .author-section {
    padding: 0.75rem;
  }
  .author-card {
    grid-template-columns: 4.2rem minmax(0, 1fr);
    gap: 0.5rem;
    padding: 0.5rem;
  }
  .author-portrait {
    width: 4.2rem;
    height: 7.9rem;
  }
  .author-card-name strong {
    font-size: 0.92rem;
  }
  .author-card-copy p,
  .author-card-copy ul {
    font-size: 0.69rem;
  }
  .author-card-copy small,
  .author-view-all,
  .author-actions button {
    font-size: 0.67rem;
  }
}

/* One continuous, cover-only digital bookshelf. */
#player {
  cursor: pointer;
}
.shelves {
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  column-gap: 0.65rem;
  row-gap: 2.3rem;
  padding: 1rem 1rem 2rem;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent 183px,
    #6b4025 183px,
    #9a633a 193px,
    #422616 205px,
    #1a0d08 211px
  );
}
.bookshelf-book {
  position: relative;
  display: block;
  align-self: end;
  width: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 0.2rem;
  background: transparent;
  box-shadow: 5px 8px 10px #0008;
  transition: transform 0.15s;
}
/* Hover only where a pointer hovers: on a phone the hover state sticks after a tap
   and left one book lifted and tilted among its neighbours. */
@media (hover: hover) {
  .bookshelf-book:hover {
    transform: translateY(-7px) rotate(-1deg);
  }
}
.bookshelf-cover {
  display: block;
  width: 100%;
  height: 172px;
  object-fit: contain;
  background: #14231d;
  border-radius: 0.2rem;
}
.bookshelf-book .placeholder-cover {
  padding: 0.35rem;
  font-size: 0.78rem;
}
.bookshelf-read {
  position: absolute;
  right: 0.25rem;
  bottom: 0.25rem;
  display: none;
  width: 1.35rem;
  height: 1.35rem;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 900;
}
.bookshelf-read.finished {
  display: grid;
}
@media (max-width: 650px) {
  .shelves {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1.65rem 0.35rem;
    padding: 0.6rem 0.4rem 1.5rem;
    background-size: auto 151px;
  }
  .bookshelf-cover {
    height: 140px;
  }
}

/* Keep the growing top navigation compact instead of wrapping into a tall box. */
#app > nav {
  display: flex;
  flex-wrap: nowrap;
  justify-content: flex-start;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
#app > nav::-webkit-scrollbar {
  display: none;
}
#app > nav button {
  flex: 0 0 auto;
  min-width: 0;
  padding-inline: clamp(0.58rem, 2.3vw, 0.85rem);
  white-space: nowrap;
}
#app > nav [data-view='series'] {
  padding-inline: 0.55rem;
}
@media (max-width: 650px) {
  #app > nav {
    border-radius: 0.9rem;
  }
  #app > nav button {
    padding: 0.72rem 0.62rem;
    font-size: 0.78rem;
  }
}

/* Every primary destination remains visible; view choices always carry text. */
#app > nav {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  gap: 0;
  overflow: visible;
}
#app > nav button {
  width: 100%;
  padding: 0.72rem 0.2rem;
  white-space: normal;
  font-size: clamp(0.63rem, 2.4vw, 0.82rem);
  line-height: 1.15;
}
.view-switcher span {
  display: inline !important;
}
.view-switcher button {
  min-width: 0;
  padding-inline: 0.35rem;
  font-size: 0.72rem;
}
@media (max-width: 390px) {
  #app > nav button {
    font-size: 0.61rem;
    padding-inline: 0.1rem;
  }
  .view-switcher {
    gap: 0.1rem;
  }
  .view-switcher button {
    gap: 0.2rem;
    font-size: 0.66rem;
  }
}

/* Car Mode: the primary action is unmistakable and every secondary control sits below it. */
.car-transport {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 5.25rem));
  grid-template-areas: 'play play play play' 'previous back forward next';
  justify-content: center;
  gap: 1.35rem clamp(0.45rem, 4vw, 1.25rem);
  width: min(34rem, 100%);
  margin: 1rem auto;
}
.car-transport #car-play {
  grid-area: play;
  width: 11rem !important;
  height: 11rem !important;
  justify-self: center;
  font-size: 4.75rem !important;
}
.car-transport #car-previous-part {
  grid-area: previous;
}
.car-transport #car-back {
  grid-area: back;
}
.car-transport #car-forward {
  grid-area: forward;
}
.car-transport #car-next-part {
  grid-area: next;
}
.car-transport > button:not(#car-play) {
  width: 5.25rem;
  height: 5.25rem;
  justify-self: center;
}
@media (max-width: 430px) {
  .car-transport {
    grid-template-columns: repeat(4, minmax(0, 4.5rem));
    gap: 1.1rem clamp(0.25rem, 2.8vw, 0.75rem);
  }
  .car-transport #car-play {
    width: 10rem !important;
    height: 10rem !important;
    font-size: 4.25rem !important;
  }
  .car-transport > button:not(#car-play) {
    width: 4.5rem;
    height: 4.5rem;
  }
}
@media (max-width: 360px) {
  .car-transport {
    grid-template-columns: repeat(4, minmax(0, 4rem));
    gap: 0.9rem 0.25rem;
  }
  .car-transport #car-play {
    width: 9rem !important;
    height: 9rem !important;
  }
  .car-transport > button:not(#car-play) {
    width: 4rem;
    height: 4rem;
  }
}

/* Balance the larger Car Mode controls with artwork that fills the upper screen. */
#car-player > img {
  width: min(70vw, 21rem);
  height: min(43dvh, 21rem);
  max-width: 100%;
  object-fit: contain;
}
@media (max-height: 760px) {
  #car-player > img {
    width: min(62vw, 17rem);
    height: min(34dvh, 17rem);
  }
  #car-player {
    gap: 0.55rem;
  }
  .car-transport {
    margin: 0.65rem auto;
  }
}

/* Eight primary destinations stay visible as a fixed two-row navigation. */
#app > nav {
  grid-auto-flow: row;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-template-rows: repeat(2, auto);
}
.author-row {
  cursor: pointer;
}
.author-open {
  display: grid;
  gap: 0.15rem;
  padding: 0;
  background: transparent;
  color: inherit;
  text-align: left;
}
.author-hero {
  display: grid;
  grid-template-columns: 7rem minmax(0, 1fr);
  gap: 1rem;
  align-items: center;
}
.author-hero img {
  width: 7rem;
  height: 9rem;
  object-fit: cover;
  border-radius: 0.8rem;
}
.author-bio {
  white-space: pre-line;
  line-height: 1.55;
}
.author-works {
  display: grid;
  gap: 0.55rem;
  max-height: 55vh;
  overflow: auto;
}
.author-works article,
.future-card {
  display: grid;
  grid-template-columns: 3.5rem minmax(0, 1fr) auto;
  gap: 0.7rem;
  align-items: center;
  padding: 0.6rem;
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  background: var(--panel-2);
}
.author-works img,
.future-card img {
  width: 3.5rem;
  height: 5rem;
  object-fit: contain;
}
.author-works strong,
.author-works small,
.future-card strong,
.future-card small {
  display: block;
}
.author-works small,
.future-card small {
  margin-top: 0.2rem;
  color: var(--muted);
}
#author-dialog {
  width: min(42rem, calc(100% - 1rem));
}
.future-search {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.55rem;
  margin: 1rem 0;
}
.future-grid {
  display: grid;
  gap: 0.6rem;
  margin: 1rem 0 1.5rem;
}
.future-acquired {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: center;
  margin: 1rem 0;
  padding: 1rem;
  border: 1px solid var(--accent);
  border-radius: 0.8rem;
  background: var(--panel);
}
.future-acquired strong {
  flex: 1 1 100%;
}
@media (max-width: 430px) {
  .author-hero {
    grid-template-columns: 5rem minmax(0, 1fr);
  }
  .author-hero img {
    width: 5rem;
    height: 7rem;
  }
  .future-card,
  .author-works article {
    grid-template-columns: 3rem minmax(0, 1fr);
  }
  .future-card > button,
  .author-works article > button,
  .author-works .status-pill {
    grid-column: 1/-1;
  }
  .future-search {
    grid-template-columns: 1fr;
  }
}
.author-bibliography-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.6rem;
  margin-top: 1rem;
}
.author-bibliography-heading h3 {
  margin: 0;
}
.author-bibliography-heading select {
  width: auto;
  min-width: 8.5rem;
}
.author-work-card > span {
  min-width: 0;
}
.author-work-card em {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-top: 0.4rem;
  font-style: normal;
}
.author-work-card em b {
  padding: 0.18rem 0.38rem;
  border-radius: 999px;
  background: var(--panel);
  color: var(--muted);
  font-size: 0.64rem;
  font-weight: 600;
}
.author-work-card > button {
  text-transform: capitalize;
}
@media (max-width: 430px) {
  .author-bibliography-heading {
    align-items: stretch;
    flex-direction: column;
  }
  .author-bibliography-heading select {
    width: 100%;
  }
}
.author-work-cover-placeholder {
  display: grid;
  place-items: center;
  width: 3.5rem;
  height: 5rem;
  border-radius: 0.35rem;
  background: linear-gradient(
    145deg,
    var(--panel),
    color-mix(in srgb, var(--accent) 28%, var(--panel-2))
  );
  color: var(--muted);
  font-size: 1.35rem;
}
.author-works .author-library-state {
  margin-top: 0.45rem;
  color: var(--warning);
  font-weight: 700;
}
@media (max-width: 430px) {
  .author-work-cover-placeholder {
    width: 3rem;
    height: 4.4rem;
  }
}
.author-work-card {
  cursor: pointer;
}
.author-work-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.author-detail-back {
  margin-bottom: 1rem;
}
.catalog-book-detail {
  display: grid;
  grid-template-columns: minmax(7rem, 10rem) minmax(0, 1fr);
  gap: 1.25rem;
  align-items: start;
}
.catalog-book-detail > img,
.catalog-cover-placeholder {
  width: 100%;
  aspect-ratio: 2/3;
  object-fit: contain;
  border-radius: 0.75rem;
  background: var(--panel-2);
}
.catalog-cover-placeholder {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 2rem;
}
.catalog-book-detail h2 {
  margin: 0.2rem 0;
}
.catalog-subjects {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 1rem 0;
}
.catalog-subjects span {
  padding: 0.25rem 0.5rem;
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--muted);
  font-size: 0.72rem;
}
@media (max-width: 430px) {
  .catalog-book-detail {
    grid-template-columns: 5.5rem minmax(0, 1fr);
    gap: 0.8rem;
  }
  .catalog-book-detail h2 {
    font-size: 1.25rem;
  }
}
.covers,
.covers .group-books {
  grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
}
.covers .card {
  position: relative;
  display: grid;
  grid-template-columns: 5.4rem minmax(0, 1fr);
  min-height: 8.4rem;
}
.covers .cover {
  grid-row: 1;
  width: 5.4rem;
  height: 8.4rem;
  aspect-ratio: auto;
  padding: 0.4rem;
  font-size: 0.72rem;
  object-fit: contain;
}
.covers .meta {
  min-width: 0;
  padding: 0.75rem;
}
.covers .meta strong {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}
.covers .meta p {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.78rem;
}
.covers .card-play {
  right: 0.45rem;
  bottom: 0.45rem;
  top: auto;
}
.covers .card-read {
  min-height: 1.8rem;
  margin-top: 0.3rem;
  padding: 0.3rem 0.5rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--button);
  color: var(--text);
  font-size: 0.68rem;
  font-weight: 700;
}
.covers .card-read.selected {
  border-color: var(--accent);
  color: var(--accent);
  opacity: 1;
}
.covers .progress {
  margin-right: 2.6rem;
}
@media (max-width: 650px) {
  .covers,
  .covers .group-books {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.55rem;
  }
  .covers .card {
    grid-template-columns: 4rem minmax(0, 1fr);
    min-height: 7rem;
  }
  .covers .cover {
    width: 4rem;
    height: 7rem;
  }
  .covers .meta {
    padding: 0.5rem;
  }
  .covers .meta strong {
    font-size: 0.78rem;
  }
  .covers .meta p {
    font-size: 0.66rem;
  }
  .covers .card-read {
    max-width: 100%;
    padding: 0.25rem 0.4rem;
    font-size: 0.62rem;
  }
  .covers .card-play {
    width: 2rem;
    height: 2rem;
  }
  .covers .progress {
    margin-right: 1.9rem;
  }
}
.authors {
  display: grid;
  gap: 0.4rem;
}
.authors .book-group .group-books {
  display: grid;
  gap: 0.4rem;
}
.library-options .view-switcher {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  width: auto;
}
.library-options .view-switcher button {
  min-width: 0;
  justify-content: center;
  padding: 0.55rem 0.3rem;
  font-size: 0.76rem;
}
.library-options .view-switcher button span {
  display: inline;
}
.library-options #library-sort-direction {
  border-left: 1px solid var(--border);
}
.library-options #library-sort-direction b {
  font-size: 0.72rem;
}
@media (max-width: 650px) {
  .library-options .view-switcher {
    margin: 0.55rem;
  }
  .library-options .view-switcher button {
    gap: 0.18rem;
    padding: 0.52rem 0.15rem;
    font-size: 0.66rem;
  }
  .library-options #library-sort-direction b {
    font-size: 0.66rem;
  }
}
.secondary-filters {
  margin: 0.5rem 0.7rem 0;
  border: 1px solid var(--border);
  border-radius: 0.7rem;
  background: color-mix(in srgb, var(--panel-2) 84%, transparent);
}
.secondary-filters > summary {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.55rem;
  align-items: center;
  padding: 0.55rem 0.7rem;
  list-style: none;
}
.secondary-filters > summary::-webkit-details-marker {
  display: none;
}
.secondary-filters > summary small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
}
.secondary-filters > div {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
  padding: 0 0.6rem 0.6rem;
}
.secondary-filters select {
  min-width: 0;
}
.placeholder-cover {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background: linear-gradient(145deg, color-mix(in srgb, var(--accent) 42%, #263d34), #101d18 72%);
}
.placeholder-cover::before {
  content: '';
  position: absolute;
  z-index: -1;
  inset: 0 auto 0 0;
  width: 0.42rem;
  background: color-mix(in srgb, var(--accent) 58%, #101d18);
  box-shadow: 0.18rem 0 0.35rem #0005;
}
.placeholder-cover::after {
  content: '';
  position: absolute;
  z-index: -1;
  left: 14%;
  right: 10%;
  top: 15%;
  height: 1px;
  background: color-mix(in srgb, var(--accent) 65%, transparent);
  box-shadow: 0 4.4rem 0 color-mix(in srgb, var(--accent) 30%, transparent);
}
.placeholder-cover span {
  font-family: Georgia, serif;
  font-weight: 700;
  line-height: 1.08;
}
.placeholder-cover small {
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
@media (max-width: 650px) {
  .covers {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
  .covers .card {
    width: 100%;
    min-width: 0;
  }
  .secondary-filters > div {
    grid-template-columns: 1fr;
  }
  .secondary-filters > summary small {
    font-size: 0.68rem;
  }
}
.library-controls {
  grid-template-columns: 1fr;
}
.library-controls > .view-switcher {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  width: 100%;
  margin: 0;
}
.library-controls > .view-switcher button {
  min-width: 0;
  justify-content: center;
  padding: 0.55rem 0.3rem;
  font-size: 0.76rem;
}
.library-controls > .view-switcher button span {
  display: inline;
}
.library-controls > .view-switcher #library-sort-direction {
  border-left: 1px solid var(--border);
}
.library-options > summary {
  padding: 0.48rem 0.7rem;
}
.library-options > summary strong {
  font-size: 0.9rem;
}
.library-options > summary em {
  margin-top: 0.08rem;
}
.library-options .toolbar {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 0.55rem 0.6rem 0;
}
.covers {
  display: grid;
}
@media (max-width: 650px) {
  .library-controls > .view-switcher button {
    gap: 0.16rem;
    padding: 0.48rem 0.12rem;
    font-size: 0.64rem;
  }
  .library-controls > .view-switcher #library-sort-direction b {
    font-size: 0.64rem;
  }
  .covers {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}
.diagnostic-actions {
  display: flex;
  gap: 0.55rem;
  flex-wrap: wrap;
}
.diagnostic-events {
  display: grid;
  gap: 0.45rem;
  max-height: 28rem;
  overflow: auto;
  margin-top: 0.75rem;
}
.diagnostic-event {
  display: grid;
  grid-template-columns: minmax(8rem, 1fr) auto;
  gap: 0.25rem 0.7rem;
  padding: 0.6rem;
  border: 1px solid var(--border);
  border-radius: 0.65rem;
  background: var(--panel-2);
}
.diagnostic-event strong,
.diagnostic-event small {
  overflow-wrap: anywhere;
}
.diagnostic-event small {
  color: var(--muted);
}
.diagnostic-event time {
  font-size: 0.7rem;
  color: var(--muted);
  white-space: nowrap;
}
.diagnostic-event code {
  grid-column: 1/-1;
  white-space: pre-wrap;
  font-size: 0.68rem;
  color: var(--muted);
}
.car-position {
  padding: 0.25rem 1rem;
  color: #d7e2ea;
  font-size: clamp(1.1rem, 5vw, 1.5rem);
  font-variant-numeric: tabular-nums;
}
.car-position b {
  font-weight: 800;
}
#car-part:empty {
  display: none;
}

/* Metadata and Dropbox scan pop-ups */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.scan-choices {
  display: grid;
  gap: 0.55rem;
  margin: 1rem 0 0;
  padding: 0;
  border: 0;
}
.scan-choice {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.75rem;
  align-items: start;
  padding: 0.8rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 0.8rem;
  background: var(--panel-2);
  cursor: pointer;
}
.scan-choice:has(input:checked) {
  border-color: var(--accent);
}
.scan-choice input {
  margin-top: 0.2rem;
  accent-color: var(--accent);
}
.scan-choice span,
.folder-name {
  display: grid;
  gap: 0.15rem;
  min-width: 0;
}
.scan-choice small,
.folder-name small,
.scan-summary {
  color: var(--muted);
}
.folder-picker {
  display: grid;
  gap: 0.6rem;
  margin-top: 0.9rem;
}
.folder-picker input[type='search'] {
  width: 100%;
}
.folder-tree {
  max-height: min(45vh, 26rem);
  overflow: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--border);
  border-radius: 0.8rem;
  padding: 0.35rem;
}
.folder-node > summary,
.folder-leaf {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 0.6rem;
  align-items: center;
  padding: 0.45rem 0.4rem;
  border-radius: 0.5rem;
  cursor: pointer;
  list-style: none;
}
.folder-node > summary::-webkit-details-marker {
  display: none;
}
.folder-leaf {
  grid-template-columns: auto minmax(0, 1fr);
}
.folder-node input[type='checkbox'] {
  width: 1.15rem;
  height: 1.15rem;
  accent-color: var(--accent);
}
.folder-name strong {
  overflow-wrap: anywhere;
  font-weight: 600;
}
.folder-node > summary .disclosure {
  transition: transform 0.15s;
}
.folder-node[open] > summary .disclosure {
  transform: rotate(180deg);
}
.folder-children {
  margin-left: 0.85rem;
  padding-left: 0.6rem;
  border-left: 1px solid var(--border);
}
.scan-summary {
  margin: 0.8rem 0 0;
  min-height: 1.2em;
}
/* The scan pop-ups never scroll as a whole: only the folder list does, so the
   sticky close button cannot drift over the choices and Start stays on screen.
   (Found in a 390px Chromium pass: with the page scrolling, × covered the
   "Selected folders" text and Start sat below the fold.) */
.scan-dialog[open] {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.scan-dialog > .close {
  position: absolute;
  top: 0.6rem;
  right: 0.8rem;
}
.scan-dialog h2 {
  padding-right: 2.5rem;
}
/* flex: 1 1 auto, never flex: 1. The pop-up has only a max-height, so its
   height is indefinite; iOS Safari resolves flex: 1's 0% basis against that
   as zero and collapsed both pop-ups to their header (seen on production
   v1.6.0, 2026-11-13). Chromium sizes the same rule to content, which is why
   the Chromium check passed. Auto basis starts from content height and only
   shrinks the folder list when the pop-up would outgrow the screen. */
.scan-dialog form {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}
.scan-dialog .folder-picker:not([hidden]) {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}
.scan-dialog .folder-tree {
  flex: 1 1 auto;
  min-height: 9rem;
  max-height: none;
}
.scan-dialog:has(input[value='folders']:checked) .scan-choice small {
  display: none;
}
.scan-dialog:has(input[value='folders']:checked) .scan-choice {
  padding: 0.55rem 0.9rem;
}

/* Metadata lock checkbox and locked editors */
.metadata-lock {
  margin: 0.8rem 0;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 0.8rem;
  background: var(--panel-2);
}
.metadata-lock:has(input:checked) {
  border-color: var(--accent);
}
.metadata-lock > summary {
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.6rem;
  align-items: center;
  cursor: pointer;
  list-style: none;
}
.metadata-lock > summary::-webkit-details-marker {
  display: none;
}
.metadata-lock[open] > summary {
  margin-bottom: 0.7rem;
}
.metadata-lock > summary .disclosure {
  transition: transform 0.15s;
}
.metadata-lock[open] > summary .disclosure {
  transform: rotate(180deg);
}
.metadata-lock .lock-summary {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
}
.metadata-lock .lock-summary strong,
.metadata-lock .lock-summary small {
  /* The app styles summary text as stacked blocks; this line must not wrap. */
  display: inline;
}
.metadata-lock .lock-summary small {
  overflow: hidden;
  text-overflow: ellipsis;
}
.metadata-lock:not([open]) {
  padding: 0.5rem 0.9rem;
}
.lock-summary small {
  color: var(--muted);
}
.metadata-lock label {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.7rem;
  align-items: start;
  cursor: pointer;
}
.metadata-lock input {
  width: 1.2rem;
  height: 1.2rem;
  margin-top: 0.15rem;
  accent-color: var(--accent);
}
.metadata-lock label > span {
  display: grid;
  gap: 0.2rem;
  min-width: 0;
}
.metadata-lock small,
.lock-notice {
  color: var(--muted);
}
.lock-notice {
  margin: 0 0 0.6rem;
  font-weight: 600;
}
.metadata-locked {
  opacity: 0.75;
}
.metadata-lock[open] .lock-summary small {
  display: none;
}

/* Future Reads: heading row, controls, and the details pop-up */
.future-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  margin-top: 1.2rem;
}
.future-heading h3 {
  margin: 0;
}
.future-heading h3 small {
  color: var(--muted);
  font-weight: 500;
}
.future-controls {
  margin: 0.4rem 0 0.8rem;
}
.future-detail-head {
  display: grid;
  grid-template-columns: 7rem minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}
.future-detail-head h2 {
  margin: 0.1rem 0 0.3rem;
  padding-right: 2.5rem;
}
.future-detail-head p {
  margin: 0.15rem 0;
}
.future-detail-cover {
  width: 7rem;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 0.6rem;
}
.future-detail-cover.placeholder-cover {
  display: grid;
  place-content: center;
  padding: 0.5rem;
  text-align: center;
  font-size: 0.8rem;
}
.future-detail-description {
  margin: 1rem 0 0.6rem;
  line-height: 1.5;
}
/* Future Read icons have no Read button, progress bar or play button, so
   they must not keep the space the library card reserves for them (the
   10.5rem text column left half of each card empty). */
.covers .card.future-book {
  height: auto;
  min-height: 0;
  grid-template-rows: auto;
  align-self: start;
}
.covers .card.future-book .meta {
  min-height: 0;
}

/* "Also replace cover" on the manual match pop-up */
.match-replace-cover {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.7rem;
  align-items: start;
  margin: 0.6rem 0 0.9rem;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 0.8rem;
  background: var(--panel-2);
  cursor: pointer;
}
.match-replace-cover[hidden] {
  display: none;
}
.match-replace-cover input {
  width: 1.2rem;
  height: 1.2rem;
  margin-top: 0.15rem;
  accent-color: var(--accent);
}
.match-replace-cover span {
  display: grid;
  gap: 0.15rem;
}
.match-replace-cover small {
  color: var(--muted);
}

/* Dropbox folder lines, the match pop-up's book panel, review book links */
.book-path {
  margin: 0.5rem 0;
  color: var(--muted);
  font-size: 0.85rem;
  overflow-wrap: anywhere;
  user-select: text;
  -webkit-user-select: text;
}
.book-path small {
  display: block;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.saved-book-path {
  display: block;
  overflow-wrap: anywhere;
  opacity: 0.8;
}
.review-book-link {
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 0.2em;
  cursor: pointer;
}
.match-book-panel {
  margin: 0.6rem 0;
  padding: 0.6rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 0.8rem;
  background: var(--panel-2);
}
.match-book-panel > summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.6rem;
  align-items: center;
  cursor: pointer;
  list-style: none;
}
.match-book-panel > summary::-webkit-details-marker {
  display: none;
}
.match-book-panel > summary span:first-child {
  display: grid;
  gap: 0.1rem;
  min-width: 0;
}
.match-book-panel > summary small,
.match-book-panel dt {
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.match-book-panel dl {
  display: grid;
  gap: 0.5rem;
  margin: 0.7rem 0 0.2rem;
}
.match-book-panel dd {
  margin: 0;
  overflow-wrap: anywhere;
}

/* Cover size for the library's Bookshelf and Icons layouts (Small / Medium / Large).
   Everything here needs the [data-size] the library sets, so Future Reads, which
   reuses the .shelves and .covers classes, is left exactly as it was.
   Bookshelf: one cover height (--h) and one row gap (--gap) per size drive the
   cover, the grid and the shelf boards drawn behind it, so the boards cannot drift
   from the books (the old fixed 183px boards only fitted the old fixed 172px cover).
   The boards sit at the same fractions of the gap as the original 11/21/33/39px. */
.shelves[data-size] {
  --h: 172px;
  --w: 129px;
  --gap: 32px;
  grid-template-columns: repeat(auto-fill, var(--w));
  justify-content: center;
  column-gap: 0.65rem;
  row-gap: var(--gap);
  padding: 1rem 1rem 2rem;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent calc(var(--h) + var(--gap) * 0.282),
    #6b4025 calc(var(--h) + var(--gap) * 0.282),
    #9a633a calc(var(--h) + var(--gap) * 0.538),
    #422616 calc(var(--h) + var(--gap) * 0.846),
    #1a0d08 calc(var(--h) + var(--gap))
  );
  background-size: auto;
}
.shelves[data-size='medium'] {
  --h: 240px;
  --w: 180px;
  --gap: 40px;
}
.shelves[data-size='large'] {
  --h: 330px;
  --w: 248px;
  --gap: 48px;
}
.shelves[data-size] .bookshelf-cover {
  height: var(--h);
}
.shelves[data-size='medium'] .bookshelf-book .placeholder-cover {
  font-size: 1rem;
}
.shelves[data-size='large'] .bookshelf-book .placeholder-cover {
  padding: 0.7rem;
  font-size: 1.3rem;
}
@media (max-width: 650px) {
  .shelves[data-size] {
    --h: 106px;
    --w: 80px;
    --gap: 24px;
    grid-template-columns: repeat(auto-fill, var(--w));
    column-gap: 0.35rem;
    padding: 1rem 0.4rem 1.5rem;
  }
  .shelves[data-size='medium'] {
    --h: 149px;
    --w: 112px;
    --gap: 30px;
  }
  .shelves[data-size='large'] {
    --h: 227px;
    --w: 170px;
    --gap: 36px;
  }
}

/* Icons: the cover and the card grow together. On a phone, Small keeps the two
   narrow columns and the larger sizes use one full-width column. */
.covers[data-size] {
  --card-min: 16rem;
  --cw: 5.4rem;
  --ch: 8.4rem;
  grid-template-columns: repeat(auto-fill, minmax(var(--card-min), 1fr));
}
.covers[data-size='medium'] {
  --card-min: 18rem;
  --cw: 7.4rem;
  --ch: 11.4rem;
}
.covers[data-size='large'] {
  --card-min: 22rem;
  --cw: 9.8rem;
  --ch: 15rem;
}
.covers[data-size] .card {
  grid-template-columns: var(--cw) minmax(0, 1fr);
  min-height: var(--ch);
}
.covers[data-size] .cover {
  width: var(--cw);
  height: var(--ch);
}
.covers[data-size='medium'] .meta strong {
  font-size: 1.05rem;
}
.covers[data-size='large'] .meta strong {
  font-size: 1.2rem;
}
.covers[data-size='medium'] .placeholder-cover,
.covers[data-size='large'] .placeholder-cover {
  font-size: 0.95rem;
}
@media (max-width: 650px) {
  .covers[data-size] {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    --cw: 4rem;
    --ch: 7rem;
  }
  .covers[data-size='medium'],
  .covers[data-size='large'] {
    grid-template-columns: minmax(0, 1fr) !important;
  }
  .covers[data-size='medium'] {
    --cw: 5.4rem;
    --ch: 8.4rem;
  }
  .covers[data-size='large'] {
    --cw: 8rem;
    --ch: 12.4rem;
  }
  .covers[data-size] .meta strong {
    font-size: 0.78rem;
  }
  .covers[data-size='medium'] .meta strong,
  .covers[data-size='large'] .meta strong {
    font-size: 1rem;
  }
}

/* A cover with no image: the title and author were inline, so the author ran on
   straight after the title ("…SpineAUTHOR NAME"). Stack them. */
.placeholder-cover {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 0.45em;
}
.bookshelf-book .placeholder-cover span {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 6;
  line-clamp: 6;
}
.bookshelf-book .placeholder-cover small {
  font-size: 0.72em;
}

/* The Small / Medium / Large tool under the layout buttons: a collapsed panel like
   Filters, so it does not take a row of its own until opened. */
.size-options[hidden] {
  display: none;
}
.size-buttons {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 0.6rem 0.65rem;
}
.size-buttons button {
  min-width: 4.4rem;
  min-height: 2.2rem;
  padding: 0.3rem 0.8rem;
  border: 1px solid var(--line, #2c4b40);
  border-radius: 999px;
  background: var(--button, transparent);
  color: var(--text, inherit);
  font-size: 0.85rem;
  font-weight: 700;
}
.size-buttons button.active,
.size-buttons button[aria-pressed='true'] {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-ink, #10221b);
}

/* Icons that line up. Cards in a row used to take their own heights, the read
   label sat in a different place on every card and ran under the play button, and
   each cover floated wherever its own shape put it. Now every card in a row is the
   same height, every cover fills a column of the same size, and the bottom corner
   of each card is reserved: the read label sits just above it, the progress bar
   beside the play button inside it. Only the library's sized layout is touched. */
.covers[data-size],
.covers[data-size] .group-books {
  align-items: stretch;
}
.covers[data-size] .card {
  align-self: stretch;
  height: auto;
}
.covers[data-size] .cover {
  align-self: stretch;
  height: auto;
  min-height: var(--ch);
  object-fit: contain;
  object-position: center;
  background: #14231d;
}
.covers[data-size] .meta {
  --pad: 0.75rem;
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: var(--pad);
  padding-bottom: 3.2rem;
}
.covers[data-size] .meta .card-read {
  align-self: flex-start;
  margin-top: auto;
  white-space: nowrap;
  text-align: left;
}
.covers[data-size] .meta .progress {
  position: absolute;
  left: var(--pad);
  right: 3.6rem;
  bottom: 1.35rem;
  margin: 0;
}
@media (max-width: 650px) {
  .covers[data-size] .meta {
    --pad: 0.5rem;
    padding-bottom: 3rem;
  }
  .covers[data-size] .meta .progress {
    right: 3rem;
    bottom: 1.2rem;
  }
}
.size-options .size-buttons {
  padding-top: 0;
}

/* Bookshelf covers that fit their slot and stand on the shelf. The slot (a column
   wide, --h tall) used to be a dark box with the cover centred inside it, so a
   square cover floated in the middle with bars above and below, and the shadow was
   drawn round the whole box, not round the cover. Now the cover is scaled as large
   as the slot allows without distorting it (a tall cover fills the height, a square
   one the width), sits at the bottom so it stands on the shelf, and casts its own
   shadow. A cover with no image keeps the full slot. */
/* Every cover sits in the same tile (owner 2026-11-15: oversized and undersized covers made the shelf
   ragged), and no cover is cut off (owner, same day, after the first version cropped a wide cover:
   "this cover didn't shrink to fit"). Each tile is one --w by --h box, 3:4. The picture is scaled to
   fit INSIDE it (object-fit: contain), so a square audiobook cover is the tile's full width and shorter
   than a tall one, and none loses any of its picture. The picture stands on the bottom of the tile, i.e.
   on the shelf, and its shadow is drop-shadow(), which follows the picture's own edge; a box-shadow
   would draw the shadow round the whole tile, empty space included. The first version used
   object-fit: cover and cropped "BRIAN FREEMAN" and "ALTER EGO" at the sides of a square cover. */
.shelves[data-size] .bookshelf-book {
  display: block;
  width: var(--w);
  height: var(--h);
  background: transparent;
  box-shadow: none;
}
.shelves[data-size] img.bookshelf-cover {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center bottom;
  background: transparent;
  border-radius: 0;
  box-shadow: none;
  filter: drop-shadow(5px 8px 6px #0008);
}
.shelves[data-size] .placeholder-cover.bookshelf-cover {
  width: 100%;
  height: 100%;
  box-shadow: 5px 8px 10px #0008;
}

/* Reviewing a public author record before it is matched, and the biography's line breaks
   (the biography is cleaned into paragraphs by the server). */
.author-bio {
  white-space: pre-line;
}
#author-review-dialog {
  width: min(36rem, calc(100% - 1rem));
}
.author-review-library,
.author-review-record {
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--line, #2c4b40);
  border-radius: 0.9rem;
  background: #14231d;
}
.author-review-library small,
.author-review-record small {
  color: var(--muted, #b7c4bd);
  font-size: 0.74rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.author-review-library h3,
.author-review-record h3 {
  margin: 0.15rem 0;
}
.author-review-library p,
.author-review-record p {
  margin: 0.2rem 0;
}
.author-review-arrow {
  margin: 0.45rem 0;
  text-align: center;
  color: var(--muted, #b7c4bd);
  font-size: 0.8rem;
}
.author-review-record {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.8rem;
  align-items: start;
}
.author-review-record img {
  width: 5rem;
  height: 6.5rem;
  border-radius: 0.5rem;
  object-fit: cover;
}
.author-review-links,
.author-source-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}
.author-review-links a,
.author-source-links a {
  color: var(--accent);
  font-weight: 700;
}
.author-review-warning {
  padding: 0.7rem 0.85rem;
  border: 1px solid #b9792f;
  border-radius: 0.9rem;
  background: #3a2a14;
}
.author-review-actions {
  display: grid;
  gap: 0.5rem;
  margin-top: 0.8rem;
}

/* Pen names: the redirect note at the top of a profile, the list of pen names, the label on the
   Authors list, and the admin controls. */
.author-redirect {
  margin: 0 0 0.7rem;
  padding: 0.55rem 3.6rem 0.55rem 0.8rem;
  border: 1px solid var(--line, #2c4b40);
  border-radius: 0.8rem;
  background: #14231d;
  color: var(--muted, #b7c4bd);
  font-size: 0.9rem;
}
.author-aliases {
  margin: 0.4rem 0;
}
.author-alias-label {
  display: block;
  color: var(--accent);
  font-weight: 700;
}
.author-pen-names,
.author-merge,
.author-rename {
  margin: 0.6rem 0;
  padding: 0.5rem 0.8rem;
  border: 1px solid var(--line, #2c4b40);
  border-radius: 0.8rem;
}
.author-pen-names summary,
.author-merge summary,
.author-rename summary {
  cursor: pointer;
  font-weight: 700;
}
.author-pen-names form,
.author-merge form,
.author-rename form {
  display: grid;
  gap: 0.5rem;
  margin: 0.5rem 0;
}

/* The same author's other books, inside "Book being matched". */
.match-author-books {
  margin-top: 0.6rem;
}
.match-author-books summary {
  cursor: pointer;
  font-weight: 600;
}
.match-author-books ul {
  margin: 0.4rem 0 0;
  padding-left: 1.2rem;
}
.match-author-books li small {
  opacity: 0.75;
  margin-left: 0.35rem;
}

/* Possible pen names (Admin → Authors). */
.pen-names-list {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.75rem;
  margin-top: 0.75rem;
}
.pen-name-card {
  border: 1px solid var(--line, rgba(255, 255, 255, 0.14));
  border-radius: 1rem;
  padding: 0.85rem 1rem;
}
.pen-name-card p {
  margin: 0 0 0.6rem;
}
.pen-name-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.5rem;
}

/* The match dialog is one box: the guess at title, series and author, read back under it. */
.match-query {
  display: grid;
  gap: 0.35rem;
}
.match-query input {
  width: 100%;
}
.match-read {
  margin: 0.4rem 0 0.2rem;
  font-size: 0.9rem;
}
.match-more {
  margin: 0.5rem 0;
}
.match-more summary {
  cursor: pointer;
  font-weight: 700;
}
.match-best {
  border: 2px solid var(--accent, #e8b85a);
}
.match-best-label {
  display: block;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent, #e8b85a);
}
.match-others {
  margin: 1rem 0 0.4rem;
  font-size: 1rem;
}

/* Covers in a row that scrolls sideways (library and Future reads "slideshow", home page rows). */
.cover-scroller {
  display: flex;
  gap: 0.9rem;
  overflow-x: auto;
  padding: 0.4rem 0.2rem 1rem;
  scroll-snap-type: x proximity;
  scroll-padding-inline: 0.2rem;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  outline: none;
}
.scroller-book {
  flex: 0 0 auto;
  width: min(9.5rem, 38vw);
  padding: 0;
  display: grid;
  gap: 0.25rem;
  align-content: start;
  text-align: left;
  background: none;
  border: 0;
  color: inherit;
  scroll-snap-align: start;
}
.scroller-cover {
  width: 100%;
  aspect-ratio: 3/4; /* the bookshelf's tile shape, so covers match across layouts */
  object-fit: cover;
  border-radius: 0.5rem;
  box-shadow: 0 0.6rem 1rem #0008;
}
.scroller-title {
  font-weight: 700;
  font-size: 0.9rem;
  line-height: 1.2;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.scroller-book small {
  color: var(--muted);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.subtabs {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 0.9rem;
}
.subtabs button {
  flex: 1;
  background: #14251d;
  border: 1px solid #2f4d40;
  color: inherit;
}
.subtabs button.active {
  background: #2e5a47;
}
.sort-pick {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: var(--muted);
}
.sort-pick select {
  width: auto;
}

.sync-difference-card {
  padding: 0.8rem;
  margin: 0.8rem 0;
  border: 1px solid #2f4d40;
  border-radius: 0.9rem;
  background: #101e18;
}
.sync-difference-card h3 {
  margin: 0 0 0.5rem;
}
.sync-difference-card table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 0.85rem;
}
.sync-difference-card th,
.sync-difference-card td {
  padding: 0.3rem 0.4rem;
  text-align: left;
  vertical-align: top;
  overflow-wrap: anywhere;
  border-bottom: 1px solid #ffffff14;
}

/* Destructive confirmation: the button that deletes data is plainly red. */
.button.danger {
  background: #8f2f2f;
  color: #fff;
}
.button.danger:disabled {
  opacity: 0.45;
}
#remove-folder-summary ul {
  margin: 0.4rem 0 0.8rem;
  padding-left: 1.2rem;
}

/* The mini player's two window buttons, Windows style: a square (open the full player) and an X (close),
   joined as one pair in the top-right slot. An earlier close button floated over the player's corner and
   covered or crowded the open-full-player arrow; as part of the grid the pair cannot overlap anything. */
.player-window-controls {
  display: flex;
  align-self: start;
  justify-self: end;
  gap: 1px;
}
.player-window-controls button {
  display: grid;
  place-items: center;
  width: 2.7rem;
  height: 2.2rem;
  padding: 0;
  border: 1px solid #4b6e5c;
  border-radius: 0;
  background: #1b3027;
  color: inherit;
}
.player-window-controls button:first-child {
  border-radius: 0.5rem 0 0 0.5rem;
}
.player-window-controls button:last-child {
  border-radius: 0 0.5rem 0.5rem 0;
}
.player-window-controls button:hover {
  background: #2a4a3b;
}
.player-window-controls #close-mini-player:hover {
  background: #c42b1c;
  color: #fff;
}
.icon-square {
  display: block;
  width: 0.8rem;
  height: 0.8rem;
  border: 2px solid currentColor;
  box-sizing: border-box;
}
.icon-x {
  position: relative;
  display: block;
  width: 0.95rem;
  height: 0.95rem;
}
.icon-x::before,
.icon-x::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 100%;
  height: 2px;
  background: currentColor;
}
.icon-x::before {
  transform: translate(-50%, -50%) rotate(45deg);
}
.icon-x::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

.remove-folder-json {
  margin: 0.8rem 0;
  padding: 0.7rem 0.9rem;
  border: 1px solid #4b6e5c;
  border-radius: 0.8rem;
}
.remove-folder-json label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.4rem;
}

/* A long title is cut with an ellipsis before the window buttons, not run under them. The rules that cut it
   (overflow, ellipsis, nowrap on "#player > div strong") do nothing to an inline element, and strong is one,
   so the text used to spill past its box and sit under whatever was to its right. */
#player > div strong {
  display: block;
}

.diagnostic-event .diagnostic-summary {
  margin: 0.35rem 0 0;
  overflow-wrap: anywhere;
}

/* The seek bar's touch layer. A range input handles touch itself on iPhone Safari, whatever the page does,
   and writes the finger's own position into the slider while the page is trying to scrub slowly: one inch
   of finger moved a long book hours although the label said "3 sec/in" (owner, 2026-11-15). So the finger
   never meets the slider: this transparent layer takes every touch and pointer, and the page keeps its own
   value for the drag. The slider stays for the keyboard and screen readers. */
.seek-touch {
  position: absolute;
  inset: 0;
  z-index: 1;
  touch-action: none;
  background: transparent;
}
.precision-seek output {
  pointer-events: none;
}

/* The Admin alert buttons ("Sync differences", "Possible several books") sat directly against the
   card under them (owner 2026-11-15, screenshot). Each now stands on its own line with room above and below (the first version left room below only,
   and the button still touched the Settings card above it).
   :not([hidden]) because display would otherwise override the hidden attribute. */
.sync-differences-alert:not([hidden]) {
  display: block;
  margin: 1rem 0;
}

/* "Number the books 1, 2, 3…" under the Series box of the split dialog. :not([hidden]) so display does
   not override the hidden attribute used for the one-multipart-book choice. */
#file-split-dialog .split-number-row:not([hidden]) {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
#file-split-dialog .split-number-row input {
  width: auto;
  flex: none;
}

/* The Appearance card sat flush against the next card when no alert button stood between them (owner
   2026-11-15, screenshot). The margin collapses with an alert button's own 1rem, so the gap is 1rem
   either way. */
#personal-settings {
  margin-bottom: 1rem;
}

/* "Find a match" in a Future read's detail dialog: the search box and a column of results, each a small
   cover, the title and author, and a button. */
.future-find:not([hidden]) {
  display: grid;
  gap: 0.75rem;
  margin-top: 1rem;
}
.future-find form {
  display: grid;
  gap: 0.5rem;
}
.future-find-row {
  display: grid;
  grid-template-columns: 3rem minmax(0, 1fr) auto;
  gap: 0.7rem;
  align-items: center;
  padding: 0.5rem 0;
  border-top: 1px solid var(--border);
}
.future-find-row strong,
.future-find-row small {
  display: block;
  overflow-wrap: anywhere;
}
.future-find-cover {
  width: 3rem;
  height: 4rem;
  object-fit: cover;
  border-radius: 0.3rem;
  background: #1b3027;
}

/* Car Mode's second clock is left out when it would repeat the time left in the book (owner
   2026-11-16); display on .car-position would otherwise override the hidden attribute. */
.car-position[hidden] {
  display: none;
}
