:root {
    color-scheme: dark;
    --ink: #eee5d1;
    --muted: #b0a58e;
    --green: #caa755;
    --green-dark: #e4c779;
    --green-soft: #3a3425;
    --paper: #121713;
    --white: #f5edda;
    --line: #3b3e32;
    --shadow: 0 14px 40px rgb(0 0 0 / 24%);
    font-family: "Segoe UI", Arial, sans-serif;
    font-synthesis: none;
    text-rendering: optimizeLegibility;
}

* {
    box-sizing: border-box;
}

body {
    min-width: 320px;
    min-height: 100vh;
    margin: 0;
    color: var(--ink);
    background:
        radial-gradient(ellipse at 82% 0%, rgb(126 94 35 / 13%), transparent 34rem),
        radial-gradient(ellipse at 4% 44%, rgb(35 75 53 / 18%), transparent 34rem),
        repeating-linear-gradient(45deg, transparent 0 38px, rgb(194 158 79 / 2%) 39px 40px),
        var(--paper);
}

button,
input {
    font: inherit;
}

button {
    cursor: pointer;
}

.topbar {
    display: flex;
    min-height: 76px;
    align-items: center;
    justify-content: space-between;
    padding: 0 max(5vw, 24px);
    border-bottom: 1px solid rgb(31 48 43 / 7%);
}

.site-nav {
    display: flex;
    align-items: center;
    gap: 6px;
}

.site-nav-link {
    padding: 10px 12px;
    border-radius: 7px;
    color: var(--muted);
    font-size: 13px;
    text-decoration: none;
    transition: color .15s ease, background .15s ease;
}

.site-nav-link:hover,
.site-nav-link.is-active {
    color: #e3c777;
    background: #29291e;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 11px;
    color: var(--ink);
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -.02em;
    text-decoration: none;
}

.brand-mark {
    display: grid;
    width: 34px;
    height: 34px;
    place-items: center;
    border-radius: 11px;
    color: var(--white);
    background: var(--green);
    font-size: 20px;
    font-weight: 500;
}

.privacy-note {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-size: 12px;
}

.privacy-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #6b9a7e;
}

.page {
    width: min(100% - 48px, 1020px);
    margin: 0 auto;
    padding: 66px 0 90px;
}

.intro {
    margin-bottom: 42px;
}

.eyebrow {
    margin: 0 0 12px;
    color: var(--green);
    font-size: 10px;
    font-weight: 750;
    letter-spacing: .16em;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 13px;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(38px, 5vw, 56px);
    font-weight: 400;
    letter-spacing: -.045em;
    line-height: 1.08;
}

.intro-copy {
    margin-bottom: 0;
    color: var(--muted);
    font-size: 15px;
    line-height: 1.6;
}

.add-panel {
    padding: 27px 30px 22px;
    border: 1px solid rgb(49 93 77 / 10%);
    border-radius: 17px;
    background: rgb(255 255 255 / 83%);
    box-shadow: var(--shadow);
}

.section-heading,
.library-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.section-heading {
    margin-bottom: 24px;
}

.section-heading .eyebrow,
.library-heading .eyebrow {
    margin-bottom: 7px;
}

h2 {
    margin-bottom: 0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 26px;
    font-weight: 400;
    letter-spacing: -.025em;
}

.step-number {
    color: #c5cec4;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 28px;
}

.form-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.field {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 8px;
    color: #49564f;
    font-size: 12px;
    font-weight: 650;
}

.field input:not([type="file"]),
.field select {
    width: 100%;
    height: 43px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    outline: none;
    color: var(--ink);
    background: #fff;
    font-size: 13px;
}

.field input:focus,
.field select:focus,
.search-box:focus-within {
    border-color: #81a18b;
    box-shadow: 0 0 0 3px rgb(100 143 112 / 12%);
}

.field input::placeholder,
.search-box input::placeholder {
    color: #a2aaa4;
}

.optional {
    color: #a2aaa4;
    font-weight: 400;
}

.file-field {
    grid-column: 1 / -1;
    gap: 9px;
}

.file-field input {
    width: 100%;
    min-height: 44px;
    padding: 8px;
    border: 1px dashed #cad4c9;
    border-radius: 8px;
    color: var(--muted);
    background: #fbfcf9;
    font-size: 12px;
}

.file-field input::file-selector-button {
    margin-right: 10px;
    padding: 6px 10px;
    border: 0;
    border-radius: 5px;
    color: var(--green-dark);
    background: var(--green-soft);
    font: inherit;
    font-weight: 650;
    cursor: pointer;
}

.additional-volumes {
    grid-column: 1 / -1;
}

.additional-volume-fields {
    display: grid;
    gap: 14px;
}

.add-volume-button {
    margin-top: 14px;
}

.form-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-top: 17px;
}

.form-hint {
    max-width: 480px;
    margin-bottom: 0;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.6;
}

.button {
    display: inline-flex;
    min-height: 42px;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 16px;
    border: 0;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 650;
    transition: background .15s ease, transform .15s ease;
}

.button[hidden] {
    display: none;
}

.button:hover {
    transform: translateY(-1px);
}

.button-primary {
    color: #fff;
    background: var(--green);
}

.button-primary:hover {
    background: var(--green-dark);
}

.button-primary span {
    font-size: 17px;
    font-weight: 400;
}

.message {
    min-height: 0;
    margin: 0;
    color: var(--green-dark);
    font-size: 12px;
}

.message:not(:empty) {
    margin-top: 12px;
}

.message.error {
    color: #a33f36;
}

.library-section {
    margin-top: 57px;
}

.library-heading {
    gap: 20px;
    margin-bottom: 19px;
    flex-wrap: wrap;
}

.text-search-dialog {
    width: min(720px, calc(100vw - 32px));
    max-width: none;
    max-height: min(88vh, 820px);
    padding: 0;
    overflow: auto;
    border: 1px solid #76643a;
    border-radius: 14px;
    color: var(--ink);
    background: #1b241d;
    box-shadow: 0 24px 80px rgb(0 0 0 / 40%);
}

.text-search-dialog::backdrop {
    background: rgb(7 11 8 / 78%);
    backdrop-filter: blur(3px);
}

.text-search-form {
    display: grid;
    gap: 18px;
    padding: 25px;
}

.text-search-form .section-heading {
    margin-bottom: 0;
}

.text-search-filters {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.text-search-form .field {
    color: #d8ceb8;
}

.text-search-form .field input:not([type="file"]),
.text-search-form .field select {
    width: 100%;
    min-height: 42px;
    padding: 9px 11px;
    border: 1px solid #4c5042;
    border-radius: 7px;
    color: var(--ink);
    background: #121713;
}

.text-search-hint {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.6;
}

.text-search-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.text-search-results {
    display: grid;
    gap: 10px;
    max-height: 38vh;
    margin: 0;
    padding: 0 4px 0 24px;
    overflow: auto;
}

.text-search-result {
    width: 100%;
    padding: 13px;
    border: 1px solid #3b4438;
    border-radius: 8px;
    color: var(--ink);
    background: #141b16;
    text-align: left;
}

.text-search-result:hover {
    border-color: var(--green);
    background: #20291f;
}

.text-search-result-title {
    display: block;
    margin-bottom: 4px;
    font-weight: 650;
}

.text-search-result-meta,
.text-search-result-snippet {
    display: block;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.6;
}

.text-search-result-snippet {
    margin-top: 6px;
    color: var(--ink);
}

.count-badge {
    display: inline-grid;
    min-width: 24px;
    height: 24px;
    margin-left: 4px;
    padding: 0 6px;
    place-items: center;
    border-radius: 20px;
    color: var(--green);
    background: var(--green-soft);
    font-family: "Segoe UI", Arial, sans-serif;
    font-size: 11px;
    font-weight: 650;
    vertical-align: 3px;
}

.search-box {
    display: flex;
    width: min(270px, 42vw);
    height: 40px;
    align-items: center;
    gap: 8px;
    padding: 0 11px;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: #8b9890;
    background: #fff;
}

.search-box > span:not(.visually-hidden) {
    font-size: 21px;
    line-height: 1;
}

.search-box input {
    width: 100%;
    border: 0;
    outline: 0;
    color: var(--ink);
    background: transparent;
    font-size: 12px;
}

.book-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 270px), 1fr));
    gap: 16px;
}

.book-card {
    display: flex;
    min-height: 190px;
    flex-direction: column;
    padding: 19px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 5px 18px rgb(31 48 43 / 3%);
}

.book-card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.book-symbol {
    display: grid;
    width: 39px;
    height: 46px;
    flex: 0 0 auto;
    place-items: center;
    border: 1px solid #dce6dc;
    border-radius: 5px 9px 9px 5px;
    color: var(--green);
    background: linear-gradient(90deg, #e7eee5 4px, #f3f6f0 4px);
    font-family: Georgia, "Times New Roman", serif;
    font-size: 19px;
}

.remove-button,
.icon-button {
    display: grid;
    width: 30px;
    height: 30px;
    flex: 0 0 auto;
    place-items: center;
    border: 0;
    border-radius: 7px;
    color: #89938d;
    background: transparent;
    font-size: 18px;
}

.remove-button:hover {
    color: #a33f36;
    background: #fbefed;
}

.book-title {
    overflow: hidden;
    margin: 15px 0 5px;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 17px;
    font-weight: 400;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.book-author,
.book-file {
    overflow: hidden;
    margin-bottom: 0;
    color: var(--muted);
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.book-card-bottom {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: stretch;
    gap: 10px;
    margin-top: auto;
    padding-top: 15px;
}

.book-file {
    color: #9aa39d;
    font-size: 10px;
}

.book-progress {
    margin: 0;
    color: #d1ad5c;
    font-size: 10px;
    line-height: 1.4;
}

.book-progress[hidden] {
    display: none;
}

.book-reading-controls {
    display: grid;
    width: 100%;
    min-width: 0;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: stretch;
    gap: 7px;
}

.add-existing-volume-button {
    width: 100%;
    min-width: 0;
    min-height: 30px;
    padding: 0 8px;
    border: 1px solid #76643a;
    border-radius: 6px;
    color: #e1c777;
    background: transparent;
    font-size: 10px;
    font-weight: 650;
    white-space: nowrap;
}

.add-existing-volume-button:hover {
    background: #29291e;
}

.volume-select {
    width: 100%;
    min-width: 0;
    height: 34px;
    padding: 0 7px;
    border: 1px solid #76643a;
    border-radius: 6px;
    color: var(--ink);
    background: #29291e;
    font-size: 10px;
}

.read-button {
    grid-column: 1 / -1;
    width: 100%;
    height: 34px;
    min-height: 34px;
    padding: 6px 10px;
    border: 1px solid #dfe8de;
    border-radius: 6px;
    color: var(--green-dark);
    background: #f5f8f3;
    font-size: 10px;
    font-weight: 650;
    white-space: nowrap;
}

.read-button:hover {
    border-color: #c1d2c1;
    background: var(--green-soft);
}

.volume-select:focus,
.add-existing-volume-button:focus-visible,
.read-button:focus-visible,
.add-volume-button:focus-visible {
    outline: 2px solid #caa755;
    outline-offset: 2px;
}

.empty-state {
    padding: 43px 20px;
    border: 1px dashed #dce2d8;
    border-radius: 12px;
    text-align: center;
}

.empty-icon {
    display: grid;
    width: 42px;
    height: 42px;
    margin: 0 auto 13px;
    place-items: center;
    border-radius: 50%;
    color: var(--green);
    background: var(--green-soft);
    font-size: 25px;
}

.empty-state h3 {
    margin-bottom: 7px;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 20px;
    font-weight: 400;
}

.empty-state p {
    margin-bottom: 0;
    color: var(--muted);
    font-size: 12px;
}

.reader-dialog {
    width: min(1100px, 96vw);
    height: min(92vh, 900px);
    max-width: none;
    max-height: none;
    padding: 0;
    overflow: hidden;
    border: 0;
    border-radius: 12px;
    background: #f0f0ed;
    box-shadow: 0 24px 80px rgb(0 0 0 / 30%);
}

.reader-dialog:not([open]) {
    display: none;
}

.reader-dialog[open] {
    display: flex;
    flex-direction: column;
}

.reader-dialog::backdrop {
    background: rgb(17 27 23 / 72%);
    backdrop-filter: blur(3px);
}

.reader-toolbar {
    display: flex;
    min-height: 66px;
    flex: 0 0 auto;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 0 20px;
    background: #fff;
}

.reader-label {
    color: var(--green);
    font-size: 9px;
    font-weight: 700;
    letter-spacing: .14em;
}

.reader-book-info h2 {
    max-width: min(75vw, 750px);
    overflow: hidden;
    margin-top: 3px;
    font-family: "Segoe UI", Arial, sans-serif;
    font-size: 14px;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.reader-page-marker {
    margin: 3px 0 0;
    color: #a99f89;
    font-size: 10px;
}

.icon-button {
    width: 34px;
    height: 34px;
    color: #59645e;
    font-size: 26px;
}

.icon-button:hover {
    background: #f0f2ee;
}

.pdf-scroll {
    min-height: 0;
    flex: 1 1 auto;
    overflow: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y pinch-zoom;
    background: #262923;
}

.pdf-status {
    margin: 24px;
    color: #eee5d1;
    font-size: 14px;
    line-height: 1.5;
    text-align: center;
}

.pdf-pages {
    display: grid;
    justify-items: center;
    gap: 16px;
    padding: 16px 12px;
}

.pdf-page {
    width: 100%;
    max-width: 900px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 4px 18px rgb(0 0 0 / 25%);
}

.pdf-page-canvas {
    display: block;
    width: 100%;
    height: auto;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    clip-path: inset(50%);
}

@media (max-width: 620px) {
    .text-search-filters {
        grid-template-columns: 1fr;
    }

    .topbar {
        min-height: 65px;
        padding: 0 20px;
    }

    .brand {
        font-size: 13px;
    }

    .privacy-note {
        font-size: 10px;
    }

    .page {
        width: min(100% - 32px, 1020px);
        padding-top: 47px;
    }

    .intro {
        margin-bottom: 30px;
    }

    .add-panel {
        padding: 22px 18px 17px;
    }

    .form-fields {
        grid-template-columns: 1fr;
    }

    .file-field {
        grid-column: auto;
    }

    .form-footer {
        align-items: stretch;
        flex-direction: column;
    }

    .button-primary {
        align-self: flex-start;
    }

    .library-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .search-box {
        width: 100%;
    }

    .book-grid {
        grid-template-columns: 1fr;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: .01ms !important;
    }
}

/* Deep green, aged gold, and restrained geometric detail evoke an illuminated manuscript. */
.topbar {
    border-bottom-color: rgb(202 167 85 / 20%);
}

.brand-mark {
    border: 1px solid rgb(228 199 121 / 50%);
    border-radius: 50% 50% 44% 44%;
    color: #171a14;
    background: linear-gradient(145deg, #e3c575, #b78b3e);
}

.privacy-dot {
    background: #d1ad5c;
    box-shadow: 0 0 9px rgb(209 173 92 / 45%);
}

.eyebrow,
.reader-label {
    color: #d1ad5c;
}

h1 {
    color: #f1e7d1;
}

.add-panel {
    border-color: rgb(202 167 85 / 28%);
    background:
        linear-gradient(135deg, rgb(202 167 85 / 3%), transparent 45%),
        #1b241d;
    box-shadow: 0 14px 40px rgb(0 0 0 / 25%), inset 0 1px rgb(255 255 255 / 2%);
}

.step-number {
    color: #76643c;
}

.field {
    color: #d8ceb8;
}

.field input:not([type="file"]),
.field select,
.search-box {
    border-color: #41463a;
    color: var(--ink);
    background: #141a16;
}

.field input:focus,
.field select:focus,
.search-box:focus-within {
    border-color: #caa755;
    box-shadow: 0 0 0 3px rgb(202 167 85 / 13%);
}

.field input::placeholder,
.search-box input::placeholder,
.optional {
    color: #827d6e;
}

.file-field input {
    border-color: #65583a;
    color: #c0b69e;
    background: #171d18;
}

.file-field input::file-selector-button {
    color: #191a14;
    background: #caaa5d;
}

.form-hint,
.privacy-note,
.intro-copy {
    color: #a99f89;
}

.button-primary {
    color: #1a1a13;
    background: linear-gradient(135deg, #dfc477, #bd984b);
}

.button-primary:hover {
    background: linear-gradient(135deg, #edd894, #d1ae5e);
}

.message {
    color: #dec779;
}

.message.error {
    color: #e18c78;
}

.count-badge {
    color: #e3c777;
    background: #393321;
}

.search-box {
    color: #c2a85f;
}

.book-card {
    border-color: #3d4437;
    background:
        linear-gradient(145deg, rgb(202 167 85 / 4%), transparent 54%),
        #1b241d;
    box-shadow: 0 7px 22px rgb(0 0 0 / 17%);
}

.book-symbol {
    border-color: #76643a;
    color: #e2c574;
    background: linear-gradient(90deg, #51452b 4px, #292b20 4px);
}

.remove-button,
.icon-button {
    color: #b2a687;
}

.remove-button:hover {
    color: #f0a293;
    background: #392722;
}

.book-author {
    color: #b0a58e;
}

.book-file {
    color: #8f8a78;
}

.read-button {
    border-color: #76643a;
    color: #e1c777;
    background: #29291e;
}

.read-button:hover {
    border-color: #c5a458;
    background: #383322;
}

.empty-state {
    border-color: #65583a;
    background: rgb(27 36 29 / 45%);
}

.empty-icon {
    color: #e0c373;
    background: #393321;
}

.empty-state h3 {
    color: #e8ddc5;
}

.empty-state p {
    color: #a99f89;
}

.reader-dialog {
    border: 1px solid #76643a;
    background: #171c18;
}

.reader-toolbar {
    border-bottom: 1px solid #51472f;
    background: #1b241d;
}

.reader-book-info h2 {
    color: #eee5d1;
}

.reader-page-marker {
    color: #b0a58e;
}

.icon-button:hover {
    color: #e3c777;
    background: #343326;
}

.reader-dialog iframe {
    background: #262923;
}

::selection {
    color: #171a14;
    background: #d9bd70;
}

.topbar {
    border-bottom-color: rgb(202 167 85 / 20%);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.button-outline {
    min-height: 36px;
    padding: 0 12px;
    border: 1px solid #76643a;
    color: #e1c777;
    background: transparent;
}

.button-outline:hover {
    background: #29291e;
}

.add-panel[hidden],
.empty-state[hidden],
.page-view[hidden] {
    display: none;
}

.recommendation-view {
    max-width: 760px;
    margin: 0 auto;
}

.recommendation-form {
    display: grid;
    gap: 18px;
    padding: 27px 30px;
    border: 1px solid rgb(202 167 85 / 28%);
    border-radius: 17px;
    background:
        linear-gradient(135deg, rgb(202 167 85 / 3%), transparent 45%),
        #1b241d;
    box-shadow: 0 14px 40px rgb(0 0 0 / 25%), inset 0 1px rgb(255 255 255 / 2%);
}

.recommendation-form .button-primary {
    justify-self: start;
}

.recommendation-form .message:not(:empty) {
    margin-top: 0;
}

.recommendation-submit:disabled,
.recommendation-form button:disabled {
    cursor: wait;
    opacity: .7;
}

.honeypot-field {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
}

.app-message {
    margin: 0;
    color: #dec779;
    font-size: 13px;
    line-height: 1.6;
}

.app-message:not(:empty) {
    margin: -20px 0 25px;
}

.app-message.error,
.message.error {
    color: #e18c78;
}

.login-dialog {
    width: min(440px, calc(100vw - 32px));
    max-width: none;
    padding: 0;
    border: 1px solid #76643a;
    border-radius: 14px;
    color: var(--ink);
    background: #1b241d;
    box-shadow: 0 24px 80px rgb(0 0 0 / 40%);
}

.login-dialog::backdrop {
    background: rgb(7 11 8 / 78%);
    backdrop-filter: blur(3px);
}

.login-form {
    display: grid;
    gap: 18px;
    padding: 25px;
}

.login-form .section-heading {
    margin-bottom: 0;
}

.login-form .field {
    color: #d8ceb8;
}

/* Keep controls comfortable on touch screens and layouts fluid on small viewports. */
html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    min-width: 0;
    min-height: 100vh;
    min-height: 100svh;
    overflow-wrap: break-word;
}

button,
a,
input,
iframe {
    max-width: 100%;
}

button,
input {
    touch-action: manipulation;
}

:focus-visible {
    outline: 2px solid #e3c777;
    outline-offset: 3px;
}

.reader-dialog,
.login-dialog {
    overscroll-behavior: contain;
}

.reader-dialog {
    height: min(92vh, 900px);
    height: min(92dvh, 900px);
}

.book-grid {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
}

.book-title {
    overflow-wrap: anywhere;
    white-space: normal;
}

@media (max-width: 760px) {
    .topbar {
        flex-wrap: wrap;
        justify-content: space-between;
        gap: 14px;
        padding-right: max(20px, env(safe-area-inset-right));
        padding-left: max(20px, env(safe-area-inset-left));
    }

    .brand {
        order: 1;
    }

    .topbar-actions {
        order: 2;
    }

    .site-nav {
        order: 3;
        width: 100%;
        justify-content: center;
    }

    .topbar-actions {
        gap: 10px;
    }

    .privacy-note {
        max-width: 190px;
        line-height: 1.4;
    }

    .page {
        width: min(100% - 40px, 1020px);
    }

    .field input:not([type="file"]),
    .field select,
    .search-box input {
        font-size: 16px;
    }

    .button,
    .read-button,
    .remove-button,
    .icon-button {
        min-height: 44px;
    }

    .remove-button,
    .icon-button {
        min-width: 44px;
    }
}

@media (max-width: 480px) {
    .topbar {
        min-height: 62px;
        flex-wrap: wrap;
        justify-content: space-between;
        padding-top: 10px;
        padding-bottom: 10px;
    }

    .brand {
        min-width: 0;
        font-size: 12px;
        flex: 1 1 100%;
    }

    .brand-mark {
        width: 32px;
        height: 32px;
        flex: 0 0 auto;
    }

    .privacy-note {
        max-width: 142px;
        font-size: 9px;
    }

    .topbar-actions {
        width: 100%;
        min-width: 0;
        justify-content: space-between;
    }

    .site-nav {
        gap: 4px;
        justify-content: flex-start;
    }

    .site-nav-link {
        padding: 9px 10px;
        font-size: 12px;
    }

    .button-outline {
        padding: 0 9px;
        font-size: 11px;
    }

    .page {
        width: min(100% - 32px, 1020px);
        padding-top: 38px;
        padding-bottom: max(56px, env(safe-area-inset-bottom));
    }

    h1 {
        font-size: clamp(34px, 10vw, 44px);
    }

    .intro-copy {
        font-size: 14px;
    }

    .add-panel {
        padding: 20px 16px;
    }

    .recommendation-form {
        gap: 16px;
        padding: 20px 16px;
    }

    .recommendation-form .button-primary {
        width: 100%;
        justify-self: stretch;
    }

    h2 {
        font-size: 23px;
    }

    .form-footer {
        gap: 14px;
    }

    .button-primary {
        width: 100%;
        align-self: stretch;
    }

    .library-section {
        margin-top: 42px;
    }

    .book-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .book-card {
        min-width: 0;
    }

    .book-card-bottom {
        flex-wrap: wrap;
    }

    .reader-dialog {
        position: fixed;
        inset: 0;
        width: 100%;
        height: 100%;
        height: 100dvh;
        max-height: none;
        margin: 0;
        border-radius: 0;
        padding-bottom: env(safe-area-inset-bottom);
    }

    .reader-toolbar {
        height: auto;
        min-height: 62px;
        flex: 0 0 auto;
        padding: 8px max(12px, env(safe-area-inset-left)) 8px max(16px, env(safe-area-inset-left));
    }

    .reader-book-info {
        min-width: 0;
    }

    .reader-book-info h2 {
        max-width: calc(100vw - 88px);
    }

    .pdf-pages {
        gap: 10px;
        padding: 10px 0;
    }

    .login-form {
        padding: 20px;
    }
}

@media (max-width: 350px) {
    .privacy-note {
        max-width: 112px;
    }

    .brand {
        gap: 7px;
        font-size: 11px;
    }

    .topbar {
        padding-right: max(12px, env(safe-area-inset-right));
        padding-left: max(12px, env(safe-area-inset-left));
    }
}

.login-form .field input {
    min-height: 43px;
    padding: 0 12px;
    border: 1px solid #41463a;
    border-radius: 8px;
    outline: none;
    color: var(--ink);
    background: #141a16;
}

.login-form .field input:focus {
    border-color: #caa755;
    box-shadow: 0 0 0 3px rgb(202 167 85 / 13%);
}

.login-form .button-primary {
    justify-self: start;
}

.login-form .message {
    margin: -8px 0 0;
}

@media (max-width: 620px) {
    .topbar-actions {
        align-items: flex-end;
        flex-direction: column;
        gap: 7px;
    }

    .privacy-note {
        font-size: 9px;
    }

    .button-outline {
        min-height: 30px;
        font-size: 10px;
    }
}

@media (max-width: 480px) {
    .topbar-actions {
        align-items: center;
        flex-direction: row;
        gap: 10px;
    }

    .privacy-note {
        max-width: calc(100% - 120px);
    }

    .button-outline {
        min-height: 44px;
    }
}