:root {
  --paper: #f5f0e6;
  --paper-2: #eee6d8;
  --paper-3: #e3d8c6;
  --ink: #1f2823;
  --muted: #6e746d;
  --line: rgba(45, 52, 47, .14);
  --green: #2f5c4b;
  --green-dark: #173d31;
  --green-wash: #d9e4dc;
  --ochre: #b36a39;
  --white: #fffdf8;
  --shadow: 0 24px 70px rgba(45, 43, 34, .14);
  --transcript-size: 1.24rem;
  color-scheme: light;
}

html[data-theme="dark"] {
  --paper: #111613;
  --paper-2: #181f1b;
  --paper-3: #263029;
  --ink: #ece7dc;
  --muted: #a2aaa4;
  --line: rgba(222, 231, 224, .14);
  --green: #79a792;
  --green-dark: #9ccab5;
  --green-wash: #253a31;
  --ochre: #d68a55;
  --white: #1a211d;
  --shadow: 0 24px 70px rgba(0, 0, 0, .34);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--paper); color: var(--ink); }
body { font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; }
button, select { cursor: pointer; }
button { color: inherit; }
img { display: block; max-width: 100%; }

.app-shell { min-height: 100vh; }
.library-pane { min-width: 0; width: 100%; height: 100vh; display: flex; flex-direction: column; background: var(--paper); }
.reader-pane { display: none; min-width: 0; width: 100%; height: 100vh; overflow-y: auto; background: var(--white); position: relative; }
.app-shell.reader-open .library-pane { display: none; }
.app-shell.reader-open .reader-pane { display: block; }

.topbar { padding: 24px 28px 18px; display: flex; align-items: center; justify-content: space-between; }
.brand-mark { width: 48px; height: 38px; flex: 0 0 auto; display: grid; place-items: center; color: var(--green-dark); }
.brand-mark svg { width: 100%; height: 100%; overflow: visible; }
.brand-mark path { fill: none; stroke: currentColor; stroke-width: 3.2; stroke-linecap: round; stroke-linejoin: round; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 9px; }
.transcription-status { display: flex; align-items: center; gap: 7px; padding: 7px 9px; border-radius: 9px; background: var(--green-wash); color: var(--green-dark); font-size: .64rem; font-weight: 750; }
.transcription-status[hidden] { display: none; }
.theme-toggle { width: 36px; height: 36px; display: grid; place-items: center; flex: 0 0 auto; border: 1px solid var(--line); border-radius: 50%; background: var(--white); color: var(--ink); font-size: 1rem; line-height: 1; }
.theme-toggle:hover { background: var(--green-wash); color: var(--green-dark); }
.phone-access-button { min-height: 36px; padding: 0 12px; border: 1px solid var(--line); border-radius: 18px; background: var(--white); color: var(--ink); font-size: .7rem; font-weight: 750; }
.phone-access-button:hover { background: var(--green-wash); color: var(--green-dark); }
.transcription-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ochre); box-shadow: 0 0 0 4px rgba(179,106,57,.12); animation: transcript-pulse 1.8s ease-in-out infinite; }
@keyframes transcript-pulse { 50% { opacity: .45; transform: scale(.82); } }

.phone-access-dialog { width: min(92vw, 480px); margin: auto; padding: 0; border: 0; border-radius: 20px; background: transparent; color: var(--ink); box-shadow: var(--shadow); }
.phone-access-dialog::backdrop { background: rgba(10, 16, 13, .62); backdrop-filter: blur(5px); }
.phone-access-card { position: relative; padding: 34px; border: 1px solid var(--line); border-radius: 20px; background: var(--white); }
.phone-access-card h2 { margin: 6px 0 8px; font: 600 2rem/1.05 Georgia, "Times New Roman", serif; letter-spacing: -.025em; }
.phone-access-intro, .phone-access-note { color: var(--muted); line-height: 1.55; }
.phone-access-intro { margin: 0 0 18px; }
.phone-access-url { display: block; margin-bottom: 12px; padding: 13px 14px; overflow-wrap: anywhere; border-radius: 10px; background: var(--paper); color: var(--green-dark); font-size: .9rem; font-weight: 750; text-decoration: none; }
.phone-copy-button { width: 100%; min-height: 44px; }
.phone-access-code { margin: 16px 0 20px; padding: 14px; display: flex; align-items: center; justify-content: space-between; gap: 16px; border: 1px solid var(--line); border-radius: 11px; }
.phone-access-code span { color: var(--muted); font-size: .72rem; font-weight: 700; }
.phone-access-code strong { color: var(--ochre); font: 750 1.35rem/1 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .14em; }
.phone-setup-steps { margin: 22px 0 18px; padding-left: 22px; color: var(--ink); font-size: .88rem; line-height: 1.65; }
.phone-access-note { margin: 0; padding-top: 16px; border-top: 1px solid var(--line); font-size: .78rem; }
.phone-dialog-close { position: absolute; top: 14px; right: 14px; width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 50%; background: var(--paper); color: var(--muted); font-size: 1.25rem; line-height: 1; }
.delete-book-dialog { width: min(92vw, 590px); max-height: min(88dvh, 760px); margin: auto; padding: 0; border: 0; border-radius: 22px; background: transparent; color: var(--ink); box-shadow: 0 30px 90px rgba(40,18,13,.28); }
.delete-book-dialog::backdrop { background: rgba(16,13,11,.68); backdrop-filter: blur(7px); }
.delete-book-card { position: relative; padding: 34px; overflow-y: auto; border: 1px solid rgba(145,67,48,.19); border-radius: 22px; background: var(--white); }
.delete-book-card h2 { margin: 6px 42px 10px 0; font: 600 1.85rem/1.12 Georgia, "Times New Roman", serif; letter-spacing: -.025em; }
.delete-kicker { color: #a84e3d; }
.delete-book-intro { margin: 0 0 20px; color: var(--muted); font-size: .86rem; line-height: 1.55; }
.delete-location-list { display: grid; gap: 7px; max-height: 270px; overflow-y: auto; padding: 8px; border: 1px solid var(--line); border-radius: 14px; background: var(--paper); }
.delete-location-list > p { margin: 12px; color: var(--muted); font-size: .78rem; }
.delete-location-item { display: grid; grid-template-columns: 30px minmax(0,1fr); gap: 10px; align-items: center; padding: 9px 10px; border-radius: 10px; background: var(--white); }
.delete-location-icon { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; background: rgba(168,78,61,.1); color: #a84e3d; font-size: .75rem; font-weight: 800; }
.delete-location-item strong, .delete-location-item small { display: block; }
.delete-location-item strong { font-size: .76rem; }
.delete-location-item small { margin-top: 3px; overflow-wrap: anywhere; color: var(--muted); font-size: .63rem; line-height: 1.35; }
.delete-blocked { margin: 12px 0 0; padding: 11px 12px; border-left: 3px solid #b15542; background: rgba(177,85,66,.09); color: #934331; font-size: .75rem; line-height: 1.45; }
.delete-confirm-label { display: block; margin: 18px 0 7px; color: var(--muted); font-size: .72rem; }
.delete-confirm-input { width: 100%; min-height: 45px; padding: 0 13px; border: 1px solid var(--line); border-radius: 10px; outline: 0; background: var(--paper); color: var(--ink); font-weight: 800; letter-spacing: .08em; }
.delete-confirm-input:focus { border-color: rgba(168,78,61,.55); box-shadow: 0 0 0 3px rgba(168,78,61,.09); }
.delete-dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.danger-button { min-height: 39px; padding: 0 14px; border: 1px solid #a84e3d; border-radius: 10px; background: #a84e3d; color: #fff; font-size: .72rem; font-weight: 800; }
.danger-button:hover:not(:disabled) { background: #8f3e30; }
.danger-button:disabled { opacity: .42; cursor: not-allowed; }

.search-wrap { margin: 0 28px; min-height: 50px; border: 1px solid var(--line); border-radius: 14px; background: var(--white); display: flex; align-items: center; gap: 10px; padding: 0 13px; box-shadow: 0 5px 18px rgba(49, 51, 42, .04); }
.search-wrap:focus-within { border-color: rgba(47, 92, 75, .55); box-shadow: 0 0 0 3px rgba(47, 92, 75, .09); }
.search-icon { color: var(--green); font-size: 1.45rem; line-height: 1; transform: rotate(-15deg); }
.search-wrap input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: .94rem; }

.search-results { position: absolute; z-index: 40; top: 132px; left: 28px; width: min(640px, calc(100vw - 56px)); max-height: 56vh; overflow: auto; padding: 8px; background: var(--white); border: 1px solid var(--line); border-radius: 15px; box-shadow: var(--shadow); }
.search-result { width: 100%; display: grid; grid-template-columns: 42px 1fr auto; gap: 11px; text-align: left; border: 0; border-radius: 11px; padding: 9px; background: transparent; }
.search-result:hover { background: var(--green-wash); }
.search-result img, .search-result-cover { width: 42px; height: 56px; object-fit: cover; border-radius: 5px; background: var(--paper-3); }
.search-result strong { display: block; font-family: Georgia, serif; font-size: .92rem; }
.search-result p { margin: 4px 0 0; color: var(--muted); font-size: .75rem; line-height: 1.35; }
.search-result time { color: var(--ochre); font-size: .72rem; font-weight: 700; }

.library-toolbar { padding: 13px 28px; display: flex; align-items: center; justify-content: space-between; gap: 10px; border-bottom: 1px solid var(--line); }
.filter-chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.filter-chips::-webkit-scrollbar { display: none; }
.chip { border: 0; background: transparent; padding: 8px 10px; border-radius: 9px; color: var(--muted); font-size: .75rem; font-weight: 650; white-space: nowrap; }
.chip span { margin-left: 4px; opacity: .65; }
.chip:hover { background: rgba(47, 92, 75, .07); color: var(--ink); }
.chip.active { background: var(--green-dark); color: white; }
.toolbar-actions { min-width: 0; display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.status-control { min-width: 0; }
.book-metadata-select { appearance: none; -webkit-appearance: none; background-image: none; }
.toolbar-menu, .category-filter { position: relative; }
.toolbar-menu summary, .category-filter summary { list-style: none; min-height: 33px; display: flex; align-items: center; gap: 5px; padding: 0 10px; border: 1px solid var(--line); border-radius: 9px; background: rgba(255,253,248,.22); color: var(--ink); font-size: .7rem; font-weight: 720; cursor: pointer; white-space: nowrap; transition: border-color .16s ease, background .16s ease, box-shadow .16s ease, transform .16s ease; }
.toolbar-menu summary::-webkit-details-marker, .category-filter summary::-webkit-details-marker { display: none; }
.toolbar-menu summary:hover, .category-filter summary:hover { border-color: rgba(47,92,75,.28); background: var(--white); box-shadow: 0 5px 16px rgba(35,45,38,.06); }
.toolbar-menu[open] summary, .category-filter[open] summary { border-color: rgba(47,92,75,.28); background: var(--white); color: var(--green-dark); box-shadow: 0 0 0 3px rgba(47,92,75,.07), 0 7px 18px rgba(35,45,38,.08); transform: translateY(-1px); }
.category-filter summary::after { content: none; }
.category-filter.active summary { background: var(--green-wash); border-color: transparent; color: var(--green-dark); }
.category-filter summary span:not(:empty) { min-width: 18px; height: 18px; display: grid; place-items: center; border-radius: 50%; background: var(--green-dark); color: white; font-size: .58rem; }
.premium-menu { border: 1px solid rgba(45,52,47,.12); border-radius: 15px; background: linear-gradient(145deg, rgba(255,253,248,.99), rgba(248,244,235,.98)); box-shadow: 0 22px 55px rgba(36,41,36,.18), 0 5px 14px rgba(36,41,36,.08), inset 0 1px 0 rgba(255,255,255,.8); backdrop-filter: blur(18px) saturate(1.12); animation: premium-menu-in .15s cubic-bezier(.2,.8,.2,1); transform-origin: top right; }
@keyframes premium-menu-in { from { opacity: 0; transform: translateY(-5px) scale(.975); } to { opacity: 1; transform: translateY(0) scale(1); } }
.toolbar-menu-popover { position: absolute; z-index: 70; top: calc(100% + 9px); min-width: 210px; display: grid; gap: 3px; padding: 7px; }
.status-control .toolbar-menu-popover { left: 0; transform-origin: top left; }
.sort-control .toolbar-menu-popover { right: 0; }
.toolbar-menu-popover button { min-height: 38px; display: grid; grid-template-columns: 20px minmax(0,1fr); align-items: center; gap: 7px; padding: 7px 10px; border: 0; border-radius: 9px; background: transparent; color: var(--ink); text-align: left; font-size: .72rem; font-weight: 680; }
.toolbar-menu-popover button:hover { background: rgba(47,92,75,.075); }
.toolbar-menu-popover button.active { background: var(--green-wash); color: var(--green-dark); }
.premium-menu-check { color: transparent; font-size: .72rem; font-weight: 900; }
.toolbar-menu-popover button.active .premium-menu-check { color: var(--green-dark); }
.category-menu { position: absolute; z-index: 70; top: calc(100% + 9px); right: 0; width: 260px; display: grid; gap: 3px; padding: 10px; }
.category-menu-heading { display: flex; justify-content: space-between; align-items: center; padding: 4px 5px 7px; }
.category-menu-heading strong { font-family: Georgia, serif; font-size: .9rem; }
.category-menu-heading button { border: 0; background: transparent; color: var(--ochre); font-size: .66rem; font-weight: 700; }
.category-menu label { display: flex; align-items: center; gap: 8px; min-height: 34px; padding: 5px 7px; border-radius: 7px; color: var(--ink); font-size: .72rem; cursor: pointer; }
.category-menu label:hover { background: var(--paper); }
.category-menu input { width: 17px; height: 17px; margin: 0; display: grid; place-items: center; appearance: none; border: 1px solid rgba(47,92,75,.28); border-radius: 5px; background: var(--white); }
.category-menu input::before { content: "✓"; color: transparent; font-size: .68rem; font-weight: 900; transform: scale(.7); transition: transform .12s ease; }
.category-menu input:checked { border-color: var(--green-dark); background: var(--green-dark); }
.category-menu input:checked::before { color: white; transform: scale(1); }
.chapter-menu { position: relative; width: min(72%, 520px); color: var(--ink); }
.chapter-menu summary { min-height: 34px; display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 0 12px; list-style: none; border: 1px solid transparent; border-radius: 9px; background: transparent; color: var(--ink); font-weight: 720; cursor: pointer; transition: border-color .16s ease, background .16s ease, box-shadow .16s ease; }
.chapter-menu summary::-webkit-details-marker { display: none; }
.chapter-menu summary::after { content: "⌄"; color: var(--muted); font-size: .8rem; transition: transform .16s ease; }
.chapter-menu summary span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chapter-menu summary:hover { border-color: rgba(47,92,75,.22); background: var(--paper); }
.chapter-menu[open] summary { border-color: rgba(47,92,75,.28); background: var(--white); color: var(--green-dark); box-shadow: 0 0 0 3px rgba(47,92,75,.07), 0 7px 18px rgba(35,45,38,.08); }
.chapter-menu[open] summary::after { transform: rotate(180deg); }
.chapter-menu-popover { position: absolute; z-index: 80; top: calc(100% + 8px); right: 0; width: min(600px, calc(100vw - 48px)); max-height: min(55vh, 460px); overflow-y: auto; padding: 8px; }
.chapter-menu-popover button { width: 100%; min-height: 42px; display: grid; grid-template-columns: 16px 28px minmax(0,1fr) auto; gap: 8px; align-items: start; padding: 10px; border: 0; border-radius: 10px; background: transparent; color: var(--ink); text-align: left; transition: background .14s ease, color .14s ease, transform .14s ease; }
.chapter-menu-popover button:hover { background: rgba(47,92,75,.08); transform: translateX(2px); }
.chapter-menu-popover button.active { background: var(--green-wash); color: var(--green-dark); }
.chapter-menu-popover button.active .premium-menu-check { color: var(--green-dark); }
.chapter-menu-number, .chapter-menu-popover time { color: var(--muted); font-size: .62rem; font-variant-numeric: tabular-nums; }
.chapter-menu-number { padding-top: 2px; font-weight: 800; letter-spacing: .04em; }
.chapter-menu-title { min-width: 0; white-space: normal; overflow-wrap: anywhere; font-size: .74rem; font-weight: 700; line-height: 1.38; }
.chapter-menu-popover time { padding: 2px 0 0 8px; }
.icon-button, .round-button { border: 1px solid var(--line); background: transparent; border-radius: 8px; min-width: 33px; height: 33px; }
.icon-button.active, .icon-button:hover { background: var(--green-wash); border-color: transparent; color: var(--green-dark); }

.library-content { min-height: 0; flex: 1; overflow: auto; padding: 0 28px 36px; }
.library-summary { position: sticky; top: 0; z-index: 5; padding: 15px 0 10px; display: flex; justify-content: space-between; align-items: baseline; background: linear-gradient(var(--paper) 75%, rgba(245,240,230,0)); }
.library-summary p, .library-summary span { margin: 0; color: var(--muted); font-size: .72rem; }
.library-summary p { font-weight: 650; color: var(--ink); }
.book-table-header { display: grid; grid-template-columns: 48px minmax(0, 1fr) 64px 140px 94px 92px; gap: 12px; align-items: center; min-height: 30px; padding: 0 7px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); color: var(--muted); font-size: .6rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.book-table-header[hidden] { display: none; }
.book-table-header span:nth-child(3), .book-table-header span:nth-child(6) { text-align: center; }
.book-table-header span:nth-child(4) { padding-left: 6px; }

.book-list.table-view { display: flex; flex-direction: column; }
.book-row { position: relative; display: grid; grid-template-columns: 48px minmax(0, 1fr) 64px 140px 94px 92px; gap: 12px; align-items: center; min-height: 76px; padding: 8px 7px; border-bottom: 1px solid var(--line); transition: background .16s ease, transform .16s ease; }
.book-row:hover { background: rgba(255,253,248,.72); }
.book-row.active { background: var(--green-wash); }
.book-cover { width: 43px; height: 58px; object-fit: cover; border-radius: 5px; box-shadow: 0 5px 13px rgba(32,38,32,.16); background: var(--paper-3); }
.book-cover-fallback { width: 43px; height: 58px; border-radius: 5px; background: linear-gradient(145deg, var(--green), var(--green-dark)); color: white; display: grid; place-items: center; padding: 5px; text-align: center; font-family: Georgia, serif; font-size: .6rem; }
.book-cover-play { position: relative; width: 43px; padding: 0; border: 0; border-radius: 5px; background: transparent; overflow: hidden; box-shadow: 0 5px 13px rgba(32,38,32,.16); }
.book-cover-play .book-cover { box-shadow: none; }
.book-cover-play:hover { transform: translateY(-1px); box-shadow: 0 7px 16px rgba(32,38,32,.2); }
.book-cover-play:focus-visible { outline: 3px solid rgba(47,92,75,.28); outline-offset: 2px; }
.book-main { min-width: 0; }
.book-main-head { min-width: 0; display: flex; align-items: flex-start; gap: 5px; }
.book-title-button { display: block; width: 100%; min-width: 0; padding: 4px 0; border: 0; background: transparent; text-align: left; border-radius: 5px; }
.book-title-button:hover .book-title, .book-title-button:focus-visible .book-title { color: var(--green); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.book-title-button:focus-visible { outline: 3px solid rgba(47,92,75,.12); }
.book-title { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: .94rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.book-author { margin: 4px 0 0; color: var(--muted); font-size: .69rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.metadata-cell { min-width: 0; position: relative; }
.metadata-cell::after { content: "⌄"; position: absolute; right: 6px; top: 50%; transform: translateY(-55%); color: var(--muted); font-size: .66rem; pointer-events: none; }
.book-metadata-select { width: 100%; min-width: 0; height: 30px; border: 1px solid transparent; border-radius: 6px; background: transparent; color: var(--ink); padding: 0 6px; outline: 0; font-size: .66rem; font-weight: 650; text-overflow: ellipsis; }
.book-metadata-select:hover { background: var(--white); border-color: var(--line); }
.book-metadata-select:focus { background: var(--white); border-color: rgba(47,92,75,.5); box-shadow: 0 0 0 3px rgba(47,92,75,.08); }
.fnf-cell .book-metadata-select { padding: 0; text-align: center; text-align-last: center; font-weight: 800; }
.fnf-cell::after { right: 4px; }
.book-duration { color: var(--muted); font-size: .69rem; }
.row-progress { display: flex; flex-direction: column; gap: 5px; }
.row-progress-track { width: 100%; height: 4px; background: var(--paper-3); overflow: hidden; border-radius: 10px; }
.row-progress-fill { height: 100%; width: 0; background: var(--ochre); border-radius: inherit; }
.row-progress span { font-size: .63rem; color: var(--muted); }
.book-badges { display: flex; justify-content: flex-end; align-items: center; gap: 5px; }
.book-flags, .status-badges { display: flex; gap: 4px; }
.book-flag-button { width: 28px; height: 28px; display: grid; place-items: center; padding: 0; border: 1px solid var(--line); border-radius: 50%; background: rgba(255,253,248,.72); color: var(--muted); font-size: .9rem; font-weight: 800; line-height: 1; }
.book-flag-button:hover { border-color: rgba(47,92,75,.34); color: var(--green-dark); background: var(--white); }
.book-flag-button.favorite.active { border-color: transparent; background: #f1dcd6; color: #a44d43; }
.book-flag-button.favorite.double { width: 36px; border-radius: 14px; letter-spacing: -3px; padding-right: 3px; }
.book-flag-button.keep.active { border-color: transparent; background: var(--green-wash); color: var(--green-dark); }
.tiny-badge { min-width: 22px; height: 22px; padding: 0 5px; border-radius: 7px; display: grid; place-items: center; background: rgba(47,92,75,.09); color: var(--green); font-size: .61rem; font-weight: 700; }
.book-more { display: none; position: relative; flex: 0 0 auto; }
.book-more summary { width: 24px; height: 28px; display: grid; place-items: center; border: 0; border-radius: 0; background: transparent; color: var(--muted); font-size: 1.05rem; font-weight: 850; line-height: 1; list-style: none; cursor: pointer; }
.book-more summary::-webkit-details-marker { display: none; }
.book-more summary:hover, .book-more[open] summary { background: transparent; color: var(--green-dark); }
.book-more-menu { position: absolute; z-index: 70; top: 34px; right: 0; width: 174px; padding: 7px; display: grid; gap: 3px; }
.book-more-menu button { min-height: 38px; display: flex; align-items: center; gap: 9px; padding: 7px 10px; border: 0; border-radius: 9px; background: transparent; color: var(--ink); text-align: left; font-size: .72rem; font-weight: 700; }
.book-more-menu button:hover { background: rgba(47,92,75,.075); }
.book-more-menu button.active { background: var(--green-wash); color: var(--green-dark); }
.book-more-icon { width: 24px; color: var(--muted); text-align: center; font-size: .84rem; font-weight: 850; }
.book-more-menu button.active .book-more-icon { color: #a44d43; }
.book-more-menu button.keep.active .book-more-icon { color: var(--green-dark); }

.book-list.grid-view { display: grid; grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); gap: 22px 15px; }
.grid-view .book-row { display: block; padding: 0; border: 0; background: transparent; min-height: 0; }
.grid-view .book-row:hover { z-index: 2; transform: translateY(-3px); }
.grid-view .book-row:has(.book-more[open]) { z-index: 60; }
.grid-view .book-row:has(.book-more[open]) .book-more { z-index: 61; }
.grid-view .book-cover-play { width: 100%; border-radius: 9px; }
.grid-view .book-cover, .grid-view .book-cover-fallback { width: 100%; height: auto; aspect-ratio: 1 / 1; border-radius: 9px; }
.grid-view .book-main { padding: 9px 2px 0; }
.grid-view .book-title-button { flex: 1; width: auto; }
.grid-view .book-more { display: block; margin-top: 1px; }
.grid-view .book-title { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.24; }
.grid-view .metadata-cell, .grid-view .book-duration, .grid-view .status-badges { display: none; }
.grid-view .book-badges { display: none; }
.grid-view .row-progress { padding: 8px 2px 0; }
.library-player { flex: 0 0 auto; position: relative; z-index: 12; display: grid; grid-template-columns: minmax(150px, 1fr) minmax(130px, .8fr) auto; align-items: center; gap: 14px; padding: 9px 28px max(9px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: rgba(255,253,248,.97); box-shadow: 0 -8px 24px rgba(45,43,34,.07); backdrop-filter: blur(12px); }
.library-player[hidden] { display: none; }
.library-player-book { min-width: 0; display: grid; grid-template-columns: 36px minmax(0,1fr); gap: 9px; align-items: center; padding: 0; border: 0; background: transparent; text-align: left; }
.library-player-book img { width: 36px; height: 44px; border-radius: 4px; object-fit: cover; box-shadow: 0 3px 9px rgba(32,38,32,.16); }
.library-player-copy { min-width: 0; }
.library-player-copy strong, .library-player-copy small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.library-player-copy strong { font-family: Georgia, serif; font-size: .78rem; }
.library-player-copy small { margin-top: 3px; color: var(--muted); font-size: .61rem; }
.library-player-book:hover strong { color: var(--green); }
.library-player-timeline { min-width: 0; display: grid; grid-template-columns: minmax(70px,1fr) auto; gap: 8px; align-items: center; }
.library-player-timeline input { min-width: 0; width: 100%; accent-color: var(--green-dark); }
.library-player-time { color: var(--muted); font-size: .58rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.library-player-controls { display: flex; align-items: center; gap: 4px; }
.mini-skip, .mini-play { position: relative; display: grid; place-items: center; border: 0; border-radius: 50%; background: transparent; color: var(--green-dark); }
.mini-skip { width: 34px; height: 34px; }
.mini-skip:hover { background: var(--green-wash); }
.mini-skip .skip-arrow { font: 1.45rem/1 Arial, sans-serif; }
.mini-skip .skip-value { position: absolute; left: 50%; top: 52%; transform: translate(-50%,-50%); font-size: .48rem; font-weight: 850; }
.mini-play { width: 38px; height: 38px; padding-left: 2px; background: var(--green-dark); color: white; font-size: .72rem; }
.empty-library { text-align: center; padding: 70px 20px; color: var(--muted); }
.empty-library h2 { font-family: Georgia, serif; color: var(--ink); }
.library-offline p { margin-bottom: 20px; }

.reader-empty { min-height: 100%; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; padding: 60px; }
.reader-empty[hidden], .reader-content[hidden] { display: none; }
.reader-empty h2 { margin: 12px 0 8px; font-family: Georgia, serif; font-size: clamp(2rem, 4vw, 3.5rem); font-weight: 500; letter-spacing: -.04em; }
.reader-empty > p:last-child { max-width: 430px; color: var(--muted); line-height: 1.65; }
.empty-rings { width: 130px; height: 130px; position: relative; margin-bottom: 32px; }
.empty-rings span { position: absolute; inset: 0; margin: auto; border: 1px solid rgba(47,92,75,.25); border-radius: 50%; }
.empty-rings span:nth-child(2) { inset: 20px; }
.empty-rings span:nth-child(3) { inset: 42px; background: var(--green-dark); box-shadow: 0 0 0 12px var(--green-wash); }

.reader-content { min-height: 100%; padding: 22px clamp(24px, 4vw, 54px) 64px; }
.reader-header { display: flex; justify-content: space-between; align-items: center; min-height: 42px; }
.reader-close { border: 0; background: transparent; color: var(--muted); padding: 7px 0; }
.reader-close span { margin-left: 5px; }
.reader-header-actions { display: flex; gap: 8px; }
.secondary-button, .primary-button { border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; background: transparent; font-size: .72rem; font-weight: 700; }
.secondary-button:hover { background: var(--paper); }
.primary-button { background: var(--green-dark); border-color: var(--green-dark); color: white; }
.primary-button:hover { background: var(--green); }

.book-hero { display: grid; grid-template-columns: 136px minmax(0,1fr); gap: 26px; align-items: end; padding: 28px 0 24px; }
.hero-cover-wrap { position: relative; }
.hero-cover { width: 136px; height: 136px; border-radius: 12px; object-fit: cover; box-shadow: 0 18px 38px rgba(32,38,32,.23); }
.hero-copy h2 { margin: 8px 0 6px; font-family: Georgia, serif; font-size: clamp(1.65rem, 3vw, 2.7rem); font-weight: 500; line-height: 1.05; letter-spacing: -.035em; }
.hero-author { margin: 0; color: var(--muted); font-size: .9rem; }
.hero-meta { margin-top: 12px; display: flex; gap: 8px; flex-wrap: wrap; }
.meta-pill { padding: 5px 8px; background: var(--paper); border-radius: 7px; color: var(--muted); font-size: .64rem; }

.player-card { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 17px 0 19px; }
.chapter-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; font-size: .72rem; color: var(--muted); }
.progress-slider { width: 100%; height: 4px; margin: 0; accent-color: var(--green-dark); }
.time-row { display: flex; justify-content: space-between; margin-top: 6px; color: var(--muted); font-variant-numeric: tabular-nums; font-size: .66rem; }
.transport-row { margin-top: 9px; display: flex; justify-content: center; align-items: center; gap: 22px; }
.play-button { width: 58px; height: 58px; border: 0; border-radius: 50%; background: var(--green-dark); color: white; font-size: 1.1rem; padding-left: 5px; box-shadow: 0 8px 22px rgba(23,61,49,.24); }
.play-button:hover { transform: scale(1.03); }
.transport-button { width: 46px; height: 46px; border: 0; border-radius: 50%; background: transparent; position: relative; display: grid; place-items: center; color: var(--green-dark); }
.transport-button:hover { background: var(--green-wash); }
.transport-button .skip-arrow { font-size: 2rem; line-height: 1; font-family: Arial, sans-serif; }
.transport-button .skip-value { position: absolute; left: 50%; top: 51%; transform: translate(-50%,-50%); font-size: .58rem; line-height: 1; font-weight: 850; font-variant-numeric: tabular-nums; }
.speed-control { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 8px; padding: 5px 7px; font-size: .7rem; }
.speed-control select { border: 0; background: transparent; outline: 0; appearance: none; font-weight: 700; }

.reader-tabs { position: sticky; top: 0; z-index: 10; display: flex; gap: 24px; padding-top: 19px; background: linear-gradient(var(--white) 84%, rgba(255,253,248,0)); }
.reader-tab { border: 0; border-bottom: 2px solid transparent; padding: 9px 0 11px; background: transparent; color: var(--muted); font-size: .72rem; font-weight: 700; }
.reader-tab.active { color: var(--green-dark); border-color: var(--ochre); }
.reader-tab span { margin-left: 3px; color: var(--ochre); }
.reader-delete { margin-left: auto; border: 0; padding: 9px 0 11px; background: transparent; color: #a84e3d; font-size: .7rem; font-weight: 750; }
.reader-delete:hover { color: #853727; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

.transcript-tools { padding: 19px 0 11px; display: flex; gap: 8px; align-items: center; }
.transcript-search { flex: 1; height: 38px; display: flex; align-items: center; gap: 7px; padding: 0 10px; background: var(--paper); border-radius: 9px; }
.transcript-search input { min-width: 0; width: 100%; border: 0; outline: 0; background: transparent; font-size: .74rem; }
.font-controls { display: flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.font-controls button, .follow-button { height: 38px; border: 0; background: transparent; padding: 0 10px; font-size: .7rem; font-weight: 700; }
.font-controls button + button { border-left: 1px solid var(--line); }
.font-controls button:hover, .follow-button:hover { background: var(--paper); }
.follow-button { border: 1px solid var(--line); border-radius: 9px; color: var(--muted); }
.follow-button.active { background: var(--green-wash); color: var(--green-dark); border-color: transparent; }
.transcript-scroll { height: min(49vh, 620px); overflow-y: auto; padding: 16vh 5px 24vh; scroll-behavior: smooth; mask-image: linear-gradient(to bottom, transparent, black 10%, black 90%, transparent); }
.transcript-line { position: relative; margin: 0 0 1.1em; padding: .2em .6em .2em 1.1em; color: #7a7c76; font-family: Georgia, "Times New Roman", serif; font-size: var(--transcript-size); line-height: 1.62; cursor: pointer; border-radius: 8px; transition: color .25s ease, background .25s ease, transform .25s ease; }
.transcript-line:hover { color: var(--ink); background: var(--paper); }
.transcript-line.active { color: var(--ink); background: linear-gradient(90deg, rgba(217,228,220,.82), rgba(217,228,220,.2)); transform: translateX(4px); }
.transcript-line.active::before { content: ""; position: absolute; left: 0; top: .4em; bottom: .4em; width: 3px; border-radius: 4px; background: var(--ochre); }
.transcript-line.filtered-out { display: none; }
.transcript-time { display: block; margin-bottom: .28rem; color: var(--ochre); font-family: Inter, sans-serif; font-size: .58rem; font-weight: 800; letter-spacing: .08em; }
.book-panel { padding-top: 20px; }
.book-view-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 13px; }
.book-view-toolbar strong { display: block; margin-top: 4px; font-family: Georgia, serif; font-size: 1.15rem; font-weight: 600; }
.book-page-controls { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .68rem; font-variant-numeric: tabular-nums; }
.book-page-controls button { width: 32px; height: 32px; border: 1px solid var(--line); border-radius: 50%; background: var(--white); color: var(--green-dark); }
.book-page-controls button:hover:not(:disabled) { background: var(--green-wash); }
.book-page-controls button:disabled { opacity: .35; cursor: default; }
.book-density-controls { display: flex; overflow: hidden; margin-right: 3px; border: 1px solid var(--line); border-radius: 9px; background: var(--white); }
.book-density-controls button { width: 29px; height: 30px; border: 0; border-radius: 0; background: transparent; font-size: .9rem; }
.book-density-controls button + button { border-left: 1px solid var(--line); }
.book-page { position: relative; min-height: 470px; }
.book-leaf { position: relative; min-height: 470px; padding: clamp(38px, 6vw, 68px) clamp(34px, 7vw, 76px) 58px; border: 1px solid rgba(75,64,49,.14); border-radius: 4px 12px 12px 4px; background: #fdfaf2; box-shadow: 0 16px 34px rgba(58,48,35,.1), inset 10px 0 20px rgba(91,70,42,.035); overflow: hidden; }
.book-reading-row { position: relative; }
.book-reading-line { position: relative; display: block; width: 100%; margin: 0 0 .82em; padding: .1em 2.2em .1em .45em; border: 0; border-radius: 4px; background: transparent; color: #37362f; font-family: Georgia, "Times New Roman", serif; font-size: clamp(1rem, 1.35vw, 1.22rem); line-height: 1.56; text-align: left; cursor: pointer; transition: color .18s ease, background .18s ease; }
.book-reading-line:hover { background: rgba(217,228,220,.45); }
.book-reading-line.active { background: linear-gradient(90deg, rgba(217,228,220,.95), rgba(217,228,220,.35)); color: var(--green-dark); }
.book-reading-line.active::before { content: ""; position: absolute; left: -.38em; top: .3em; bottom: .3em; width: 3px; border-radius: 3px; background: var(--ochre); }
.book-line-bookmark { position: absolute; top: .16em; right: .25em; width: 28px; height: 28px; border: 0; border-radius: 50%; background: transparent; color: #8b8579; font-size: .95rem; opacity: 0; transition: opacity .16s ease, color .16s ease, background .16s ease; }
.book-reading-row:hover .book-line-bookmark, .book-line-bookmark:focus-visible, .book-line-bookmark.saved { opacity: 1; }
.book-line-bookmark:hover { color: var(--ochre); background: rgba(217,228,220,.72); }
.book-line-bookmark.saved { color: var(--ochre); }
.book-page-folio { position: absolute; left: 50%; bottom: 20px; transform: translateX(-50%); color: #968b7d; font: .7rem Georgia, serif; }

html[data-theme="dark"] .brand-mark,
html[data-theme="dark"] .chip.active,
html[data-theme="dark"] .primary-button,
html[data-theme="dark"] .play-button,
html[data-theme="dark"] .mini-play,
html[data-theme="dark"] .start-library-link,
html[data-theme="dark"] .category-filter summary span { background: #2b5b49; color: #fff; }
html[data-theme="dark"] .book-leaf { background: #1d211c; border-color: rgba(236,231,220,.14); }
html[data-theme="dark"] .book-reading-line { color: #ddd8cd; }
html[data-theme="dark"] .book-reading-line.active { color: #f4efe4; background: linear-gradient(90deg, rgba(54,89,73,.95), rgba(44,67,57,.46)); }
html[data-theme="dark"] .book-density-controls { background: #1d211c; }
html[data-theme="dark"] .book-line-bookmark { color: #aaa397; }
html[data-theme="dark"] .book-line-bookmark.saved { color: #eda25f; }
html[data-theme="dark"] .transcript-line { color: #929b94; }
html[data-theme="dark"] .premium-menu { border-color: rgba(222,231,224,.14); background: linear-gradient(145deg, rgba(29,37,32,.99), rgba(20,27,23,.98)); box-shadow: 0 24px 60px rgba(0,0,0,.48), 0 5px 16px rgba(0,0,0,.3), inset 0 1px 0 rgba(255,255,255,.06); }
html[data-theme="dark"] .transcript-line.active { color: var(--ink); background: linear-gradient(90deg, rgba(54,89,73,.9), rgba(44,67,57,.28)); }
html[data-theme="dark"] .reader-content.book-mode .player-card { background: rgba(26,33,29,.96); }
html[data-theme="dark"] .book-leaf-left { box-shadow: -10px 18px 38px rgba(0,0,0,.3), inset -18px 0 28px rgba(0,0,0,.22); }
html[data-theme="dark"] .book-leaf-right { box-shadow: 10px 18px 38px rgba(0,0,0,.3), inset 18px 0 28px rgba(0,0,0,.22); }
html[data-theme="dark"] .library-player { background: rgba(26,33,29,.97); box-shadow: 0 -8px 28px rgba(0,0,0,.3); }
html[data-theme="dark"] .book-flag-button { background: rgba(26,33,29,.9); }
html[data-theme="dark"] .book-row:hover { background: rgba(42,55,48,.72); }
html[data-theme="dark"] .library-summary { background: linear-gradient(var(--paper) 75%, rgba(17,22,19,0)); }
html[data-theme="dark"] .reader-tabs { background: linear-gradient(var(--white) 84%, rgba(26,33,29,0)); }
html[data-theme="dark"] .delete-book-card { background: #1a211d; border-color: rgba(214,111,87,.24); }
html[data-theme="dark"] .delete-location-list, html[data-theme="dark"] .delete-confirm-input { background: #111613; }
html[data-theme="dark"] .delete-location-item { background: #202922; }
html[data-theme="dark"] select,
html[data-theme="dark"] select option { background-color: #1a211d; color: #ece7dc; color-scheme: dark; }
html[data-theme="dark"] .speed-control { background: #1a211d; border-color: rgba(222,231,224,.2); color: #ece7dc; }
html[data-theme="dark"] .speed-control select { background: #1a211d; color: #ece7dc; }
.transcript-loading, .transcript-empty { display: grid; place-items: center; min-height: 260px; text-align: center; color: var(--muted); padding: 30px; line-height: 1.6; }
.transcript-empty strong { display: block; margin-bottom: 8px; color: var(--ink); font-family: Georgia, serif; font-size: 1.4rem; }
.chapter-navigation { display: flex; flex-direction: column; gap: 8px; margin-top: 20px; width: min(100%, 440px); }
.chapter-link { display: flex; justify-content: space-between; gap: 12px; border: 1px solid var(--line); background: var(--white); border-radius: 9px; padding: 10px 12px; text-align: left; }
.chapter-link:hover { background: var(--green-wash); }
.chapter-link time { color: var(--ochre); font-size: .68rem; }

.panel-heading { display: flex; justify-content: space-between; align-items: end; padding: 28px 0 18px; }
.panel-heading h3 { margin: 6px 0 0; font-family: Georgia, serif; font-size: 1.7rem; font-weight: 500; }
.moment-list { display: flex; flex-direction: column; gap: 9px; }
.moment-item { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: start; padding: 13px; border: 1px solid var(--line); border-radius: 11px; background: var(--white); }
.moment-time { border: 0; border-radius: 7px; background: var(--green-wash); color: var(--green-dark); padding: 6px 8px; font-size: .67rem; font-weight: 750; }
.moment-item strong { display: block; font-family: Georgia, serif; font-size: .92rem; }
.moment-item p { margin: 5px 0 0; color: var(--muted); font-size: .74rem; line-height: 1.45; }
.delete-button { border: 0; background: transparent; color: #92796d; font-size: 1rem; }
.summary-content { max-width: 900px; padding-bottom: 70px; color: var(--ink); }
.summary-content p { margin: 0 0 1em; font-family: Georgia, serif; font-size: 1rem; line-height: 1.72; }
.summary-content h4 { margin: 5px 0 18px; font-family: Georgia, serif; font-size: clamp(1.35rem, 2.2vw, 1.85rem); font-weight: 500; line-height: 1.15; }
.summary-kicker { margin: 0 !important; color: var(--ochre); font-family: Inter, sans-serif !important; font-size: .63rem !important; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.summary-overview { padding: 28px clamp(22px, 4vw, 46px); border: 1px solid var(--line); border-radius: 16px; background: var(--white); box-shadow: 0 12px 28px rgba(45,43,34,.06); }
.summary-main-ideas { margin-top: 34px; }
.summary-ideas { display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; }
.summary-ideas li { display: grid; grid-template-columns: auto minmax(0,1fr); gap: 13px; padding: 15px 0; border-top: 1px solid var(--line); }
.summary-ideas li:last-child { border-bottom: 1px solid var(--line); }
.summary-ideas strong { display: block; margin: 1px 0 4px; font-family: Inter, sans-serif; font-size: .82rem; }
.summary-ideas p { margin: 0; color: var(--muted); font-family: Inter, sans-serif; font-size: .78rem; line-height: 1.55; }
.summary-timestamp, .chapter-summary-card header button { align-self: start; border: 0; border-radius: 7px; background: var(--green-wash); color: var(--green-dark); padding: 6px 8px; font-size: .66rem; font-weight: 750; font-variant-numeric: tabular-nums; }
.summary-timestamp:hover, .chapter-summary-card header button:hover { background: var(--green); color: white; }
.chapter-summaries { margin-top: 44px; }
.chapter-summary-heading { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin-bottom: 15px; }
.chapter-summary-heading h4 { margin-bottom: 0; }
.chapter-summary-heading > span { color: var(--muted); font-size: .7rem; }
.chapter-summary-card { margin-bottom: 15px; padding: clamp(22px, 3.5vw, 36px); border: 1px solid var(--line); border-radius: 15px; background: var(--white); }
.chapter-summary-card header { display: flex; align-items: start; justify-content: space-between; gap: 18px; margin-bottom: 18px; }
.chapter-summary-card header span { color: var(--ochre); font-size: .61rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.chapter-summary-card h5 { margin: 4px 0 0; font-family: Georgia, serif; font-size: 1.28rem; font-weight: 500; }
.chapter-summary-card .summary-ideas { margin-top: 20px; }
.summary-provenance { margin: 25px 0 !important; color: var(--muted); font-family: Inter, sans-serif !important; font-size: .68rem !important; text-align: center; }
.publisher-description { margin-top: 24px; color: var(--muted); }
.publisher-description summary { cursor: pointer; font-size: .72rem; font-weight: 700; }
.publisher-description p { margin-top: 12px; color: var(--muted); font-size: .86rem; }
.summary-content .summary-placeholder { padding: 18px; border-left: 3px solid var(--ochre); background: var(--paper); font-family: Inter, sans-serif; font-size: .78rem; color: var(--muted); }
.action-form { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin-bottom: 16px; }
.action-form input { min-width: 0; border: 1px solid var(--line); border-radius: 10px; background: var(--white); padding: 11px 12px; outline: 0; }
.action-form input:focus { border-color: rgba(47,92,75,.55); box-shadow: 0 0 0 3px rgba(47,92,75,.08); }

.toast { position: fixed; left: 50%; bottom: 28px; z-index: 100; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; padding: 11px 16px; border-radius: 11px; background: var(--green-dark); color: white; box-shadow: var(--shadow); font-size: .75rem; transition: opacity .2s ease, transform .2s ease; }
.toast.visible { opacity: 1; transform: translate(-50%,0); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }

@media (min-width: 821px) {
  .reader-content { width: min(100%, 1540px); margin: 0 auto; }
  .reader-content.book-mode { padding: 14px clamp(26px, 3vw, 52px) 128px; }
  .reader-content.book-mode .book-hero { display: none; }
  .reader-content.book-mode .reader-header { margin-bottom: 2px; }
  .reader-content.book-mode .player-card { position: fixed; z-index: 25; left: 50%; bottom: 18px; width: min(560px, calc(100vw - 48px)); transform: translateX(-50%); padding: 8px 18px 10px; border: 1px solid var(--line); border-radius: 16px; background: rgba(255,253,248,.96); box-shadow: 0 14px 42px rgba(45,43,34,.18); backdrop-filter: blur(14px); }
  .reader-content.book-mode .chapter-row { display: none; }
  .reader-content.book-mode .transport-row { margin-top: 2px; }
  .reader-content.book-mode .play-button { width: 46px; height: 46px; }
  .reader-content.book-mode .transport-button { width: 38px; height: 38px; }
  .reader-content.book-mode .reader-tabs { padding-top: 4px; }
  .reader-content.book-mode .book-panel { padding-top: 8px; }
  .book-page { width: min(100%, 1320px); margin: 0 auto; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .book-leaf { min-height: clamp(560px, 72vh, 760px); padding: clamp(48px, 5vw, 76px) clamp(42px, 4.5vw, 72px) 62px; border-radius: 0; }
  .book-leaf-left { border-radius: 14px 2px 2px 14px; box-shadow: -10px 18px 38px rgba(58,48,35,.1), inset -18px 0 28px rgba(91,70,42,.08); }
  .book-leaf-right { border-radius: 2px 14px 14px 2px; box-shadow: 10px 18px 38px rgba(58,48,35,.1), inset 18px 0 28px rgba(91,70,42,.08); }
  .book-leaf-right::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 1px; background: rgba(83,62,35,.14); box-shadow: 7px 0 18px rgba(83,62,35,.09); }
  .book-reading-line { font-size: clamp(.98rem, 1.22vw, 1.22rem); }
}

@media (max-width: 1080px) {
  .book-row, .book-table-header { grid-template-columns: 48px minmax(0,1fr) 58px 128px 76px 64px; gap: 8px; }
  .status-badges { display: none; }
}

@media (max-width: 820px) {
  .app-shell { display: block; }
  .library-pane { width: 100%; height: 100dvh; border: 0; }
  .reader-pane { display: none; position: fixed; inset: 0; z-index: 60; height: 100dvh; }
  .app-shell.reader-open .reader-pane { display: block; }
  .reader-empty { display: none; }
  .search-results { position: fixed; top: 125px; left: 18px; right: 18px; width: auto; max-height: 65vh; }
  .topbar { padding: 18px; }
  .search-wrap { margin: 0 18px; }
  .library-toolbar { padding: 11px 18px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 7px; }
  .filter-chips { width: 100%; }
  .toolbar-actions { width: 100%; justify-content: flex-start; }
  .library-content { padding: 0 18px 28px; }
  .library-player { padding-left: 18px; padding-right: 18px; }
  .book-row, .book-table-header { grid-template-columns: 48px minmax(0,1fr) 58px 128px 76px 64px; gap: 8px; }
  .reader-content { padding: max(14px, env(safe-area-inset-top)) 18px calc(52px + env(safe-area-inset-bottom)); }
  .reader-close span { display: inline; }
  .book-hero { grid-template-columns: 100px 1fr; gap: 18px; padding: 22px 0 18px; }
  .hero-cover { width: 100px; height: 100px; border-radius: 9px; }
  .hero-copy h2 { font-size: 1.5rem; }
  .reader-tabs { gap: 16px; overflow-x: auto; }
  .reader-tab { white-space: nowrap; }
  .reader-delete { position: sticky; right: 0; padding-left: 12px; background: var(--white); white-space: nowrap; }
  .transcript-scroll { height: 52vh; }
  .book-page { min-height: 62vh; }
  .book-leaf { min-height: 62vh; }
}

@media (max-width: 540px) {
  .brand-mark { width: 42px; height: 32px; }
  .toolbar-actions .icon-button { display: none; }
  .library-toolbar { overflow-x: auto; }
  .filter-chips { width: 100%; }
  .toolbar-actions { width: 100%; }
  .toolbar-menu-popover, .category-menu { position: fixed; top: 225px; left: 18px; right: 18px; width: auto; min-width: 0; max-height: calc(100dvh - 250px); overflow-y: auto; transform-origin: top center; }
  .status-control .toolbar-menu-popover, .sort-control .toolbar-menu-popover, .category-filter .category-menu { left: 18px; right: 18px; }
  .book-table-header, .book-list.table-view { min-width: 640px; }
  .book-row, .book-table-header { grid-template-columns: 45px minmax(170px,1fr) 54px 120px 72px 64px; gap: 7px; }
  .book-row { min-height: 70px; }
  .book-cover { width: 40px; height: 54px; }
  .book-cover-play { width: 40px; }
  .library-player { grid-template-columns: minmax(0,1fr) auto; gap: 7px 10px; }
  .library-player-timeline { grid-column: 1 / -1; grid-row: 2; }
  .reader-header-actions .secondary-button { padding: 8px; font-size: .66rem; }
  .chapter-menu { width: min(76%, 520px); }
  .chapter-menu-popover { position: fixed; top: 150px; left: 18px; right: 18px; width: auto; max-height: calc(100dvh - 185px); }
  .book-hero { align-items: center; }
  .hero-meta { display: none; }
  .transport-row { gap: 16px; }
  .transcript-tools { flex-wrap: wrap; }
  .transcript-search { flex-basis: 100%; }
  .transcript-scroll { padding-top: 10vh; }
  .book-view-toolbar { align-items: flex-end; }
  .book-leaf { padding: 34px 24px 52px; }
  .book-reading-line { font-size: 1rem; }
  .summary-overview, .chapter-summary-card { padding: 22px 18px; }
  .chapter-summary-card header { align-items: center; }
  .summary-ideas li { gap: 9px; }
  .panel-heading { align-items: center; }
  .panel-heading h3 { font-size: 1.45rem; }
  .delete-book-card { padding: 27px 20px 22px; }
  .delete-dialog-actions { display: grid; grid-template-columns: 1fr 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
