:root {
  color-scheme: light dark;
  --bg: #f5f2eb;
  --bg-raised: #fbfaf6;
  --panel: #ffffff;
  --panel-2: #ece9e1;
  --text: #1d2426;
  --muted: #667074;
  --faint: #8d9698;
  --line: #dcd9d1;
  --line-strong: #c8c5bd;
  --accent: #d85d38;
  --accent-hover: #bd4929;
  --accent-soft: #f7dfd5;
  --accent-ink: #ffffff;
  --focus: #167c80;
  --shadow-sm: 0 2px 8px rgba(32, 38, 39, .08);
  --shadow-lg: 0 28px 70px rgba(20, 25, 27, .2);
  --ebook: #2b8063;
  --audiobook: #b05e24;
  --readalong: #7556a8;
  --movie: #b9473b;
  --series: #2e718e;
  --comic: #a13e69;
  --game: #457c78;
  --scene: #746486;
  --header-height: 118px;
  --sidebar: 286px;
  --player-space: calc(92px + env(safe-area-inset-bottom, 0px));
}

/* Playback keeps the library's warm panels, accent buttons, and quiet borders. */
#app { padding-bottom: var(--player-space); }
#detail-body { padding-bottom: var(--player-space); }
.detail-playback { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.detail-playback:empty { display: none; }
.detail-playback .live-button { min-height: 44px; }
.video-player, .audio-sheet { overscroll-behavior: contain; }
.video-player { width: 100%; max-width: none; height: 100dvh; max-height: 100dvh; border: 0; border-radius: 0; background: var(--bg); padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px); }
.video-player[open] { display: flex; flex-direction: column; }
.player-heading { display: flex; flex: 0 0 auto; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 22px; border-bottom: 1px solid var(--line); }
.player-heading > div { min-width: 0; }
.player-heading h2 { margin: 4px 0 0; font-size: clamp(16px, 2.5vw, 24px); overflow-wrap: anywhere; }
.player-heading .icon-button { flex-shrink: 0; font-size: 26px; }
.video-stage { flex: 1 1 auto; min-height: 100px; display: flex; background: #000; }
.video-stage video { display: block; width: 100%; min-width: 0; height: 100%; max-height: 72dvh; margin: auto; object-fit: contain; }
.player-toolbar { display: flex; flex: 0 0 auto; flex-wrap: wrap; align-items: end; justify-content: center; gap: 10px; padding: 12px 20px; }
.player-toolbar label, .audio-options label { display: grid; gap: 5px; min-width: 0; color: var(--muted); font-size: 12px; }
.player-toolbar select { max-width: min(270px, 80vw); }
.player-toolbar button, .audio-transport button, .audio-dock button, .player-heading button { min-height: 44px; }
.player-countdown { display: flex; justify-content: center; flex-wrap: wrap; gap: 14px; padding: 8px 20px; font-size: 13px; }
.player-countdown button { min-height: 32px; }
.player-message { margin: 0; padding: 10px 20px; color: var(--accent-hover); font-size: 13px; overflow-wrap: anywhere; }
.player-message:empty { display: none; }
.audio-dock { position: fixed; z-index: 45; bottom: 0; left: 0; right: 0; display: flex; align-items: center; gap: 10px; height: var(--player-space); padding: 10px max(18px, env(safe-area-inset-right, 0px)) calc(10px + env(safe-area-inset-bottom, 0px)) max(18px, env(safe-area-inset-left, 0px)); border-top: 1px solid var(--line-strong); background: var(--panel); box-shadow: 0 -8px 28px rgba(20,25,27,.12); }
.audio-dock-info { display: flex; align-items: center; gap: 12px; min-width: 0; flex: 1; height: 100%; border: 0; border-radius: 4px; padding: 0; background: transparent; color: var(--text); text-align: left; cursor: pointer; }
.audio-dock-info img { width: 52px; height: 52px; object-fit: cover; border-radius: 3px 3px 9px 3px; }
.audio-dock-info > span { display: grid; gap: 5px; min-width: 0; }
.audio-dock-info strong, .audio-dock-info small { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.audio-dock-info strong { font-size: 14px; }
.audio-dock-info small { color: var(--muted); font-size: 12px; }
.audio-dock > button:not(.audio-dock-info) { flex-shrink: 0; }
.audio-dock .audio-toggle { min-width: 72px; }
.audio-sheet { width: min(640px, 100vw); height: auto; max-height: calc(100dvh - env(safe-area-inset-top, 0px)); margin: auto auto 0; border-radius: 20px 20px 0 0; overflow-y: auto; padding-bottom: env(safe-area-inset-bottom, 0px); }
.audio-sheet .player-heading { position: sticky; top: 0; z-index: 1; background: var(--panel); }
.audio-sheet-content { padding: 22px clamp(18px, 5vw, 38px) 28px; }
.audio-cover { display: block; width: min(220px, 55vw); aspect-ratio: 1; object-fit: cover; margin: 0 auto 20px; border-radius: 4px 4px 20px 4px; box-shadow: var(--shadow-sm); }
.audio-sheet h2 { margin: 0 0 8px; font-family: ui-serif, Georgia, serif; font-weight: 550; font-size: clamp(24px, 5vw, 32px); text-align: center; overflow-wrap: anywhere; }
#audio-chapter { text-align: center; margin-bottom: 20px; }
#audio-scrubber, #audio-volume { width: 100%; min-width: 0; min-height: 32px; accent-color: var(--accent); padding: 0; cursor: pointer; }
.audio-times { display: flex; justify-content: space-between; gap: 10px; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.audio-transport { display: flex; justify-content: center; gap: 12px; margin: 22px 0; }
.audio-transport .audio-toggle { min-width: 96px; }
.audio-options { display: grid; grid-template-columns: 1fr 1.5fr; gap: 14px; }
.audio-options select { width: 100%; min-height: 44px; }
.audio-volume { grid-column: 1 / -1; }
.audio-sheet .player-message { padding: 10px 0; }
.audio-chapters { margin: 20px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.audio-chapters summary { padding: 16px 0; cursor: pointer; font-size: 13px; font-weight: 750; }
.audio-chapters ol { list-style: none; margin: 0; padding: 0; max-height: 300px; overflow-y: auto; }
.audio-chapters button { width: 100%; min-height: 48px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border: 0; border-top: 1px solid var(--line); padding: 12px; text-align: left; color: var(--text); background: var(--bg-raised); cursor: pointer; font-size: 13px; }
.audio-chapters button span:first-child { min-width: 0; overflow-wrap: anywhere; }
.audio-chapters button span:last-child { flex-shrink: 0; color: var(--muted); font-variant-numeric: tabular-nums; font-size: 11px; }
.audio-chapters button[aria-current] { border-left: 3px solid var(--accent); background: var(--accent-soft); font-weight: 750; }
.audio-chapters button:hover { background: var(--panel-2); }
.video-player :focus-visible, .audio-sheet :focus-visible, .audio-dock :focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
@media (max-width: 620px) {
  #detail-body { padding-bottom: var(--player-space); }
  .video-player { width: 100%; height: 100dvh; max-height: 100dvh; overflow-y: auto; }
  .player-heading { padding: 12px 16px; }
  .player-toolbar { padding: 10px 14px; gap: 8px; justify-content: flex-start; }
  .player-toolbar button { padding-inline: 12px; font-size: 12px; }
  .player-toolbar label { flex: 1 1 140px; }
  .player-toolbar select { width: 100%; max-width: 100%; }
  .audio-dock { gap: 6px; padding-left: max(10px, env(safe-area-inset-left, 0px)); padding-right: max(10px, env(safe-area-inset-right, 0px)); }
  .audio-dock-info { gap: 8px; }
  .audio-dock-info img { width: 40px; height: 40px; }
  .audio-dock-info strong { font-size: 12px; }
  .audio-dock-info small { font-size: 10px; }
  .audio-dock .icon-button { width: 44px; }
  .audio-dock .audio-toggle { min-width: 60px; padding-inline: 9px; font-size: 12px; }
  .audio-sheet { height: auto; width: 100%; max-height: calc(100dvh - env(safe-area-inset-top, 0px)); border-radius: 18px 18px 0 0; }
}

/* Live library controls use the same paper panels and format colours as the shelf. */
.availability-chip { display: inline-block; align-self: start; max-width: 100%; margin-top: 6px; padding: 2px 6px; border: 1px solid var(--line); border-radius: 5px; color: var(--muted); background: var(--panel); font-size: 10px; font-weight: 700; overflow-wrap: anywhere; }
.availability-coming, .state-coming { color: var(--series); background: color-mix(in srgb, var(--series) 10%, var(--panel)); }
.availability-partial, .state-missing { color: var(--accent-hover); background: var(--accent-soft); }
.state-available, .availability-in_library, .watched-mark { color: var(--ebook); }
.kinds button .activity-badge { display: inline-block; min-width: 20px; padding: 1px 5px; border-radius: 999px; color: var(--accent-ink); background: var(--accent); font-size: 10px; }
.live-header { margin-top: 16px; line-height: 1.7; }
.live-header:empty, .live-action-message:empty { display: none; }
.live-action-message { white-space: pre-line; overflow-wrap: anywhere; margin: 0 0 16px; padding: 10px 12px; border-left: 3px solid var(--focus); background: var(--panel-2); color: var(--text); }
.live-skeleton { display: grid; gap: 12px; padding: 12px 0; }
.live-skeleton .skeleton-line { width: 100%; height: 18px; }
.live-skeleton .skeleton-line.short { width: 65%; }
.live-load-error { margin-bottom: 16px; }
.live-toolbar, .season-tools { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; margin-bottom: 16px; }
.live-toolbar .hint, .season-tools .hint { margin: 0; }
.live-controls, .episode-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.live-button { max-width: 100%; white-space: normal; overflow-wrap: anywhere; display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: 8px 11px; font-size: 12px; text-decoration: none; }
.monitor-button[aria-pressed="true"] { color: var(--ebook); border-color: color-mix(in srgb, var(--ebook) 45%, var(--line)); }
.seasons { display: grid; gap: 12px; }
.season-panel, .chapter-panel, .download-group { min-width: 0; border: 1px solid var(--line); border-radius: 11px; background: var(--bg-raised); overflow: hidden; }
.season-panel > summary, .chapter-panel > summary, .download-group > summary, .activity-overflow > summary, .activity-logs > summary { padding: 14px 16px; cursor: pointer; font-weight: 750; overflow-wrap: anywhere; }
.season-panel > summary::marker, .chapter-panel > summary::marker, .download-group > summary::marker, .activity-overflow > summary::marker, .activity-logs > summary::marker { color: var(--accent); }
.season-panel > summary > span, .chapter-panel > summary > span, .download-group > summary > span, .activity-logs > summary > span { display: block; margin: 4px 0 0 17px; color: var(--muted); font-size: 12px; font-weight: 400; }
.season-panel[open] > summary, .download-group[open] > summary { border-bottom: 1px solid var(--line); }
.season-tools { margin: 0; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.episode-list, .chapter-list, .activity-list { margin: 0; padding: 0; list-style: none; }
.episode-row { display: grid; grid-template-columns: 60px minmax(0, 1fr) auto; gap: 12px; padding: 16px; border-bottom: 1px solid var(--line); }
.episode-row:last-child { border-bottom: 0; }
.episode-number { padding-top: 3px; color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.episode-copy, .episode-actions { min-width: 0; }
.episode-copy h4, .download-record h4 { margin: 0; font-size: 14px; overflow-wrap: anywhere; }
.episode-flags { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 9px; }
.state-chip { display: inline-block; width: fit-content; max-width: 100%; border: 1px solid var(--line); border-radius: 6px; padding: 3px 7px; font-size: 11px; font-weight: 700; overflow-wrap: anywhere; }
.watched-mark { font-size: 11px; }
.episode-actions { align-content: start; align-items: start; justify-content: end; max-width: 180px; }
.episode-actions a.live-button { color: var(--text); }
.episode-overview { margin-top: 10px; color: var(--muted); font-size: 12px; }
.episode-overview summary { cursor: pointer; }
.episode-overview p { margin-bottom: 0; }
.empty-live { padding: 16px; }
.live-progress { display: block; width: 100%; height: 6px; border: 0; border-radius: 6px; overflow: hidden; background: var(--panel-2); color: var(--accent); accent-color: var(--accent); }
.live-progress::-webkit-progress-bar { background: var(--panel-2); border-radius: 6px; }
.live-progress::-webkit-progress-value { background: var(--accent); border-radius: 6px; }
.live-progress::-moz-progress-bar { background: var(--accent); border-radius: 6px; }
.progress-caption { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; font-size: 12px; }
.progress-caption > * { min-width: 0; overflow-wrap: anywhere; }
.progress-caption > span { color: var(--muted); font-variant-numeric: tabular-nums; }
.download-status { margin-top: 12px; }
.download-status.has-warning { padding: 12px; border-radius: 7px; }
.has-warning { border-color: var(--accent); background: color-mix(in srgb, var(--accent-soft) 40%, var(--panel)); }
.warning-label { margin: 8px 0 0; color: var(--accent-hover); font-size: 12px; font-weight: 750; }
.download-messages { margin: 8px 0 0; padding-left: 18px; font-size: 12px; overflow-wrap: anywhere; }
.file-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; padding: 18px; border: 1px solid var(--line); border-radius: 11px; background: var(--bg-raised); }
.file-facts dt { color: var(--muted); font-size: 11px; }
.file-facts dd { margin: 4px 0 0; font-weight: 700; font-size: 14px; overflow-wrap: anywhere; }
.movie-playback { margin: 18px 0; }
.movie-playback p { font-size: 13px; }
.reading-positions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.reading-position { padding: 16px; border: 1px solid var(--line); border-radius: 9px; background: var(--bg-raised); }
.chapter-panel { margin-top: 18px; }
.chapter-list { max-height: 340px; overflow: auto; }
.chapter-list li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 16px; border-top: 1px solid var(--line); font-size: 12px; }
.chapter-list li span:first-child { overflow-wrap: anywhere; }
.chapter-list li span:last-child { flex-shrink: 0; color: var(--muted); font-variant-numeric: tabular-nums; }
.activity-page .layout { grid-template-columns: minmax(0, 1fr); }
.activity-page .filters { display: none; }
.activity-view { max-width: 1160px; margin: 0 auto; padding: 30px 32px 60px; }
.activity-view h1 { margin: 3px 0 0; font: 550 clamp(32px, 4vw, 44px)/1.1 ui-serif, Georgia, serif; letter-spacing: -.035em; }
.activity-sections { display: grid; gap: 20px; margin-top: 22px; }
.activity-section { min-width: 0; padding: 22px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.activity-section h2 { margin: 0; font: 550 25px/1.2 ui-serif, Georgia, serif; letter-spacing: -.02em; }
.activity-section h3 { margin: 18px 0 10px; font-size: 14px; }
.activity-section .section-title { flex-wrap: wrap; }
.live-section .section-title > span, .activity-section .section-title > span { display: inline-block; height: auto; padding: 3px 7px; overflow-wrap: anywhere; }
.live-section .section-title > .state-available { color: var(--ebook); }
.download-service + .download-service { margin-top: 24px; }
.download-group { margin-top: 12px; }
.download-records { max-height: 560px; overflow-y: auto; overscroll-behavior: contain; }
.download-record { padding: 16px; border-bottom: 1px solid var(--line); }
.download-record:last-child { border-bottom: 0; }
.release-name { margin: 4px 0 0; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.activity-list > li { padding: 15px 0; border-bottom: 1px solid var(--line); }
.activity-list > li:last-child { border-bottom: 0; }
.activity-list strong { font-size: 13px; overflow-wrap: anywhere; }
.request-activity-row { display: flex; justify-content: space-between; gap: 12px; }
.request-activity-row a { color: var(--focus); }
.request-states { display: flex; align-items: end; flex-direction: column; gap: 4px; }
.request-states .hint { margin: 0; }
.activity-overflow { margin-top: 12px; }
.activity-overflow > summary { padding-left: 0; }
.service-error { padding: 12px; border-left: 3px solid var(--accent); background: var(--accent-soft); font-size: 12px; overflow-wrap: anywhere; }
.activity-logs > summary { padding: 0; }
.log-tail { max-height: 300px; margin-bottom: 0; padding: 14px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--muted); font-size: 11px; white-space: pre-wrap; overflow-wrap: anywhere; }
@media (max-width: 900px) {
  .activity-view { padding: 22px 16px 60px; }
}
@media (max-width: 620px) {
  .episode-row { grid-template-columns: minmax(0, 1fr); gap: 7px; padding: 14px; }
  .episode-actions { justify-content: start; max-width: none; margin-top: 5px; }
  .live-button { min-height: 44px; }
  .season-panel > summary, .chapter-panel > summary, .download-group > summary { padding: 14px 12px; }
  .season-tools { padding: 12px; }
  .reading-positions { grid-template-columns: minmax(0, 1fr); }
  .chapter-list li { flex-direction: column; gap: 3px; }
  .activity-section { padding: 16px; }
  .request-activity-row { flex-direction: column; }
  .request-states { align-items: start; }
  .availability-chip { font-size: 9px; padding: 2px 4px; }
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #10151d;
    --bg-raised: #151b24;
    --panel: #1b222c;
    --panel-2: #242d38;
    --text: #f1f1ed;
    --muted: #a5adb5;
    --faint: #7c8792;
    --line: #303a47;
    --line-strong: #44505f;
    --accent: #f07a53;
    --accent-hover: #ff8b64;
    --accent-soft: #3d2927;
    --accent-ink: #15100e;
    --focus: #62c3c3;
    --shadow-sm: 0 3px 12px rgba(0, 0, 0, .28);
    --shadow-lg: 0 30px 80px rgba(0, 0, 0, .55);
    --ebook: #3b9675;
    --audiobook: #bf6d31;
    --readalong: #8767bc;
    --movie: #ca584c;
    --series: #3d84a3;
    --comic: #b7507b;
  }
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--bg); scroll-behavior: smooth; }
body { margin: 0; min-height: 100vh; overflow-x: hidden; background: var(--bg); color: var(--text); font: 15px/1.5 ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
button, input, select { font: inherit; color: inherit; }
button, a, input, select, summary { -webkit-tap-highlight-color: transparent; }
button { touch-action: manipulation; }
[hidden] { display: none !important; }
svg { display: block; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.eyebrow { color: var(--accent); font-size: 11px; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.hint { color: var(--muted); font-size: 12px; margin: 7px 0 0; }

input, select {
  min-width: 0;
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: var(--panel);
  padding: 9px 11px;
  outline: none;
}
input:hover, select:hover { border-color: var(--faint); }
input:focus, select:focus { border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 18%, transparent); }
input::placeholder { color: var(--faint); opacity: 1; }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 15px) 50%, calc(100% - 10px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 28px; }

.primary-button, .secondary-button {
  border: 0;
  border-radius: 9px;
  cursor: pointer;
  font-weight: 750;
  padding: 10px 16px;
}
.primary-button { background: var(--accent); color: var(--accent-ink); }
.primary-button:hover { background: var(--accent-hover); }
.secondary-button { background: var(--panel-2); border: 1px solid var(--line); }
.secondary-button:hover { border-color: var(--line-strong); transform: translateY(-1px); }
button:disabled { cursor: wait; opacity: .55; }
.icon-button { display: inline-grid; place-items: center; width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel); cursor: pointer; }
.icon-button:hover { background: var(--panel-2); }
.icon-button svg { width: 19px; height: 19px; }
.text-button { width: fit-content; border: 0; padding: 2px 0; color: var(--accent); background: none; cursor: pointer; font-weight: 700; text-align: left; }
.text-button:hover { text-decoration: underline; text-underline-offset: 3px; }
.muted-button { color: var(--muted); }

/* Sign in */
.auth { min-height: 100svh; display: grid; grid-template-columns: minmax(280px, 1fr) minmax(360px, .75fr); background: var(--bg); }
.auth-art { position: relative; display: flex; min-height: 100%; flex-direction: column; justify-content: space-between; overflow: hidden; padding: clamp(32px, 5vw, 72px); color: #fff; background: #1b3032; }
.auth-art::before, .auth-art::after { content: ""; position: absolute; border: 1px solid rgba(255, 255, 255, .18); border-radius: 50%; }
.auth-art::before { width: min(52vw, 680px); aspect-ratio: 1; right: -18%; top: -20%; box-shadow: 0 0 0 70px rgba(255,255,255,.025), 0 0 0 140px rgba(255,255,255,.02); }
.auth-art::after { width: 240px; aspect-ratio: 1; left: 28%; bottom: -130px; background: var(--accent); border: 0; }
.auth-mark { position: relative; z-index: 1; display: grid; place-items: center; width: 58px; height: 58px; border: 1px solid rgba(255,255,255,.35); border-radius: 16px; font-weight: 900; letter-spacing: -.05em; }
.auth-art p { position: relative; z-index: 1; margin: 0; font-family: ui-serif, Georgia, serif; font-size: clamp(44px, 6.5vw, 92px); font-weight: 500; letter-spacing: -.045em; line-height: .93; }
.auth-card { align-self: center; width: min(420px, calc(100% - 48px)); margin: 24px auto; display: grid; gap: 15px; }
.auth-card h1 { margin: -6px 0 0; font-family: ui-serif, Georgia, serif; font-size: 42px; font-weight: 600; letter-spacing: -.035em; }
.auth-copy { margin: -7px 0 8px; color: var(--muted); }
.auth-card .primary-button { margin-top: 4px; padding-block: 12px; }
.err { min-height: 1.5em; margin: 0; color: #d04c42; font-size: 13px; }

/* Header */
.site-header { position: sticky; z-index: 20; top: 0; padding-top: env(safe-area-inset-top); background: color-mix(in srgb, var(--bg-raised) 94%, transparent); border-bottom: 1px solid var(--line); backdrop-filter: blur(18px); }
.header-main { min-height: 70px; display: grid; grid-template-columns: var(--sidebar) minmax(250px, 720px) auto; align-items: center; gap: 20px; padding: 10px 24px; }
.brand { display: flex; align-items: center; gap: 11px; width: fit-content; color: var(--text); font-size: 17px; font-weight: 800; letter-spacing: -.025em; text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: var(--accent); color: var(--accent-ink); font-size: 12px; font-weight: 900; letter-spacing: -.04em; }
.brand-mark svg { width: 28px; height: 28px; }
.auth-mark svg { width: 38px; height: 38px; }
.header-actions { display: flex; justify-content: flex-end; align-items: center; gap: 8px; }
.header-action.private-trigger { display: inline-flex; color: var(--muted); background: transparent; }
.private-trigger:hover, .private-trigger[aria-pressed="true"] { color: var(--text); border-color: var(--line-strong); background: var(--panel-2); }
.searchbox { position: relative; width: 100%; }
.searchbox > svg { position: absolute; z-index: 1; left: 15px; top: 50%; width: 19px; height: 19px; color: var(--muted); transform: translateY(-50%); pointer-events: none; }
.searchbox input { height: 44px; padding: 9px 45px; border-color: transparent; border-radius: 12px; background: var(--panel-2); font-size: 16px; }
.searchbox input:focus { border-color: var(--focus); background: var(--panel); }
.searchbox kbd { position: absolute; right: 13px; top: 50%; transform: translateY(-50%); padding: 1px 7px; border: 1px solid var(--line-strong); border-radius: 5px; color: var(--muted); background: var(--panel); font: 12px/1.6 ui-monospace, monospace; }
.header-action { justify-self: end; display: none; align-items: center; gap: 8px; min-height: 42px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel); padding: 7px 12px; cursor: pointer; font-weight: 700; }
.header-action svg { width: 20px; height: 20px; }
.filter-total { display: grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; background: var(--accent); color: var(--accent-ink); font-size: 11px; }
.kinds { display: flex; align-items: center; gap: 6px; min-height: 47px; padding: 0 24px 9px calc(var(--sidebar) + 24px); overflow-x: auto; scrollbar-width: none; }
.kinds::-webkit-scrollbar { display: none; }
.kinds button { flex: 0 0 auto; border: 1px solid transparent; border-radius: 999px; padding: 6px 12px; background: transparent; color: var(--muted); cursor: pointer; font-size: 13px; font-weight: 700; }
.kinds button:hover { background: var(--panel-2); color: var(--text); }
.kinds button.on { border-color: var(--line-strong); background: var(--panel); color: var(--text); box-shadow: var(--shadow-sm); }
.kinds button span { margin-left: 6px; color: var(--faint); font-size: 11px; font-variant-numeric: tabular-nums; }

/* Settings and app connections */
.kinds .settings-nav { position: relative; display: inline-grid; place-items: center; min-width: 44px; min-height: 40px; padding: 8px 12px; }
.settings-nav svg { width: 19px; height: 19px; }
.settings-page .layout { grid-template-columns: minmax(0, 1fr); }
.settings-page .filters { display: none; }
.settings-view { max-width: 1060px; margin: 0 auto; padding: 30px 32px 60px; }
.settings-view h1 { margin: 3px 0 0; font: 550 clamp(32px, 4vw, 44px)/1.1 ui-serif, Georgia, serif; letter-spacing: -.035em; }
.settings-view h2 { margin: 28px 0 8px; font: 550 28px/1.2 ui-serif, Georgia, serif; }
.settings-welcome { padding: 16px 18px; border-left: 3px solid var(--accent); border-radius: 4px 4px 12px 4px; background: var(--accent-soft); }
.settings-options { margin-top: 24px; padding: 20px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.settings-options .check { font-weight: 700; }
.settings-options .hint { margin-bottom: 0; max-width: 680px; }
.settings-options + .settings-options { margin-top: 12px; }
.settings-options h2 { margin: 0 0 4px; font-size: 1rem; }
.password-form { display: grid; gap: 10px; max-width: 420px; margin-top: 12px; }
.password-form input { width: 100%; min-height: 44px; }
.connection-groups { display: grid; gap: 24px; margin-top: 20px; }
.connection-group { min-width: 0; }
.connection-group h3 { margin: 0 0 12px; color: var(--muted); font-size: 13px; }
.connection-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; gap: 16px; }
.connection-card { min-width: 0; padding: 20px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); overflow-wrap: anywhere; }
.connection-heading { display: flex; justify-content: space-between; align-items: start; gap: 12px; }
.connection-heading > div { min-width: 0; }
.connection-heading h4 { margin: 0 0 6px; font-size: 17px; }
.connection-heading > button { flex: 0 0 auto; }
.connection-mode { padding-left: 10px; border-left: 2px solid var(--line-strong); }
.connection-editor { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
.connection-fields { margin-bottom: 18px; }
.connection-fields .field { min-width: 0; }
.connection-fields .hint { margin: 0; font-weight: 400; }
.connection-input { display: flex; align-items: stretch; gap: 8px; min-width: 0; }
.connection-input input { min-width: 0; flex: 1; }
.connection-input .secret-toggle { flex: 0 0 auto; min-width: 62px; padding-inline: 10px; }
.required-mark { color: var(--accent); }
.connection-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.connection-actions button, .connection-heading button, .connection-input button { min-height: 44px; }
.connection-disconnect { margin-left: auto; }
.connection-message { margin: 10px 0; font-size: 13px; overflow-wrap: anywhere; }
.connection-message:empty { display: none; }
.connection-message.is-success { color: var(--ebook); }
.connection-message.is-error { color: var(--movie); }
.connection-message.is-busy { color: var(--muted); }
.connection-message.is-busy::before { content: ""; display: inline-block; width: 12px; height: 12px; margin-right: 8px; vertical-align: -2px; border: 2px solid var(--line-strong); border-top-color: var(--accent); border-radius: 50%; animation: connection-spin .8s linear infinite; }
@keyframes connection-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .connection-message.is-busy::before { animation: none; } }
.head-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.password-form textarea { width: 100%; min-height: 64px; resize: vertical; font: inherit; }
.taste-themes { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; }
.taste-themes .hint { margin-left: 4px; }
.device-app-fields { display: grid; gap: 10px; margin: 6px 0 0; padding: 14px; border: 1px solid var(--line); border-radius: 10px; }
.device-app-fields legend { padding: 0 6px; color: var(--muted); font-size: 13px; }
.device-app-fields .check { font-weight: 400; margin-top: -4px; }

/* Use on your devices */
.devices-view { max-width: 820px; margin: 0 auto; padding: 30px 32px 60px; }
.devices-view h1 { margin: 3px 0 0; font: 550 clamp(32px, 4vw, 44px)/1.1 ui-serif, Georgia, serif; letter-spacing: -.035em; }
.devices-body { display: grid; gap: 14px; margin-top: 8px; }
.device-section { min-width: 0; padding: 20px 22px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.device-section h2 { margin: 0 0 6px; font: 550 23px/1.2 ui-serif, Georgia, serif; letter-spacing: -.015em; text-wrap: balance; }
.device-section h3 { margin: 16px 0 4px; font-size: 1rem; }
.device-section p, .device-section li { max-width: 66ch; line-height: 1.55; }
.device-section ul { display: grid; gap: 6px; margin: 8px 0; padding-left: 20px; }
.device-section li::marker { color: var(--accent); }
.device-section em { font-style: normal; font-weight: 650; }
.device-address { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.device-address code { min-width: 0; padding: 4px 8px; border-radius: 6px; background: var(--accent-soft); font-size: 14px; overflow-wrap: anywhere; }
.device-note { margin: 10px 0 0; padding: 12px 14px; border-left: 3px solid var(--focus); border-radius: 4px 4px 10px 4px; background: var(--bg-raised); }
.device-invite { display: inline-flex; margin-top: 8px; text-decoration: none; }
.device-section [data-access-ask] { margin-top: 4px; }
@media (max-width: 900px) { .settings-view, .devices-view { padding: 22px 16px 60px; } }
@media (max-width: 620px) {
  .connection-cards { grid-template-columns: minmax(0, 1fr); }
  .connection-card, .settings-options { padding: 16px; }
  .connection-fields input { font-size: 16px; }
}

/* Sidebar */
.layout { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); align-items: start; }
.filters { position: sticky; z-index: 10; top: var(--header-height); height: calc(100svh - var(--header-height)); border-right: 1px solid var(--line); background: var(--bg-raised); }
.filters-head { display: flex; min-height: 76px; align-items: center; justify-content: space-between; padding: 17px 20px 12px; border-bottom: 1px solid var(--line); }
.filters-head h2 { margin: 1px 0 0; font-family: ui-serif, Georgia, serif; font-size: 24px; font-weight: 600; letter-spacing: -.02em; }
.filters-close { display: none; }
.filter-scroll { height: calc(100% - 76px); overflow-y: auto; overscroll-behavior: contain; padding: 4px 20px calc(30px + env(safe-area-inset-bottom)); scrollbar-color: var(--line-strong) transparent; scrollbar-width: thin; }
.filter-section { padding: 18px 0; margin: 0; border-bottom: 1px solid var(--line); }
.filter-section h3, .filter-section summary { margin: 0 0 10px; color: var(--text); font-size: 12px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; }
.filter-section summary { position: relative; list-style: none; cursor: pointer; }
.filter-section summary::-webkit-details-marker { display: none; }
.filter-section summary::after { content: "+"; position: absolute; right: 1px; top: -5px; color: var(--muted); font-size: 19px; font-weight: 400; }
.filter-section[open] summary::after { content: "−"; }
.filter-section h4 { margin: 14px 0 7px; color: var(--muted); font-size: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips.scroll { max-height: 196px; padding-right: 3px; overflow-y: auto; }
.chip { display: inline-flex; align-items: center; gap: 5px; min-height: 29px; max-width: 100%; border: 1px solid var(--line); border-radius: 7px; background: var(--panel); padding: 4px 8px; cursor: pointer; color: var(--muted); font-size: 12px; }
.chip > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip:hover { border-color: var(--line-strong); color: var(--text); }
.chip.on { border-color: var(--text); background: var(--text); color: var(--bg); }
.chip-count { color: var(--faint); font-size: 10px; font-variant-numeric: tabular-nums; }
.chip.on .chip-count { color: inherit; opacity: .7; }
.format-chip { border-left: 3px solid var(--format-color, var(--line-strong)); }
.field-stack, .check-stack { display: grid; gap: 11px; margin-top: 12px; }
.field { display: grid; gap: 5px; color: var(--muted); font-size: 12px; }
.field-label { color: var(--muted); font-size: 12px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.decade-chips { margin-top: -4px; }
.check { display: flex; align-items: flex-start; gap: 9px; cursor: pointer; color: var(--muted); font-size: 13px; }
.check input { flex: 0 0 auto; width: 17px; height: 17px; margin: 1px 0 0; accent-color: var(--accent); }
.filter-utility { display: grid; gap: 9px; padding: 18px 0; }
.library-status { margin: 5px 0 1px; color: var(--muted); font-size: 11px; line-height: 1.4; overflow-wrap: anywhere; }

/* Main views */
.content { min-width: 0; }
.home-view, .results-view { padding: 28px clamp(18px, 3.2vw, 48px) calc(70px + env(safe-area-inset-bottom)); }
.hero { position: relative; min-height: 260px; display: flex; align-items: center; overflow: hidden; border-radius: 3px 3px 36px 3px; padding: clamp(28px, 5vw, 64px); color: #f4f3ec; background: #1d3536; }
.hero::before { content: ""; position: absolute; width: 410px; height: 410px; right: -85px; top: -125px; border: 1px solid rgba(255,255,255,.13); border-radius: 50%; box-shadow: 0 0 0 48px rgba(255,255,255,.035), 0 0 0 96px rgba(255,255,255,.022); }
.hero::after { content: ""; position: absolute; width: 160px; height: 160px; right: 20%; bottom: -95px; border-radius: 50%; background: var(--accent); }
.hero-copy { position: relative; z-index: 2; max-width: 620px; }
.hero .eyebrow { color: #f09a7d; }
.hero h1 { margin: 8px 0 12px; font-family: ui-serif, Georgia, serif; font-size: clamp(39px, 5.2vw, 72px); font-weight: 500; letter-spacing: -.045em; line-height: .98; }
.hero p { max-width: 560px; margin: 0; color: rgba(255,255,255,.7); font-size: clamp(14px, 1.3vw, 17px); }
.hero-orbit { position: absolute; right: 6%; top: 50%; z-index: 1; width: 210px; height: 210px; transform: translateY(-50%); border: 1px solid rgba(255,255,255,.18); border-radius: 50%; }
.hero-orbit span { position: absolute; font-size: 9px; font-weight: 800; letter-spacing: .16em; color: rgba(255,255,255,.58); }
.hero-orbit span:nth-child(1) { left: -18px; top: 47%; }
.hero-orbit span:nth-child(2) { left: 39%; top: -8px; }
.hero-orbit span:nth-child(3) { right: -24px; bottom: 27%; }
.home-rows { margin-top: 36px; }
.media-row { margin-bottom: 38px; }
.row-heading { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin-bottom: 14px; }
.row-heading h2 { margin: 0; font-family: ui-serif, Georgia, serif; font-size: 28px; font-weight: 600; letter-spacing: -.025em; }
.row-heading p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.row-link { flex: 0 0 auto; border: 0; background: none; padding: 5px 0; color: var(--accent); cursor: pointer; font-weight: 750; }
.row-link:hover { text-decoration: underline; text-underline-offset: 4px; }
.rail, .detail-rail { display: grid; grid-auto-flow: column; grid-auto-columns: clamp(132px, 12.8vw, 176px); gap: clamp(11px, 1.25vw, 18px); overflow-x: auto; overscroll-behavior-inline: contain; padding: 2px 2px 12px; scroll-snap-type: x proximity; scrollbar-color: var(--line-strong) transparent; scrollbar-width: thin; }
.rail .card { scroll-snap-align: start; }
.row-empty { grid-column: 1 / -1; padding: 26px; color: var(--muted); background: var(--panel-2); }

/* Suggestions share the home rails and request flows. */
.private-mode .suggestions { display: none; }
.suggestions .rail { align-items: start; }
.suggestion-card { scroll-snap-align: start; }
.suggestion-reason { display: block; max-width: 100%; margin: 4px 0 0; overflow: hidden; color: var(--muted); font-size: 11.5px; line-height: 1.5; text-overflow: ellipsis; white-space: nowrap; }
.suggestion-footer { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-top: 10px; }
.suggestion-footer button, .suggestions .request-card-actions button, .suggestions .request-details, .suggestions .related-book-request button { min-height: 44px; }
.suggestions .request-details { display: inline-flex; align-items: center; }
.suggestions .request-picker { min-width: 0; }
.suggestions .request-picker input, .suggestions .request-picker select { min-width: 0; max-width: 100%; font-size: 16px; }
.suggestion-loading { color: var(--muted); font-size: 13px; }

.results-head { min-height: 70px; display: flex; align-items: end; justify-content: space-between; gap: 22px; margin-bottom: 18px; }
.results-head h1 { margin: 1px 0 0; font-family: ui-serif, Georgia, serif; font-size: clamp(30px, 3vw, 44px); font-weight: 600; letter-spacing: -.035em; line-height: 1.05; }
.sort-wrap { display: flex; align-items: center; gap: 8px; }
.sort-wrap label { flex: 0 0 auto; color: var(--muted); font-size: 12px; }
.sort-wrap select { width: auto; min-width: 155px; }
.result-bar { display: flex; min-height: 37px; align-items: center; gap: 12px; margin-bottom: 18px; color: var(--muted); font-size: 12px; }
#count { flex: 0 0 auto; font-variant-numeric: tabular-nums; }
.active-filters { display: flex; gap: 6px; overflow-x: auto; padding: 3px 1px; scrollbar-width: none; }
.active-filters::-webkit-scrollbar { display: none; }
.active-pill { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 5px; border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--line)); border-radius: 999px; background: var(--accent-soft); padding: 4px 7px 4px 10px; color: var(--text); cursor: pointer; font-size: 11px; }
.active-pill:hover { border-color: var(--accent); }
.active-pill svg { width: 13px; height: 13px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(138px, 1fr)); gap: clamp(22px, 2.6vw, 38px) clamp(12px, 1.6vw, 22px); }
.empty-state { grid-column: 1 / -1; display: grid; justify-items: start; min-height: 220px; align-content: center; padding: 34px; border: 1px dashed var(--line-strong); background: var(--bg-raised); }
.empty-state h2 { margin: 0; font-family: ui-serif, Georgia, serif; font-size: 27px; }
.empty-state p { max-width: 520px; margin: 5px 0 18px; color: var(--muted); }
.more { display: flex; justify-content: center; padding: 40px 0 10px; }

/* Work cards */
.card { min-width: 0; display: flex; flex-direction: column; border: 0; padding: 0; background: none; color: var(--text); cursor: pointer; text-align: left; }
.cover-shell { position: relative; display: block; width: 100%; aspect-ratio: 2 / 3; overflow: hidden; border-radius: 4px 4px 15px 4px; background: var(--panel-2); box-shadow: var(--shadow-sm); transform: translateZ(0); transition: transform .18s ease, box-shadow .18s ease; }
.card:hover .cover-shell { transform: translateY(-4px); box-shadow: 0 10px 24px rgba(25, 29, 30, .18); }
.cover-placeholder { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: center; padding: 14%; background: linear-gradient(145deg, color-mix(in srgb, var(--panel-2) 75%, var(--accent)), var(--panel-2)); color: var(--text); text-align: center; }
.cover-placeholder::before, .cover-placeholder::after { content: ""; position: absolute; left: 12%; right: 12%; height: 1px; background: currentColor; opacity: .18; }
.cover-placeholder::before { top: 9%; }
.cover-placeholder::after { bottom: 9%; }
.placeholder-title { display: -webkit-box; overflow: hidden; font-family: ui-serif, Georgia, serif; font-size: clamp(13px, 1.35vw, 20px); font-weight: 650; line-height: 1.05; -webkit-box-orient: vertical; -webkit-line-clamp: 4; }
.placeholder-author { margin-top: 10px; color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.cover-image { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; display: block; object-fit: cover; }
.cover-shade { position: absolute; z-index: 2; inset: auto 0 0; height: 30%; background: linear-gradient(transparent, rgba(0,0,0,.48)); opacity: .65; pointer-events: none; }
.format-stack { position: absolute; z-index: 3; left: 7px; right: 7px; bottom: 8px; display: flex; flex-wrap: wrap; gap: 4px; }
.format-badge { border-radius: 4px; padding: 2px 5px; color: #fff; background: var(--format-color, #4c5963); font-size: 9px; font-weight: 800; letter-spacing: .025em; line-height: 1.4; text-transform: uppercase; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.f-ebook { --format-color: var(--ebook); }
.f-audiobook { --format-color: var(--audiobook); }
.f-readalong { --format-color: var(--readalong); }
.f-movie { --format-color: var(--movie); }
.f-series { --format-color: var(--series); }
.f-comic { --format-color: var(--comic); }
.f-game { --format-color: var(--game); }
.f-scene { --format-color: var(--scene); }
.game-card .cover-shell, .game-detail .detail-cover { aspect-ratio: 1; }
.more-badge { background: rgba(25, 29, 32, .84); }
.finished-mark { position: absolute; z-index: 3; right: 7px; top: 7px; display: grid; place-items: center; width: 24px; height: 24px; border: 2px solid rgba(255,255,255,.75); border-radius: 50%; background: #1e8161; color: #fff; box-shadow: 0 2px 5px rgba(0,0,0,.25); }
.finished-mark svg { width: 14px; height: 14px; stroke-width: 2.5; }
.hidden-mark { position: absolute; z-index: 3; left: 7px; top: 7px; border-radius: 4px; padding: 2px 5px; background: rgba(20,24,27,.82); color: #fff; font-size: 9px; font-weight: 750; }
.progress-track { position: absolute; z-index: 4; left: 0; right: 0; bottom: 0; height: 4px; overflow: hidden; background: rgba(255,255,255,.32); }
.progress-track > span { display: block; height: 100%; background: var(--accent); }
.card-title { display: -webkit-box; overflow: hidden; margin-top: 9px; font-size: 13.5px; font-weight: 760; letter-spacing: -.012em; line-height: 1.25; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.card-subtitle { width: 100%; overflow: hidden; margin-top: 3px; color: var(--muted); font-size: 11.5px; line-height: 1.3; text-overflow: ellipsis; white-space: nowrap; }
.skeleton { background: linear-gradient(90deg, var(--panel-2) 20%, color-mix(in srgb, var(--panel-2) 75%, var(--panel)) 45%, var(--panel-2) 70%); background-size: 300% 100%; animation: shimmer 1.4s infinite linear; }
.skeleton-line { width: 88%; height: 12px; margin-top: 10px; border-radius: 3px; }
.skeleton-line.short { width: 60%; height: 9px; margin-top: 6px; }
@keyframes shimmer { to { background-position: -150% 0; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; } }

/* Detail dialog */
dialog { width: min(1060px, calc(100vw - 34px)); max-height: min(92svh, 900px); margin: auto; overflow: hidden; border: 1px solid var(--line); border-radius: 4px 4px 22px 4px; padding: 0; background: var(--panel); color: var(--text); box-shadow: var(--shadow-lg); }
dialog::backdrop { background: rgba(6, 10, 14, .72); backdrop-filter: blur(4px); }
#detail-body { max-height: inherit; overflow-y: auto; overscroll-behavior: contain; }
.dialog-close { position: sticky; z-index: 8; top: 14px; float: right; margin: 14px 14px -52px 0; background: color-mix(in srgb, var(--panel) 88%, transparent); backdrop-filter: blur(8px); }
.detail-view { min-height: 560px; }
.detail-lead { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 30px; align-items: end; padding: 38px 64px 32px 38px; background: linear-gradient(125deg, var(--panel-2), var(--panel)); border-bottom: 1px solid var(--line); }
.detail-cover { position: relative; width: 100%; aspect-ratio: 2 / 3; overflow: hidden; border-radius: 3px 3px 15px 3px; background: var(--panel-2); box-shadow: 0 16px 38px rgba(20,24,27,.22); }
.detail-cover .cover-image { z-index: 1; }
.detail-intro { padding-bottom: 5px; }
.detail-intro h2 { max-width: 680px; margin: 7px 0 12px; font-family: ui-serif, Georgia, serif; font-size: clamp(32px, 4.6vw, 58px); font-weight: 550; letter-spacing: -.045em; line-height: .98; }
.detail-meta { display: flex; flex-wrap: wrap; gap: 0; color: var(--muted); font-size: 13px; }
.detail-meta span + span::before { content: "·"; margin: 0 8px; color: var(--faint); }
.narrators { margin: 8px 0 0; color: var(--muted); font-size: 13px; }
.narrators strong { color: var(--text); font-weight: 650; }
.detail-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 15px; }
.detail-tag { border: 1px solid var(--line); border-radius: 999px; background: var(--panel); padding: 3px 8px; color: var(--muted); cursor: pointer; font-size: 10.5px; }
.detail-tag:not(.passive):hover { border-color: var(--accent); color: var(--accent); }
.detail-tag.passive { cursor: default; }
.detail-content { display: grid; gap: 0; padding: 4px 38px 40px; }
.detail-section { min-width: 0; padding: 25px 0; border-bottom: 1px solid var(--line); }
.detail-section:last-child { border-bottom: 0; }
.section-title { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.section-title h3 { margin: 0; font-size: 12px; font-weight: 850; letter-spacing: .09em; text-transform: uppercase; }
.section-title > span { display: grid; place-items: center; min-width: 19px; height: 19px; border-radius: 10px; background: var(--panel-2); color: var(--muted); font-size: 10px; }
.edition-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.edition-wrap { min-width: 0; display: grid; grid-template-columns: 1fr auto; align-items: center; border: 1px solid var(--line); border-left: 4px solid var(--format-color, var(--line-strong)); border-radius: 4px 4px 12px 4px; background: var(--bg-raised); }
.edition-wrap:hover { border-color: var(--line-strong); border-left-color: var(--format-color, var(--line-strong)); }
.edition-action { min-width: 0; display: flex; align-items: center; gap: 10px; padding: 11px 8px 11px 11px; color: var(--text); text-decoration: none; }
.edition-action:focus-visible { border-radius: 5px; }
.edition-icon { flex: 0 0 auto; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--format-color, var(--text)); color: #fff; font: 800 13px/1 ui-serif, Georgia, serif; }
.edition-copy { min-width: 0; display: grid; }
.edition-copy strong { font-size: 13px; }
.edition-copy small { overflow: hidden; color: var(--muted); font-size: 10.5px; text-overflow: ellipsis; white-space: nowrap; }
.edition-arrow { color: var(--muted); font-size: 16px; }
.split-button { margin-right: 9px; border: 0; background: none; padding: 5px; color: var(--muted); cursor: pointer; font-size: 10px; white-space: nowrap; }
.split-button:hover { color: var(--accent); text-decoration: underline; }
.unlinked-splits { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.unlinked-split { border: 0; background: none; padding: 2px 0; color: var(--muted); cursor: pointer; font-size: 10.5px; }
.unlinked-split:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.unlinked-split span { color: var(--faint); }
.description { max-width: 76ch; color: color-mix(in srgb, var(--text) 86%, var(--muted)); font-size: 14px; line-height: 1.7; white-space: pre-line; }
.detail-rail { grid-auto-columns: 116px; padding-bottom: 9px; }
.detail-rail .card-title { font-size: 11.5px; }
.detail-rail .card-subtitle { font-size: 10px; }
.detail-rail .format-stack { display: none; }
.current-work .cover-shell { outline: 3px solid var(--accent); outline-offset: -3px; }
.current-work::after { content: "Current"; align-self: flex-start; margin-top: 5px; border-radius: 3px; padding: 1px 5px; background: var(--accent); color: var(--accent-ink); font-size: 9px; font-weight: 800; text-transform: uppercase; }
.detail-loading { padding: 50px; display: grid; grid-template-columns: repeat(3, 150px); gap: 18px; }

/* Requests use the library's covers, quiet surfaces, and compact actions. */
.private-banner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin: 22px clamp(18px, 3.2vw, 48px) 0; padding: 12px 16px; border: 1px solid var(--line); border-left: 3px solid var(--scene); border-radius: 3px 3px 12px 3px; background: color-mix(in srgb, var(--scene) 8%, var(--bg-raised)); color: var(--muted); font-size: 12px; }
.private-banner > div { display: flex; flex-wrap: wrap; gap: 18px; }
.private-mode .results-head .eyebrow { color: var(--muted); }
.private-notice { margin: 16px clamp(18px, 3.2vw, 48px) 0; }
.pin-dialog { width: min(420px, calc(100vw - 32px)); height: auto; max-height: calc(100svh - 32px); overflow-y: auto; border: 1px solid var(--line); border-radius: 4px 4px 22px 4px; }
.pin-form { display: grid; gap: 17px; padding: 26px; }
.pin-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.pin-heading h2 { margin: 0; font-family: ui-serif, Georgia, serif; font-size: 29px; font-weight: 600; letter-spacing: -.035em; }
.pin-heading .icon-button { flex: 0 0 auto; }
.pin-form .hint { margin: -5px 0 0; }
.pin-form input { font-size: 18px; letter-spacing: .15em; }
.pin-form .err { overflow-wrap: anywhere; }

.request-search { margin-top: 24px; padding-top: 24px; border-top: 1px solid var(--line); }
.request-search-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.request-search-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.game-request { width: 100%; min-width: 0; margin-top: 14px; padding: 14px; border: 1px solid var(--line); border-radius: 4px 4px 12px 4px; background: var(--bg-raised); }
.game-request h3 { margin: 0 0 12px; font-size: 14px; }
.game-request-form { display: flex; flex-wrap: wrap; align-items: end; gap: 10px; min-width: 0; }
.game-request-form label { display: grid; gap: 5px; flex: 1 1 170px; min-width: 0; color: var(--muted); font-size: 12px; }
.game-request-form .game-title-field { flex-basis: 220px; }
.game-request-form input, .game-request-form select { font-size: 13px; }
.game-request-form button { max-width: 100%; white-space: normal; overflow-wrap: anywhere; font-size: 12px; }
.game-request-form .request-message { flex-basis: 100%; margin: 0; }
.request-card .game-request { padding: 10px; }
.request-card .game-request-form { display: grid; }
.request-card .game-request-form button { width: 100%; }
.empty-state .game-request { border-left: 3px solid var(--game); }
.empty-state .game-request .request-message { margin: 0; }
.request-search h2 { margin: 0; font-family: ui-serif, Georgia, serif; font-size: 24px; font-weight: 600; letter-spacing: -.025em; }
.request-group + .request-group { margin-top: 24px; }
.request-group > h4, .request-picker h4 { margin: 0 0 12px; font-size: 13px; font-weight: 750; }
.request-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 22px 14px; margin-top: 14px; }
.request-grid:empty, .request-message:empty, [data-request-status]:empty, [data-message]:empty { display: none; }
.request-card { min-width: 0; max-width: 190px; }
.request-card .card-title { margin-bottom: 0; }
.request-card .card-subtitle { margin-bottom: 0; }
.request-card-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }
.request-card .secondary-button, .request-pill { padding: 6px 10px; font-size: 11px; }
.request-pill { display: inline-block; max-width: 100%; border: 1px solid var(--line); border-radius: 999px; background: var(--panel-2); color: var(--muted); }
.request-section button:disabled, .request-search button:disabled { cursor: default; transform: none; }
.request-pill:disabled { opacity: 1; }
.request-link, .request-details { color: var(--accent); font-size: 12px; text-underline-offset: 3px; }
.request-details { color: var(--muted); font-size: 11px; }
.request-card .hint { margin: 0; font-size: 11px; }
.request-message, .request-option-copy, .request-card-actions { overflow-wrap: anywhere; }
.request-card .request-message { margin-top: 8px; }
.book-request { margin-top: 10px; }
.book-request h5 { margin: 0 0 10px; font-size: 12px; }
.book-request + .book-request { margin-top: 18px; }
.book-request-actions, .wanted-chips, .wanted-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.book-request-actions button { min-height: 44px; max-width: 100%; font-size: 12px; white-space: normal; }
.wanted-row { display: flex; align-items: start; justify-content: space-between; gap: 16px; }
.wanted-copy { min-width: 0; }
.wanted-copy .hint, .book-request .hint { overflow-wrap: anywhere; }
.wanted-chips { margin-top: 8px; }
.wanted-actions { flex: 0 0 auto; }
.wanted-actions button { min-height: 44px; }
.book-request > button { font-size: 12px; }
.book-request > button[aria-disabled="true"] { color: var(--muted); cursor: default; }
.request-picker { margin-top: 12px; border: 1px solid var(--line); border-radius: 4px 4px 12px 4px; padding: 14px; background: var(--bg-raised); }
.request-picker-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 8px; }
.request-picker-head h4 { margin: 0; }
.request-picker-head button { font-size: 12px; }
.request-options { display: grid; gap: 8px; margin-top: 12px; }
.request-options:empty { display: none; }
.request-option { display: flex; align-items: center; gap: 12px; width: 100%; min-width: 0; border: 1px solid var(--line); border-radius: 4px 4px 9px 4px; padding: 10px; background: var(--panel); text-align: left; cursor: pointer; }
.request-option:hover { border-color: var(--accent); }
.request-option-copy { display: grid; gap: 4px; min-width: 0; flex: 1; }
.request-option-copy strong { font-size: 12px; font-weight: 750; }
.request-option-copy small { color: var(--muted); font-size: 11px; }
.request-option-verb { flex: 0 0 auto; color: var(--accent); font-size: 11px; font-weight: 750; }
.candidate-cover { flex: 0 0 auto; width: 34px; height: 50px; border-radius: 2px; object-fit: cover; background: var(--panel-2); }
.candidate-placeholder { display: grid; place-items: center; color: var(--muted); font-family: ui-serif, Georgia, serif; }
@media (max-width: 620px) {
  .wanted-row { flex-direction: column; gap: 8px; }
  .wanted-actions { width: 100%; }
  .game-request-form { display: grid; grid-template-columns: minmax(0, 1fr); }
  .request-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .request-picker { padding: 10px; }
  .request-option { flex-wrap: wrap; gap: 8px; }
  .request-option-copy { flex-basis: 140px; }
  .request-option-verb { margin-left: auto; }
  .request-search-heading .secondary-button { max-width: 100%; font-size: 12px; }
}

/* Mobile filter sheet and responsive layout */
.filter-scrim { position: fixed; z-index: 39; inset: 0; width: 100%; height: 100%; border: 0; background: rgba(6,10,14,.68); backdrop-filter: blur(3px); }
@media (max-width: 1100px) {
  :root { --sidebar: 260px; }
  .hero-orbit { opacity: .5; }
  .detail-lead { grid-template-columns: 185px minmax(0, 1fr); }
}

@media (max-width: 900px) {
  :root { --header-height: 117px; }
  body.filters-open { overflow: hidden; }
  .header-main { grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; padding: 10px 16px; }
  .brand > span:last-child { display: none; }
  .searchbox kbd { display: none; }
  .searchbox input { padding-right: 14px; }
  .header-action { display: inline-flex; }
  .header-action > span:not(.filter-total) { display: none; }
  .private-banner { margin: 16px 16px 0; }
  .private-notice { margin-inline: 16px; }
  .kinds { padding: 0 16px 9px; }
  .layout { grid-template-columns: 1fr; }
  .filters { position: fixed; z-index: 40; top: auto; right: 0; bottom: 0; left: 0; width: 100%; height: min(86svh, 760px); max-height: calc(100svh - env(safe-area-inset-top)); border: 0; border-top: 1px solid var(--line-strong); border-radius: 18px 18px 0 0; box-shadow: var(--shadow-lg); transform: translateY(105%); transition: transform .25s ease; }
  .filters::before { content: ""; position: absolute; left: 50%; top: 7px; width: 42px; height: 4px; border-radius: 2px; background: var(--line-strong); transform: translateX(-50%); }
  .filters-open .filters { transform: translateY(0); }
  .filters-head { min-height: 70px; padding-top: 19px; }
  .filters-close { display: inline-grid; }
  .filter-scroll { height: calc(100% - 70px); }
  .filter-section { padding-block: 16px; }
  .content { width: 100%; }
  .home-view, .results-view { padding: 18px 16px calc(58px + env(safe-area-inset-bottom)); }
  .hero { min-height: 230px; padding: 30px 26px; border-radius: 3px 3px 26px 3px; }
  .hero-copy { max-width: 78%; }
  .hero p { max-width: 440px; }
  .hero-orbit { right: -85px; }
  .rail { grid-auto-columns: clamp(128px, 36vw, 158px); margin-right: -16px; padding-right: 16px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); }
}

@media (max-width: 620px) {
  .auth { grid-template-columns: 1fr; }
  .auth-art { display: none; }
  .auth-card { width: min(390px, calc(100% - 36px)); }
  .auth-card h1 { font-size: 38px; }
  .hero { min-height: 218px; }
  .hero h1 { font-size: clamp(36px, 11vw, 49px); }
  .hero-copy { max-width: 94%; }
  .hero p { font-size: 13px; }
  .hero-orbit { display: none; }
  .home-rows { margin-top: 29px; }
  .media-row { margin-bottom: 31px; }
  .row-heading h2 { font-size: 24px; }
  .row-heading p { max-width: 225px; font-size: 11.5px; }
  .row-link { font-size: 12px; }
  .results-head { align-items: flex-start; flex-direction: column; margin-bottom: 14px; }
  .sort-wrap { width: 100%; }
  .sort-wrap select { min-width: 0; flex: 1; }
  .result-bar { align-items: flex-start; flex-direction: column; }
  .active-filters { width: calc(100vw - 32px); }
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px 9px; }
  .card-title { font-size: 12.5px; }
  .card-subtitle { font-size: 10.5px; }
  .format-stack { left: 5px; right: 5px; bottom: 6px; gap: 3px; }
  .format-badge { padding: 1px 4px; font-size: 7.5px; }
  dialog { width: 100vw; height: 100svh; max-height: 100svh; border: 0; border-radius: 0; }
  #detail-body { height: 100%; padding-bottom: var(--player-space); }
  .dialog-close { top: calc(10px + env(safe-area-inset-top)); margin-top: calc(10px + env(safe-area-inset-top)); }
  .detail-lead { grid-template-columns: 104px minmax(0, 1fr); gap: 17px; align-items: end; padding: calc(52px + env(safe-area-inset-top)) 48px 22px 16px; }
  .detail-intro h2 { margin: 5px 0 9px; font-size: clamp(27px, 8vw, 39px); }
  .detail-meta { font-size: 11px; }
  .narrators { font-size: 11px; }
  .detail-tags { margin-top: 10px; }
  .detail-content { padding: 0 16px 28px; }
  .detail-section { padding-block: 20px; }
  .edition-grid { grid-template-columns: 1fr; }
  .description { font-size: 13px; }
  .detail-rail { grid-auto-columns: 104px; margin-right: -16px; padding-right: 16px; }
}

@media (max-width: 350px) {
  .header-main { padding-inline: 10px; }
  .brand-mark { width: 34px; height: 34px; }
  .header-action { padding-inline: 9px; }
  .kinds { padding-inline: 10px; }
  .home-view, .results-view { padding-inline: 12px; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detail-lead { grid-template-columns: 88px minmax(0, 1fr); padding-left: 12px; }
  .detail-content { padding-inline: 12px; }
}

.related-book-request { grid-column: 1 / -1; margin-top: 10px; }
.related-book-request .request-card-actions { flex-wrap: wrap; }

/* Accounts use the same quiet surfaces and form controls as Connections. */
.signed-in-user { display: block; max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 12px; }
.account-form { display: grid; gap: 14px; min-width: 0; margin-top: 16px; }
.account-form > button { justify-self: start; }
.account-form .field, .account-form [data-permission-editor] { min-width: 0; }
.account-form input, .account-form select { width: 100%; min-width: 0; min-height: 44px; }
.account-form input[type="checkbox"] { width: 18px; min-height: 18px; flex: 0 0 auto; }
.account-fields, .permission-switches { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.permission-switches { margin-top: 16px; }
.permission-switches .check { align-items: start; }
.permission-switches .hint { margin: 4px 0 0 26px; }
.permission-presets { margin: 0 0 16px; }
.accounts-list { display: grid; gap: 16px; }
.account-card { min-width: 0; border-top: 1px solid var(--line); padding-top: 16px; overflow-wrap: anywhere; }
.account-card h3 { margin: 0; font-size: 16px; }
.account-create { border-block: 1px solid var(--line); margin-block: 24px; padding-block: 18px; }
.account-create summary { cursor: pointer; font-weight: 700; }
.account-form button, .invite-row button { min-height: 44px; max-width: 100%; white-space: normal; overflow-wrap: anywhere; }
.invites-list { list-style: none; padding: 0; margin: 14px 0 0; }
.invite-row { display: flex; justify-content: space-between; align-items: start; gap: 12px; border-top: 1px solid var(--line); padding: 14px 0; overflow-wrap: anywhere; }
.invite-row > div { min-width: 0; }
.invite-row > button { flex: 0 0 auto; }
.player-sync-note { margin: 12px 18px; overflow-wrap: anywhere; }
.audio-sheet .player-sync-note { margin-inline: 0; }

/* Reader chrome shares the player's controls; the comic canvas stays dark. */
.reader-overlay {
  --bg: #10151d; --bg-raised: #181e27; --panel: #1d2530; --panel-2: #293340;
  --text: #edf0f4; --muted: #b3bdcb; --line: #35404e; --line-strong: #4a5869; --focus: #62b9bd;
  --reader-paper: #10151d;
  color-scheme: dark;
  position: fixed; inset: 0; margin: 0; width: 100%; max-width: none;
  height: 100vh; height: 100dvh; max-height: none; padding: 0; border: 0; border-radius: 0;
  overflow: hidden; overscroll-behavior: contain; background: var(--reader-paper); color: var(--text);
}
.reader-overlay::backdrop { background: #10151d; }
.reader-overlay[open] { display: block; }
.reader-overlay [hidden] { display: none !important; }
.reader-overlay button, .reader-overlay select { min-height: 44px; }
.reader-overlay .icon-button { flex: 0 0 44px; width: 44px; font-size: 24px; }
.reader-overlay :focus-visible { outline: 3px solid var(--focus); outline-offset: -3px; }
.reader-top, .reader-bottom { position: absolute; left: 0; right: 0; z-index: 3; background: var(--bg-raised); }
.reader-top {
  top: 0; gap: 10px; padding: calc(10px + env(safe-area-inset-top, 0px)) max(12px, env(safe-area-inset-right, 0px)) 10px max(12px, env(safe-area-inset-left, 0px));
}
.reader-heading { flex: 1; min-width: 0; }
.reader-top h2 { margin: 0; font-size: clamp(15px, 2vw, 21px); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
#reader-chapter { margin: 4px 0 0; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#reader-chapter:empty { display: none; }
.reader-bottom {
  bottom: 0; display: flex; align-items: center; gap: 14px; border-top: 1px solid var(--line);
  padding: 8px max(16px, env(safe-area-inset-right, 0px)) calc(8px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
}
.reader-position { flex: 1; min-width: 0; display: grid; text-align: center; gap: 0; font-size: 12px; font-variant-numeric: tabular-nums; }
#reader-scrubber { width: 100%; min-width: 0; min-height: 44px; padding: 0; accent-color: var(--accent); cursor: pointer; }
.reader-stage { position: absolute; inset: 0; min-width: 0; overflow: auto; overscroll-behavior: contain; background: var(--reader-paper); }
.reader-overlay[data-mode="pages"] .reader-stage { display: flex; align-items: stretch; justify-content: center; }
.reader-stage[data-direction="rtl"] { flex-direction: row-reverse; }
.reader-page { position: relative; flex: 1 1 0; min-width: 0; min-height: 100%; display: flex; justify-content: center; align-items: flex-start; }
.reader-page img { display: block; width: 100%; height: 100%; object-fit: contain; user-select: none; }
.reader-stage[data-fit="screen"] { overflow-y: hidden; }
.reader-stage[data-fit="screen"] .reader-page { height: 100%; }
.reader-stage[data-fit="width"] .reader-page { align-self: flex-start; }
.reader-stage[data-fit="width"] img { height: auto; object-fit: initial; }
.reader-spinner { position: absolute; z-index: 1; top: calc(50% - 16px); left: calc(50% - 16px); width: 32px; height: 32px; border: 3px solid #ffffff40; border-top-color: var(--accent); border-radius: 50%; animation: reader-spin .8s linear infinite; }
@keyframes reader-spin { to { transform: rotate(360deg); } }
.reader-page-retry { position: absolute; top: 45%; left: 10%; width: 80%; white-space: normal; }
.reader-message { position: absolute; z-index: 5; top: calc(100px + env(safe-area-inset-top, 0px)); left: max(16px, env(safe-area-inset-left, 0px)); right: max(16px, env(safe-area-inset-right, 0px)); margin: 0; padding: 12px 16px; border-radius: 8px; background: var(--panel); color: var(--text); font-size: 14px; overflow-wrap: anywhere; pointer-events: none; }
.reader-message:empty { display: none; }
.reader-end { position: absolute; z-index: 2; bottom: calc(92px + env(safe-area-inset-bottom, 0px)); left: 50%; transform: translateX(-50%); display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 10px; width: max-content; max-width: calc(100% - 32px - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px)); padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); box-shadow: var(--shadow-lg); }
.reader-end strong { width: 100%; text-align: center; }
#reader-next-book { max-width: 100%; overflow-wrap: anywhere; white-space: normal; }
.reader-chrome { transition: opacity .18s ease, visibility .18s ease; }
.reader-chrome-hidden .reader-chrome { opacity: 0; visibility: hidden; pointer-events: none; }
.reader-sheet { position: absolute; z-index: 6; right: max(12px, env(safe-area-inset-right, 0px)); bottom: calc(88px + env(safe-area-inset-bottom, 0px)); width: min(360px, calc(100% - 24px - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px))); max-height: calc(100% - 190px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)); overflow: auto; overscroll-behavior: contain; padding: 16px; border: 1px solid var(--line-strong); border-radius: 14px; background: var(--panel); box-shadow: var(--shadow-lg); }
.reader-sheet-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 10px; }
.reader-sheet h3 { margin: 0; font-size: 17px; }
.reader-sheet label { display: grid; gap: 6px; margin: 14px 0; color: var(--muted); font-size: 13px; }
.reader-sheet select { width: 100%; min-width: 0; }
.reader-font { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13px; }
.reader-font button { min-width: 44px; padding-inline: 12px; }
.reader-toc ol { padding: 0 0 0 16px; list-style: none; margin: 0; }
.reader-toc > div > ol { padding-left: 0; }
.reader-toc button.text-button { width: 100%; text-align: left; white-space: normal; overflow-wrap: anywhere; padding: 10px; border-bottom: 1px solid var(--line); }
.reader-toc [aria-current] { color: var(--accent); background: var(--panel-2); }
.reader-overlay[data-mode="epub"] .reader-stage { inset: calc(96px + env(safe-area-inset-top, 0px)) env(safe-area-inset-right, 0px) calc(82px + env(safe-area-inset-bottom, 0px)) env(safe-area-inset-left, 0px); }
.reader-epub { width: 100%; height: 100%; }
.reader-overlay[data-theme="light"] { --reader-paper: #fbfaf6; }
.reader-overlay[data-theme="sepia"] { --reader-paper: #f1e5cf; }
.reader-overlay[data-theme="dark"] { --reader-paper: #151a21; }
@media (max-width: 620px) {
  .reader-top { gap: 5px; padding-inline: max(8px, env(safe-area-inset-left, 0px)) max(8px, env(safe-area-inset-right, 0px)); }
  #reader-toc-toggle { padding-inline: 8px; font-size: 12px; }
  .reader-bottom { gap: 8px; padding-inline: max(10px, env(safe-area-inset-left, 0px)) max(10px, env(safe-area-inset-right, 0px)); }
  .reader-bottom button { padding-inline: 10px; font-size: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .reader-overlay *, .reader-overlay *::before, .reader-overlay *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
#upload-open { display: inline-flex; }
.save-editions { display: grid; gap: 10px; }
.save-edition { display: flex; align-items: start; justify-content: space-between; gap: 14px; min-width: 0; padding: 12px; border: 1px solid var(--line); border-radius: 4px 4px 12px 4px; background: var(--bg-raised); }
.save-edition-copy { display: grid; gap: 4px; min-width: 0; overflow-wrap: anywhere; }
.save-edition-copy strong { font-size: 13px; }
.save-edition-copy small { font-size: 11px; color: var(--muted); }
.save-edition .secondary-button, .save-formats summary { display: inline-flex; align-items: center; min-height: 44px; font-size: 12px; text-decoration: none; }
.save-edition > .secondary-button { flex: 0 0 auto; }
.save-formats { flex: 0 0 auto; max-width: 100%; }
.save-formats summary { display: list-item; padding: 12px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; }
.save-format-links { display: flex; flex-wrap: wrap; gap: 8px; max-width: 230px; margin-top: 8px; }
.upload-dialog { width: min(520px, calc(100vw - 32px)); height: auto; max-height: calc(100svh - 32px); overflow-y: auto; padding: 22px; border: 1px solid var(--line); border-radius: 4px 4px 22px 4px; }
.upload-dialog h2 { margin: 0; }
.upload-dialog .hint, .upload-dialog .connection-message { overflow-wrap: anywhere; }
.upload-drop { border: 2px dashed var(--line-strong); border-radius: 12px; padding: 16px; background: var(--bg-raised); }
.upload-drop p { margin-top: 0; font-size: 13px; }
.upload-drop.is-dragging { border-color: var(--accent); background: var(--panel-2); }
.upload-drop input { width: 100%; min-width: 0; min-height: 44px; padding: 6px; }
.upload-drop input::file-selector-button { min-height: 36px; margin-right: 8px; cursor: pointer; }
.upload-file-list { list-style: none; padding: 0; margin: 14px 0; }
.upload-file-list:empty { display: none; }
.upload-file-list li { display: grid; gap: 4px; padding: 10px 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; font-size: 12px; }
.upload-file-list .is-error { color: var(--danger, #c54639); }
#upload-form > button { min-height: 44px; }
#upload-options-form { max-width: 560px; }
#upload-options-form .field, #upload-options-form input { min-width: 0; }
/* Approval requests share Activity's list surfaces and connection controls. */
.approval-row { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.approval-copy, .approval-actions, .approval-actions .field { min-width: 0; }
.approval-copy, .approval-row .request-message { overflow-wrap: anywhere; }
.approval-actions { display: flex; flex-wrap: wrap; align-items: end; gap: 10px; }
.approval-actions .field { flex: 1 1 190px; }
.approval-actions input { width: 100%; min-width: 0; min-height: 44px; }
.approval-actions button { min-height: 44px; max-width: 100%; white-space: normal; }
.approval-note { white-space: pre-wrap; }
.approval-row .request-message:empty { display: none; }
#my-account-form .check { align-items: start; }
#my-account-form input[type="checkbox"] { width: 18px; min-height: 18px; flex: 0 0 auto; }
#my-account-form .field, #my-account-form input { min-width: 0; }
@media (max-width: 620px) {
  .approval-actions .field { flex-basis: 100%; order: 1; }
  .approval-actions [data-approval-action="deny"] { order: 2; }
  .approval-actions input { font-size: 16px; }
  .header-actions { gap: 4px; }
  .header-actions:has(#upload-open:not([hidden])) .signed-in-user { display: none; }
  .save-edition { flex-direction: column; gap: 10px; }
  .upload-dialog { padding: 18px; }
  .upload-drop { padding: 12px; }
  .signed-in-user { max-width: 60px; font-size: 11px; }
  .account-fields, .permission-switches { grid-template-columns: minmax(0, 1fr); }
  .account-form input, .account-form select, .password-form input { font-size: 16px; }
  .account-form .connection-actions { gap: 8px; }
}

/* Read-along controls reserve room above the phone's home indicator. */
.reader-overlay[data-mode="readalong"] .reader-stage { inset: calc(96px + env(safe-area-inset-top, 0px)) env(safe-area-inset-right, 0px) calc(146px + env(safe-area-inset-bottom, 0px)) env(safe-area-inset-left, 0px); }
.reader-overlay[data-mode="readalong"] .reader-bottom { flex-wrap: wrap; gap: 6px 10px; }
.reader-narration { width: 100%; display: flex; align-items: center; justify-content: center; gap: 8px; }
.reader-narration #reader-play { min-width: 76px; min-height: 48px; font-size: 15px; }
.reader-narration select { width: 72px; min-width: 0; padding-inline: 6px; }
#reader-elapsed { min-width: 36px; font-size: 12px; font-variant-numeric: tabular-nums; }
.reader-back { position: absolute; z-index: 5; bottom: calc(150px + env(safe-area-inset-bottom, 0px)); left: 50%; transform: translateX(-50%); border-radius: 30px; white-space: nowrap; box-shadow: var(--shadow-lg); }
.reader-overlay[data-mode="readalong"] .reader-sheet { bottom: calc(148px + env(safe-area-inset-bottom, 0px)); max-height: calc(100% - 248px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)); }
.reader-overlay[data-mode="readalong"] .reader-end { bottom: calc(156px + env(safe-area-inset-bottom, 0px)); }
.bookbridge-fields { min-width: 0; margin: 8px 0; padding: 14px; border: 1px solid var(--line); border-radius: 10px; }
.bookbridge-fields legend { font-weight: 600; padding-inline: 5px; }
.bookbridge-fields .field + .field { margin-top: 12px; }
.offline-work { font-size: 12px; white-space: normal; }
span.offline-work { border: 0; color: var(--muted); align-self: center; }
#offline-banner { position: sticky; top: 0; z-index: 30; padding: calc(6px + env(safe-area-inset-top, 0px)) 12px 6px; background: var(--panel); color: var(--text); text-align: center; font-size: 13px; }
#offline-library { max-width: 760px; margin: 20px auto; padding: 16px; }
#offline-account { margin-top: 24px; }
.offline-item { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding-block: 12px; border-bottom: 1px solid var(--line); }
.offline-item span { flex: 1 1 180px; overflow-wrap: anywhere; }
.offline-item button { min-height: 44px; }
.offline-dialog { width: min(440px, calc(100% - 32px)); max-height: calc(100dvh - 48px); overflow: auto; padding: 20px; color: var(--text); background: var(--panel); border: 1px solid var(--line); border-radius: 14px; }
.offline-dialog::backdrop { background: #0009; }
.offline-dialog p { overflow-wrap: anywhere; }
@media (max-width: 400px) { .reader-narration { gap: 6px; } .reader-narration button { padding-inline: 8px; } }
.watching-list { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 8px; }
.watching-row { display: grid; grid-template-columns: 40px 1fr; gap: 10px; align-items: center; }
.watching-row img, .watching-cover { width: 40px; height: 56px; object-fit: cover; border-radius: 4px; background: var(--bg-raised); }
.watching-row strong { display: block; font-weight: 600; overflow-wrap: anywhere; }
.watching-row strong .text-button { display: inline; padding: 0; font: inherit; font-weight: 700; }
.watching-row span { font-size: 12px; color: var(--muted); }
.my-apps-form { display: grid; gap: 10px; margin-top: 12px; }
.my-apps-form fieldset { border: 0; margin: 0; padding: 0; display: grid; gap: 8px; }
.my-apps-form legend { font-weight: 700; margin-bottom: 4px; }
.find-dialog { width: min(820px, calc(100vw - 32px)); max-height: calc(100svh - 32px); overflow-y: auto; border: 1px solid var(--line); border-radius: 4px 4px 22px 4px; }
.find-tabs { display: flex; gap: 6px; margin: 4px 0 12px; }
.find-tabs [role=tab] { border: 1px solid var(--line); background: none; color: var(--muted); padding: 6px 14px; border-radius: 999px; cursor: pointer; }
.find-tabs [aria-selected=true] { color: var(--text, inherit); border-color: var(--scene); background: color-mix(in srgb, var(--scene) 12%, transparent); }
.find-form { display: flex; gap: 8px; }
.find-form input { flex: 1; min-width: 0; }
.find-list, .find-scenes { list-style: none; margin: 8px 0; padding: 0; display: grid; gap: 8px; }
.find-row { display: flex; gap: 12px; justify-content: space-between; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: 6px; }
.find-row > div:first-child { min-width: 0; display: grid; gap: 2px; }
.find-row strong { font-weight: 600; overflow-wrap: anywhere; }
.find-row span, .find-scenes span { font-size: 12px; color: var(--muted); }
.find-why { color: var(--scene) !important; }
.find-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; flex-shrink: 0; }
.find-scenes li { display: grid; grid-template-columns: 120px 1fr; gap: 12px; align-items: start; }
.find-scenes img, .find-noimg { width: 120px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 4px; background: var(--bg-raised); }
.find-scenes li > div { display: grid; gap: 4px; min-width: 0; }
.find-status-chip { font-size: 12px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); }
@media (max-width: 560px) { .find-row { flex-direction: column; align-items: stretch; } .find-scenes li { grid-template-columns: 80px 1fr; } .find-scenes img, .find-noimg { width: 80px; } }
.find-open { padding: 4px 12px; font-size: 12px; }
.find-offer { margin-top: 0; margin-bottom: 18px; }
.find-options { display: flex; gap: 16px; margin-top: 10px; }
.find-types { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.find-type { border: 1px solid var(--line); background: none; color: var(--muted); padding: 3px 10px; border-radius: 999px; font-size: 12px; cursor: pointer; }
.find-type[aria-pressed=true] { color: inherit; border-color: var(--scene); background: color-mix(in srgb, var(--scene) 14%, transparent); }
.download-note { margin: 6px 0 0; font-size: 13px; }
.download-note.is-stuck { color: var(--accent); font-weight: 600; }
.health-row { padding: 8px 10px; border-left: 3px solid var(--line); border-radius: 3px; margin-bottom: 6px; background: var(--bg-raised); font-size: 13px; list-style: none; }
.health-error { border-left-color: var(--accent); }
.health-warning { border-left-color: var(--focus); }
.coming-row { display: grid; grid-template-columns: 110px 1fr; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--line); list-style: none; }
.coming-date { font-size: 12px; color: var(--muted); font-weight: 600; }
