:root {
  color-scheme: light;
  --paper: #f8f6f1;
  --white: #fffdf8;
  --ink: #292e27;
  --muted: #62675a;
  --border: #e5dfd4;
  --green: #35513f;
  --red: #a74538;
  --serif: "Songti SC", "Noto Serif CJK SC", "SimSun", Georgia, serif;
  font: 16px/1.55 "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .52; }
a { color: inherit; text-decoration: none; }
svg { width: 1.2rem; height: 1.2rem; flex: none; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; }
:focus-visible { outline: 2px solid #a74538; outline-offset: 4px; }

.site-header { background: #fffdfa; border-bottom: 1px solid #ebe5da; }
.header-inner, .site-main, .site-footer { max-width: 1208px; width: calc(100% - 88px); margin-inline: auto; }
.header-inner { min-height: 72px; display: flex; align-items: center; gap: 32px; }
.brand { display: inline-flex; gap: 10px; align-items: center; flex: none; font: 800 1.6rem/1 var(--serif); letter-spacing: .08em; }
.brand-icon { display: grid; place-items: center; width: 35px; height: 35px; background: var(--red); border-radius: 9px; color: #fff9e9; }
.brand-icon svg { width: 20px; height: 20px; }
.primary-nav { display: flex; gap: 25px; align-self: stretch; flex: none; }
.primary-nav a { position: relative; display: grid; align-items: center; padding: 1px 0; color: var(--muted); font-size: .9rem; white-space: nowrap; }
.primary-nav a:hover, .primary-nav a[aria-current] { color: var(--green); }
.primary-nav a[aria-current] { font-weight: 700; }
.primary-nav a[aria-current]::after { content: ""; height: 2px; position: absolute; bottom: 0; inset-inline: 0; border-radius: 2px; background: var(--green); }
.search-form { display: flex; align-items: center; gap: 9px; min-width: 10rem; max-width: 330px; height: 40px; padding: 0 11px; margin-left: auto; flex: 1; border: 1px solid var(--border); border-radius: 8px; background: #f6f3ed; color: var(--muted); }
.search-form:focus-within { border-color: #879687; box-shadow: 0 0 0 2px #35513f15; }
.search-form input { flex: 1; min-width: 0; padding: 0; border: 0; background: none; color: var(--ink); font-size: .9rem; outline: none; }
.search-form input::placeholder { color: #77766b; opacity: 1; }
.search-form kbd { flex: none; padding: 1px 5px; border: 1px solid #e3ddd2; border-radius: 4px; color: #6b685e; font-size: .72rem; }
.account-actions { display: flex; align-items: center; gap: 14px; flex: none; }
.button { min-height: 42px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid transparent; border-radius: 8px; padding: 8px 15px; font-size: .9rem; font-weight: 650; text-align: center; white-space: nowrap; }
.button-outline { background: var(--white); border-color: #d8d3c6; color: var(--green); }
.button-outline:hover { border-color: #98a08c; background: #f0eee5; }
.button-primary { background: var(--green); color: #fffdf6; }
.button-primary:hover { background: #284432; }
.button-plain, .button-link { background: transparent; color: var(--ink); padding-inline: 5px; }
.button-plain:hover, .button-link:hover { color: var(--red); }
.button-paper { background: #f5edda; color: #2f4034; }
.button-paper:hover { background: #fff8e8; }
#account-trigger span { max-width: 7rem; overflow: hidden; text-overflow: ellipsis; }

.site-main { min-height: 64vh; }
.hero { isolation: isolate; position: relative; display: flex; align-items: center; min-height: clamp(320px, 31vw, 376px); margin-top: 34px; background: #15271c; color: #fff9e9; overflow: hidden; border-radius: 15px; }
.hero picture, .hero img { position: absolute; width: 100%; height: 100%; inset: 0; }
.hero img { object-fit: cover; object-position: 52% center; }
.hero::after { content: ""; position: absolute; inset: 0; z-index: 0; background: linear-gradient(90deg, #0c2119aa, #10251815 69%, transparent); pointer-events: none; }
.hero-content { position: relative; z-index: 1; padding: 38px clamp(35px, 6vw, 76px); }
.hero-label { margin: 0 0 14px; font-size: .875rem; color: #ebd9b6; letter-spacing: .16em; }
.hero-label span { display: inline-block; vertical-align: .23em; margin-right: 7px; width: 20px; height: 1px; background: #c2a877; }
.hero h1 { margin: 0 0 13px; font: 800 clamp(2.6rem, 4.6vw, 4.05rem)/1.15 var(--serif); letter-spacing: .035em; }
.hero-description { margin: 0 0 25px; color: #efeadc; font-size: 1rem; line-height: 1.7; }
.hero .button { padding-inline: 15px; }

.catalog { padding: 37px 0 24px; }
.catalog-head { display: flex; align-items: center; justify-content: space-between; gap: 17px; margin-bottom: 21px; }
.catalog h2 { margin: 0; font: 800 clamp(1.55rem, 2.4vw, 2rem)/1.2 var(--serif); overflow-wrap: anywhere; }
.filters { display: flex; gap: 5px; flex-wrap: wrap; }
.filters button { min-height: 36px; min-width: 3rem; padding: 5px 12px; border: 1px solid transparent; border-radius: 7px; background: transparent; color: var(--muted); font-size: .875rem; }
.filters button:hover { background: #f0ece1; }
.filters button[aria-pressed="true"] { border-color: #dce3d6; background: #e7ece1; color: #36503d; font-weight: 700; }
.book-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 27px 21px; }
.book-card { display: block; min-width: 0; border-radius: 9px; }
.cover-surface { display: grid; place-items: center; aspect-ratio: 1.03; background: #efebe2; border: 1px solid #ebe4d7; border-radius: 9px; padding: 11%; overflow: hidden; }
.book-cover { --cover: #415e53; --cover-dark: #213930; --cover-type: #f7e7c8; --accent: #c9b491; position: relative; width: min(69%, 143px); aspect-ratio: .705; isolation: isolate; overflow: hidden; border-radius: 2px 5px 5px 2px; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 8%; color: var(--cover-type); background: linear-gradient(90deg, #1114, #fff1 5%, #1112 8%, transparent 11%), linear-gradient(156deg, var(--cover), var(--cover-dark)); box-shadow: 5px 6px 10px #4b392d44, inset -2px 0 #0003; transition: transform .2s ease; }
.book-cover::before { content: ""; position: absolute; inset: 8% 10% 8% 13%; z-index: -1; border: 1px solid color-mix(in srgb, var(--accent) 50%, transparent); border-radius: 48% 48% 1px 1px / 20% 20% 1px 1px; background: repeating-linear-gradient(104deg, transparent 0 3px, #fff1 4px, transparent 5px 7px); opacity: .6; }
.book-cover::after { content: ""; position: absolute; width: 82%; height: 36%; bottom: -5%; right: -5%; z-index: -1; border-radius: 100% 30% 0 0; background: repeating-radial-gradient(ellipse at 76% 100%, transparent 0 8px, var(--accent) 9px, transparent 10px 12px); opacity: .37; }
.book-card:hover .book-cover { transform: translateY(-4px) rotate(-1deg); }
.book-cover[data-cover="1"] { --cover: #a35340; --cover-dark: #703a32; --cover-type: #fae4ba; --accent: #e0a882; }
.book-cover[data-cover="2"] { --cover: #4b5e72; --cover-dark: #263a50; --cover-type: #e8e9d8; --accent: #b4bbaf; }
.book-cover[data-cover="3"] { --cover: #b3864a; --cover-dark: #77532d; --cover-type: #fff0cc; --accent: #f6cc79; }
.book-cover[data-cover="4"] { --cover: #758159; --cover-dark: #415238; --cover-type: #fcf0cf; --accent: #dbd29a; }
.book-cover[data-cover="5"] { --cover: #725965; --cover-dark: #4c3746; --cover-type: #f4e1d5; --accent: #d7b2a8; }
.book-cover[data-cover="1"]::after, .book-cover[data-cover="4"]::after { transform: rotate(-15deg); border-radius: 45% 80% 0 0; }
.book-cover[data-cover="2"]::before, .book-cover[data-cover="5"]::before { border-radius: 1px; }
.book-cover[data-cover="3"]::after { inset: auto auto 0 -15%; transform: rotate(13deg); }
.cover-title { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; max-width: 100%; overflow-wrap: anywhere; font: 800 clamp(.95rem, 1.55vw, 1.35rem)/1.32 var(--serif); letter-spacing: .08em; text-align: center; }
.book-cover[data-short="true"] { padding-inline: 5%; }
.book-cover[data-short="true"] .cover-title { font-size: clamp(.74rem, 1.3vw, 1.1rem); letter-spacing: .025em; }
.cover-author { display: block; max-width: 100%; margin-top: 7%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font: 600 .67rem/1.3 var(--serif); letter-spacing: .12em; }
.cover-image { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; visibility: hidden; }
.book-cover.has-image { background: transparent; box-shadow: none; }
.book-cover.has-image::before, .book-cover.has-image::after, .has-image .cover-title, .has-image .cover-author { visibility: hidden; }
.has-image .cover-image { visibility: visible; }
.book-card h3 { text-overflow: ellipsis; overflow: hidden; white-space: nowrap; margin: 12px 0 1px; font-size: 1rem; line-height: 1.45; }
.book-card:hover h3 { color: var(--red); }
.book-card p { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin: 0; color: var(--muted); font-size: .875rem; }
.book-card .card-progress { margin-top: 6px; color: var(--green); }
.empty { display: grid; gap: 10px; justify-items: center; text-align: center; color: var(--muted); background: var(--white); border: 1px solid var(--border); border-radius: 12px; padding: 40px 18px; }
.empty h3, .empty p { margin: 0; }
.empty h3 { color: var(--ink); }
.more { text-align: center; padding-top: 25px; }
.skeleton { aspect-ratio: 1.03; border-radius: 9px; background: #efebe2; }
.site-footer { display: flex; align-items: center; justify-content: space-between; margin-top: 42px; padding: 20px 0 28px; border-top: 1px solid var(--border); color: var(--muted); font-size: .875rem; }
.site-footer > div { display: flex; align-items: center; gap: 12px; }
.footer-brand { font: 800 1.15rem var(--serif); color: var(--ink); }

.breadcrumb { display: inline-block; margin-bottom: 15px; color: var(--muted); font-size: .875rem; }
.breadcrumb:hover { color: var(--red); }
#details { padding-top: 34px; }
.detail-panel { display: grid; grid-template-columns: minmax(175px, 240px) 1fr; gap: clamp(20px, 5vw, 55px); border: 1px solid var(--border); background: var(--white); padding: clamp(20px, 4vw, 44px); border-radius: 14px; }
.detail-panel .cover-surface { min-height: 235px; aspect-ratio: auto; }
.detail-panel .book-cover { width: min(84%, 150px); }
.admin { padding-block: 2rem 1rem; }
.admin h1 { margin: 0; font: 800 clamp(1.6rem, 3vw, 2.25rem)/1.2 var(--serif); }
.admin-toolbar { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 10px; margin: 0 0 1rem; }
.admin-toolbar label { display: grid; min-width: 0; gap: 5px; font-size: .875rem; font-weight: 650; }
.admin-toolbar label:first-child { flex: 1 1 15rem; max-width: 26rem; }
.admin-toolbar input, .admin-toolbar select { min-width: 0; height: 42px; padding: 7px 10px; color: var(--ink); border: 1px solid var(--border); border-radius: 8px; background-color: var(--white); }
.admin-books { display: grid; gap: 8px; margin: 0 0 1rem; padding: 0; list-style: none; }
.admin-book { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 6px 18px; padding: 13px 16px; border: 1px solid var(--border); border-radius: 10px; background: var(--white); }
.admin-book-info { flex: 1 1 16rem; min-width: 0; }
.admin-book h2 { margin: 0; font-size: 1rem; overflow-wrap: anywhere; }
.admin-book p { margin: 3px 0 0; color: var(--muted); font-size: .875rem; overflow-wrap: anywhere; }
.admin-book-actions, .admin-dialog-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.admin-dialog-actions { justify-content: flex-end; margin-top: 12px; }
.admin .dialog-head h2 { overflow-wrap: anywhere; }
.dialog-form .admin-checkbox { display: flex; align-items: center; gap: 8px; }
.dialog-form .admin-checkbox input { width: 16px; height: 16px; min-height: 0; accent-color: var(--green); }
.button-danger { background: #93392e; color: white; border-color: transparent; }
.button-danger:hover { background: #742a22; }
.admin-visibility { margin-right: 3px; padding: 4px 7px; border-radius: 5px; color: var(--green); background: #e7ece1; font-size: .875rem; }
.admin-visibility.is-hidden { background: #f3e8df; color: #854730; }
#admin-more { display: flex; margin-inline: auto; }
.detail-meta { margin: 7px 0; color: var(--muted); }
.detail-panel h1 { font: 800 clamp(2rem, 4vw, 3.25rem)/1.15 var(--serif); margin: 0 0 8px; overflow-wrap: anywhere; }
.detail-description { max-width: 42rem; white-space: pre-line; overflow-wrap: anywhere; }
.detail-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }

body.reading { overflow: hidden; }
body.reading .site-header { display: none; }
body.reading .site-main { width: 100%; max-width: none; }
.reader-layout { height: 100dvh; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto; }
.reader-bar, .reader-controls { display: grid; align-items: center; gap: 10px; background: var(--white); }
.reader-bar { grid-template-columns: minmax(0, 1fr) auto; padding: 10px max(18px, calc((100% - 1040px) / 2)); border-bottom: 1px solid var(--border); }
.reader-controls { grid-template-columns: minmax(4rem, 1fr) auto minmax(4rem, 1fr); padding: 10px 18px; border-top: 1px solid var(--border); }
.reader-controls > .button { justify-self: start; }
.reader-navigation { display: flex; align-items: center; justify-content: center; gap: 10px; }
.reader-navigation .button { flex: none; }
.reader-title { display: flex; align-items: center; min-width: 0; gap: 12px; }
.reader-title .button { flex: none; }
.reader-title strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reader-tool-row, .text-size, .reader-modes { display: flex; align-items: center; gap: 8px; }
.reader-tool-row { flex-wrap: wrap; }
.reader-modes { gap: 2px; padding: 2px; border: 1px solid var(--border); border-radius: 9px; background: var(--paper); }
.reader-modes .button { min-height: 40px; padding-block: 5px; padding-inline: 13px; }
.reader-modes .button[aria-pressed="true"] { background: var(--green); color: var(--white); }
.reader-tools[open] { display: flex; flex-direction: column; gap: 12px; max-width: min(34rem, calc(100% - 24px)); padding: 16px; overflow: hidden; }
.reader-tool-tabs { display: flex; flex: none; gap: 4px; padding: 4px; border-radius: 10px; background: var(--paper); }
.reader-tool-tabs .button { flex: 1; white-space: normal; }
.reader-tool-tabs [aria-pressed="true"] { background: var(--white); color: var(--green); border-color: var(--border); }
.reader-settings { min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 4px; }
.reader-settings h3 { margin: 0 0 8px; font-size: 1rem; }
.reader-display > .button { margin-top: 10px; }
.reader-listening { border-top: 1px solid var(--border); padding-top: 12px; margin-top: 13px; }
.reader-tool-note { flex: 1 1 8em; margin: 0; color: var(--muted); font-size: .875rem; overflow-wrap: anywhere; }
.reader-tool-tip { margin: 9px 0 0; color: var(--muted); font-size: .875rem; }
.reader-voice-settings { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 12px; }
.reader-sleep-settings { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: end; gap: 10px; margin-top: 12px; }
.reader-sleep-status { min-height: 44px; display: grid; align-items: center; margin: 0; color: var(--muted); font-size: .875rem; font-variant-numeric: tabular-nums; }
.reader-tool-field { min-width: 0; display: grid; gap: 5px; font-size: .9rem; color: var(--muted); }
.reader-tool-field select { width: 100%; min-width: 0; min-height: 44px; border: 1px solid var(--border); border-radius: 8px; padding: 6px 8px; color: var(--ink); background-color: var(--paper); font-size: 1rem; text-overflow: ellipsis; }
.reader-rate-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.reader-rate-value { color: var(--green); font-weight: 650; font-variant-numeric: tabular-nums; }
.reader-rate { width: 100%; min-height: 44px; margin: 0; accent-color: var(--green); cursor: pointer; }
.reader-speech-popover { position: fixed; z-index: 2; display: flex; align-items: stretch; max-width: calc(100vw - 16px); padding: 2px 4px; border: 1px solid var(--border); border-radius: 9px; background: var(--white); box-shadow: 0 5px 18px #20291f25; }
.reader-speech-popover .button { flex: 0 1 auto; padding-inline: 9px; color: var(--green); white-space: normal; }
.reader-speech-popover .button + .button { border-left-color: var(--border); border-radius: 0 7px 7px 0; }
.reader-blackout[open] { position: fixed; inset: 0; width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; border-radius: 0; overflow: hidden; background: #000; box-shadow: none; forced-color-adjust: none; }
.reader-blackout::backdrop { background: #000; forced-color-adjust: none; }
.reader-blackout-exit { display: block; width: 100%; height: 100%; margin: 0; padding: 0; border: 0; outline: 0; background: #000; touch-action: manipulation; }
.reader-scroll { position: relative; min-width: 0; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; scrollbar-gutter: stable; }
.reader-scroll.is-paged { touch-action: pan-y pinch-zoom; }
.reader-page { --page-gutter: 28px; max-width: 790px; margin: 0 auto; padding: 40px var(--page-gutter) 64px; }
.reader-scroll.is-paged:not(.has-pdf) { overflow: hidden; scrollbar-gutter: auto; }
.is-paged .reader-page:not(.pdf-page) { width: 100%; height: 100%; overflow: hidden; padding-block: min(4dvh, 28px); }
.is-paged .reader-page article { height: 100%; column-count: 1; column-gap: calc(2 * var(--page-gutter)); column-fill: auto; }
.reader-page h1 { margin: 0 0 .85em; font: 800 1.75em/1.35 var(--serif); }
.reader-page article { color: #343229; font: 1.2rem/2.05 var(--serif); overflow-wrap: anywhere; }
.reader-page article p { margin: 0 0 .9em; white-space: pre-wrap; }
.reader-speaking { background: #f4d88299; }
::highlight(reader-speaking) { background-color: #f4d88299; }
.reader-scroll.has-pdf { container-type: size; overflow-anchor: none; }
.reader-page.pdf-page { width: 100%; max-width: 980px; min-height: 100%; padding: 12px 8px; }
.reader-pdf-sheet { display: grid; align-content: start; min-width: 0; aspect-ratio: .707; }
.reader-pdf-surface { position: relative; --scale-round-x: 1px; --scale-round-y: 1px; }
.reader-pdf-text { position: absolute; inset: 0 auto auto 0; line-height: 1; transform-origin: 0 0; overflow: clip; text-size-adjust: none; -webkit-text-size-adjust: none; }
.reader-pdf-text > :is(span, br) { position: absolute; color: transparent; white-space: pre; cursor: text; transform-origin: 0 0; }
.reader-pdf-text > span { font-size: calc(var(--total-scale-factor) * var(--min-font-size, 1) * var(--font-height)); transform: rotate(var(--rotate, 0deg)) scaleX(var(--scale-x, 1)) scale(calc(1 / var(--min-font-size, 1))); }
.reader-pdf-text[data-main-rotation="90"] { transform: rotate(90deg) translateY(-100%); }
.reader-pdf-text[data-main-rotation="180"] { transform: translate(100%, 100%) rotate(180deg); }
.reader-pdf-text[data-main-rotation="270"] { transform: rotate(270deg) translateX(-100%); }
.pdf-page.is-continuous .reader-pdf-sheet { min-height: 38dvh; min-height: min(38dvh, 100cqh); }
.pdf-page.is-continuous .reader-pdf-sheet:last-child { min-height: 100dvh; min-height: max(0px, calc(100cqh - 24px)); }
.pdf-page.is-continuous .reader-pdf-sheet + .reader-pdf-sheet { margin-top: 14px; }
.pdf-page canvas { display: block; margin-inline: auto; max-width: 100%; background: white; box-shadow: 0 5px 20px #32302820; }
.reader-page .reader-error { text-align: center; color: var(--red); }
.reader-counter { min-width: 7rem; text-align: center; color: var(--muted); font-size: .875rem; }
.reader-status { white-space: nowrap; font-size: .875rem; color: var(--muted); }
.reader-jump { width: 4.5rem; min-height: 38px; margin-right: 3px; border: 1px solid var(--border); border-radius: 7px; padding: 5px; text-align: center; }
.reader-toc { display: flex; flex-direction: column; min-height: 0; gap: 9px; padding: 4px; }
.reader-toc-search { width: 100%; min-width: 0; min-height: 42px; border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; color: var(--ink); background: var(--paper); }
.reader-toc-list { position: relative; min-height: 0; margin: 0; padding: 3px; list-style: none; overflow: auto; overscroll-behavior: contain; }
.reader-toc-list .button { display: flex; width: 100%; justify-content: flex-start; text-align: start; white-space: normal; overflow-wrap: anywhere; padding: 8px; }
.reader-toc-list .button:hover { background: var(--paper); }
.reader-toc-list .button[aria-current] { background: #e6eadf; color: var(--green); }
.reader-toc-list .button:focus-visible { outline-offset: -2px; }
.reader-toc-number { flex: none; min-width: 2.75em; color: var(--muted); font-variant-numeric: tabular-nums; }
.reader-toc-jump, .reader-toc-pager { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.reader-toc-pager { justify-content: space-between; color: var(--muted); font-size: .875rem; }
.reader-toc-info { margin: 0; color: var(--muted); font-size: .875rem; }

dialog { max-width: min(30rem, calc(100% - 28px)); width: 100%; max-height: calc(100dvh - 28px); overflow: auto; padding: 22px 25px 25px; border: 1px solid var(--border); border-radius: 13px; background: var(--white); color: var(--ink); box-shadow: 0 20px 90px #20291f2b; }
dialog::backdrop { background: #202a23aa; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.dialog-head h2 { margin: 0; font: 800 1.55rem var(--serif); }
.icon-button { display: grid; place-items: center; flex: none; width: 39px; height: 39px; border: 0; border-radius: 8px; color: var(--muted); background: transparent; }
.icon-button:hover { background: #f0ece3; }
.dialog-intro { margin: 6px 0 17px; color: var(--muted); font-size: .9rem; }
.upload-hint { margin: 0; color: var(--muted); font-size: .875rem; }
.dialog-form, .dialog-form label { display: grid; gap: 6px; }
.dialog-form { gap: 13px; }
.dialog-form label { font-size: .875rem; font-weight: 650; }
.dialog-form input, .dialog-form select, .dialog-form textarea { width: 100%; min-width: 0; min-height: 41px; color: var(--ink); border: 1px solid #ddd8ca; border-radius: 7px; background-color: #fbf9f4; padding: 7px 10px; font-weight: 400; }
.dialog-form textarea { resize: vertical; }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 15px) 50%, calc(100% - 10px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 25px !important; }
.form-row { display: grid; grid-template-columns: 1fr .7fr; gap: 10px; }
.dialog-form .file-field { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; background: #f4f3eb; border: 1px dashed #b6baaa; border-radius: 8px; padding: 10px; }
.file-field small { display: block; color: var(--muted); font-weight: 400; }
.file-field input { min-height: 36px; padding: 5px; }
.form-error { margin: 0; color: #9b3028; font-size: .875rem; }
progress { width: 100%; accent-color: var(--green); }
.notice { position: fixed; z-index: 3; bottom: 18px; left: 50%; max-width: calc(100% - 24px); width: max-content; transform: translateX(-50%); margin: 0; padding: 9px 15px; border-radius: 8px; background: #2c4435; color: white; box-shadow: 0 4px 12px #0003; font-size: .9rem; }

@media (max-width: 1050px) {
  .header-inner, .site-main, .site-footer { width: calc(100% - 52px); }
  .header-inner { gap: 18px; }
  .primary-nav { gap: 13px; }
  .book-grid { gap: 22px 15px; }
  .account-actions { gap: 8px; }
}

@media (max-width: 850px) {
  .book-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .cover-title { font-size: clamp(1rem, 2.2vw, 1.35rem); }
  .search-form kbd { display: none; }
}

@media (max-width: 700px) {
  .header-inner, .site-main, .site-footer { width: calc(100% - 32px); }
  .header-inner { flex-wrap: wrap; min-height: 0; gap: 0 10px; padding-top: 12px; }
  .account-actions { margin-left: auto; }
  .primary-nav { order: 3; justify-content: space-between; gap: 14px; width: 100%; min-height: 43px; }
  .primary-nav a { justify-content: center; flex: 1; }
  .search-form { order: 2; min-width: 100%; margin-top: 11px; }
  .hero { min-height: 290px; margin-top: 19px; }
  .hero img { object-position: 58% center; }
  .hero::after { background: linear-gradient(90deg, #14281ddd, #14281d70 65%, #14281d30); }
  .hero-content { padding: 24px; }
  .catalog { padding-top: 25px; }
  .catalog-head { align-items: flex-start; flex-direction: column; gap: 10px; margin-bottom: 15px; }
  .filters { gap: 2px; }
  .filters button { min-width: 2.7rem; padding-inline: 8px; }
  .book-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 17px 10px; }
  .cover-title { font-size: clamp(.8rem, 3.2vw, 1.2rem); }
  .cover-author { font-size: .61rem; }
  .book-card h3 { margin-top: 7px; font-size: .94rem; }
  .book-card p { font-size: .82rem; }
  #details { padding-top: 19px; }
  .detail-panel { grid-template-columns: minmax(83px, 27%) 1fr; gap: 14px; padding: 14px; }
  .detail-panel .cover-surface { min-height: 0; align-self: start; aspect-ratio: .82; }
  .detail-panel h1 { font-size: 1.55rem; }
  .detail-actions { margin-top: 12px; }
  .reader-bar, .reader-controls { padding: 6px 10px; }
  .reader-bar .button, .reader-controls .button { padding-inline: 8px; }
  .reader-bar { grid-template-columns: minmax(0, 1fr); }
  .reader-tools[open] { margin: auto 0 0; width: 100%; max-width: none; max-height: 88dvh; border-radius: 17px 17px 0 0; padding: 12px 12px calc(12px + env(safe-area-inset-bottom)); }
  .reader-voice-settings { grid-template-columns: minmax(0, 1fr); }
  .reader-controls { grid-template-columns: auto minmax(0, 1fr); gap: 6px; padding-bottom: calc(6px + env(safe-area-inset-bottom)); }
  .reader-navigation { gap: 4px; }
  .reader-navigation .button { padding-inline: 7px; }
  .reader-counter { min-width: 0; text-wrap: balance; }
  .reader-jump { width: 3.4rem; }
  .reader-page { --page-gutter: 18px; padding-block: 26px 40px; }
  .reader-status { display: none; }
}

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