.literature-search-section {
    padding-top: .25rem;
}

.literature-search-section .search-bar {
    margin-bottom: .75rem;
}

.literature-discovery {
    padding: 1.65rem;
}

.literature-section-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.35rem;
}

.literature-section-heading h1 {
    margin: 0 0 .4rem;
    color: #29494e;
    font-family: 'Open Sans', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: clamp(1.45rem, 2.2vw, 1.9rem);
    font-weight: 700;
    line-height: 1.2;
}

.literature-section-heading .discovery-description {
    margin: 0;
}

.literature-result-count {
    flex: 0 0 auto;
    color: #718084;
    font-size: .88rem;
}

.literature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(225px, 1fr));
    align-items: stretch;
    gap: 1.15rem;
}

.literature-card {
    display: flex;
    min-width: 0;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid #e0e9e8;
    border-radius: 13px;
    background: #fff;
    color: #2c3e50;
    text-decoration: none;
    box-shadow: 0 3px 12px rgba(31, 66, 75, .055);
    transition: transform .18s ease, box-shadow .18s ease;
}

.literature-card:hover,
.literature-card:focus-visible {
    transform: translateY(-3px);
    box-shadow: 0 10px 24px rgba(23, 116, 132, .13);
}

.literature-cover {
    position: relative;
    display: grid;
    aspect-ratio: .72;
    overflow: hidden;
    place-items: center;
    background: #eaf1f0;
}

.literature-cover img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.literature-cover-placeholder {
    position: relative;
    display: flex;
    width: 76%;
    height: 86%;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .9rem;
    padding: 1.2rem;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, .42);
    border-radius: 5px 10px 10px 5px;
    background:
        linear-gradient(90deg, rgba(15, 61, 69, .42) 0 7%, transparent 7% 100%),
        linear-gradient(145deg, #27889a 0%, #176978 50%, #125461 100%);
    color: #fff;
    text-align: center;
    box-shadow: 9px 12px 24px rgba(21, 65, 71, .24), inset 7px 0 11px rgba(4, 37, 44, .2);
}

.literature-cover-placeholder::after {
    position: absolute;
    inset: .65rem;
    border: 1px solid rgba(236, 247, 245, .42);
    border-radius: 2px 5px 5px 2px;
    content: "";
    pointer-events: none;
}

.book-placeholder-mark {
    color: rgba(255, 255, 255, .85);
    font-size: 1.6rem;
}

.book-placeholder-title {
    display: -webkit-box;
    max-width: 100%;
    overflow: hidden;
    font-family: 'Open Sans', sans-serif;
    font-size: clamp(.85rem, 1.2vw, 1.05rem);
    font-weight: 700;
    line-height: 1.4;
    text-overflow: ellipsis;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 5;
}

.book-placeholder-author {
    display: -webkit-box;
    max-width: 100%;
    overflow: hidden;
    color: rgba(255, 255, 255, .83);
    font-size: .75rem;
    line-height: 1.35;
    text-overflow: ellipsis;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.literature-card-content {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: .45rem;
    padding: 1rem;
}

.literature-card-content h2 {
    margin: 0;
    color: #2c3e50;
    font-family: 'Open Sans', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 1.02rem;
    font-weight: 700;
    line-height: 1.35;
}

.literature-author {
    margin: 0;
    color: #168394;
    font-size: .84rem;
    font-weight: 600;
}

.literature-card-description {
    display: -webkit-box;
    margin: .1rem 0 .3rem;
    overflow: hidden;
    color: #718084;
    font-size: .84rem;
    line-height: 1.55;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 5;
}

.literature-card-formats {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
    margin-top: auto;
    padding-top: .5rem;
}

.literature-card-formats span {
    padding: .22rem .55rem;
    border: 1px solid #c9e5e9;
    border-radius: 999px;
    background: #eff9fa;
    color: #177b8c;
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .04em;
}

.literature-pagination {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: .35rem;
    margin-top: 1.6rem;
}

.literature-pagination a {
    display: grid;
    min-width: 2.35rem;
    min-height: 2.35rem;
    place-items: center;
    border: 1px solid #d6e5e6;
    border-radius: 8px;
    background: #fff;
    color: #48656b;
    text-decoration: none;
}

.literature-pagination a.active,
.literature-pagination a:hover {
    border-color: #17a2b8;
    background: #e7f6f8;
    color: #138496;
}

.literature-reader-body {
    overflow-anchor: none;
}

.literature-reader-page {
    width: min(1400px, calc(100% - 3rem));
    margin: 1.3rem auto 3rem;
}

.literature-back-link {
    display: inline-block;
    margin-bottom: .8rem;
    color: #138496;
    font-weight: 600;
    text-decoration: none;
}

.literature-back-link:hover {
    text-decoration: underline;
}

.literature-reader-shell,
.literature-not-found {
    overflow: visible;
    border: 1px solid #e0e9e8;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 8px 28px rgba(31, 66, 75, .07);
}

.literature-reader-shell {
    padding: clamp(1rem, 2.5vw, 2rem);
}

.literature-not-found {
    padding: 2rem;
}

.literature-not-found h1 {
    margin: 0 0 .6rem;
    font-family: 'Open Sans', sans-serif;
    font-size: 1.5rem;
}

.literature-reader-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1.25rem;
    margin-bottom: 1.25rem;
}

.literature-reader-title {
    min-width: 0;
}

.literature-reader-title h1 {
    margin: 0;
    color: #29494e;
    font-family: 'Open Sans', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: clamp(1.35rem, 2.4vw, 1.9rem);
    font-weight: 700;
    line-height: 1.25;
}

.literature-reader-author {
    margin: .35rem 0 0;
    color: #168394;
    font-weight: 600;
}

.literature-reader-description {
    max-width: 850px;
    margin: .65rem 0 0;
    color: #65777b;
    font-size: .9rem;
    line-height: 1.55;
}

.literature-reader-actions {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: .55rem;
}

.literature-download-button,
.literature-format-link {
    display: inline-flex;
    min-height: 42px;
    align-items: center;
    justify-content: center;
    padding: .65rem .95rem;
    border: 0;
    border-radius: 8px;
    background: var(--primary-color, #17a2b8);
    color: #fff;
    font: inherit;
    font-size: .9rem;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
}

.literature-download-button:hover,
.literature-format-link:hover {
    background: var(--primary-dark, #138496);
    color: #fff;
}

.literature-share-link {
    position: relative;
    gap: .4rem;
}

.literature-share-link svg {
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.literature-download-menu {
    position: relative;
}

.literature-download-menu summary {
    list-style: none;
}

.literature-download-menu summary::-webkit-details-marker {
    display: none;
}

.literature-download-button::after {
    margin-left: .5rem;
    content: "⌄";
    font-size: 1rem;
    line-height: 1;
}

.literature-download-options {
    position: absolute;
    z-index: 30;
    top: calc(100% + .4rem);
    right: 0;
    display: grid;
    min-width: 155px;
    gap: .2rem;
    padding: .35rem;
    border: 1px solid #dce8e8;
    border-radius: 9px;
    background: #fff;
    box-shadow: 0 8px 20px rgba(31, 66, 75, .14);
}

.literature-download-options a {
    padding: .55rem .65rem;
    border-radius: 6px;
    color: #3f5f66;
    font-size: .85rem;
    text-decoration: none;
    white-space: nowrap;
}

.literature-download-options a:hover {
    background: #eaf7f9;
    color: #138496;
}

.literature-reader-toolbar {
    display: flex;
    align-items: center;
    gap: .7rem;
    padding: .65rem .75rem;
    border: 1px solid #deeaeb;
    border-radius: 10px 10px 0 0;
    background: #f5fafb;
}

.literature-toc-label {
    flex: 0 0 auto;
    color: #52666b;
    font-size: .82rem;
    font-weight: 700;
}

#literature-toc {
    min-width: 150px;
    max-width: 540px;
    flex: 1 1 280px;
    padding: .55rem .7rem;
    border: 1px solid #cbdad7;
    border-radius: 7px;
    background: #fff;
    color: #29494e;
    font: inherit;
    font-size: .85rem;
}

.literature-reader-controls {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: .35rem;
}

.literature-reader-controls button {
    display: grid;
    min-width: 36px;
    min-height: 36px;
    place-items: center;
    border: 1px solid #cadfe2;
    border-radius: 7px;
    background: #fff;
    color: #138496;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.literature-reader-controls button:hover:not(:disabled) {
    border-color: #17a2b8;
    background: #e7f6f8;
}

.literature-reader-controls button:disabled {
    opacity: .45;
    cursor: not-allowed;
}

#epub-font-value,
#pdf-zoom-value,
#pdf-page-status {
    min-width: 42px;
    color: #627478;
    font-size: .78rem;
    text-align: center;
    white-space: nowrap;
}

.reader-control-divider {
    width: 1px;
    height: 24px;
    margin: 0 .2rem;
    background: #d6e4e5;
}

.literature-reader-status {
    min-height: 29px;
    padding: .3rem .75rem;
    border-right: 1px solid #deeaeb;
    border-left: 1px solid #deeaeb;
    background: #fbfdfd;
    color: #738286;
    font-size: .75rem;
}

.literature-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    min-height: 180px;
    padding: 2rem 1rem;
    text-align: left;
}

.literature-loading[hidden] {
    display: none;
}

.literature-loading strong {
    display: block;
    color: #138496;
    font-size: 1.08rem;
}

.literature-loading p {
    margin: .35rem 0 0;
    font-size: .9rem;
    line-height: 1.5;
}

.literature-loading-spinner {
    flex: 0 0 38px;
    width: 38px;
    height: 38px;
    border: 3px solid rgba(19, 132, 150, .2);
    border-top-color: #138496;
    border-radius: 50%;
    animation: literature-loading-spin .85s linear infinite;
}

.literature-loading.is-finishing {
    min-height: 0;
    padding: .55rem .75rem;
    gap: .65rem;
}

.literature-loading.is-finishing .literature-loading-spinner {
    flex-basis: 22px;
    width: 22px;
    height: 22px;
    border-width: 2px;
}

.literature-loading.is-finishing strong {
    font-size: .88rem;
}

.literature-loading.is-finishing p {
    margin-top: .15rem;
    font-size: .78rem;
}

@keyframes literature-loading-spin {
    to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
    .literature-loading-spinner { animation: none; }
}

html[data-reader-theme="dark"] .literature-loading strong {
    color: #5cb8c4;
}

.epub-viewer,
.pdf-viewer {
    width: 100%;
    min-height: 62vh;
    overflow: hidden;
    border: 1px solid #deeaeb;
    border-top: 0;
    border-radius: 0 0 10px 10px;
    background: #edf2f1;
}

.epub-viewer {
    height: min(78vh, 920px);
    min-height: 560px;
    background: #eef2f0;
}

.epub-viewer.epub-article-viewer {
    height: auto;
    min-height: 0;
    max-height: none;
    overflow: visible;
    border: 0;
    border-radius: 0;
    background: transparent;
    overflow-anchor: none;
    scroll-behavior: auto;
}

.epub-article-viewer .epub-container,
.epub-article-viewer .epub-view {
    overflow-anchor: none !important;
}

.epub-article-viewer .epub-container {
    width: 100% !important;
    max-width: 100%;
}

.epub-viewer iframe {
    width: 100%;
    height: 100%;
    border: 0 !important;
    background: #fff;
}

.pdf-viewer {
    display: flex;
    max-height: 82vh;
    justify-content: center;
    overflow: auto;
    padding: 1rem;
    background: #e9eeed;
}

#pdf-canvas {
    display: block;
    max-width: none;
    background: #fff;
    box-shadow: 0 4px 18px rgba(31, 50, 55, .17);
}

.literature-reader-error {
    margin-top: .75rem;
    padding: 1rem;
    border: 1px solid #ead6ae;
    border-radius: 8px;
    background: #fff9eb;
    color: #5f5136;
}

.literature-reader-error p {
    margin: .4rem 0 0;
}

.literature-reader-error a {
    color: #138496;
    font-weight: 600;
}

.literature-attribution {
    margin-top: 1.15rem;
    padding-top: .85rem;
    border-top: 1px solid #e7eeee;
    color: #738286;
    font-size: .8rem;
    line-height: 1.5;
}

.literature-attribution p {
    margin: .2rem 0;
}

@media (max-width: 760px) {
    .literature-discovery {
        padding: 1rem;
    }

    .literature-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: .75rem;
    }

    .literature-cover {
        aspect-ratio: .78;
    }

    .literature-cover-placeholder {
        width: 82%;
        height: 88%;
        gap: .5rem;
        padding: .8rem;
    }

    .literature-card-content {
        gap: .35rem;
        padding: .75rem;
    }

    .literature-card-content h2 {
        font-size: .9rem;
    }

    .literature-card-description {
        font-size: .78rem;
        -webkit-line-clamp: 4;
    }

    .literature-card-formats {
        gap: .25rem;
    }

    .literature-card-formats span {
        padding: .17rem .42rem;
        font-size: .62rem;
    }

    .literature-section-heading {
        align-items: flex-start;
    }

    .literature-result-count {
        padding-top: .2rem;
        font-size: .78rem;
    }

    .literature-reader-page {
        width: calc(100% - 1.5rem);
        margin-top: .8rem;
    }

    .literature-reader-shell {
        padding: .85rem;
    }

    .literature-reader-heading {
        flex-direction: column;
        gap: .8rem;
    }

    .literature-reader-actions {
        width: 100%;
        flex-wrap: wrap;
        justify-content: flex-end;
    }

    .literature-reader-toolbar {
        flex-wrap: wrap;
        gap: .5rem;
        padding: .55rem;
    }

    .literature-toc-label {
        width: 100%;
    }

    #literature-toc {
        width: 100%;
        max-width: none;
        flex-basis: 100%;
    }

    .literature-reader-controls {
        justify-content: center;
    }

    #literature-toc {
        box-sizing: border-box;
        min-width: 0;
    }

    .literature-reader-toolbar .literature-reader-controls {
        margin-left: auto;
    }

    .pdf-toolbar {
        justify-content: space-between;
    }

    .pdf-toolbar .literature-reader-controls {
        gap: .2rem;
    }

    .epub-viewer {
        height: 68vh;
        min-height: 420px;
    }

    .pdf-viewer {
        min-height: 55vh;
        max-height: 75vh;
        padding: .5rem;
    }

    .literature-not-found {
        padding: 1.25rem;
    }
}

.literature-reader-controls .literature-copy-bibliography {
    position: relative;
}

.literature-copy-bibliography svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.literature-copy-bibliography.is-copied::after,
.literature-copy-bibliography.is-copy-error::after,
.literature-share-link.is-copied::after,
.literature-share-link.is-copy-error::after {
    position: absolute;
    z-index: 20;
    top: calc(100% + 7px);
    right: 0;
    width: max-content;
    padding: .35rem .55rem;
    border-radius: 6px;
    background: #29494e;
    color: #fff;
    font-size: .72rem;
    font-weight: 600;
    line-height: 1.2;
    box-shadow: 0 3px 10px rgba(31, 66, 75, .18);
}

.literature-copy-bibliography.is-copied::after {
    content: "Скопировано";
}

.literature-copy-bibliography.is-copy-error::after,
.literature-share-link.is-copy-error::after {
    content: "Не удалось скопировать";
}

.literature-share-link.is-copied::after {
    content: "Ссылка скопирована";
}

html[data-reader-theme="dark"] body.literature-reader-body {
    background: #121212;
    color: #b3b3b3;
}

html[data-reader-theme="dark"] .literature-reader-shell,
html[data-reader-theme="dark"] .literature-not-found {
    border-color: #383838;
    background: #1e1e1e;
    color: #b3b3b3;
    box-shadow: 0 8px 28px rgba(0, 0, 0, .2);
}

html[data-reader-theme="dark"] .literature-reader-title h1,
html[data-reader-theme="dark"] .literature-not-found h1 {
    color: #f1f1f1;
}

html[data-reader-theme="dark"] .literature-reader-author,
html[data-reader-theme="dark"] .literature-reader-description,
html[data-reader-theme="dark"] .literature-attribution,
html[data-reader-theme="dark"] #epub-font-value,
html[data-reader-theme="dark"] #pdf-zoom-value,
html[data-reader-theme="dark"] #pdf-page-status {
    color: #b3b3b3;
}

html[data-reader-theme="dark"] .literature-reader-toolbar,
html[data-reader-theme="dark"] .literature-reader-status {
    border-color: #383838;
    background: #242424;
    color: #b3b3b3;
}

html[data-reader-theme="dark"] #literature-toc,
html[data-reader-theme="dark"] .literature-reader-controls button,
html[data-reader-theme="dark"] .literature-theme-switch button[aria-pressed="true"] {
    border-color: #4b5557;
    background: #303030;
    color: #e0e0e0;
}

html[data-reader-theme="dark"] .literature-theme-switch {
    border-color: #383838;
    background: #242424;
}

html[data-reader-theme="dark"] .literature-theme-switch button {
    color: #b3b3b3;
}

html[data-reader-theme="dark"] .literature-download-options {
    border-color: #454545;
    background: #242424;
}

html[data-reader-theme="dark"] .literature-download-options a {
    color: #e0e0e0;
}

html[data-reader-theme="dark"] .literature-download-options a:hover,
html[data-reader-theme="dark"] .literature-reader-controls button:hover:not(:disabled) {
    background: #343f41;
    color: #8ad2dc;
}

html[data-reader-theme="dark"] .literature-back-link {
    border-color: #383838;
    background: #1e1e1e;
    color: #d0d0d0;
}

html[data-reader-theme="dark"] .literature-back-link:hover {
    border-color: #5cb8c4;
    background: #242f31;
    color: #8ad2dc;
}

html[data-reader-theme="dark"] .literature-reader-error {
    border-color: #5a4a2e;
    background: #30291d;
    color: #e7d2a7;
}

html[data-reader-theme="dark"] .literature-attribution {
    border-color: #383838;
}

html[data-reader-theme="dark"] .pdf-viewer {
    border-color: #383838;
    background: #242424;
}

html[data-reader-theme="dark"] .epub-viewer iframe {
    background: #1e1e1e;
}

html[data-reader-theme="dark"] #pdf-canvas {
    filter: invert(.88) hue-rotate(180deg);
}

html[data-reader-theme="beige"] body.literature-reader-body {
    background: #F3E1BF;
    color: #2B2926;
}

html[data-reader-theme="beige"] .literature-reader-shell,
html[data-reader-theme="beige"] .literature-not-found {
    border-color: #dfc99f;
    background: #F3E1BF;
    color: #2B2926;
    box-shadow: 0 8px 28px rgba(91, 69, 32, .1);
}

html[data-reader-theme="beige"] .literature-reader-title h1,
html[data-reader-theme="beige"] .literature-not-found h1,
html[data-reader-theme="beige"] .literature-reader-description,
html[data-reader-theme="beige"] .literature-reader-author,
html[data-reader-theme="beige"] .literature-attribution {
    color: #2B2926;
}

html[data-reader-theme="beige"] .literature-reader-toolbar,
html[data-reader-theme="beige"] .literature-reader-status {
    border-color: #dfc99f;
    background: #ead4aa;
    color: #2B2926;
}

html[data-reader-theme="beige"] #literature-toc,
html[data-reader-theme="beige"] .literature-reader-controls button,
html[data-reader-theme="beige"] .literature-theme-switch button[aria-pressed="true"] {
    border-color: #d2bd94;
    background: #F3E1BF;
    color: #2B2926;
}

html[data-reader-theme="beige"] .literature-theme-switch {
    border-color: #dfc99f;
    background: #ead4aa;
}

html[data-reader-theme="beige"] .literature-theme-switch button {
    color: #63563f;
}

html[data-reader-theme="beige"] .literature-download-options {
    border-color: #dfc99f;
    background: #F3E1BF;
}

html[data-reader-theme="beige"] .literature-download-options a {
    color: #2B2926;
}

html[data-reader-theme="beige"] .literature-download-options a:hover,
html[data-reader-theme="beige"] .literature-reader-controls button:hover:not(:disabled) {
    background: #e7d0a3;
    color: #138496;
}

html[data-reader-theme="beige"] .literature-back-link {
    border-color: #dfc99f;
    background: #F3E1BF;
    color: #3f514f;
}

html[data-reader-theme="beige"] .literature-back-link:hover {
    border-color: #138496;
    background: #ead4aa;
    color: #138496;
}

html[data-reader-theme="beige"] .literature-reader-error {
    border-color: #ddc18e;
    background: #f8ebd0;
    color: #5f5136;
}

html[data-reader-theme="beige"] .literature-attribution {
    border-color: #dfc99f;
}

html[data-reader-theme="beige"] .pdf-viewer {
    border-color: #dfc99f;
    background: #ead4aa;
}

html[data-reader-theme="beige"] .epub-viewer iframe {
    background: #F3E1BF;
}

body.literature-reader-body .literature-reader-toolbar,
html[data-reader-theme] body.literature-reader-body .literature-reader-toolbar,
body.literature-reader-body #literature-toc,
html[data-reader-theme] body.literature-reader-body #literature-toc {
    background: transparent;
}

html[data-reader-theme="beige"] #pdf-canvas {
    filter: sepia(.16);
}

@media (max-width: 380px) {
    .literature-grid {
        grid-template-columns: 1fr;
    }

    .literature-card {
        display: grid;
        grid-template-columns: minmax(95px, .62fr) minmax(0, 1fr);
        align-items: stretch;
    }

    .literature-cover {
        height: 100%;
        min-height: 185px;
        aspect-ratio: auto;
    }

    .literature-cover-placeholder {
        width: 82%;
        height: 90%;
        padding: .6rem;
    }

    .literature-cover-placeholder::after {
        inset: .4rem;
    }
}

.literature-back-link {
    display: inline-flex;
    min-height: 40px;
    align-items: center;
    gap: .55rem;
    padding: .45rem .8rem;
    border: 1px solid #d6e5e6;
    border-radius: 9px;
    background: #fff;
    color: #48656b;
    text-decoration: none;
    transition: background .18s ease, border-color .18s ease, color .18s ease, transform .18s ease;
}

.literature-back-link:hover {
    transform: translateX(-2px);
    border-color: #a9d9e0;
    background: #eaf7f9;
    color: #138496;
    text-decoration: none;
}

.literature-back-link svg {
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.literature-download-button {
    display: inline-flex;
    min-width: 128px;
    align-items: center;
    gap: .5rem;
    padding: .65rem .9rem;
    line-height: 1;
    white-space: nowrap;
    box-shadow: 0 3px 9px rgba(23, 116, 132, .16);
    user-select: none;
}

.literature-download-menu summary {
    display: flex;
    align-items: center;
    list-style: none;
}

.literature-download-menu summary::marker {
    content: "";
}

.literature-download-menu summary::-webkit-details-marker {
    display: none;
}

.literature-download-button svg {
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.literature-download-button .literature-download-chevron {
    width: 16px;
    height: 16px;
    margin-left: auto;
    transition: transform .18s ease;
}

.literature-download-button::after {
    display: none;
    content: none;
}

.literature-download-menu[open] .literature-download-chevron {
    transform: rotate(180deg);
}

.literature-download-menu summary:focus-visible,
.literature-back-link:focus-visible,
.literature-theme-switch button:focus-visible,
.literature-scroll-top:focus-visible {
    outline: 3px solid rgba(23, 162, 184, .35);
    outline-offset: 3px;
}

.literature-theme-switch {
    display: inline-flex;
    align-items: center;
    gap: .15rem;
    margin-left: auto;
    padding: .22rem;
    border: 1px solid #dce8e8;
    border-radius: 10px;
    background: #edf3f2;
}

.literature-theme-switch button {
    min-height: 34px;
    padding: .4rem .6rem;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: #607276;
    font: inherit;
    font-size: .76rem;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    transition: background .16s ease, color .16s ease, box-shadow .16s ease;
}

.literature-theme-switch button[aria-pressed="true"] {
    background: #fff;
    color: #29494e;
    box-shadow: 0 1px 4px rgba(31, 66, 75, .15);
}

.literature-scroll-top {
    position: fixed;
    z-index: 1005;
    right: max(1rem, env(safe-area-inset-right));
    bottom: max(1rem, env(safe-area-inset-bottom));
    display: grid;
    width: 48px;
    height: 48px;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, .45);
    border-radius: 50%;
    background: #138496;
    color: #fff;
    box-shadow: 0 5px 18px rgba(25, 57, 63, .25);
    cursor: pointer;
    opacity: .96;
    transition: transform .18s ease, background .18s ease, opacity .18s ease;
}

.literature-scroll-top[hidden] {
    display: none;
}

.literature-scroll-top:hover {
    transform: translateY(-3px);
    background: #17a2b8;
    opacity: 1;
}

.literature-scroll-top svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

@media (max-width: 760px) {
    body.literature-reader-body,
    body.literature-reader-body .epub-article-viewer,
    body.literature-reader-body .epub-article-viewer .epub-container,
    body.literature-reader-body .epub-article-viewer .epub-view {
        overflow-anchor: auto !important;
    }

    body.literature-reader-body .epub-article-viewer .epub-view {
        content-visibility: visible !important;
    }
}

@media (max-width: 760px) {
    .literature-theme-switch {
        width: 100%;
        margin-left: 0;
    }

    .literature-theme-switch button {
        flex: 1 1 0;
        padding: .4rem .3rem;
        font-size: .72rem;
    }

    .literature-reader-actions .literature-download-menu,
    .literature-reader-actions .literature-download-button,
    .literature-reader-actions .literature-share-link {
        min-width: 0;
    }

    .literature-scroll-top {
        right: max(.75rem, env(safe-area-inset-right));
        bottom: max(.75rem, env(safe-area-inset-bottom));
        width: 46px;
        height: 46px;
    }
}

