@font-face {
  font-family: "Noto Sans Local";
  src: url("/static/assets/noto-sans.woff2") format("woff2");
  font-display: swap;
  font-weight: 400;
}
@font-face {
  font-family: "Noto Sans Local";
  src: url("/static/assets/noto-sans-bold.woff2") format("woff2");
  font-display: swap;
  font-weight: 600 800;
}
@font-face {
  font-family: "Noto Serif Local";
  src: url("/static/assets/noto-serif.woff2") format("woff2");
  font-display: swap;
  font-weight: 400 600;
}
:root {
  --bg: #f4eadb;
  --surface: #fff7ea;
  --side: #efdfce;
  --text: #352129;
  --muted: #694d54;
  --line: #dec8bb;
  --accent: #752940;
  --accent-hover: #5d1f33;
  --accent-ink: #6b253a;
  --accent-soft: #eed9d7;
  --on-accent: #fff6e8;
  --ring: #913850;
  --danger: #9c2c39;
  --danger-hover: #7e2431;
  --danger-soft: #f5ded7;
  --shadow: 0 16px 38px #411b2926;
  --hero-ink: #451f2d;
  --hero-muted: #65434a;
  --hero-wash: linear-gradient(90deg, #f1dfca 3%, #f1dfcaf7 28%, #f1dfcad9 42%, #f1dfca29 72%, transparent);
  --hero-wash-narrow: linear-gradient(90deg, #f1dfcaf7 3%, #f1dfcaec 47%, #f1dfca9e 75%, #f1dfca19);
  --sans: "Noto Sans Local", system-ui, sans-serif;
  --serif: "Noto Serif Local", Georgia, serif;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #280f1b;
  --surface: #391624;
  --side: #30111f;
  --text: #f8e9d4;
  --muted: #d9bbaa;
  --line: #613348;
  --accent: #efcdaa;
  --accent-hover: #f9dbba;
  --accent-ink: #f2d6b7;
  --accent-soft: #502638;
  --on-accent: #381622;
  --ring: #e8bb98;
  --danger: #ffafa8;
  --danger-hover: #ffc0b9;
  --danger-soft: #5a2535;
  --shadow: 0 16px 38px #1a071170;
  --hero-ink: #ffefdb;
  --hero-muted: #f7d8c0;
  --hero-wash: linear-gradient(90deg, #381522 3%, #381522f5 28%, #381522db 42%, #38152233 76%, transparent);
  --hero-wash-narrow: linear-gradient(90deg, #381522fa 3%, #381522ed 47%, #3815229e 75%, #38152229);
  color-scheme: dark;
}
*, *::before, *::after { box-sizing: border-box; }
html { background: var(--bg); }
body { margin: 0; color: var(--text); font: 14px/1.5 var(--sans); }
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
button { color: inherit; cursor: pointer; }
a { color: inherit; }
h1, h2, h3, p { margin: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--ring); outline-offset: 3px; }
.skip-link { position: fixed; top: 10px; left: 10px; padding: 8px 12px; z-index: 20; background: var(--surface); transform: translateY(-160%); }
.skip-link:focus { transform: none; }
[data-icon] { display: inline-flex; align-items: center; justify-content: center; flex: none; }
.ui-icon { display: block; width: 18px; height: 18px; }
.startup { min-height: 100dvh; display: grid; place-content: center; color: var(--muted); }
.button, .icon-button, .nav-item, .text-button, .profile-button, .format-button, .continue-card, .book-link {
  transition: background-color .18s ease, color .18s ease, border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}
.button { display: inline-flex; justify-content: center; align-items: center; gap: 9px; min-height: 42px; border: 1px solid transparent; border-radius: 9px; padding: 8px 14px; font-size: 13px; font-weight: 650; text-decoration: none; white-space: nowrap; }
.button.primary { background: var(--accent); color: var(--on-accent); }
.button.primary:hover { background: var(--accent-hover); }
.button.secondary { border-color: var(--line); background: var(--surface); color: var(--accent-ink); }
.button.secondary:hover { border-color: var(--ring); }
.button.danger { background: var(--danger); color: var(--on-accent); }
.button.danger:hover { background: var(--danger-hover); }
.button:disabled { opacity: .63; cursor: wait; }
.icon-button { display: inline-grid; place-content: center; width: 38px; height: 38px; border-radius: 8px; border: 1px solid transparent; background: none; color: var(--muted); }
.icon-button:hover { color: var(--accent-ink); background: var(--accent-soft); }
.text-button { display: inline-flex; align-items: center; gap: 7px; padding: 6px 0; background: none; border: 0; color: var(--accent-ink); font-size: 13px; font-weight: 600; }
.text-button:hover { color: var(--text); }
.wide { width: 100%; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; width: fit-content; max-width: 100%; color: var(--text); font: 600 26px/1.12 var(--serif); letter-spacing: -.045em; }
.brand-name { min-width: 0; }
.brand-icon { width: 39px; height: 39px; border-radius: 11px; background: var(--accent); color: var(--on-accent); }
.brand-icon .ui-icon { width: 25px; height: 25px; }
.library-app { min-height: 100dvh; display: grid; grid-template-columns: 228px minmax(0, 1fr); grid-template-rows: 72px 1fr; }
.sidebar { grid-column: 1; grid-row: 1 / -1; position: sticky; top: 0; align-self: start; height: 100dvh; display: flex; flex-direction: column; padding: 24px 16px 16px; background: var(--side); border-right: 1px solid var(--line); z-index: 5; overflow: auto; }
.sidebar .brand { margin: 0 0 38px; padding-inline: 4px; gap: 8px; font-size: clamp(18px, 1.52vw, 20px); }
.sidebar .brand-icon { width: 35px; height: 35px; }
.sidebar .brand-name { max-width: 8em; }
.side-navigation { display: grid; gap: 4px; }
.side-label { margin: 0 12px 6px; color: var(--muted); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .12em; }
.tags-label { margin-top: 24px; }
.nav-item { display: flex; align-items: center; gap: 12px; min-height: 42px; width: 100%; padding: 8px 11px; border: 0; border-radius: 8px; color: var(--muted); background: none; text-align: left; font-size: 13px; }
.nav-item:hover { background: var(--surface); color: var(--text); }
.nav-item[aria-current="page"] { background: var(--accent-soft); color: var(--accent-ink); font-weight: 700; box-shadow: inset 2px 0 var(--accent); }
.nav-item .ui-icon { width: 17px; height: 17px; }
.nav-count { margin-inline-start: auto; min-width: 19px; color: inherit; text-align: center; font-size: 11px; font-variant-numeric: tabular-nums; }
.tag-navigation .nav-item { min-height: 36px; }
.tag-navigation .nav-item span:last-child { min-width: 0; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; }
.tag-dot { width: 8px; height: 8px; margin: 0 5px 0 4px; border-radius: 50%; background: #6a937b; flex: none; }
.tag-dot.tag-1 { background: #ba8f61; }
.tag-dot.tag-2 { background: #8d8eb3; }
.tag-dot.tag-3 { background: #bc8683; }
.tag-dot.tag-4 { background: #7d9dad; }
.side-bottom { margin-top: auto; padding-top: 10px; border-top: 1px solid var(--line); }
#demo-button { margin-top: 4px; }
.topbar { grid-column: 2; grid-row: 1; position: sticky; top: 0; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 0 38px; border-bottom: 1px solid var(--line); background: var(--bg); z-index: 3; min-width: 0; }
.catalog-search { display: flex; align-items: center; width: min(390px, 100%); min-width: 0; gap: 10px; height: 40px; padding: 0 11px; background: var(--surface); color: var(--muted); border: 1px solid var(--line); border-radius: 9px; }
.catalog-search:focus-within { border-color: var(--ring); box-shadow: 0 0 0 2px var(--accent-soft); }
.catalog-search input { width: 100%; padding: 0; border: 0; outline: 0; background: transparent; color: var(--text); font-size: 12px; }
.catalog-search input::placeholder { color: var(--muted); opacity: 1; }
.catalog-search kbd { border: 1px solid var(--line); border-radius: 4px; min-width: 19px; height: 20px; text-align: center; font-size: 12px; color: var(--muted); }
.header-actions { display: flex; align-items: center; gap: 16px; }
.upload-top { border-radius: 8px; }
.profile-wrap { position: relative; }
.profile-button { display: flex; align-items: center; gap: 4px; border: 0; background: none; border-radius: 10px; padding: 2px; color: var(--muted); }
.profile-button:hover { background: var(--accent-soft); }
.avatar { display: grid; place-content: center; text-transform: uppercase; width: 34px; height: 34px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-ink); font-size: 12px; font-weight: 700; }
.profile-chevron .ui-icon { width: 13px; height: 13px; }
.profile-menu { position: absolute; right: 0; top: calc(100% + 10px); z-index: 5; width: min(240px, 80vw); padding: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 13px; box-shadow: var(--shadow); }
.profile-menu strong, .profile-menu small { display: block; padding: 0 8px; overflow-wrap: anywhere; }
.profile-menu small { margin: 4px 0 8px; color: var(--muted); }
.mobile-nav, .mobile-brand { display: none; }
.library-main { width: 100%; max-width: 1600px; justify-self: center; padding: 27px 38px 56px; min-width: 0; }
.hero { position: relative; isolation: isolate; overflow: hidden; display: flex; align-items: center; min-height: 284px; padding: 35px 41px; border-radius: 18px; color: var(--hero-ink); background: var(--side) url("/static/assets/reading-room.webp") 58% center / cover no-repeat; box-shadow: 0 9px 24px #411b2926; }
.hero::before { content: ""; z-index: -1; position: absolute; inset: 0; background: var(--hero-wash); }
.hero-copy { position: relative; }
.hero-kicker { color: var(--hero-muted); font-size: 10px; font-weight: 700; letter-spacing: .18em; text-transform: uppercase; }
.hero h1 { margin: 11px 0 10px; font: 400 clamp(37px, 4.25vw, 64px)/1.06 var(--serif); letter-spacing: -.062em; }
.hero-description { margin-bottom: 22px; color: var(--hero-muted); font-size: 14px; }
.hero-button { min-height: 40px; background: var(--accent); color: var(--on-accent); padding-inline: 13px; }
.hero-button:hover { background: var(--accent-hover); }
.hero-button .ui-icon { width: 16px; height: 16px; }
.hero-arrow { margin-left: 5px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 15px; }
.section-head h2 { font: 500 27px/1.2 var(--serif); letter-spacing: -.052em; }
.continue-section { margin: 26px 0 0; }
.continue-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.continue-card { display: grid; grid-template-columns: 52px minmax(0, 1fr) 13px; gap: 12px; align-items: center; min-width: 0; min-height: 106px; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: 0 2px 6px #26382c0a; text-decoration: none; }
.continue-card:hover { border-color: var(--ring); box-shadow: 0 4px 16px #411b2918; transform: translateY(-2px); }
.continue-card .cover { height: 70px; border-radius: 4px 5px 5px 4px; }
.continue-card .cover-fallback span:last-child { display: none; }
.continue-data { min-width: 0; }
.continue-card strong, .continue-author { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.continue-card strong { font-size: 13px; font-weight: 700; }
.continue-author { margin-top: 3px; font-size: 11px; color: var(--muted); }
.continue-card > [data-icon] { color: var(--accent-ink); }
.continue-card > [data-icon] .ui-icon { width: 15px; }
.progress-line { display: flex; align-items: center; gap: 8px; margin-top: 9px; color: var(--muted); font-size: 10px; font-weight: 600; }
.progress-line progress { display: block; width: 100%; height: 4px; border: 0; border-radius: 10px; background: var(--line); accent-color: var(--accent); }
.progress-line progress::-webkit-progress-bar { background: var(--line); border-radius: 10px; }
.progress-line progress::-webkit-progress-value, .progress-line progress::-moz-progress-bar { background: var(--accent); border-radius: 10px; }
.progress-line progress::-webkit-progress-value { background: var(--accent); border-radius: 10px; }
.catalog { margin-top: 27px; }
.hero[hidden] ~ .catalog { margin-top: 0; }
.catalog-heading { margin-bottom: 12px; }
.heading-label { display: flex; align-items: baseline; gap: 12px; min-width: 0; }
.heading-label h2 { overflow-wrap: anywhere; }
.catalog-count { color: var(--muted); font-size: 12px; white-space: nowrap; }
#select-books { min-height: 36px; }
#select-books .ui-icon { width: 16px; height: 16px; }
#select-books[aria-pressed="true"] { border-color: var(--ring); background: var(--accent-soft); }
.bulk-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 14px; padding: 8px 12px; margin-bottom: 14px; border: 1px solid var(--line); border-radius: 9px; background: var(--accent-soft); }
.bulk-selection, .bulk-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 7px 12px; }
.bulk-selection > span { color: var(--muted); font-size: 12px; }
.bulk-actions { gap: 6px; }
.bulk-actions .button { min-height: 34px; padding: 6px 9px; font-size: 12px; }
#select-visible:disabled, .bulk-actions .button:disabled { opacity: .63; cursor: default; }
.catalog-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.format-filters, .view-actions, .view-controls { display: flex; align-items: center; gap: 6px; }
.format-button { min-height: 34px; padding: 0 11px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); color: var(--muted); font-size: 11px; font-weight: 650; white-space: nowrap; }
.format-button:hover { color: var(--text); border-color: var(--ring); }
.format-button[aria-pressed="true"] { color: var(--accent-ink); background: var(--accent-soft); border-color: transparent; }
.view-actions { gap: 10px; }
.sort-control { display: flex; align-items: center; height: 35px; gap: 7px; padding: 0 8px; border: 1px solid var(--line); border-radius: 7px; color: var(--muted); background: var(--surface); }
.sort-control select { appearance: none; cursor: pointer; background: transparent; border: 0; color: var(--text); font-size: 11px; }
.sort-control .ui-icon { width: 14px; height: 14px; }
.view-controls { gap: 2px; padding: 2px; border-radius: 7px; background: var(--surface); border: 1px solid var(--line); }
.view-controls .icon-button { width: 30px; height: 29px; border-radius: 5px; }
.view-controls .icon-button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent-ink); }
.view-controls .ui-icon { width: 15px; height: 15px; }
.book-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 20px 16px; }
.book-card { position: relative; min-width: 0; }
.book-card:has(.book-menu[open]) { z-index: 2; }
.book-card.is-selected .cover { outline: 2px solid var(--ring); outline-offset: -2px; }
.book-link { display: block; text-decoration: none; border-radius: 7px; min-width: 0; }
a.book-link:hover .cover { transform: translateY(-3px); box-shadow: 0 7px 16px #1a2e2043; }
.book-cover-wrap { position: relative; display: block; }
.cover { display: grid; overflow: hidden; position: relative; background: var(--accent-soft); transition: transform .18s ease, box-shadow .18s ease; }
.cover-image { display: block; width: 100%; height: 100%; object-fit: cover; }
.cover::after { content: ""; position: absolute; inset: 0; pointer-events: none; border: 1px solid #222b2620; border-radius: inherit; background: linear-gradient(90deg, #242b2450, #242b2410 3%, transparent 6%); }
.book-card .cover { aspect-ratio: .738; border-radius: 6px 11px 11px 6px; box-shadow: 0 5px 11px #1a2e202b; }
.cover-fallback { display: flex; flex-direction: column; gap: 7px; align-items: center; justify-content: center; padding: 12px; text-align: center; background: radial-gradient(ellipse at 75% 80%, #ffffff29, transparent 60%), #69263c; color: #fff3e0; }
.cover-fallback[data-tone="1"] { background-color: #7e4c40; }
.cover-fallback[data-tone="2"] { background-color: #5e324b; }
.cover-fallback[data-tone="3"] { background-color: #594257; }
.cover-fallback .ui-icon { width: 24px; height: 24px; }
.cover-fallback > span:last-child { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; font-family: var(--serif); }
.format-badge { position: absolute; top: 8px; left: 8px; padding: 3px 6px; border-radius: 4px; background: #191f1be8; color: #fff; font-size: 9px; font-weight: 700; letter-spacing: .04em; }
.book-indicator { position: absolute; top: 8px; right: 8px; display: grid; place-items: center; width: 22px; height: 20px; border-radius: 4px; background: #191f1be8; color: #f7d58d; }
.book-indicator .ui-icon { width: 13px; height: 13px; fill: currentColor; }
.book-check { position: absolute; z-index: 1; top: 6px; right: 6px; display: grid; place-items: center; width: 35px; height: 35px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); box-shadow: 0 2px 7px #1a2e2032; cursor: pointer; }
.book-check:focus-within { outline: 2px solid var(--ring); outline-offset: 2px; }
.book-check input { width: 16px; height: 16px; margin: 0; cursor: inherit; }
.book-card:has(.book-check) .book-indicator { display: none; }
.book-card-data { min-width: 0; display: block; padding: 9px 0 2px; }
.book-card strong, .book-author { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; min-width: 0; }
.book-card strong { display: -webkit-box; min-height: 2.64em; color: var(--text); font: 600 15px/1.32 var(--serif); white-space: normal; overflow-wrap: anywhere; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.book-author { padding-right: 32px; font-size: 11px; color: var(--muted); margin-top: 2px; }
.list-view .book-card strong { display: block; min-height: 0; white-space: nowrap; }
.list-view .book-author { padding-right: 0; }
.book-card .progress-line { margin-top: 6px; }
.book-trash-status { display: block; overflow: hidden; min-width: 0; margin-top: 6px; color: var(--muted); font-size: 10px; white-space: nowrap; text-overflow: ellipsis; }
.book-menu { position: absolute; inset-inline: 0; bottom: 20px; pointer-events: none; }
.book-menu summary { display: grid; list-style: none; width: 32px; height: 32px; margin-inline-start: auto; cursor: pointer; pointer-events: auto; }
.book-menu summary .ui-icon { stroke-width: 2.4; }
.book-menu summary::-webkit-details-marker { display: none; }
.book-menu[open] summary { color: var(--accent-ink); background: var(--accent-soft); }
.book-menu-items { position: absolute; inset-inline-end: 0; top: calc(100% + 4px); z-index: 1; display: grid; width: min(212px, calc(100vw - 28px)); gap: 2px; padding: 5px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); box-shadow: var(--shadow); pointer-events: auto; }
.book-menu:not([open]) .book-menu-items { display: none; }
.book-menu.opens-up .book-menu-items { top: auto; bottom: calc(100% + 4px); }
.book-menu-items .nav-item { min-height: 35px; gap: 8px; padding: 6px 8px; color: var(--text); text-decoration: none; font-size: 12px; }
.book-menu-items .nav-item:hover { background: var(--accent-soft); }
.book-menu-items .danger-link { color: var(--danger); }
.book-menu-items .danger-link:hover { background: var(--danger-soft); }
.book-menu-items button:disabled { opacity: .55; cursor: default; }
.book-grid.list-view { display: grid; grid-template-columns: 1fr; gap: 5px; }
.list-view .book-card { padding: 7px 40px 7px 8px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); }
.list-view .book-link { display: grid; grid-template-columns: 40px minmax(0, 1fr); align-items: center; gap: 14px; }
.list-view .book-cover-wrap { width: 40px; }
.list-view .book-card-data { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)) minmax(0, 160px); align-items: center; gap: 10px; padding: 0; }
.list-view .format-badge { top: auto; right: -2px; left: auto; bottom: 2px; padding: 1px 3px; font-size: 7px; }
.list-view .book-indicator { top: 3px; right: 3px; width: 17px; height: 16px; }
.list-view .book-indicator .ui-icon { width: 11px; height: 11px; }
.list-view .book-card:has(.book-check) { padding-inline-start: 46px; }
.list-view .book-check { inset-inline: 7px auto; top: 50%; transform: translateY(-50%); }
.list-view .book-card.is-selected { border-color: var(--ring); }
.list-view .book-menu { inset-inline: 8px; bottom: 50%; transform: translateY(50%); }
.list-view .book-trash-status { margin-top: 0; }
.list-view .cover-fallback span:last-child { display: none; }
.empty { padding: 35px 20px; border: 1px dashed var(--line); background: var(--surface); border-radius: 13px; text-align: center; }
.empty-icon { width: 44px; height: 44px; border-radius: 13px; background: var(--accent-soft); color: var(--accent-ink); }
.empty-icon .ui-icon { width: 21px; height: 21px; }
.empty h3 { margin-top: 10px; font: 400 24px/1.2 var(--serif); }
.empty p { margin: 6px 0 15px; color: var(--muted); }

.auth { min-height: 100dvh; display: grid; grid-template-columns: 1.12fr 1fr; background: var(--surface); }
.auth-art { min-height: 100%; background: linear-gradient(#38152225, #3815224d), #381522 url("/static/assets/reading-room.webp") 78% center / cover no-repeat; }
.auth-area { width: min(100% - 48px, 373px); align-self: center; justify-self: center; padding-block: 34px; }
.auth-area .brand { margin-bottom: 34px; }
.auth h1 { margin-bottom: 22px; font: 400 clamp(31px, 4vw, 45px)/1.12 var(--serif); letter-spacing: -.05em; }
.auth form, .library-dialog form { display: grid; gap: 14px; }
.auth form label, .library-dialog form label { display: grid; gap: 5px; color: var(--text); font-size: 13px; font-weight: 600; }
.auth input:not([type="checkbox"]), .library-dialog input:not([type="checkbox"]) { width: 100%; min-height: 41px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--text); }
input[type="checkbox"] { accent-color: var(--accent); }
.form-hint { color: var(--muted); font-size: 12px; }
.form-error { color: var(--danger); font-size: 12px; }
.library-dialog { width: min(94vw, 525px); max-height: 90dvh; border: 1px solid var(--line); border-radius: 15px; margin: auto; padding: 21px; background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.library-dialog::backdrop { background: #35142182; }
.dialog-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 15px; }
.dialog-head h2 { font: 400 26px/1.2 var(--serif); letter-spacing: -.05em; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }
.purge-copy { color: var(--muted); overflow-wrap: anywhere; }
.purge-error { margin-top: 10px; }
#purge-dialog .dialog-actions { margin-top: 18px; }
.drop-zone { position: relative; display: grid; justify-items: center; gap: 5px; padding: 24px; border: 1px dashed var(--ring); background: var(--bg); border-radius: 11px; cursor: pointer; text-align: center; color: var(--muted); }
.drop-zone:focus-within, .drop-zone.dragging { background: var(--accent-soft); outline: 2px solid var(--ring); }
.drop-zone strong { color: var(--text); margin-top: 4px; }
.drop-zone small { margin-top: 5px; }
.drop-zone input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; cursor: pointer; }
.upload-modes, .upload-pair-options { display: flex; flex-wrap: wrap; gap: 7px; }
.upload-modes { margin-bottom: 14px; }
.upload-modes button { flex: 1 1 auto; }
.upload-modes button[aria-pressed="true"] { border-color: var(--ring); background: var(--accent-soft); color: var(--accent-ink); }
#upload-pair-form { gap: 11px; }
#upload-pair-form input[type="file"] { min-width: 0; }
#upload-pair-form [data-upload-role].dragging input { outline: 2px solid var(--ring); }
.upload-queue { list-style: none; display: grid; gap: 6px; padding: 0; margin: 10px 0 0; }
.upload-queue li { display: grid; gap: 4px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 7px; overflow-wrap: anywhere; }
.upload-queue small { color: var(--muted); }
.upload-queue .upload-error { color: var(--danger); }
.upload-queue progress { width: 100%; height: 7px; accent-color: var(--accent); }
.drop-overlay { position: fixed; z-index: 8; inset: 12px; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 14px; padding: 20px; text-align: center; color: var(--accent-ink); background: var(--surface); border: 2px dashed var(--ring); border-radius: 16px; pointer-events: none; }
.drop-overlay .ui-icon { height: 40px; width: 40px; }
.toasts { position: fixed; right: 17px; bottom: 18px; z-index: 15; width: min(365px, calc(100% - 34px)); pointer-events: none; }
.toast { margin-top: 8px; padding: 12px 15px; background: var(--surface); color: var(--text); border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: 9px; box-shadow: var(--shadow); }
.toast.error { border-left-color: var(--danger); }

@media (min-width: 1510px) {
  .library-app { grid-template-columns: 244px minmax(0, 1fr); }
  .hero { min-height: 296px; }
}
@media (max-width: 1160px) {
  .library-app { grid-template-columns: 196px minmax(0, 1fr); }
  .topbar, .library-main { padding-inline: 25px; }
  .hero { padding-inline: 27px; }
  .book-grid { gap: 16px 12px; }
}
@media (max-width: 1030px) {
  .book-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .continue-grid { gap: 8px; }
  .continue-card { grid-template-columns: 41px minmax(0, 1fr); gap: 8px; min-height: 88px; padding: 8px; }
  .continue-card .cover { height: 59px; }
  .continue-card > [data-icon] { display: none; }
}
@media (max-width: 825px) {
  .library-app { grid-template-columns: minmax(0, 1fr); grid-template-rows: 64px 1fr; }
  .topbar { grid-column: 1; }
  .sidebar { display: none; position: fixed; top: 0; bottom: 0; width: min(270px, 85vw); box-shadow: var(--shadow); }
  .sidebar.open { display: flex; animation: sidebar-in .22s ease-out; }
  @keyframes sidebar-in { from { transform: translateX(-100%); } to { transform: none; } }
  .sidebar-shade { position: fixed; inset: 0; border: 0; background: #35142168; z-index: 4; }
  .mobile-nav { display: inline-grid; margin-left: -5px; }
  .mobile-brand { display: inline-flex; font-size: 17px; margin-right: auto; }
  .mobile-brand .brand-name { max-width: 8em; }
  .mobile-brand .brand-icon { display: none; }
  .topbar .catalog-search { flex: 1; }
}
@media (max-width: 610px) {
  .library-app { grid-template-rows: auto 1fr; }
  .topbar { flex-wrap: wrap; gap: 6px; padding: 9px 14px 10px; }
  .mobile-brand { font-size: clamp(14px, 4vw, 17px); }
  .topbar .catalog-search { order: 4; flex: 0 0 100%; width: 100%; height: 38px; }
  .catalog-search kbd, .profile-chevron { display: none; }
  .header-actions { gap: 7px; }
  .upload-top { min-height: 37px; padding: 5px 9px; font-size: 12px; }
  .upload-top .ui-icon { width: 16px; height: 16px; }
  .library-main { padding: 14px 14px 35px; }
  .hero { min-height: 233px; padding: 22px 15px; background-position: 65% center; }
  .hero::before { background: var(--hero-wash-narrow); }
  .hero h1 { font-size: clamp(29px, 9.2vw, 43px); }
  .hero-description { font-size: 12px; max-width: 215px; }
  .hero-kicker { font-size: 9px; }
  .continue-section, .catalog { margin-top: 22px; }
  .section-head { margin-bottom: 11px; gap: 7px; }
  .section-head h2 { font-size: 22px; }
  .catalog-heading .heading-label { flex-wrap: wrap; gap: 2px 8px; }
  #select-books { min-height: 34px; gap: 6px; padding: 5px 8px; font-size: 12px; }
  .section-link { font-size: 11px; min-height: 32px; white-space: nowrap; }
  .section-link .ui-icon { width: 15px; height: 15px; }
  .continue-grid { display: grid; grid-auto-flow: column; grid-template-columns: none; grid-auto-columns: minmax(155px, 66%); overflow-x: auto; padding: 3px 2px 6px; margin: -3px -2px 0; scroll-snap-type: x mandatory; }
  .continue-card { scroll-snap-align: start; }
  .catalog-toolbar { flex-wrap: wrap; gap: 9px; }
  .format-filters { flex-wrap: wrap; }
  .view-actions { margin-left: auto; }
  .book-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 10px; }
  .book-card strong { font-size: 13px; }
  .list-view .book-card-data { grid-template-columns: 1fr; gap: 2px; }
  .list-view .book-author { margin-top: 0; }
  .list-view .progress-line { margin-top: 2px; }
  .auth { grid-template-columns: 1fr; grid-template-rows: 24dvh 1fr; }
  .auth-art { background-position: 75% 44%; }
  .auth-area { align-self: start; padding-top: 23px; }
  .auth-area .brand { margin-bottom: 18px; }
}
@media (max-width: 390px) {
  .upload-top { width: 37px; padding-inline: 0; }
  .upload-top > span:last-child { display: none; }
}
@media (max-width: 370px) {
  .book-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .section-head h2 { font-size: 20px; }
}
@media (width > 1030px) {
  .book-grid:not(.list-view) .book-card:nth-child(6n+1) .book-menu-items { inset-inline: 0 auto; }
}
@media (610px < width <= 1030px) {
  .book-grid:not(.list-view) .book-card:nth-child(5n+1) .book-menu-items { inset-inline: 0 auto; }
}
@media (370px < width <= 610px) {
  .book-grid:not(.list-view) .book-card:nth-child(3n+1) .book-menu-items { inset-inline: 0 auto; }
}
@media (width <= 370px) {
  .book-grid:not(.list-view) .book-card:nth-child(2n+1) .book-menu-items { inset-inline: 0 auto; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
