@font-face { font-family: DM Sans; src: url('./fonts/dm-sans-latin-wght-normal.woff2') format('woff2'); font-weight: 100 1000; font-display: swap; }
@font-face { font-family: DM Sans; src: url('./fonts/dm-sans-latin-ext-wght-normal.woff2') format('woff2'); font-weight: 100 1000; font-display: swap; unicode-range: U+0100-024F,U+1E00-1EFF; }
@font-face { font-family: Newsreader; src: url('./fonts/newsreader-latin-wght-normal.woff2') format('woff2'); font-weight: 200 800; font-display: swap; }
@font-face { font-family: Newsreader; src: url('./fonts/newsreader-latin-ext-wght-normal.woff2') format('woff2'); font-weight: 200 800; font-display: swap; unicode-range: U+0100-024F,U+1E00-1EFF; }
@font-face { font-family: Newsreader; src: url('./fonts/newsreader-latin-wght-italic.woff2') format('woff2'); font-weight: 200 800; font-style: italic; font-display: swap; }
@font-face { font-family: Newsreader; src: url('./fonts/newsreader-latin-ext-wght-italic.woff2') format('woff2'); font-weight: 200 800; font-style: italic; font-display: swap; unicode-range: U+0100-024F,U+1E00-1EFF; }

:root {
  color-scheme: light;
  --bg: #faf7f0;
  --rail: #f3eee3;
  --paper: #fffcf7;
  --ink: #20352a;
  --muted: #516457;
  --line: #d9dacf;
  --accent: #0b5337;
  --button: #0b5337;
  --on-button: #fffaf0;
  --accent-soft: #e8efe5;
  --gold: #aa8650;
  --highlight: #f1e2af;
  --green: #17864b;
  --alert: #a14024;
  --shadow: 0 2px 6px #1831260a, 0 11px 28px #223a2810;
  --deep: #102d22;
  --forest: #164e37;
  --evergreen: #204b39;
  --linen: #fff6e5;
  --champagne: #e5d2a8;
  --gilt: #c5a46d;
  --scrim: #0b1d15a1;
  --serif: Newsreader, Georgia, serif;
  --sans: 'DM Sans', system-ui, sans-serif;
  --text-size: 21px;
  font: 15px/1.5 var(--sans);
}
:root[data-theme=dark] {
  color-scheme: dark;
  --bg: #0d1812;
  --rail: #11231a;
  --paper: #192c21;
  --ink: #f6f1e6;
  --muted: #b8c8bc;
  --line: #365040;
  --accent: #87d5a7;
  --button: #8bd2a6;
  --on-button: #11291d;
  --accent-soft: #20382a;
  --gold: #d1b47c;
  --highlight: #475737;
  --green: #71d298;
  --alert: #f5aa8f;
  --shadow: 0 3px 7px #050d095c, 0 12px 28px #050d0936;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; min-width: 0; height: 100%; }
body { background: radial-gradient(ellipse at 12% 0%, var(--paper), var(--bg) 72%); color: var(--ink); }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.55; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.symbols { position: absolute; width: 0; height: 0; overflow: hidden; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip-link { position: fixed; z-index: 6; top: 8px; left: 8px; padding: 10px 14px; border-radius: 8px; background: var(--paper); }
.skip-link:not(:focus) { width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
button, textarea, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:is(:disabled, [aria-disabled=true]) { opacity: .43; cursor: default; }
a { color: var(--accent); text-underline-offset: .18em; }
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { font-family: var(--serif); font-weight: 520; letter-spacing: -.026em; line-height: 1.08; }
h1 { font-size: clamp(2.85rem, 5vw, 4.35rem); font-weight: 625; letter-spacing: -.042em; }
h2 { font-size: clamp(1.8rem, 3vw, 2.45rem); font-weight: 600; }
h3 { font-size: 1.6rem; }
.layout { display: grid; grid-template-columns: clamp(210px, 18vw, 268px) minmax(0, 1fr); height: 100%; height: 100dvh; overflow: hidden; }
.sidebar { display: flex; flex-direction: column; gap: clamp(12px, 2.3vh, 23px); min-height: 0; padding: 15px 17px 16px; overflow: auto; border-right: 1px solid var(--line); background: radial-gradient(ellipse at 50% 0%, var(--paper), var(--rail) 74%); }
.brand { display: block; align-self: center; width: clamp(90px, 15vh, 142px); padding: 0; border: 0; border-radius: 12px; background: none; }
.brand img { display: block; width: 100%; height: auto; filter: drop-shadow(0 4px 7px #18312630); }
.voice-mark, .empty-icon { display: inline-grid; flex: none; place-items: center; border-radius: 50%; width: 43px; height: 43px; background: var(--button); color: var(--on-button); }
.navigation { display: grid; gap: 6px; }
.navigation button { display: flex; align-items: center; gap: 12px; padding: 10px 13px; min-height: 44px; border: 1px solid transparent; border-radius: 9px; background: none; text-align: left; color: var(--ink); font-weight: 640; }
.navigation button svg { color: var(--accent); }
.navigation button:hover { background: var(--accent-soft); color: var(--accent); }
.navigation button[aria-current=page] { background: linear-gradient(115deg, var(--deep), var(--forest)); border-color: var(--evergreen); color: var(--linen); box-shadow: inset 3px 0 var(--gilt), var(--shadow); }
.navigation button[aria-current=page] svg { color: inherit; }
.sidebar-tail { display: grid; flex: 1; min-height: 144px; grid-template-rows: minmax(0, 1fr) auto; row-gap: 10px; }
.sidebar-art { align-self: end; justify-self: center; width: 100%; height: 100%; max-width: 210px; max-height: 280px; object-fit: contain; object-position: center bottom; opacity: .58; pointer-events: none; filter: sepia(.2) hue-rotate(17deg); }
:root[data-theme=dark] .sidebar-art { opacity: .34; }
.voice-chip { grid-row: 2; position: relative; isolation: isolate; display: flex; align-items: flex-end; min-height: 134px; padding: 11px; overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: radial-gradient(ellipse at 75% 12%, var(--accent-soft), var(--paper) 76%); box-shadow: var(--shadow); }
.vera-portrait { position: absolute; z-index: -1; bottom: 0; right: -9px; width: 133px; height: auto; opacity: 0; }
.vera-preparing { width: 147px; opacity: 1; }
[data-voice=ready] .vera-preparing { opacity: 0; }
[data-voice=ready] .vera-ready { opacity: 1; }
.voice-chip-copy { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 1px 7px; min-width: 0; width: min(110px, 65%); padding: 7px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); }
.voice-chip-copy strong { grid-column: 2; font: 660 1.5rem/.93 var(--serif); padding-top: 4px; }
.voice-chip-copy small { grid-row: 2; grid-column: 2; overflow-wrap: anywhere; }
.voice-chip-copy .voice-dot { grid-row: 1; grid-column: 1; }
.voice-chip-copy:has(.voice-chip-progress:not([hidden])) { width: min(144px, 86%); }
.voice-chip-progress { grid-column: 2; display: flex; align-items: center; gap: 5px; color: var(--muted); font-size: .69rem; }
.voice-chip-progress span { white-space: nowrap; }
.voice-chip-progress progress { min-width: 0; height: .3rem; }
.voice-meter { appearance: none; border: 0; border-radius: 999px; overflow: hidden; background: var(--line); }
.voice-meter::-webkit-progress-bar { background: transparent; }
.voice-meter::-webkit-progress-value { background: var(--accent); border-radius: 999px; }
.voice-meter::-moz-progress-bar { background: var(--accent); border-radius: 999px; }
.voice-meter:indeterminate { background: repeating-linear-gradient(115deg, var(--line) 0 5px, var(--gold) 5px 7px); }
.voice-meter:indeterminate::-moz-progress-bar { background: transparent; }
.voice-mark { width: 36px; height: 36px; background: var(--accent-soft); color: var(--accent); }
.voice-mark svg { width: 18px; height: 18px; }
.voice-chip strong { color: var(--ink); }
small { display: block; font-size: .77rem; font-weight: 500; color: var(--muted); }
.voice-dot { flex: none; width: 7px; height: 7px; margin-left: auto; border-radius: 50%; background: var(--gold); }
[data-voice=ready] .voice-dot { background: var(--green); }
[data-voice=unavailable] .voice-dot { background: var(--alert); }
.workspace { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
main { min-height: 0; flex: 1 1 auto; overflow: auto; overscroll-behavior: contain; scroll-padding: 7px; }
main:focus-visible { outline-offset: -3px; }
.page { width: min(100%, 1490px); padding: clamp(27px, 3.3vw, 52px) clamp(25px, 4.1vw, 72px) 30px; margin: auto; }
.page-narrow, #view-settings { max-width: 1220px; }
#view-settings { container-type: inline-size; }
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-bottom: clamp(19px, 2.4vw, 31px); padding-bottom: 13px; border-bottom: 1px solid var(--line); }
.page-head h1 { color: var(--accent); }
.page-head p { margin-top: 4px; color: var(--muted); }
.library-head { flex-wrap: wrap; }
.button, .icon-button, .plain { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 6px 16px; border: 1px solid transparent; border-radius: 10px; background: transparent; font-weight: 680; line-height: 1.2; }
.button svg, .plain svg, .icon-button svg { width: 18px; height: 18px; }
.primary { background: var(--button); color: var(--on-button); box-shadow: inset 0 0 0 1px #e5d2a83d, var(--shadow); }
.primary:hover:not(:disabled) { filter: brightness(1.13); }
.outline, .icon-button { color: var(--accent); border-color: var(--line); background: var(--paper); }
.button:active:not(:disabled), .icon-button:active:not(:disabled) { transform: translateY(1px); }
.outline:hover:not(:disabled), .icon-button:hover:not(:disabled), .plain:hover { background: var(--accent-soft); }
.icon-button { width: 44px; padding: 0; }
.plain { color: var(--accent); }
.import-actions { display: flex; flex: none; gap: 7px; }
#import-help p { color: var(--muted); line-height: 1.8; }
.hero {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: clamp(18px, 3vw, 38px);
  position: relative;
  isolation: isolate;
  min-height: clamp(248px, 24vw, 330px);
  padding: clamp(32px, 3.7vw, 51px) clamp(28px, 4.4vw, 60px);
  background: var(--deep) url('./art/library-banner.webp') center / cover no-repeat;
  border: 1px solid var(--evergreen);
  border-radius: 19px;
  color: var(--linen);
  box-shadow: var(--shadow);
}
.hero::before, .hero::after { content: ''; position: absolute; pointer-events: none; }
.hero::before { inset: 0; border-radius: inherit; z-index: -1; background: linear-gradient(0deg, #102d229c, transparent 48%), linear-gradient(92deg, #102d22 8%, #123125ef 48%, #163829a8 77%, #17382b44); }
.hero::after { inset: 8px; border: 1px solid #c5a46d78; border-radius: 12px; }
.hero-ornament { position: absolute; top: 13px; right: 20px; width: 67px; height: 16px; color: var(--champagne); }
.hero-copy { grid-column: 1 / -1; width: min(100%, 37rem); overflow-wrap: anywhere; }
#hero-cover:not([hidden]) + .hero-copy { grid-column: 2; }
.hero h2 { color: var(--linen); font-size: clamp(2.55rem, 4.6vw, 4.15rem); line-height: .98; }
.hero p { margin-top: 7px; }
.hero .hero-kicker { display: flex; align-items: center; gap: 8px; color: var(--champagne); font-weight: 720; margin: 0 0 7px; }
.hero-kicker svg { width: 17px; height: 17px; }
.hero-chapter { font-size: .92rem; }
.hero #hero-action { margin-top: 15px; background: var(--linen); color: var(--deep); }
.hero #hero-action:focus-visible { outline-color: var(--champagne); }
.hero .book-progress { width: min(100%, 19rem); margin-top: 9px; color: inherit; }
.hero .book-progress { --progress-track: #e5d2a84d; --progress-fill: var(--champagne); }
#hero-cover { width: clamp(96px, 12vw, 158px); }
#hero-cover .cover { box-shadow: 2px 7px 10px #08191275, 8px 15px 24px #08191268; }
:root[data-theme=dark] .hero { background-image: url('./art/library.webp'); }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 15px; margin: clamp(24px, 3.4vw, 44px) 0 14px; }
.section-head span { color: var(--muted); font-size: .86rem; }
.empty { display: flex; align-items: center; gap: 18px; min-height: 112px; padding: clamp(18px, 3vw, 28px); border: 1px dashed var(--line); border-radius: 14px; background: linear-gradient(145deg, var(--paper), var(--bg)); }
.empty-icon { background: var(--accent-soft); color: var(--accent); width: 54px; height: 54px; }
.empty-icon svg { width: 26px; height: 26px; }
.empty p { margin-top: 5px; color: var(--muted); }
.local-note { display: flex; align-items: center; gap: 6px; margin-top: 18px; color: var(--muted); font-size: .82rem; }
.local-note svg { width: 15px; height: 15px; }
.book-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 146px), 1fr)); gap: clamp(14px, 2vw, 24px); margin: 0; padding: 0; list-style: none; }
.book-card { position: relative; min-width: 0; }
.book-open { display: grid; align-content: start; width: 100%; height: 100%; padding: 0; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); box-shadow: var(--shadow); text-align: left; }
.cover { aspect-ratio: 5 / 7; width: 100%; display: grid; place-items: center; position: relative; isolation: isolate; background: var(--book-color, var(--deep)); color: var(--linen); border-radius: 5px 9px 9px 5px; overflow: hidden; text-align: center; }
.cover::after { content: ''; position: absolute; z-index: 1; inset: 0; border-radius: inherit; pointer-events: none; background: linear-gradient(90deg,#08191263,#0819121c 4%,#fff1ce3b 6%,transparent 12%); box-shadow: inset -2px 0 #f9e2b361, inset 0 1px #f9e2b34f; }
.cover-binding { position: absolute; inset: 6% 7% 6% 10%; display: flex; flex-direction: column; align-items: center; justify-content: space-evenly; gap: 2%; padding: 4%; border: 3px double #f0c98b9c; border-radius: 7px; background: radial-gradient(ellipse at 68% 17%, #fff1bc26, transparent 75%); }
.cover-binding svg { width: 57%; height: auto; aspect-ratio: 88 / 18; color: #e7b777; }
.cover-binding svg:nth-of-type(2) { width: 23%; aspect-ratio: 1; }
.cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: var(--deep); }
.cover-label { font: 620 clamp(.92rem, 2vw, 1.45rem)/1.03 var(--serif); overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.book-open:hover .cover { filter: brightness(1.08); }
.book-open:hover, .add-book:hover { border-color: var(--gold); }
.book-details { display: grid; gap: 5px; padding: 10px 11px 11px; min-width: 0; }
.book-title { font: 600 1.35rem/1.1 var(--serif); overflow-wrap: anywhere; }
.book-author { color: var(--muted); overflow-wrap: anywhere; font-size: .85rem; }
.book-origin { color: var(--accent); font-size: .75rem; font-weight: 650; }
.book-remove { position: absolute; z-index: 1; top: 7px; right: 7px; width: 38px; min-height: 38px; background: var(--paper); box-shadow: var(--shadow); }
.book-remove svg { width: 15px; height: 15px; }
.book-progress { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: .78rem; }
progress { accent-color: var(--accent); width: 100%; height: .5rem; }
.book-progress progress { appearance: none; flex: 1; min-width: 0; height: .4rem; border: 0; border-radius: 999px; overflow: hidden; background: var(--progress-track, var(--line)); }
.book-progress progress::-webkit-progress-bar { background: transparent; }
.book-progress progress::-webkit-progress-value { background: var(--progress-fill, var(--accent)); border-radius: 999px; }
.book-progress progress::-moz-progress-bar { background: var(--progress-fill, var(--accent)); border-radius: 999px; }
.book-progress > span { white-space: nowrap; }
.add-book { align-self: start; display: grid; justify-items: center; align-content: center; gap: 7px; width: 100%; aspect-ratio: 5 / 7; padding: 10px; border: 1px dashed var(--gold); border-radius: 10px; background: var(--paper); color: var(--accent); font-weight: 690; }
.add-book svg { width: 27px; height: 27px; }
.add-book:hover { background: var(--accent-soft); }
body[data-view=reader] .layout { grid-template-columns: minmax(0, 1fr); }
body[data-view=reader] .sidebar { display: none; }
body[data-view=reader] main { background: radial-gradient(ellipse at 50% 18%, var(--paper) 32%, var(--bg) 96%); }
.reader-bar, .news-reader-nav { align-items: center; gap: 8px; flex: none; border-bottom: 1px solid var(--line); background: linear-gradient(100deg, var(--rail), var(--paper), var(--rail)); box-shadow: var(--shadow); z-index: 1; }
.reader-bar { display: grid; grid-template-columns: 1fr minmax(0, 2fr) 1fr; padding: 8px clamp(8px, 4vw, 58px); }
.reader-bar > button { justify-self: start; }
.reader-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: center; color: var(--ink); font: 660 1.42rem/1.25 var(--serif); padding: 5px 0 2px; }
.reader-actions { display: flex; justify-content: end; gap: 8px; }
.reader-find { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px 18px; padding: 8px 0 2px; border-top: 1px solid var(--line); }
.reader-find form { display: flex; align-items: center; gap: 5px; max-width: 100%; }
.reader-find input { min-width: 0; min-height: 44px; padding: 6px 9px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); background: var(--paper); }
#book-query { flex: 1; width: min(18rem, 40vw); }
#pdf-page { width: 4.25rem; }
.reader-find .button { padding-inline: 10px; white-space: nowrap; }
.reader-find .icon-button { flex: none; }
#reader-find-status { flex-basis: 100%; min-width: 0; margin: 0; overflow-wrap: anywhere; text-align: center; font-size: .9rem; color: var(--ink); }
#reader-find-status:empty { position: absolute; }
.reader { max-width: 880px; margin: auto; padding: clamp(27px, 5vw, 69px) clamp(22px, 6vw, 78px) 42px; }
.chapter-heading { display: flex; justify-content: center; align-items: center; gap: 13px; color: var(--accent); margin-bottom: 14px; text-align: center; font: 640 1.3rem/1.2 var(--serif); letter-spacing: normal; overflow-wrap: anywhere; }
.chapter-heading::before, .chapter-heading::after { content: ''; flex: 0 0 clamp(14px, 4vw, 37px); height: 1px; background: var(--gold); }
.prose { font: var(--text-size)/1.64 var(--serif); overflow-wrap: anywhere; }
.prose :is(h1,h2,h3,h4,h5,h6) { font-family: var(--serif); line-height: 1.08; margin: 1.15em 0 .5em; }
.prose h1 { font-size: 2.2em; }
.prose h2 { font-size: 1.72em; }
.prose h3 { font-size: 1.4em; }
.prose > :first-child, .prose > :first-child > :first-child { margin-top: 0; }
.reader .prose > :first-child:is(h1,h2,h3) { text-align: center; }
.reader .prose > :first-child:is(h1,h2,h3)::after { content: ''; display: block; width: 55px; margin: .35em auto 0; border-bottom: 3px double var(--gold); }
.prose :is(p, blockquote, pre, ul, ol, dl, figure, table) { margin: 0 0 .85em; }
.prose blockquote { border-left: 2px solid var(--line); padding-left: 1em; font-style: italic; }
.prose img { max-width: 100%; height: auto; display: block; margin: 1em auto; }
.prose table { max-width: 100%; display: block; overflow-x: auto; border-collapse: collapse; }
.prose :is(td,th) { border: 1px solid var(--line); padding: 5px 10px; }
.prose pre { white-space: pre-wrap; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 1.6em 0; }
.sentence { scroll-margin: 22px 0; }
.sentence.current { background: var(--highlight); border-radius: .15em; box-shadow: 0 1px var(--gold); box-decoration-break: clone; -webkit-box-decoration-break: clone; }
::highlight(book-search) { text-decoration: underline 2px; color: var(--accent); background-color: var(--accent-soft); }
.search-match { text-decoration: underline 2px; text-decoration-color: var(--accent); text-underline-offset: .16em; }
.chapter-links { display: flex; justify-content: space-between; gap: 10px; border-top: 1px solid var(--line); margin-top: 38px; padding-top: 20px; }
.chapter-links button:last-child { margin-left: auto; }
.player { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: clamp(10px, 2vw, 24px); margin: 0 clamp(9px, 2.2vw, 32px) max(10px, env(safe-area-inset-bottom)); padding: 10px clamp(12px, 2.5vw, 30px); border: 1px solid var(--evergreen); border-radius: 16px; background: radial-gradient(ellipse at 44% 0, var(--forest), var(--deep) 72%); color: var(--linen); box-shadow: inset 0 1px #e5d2a835, var(--shadow); z-index: 1; }
.player-info { display: flex; align-items: center; gap: 11px; min-width: 0; }
.player-info > div { min-width: 0; }
.player-info strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 660 1.35rem/1.15 var(--serif); padding-top: 3px; }
.player-info small { color: var(--champagne); overflow-wrap: anywhere; }
.player-cover { display: block; width: 39px; flex: none; }
.player-cover .cover-label, #hero-cover .cover-label { display: none; }
.player-cover .cover-binding { border-width: 1px; }
.player .voice-mark { background: var(--champagne); color: var(--deep); }
.player-buttons { display: flex; align-items: center; gap: 9px; }
.player:has(.book-navigation:not([hidden])) { grid-template-columns: minmax(0, 1fr) auto auto auto; }
.book-navigation { display: flex; align-items: center; justify-content: center; gap: 6px; }
.book-navigation select { min-height: 44px; color-scheme: dark; border: 1px solid #e5d2a870; border-radius: 12px; padding-inline: 10px; background: var(--deep); color: var(--linen); }
.book-navigation select:focus-visible { outline-color: var(--champagne); }
.player .play { min-width: 118px; min-height: 47px; border-radius: 24px; background: var(--linen); color: var(--deep); }
.player .stop { border-radius: 50%; background: #ffffff12; color: var(--linen); border-color: #e5d2a870; }
.player .stop:hover:not(:disabled) { background: #ffffff2e; }
.player .stop[aria-disabled=true] { opacity: .48; cursor: default; }
.player .stop[aria-disabled=true]:hover { background: #ffffff12; }
.player button:focus-visible { outline-color: var(--champagne); }
.player-detail { display: flex; justify-content: flex-end; align-items: center; gap: 13px; color: var(--champagne); font-size: .84rem; text-align: right; }
.waveform { width: clamp(52px, 9vw, 112px); height: 24px; color: var(--gilt); opacity: .66; }
.player[data-state=playing] .waveform { opacity: 1; }

@media (max-width: 980px) {
  .player:has(.book-navigation:not([hidden])) { grid-template-columns: minmax(0, 1fr) auto; }
  .player:has(.book-navigation:not([hidden])) .player-detail { grid-area: 2 / 1; justify-content: start; text-align: left; }
  .book-navigation { grid-area: 2 / 2; }
}
.panel { margin-bottom: 17px; padding: clamp(17px, 3vw, 27px); background: linear-gradient(145deg, var(--paper), var(--bg)); border: 1px solid var(--line); border-radius: 15px; box-shadow: var(--shadow); }
.editor-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.editor label { font-weight: 700; }
.editor-actions { display: flex; gap: 5px; }
.editor-actions .icon-button { border-color: transparent; background: none; }
.editor-actions .icon-button:hover { background: var(--accent-soft); }
textarea { display: block; width: 100%; min-height: 8em; padding: clamp(13px, 2vw, 22px); resize: vertical; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); font: var(--text-size)/1.5 var(--serif); }
.text-preview { white-space: pre-wrap; padding: 17px 22px; background: var(--paper); border: 1px solid var(--line); border-radius: 13px; }
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 17px; }
@container (max-width: 536px) {
  .settings-grid { grid-template-columns: minmax(0, 1fr); }
}
.settings-panel { min-width: 0; margin: 0; border-top-color: var(--gold); }
.settings-title { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.settings-title h2 { font-size: clamp(1.45rem, 3vw, 1.95rem); padding-top: 4px; }
.settings-panel p { color: var(--muted); margin: 9px 0; }
.settings-panel progress { max-width: 260px; }
.settings-panel .button { margin-top: 3px; }
.settings-panel [data-appearance=size] { margin-top: 18px; }
.voice-badge { display: inline-flex; align-items: center; gap: 5px; margin-left: auto; border: 1px solid var(--line); border-radius: 999px; padding: 4px 8px; color: var(--muted); background: var(--paper); font-size: .78rem; }
.about { display: flex; gap: 16px; margin-top: 18px; color: var(--muted); font-size: .82rem; }
.about-page { max-width: 960px; }
.about-intro { display: flex; align-items: center; gap: clamp(18px, 4vw, 48px); padding: clamp(22px, 5vw, 48px); border-top: 2px solid var(--gold); background: linear-gradient(115deg, var(--accent-soft), var(--paper) 68%); }
.about-intro img { flex: none; width: clamp(92px, 15vw, 174px); height: auto; filter: drop-shadow(0 5px 9px #18312630); }
.about-intro h2 { color: var(--accent); font-size: clamp(2.6rem, 5vw, 4.1rem); }
.about-version { margin-top: 2px; color: var(--muted); font-size: .85rem; font-weight: 680; font-variant-numeric: tabular-nums; }
.about-summary { max-width: 44ch; margin-top: 13px; color: var(--muted); line-height: 1.65; }
.about-project h2 { color: var(--accent); }
.about-project dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px 24px; margin: 14px 0 0; }
.about-project dl > div { padding-top: 10px; border-top: 1px solid var(--line); }
.about-project dt { color: var(--muted); font-size: .85rem; font-weight: 680; }
.about-project dd { margin: 3px 0 0; overflow-wrap: anywhere; }
fieldset { border: 0; padding: 0; margin: 15px 0; }
legend { font-weight: 680; padding: 0; margin-bottom: 6px; }
.segmented { display: inline-flex; align-items: center; gap: 4px; padding: 4px; background: var(--rail); border: 1px solid var(--line); border-radius: 10px; }
.segmented label { position: relative; cursor: pointer; }
.segmented input { position: absolute; opacity: 0; }
.segmented span { display: flex; align-items: center; gap: 7px; min-height: 39px; padding: 6px 12px; border-radius: 6px; }
.segmented input:checked + span { background: var(--button); color: var(--on-button); font-weight: 680; }
.segmented input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }
.size-control { max-width: 420px; display: grid; grid-template-columns: 1fr auto; gap: 8px; font-weight: 680; }
.size-control input { width: 100%; grid-column: 1 / -1; accent-color: var(--accent); }
.size-value { color: var(--accent); }
dialog { color: var(--ink); width: min(440px, calc(100% - 26px)); max-height: calc(100dvh - 25px); padding: 23px; border: 1px solid var(--line); border-radius: 16px; background: var(--paper); box-shadow: var(--shadow); }
dialog::backdrop { background: var(--scrim); }
dialog header { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.drawer { margin: 0 0 0 auto; height: 100dvh; max-height: none; border-radius: 14px 0 0 14px; }
.drawer ol { display: grid; gap: 4px; margin: 0; padding: 0; list-style: none; }
.drawer li > ol { margin-top: 4px; }
.drawer nav button { display: block; width: 100%; text-align: left; border: 0; padding: 11px 12px 11px calc(12px + var(--depth,0) * 13px); border-radius: 7px; background: transparent; overflow-wrap: anywhere; }
.drawer nav button:hover, .drawer nav button[data-current] { color: var(--accent); background: var(--accent-soft); }
.drawer section { margin-top: 18px; border-top: 1px solid var(--line); }
.drawer ul { margin: 6px 0 0; padding: 0; list-style: none; }
.drawer ul button { max-width: 100%; text-align: left; overflow-wrap: anywhere; }
.dialog-actions { display: flex; justify-content: end; gap: 8px; margin-top: 16px; }
.install-guide { width: min(850px, calc(100% - 26px)); padding: 0; background: linear-gradient(140deg, var(--paper), var(--bg)); box-shadow: var(--shadow); }
.install-guide header { position: sticky; z-index: 1; top: 0; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; justify-content: start; gap: 13px; margin: 0; padding: clamp(13px, 3vw, 25px); border-bottom: 1px solid var(--line); background: var(--paper); }
.install-guide header h2 { color: var(--accent); }
.install-guide header p { color: var(--muted); }
.install-guide .voice-mark { width: 43px; height: 43px; }
.install-body { padding: clamp(13px, 3vw, 24px); }
.install-desktop { padding: clamp(13px, 3vw, 24px); border: 1px solid var(--line); border-top: 2px solid var(--gold); border-radius: 12px; background: linear-gradient(125deg, var(--accent-soft), var(--paper) 75%); }
.install-desktop h4 { margin: 8px 0 3px; font-size: 1.05rem; }
.install-desktop > p, .install-options p { color: var(--muted); font-size: .89rem; }
.install-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 16px 0 0; padding: 0; list-style: none; }
.install-options .button { width: 100%; padding-inline: 10px; text-align: center; text-decoration: none; }
.install-options p { margin-top: 5px; text-align: center; }
.install-web { margin-top: 22px; }
.install-web > h3 { margin-bottom: 12px; }
.install-web > .primary { margin-bottom: 12px; }
.install-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding: 0; margin: 0; list-style: none; }
.install-list li { display: flex; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); }
.install-list img { flex: none; }
.install-list h4 { display: flex; flex-wrap: wrap; align-items: baseline; gap: 3px 6px; margin: 0; font: 750 .97rem/1.25 var(--sans); }
.install-list h4 small { color: var(--accent); font-weight: 680; }
.install-list p { margin-top: 5px; color: var(--muted); font-size: .88rem; overflow-wrap: anywhere; }
.install-list [lang=en] { color: var(--ink); font-weight: 630; }
.install-note { display: flex; gap: 10px; margin-top: 16px; padding: 12px 14px; border-radius: 10px; background: var(--accent-soft); color: var(--ink); font-size: .89rem; }
.install-note svg { color: var(--accent); }
.notice { position: fixed; z-index: 5; bottom: 78px; left: 50%; transform: translateX(-50%); width: min(490px, calc(100% - 30px)); background: var(--paper); box-shadow: var(--shadow); border: 1px solid var(--line); padding: 10px 10px 10px 16px; border-radius: 10px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.notice button { flex: none; }
.notice[data-above-focus] { top: 12px; bottom: auto; }
.noscript { position: fixed; inset: auto 15px 15px; padding: 15px; background: var(--paper); }

.news-head { flex-wrap: wrap; }
.news-head-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.news-controls { display: flex; align-items: end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 17px; }
.news-filter, .news-source-form label { display: grid; gap: 5px; font-size: .86rem; font-weight: 680; }
.news-filter { flex: 0 1 300px; min-width: 0; }
.news-filter select, .news-source-form input { min-width: 0; width: 100%; min-height: 44px; padding: 8px 11px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); }
.news-status { padding: 10px 14px; margin-bottom: 16px; border-left: 3px solid var(--gold); border-radius: 0 7px 7px 0; background: var(--accent-soft); color: var(--ink); font-size: .9rem; overflow-wrap: anywhere; }
.news-list { margin: 0; padding: 0; list-style: none; border: 1px solid var(--line); border-top: 2px solid var(--gold); border-radius: 12px; background: var(--paper); box-shadow: var(--shadow); }
.news-list li + li { border-top: 1px solid var(--line); }
.news-row { display: grid; grid-template-columns: minmax(0, 1fr) fit-content(24%); align-items: center; gap: 12px; width: 100%; min-height: 46px; padding: 7px clamp(12px, 2vw, 19px); border: 0; border-radius: 7px; background: transparent; color: var(--accent); text-align: left; }
.news-row:hover, .news-row:focus-visible { background: var(--accent-soft); }
.news-row:focus-visible { outline-offset: -2px; }
.news-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 690 1.22rem/1.25 var(--serif); }
.news-row.is-opened .news-title { color: var(--muted); font-weight: 560; }
.news-row .news-source-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: right; color: var(--muted); font-size: .81rem; font-weight: 570; }
.news-meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; color: var(--muted); font-size: .81rem; overflow-wrap: anywhere; }
.news-source-name { color: var(--accent); font-weight: 710; }
#news-more { margin-top: 17px; }
.news-reader { max-width: 920px; padding-top: 24px; }
.news-reader-nav { display: flex; justify-content: space-between; padding: 4px clamp(12px, 4vw, 58px); }
.news-reader-nav .plain { padding-inline: 8px; }
.news-article-header { display: grid; justify-items: start; gap: 8px; padding-bottom: 19px; margin-bottom: 24px; border-bottom: 1px solid var(--line); }
.news-article-header h1 { font-size: clamp(2.2rem, 5.5vw, 4rem); color: var(--accent); overflow-wrap: anywhere; }
.news-article-header a { font-size: .85rem; }
.news-sources { width: min(625px, calc(100% - 24px)); }
.news-source-form { display: grid; gap: 10px; padding: 15px; margin-block: 15px; border: 1px solid var(--line); border-radius: 9px; background: var(--rail); }
.news-source-form p { color: var(--muted); font-size: .87rem; }
.news-source-form .dialog-actions { margin-top: 0; }
.news-source-list { display: grid; gap: 3px; margin: 13px 0 0; padding: 0; list-style: none; }
.news-source-row { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 4px 12px; min-width: 0; padding: 5px 0; border-bottom: 1px solid var(--line); }
.news-source-switch { display: flex; align-items: center; gap: 10px; min-height: 44px; overflow-wrap: anywhere; cursor: pointer; }
.news-source-switch input { width: 19px; height: 19px; margin: 0; accent-color: var(--accent); flex: none; }
.news-source-actions { display: flex; flex-wrap: wrap; gap: 5px; }
.news-source-actions .button { padding-inline: 9px; font-size: .85rem; }

@media (max-width: 1000px) {
  .sidebar { padding-inline: 12px; }
  .hero { background-position: 64% bottom; }
}
@media (max-height: 690px) {
  .sidebar { gap: 10px; padding-block: 10px; }
  .navigation { gap: 2px; }
  .sidebar-tail { min-height: 134px; row-gap: 0; }
  .sidebar-art { display: none; }
  .brand { width: 82px; }
}
@media (max-width: 700px) {
  .layout { grid-template-columns: minmax(0,1fr); grid-template-rows: auto minmax(0,1fr); }
  .workspace { grid-row: 2; }
  .sidebar { display: grid; grid-row: 1; grid-template-columns: 58px minmax(0,1fr); align-items: center; gap: 3px 10px; padding: max(5px, env(safe-area-inset-top)) 9px 6px; border: 0; border-bottom: 1px solid var(--line); }
  .sidebar .brand { grid-row: 1; width: 45px; }
  .sidebar-tail { grid-row: 1; grid-column: 2; width: min(173px, 100%); min-height: 0; justify-self: end; display: block; }
  .sidebar-art { display: none; }
  .voice-chip { min-height: 46px; padding: 4px 6px; border-radius: 9px; align-items: center; box-shadow: none; }
  .voice-chip-copy { width: min(106px, 73%); padding: 0; border: 0; border-radius: 0; background: transparent; }
  .voice-chip-copy strong { font-size: 1.17rem; }
  .voice-chip-copy small { font-size: .69rem; }
  .voice-chip-copy:has(.voice-chip-progress:not([hidden])) { width: min(123px, 84%); padding: 2px 3px; background: var(--paper); }
  .vera-portrait { width: 62px; right: 0; bottom: auto; top: 1px; }
  .vera-preparing { width: 74px; right: -7px; }
  .navigation { grid-row: 2; grid-column: 1 / -1; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 3px; }
  .navigation button { justify-content: center; flex-direction: column; text-align: center; gap: 2px; padding: 6px 3px; font-size: .72rem; line-height: 1.2; }
  .navigation button[aria-current=page] { box-shadow: inset 0 -2px var(--gilt); }
  .navigation svg { width: 19px; height: 19px; }
  .page { padding-inline: clamp(15px, 4vw, 28px); }
  .page-head { gap: 11px; }
  .top-import { padding-inline: 10px; }
  .hero { min-height: 230px; padding: 36px clamp(17px, 5vw, 35px) 29px; gap: 13px; background-position: 42% bottom; }
  .hero::before { background: linear-gradient(90deg, #102d22fa, #102d22e6 76%, #102d229e); }
  .hero h2 { font-size: clamp(1.95rem, 5.3vw, 3.4rem); }
  #hero-cover { width: clamp(63px, 19vw, 111px); }
  .cover-binding { border-width: 2px; }
  .empty { flex-wrap: wrap; gap: 13px; }
  .empty h3 { font-size: 1.36rem; }
  .empty-icon { width: 40px; height: 40px; }
  .empty-icon svg { width: 22px; height: 22px; }
  .book-grid { grid-template-columns: repeat(auto-fill,minmax(min(100%, 126px),1fr)); gap: 14px; }
  body[data-view=reader] .layout { grid-template-rows: minmax(0, 1fr); }
  body[data-view=reader] .workspace { grid-row: 1; }
  .reader-bar { grid-template-columns: auto minmax(0,1fr) auto; }
  .reader-bar .plain { padding-inline: 5px; font-size: .87rem; }
  .reader-actions { gap: 4px; }
  .reader-actions .icon-button { width: 44px; }
  .player { grid-template-columns: minmax(0,1fr) auto; gap: 8px; }
  .player-detail { display: none; }
  .book-navigation { grid-column: 1 / -1; }
  .player .play { min-width: 96px; padding-inline: 10px; }
  .player-buttons { gap: 5px; }
  .player-cover { width: 32px; }
  .player-info { gap: 7px; }
  .player-info strong { font-size: 1.12rem; }
  .player.news-queue { grid-template-columns: minmax(0, 1fr); }
  .player.news-queue .player-buttons { justify-content: center; }
  .news-row { grid-template-columns: minmax(0, 1fr); gap: 1px; padding-block: 8px; }
  .news-title { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; white-space: normal; overflow-wrap: anywhere; }
  .news-row .news-source-name { text-align: left; }
}
@media (max-width: 540px) {
  .settings-grid, .install-list, .install-options { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .library-head { align-items: flex-start; flex-direction: column; }
  .page-head h1 { font-size: clamp(2.65rem, 10vw, 3.6rem); }
  .page-head p { max-width: 35ch; }
  .about-intro { align-items: flex-start; flex-direction: column; }
  .about-project dl { grid-template-columns: minmax(0, 1fr); }
  .install-guide header { gap: 8px; }
  .install-guide header .voice-mark { width: 35px; height: 35px; }
  .install-guide header p { font-size: .85rem; }
  .news-controls { align-items: stretch; flex-direction: column; }
  .news-filter { flex-basis: auto; }
  .news-controls .button { align-self: flex-start; }
}
@media (max-width: 420px) {
  .navigation { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .reader-bar { grid-template-columns: minmax(0, 1fr) auto; }
  .reader-title { grid-row: 2; grid-column: 1 / -1; padding-block: 0; }
}
@media (prefers-reduced-motion: no-preference) {
  button, .cover { transition: background-color .16s ease, color .16s ease, border-color .16s ease, filter .16s ease; }
  .vera-portrait { transition: opacity .24s ease; }
  body:is([data-voice=waiting],[data-voice=download],[data-voice=initializing]) .voice-chip .voice-dot {
    animation: vera-activity 1.7s ease-in-out infinite alternate;
  }
}
@keyframes vera-activity { from { opacity: .52; } to { opacity: 1; } }
