/* Panel interface: unified application shell, controls, media cards and dialogs. */
:root {
  color-scheme: light;
  --paper: #f7f6f2;
  --surface: #fffefb;
  --surface-subtle: #f3f3ed;
  --ink: #182c2c;
  --muted: #65726a;
  --line: #dedfd7;
  --accent: #bf4826;
  --accent-hover: #a93d20;
  --accent-soft: #e7ebdf;
  --success: #38734d;
  --danger: #a23e2e;
  --green: #dce7d9;
  --rail: 228px;
  --radius: 12px;
  font-family: 'Segoe UI Variable', 'Segoe UI', system-ui, sans-serif;
  font-size: 14px;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); line-height: 1.5; }
button,input,select { font: inherit; }
button,a,input,select,summary { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; border: 0; color: inherit; transition: background .15s, border-color .15s, box-shadow .15s; }
button:disabled { opacity: .48; cursor: default; }
button[hidden],[hidden] { display: none !important; }
a { color: var(--accent); }
button:focus-visible,a:focus-visible,input:focus-visible,select:focus-visible,summary:focus-visible { outline: 3px solid #d4774a; outline-offset: 3px; }
h1,h2,h3,p { margin: 0; }
h1 { font-size: 28px; line-height: 1.25; letter-spacing: -.8px; font-weight: 700; }
h1:focus { outline: none; }
h2 { font-size: 18px; line-height: 1.35; letter-spacing: -.3px; }
h3 { font-size: 14px; line-height: 1.5; }
p { color: var(--muted); }
em { font-style: normal; }
.icon { width: 20px; height: 20px; flex: 0 0 20px; vertical-align: middle; }
kbd { font-family: inherit; font-size: 11px; line-height: 1.4; border: 1px solid var(--line); background: var(--surface-subtle); border-radius: 5px; padding: 3px 6px; color: var(--muted); white-space: nowrap; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.skip-link { position: fixed; top: -80px; left: 16px; z-index: 100; background: var(--accent); color: white; padding: 12px 18px; border-radius: 8px; }
.skip-link:focus { top: 12px; }
/* Persistent desktop navigation, compact tablet rail, bottom navigation on mobile. */
.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--rail); background: #f0f0e9; color: #182c2c; padding: 29px 16px 20px; display: flex; flex-direction: column; z-index: 30; }
.brand { display: flex; align-items: center; gap: 11px; padding: 0 12px; text-decoration: none; color: var(--ink); font-weight: 750; font-size: 25px; letter-spacing: -.9px; }
.brand-symbol { width: 35px; height: 35px; color: #d45732; display: flex; }
.brand-symbol svg { width: 100%; height: 100%; }
.workspace-label { font-size: 10px; font-weight: 650; letter-spacing: 1.5px; color: #69776c; margin: 37px 14px 13px; }
.sidebar nav { display: grid; gap: 6px; }
.nav { display: flex; align-items: center; gap: 12px; border-radius: 9px; padding: 12px 14px; min-height: 46px; background: none; color: #5e6c66; text-align: left; font-size: 13px; font-weight: 550; }
.nav:hover { background: #e4e7dd; color: var(--ink); }
.nav.active { background: #182c2c; color: white; box-shadow: 0 4px 12px #172c2c22; }
.nav b { margin-left: auto; min-width: 22px; padding: 2px 5px; border-radius: 6px; background: #ffffff18; color: inherit; font-size: 10px; text-align: center; }
.sidebar-note { margin-top: auto; border-top: 1px solid var(--line); padding: 15px 10px 0; display: grid; gap: 15px; }
.sidebar-help { display: flex; align-items: center; gap: 12px; padding: 8px 0; background: none; color: #5e6c66; text-align: left; font-size: 12px; }
.sidebar-help:hover { color: var(--ink); }
.connection-state { display: inline-flex; align-items: center; gap: 7px; font-size: 11px; color: #536d59; }
.connection-state::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: #729572; flex-shrink: 0; }
.connection-state.offline { color: #a23e2e; }
.connection-state.offline::before { background: #b2573c; }
.local-caption { color: #69776c; font-size: 10px; }
main { margin-left: var(--rail); min-height: 100vh; padding: 0 34px 50px; }
main > header { position: sticky; top: 0; z-index: 20; height: 58px; margin: 0 -34px 0; padding: 0 34px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 16px; background: #f7f6f2ee; backdrop-filter: blur(16px); }
.header-context { font-size: 12px; color: var(--muted); }
.mobile-brand { display: none; }
.header-actions { display: flex; gap: 10px; align-items: center; }
.command-search { display: flex; align-items: center; gap: 9px; min-width: 200px; padding: 8px 10px; border-radius: 8px; background: var(--surface); border: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.command-search .icon { width: 16px; height: 16px; flex-basis: 16px; }
.command-search kbd { margin-left: auto; }
.icon-button { display: inline-grid; place-items: center; width: 38px; height: 38px; min-width: 38px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); font-size: 24px; }
.icon-button:hover { background: var(--accent-soft); }
.view { max-width: 1440px; margin: 0 auto; }
.page-heading { padding: 29px 0 24px; }
.page-heading p { font-size: 13px; margin-top: 7px; }
/* Common fields and action hierarchy. */
.primary,.secondary,.subtle { display: inline-flex; align-items: center; justify-content: center; gap: 7px; border-radius: 8px; min-height: 38px; padding: 9px 14px; font-size: 12px; font-weight: 600; line-height: 1.4; }
.primary { background: var(--accent); color: #fff; border: 1px solid var(--accent); }
.primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }
.secondary { background: var(--surface); border: 1px solid var(--line); color: #385044; }
.secondary:hover:not(:disabled) { border-color: #c8cfbd; background: #eff1e8; }
.subtle { background: transparent; color: var(--muted); font-weight: 500; }
.subtle:hover:not(:disabled) { color: var(--accent); background: var(--accent-soft); }
input:not([type=checkbox]),select { border: 1px solid #d4d9ce; background: var(--surface); color: var(--ink); border-radius: 7px; padding: 9px 11px; min-height: 38px; min-width: 0; max-width: 100%; font-size: 12px; }
select { padding-right: 25px; }
input::placeholder { color: var(--muted); }
input[type=checkbox] { accent-color: var(--accent); width: 18px; height: 18px; flex-shrink: 0; }
.footnote { font-size: 11px; line-height: 1.7; margin: 12px 0; }
.footnote:empty { display: none; }
/* Discover: source tabs and compact search with progressively disclosed filters. */
.discovery-workspace { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 0 18px 13px; box-shadow: 0 2px 4px #182c2c02; }
.source-switch { display: flex; gap: 24px; border-bottom: 1px solid var(--line); margin: 0 0 12px; }
.source-switch button { background: none; border-bottom: 2px solid transparent; padding: 11px 0 10px; text-align: left; display: flex; align-items: center; gap: 8px; position: relative; top: 1px; color: var(--muted); }
.source-switch button > span { display: block; font-size: 13px; font-weight: 650; }
.source-switch small { display: block; font-size: 10px; margin-top: 0; color: var(--muted); font-weight: 400; }
.source-switch button.active { border-color: var(--accent); color: var(--accent); }
.source-switch button.active small { color: #61745e; }
.source-switch button:hover { color: var(--accent); }
.search-box { display: flex; align-items: center; gap: 12px; border: 1px solid #d4d9ce; background: #fafaf5; border-radius: 9px; padding: 5px 5px 5px 14px; }
.search-box > span { color: var(--muted); display: flex; }
.search-box input { flex: 1; border: 0; background: transparent; min-width: 0; box-shadow: none; font-size: 14px; padding: 8px 0; }
.search-box input:focus { outline: none; }
.search-box:focus-within { border-color: #d4774a; box-shadow: 0 0 0 3px #bf48260e; }
.search-box .primary { min-height: 40px; padding-inline: 22px; }
.quick-search { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin: 10px 0 0; }
.quick-search > span { color: var(--muted); font-size: 11px; margin-right: 3px; }
.quick-search button { color: #617066; background: #eeeee8; border-radius: 5px; padding: 4px 9px; font-size: 10px; }
.quick-search button:hover { color: var(--accent); background: var(--accent-soft); }
.manga-source-options { display: flex; gap: 18px; align-items: center; margin: 0 0 12px; padding: 9px 12px; background: var(--surface-subtle); border: 1px solid var(--line); border-radius: 8px; }
.manga-source-options label { display: flex; align-items: center; gap: 10px; font-size: 11px; color: var(--muted); flex-shrink: 0; }
.manga-source-options p { font-size: 11px; line-height: 1.6; }
.manga-source-options select { min-width: 172px; }
.discovery-feedback { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.discovery-feedback:has(p:empty):has(button[hidden]) { display: none; }
.discovery-feedback p { flex: 1; min-width: 180px; }
.discovery-feedback button { margin: 8px 0; }
.discovery-controls { display: flex; gap: 10px; align-items: end; margin-top: 10px; }
.discovery-controls label { display: flex; align-items: center; gap: 10px; font-size: 11px; color: var(--muted); }
.discovery-controls select { max-width: 320px; }
#surprise-title { margin-left: auto; }
#surprise-title .icon { width: 15px; height: 15px; flex-basis: 15px; }
.advanced-discovery { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 12px; }
summary { cursor: pointer; }
.advanced-discovery summary { color: var(--accent); font-size: 12px; font-weight: 600; }
.advanced-discovery > p { font-size: 12px; margin-top: 12px; }
.advanced-fields,.advanced-actions,.tag-filters { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 14px; }
.advanced-fields label,.tag-filters label { display: grid; gap: 6px; flex: 1; min-width: 140px; font-size: 11px; color: var(--muted); }
.tag-filters select { width: 100%; min-height: 175px; }
.tag-filters option { padding: 5px 7px; border-radius: 4px; }
.advanced-actions { align-items: center; gap: 8px; }
#source-genre-controls { display: flex; gap: 8px; flex-wrap: wrap; align-items: end; margin-top: 12px; }
#source-genre-controls label { display: grid; gap: 5px; font-size: 11px; color: var(--muted); min-width: 200px; }
#source-genre-status { flex-basis: 100%; margin: 0; }
#tags-status { margin-top: 8px; font-size: 12px; }
.results-toolbar { display: flex; justify-content: space-between; gap: 20px; align-items: center; padding-top: 20px; }
.results-toolbar h2 { font-size: 17px; }
#results-meta { display: block; margin-top: 5px; color: var(--muted); font-size: 11px; }
.results-options { display: flex; flex-wrap: wrap; gap: 12px; align-items: start; margin: 12px 0 10px; }
.browse-controls { display: flex; flex: 1; align-items: center; gap: 12px; flex-wrap: wrap; min-height: 38px; }
.browse-controls label { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--muted); }
.browse-controls select { max-width: 260px; }
.view-help { position: relative; color: var(--muted); font-size: 11px; }
.view-help p { position: absolute; top: 25px; left: 0; width: min(300px,70vw); padding: 12px; border: 1px solid var(--line); background: var(--surface); border-radius: 8px; z-index: 5; box-shadow: 0 5px 20px #182c2c12; }
.result-filters { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 9px 12px; min-width: 185px; }
.result-filters summary { font-size: 12px; color: #526457; font-weight: 550; }
.result-filters[open] { flex-basis: 100%; padding: 13px 16px; }
.filters,.extended-filters { display: inline-flex; align-items: end; gap: 10px; flex-wrap: wrap; margin: 12px 12px 0 0; }
.filters label,.extended-filters label { display: grid; gap: 5px; font-size: 11px; color: var(--muted); }
.extended-filters input { width: 80px; }
.selection-hint { font-size: 10px; color: var(--muted); margin: 0 0 16px; }
/* Book cards: media is primary; buttons have a consistent, compact hierarchy. */
.grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(245px,1fr)); gap: 24px 20px; }
.card { min-width: 0; position: relative; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: 11px; padding: 8px; box-shadow: 0 2px 3px #182c2c03; transition: border-color .18s,box-shadow .18s; }
.card:hover { border-color: #c3cdb9; box-shadow: 0 5px 18px #182c2c09; }
.cover { width: 100%; aspect-ratio: 2/3; position: relative; overflow: hidden; background: linear-gradient(145deg,#e9ecdf,#dde3d4); border-radius: 7px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.cover::before { content: 'P'; color: #b6bcae; font-size: 64px; font-weight: 800; }
.cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform .25s; }
.card:hover .cover img { transform: scale(1.025); }
.card-category { margin: 12px 3px 0; font-size: 9px; color: #687763; text-transform: uppercase; letter-spacing: .65px; font-weight: 650; }
.card h3 { margin: 5px 3px 10px; min-height: 40px; font-size: 13px; font-weight: 650; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.card-meta { display: flex; gap: 5px; flex-wrap: wrap; align-items: center; margin-top: auto; color: var(--muted); font-size: 10px; }
.card-meta > span { margin: 0 2px 4px; }
.card-meta > button { min-height: 33px; border-radius: 6px; background: #edf0e7; color: #52664f; padding: 6px 8px; font-size: 10px; font-weight: 550; flex: 1; white-space: nowrap; }
.card-meta > button:first-of-type { flex-basis: 100%; background: var(--accent-soft); color: #385542; border: 1px solid #d0dcc9; font-size: 11px; font-weight: 650; }
.card-meta > button:hover:not(:disabled) { background: #d6dfcb; color: #2f4d38; }
.card-meta > button:disabled { background: #eeeee8; border-color: #e0e3d9; color: #6c786c; opacity: .8; }
.check { position: absolute; top: 8px; left: 8px; z-index: 2; width: 28px; height: 28px; display: grid; place-items: center; background: #ffffffed; border: 1px solid #ffffffcc; border-radius: 6px; box-shadow: 0 1px 5px #0001; }
.check input { margin: 0; width: 16px; height: 16px; cursor: pointer; }
.card.selected { border-color: var(--accent); box-shadow: 0 0 0 2px #bf48263b; }
.availability-badge { position: absolute; left: 7px; right: 7px; bottom: 7px; z-index: 3; padding: 7px 8px; background: #182c2ce6; color: #fff; border: 1px solid #ffffff20; border-radius: 5px; font-size: 10px; text-align: center; backdrop-filter: blur(5px); }
.availability-badge.available { right: auto; max-width: calc(100% - 14px); padding: 5px 8px; background: #182c2cf2; font-size: 11px; font-weight: 650; line-height: 1.4; font-variant-numeric: tabular-nums; box-shadow: 0 2px 7px #182c2c25; }
.availability-badge.unavailable { background: #513a2ee8; }
.series-unavailable img { opacity: .4; filter: saturate(.5); }
.recommendation-reason { font-size: 10px; line-height: 1.6; margin: 10px 3px 3px; color: #6b765c; }
.status:not(:empty) { margin: 16px 0; padding: 18px; border: 1px dashed #d4d9ce; background: #fff; border-radius: 9px; color: var(--muted); font-size: 13px; }
.status.error { color: var(--danger); border-color: #e6cabc; background: #fff2e9; }
.empty { padding: 52px 24px; text-align: center; border: 1px dashed #d2d8cc; border-radius: 12px; background: var(--surface); margin: 15px 0; }
.empty b { font-size: 18px; display: block; margin-bottom: 8px; font-weight: 650; }
.empty p { font-size: 13px; }
.pagination { display: flex; justify-content: center; align-items: center; gap: 22px; margin: 30px 0 10px; color: var(--muted); font-size: 12px; }
.selection-bar { position: sticky; bottom: 20px; z-index: 10; max-width: 650px; margin: 24px auto 0; background: #182c2c; color: #fff; border: 1px solid #ffffff20; border-radius: 12px; padding: 12px 15px; display: flex; align-items: center; justify-content: space-between; gap: 10px; box-shadow: 0 10px 30px #172c2c30; }
.selection-bar .subtle { color: #d4d9c7; }
.selection-bar .subtle:hover { background: #ffffff12; }
#results .card,.chapter-row { user-select: none; }
.grid.chapter-browse { display: block; }
.comic-group { border: 1px solid var(--line); border-radius: 11px; padding: 14px; background: var(--surface); min-width: 0; }
.comic-group[open] { grid-column: 1/-1; }
.comic-group[open] summary .cover { max-width: 150px; }
.grouped-issues { margin-top: 18px; }
/* Inline manga: compact headers and true rows, independent of cover-card layout. */
.flat-series { margin: 10px 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); }
.flat-heading { display: grid; grid-template-columns: 40px minmax(0,1fr) auto; align-items: center; gap: 12px; }
.flat-heading .cover { width: 40px; height: 60px; border-radius: 5px; }
.flat-heading .cover::before { font-size: 25px; }
.flat-info { min-width: 0; }
.flat-info .card-category { margin: 0 0 2px; font-size: 9px; line-height: 1.35; }
.flat-info h3 { margin: 0; font-size: 14px; line-height: 1.45; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.flat-summary { margin-top: 3px; font-size: 11px; line-height: 1.4; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.flat-heading-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 4px; }
.flat-heading-actions > button { min-height: 36px; padding: 7px 9px; font-size: 11px; white-space: nowrap; }
.flat-heading-actions .flat-toggle[aria-expanded=true] { border-color: #c8d2bc; background: var(--accent-soft); color: var(--accent-hover); }
.flat-body { margin-top: 9px; }
.flat-load-status { margin: 0 2px 7px; font-size: 11px; line-height: 1.5; overflow-wrap: anywhere; }
.flat-load-status:empty { display: none; }
.flat-list { border-top: 1px solid var(--line); }
.flat-series .card.flat-chapter { display: grid; grid-template-columns: 22px minmax(0,1fr) auto; flex-direction: row; align-items: center; gap: 10px; min-height: 44px; margin: 0; padding: 4px 7px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; box-shadow: none; background: var(--surface); text-align: left; }
.flat-series .card.flat-chapter:hover { background: var(--surface-subtle); }
.flat-series .card.flat-chapter.selected { background: var(--accent-soft); box-shadow: inset 3px 0 var(--accent); }
.flat-series .card.flat-chapter:has(input:disabled) { background: #f3f3ed; }
.flat-chapter > input[type=checkbox] { width: 18px; height: 18px; margin: 0; justify-self: center; }
.flat-chapter-text { min-width: 0; }
.flat-chapter-text > strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; font-weight: 600; line-height: 1.45; }
.flat-chapter-meta { display: flex; align-items: baseline; gap: 8px; min-width: 0; font-size: 11px; line-height: 1.4; color: var(--muted); }
.flat-group { flex: 0 1 auto; max-width: 50%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.flat-group:empty { display: none; }
.flat-status { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.flat-series .flat-chapter > button { min-height: 34px; margin: 0; padding: 6px 9px; font-size: 11px; white-space: nowrap; }
.flat-pagination { display: grid; grid-template-columns: auto minmax(0,1fr) auto; align-items: center; gap: 10px; padding-top: 8px; }
.flat-pagination > button { min-height: 34px; padding: 6px 10px; font-size: 11px; }
.flat-page-label { min-width: 0; font-size: 11px; line-height: 1.4; text-align: center; color: var(--muted); overflow-wrap: anywhere; }
@media(max-width:760px) {
  .flat-series { padding: 9px 10px; }
  .flat-heading { grid-template-columns: 36px minmax(0,1fr); gap: 7px 10px; }
  .flat-heading .cover { width: 36px; height: 54px; }
  .flat-info h3 { font-size: 13px; }
  .flat-heading-actions { grid-column: 1/-1; justify-content: flex-start; }
  .flat-heading-actions > button { min-height: 40px; }
  .flat-heading-actions .flat-toggle { margin-right: auto; }
  .flat-series .card.flat-chapter { grid-template-columns: 20px minmax(0,1fr) auto; gap: 6px; min-height: 48px; padding-inline: 3px; }
  .flat-chapter > input[type=checkbox] { width: 20px; height: 20px; }
  .flat-chapter-text > strong { font-size: 12px; }
  .flat-chapter-meta { gap: 6px; }
  .flat-series .flat-chapter > button,.flat-pagination > button { min-height: 40px; padding-inline: 7px; }
  .flat-pagination { gap: 6px; }
}
/* Library and saved series. */
.library-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; padding: 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); margin-bottom: 15px; }
.library-controls > input { flex: 1; min-width: 200px; background: #fafaf5; }
.library-controls > select { min-width: 155px; }
.shared-genres { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 12px; }
.shared-genre-heading { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; margin-bottom: 10px; }
.shared-genre-heading input { margin-left: auto; width: min(100%, 240px); }
.shared-genre-list { display: grid; grid-template-columns: repeat(auto-fill,minmax(185px,1fr)); gap: 6px; max-height: 190px; overflow-y: auto; padding: 2px 4px 8px 2px; }
.shared-genre-option { display: grid; grid-template-columns: 18px minmax(0,1fr); align-items: center; gap: 2px 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; font-size: 12px; }
.shared-genre-option:has(input:checked) { background: #e7ebdf; border-color: #8a9e76; }
.shared-genre-option:focus-within { outline: 2px solid #8a9e76; outline-offset: 1px; }
.shared-genre-option input { grid-row: span 2; width: 15px; height: 15px; margin: 0; }
.shared-genre-option small { color: var(--muted); font-size: 10px; }
.shared-genres .advanced-actions { margin-top: 10px; }
.shared-genres > .footnote { margin: 8px 0 0; }
.library-controls label { display: flex; gap: 7px; align-items: center; font-size: 11px; color: var(--muted); }
#saved-status,#library-status { color: var(--muted); font-size: 12px; margin: 16px 0; }
#library-more { display: block; margin: 26px auto 0; }
/* Transfer center: useful status tabs and quieter secondary actions. */
.download-summary { padding: 17px 20px; margin-bottom: 22px; border: 1px solid #d5deca; border-radius: 10px; background: #e9edde; display: flex; justify-content: space-between; align-items: center; gap: 18px; }
#history-count { font-size: 13px; font-weight: 650; color: #526449; }
#folder-label { color: var(--muted); font-size: 11px; overflow-wrap: anywhere; }
.download-tabs { display: flex; gap: 24px; border-bottom: 1px solid var(--line); margin-bottom: 14px; overflow-x: auto; }
.download-tabs button { padding: 11px 0; background: none; border-bottom: 2px solid transparent; font-weight: 550; font-size: 12px; color: var(--muted); white-space: nowrap; }
.download-tabs button.active { color: var(--accent); border-color: var(--accent); }
.download-controls { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.download-controls #clear-history { margin-left: auto; }
#download-history-note { font-size: 11px; margin: 13px 0; }
#download-list { display: grid; gap: 10px; }
.download-row { padding: 19px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); display: grid; grid-template-columns: 38px minmax(0,1fr) auto; gap: 15px; align-items: start; }
.download-icon { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 10px; font-size: 20px; color: var(--accent); background: var(--accent-soft); }
.download-row h3 { font-size: 13px; line-height: 1.5; margin-bottom: 5px; overflow-wrap: anywhere; }
.download-row p { font-size: 11px; line-height: 1.6; margin-top: 5px; overflow-wrap: anywhere; }
.download-status { display: inline-flex; font-size: 9px; letter-spacing: .5px; text-transform: uppercase; color: var(--muted); }
.download-status.complete { color: var(--success); }
.download-status.failed,.download-status.held { color: var(--danger); }
.download-status.downloading,.download-status.scanning { color: var(--accent); }
.download-status.retrying { color: #ad7c26; }
.download-row progress { width: 100%; height: 6px; border: 0; border-radius: 10px; display: block; margin: 12px 0; accent-color: var(--accent); overflow: hidden; }
progress::-webkit-progress-bar { background: #e8ebdf; }
progress::-webkit-progress-value { background: var(--accent); border-radius: 10px; }
.download-row-actions { display: flex; flex-direction: column; gap: 6px; min-width: 118px; }
.download-row-actions button { font-size: 11px; }
.safety-result { font-size: 10px; }
.safety-result.passed { color: var(--success); }
.safety-result.blocked,.safety-result.unverified { color: var(--danger); }
#more-history { margin: 20px 0; }
.inline-help { border-top: 1px solid var(--line); padding: 16px 0; margin-top: 24px; font-size: 11px; color: var(--muted); }
/* Preferences grouped by task. */
.settings-grid { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); align-items: start; gap: 20px; max-width: 1100px; }
.settings-card { border: 1px solid var(--line); border-radius: 12px; padding: 24px; background: var(--surface); }
#settings-form { grid-column: 1/-1; }
.settings-card h2 { font-size: 16px; margin-bottom: 9px; }
.settings-card p { font-size: 12px; line-height: 1.85; margin-top: 8px; }
.settings-card label { display: block; font-size: 11px; color: var(--muted); margin: 18px 0 7px; }
.settings-card input { width: 100%; background: #fafaf5; }
.settings-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 14px; }
#stop-panel { margin-top: 14px; color: var(--danger); border-color: #e6d4c8; }
/* App dialogs: fixed header/action areas; independently scrolling content. */
dialog { width: min(940px,calc(100vw - 48px)); max-height: min(850px,90dvh); padding: 0; border: 1px solid #dedfd7; border-radius: 15px; background: var(--surface); color: var(--ink); box-shadow: 0 30px 100px #172c2c50; overflow: hidden; }
dialog[open] { display: flex; flex-direction: column; }
dialog::backdrop { background: #182c2c99; backdrop-filter: blur(5px); }
.dialog-heading { display: flex; justify-content: space-between; align-items: center; gap: 18px; padding: 22px 26px; border-bottom: 1px solid var(--line); background: var(--surface); flex-shrink: 0; }
.dialog-heading h2 { font-size: 21px; letter-spacing: -.5px; overflow-wrap: anywhere; }
.dialog-heading > div { min-width: 0; }
.dialog-heading > button { flex-shrink: 0; }
.eyebrow { font-size: 9px; text-transform: uppercase; letter-spacing: 1px; color: #bf4826; font-weight: 650; margin-bottom: 5px; }
.dialog-body { min-height: 0; overflow-y: auto; padding: 22px 26px; overscroll-behavior: contain; scrollbar-gutter: stable; }
.chapter-controls { display: flex; gap: 12px; flex-wrap: wrap; align-items: end; padding: 14px; background: #f0f0e9; border-radius: 9px; }
.chapter-controls label { display: grid; gap: 5px; color: var(--muted); font-size: 11px; flex: 1; min-width: 100px; }
.chapter-controls input,.chapter-controls select { width: 100%; }
.chapter-state-controls { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin: 13px 0; }
.chapter-state-controls label { display: flex; align-items: center; gap: 7px; font-size: 12px; }
#chapter-status { font-size: 12px; color: var(--muted); padding: 10px 0; }
.chapter-row { display: flex; gap: 14px; align-items: center; padding: 17px 10px; border-bottom: 1px solid var(--line); border-radius: 5px; cursor: pointer; }
.chapter-row > div { flex: 1; min-width: 0; }
.chapter-row strong { font-size: 13px; font-weight: 600; overflow-wrap: anywhere; }
.chapter-row small { display: block; margin-top: 4px; font-size: 11px; color: var(--muted); }
.chapter-row:hover:not(:has(input:disabled)),.chapter-row.selected { background: #e9edde; }
.chapter-row.selected { box-shadow: inset 3px 0 var(--accent); }
.chapter-row:has(input:disabled) > div:not(.chapter-source) { color: #8c9589; }
.chapter-row > .chapter-source { flex: 0 0 auto; display: grid; gap: 7px; text-align: right; max-width: 200px; }
.chapter-source a { color: #687b5c; font-size: 11px; }
.chapter-source button { min-height: 30px; padding: 5px 10px; font-size: 11px; }
.chapter-notice { border: 1px solid #eddfbf; background: #fffaef; color: #8b764c; border-radius: 8px; padding: 14px; margin: 10px 0; font-size: 12px; line-height: 1.7; }
.chapter-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 16px 26px; border-top: 1px solid var(--line); background: #f8f8f1; flex-shrink: 0; }
.chapter-actions .primary { margin-left: auto; }
#chapter-credit { font-size: 10px; }
#series-details { width: min(800px,calc(100vw - 48px)); }
.details-cover { width: 165px; float: left; margin: 0 24px 22px 0; }
.details-synopsis { white-space: pre-wrap; line-height: 1.85; font-size: 13px; }
.details-facts { clear: both; display: grid; grid-template-columns: 135px 1fr; gap: 12px 18px; margin-top: 24px; font-size: 12px; }
.details-facts dt { color: var(--muted); }
.details-facts dd { margin: 0; padding-bottom: 10px; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
#details-actions { padding: 16px 26px; border-top: 1px solid var(--line); margin: 0; background: #f8f8f1; flex-shrink: 0; }
#preview-dialog { width: min(1100px,calc(100vw - 48px)); height: 94dvh; max-height: 94dvh; }
#preview-dialog > .dialog-heading { padding: 12px 16px; }
#preview-title { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 18px; }
#preview-dialog > .dialog-body { flex: 1; display: grid; grid-template-rows: auto auto auto minmax(0,1fr); gap: 8px; min-height: 0; overflow: hidden; padding: 12px; background: #f7f6f2; scrollbar-gutter: auto; }
#preview-dialog > .dialog-body > .footnote { margin: 0; font-size: 11px; }
.preview-controls { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 10px; padding: 8px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); margin: 0; }
#preview-page-label { font-size: 12px; color: var(--muted); }
#preview-content { text-align: center; min-height: 0; min-width: 0; overflow: auto; overscroll-behavior: contain; background: #e4e7dd; border-radius: 8px; padding: 8px; }
#preview-content img { display: block; width: auto; height: auto; max-width: 100%; max-height: 100%; object-fit: contain; margin: 0 auto; }
#preview-content img.long-page { max-height: none; }
#preview-content iframe { display: block; width: 100%; height: 100%; border: 0; background: var(--surface); }
#preview-status { font-size: 12px; max-height: 4.5em; overflow: auto; }
@media(max-height:650px) {
  #preview-dialog > .dialog-body > .footnote { display: none; }
  #preview-dialog > .dialog-body { grid-template-rows: auto auto minmax(0,1fr); gap: 6px; padding: 8px; }
}
#help-dialog { width: min(560px,calc(100vw - 32px)); }
.guide-step { display: flex; gap: 16px; margin-bottom: 24px; }
.guide-step > b { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; color: var(--accent); background: var(--accent-soft); flex-shrink: 0; font-size: 12px; }
.guide-step p { font-size: 12px; line-height: 1.8; margin-top: 5px; }
.shortcut-row { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; border-top: 1px solid var(--line); font-size: 12px; }
#toast { position: fixed; bottom: 24px; right: 24px; z-index: 60; border: 1px solid #ffffff15; border-radius: 10px; background: #182c2c; color: white; box-shadow: 0 8px 30px #172c2c30; max-width: min(440px,calc(100vw - 32px)); padding: 15px 20px; font-size: 12px; line-height: 1.65; }
/* Responsive navigation and controls without tiny touch targets. */
@media(min-width:1650px) { .grid { grid-template-columns: repeat(auto-fill,minmax(265px,1fr)); } }
@media(max-width:1100px) and (min-width:761px) {
  :root { --rail: 78px; }
  .sidebar { padding: 24px 10px 18px; }
  .brand { padding: 0 11px; }
  .brand-name,.workspace-label,.nav-label,.sidebar-note { display: none; }
  .sidebar nav { margin-top: 35px; }
  .nav { padding: 13px; justify-content: center; position: relative; }
  .nav b { position: absolute; top: 3px; right: 0; min-width: 16px; font-size: 9px; padding: 1px 3px; background: #bf4826; color: white; }
  main { padding-inline: 24px; }
  main > header { margin-inline: -24px; padding-inline: 24px; }
  .discovery-controls select { max-width: 240px; }
}
@media(max-width:760px) {
  :root { --rail: 0px; }
  body { padding-bottom: calc(75px + env(safe-area-inset-bottom)); }
  .sidebar { width: 0; height: 0; padding: 0; border: 0; }
  .brand,.workspace-label,.sidebar-note { display: none; }
  .sidebar nav { position: fixed; inset: auto 0 0; background: #f7f6f2fa; backdrop-filter: blur(16px); display: flex; border-top: 1px solid var(--line); padding: 7px 8px calc(7px + env(safe-area-inset-bottom)); gap: 4px; box-shadow: 0 -3px 20px #182c2c04; }
  .nav { flex: 1; flex-direction: column; justify-content: center; gap: 3px; min-width: 0; min-height: 52px; padding: 5px 3px; color: #69776c; font-size: 10px; border-radius: 9px; position: relative; }
  .nav .icon { width: 20px; height: 20px; }
  .nav.active { background: var(--ink); color: white; box-shadow: none; }
  .nav:hover { color: var(--ink); background: var(--accent-soft); }
  .nav b { position: absolute; top: 1px; right: 13%; min-width: 15px; font-size: 8px; padding: 1px 3px; background: var(--accent); color: white; }
  main { margin-left: 0; padding: 0 18px 24px; }
  main > header { height: 62px; margin-inline: -18px; padding-inline: 18px; }
  .mobile-brand { display: block; font-size: 21px; color: var(--ink); font-weight: 750; letter-spacing: -.8px; }
  #page-context { display: none; }
  .command-search { min-width: 0; width: 38px; height: 38px; padding: 9px; font-size: 0; gap: 0; justify-content: center; }
  .command-search kbd { display: none; }
  .command-search .icon { width: 18px; height: 18px; flex-basis: 18px; }
  .page-heading { padding: 24px 0 20px; }
  h1 { font-size: 25px; }
  .page-heading p { font-size: 12px; }
  .discovery-workspace { padding: 0 14px 14px; }
  .source-switch { gap: 0; justify-content: space-between; }
  .source-switch button { padding: 13px 3px; }
  .source-switch button > span { font-size: 12px; }
  .source-switch small { font-size: 9px; }
  .search-box input { font-size: 13px; }
  .search-box .primary { padding-inline: 14px; min-height: 42px; }
  .manga-source-options { flex-wrap: wrap; gap: 7px; }
  .manga-source-options p { font-size: 10px; }
  .discovery-controls { flex-wrap: wrap; gap: 8px; }
  .discovery-controls label { width: 100%; }
  .discovery-controls select { flex: 1; max-width: none; }
  .discovery-controls > button { flex: 1; }
  #surprise-title { margin-left: 0; }
  .results-toolbar { padding-top: 23px; }
  .results-options { gap: 10px; }
  .browse-controls label { flex: 1; flex-direction: column; align-items: stretch; gap: 5px; }
  .browse-controls select { max-width: none; }
  .view-help { display: none; }
  .result-filters { width: 100%; }
  .grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 18px 12px; }
  .card { padding: 7px; }
  .card h3 { font-size: 12px; min-height: 36px; }
  .card-meta > button { min-height: 38px; padding: 7px; font-size: 10px; }
  .card-category { font-size: 8px; }
  .availability-badge { font-size: 9px; padding: 6px; }
  .check { width: 30px; height: 30px; }
  .check input { width: 18px; height: 18px; }
  .selection-bar { bottom: calc(80px + env(safe-area-inset-bottom)); flex-wrap: wrap; gap: 6px; padding: 10px; }
  .selection-bar .primary { flex: 1; }
  .library-controls { padding: 12px; }
  .library-controls > input { flex-basis: 100%; min-width: 0; }
  .library-controls > select { min-width: 0; flex: 1; }
  .download-summary { flex-direction: column; align-items: start; gap: 7px; padding: 14px; }
  .download-tabs { gap: 20px; }
  .download-controls { gap: 7px; }
  .download-controls > button { flex: 1; padding: 8px 10px; font-size: 11px; }
  .download-row { padding: 14px; gap: 11px; grid-template-columns: 32px minmax(0,1fr); }
  .download-icon { width: 32px; height: 32px; font-size: 18px; }
  .download-row-actions { grid-column: 2; flex-direction: row; flex-wrap: wrap; }
  .download-row-actions button { min-height: 38px; }
  .settings-grid { grid-template-columns: 1fr; gap: 16px; }
  .settings-card { padding: 20px; }
  .settings-actions { flex-wrap: wrap; }
  .settings-actions > button { flex: 1; }
  dialog,#series-details,#preview-dialog { width: calc(100vw - 20px); max-height: 92dvh; border-radius: 12px; }
  .dialog-heading { padding: 17px 18px; gap: 12px; }
  .dialog-heading h2 { font-size: 19px; }
  .dialog-body { padding: 17px 18px; }
  .chapter-controls { padding: 12px; gap: 10px; }
  .chapter-controls label { min-width: calc(50% - 10px); }
  .chapter-row { flex-wrap: wrap; gap: 10px; padding: 14px 5px; }
  .chapter-row input { width: 21px; height: 21px; }
  .chapter-row > .chapter-source { flex-basis: 100%; max-width: none; display: flex; align-items: center; justify-content: flex-end; }
  .chapter-source button { min-height: 38px; }
  .chapter-actions,#details-actions { padding: 12px 18px; }
  .chapter-actions .primary { flex-basis: 100%; margin-left: 0; }
  .tag-filters label { flex-basis: 100%; }
  .details-cover { width: 115px; margin-right: 17px; }
  .details-facts { grid-template-columns: 100px 1fr; gap: 10px; font-size: 11px; }
  .preview-controls { gap: 6px; padding: 6px; }
  #preview-page-label { order: 1; flex-basis: 100%; font-size: 11px; }
  .preview-controls button { padding-inline: 10px; font-size: 12px; }
  #toast { right: 16px; bottom: calc(86px + env(safe-area-inset-bottom)); }
}
@media(max-width:380px) {
  main { padding-inline: 12px; }
  main > header { margin-inline: -12px; padding-inline: 12px; }
  .source-switch button > span { font-size: 10px; }
  .source-switch small { font-size: 8px; }
  .search-box { flex-wrap: wrap; }
  .search-box .primary { flex-basis: 100%; }
  .card-meta > button { font-size: 9px; padding: 6px 4px; }
  .nav { font-size: 9px; }
  .details-cover { width: 105px; }
}
@media(prefers-reduced-motion:reduce) { *,*::before,*::after { transition: none !important; scroll-behavior: auto !important; } .card:hover .cover img { transform: none; } }

.skeleton-card{padding:8px;background:var(--surface);border:1px solid var(--line);border-radius:11px;overflow:hidden}
.skeleton-cover{aspect-ratio:2/3;background:#e4e7dd;border-radius:7px;animation:skeleton-pulse 1.5s ease-in-out infinite alternate}
.skeleton-line{height:10px;margin:14px 3px 0;background:#e4e7dd;border-radius:4px}.skeleton-line.short{width:60%;margin:9px 3px 6px}
@keyframes skeleton-pulse{to{opacity:.45}}
@media(prefers-reduced-motion:reduce){.skeleton-cover{animation:none}}

/* Compact states and long titles must fit the narrowest two-column cards. */
.header-context{display:flex;align-items:center;gap:12px}.header-connection{width:7px;height:7px;background:#638960;border-radius:50%;box-shadow:0 0 0 3px #63896012;flex-shrink:0}.header-connection.offline{background:#b2573c;box-shadow:0 0 0 3px #b2573c12}
.card-meta>button{min-width:0}.card-meta>button:first-of-type{white-space:normal;overflow-wrap:anywhere}

#library-grid .card h3{display:block;-webkit-line-clamp:unset;overflow:visible}

/* Keep the catalog near the top; large covers remain independent of page size. */
#discover .page-heading{padding:10px 0 8px;display:flex;align-items:baseline;gap:16px}
#discover .page-heading>div{display:flex;align-items:baseline;gap:16px}
#discover .page-heading h1{font-size:24px}#discover .page-heading p{margin:0;font-size:12px}
.page-size-control select{width:76px}.browse-controls .page-size-control{flex:0 0 auto}
.result-filters .quick-search{margin-top:14px;padding-top:10px;border-top:1px solid var(--line)}
#results .cover{border-radius:8px}#results .card h3{font-size:14px;min-height:42px}
.discovery-workspace { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 8px 16px; padding: 8px 14px; }
.discovery-workspace > .source-switch { grid-column: 1; grid-row: 1; margin: 0; border: 0; }
.discovery-workspace > .source-switch button { padding: 6px 0; }
.discovery-workspace > .manga-source-options { grid-column: 2; grid-row: 1; margin: 0; padding: 0; border: 0; background: transparent; }
.manga-source-options p { display: none; }
.discovery-workspace > .search-box { grid-column: 1 / -1; grid-row: 2; }
.discovery-workspace > .discovery-controls { grid-column: 1; grid-row: 3; margin: 0; align-items: center; gap: 8px; }
.discovery-workspace > .genre-shortcuts { grid-column: 1 / -1; }
.discovery-workspace:has(#shared-genres:not([hidden])) > .genre-shortcuts { display: none; }
.discovery-workspace > .shared-genres { grid-column: 2; grid-row: 3; border: 0; margin: 0; padding: 0; }
.shared-genres > summary { border: 1px solid var(--line); border-radius: 8px; padding: 9px 12px; font-size: 12px; font-weight: 600; color: var(--accent); white-space: nowrap; }
#shared-genre-count { margin-left: 8px; font-size: 10px; font-weight: 400; color: var(--muted); }
.discovery-workspace > .shared-genres[open] { grid-column: 1 / -1; grid-row: 4; padding-top: 8px; border-top: 1px solid var(--line); }
.shared-genres[open] > summary { width: fit-content; margin-bottom: 12px; }
.discovery-workspace > .advanced-discovery { grid-column: 1 / -1; margin-top: 0; padding-top: 8px; }
.results-toolbar { padding-top: 14px; }
.results-options { margin: 8px 0; }
.selection-hint { margin-bottom: 8px; }
#results.grid { grid-template-columns: repeat(auto-fill,minmax(260px,1fr)); }
.status.warning { color: #7a5c24; background: #fffbef; border: 1px solid #eadbb6; }
@media(min-width:1650px) { #results.grid { grid-template-columns: repeat(auto-fill,minmax(280px,1fr)); } }
@media(max-width:760px){
  #discover .page-heading,#discover .page-heading>div{gap:10px}
  #discover .page-heading p{display:none}
  .source-switch button{display:block;padding:10px 2px}
  .source-switch small{display:none}
  .discovery-workspace{padding:8px 12px;gap:8px}
  .discovery-workspace > .source-switch { grid-column: 1 / -1; }
  .discovery-workspace > .manga-source-options { grid-column: 1 / -1; grid-row: 2; }
  .discovery-workspace > .search-box { grid-row: 3; }
  .discovery-workspace > .discovery-controls { grid-column: 1 / -1; grid-row: 4; }
  .discovery-workspace > .shared-genres,.discovery-workspace > .shared-genres[open] { grid-column: 1 / -1; grid-row: 5; }
  #results.grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .discovery-controls label{width:auto;flex:1;min-width:0}
  .discovery-controls select{min-width:0;width:100%;max-width:100%}
  .discovery-controls>button{flex:0 0 auto;padding-inline:10px}
  #results .card h3{font-size:13px}
  .grid{gap:18px 10px}
}
@media(max-width:480px){
  .discovery-controls label{flex-basis:100%}
  .discovery-controls>button{flex:1}
  main{padding-inline:12px}main>header{margin-inline:-12px;padding-inline:12px;height:54px}
  .card{padding:5px}
}

.search-suggestions{display:flex;align-items:center;gap:7px 10px;flex-wrap:wrap;padding:11px 14px;margin:10px 0 15px;border:1px solid #d4dcc7;border-radius:8px;background:#eef1e5;font-size:12px;color:#596b4e}
.suggestion-link{background:transparent;color:#385542;text-decoration:underline;text-underline-offset:3px;font-size:13px;font-weight:650;padding:4px 3px;min-height:30px}.suggestion-link:hover{color:#243c2b}

/* Direct browsing routes and visible filter state, without a large hero area. */
.discovery-controls { flex-wrap: wrap; align-items: center; }
.discovery-shortcuts { display: flex; flex: 1; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; }
.feed-chip { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 38px; max-width: 100%; padding: 8px 12px; border: 1px solid transparent; border-radius: 8px; background: #eeeee8; color: #526457; font-size: 12px; font-weight: 600; line-height: 1.4; }
.feed-chip small { color: #617066; font-size: 10px; font-weight: 500; }
.feed-chip:hover:not(:disabled) { background: var(--accent-soft); color: var(--accent-hover); }
.feed-chip.active,.feed-chip[aria-pressed=true] { border-color: #c8d2bc; background: var(--accent-soft); color: var(--accent-hover); box-shadow: inset 0 -2px #bf48261c; }
.feed-chip.active small,.feed-chip[aria-pressed=true] small { color: #526449; }
.genre-shortcuts { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; margin-top: 9px; }
.genre-caption { flex-shrink: 0; margin-right: 3px; color: var(--muted); font-size: 11px; line-height: 1.5; }
.genre-chip { min-height: 31px; padding: 5px 10px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); color: #5e6c66; font-size: 11px; line-height: 1.4; }
.genre-chip:hover:not(:disabled),.genre-chip.active,.genre-chip[aria-pressed=true] { border-color: #c8d2bc; background: var(--accent-soft); color: var(--accent-hover); }
.active-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; margin: 10px 0 14px; min-width: 0; }
.filter-chip { display: inline-flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 32px; max-width: 100%; padding: 5px 8px 5px 10px; border: 1px solid #cdd7c2; border-radius: 7px; background: #e9edde; color: #385542; font-size: 11px; line-height: 1.5; text-align: left; }
.filter-chip > span:first-child { min-width: 0; overflow-wrap: anywhere; }
.filter-chip > span[aria-hidden] { display: inline-grid; place-items: center; flex: 0 0 17px; width: 17px; height: 17px; border-radius: 50%; background: #38554210; color: #385542; font-size: 14px; line-height: 1; }
.filter-chip:hover:not(:disabled) { background: #dfe7d5; border-color: #a9bb98; }
.filter-scope { color: #617066; font-size: 10px; }
.clear-filters { margin-left: auto; min-height: 32px; padding: 5px 8px; font-size: 11px; }

/* Quick look stays separate from selection and the bottom availability badge. */
.cover-quick-look { position: absolute; top: 8px; right: 8px; z-index: 4; display: inline-flex; align-items: center; justify-content: center; min-height: 32px; max-width: calc(100% - 54px); padding: 6px 8px; border: 1px solid #ffffff45; border-radius: 6px; background: #182c2cf5; color: white; font-size: 11px; font-weight: 600; line-height: 1.3; box-shadow: 0 2px 8px #172c2c25; opacity: 0; transform: translateY(-3px); pointer-events: none; transition: opacity .15s,transform .15s,background .15s; }
.card:hover .cover-quick-look,.card:focus-within .cover-quick-look,.cover-quick-look:focus-visible { opacity: 1; transform: none; pointer-events: auto; }
.cover-quick-look:hover { background: #a93d20; }
.cover-quick-look:focus-visible { outline: 2px solid white; outline-offset: 2px; box-shadow: 0 0 0 5px #182c2c; }
.card-category { color: var(--muted); font-size: 10px; letter-spacing: .55px; }
.card-meta > button:first-of-type { min-height: 37px; }

/* A small personal shelf reuses the existing cover cache and saved titles. */
.discovery-shelf { margin-top: 30px; padding-top: 22px; border-top: 1px solid var(--line); }
.shelf-heading { display: flex; align-items: end; justify-content: space-between; gap: 16px; }
.shelf-heading > div { min-width: 0; }
.shelf-heading h2 { font-size: 18px; }
.shelf-heading p { font-size: 12px; margin-top: 4px; }
.shelf-heading > button { flex-shrink: 0; }
.shelf-track { display: flex; gap: 18px; overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x proximity; scrollbar-width: thin; scrollbar-color: #bbc7ad transparent; margin: 10px -3px 0; padding: 6px 3px 14px; }
.shelf-card { display: flex; flex: 0 0 clamp(150px,12vw,180px); flex-direction: column; min-width: 0; scroll-snap-align: start; }
.shelf-cover { padding: 0; border: 1px solid #d4d9ce; box-shadow: 0 3px 8px #182c2c08; }
.shelf-cover:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.shelf-cover:hover img { transform: scale(1.025); }
.shelf-card .card-category { margin: 9px 0 0; font-size: 9px; }
.shelf-card h3 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; min-height: 36px; margin: 5px 0 9px; font-size: 13px; font-weight: 650; line-height: 1.4; }
.shelf-card > .secondary { width: 100%; min-height: 36px; margin-top: auto; padding: 7px; font-size: 11px; white-space: normal; }
.results-navigation { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 20px; margin: 26px 0 10px; }
.results-navigation .pagination { flex: 1; flex-wrap: wrap; gap: 12px 18px; min-width: 0; margin: 0; }
.results-navigation:has(.pagination[hidden]):has(#back-to-results[hidden]) { display: none; }
#back-to-results { margin-left: auto; flex-shrink: 0; font-size: 11px; }
#results-title { scroll-margin-top: 80px; }

@media(max-width:760px) {
  .discovery-shortcuts { flex-basis: 100%; flex-wrap: nowrap; overflow-x: auto; gap: 6px; margin: -3px; padding: 3px; scrollbar-width: thin; scrollbar-color: #bbc7ad transparent; }
  .feed-chip { flex-shrink: 0; min-height: 40px; padding: 8px 10px; }
  .genre-shortcuts { flex-wrap: nowrap; overflow-x: auto; margin: 7px -3px 0; padding: 3px; scrollbar-width: thin; scrollbar-color: #bbc7ad transparent; }
  .genre-chip { flex-shrink: 0; white-space: nowrap; }
  .active-filters { gap: 6px; }
  .card-category { font-size: 9px; }
  .discovery-shelf { margin-top: 24px; padding-top: 18px; }
  .shelf-heading { align-items: center; gap: 10px; }
  .shelf-heading h2 { font-size: 16px; }
  .shelf-heading p { font-size: 11px; }
  .shelf-heading > button { padding-inline: 10px; }
  .shelf-track { gap: 13px; }
  .shelf-card { flex-basis: 130px; }
  .shelf-card > .secondary { min-height: 40px; }
  .results-navigation { justify-content: center; gap: 13px; }
  #back-to-results { margin: 0 auto; }
}
@media(max-width:480px) {
  .results-navigation .pagination { flex-basis: 100%; }
  .results-navigation #page-label { flex-basis: 100%; order: -1; text-align: center; }
  .results-navigation #back-to-results { width: 100%; }
  .shelf-heading { align-items: start; }
}
@media(hover:none),(pointer:coarse) {
  .cover-quick-look { opacity: 1; transform: none; pointer-events: auto; min-height: 36px; }
  .feed-chip,.genre-chip,.filter-chip { min-height: 40px; }
}
@media(prefers-reduced-motion:reduce) { .shelf-cover:hover img { transform: none; } }

/* Remote access uses the same warm palette and native browser downloads. */
.logout-form { margin: 0; display: flex; }
.logout-form button { white-space: nowrap; }
.card-meta > .device-download { min-height: 40px; }
.login-page .login-shell { margin: 0; padding: 48px 20px; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 28px; }
.login-page .brand { padding: 0; font-size: 29px; }
.login-card { width: min(100%,420px); padding: 34px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 12px 42px #182c2c08; }
.login-eyebrow { color: var(--accent); font-size: 10px; font-weight: 750; letter-spacing: 1.7px; margin-bottom: 12px; }
.login-card h1 { font-size: 30px; line-height: 1.2; letter-spacing: -.7px; margin-bottom: 12px; }
.login-intro { font-size: 14px; color: var(--muted); line-height: 1.7; }
.login-card form { display: flex; flex-direction: column; margin-top: 24px; }
.login-card label { font-size: 12px; font-weight: 600; margin: 0 0 7px; }
.login-card input:not([type=hidden]) { min-height: 46px; font-size: 16px; margin-bottom: 20px; }
.login-card .primary { min-height: 46px; font-size: 14px; margin-top: 2px; }
.login-error { margin-top: 20px; padding: 12px 14px; color: var(--danger); border: 1px solid #e6d4c8; border-radius: 8px; background: #fbefea; font-size: 13px; overflow-wrap: anywhere; }
.login-caption { font-size: 12px; color: var(--muted); text-align: center; line-height: 1.8; }
@media(max-width:480px) { .login-page .login-shell { padding: 28px 16px; gap: 22px; } .login-card { padding: 26px 22px; } }
