:root {
    --bg: #f3f0e9;
    --surface: #fffdf8;
    --surface-2: #ece7dc;
    --text: #20242b;
    --muted: #66707b;
    --border: #d8d1c4;
    --accent: #315f8a;
    --accent-strong: #244a6d;
    --danger: #a73b37;
    --success: #2f7150;
    --shadow: 0 12px 30px rgba(41, 36, 29, .09);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--text);
    background: var(--bg);
}

* { box-sizing: border-box; }
html { min-height: 100%; }
body { min-height: 100vh; margin: 0; background: var(--bg); color: var(--text); line-height: 1.5; }
a { color: var(--accent); text-decoration-thickness: .08em; text-underline-offset: .14em; }
a:hover { color: var(--accent-strong); }
button, input, select { font: inherit; }
input, select {
    width: 100%; min-height: 2.7rem; padding: .58rem .72rem; color: var(--text);
    background: var(--surface); border: 1px solid var(--border); border-radius: .55rem;
}
input:focus, select:focus, button:focus-visible, a:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--accent) 35%, transparent);
    outline-offset: 2px;
}
label > span, .label { display: block; margin-bottom: .28rem; color: var(--muted); font-size: .84rem; font-weight: 700; }

.site-header {
    position: sticky; top: 0; z-index: 20; display: flex; justify-content: space-between; align-items: center;
    gap: 1.5rem; padding: .9rem clamp(1rem, 4vw, 4rem); background: color-mix(in srgb, var(--surface) 92%, transparent);
    border-bottom: 1px solid var(--border); backdrop-filter: blur(14px);
}
.brand { color: var(--text); font-family: Georgia, "Times New Roman", serif; font-size: 1.35rem; font-weight: 700; text-decoration: none; }
.site-header nav { display: flex; flex-wrap: wrap; gap: 1rem; }
.site-header nav a { color: var(--text); font-size: .92rem; font-weight: 650; text-decoration: none; }
.page-shell { width: min(1480px, 100%); min-height: calc(100vh - 8rem); margin: 0 auto; padding: clamp(1rem, 3vw, 2.4rem); }
.site-footer { padding: 1.5rem; color: var(--muted); text-align: center; font-size: .8rem; }
.page-heading { display: flex; justify-content: space-between; align-items: end; gap: 2rem; margin: .5rem 0 1.4rem; }
h1, h2 { font-family: Georgia, "Times New Roman", serif; line-height: 1.14; }
h1 { margin: .12rem 0 .35rem; font-size: clamp(2rem, 5vw, 3.4rem); letter-spacing: -.035em; }
h2 { margin: 0 0 .5rem; }
.page-heading p { margin: 0; color: var(--muted); }
.eyebrow { margin: 0; color: var(--accent) !important; font-size: .75rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.lead { max-width: 70ch; color: var(--muted); font-size: 1.08rem; }
.profile-chip { padding: .52rem .8rem; white-space: nowrap; background: var(--surface-2); border-radius: 999px; text-decoration: none; }

.search-panel {
    display: grid;
    grid-template-columns: minmax(9rem, 1fr) minmax(9rem, 1fr) minmax(14rem, 1.7fr) minmax(12rem, 1.1fr) minmax(7rem, .72fr) minmax(5.5rem, .6fr) auto;
    gap: .65rem; align-items: end;
    padding: 1rem; margin-bottom: 1.5rem; background: var(--surface); border: 1px solid var(--border);
    border-radius: 1rem; box-shadow: var(--shadow);
}
.search-panel .wide-field { grid-column: auto; }
.search-actions, .primary-actions, .format-row, .inline-form, .health-row { display: flex; flex-wrap: wrap; align-items: center; gap: .55rem; }
.search-actions { grid-column: auto; flex-wrap: nowrap; justify-content: flex-end; }
.button, button {
    display: inline-flex; align-items: center; justify-content: center; min-height: 2.55rem; padding: .55rem .9rem;
    color: var(--text); background: var(--surface-2); border: 1px solid var(--border); border-radius: .55rem;
    cursor: pointer; font-weight: 700; text-decoration: none;
}
.button:hover, button:hover { background: color-mix(in srgb, var(--surface-2) 75%, var(--accent) 12%); color: var(--text); }
.button.primary { color: white; background: var(--accent); border-color: var(--accent); }
.button.primary:hover { background: var(--accent-strong); }
.button.quiet { background: transparent; }
.button.danger { color: white; background: var(--danger); border-color: var(--danger); }
.button.small { min-height: 2rem; padding: .3rem .6rem; font-size: .82rem; }
.button.disabled, .button[disabled], button[disabled] { opacity: .48; pointer-events: none; }

.book-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(175px, 1fr)); gap: 1.15rem; }
.book-card {
    min-width: 0; overflow: hidden; background: var(--surface); border: 1px solid var(--border);
    border-radius: .9rem; box-shadow: 0 4px 16px rgba(41, 36, 29, .06); transition: transform .16s ease, box-shadow .16s ease;
}
.book-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.cover-link { display: grid; aspect-ratio: 3 / 4; place-items: center; overflow: hidden; background: var(--surface-2); }
.cover-link img { width: 100%; height: 100%; object-fit: cover; }
.cover-placeholder { display: grid; width: 100%; height: 100%; place-items: center; color: var(--muted); font-size: 3rem; background: linear-gradient(145deg, var(--surface-2), var(--surface)); }
.cover-placeholder.large { min-height: 28rem; }
.book-card-body { display: flex; min-height: 10.5rem; padding: .85rem; flex-direction: column; }
.book-card h2 { margin: 0; font-family: inherit; font-size: .98rem; line-height: 1.3; }
.book-card h2 a { color: var(--text); text-decoration: none; }
.book-card p { margin: .35rem 0 .75rem; color: var(--muted); font-size: .84rem; }
.format-row { margin-top: auto; }
.format-button { padding: .28rem .46rem; font-size: .72rem; font-weight: 800; letter-spacing: .04em; background: var(--surface-2); border-radius: .35rem; text-decoration: none; }
.format-button.read { color: white; background: var(--accent); }
.format-row.compact { margin: 0; }

.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: .85rem; }
.book-table { width: 100%; border-collapse: collapse; }
.book-table th, .book-table td { padding: .75rem .85rem; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.book-table th { color: var(--muted); background: var(--surface-2); font-size: .75rem; letter-spacing: .06em; text-transform: uppercase; }
.book-table tr:last-child td { border-bottom: 0; }
.pagination { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: .65rem; margin: 1.8rem 0; }
.pagination span { color: var(--muted); }
.empty-state { padding: clamp(2rem, 8vw, 6rem); text-align: center; background: var(--surface); border: 1px solid var(--border); border-radius: 1rem; }

.back-link { display: inline-block; margin: 0 0 1rem; }
.book-detail { display: grid; grid-template-columns: minmax(240px, 430px) minmax(0, 1fr); gap: clamp(1.5rem, 5vw, 4rem); align-items: start; }
.detail-cover { overflow: hidden; border-radius: .75rem; box-shadow: var(--shadow); }
.detail-cover img { display: block; width: 100%; height: auto; }
.detail-content h1 { max-width: 24ch; }
.book-author { color: var(--muted); font-size: 1.15rem; font-style: italic; }
.book-facts, .job-facts { display: flex; flex-wrap: wrap; gap: 1rem 2rem; margin: 1.2rem 0; }
.book-facts div, .job-facts div { display: grid; }
.book-facts dt, .job-facts dt { color: var(--muted); font-size: .75rem; font-weight: 800; text-transform: uppercase; }
.book-facts dd, .job-facts dd { margin: 0; }
.primary-actions { margin: 1.25rem 0 2rem; }
.description { max-width: 78ch; padding-top: 1rem; border-top: 1px solid var(--border); }
.description p { white-space: pre-line; }

.narrow-page, .login-panel { width: min(780px, 100%); margin: 0 auto; }
.settings-card, .login-panel {
    padding: 1.15rem; margin: 1rem 0; background: var(--surface); border: 1px solid var(--border); border-radius: .85rem; box-shadow: 0 5px 18px rgba(41,36,29,.05);
}
.login-panel { width: min(480px, 100%); margin-top: 8vh; padding: clamp(1.2rem, 5vw, 2.2rem); }
.login-panel form { display: grid; gap: .75rem; }
.profile-summary { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 1rem; }
.profile-summary strong { display: block; font-size: 1.3rem; }
.profile-stat { display: block; padding: .65rem .75rem; color: var(--text); border-radius: .65rem; text-decoration: none; }
.profile-stat:hover { color: var(--text); background: var(--surface-2); }
.profile-stat > span:last-child { color: var(--accent); font-size: .78rem; font-weight: 700; }
.reading-page { width: min(980px, 100%); margin: 0 auto; }
.reading-list { display: grid; gap: .8rem; }
.reading-item { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; gap: 1rem; align-items: center; padding: .85rem; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: .85rem; box-shadow: 0 4px 16px rgba(41, 36, 29, .05); text-decoration: none; }
.reading-item:hover { color: var(--text); border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); box-shadow: var(--shadow); }
.reading-thumbnail { display: grid; width: 64px; aspect-ratio: 3 / 4; place-items: center; overflow: hidden; background: var(--surface-2); border-radius: .38rem; }
.reading-thumbnail img { width: 100%; height: 100%; object-fit: cover; }
.reading-thumbnail .cover-placeholder { font-size: 1.5rem; }
.reading-book h2 { margin: 0; font-family: inherit; font-size: 1rem; }
.reading-book p, .reading-accessed { margin: .2rem 0 0; color: var(--muted); font-size: .82rem; }
.reading-progress { min-width: 9rem; text-align: right; }
.reading-progress strong { display: block; font-size: 1.15rem; }
.reading-progress progress { width: 9rem; accent-color: var(--accent); }
.bookmark-groups { display: grid; gap: 1rem; }
.bookmark-group { overflow: hidden; background: var(--surface); border: 1px solid var(--border); border-radius: .85rem; box-shadow: 0 4px 16px rgba(41, 36, 29, .05); }
.bookmark-group-header { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; gap: .85rem; align-items: center; padding: .85rem; background: var(--surface-2); }
.bookmark-group-header .reading-thumbnail { width: 52px; }
.bookmark-group-header h2 { margin: 0; font-family: inherit; font-size: 1rem; }
.bookmark-group-header p { margin: .15rem 0 0; color: var(--muted); font-size: .8rem; }
.bookmark-list { display: grid; }
.bookmark-link { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 1rem; padding: .8rem 1rem; color: var(--text); border-top: 1px solid var(--border); text-decoration: none; }
.bookmark-link:hover { color: var(--text); background: color-mix(in srgb, var(--surface-2) 55%, transparent); }
.bookmark-label { display: block; font-weight: 750; }
.bookmark-location { display: block; max-width: 65ch; overflow: hidden; color: var(--muted); font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .7rem; text-overflow: ellipsis; white-space: nowrap; }
.bookmark-date { align-self: center; color: var(--muted); font-size: .78rem; white-space: nowrap; }
.inline-form { display: flex; align-items: end; }
.inline-form > div:first-child { flex: 1 1 18rem; }
.inline-form label { min-width: 10rem; }
.validation-error { color: var(--danger); }
.notice { display: flex; gap: .4rem; flex-direction: column; padding: .85rem 1rem; margin: 1rem 0; border-left: .3rem solid var(--accent); background: var(--surface); border-radius: .4rem; }
.notice.danger { border-color: var(--danger); }
.notice.success { border-color: var(--success); }

.health-row { margin-bottom: 1rem; }
.health { padding: .35rem .6rem; border-radius: 999px; font-size: .8rem; font-weight: 800; }
.health.good { color: var(--success); background: color-mix(in srgb, var(--success) 12%, var(--surface)); }
.health.bad { color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, var(--surface)); }
.stat-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: .8rem; margin-bottom: 1rem; }
.stat-grid > div, .stat-card { padding: 1rem; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: .8rem; text-decoration: none; }
.stat-card:hover { color: var(--text); border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); box-shadow: var(--shadow); }
.stat-grid span { display: block; color: var(--muted); font-size: .78rem; font-weight: 700; }
.stat-grid strong { font-size: clamp(1.4rem, 3vw, 2.15rem); }
.current-profile-label { display: inline-block !important; margin-left: .5rem; padding: .14rem .4rem; color: var(--success) !important; background: color-mix(in srgb, var(--success) 12%, var(--surface)); border-radius: 999px; font-size: .68rem !important; }
.profile-table form { margin: 0; }
.admin-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.admin-grid .settings-card { display: flex; flex-direction: column; margin: 0; }
.admin-grid form { margin-top: auto; }
.check-row { display: flex; align-items: start; gap: .5rem; margin: .8rem 0; font-size: .86rem; }
.check-row input { width: auto; min-height: 0; margin-top: .25rem; }
.admin-section { margin-top: 2rem; }
.section-heading, .job-summary { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.live-indicator { color: var(--success); font-size: .82rem; font-weight: 800; }
.job-list { display: grid; gap: .7rem; }
.job-card { padding: .9rem 1rem; background: var(--surface); border: 1px solid var(--border); border-radius: .75rem; }
.job-summary > span { color: var(--muted); font-size: .8rem; }
.job-card p { margin: .35rem 0; color: var(--muted); }
.job-card progress { width: 100%; accent-color: var(--accent); }
.status { margin-left: .5rem; padding: .18rem .38rem; font-size: .68rem; font-weight: 800; text-transform: uppercase; background: var(--surface-2); border-radius: .3rem; }
.status.running, .status.queued { color: var(--accent); }
.status.failed, .status.completedwitherrors { color: var(--danger); }
.status.completed { color: var(--success); }
.error-cell { max-width: 55ch; color: var(--danger); font-size: .85rem; }
.book-tools { display: flex; justify-content: space-between; align-items: end; gap: 1rem; }

.reader-app { position: relative; display: grid; width: 100%; max-width: 100%; min-width: 0; height: calc(100vh - 8.5rem); min-height: 560px; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto minmax(0, 1fr) auto; overflow: hidden; background: #fffdf8; border: 1px solid var(--border); border-radius: .8rem; box-shadow: var(--shadow); }
.reader-app > * { min-width: 0; max-width: 100%; }
.reader-app [hidden] { display: none !important; }
.reader-controls { display: contents; }
.reader-toolbar { position: relative; z-index: 3; display: flex; width: 100%; grid-row: 1; flex-wrap: wrap; align-items: center; gap: .45rem; overflow-x: hidden; padding: .55rem; color: var(--text); background: var(--surface); border-bottom: 1px solid var(--border); }
.reader-toolbar button, .reader-toolbar select { width: auto; min-height: 2.25rem; padding: .35rem .55rem; }
.reader-close { padding: .4rem; color: var(--text); font-size: 1.4rem; text-decoration: none; }
.reader-title { min-width: 10rem; flex: 1 1 20rem; overflow: hidden; }
.reader-title strong, .reader-title span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reader-title span { color: var(--muted); font-size: .72rem; }
.font-control { display: flex; align-items: center; gap: .35rem; color: var(--muted); font-size: .78rem; }
.font-control input { width: 6rem; min-height: auto; padding: 0; }
.reader-search-panel { position: relative; z-index: 2; display: flex; width: 100%; min-width: 0; grid-row: 2; align-items: center; flex-wrap: wrap; gap: .5rem; overflow-x: hidden; padding: .55rem; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.reader-search-panel input { width: min(24rem, 100%); min-height: 2.35rem; }
.reader-search-panel select { width: min(34rem, 100%); min-height: 2.35rem; }
.reader-search-panel span { color: var(--muted); font-size: .8rem; }
.epub-viewer { position: relative; z-index: 1; width: 100%; max-width: 100%; min-width: 0; min-height: 0; grid-row: 3; overflow: hidden; }
.epub-viewer > div, .epub-viewer iframe { max-width: 100% !important; min-width: 0 !important; }
.reader-status { position: absolute; z-index: 4; align-self: center; justify-self: center; padding: .75rem 1rem; background: var(--surface); border-radius: .5rem; box-shadow: var(--shadow); }
.reader-browse-panel { position: absolute; z-index: 6; right: 1rem; bottom: 1rem; width: min(44rem, calc(100% - 2rem)); padding: .9rem 1rem; color: var(--text); background: color-mix(in srgb, var(--surface) 96%, transparent); border: 1px solid var(--border); border-radius: .85rem; box-shadow: 0 18px 45px rgba(23, 27, 32, .24); backdrop-filter: blur(12px); }
.reader-browse-panel[hidden] { display: none; }
.reader-browse-heading { display: flex; justify-content: space-between; align-items: start; gap: 1rem; }
.reader-browse-heading strong, .reader-browse-heading span { display: block; }
.reader-browse-heading span, .reader-browse-panel p { color: var(--muted); font-size: .78rem; }
#reader-browse-percent { font-weight: 800; }
#reader-browse-collapse { flex: 0 0 auto; margin-left: auto; min-height: 2rem; padding: .25rem .55rem; font-size: .78rem; }
.reader-browse-restore { display: flex; grid-row: 4; align-items: center; justify-content: center; flex-wrap: wrap; gap: .35rem .8rem; width: 100%; min-height: 2.25rem; padding: .35rem .7rem; color: var(--text); background: var(--surface-2); border: 0; border-top: 1px solid var(--border); border-radius: 0; font-size: .78rem; }
.reader-browse-restore[hidden] { display: none; }
.reader-browse-restore > span:last-child { color: var(--accent); }
.profile-switch-form { display: inline; }
.profile-switch { min-height: auto; padding: 0; color: var(--accent); background: transparent; border: 0; border-radius: 0; font: inherit; font-weight: 700; text-align: left; text-decoration: underline; text-underline-offset: .15em; }
.reader-browse-slider-label { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: .65rem; align-items: center; margin-top: .7rem; }
.reader-browse-slider-label > span { margin: 0; white-space: nowrap; }
.reader-browse-slider-label input { width: 100%; min-height: auto; padding: 0; }
.reader-browse-panel p { margin: .45rem 0 .7rem; }
.reader-browse-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: .5rem; }
#reader-browse-toggle.active { color: white; background: var(--accent); border-color: var(--accent); }

html.reader-fullscreen-open, body.reader-fullscreen-open { overflow: hidden; }
.reader-fullscreen-open .site-header, .reader-fullscreen-open .site-footer { display: none; }
.reader-app.reader-immersive { position: fixed; inset: 0; z-index: 1000; width: 100%; height: 100vh; height: 100dvh; min-height: 0; max-height: none; margin: 0; padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); grid-template-rows: minmax(0, 1fr); border: 0; border-radius: 0; box-shadow: none; background: var(--reader-page-background, #fffdf8); }
.reader-immersive .epub-viewer { grid-row: 1; grid-column: 1; }
.reader-immersive .reader-controls { position: absolute; z-index: 7; top: env(safe-area-inset-top); left: env(safe-area-inset-left); right: env(safe-area-inset-right); display: grid; grid-template-rows: auto auto; max-height: 52%; overflow-y: auto; overscroll-behavior: contain; background: var(--surface); border-bottom: 1px solid var(--border); box-shadow: var(--shadow); }
.reader-immersive .reader-toolbar { max-height: none; overflow: visible; }
.reader-immersive .reader-toolbar button, .reader-immersive .reader-toolbar select { min-height: 2.75rem; }
.reader-immersive .reader-browse-panel { bottom: max(.5rem, env(safe-area-inset-bottom)); max-height: 42%; overflow-y: auto; overscroll-behavior: contain; }
.reader-immersive .reader-browse-restore { position: absolute; z-index: 6; bottom: env(safe-area-inset-bottom); left: 0; grid-row: auto; }
.reader-immersive:not(.reader-controls-visible) .reader-browse-panel, .reader-immersive:not(.reader-controls-visible) .reader-browse-restore { display: none; }
.reader-fullscreen-hint { position: absolute; z-index: 8; left: 50%; bottom: max(1rem, env(safe-area-inset-bottom)); width: min(30rem, calc(100% - 2rem)); margin: 0; padding: .65rem .85rem; transform: translateX(-50%); pointer-events: none; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: .6rem; box-shadow: var(--shadow); font-size: .85rem; text-align: center; }
.reader-immersive[data-reading-theme="light"] { --reader-page-background: #fffdf8; --surface: #fffdf8; --surface-2: #f1eee7; --text: #20242b; --muted: #59616d; --border: #d9d3c8; --accent: #315f8a; }
.reader-immersive[data-reading-theme="sepia"] { --reader-page-background: #f3ead5; --surface: #f3ead5; --surface-2: #e8dcc2; --text: #3f3428; --muted: #655747; --border: #cbbd9f; --accent: #7a4a24; }
.reader-immersive[data-reading-theme="dark"] { --reader-page-background: #17191d; --surface: #17191d; --surface-2: #252a31; --text: #e8e5df; --muted: #a9b0b8; --border: #343a42; --accent: #91b7db; }

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #111418; --surface: #191d22; --surface-2: #252a31; --text: #ece8df; --muted: #a9b0b8;
        --border: #343a42; --accent: #8bb9e1; --accent-strong: #b5d4ee; --danger: #eb7c74; --success: #78c99b;
        --shadow: 0 12px 30px rgba(0,0,0,.25);
    }
}

@media (max-width: 1180px) {
    .search-panel { grid-template-columns: repeat(3, 1fr); }
    .search-panel .wide-field { grid-column: span 2; }
    .search-actions { grid-column: span 3; }
    .stat-grid { grid-template-columns: repeat(3, 1fr); }
    .admin-grid { grid-template-columns: 1fr; }
    .reader-title { flex-basis: calc(100% - 3rem); }
    .reader-app { height: calc(100vh - 10rem); }
}

@media (max-width: 700px) {
    .site-header { position: static; align-items: start; flex-direction: column; gap: .55rem; }
    .site-header nav { gap: .75rem; }
    .page-heading { align-items: start; flex-direction: column; gap: .7rem; }
    .search-panel { grid-template-columns: 1fr 1fr; }
    .search-panel .wide-field { grid-column: span 2; }
    .search-actions { grid-column: span 2; }
    .book-grid { grid-template-columns: repeat(auto-fill, minmax(145px, 1fr)); gap: .75rem; }
    .book-detail { grid-template-columns: 1fr; }
    .detail-cover { width: min(380px, 100%); margin: 0 auto; }
    .profile-summary, .stat-grid { grid-template-columns: 1fr 1fr; }
    .profile-summary > div:first-child { grid-column: span 2; }
    .reading-item { grid-template-columns: 52px minmax(0, 1fr); }
    .reading-thumbnail { width: 52px; }
    .reading-progress { grid-column: 2; min-width: 0; text-align: left; }
    .reading-progress progress { width: min(14rem, 100%); }
    .bookmark-group-header { grid-template-columns: 44px minmax(0, 1fr); }
    .bookmark-group-header .reading-thumbnail { width: 44px; }
    .bookmark-group-header .reading-accessed { grid-column: 2; }
    .bookmark-link { grid-template-columns: 1fr; gap: .25rem; }
    .bookmark-date { white-space: normal; }
    .book-tools { align-items: stretch; flex-direction: column; }
    .book-tools .inline-form { width: 100%; }
    .reader-app { height: calc(100vh - 3rem); min-height: 520px; margin: -1rem; border-radius: 0; }
    .reader-toolbar { max-height: 10rem; overflow-y: auto; }
    #reader-bookmark, #reader-clear { font-size: .75rem; }
    .reader-browse-panel { right: .5rem; bottom: .5rem; width: calc(100% - 1rem); }
    .reader-browse-slider-label { grid-template-columns: 1fr; gap: .3rem; }
    .reader-browse-actions { justify-content: stretch; }
    .reader-browse-actions button { flex: 1 1 12rem; }
}

@media (max-width: 430px) {
    .search-panel { grid-template-columns: 1fr; }
    .search-panel .wide-field, .search-actions { grid-column: span 1; }
    .book-grid { grid-template-columns: 1fr 1fr; }
    .stat-grid, .profile-summary { grid-template-columns: 1fr; }
    .profile-summary > div:first-child { grid-column: span 1; }
    .pagination .button:first-child, .pagination .button:last-child { display: none; }
}

/* Account forms keep labels/fields readable and checkbox labels easy to tap on phones. */
.account-form { display: grid; gap: 1rem; }
.account-form > label:not(.check-row) { display: grid; gap: .3rem; }
.account-form > label > span { margin-bottom: 0; }
.account-form > .button { justify-self: start; }
.site-header nav { align-items: center; }
