/* Header */
.header {
    background: var(--paper);
    color: var(--ink);
    border-bottom: 1px solid var(--rule);
    width: 100vw;
    position: relative;
    left: 50%;
    right: 50%;
    margin-left: -50vw;
    margin-right: -50vw;
}

/* Hide header when on chapter or medium summary pages.
   Why: the `body:has(...)` form has a known WebKit timing quirk where
   ancestor-selector invalidation can defer to the next style recalc,
   so for one frame after pushState navigation the site nav can paint
   over the chapter text. The deterministic .on-chapter-page class
   (toggled in showOnlySections) sidesteps that race. */
body.on-chapter-page .header {
    display: none;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-link {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--ink);
    text-decoration: none;
    cursor: pointer;
    transition: opacity 0.2s ease;
    flex-shrink: 0; /* Logo never shrinks */
}

.header-link:hover {
    opacity: 0.9;
}

.header-nav-buttons {
    display: flex;
    gap: 20px;
    margin-left: 20px;
    flex: 1;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
    align-items: center;
}

/* Hide scrollbar for Chrome, Safari, Opera */
.header-nav-buttons::-webkit-scrollbar {
    display: none;
}

.header-nav-btn {
    background: transparent;
    color: var(--ink);
    border: none;
    padding: 0;
    font-size: 0.94rem;
    cursor: pointer;
    transition: opacity 0.2s;
    text-decoration: none;
    font-weight: 500;
    white-space: nowrap; /* Prevent wrapping */
    flex-shrink: 0; /* Don't shrink nav items */
}

.header-nav-btn:hover {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 4px;
}

#plainly-install-button { font-family: inherit; }

.logo {
    font-family: var(--font-serif);
    font-size: 1.5rem;
    font-style: normal;
    margin: 0;
    font-weight: 600;
}

.logo-icon {
    height: 36px;
    width: auto;
    border-radius: 6px;
}

/* Breadcrumb Navigation - styled to replace back buttons */
.breadcrumb-nav {
    padding: 0;
    margin-top: 16px;
    margin-bottom: 24px;
}

.breadcrumb-list {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.breadcrumb-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* First breadcrumb link gets the back arrow */
.breadcrumb-item:first-child .breadcrumb-link::before {
    content: '← ';
}

.breadcrumb-link {
    color: var(--secondary-color);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    transition: color 0.2s;
}

.breadcrumb-link:hover {
    color: var(--secondary-color-hover);
}

.breadcrumb-separator {
    color: var(--text-light);
    font-size: 0.8rem;
}

.breadcrumb-current {
    color: var(--text-color);
    font-size: 0.95rem;
    font-weight: 400;
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 0 0 40px 0;
}

.hidden {
    display: none !important;
}

/* Books Section */
.books-section {
    padding-top: 20px;
}

.books-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

@media (min-width: 480px) {
    .books-grid {
        gap: 10px;
    }

    .container {
        padding: 0 12px;
    }
}

@media (min-width: 650px) {
    .books-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 16px;
    }

    .container {
        padding: 0 20px;
    }
}

@media (min-width: 900px) {
    .books-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 20px;
    }
}

@media (min-width: 1200px) {
    .books-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 20px;
    }
}

.books-grid {
    row-gap: 2rem;
}

/* Book card — the one card used by every book listing (createBookCard in
   app.js). The cover box keeps a 2:3 shape and shows the title in serif
   until the image loads, so loading never shows grey blobs. */
.book-card,
.top-10-book-card {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    min-width: 0;
    color: var(--ink);
    text-decoration: none;
}

.book-card-cover {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 2 / 3;
    margin-bottom: 0.45rem;
    padding: 12%;
    overflow: hidden;
    border: 1px solid var(--rule);
    border-radius: 4px;
    background: var(--paper-deep);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.book-card-cover-title {
    display: -webkit-box;
    -webkit-line-clamp: 5;
    -webkit-box-orient: vertical;
    overflow: hidden;
    color: var(--ink-muted);
    font-family: var(--font-serif);
    font-size: 1rem;
    line-height: 1.25;
    text-align: center;
}

.book-card-cover picture,
.book-card-cover img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.book-card-cover img {
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.book-card-cover img.loaded {
    opacity: 1;
}

.book-card:hover .book-card-cover,
.top-10-book-card:hover .book-card-cover {
    transform: translateY(-3px);
    box-shadow: 0 8px 18px rgba(43, 38, 34, 0.16);
}

.book-card:focus-visible,
.top-10-book-card:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 4px;
    border-radius: 4px;
}

.book-card-title {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin: 0;
    color: var(--ink);
    font-family: var(--font-serif);
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.3;
    /* Reserve two lines so author and level line up across a row. */
    min-height: 2.6em;
}

.book-card:hover .book-card-title,
.top-10-book-card:hover .book-card-title {
    color: var(--accent);
}

.book-card-author {
    overflow: hidden;
    margin: 0;
    color: var(--ink-muted);
    font-size: 0.85rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.book-card-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem 0.6rem;
    margin: 0.2rem 0 0;
    color: var(--ink-muted);
    font-size: 0.78rem;
}

/* Reading time always gets its own line under the tags, so a long level tag
   doesn't wrap some cards and not others. */
.book-card-time {
    order: 1;
    flex-basis: 100%;
}

/* No Plain English version yet: an outline tag, quieter than the level. */
.original-only-tag {
    display: inline-block;
    padding: 0.05rem 0.5rem;
    border: 1px solid var(--rule-strong);
    border-radius: 999px;
    color: var(--ink-muted);
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1.5;
    white-space: nowrap;
}

/* Published reading grade (ATOS), coloured by band: greener is easier. */
.grade-tag {
    display: inline-block;
    padding: 0.1rem 0.5rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1.5;
    white-space: nowrap;
}

.grade-tag--3-5,
.grade-tag--6-8 {
    background: var(--level-easy-bg);
    color: var(--level-easy-fg);
}

.grade-tag--9-10 {
    background: var(--level-moderate-bg);
    color: var(--level-moderate-fg);
}

.grade-tag--11-12 {
    background: var(--level-challenging-bg);
    color: var(--level-challenging-fg);
}

/* In horizontal shelves (category/discover carousels, "You may also like")
   the card takes a fixed width instead of a grid column. */
.carousel-scroll .book-card,
.carousel-scroll .top-10-book-card,
.related-books-scroll .book-card {
    flex: 0 0 168px;
}

@media (max-width: 480px) {
    .carousel-scroll .book-card,
    .carousel-scroll .top-10-book-card,
    .related-books-scroll .book-card {
        flex-basis: 136px;
    }

    .book-card-title {
        font-size: 0.92rem;
    }
}

/* Category Detail Section */
.category-detail-section {
    padding-top: 20px;
    animation: fadeIn 0.3s ease;
}

@media (max-width: 768px) {
    .category-detail-section {
        padding-top: 16px;
    }
}

@media (max-width: 480px) {
    .category-detail-section {
        padding-top: 12px;
    }
}

.category-detail-header {
    margin-bottom: 24px;
}

@media (max-width: 768px) {
    .category-detail-header {
        margin-bottom: 16px;
    }
}

@media (max-width: 480px) {
    .category-detail-header {
        margin-bottom: 12px;
    }
}

.category-detail-header h2 {
    font-size: 2rem;
    color: var(--primary-color);
    margin-bottom: 8px;
}

.category-detail-subtitle {
    font-size: 1rem;
    color: var(--text-light);
}

/* All Categories Section */
.all-categories-section {
    padding-top: 20px;
}

.loading {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-light);
    font-size: 1.1rem;
}

/* Skeleton Loading Styles */
@keyframes shimmer-px {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

.illustration-skeleton {
    width: 100%;
    height: 400px;
    background: linear-gradient(
        90deg,
        var(--skeleton-base) 0px,
        var(--skeleton-highlight) 40px,
        var(--skeleton-base) 80px
    );
    background-size: 1000px 100%;
    animation: shimmer-px 2s infinite linear;
    border-radius: 8px;
    margin: 20px 0;
}

.error {
    background-color: var(--error-bg-light);
    border: 1px solid var(--accent-color);
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
    color: var(--accent-color);
}

/* Summary Section */
.summary-section {
    background: transparent;
    width: 100vw;
    position: relative;
    left: 50%;
    right: 50%;
    margin-left: -50vw;
    margin-right: -50vw;
    padding: 0;
}

.summary-section > * {
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 20px;
    padding-right: 20px;
}

.summary-section > *:first-child {
    padding-top: 16px;
}

.summary-section > *:last-child {
    padding-bottom: 40px;
}

/* Loading States */
.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    min-height: 300px;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(0, 0, 0, 0.1);
    border-left-color: var(--secondary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

.loading-text {
    color: var(--text-light);
    font-size: 0.9rem;
    font-weight: 500;
    opacity: 0.8;
}

.back-button {
    background: transparent;
    color: var(--secondary-color);
    border: none;
    padding: 8px 0;
    font-size: 0.95rem;
    cursor: pointer;
    transition: color 0.2s;
    font-weight: 500;
}

.back-button-container {
    margin-top: 8px;
    margin-bottom: 12px;
}

.back-button {
    background: transparent;
    border: none;
    color: var(--primary-color);
    font-size: 0.9rem;
    cursor: pointer;
    padding: 6px 0;
    transition: opacity 0.2s;
}

.back-button:hover {
    opacity: 0.7;
}

/* Book Detail Header */
/* Book header: framed cover beside title, meta, actions and progress,
   closed off from the page by a hairline. */
.book-detail-header {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    align-items: center;
    gap: 2.75rem;
    margin-bottom: 2.75rem;
    padding: 0.5rem 0 2.75rem;
    border-bottom: 1px solid var(--rule);
}

#book-info-cover {
    display: block;
}

.book-detail-cover {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 2 / 3;
    object-fit: cover;
    border-radius: 6px;
    box-shadow: 0 1px 2px rgba(43, 38, 34, 0.12), 0 14px 32px rgba(43, 38, 34, 0.18);
}

.book-detail-info {
    min-width: 0;
}

/* Phones: cover beside title, author and meta; actions and progress run
   full width underneath. */
@media (max-width: 767px) {
    .book-detail-header {
        grid-template-columns: 104px minmax(0, 1fr);
        align-items: start;
        gap: 0.35rem 1.1rem;
        padding-bottom: 2rem;
    }

    .book-detail-info {
        display: contents;
    }

    #book-info-cover {
        grid-row: 1 / span 3;
        grid-column: 1;
    }

    .book-detail-info h2,
    .book-author,
    .book-meta {
        grid-column: 2;
    }

    .book-detail-info h2 {
        font-size: 1.5rem;
    }

    .book-author {
        font-size: 0.95rem;
    }

    .book-meta {
        margin-top: 0.4rem;
        font-size: 0.85rem;
    }

    .book-actions,
    .book-progress,
    .plain-english-coming-soon {
        grid-column: 1 / -1;
    }

    .book-actions {
        margin-top: 1.1rem;
    }
}

/* Author link styling - make it obvious and clickable */
.author-link {
    color: var(--ink);
    text-decoration: underline;
    text-decoration-color: var(--rule-strong);
    text-underline-offset: 3px;
    cursor: pointer;
}

.author-link:hover {
    color: var(--accent);
    text-decoration-color: currentColor;
}

.book-detail-info h2 {
    margin-bottom: 0.5rem;
    color: var(--ink);
    font-family: var(--font-serif);
    font-size: clamp(1.6rem, 3.4vw, 2.6rem);
    line-height: 1.12;
    text-wrap: balance;
    overflow-wrap: break-word;
}

.book-author {
    color: var(--ink-muted);
    font-size: 1.05rem;
}

/* Meta row: level · chapters · time · Plain English */
.book-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem 0.9rem;
    margin-top: 1rem;
    color: var(--ink-muted);
    font-size: 0.92rem;
}

.book-meta:empty {
    display: none;
}

.school-list-badge {
    padding: 0.1rem 0.55rem;
    border: 1px solid var(--rule-strong);
    border-radius: 999px;
    color: var(--ink);
    font-size: 0.75rem;
    font-weight: 600;
    text-decoration: none;
}

.school-list-badge:hover {
    border-color: var(--ink-muted);
}

.plain-english-badge {
    padding: 0.1rem 0.55rem;
    border: 1px solid var(--accent);
    border-radius: 999px;
    color: var(--accent);
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.5;
}

.book-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    gap: 0.75rem;
    margin-top: 1.6rem;
}

/* Both actions: one height, one shape */
.book-actions .book-read-btn,
.book-actions .book-sxs-link {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    min-height: 48px;
    margin-top: 0;
    padding: 0 1.3rem;
    border-radius: var(--radius-control);
    font-size: 1rem;
    font-weight: 600;
    line-height: 1;
}

.book-actions .book-sxs-link {
    border: 1px solid var(--rule-strong);
    background: var(--surface);
    color: var(--ink);
    text-decoration: none;
}

.book-actions .book-sxs-link:hover {
    border-color: var(--ink-muted);
    background: var(--paper-deep);
}

.book-actions .book-sxs-link svg {
    color: var(--ink-muted);
}

/* Side by side is a wide-screen reading mode (see view_mode.js). */
@media (max-width: 1023px) {
    .book-actions .book-sxs-link {
        display: none;
    }
}

/* Reading progress under the actions (signed-in readers) */
.book-progress {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 1rem;
    color: var(--ink-muted);
    font-size: 0.88rem;
}

.book-progress-track {
    flex: 0 0 140px;
    height: 4px;
    overflow: hidden;
    border-radius: 99px;
    background: var(--rule);
}

.book-progress-track span {
    display: block;
    height: 100%;
    background: var(--accent);
}

.book-progress-where {
    color: var(--ink);
}

@media (max-width: 767px) {
    .book-actions .book-read-btn {
        flex: 1 1 auto;
        justify-content: center;
        white-space: nowrap;
    }

    .book-progress {
        flex-wrap: wrap;
    }
}

.author {
    font-size: 1.1rem;
    color: var(--text-light);
    font-style: italic;
}

/* Book Content Sections */

/* About the author */
.about-author-section {
    max-width: 760px;
    margin-bottom: 48px;
}

.about-single-column {
    margin-bottom: 32px;
}

.about-single-column:last-child {
    margin-bottom: 0;
}

.about-heading-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.about-heading {
    margin: 0 0 12px;
    color: var(--ink);
    font-family: var(--font-serif);
    font-size: 1.5rem;
    font-weight: 600;
}

.about-heading-row .about-heading {
    margin-bottom: 0;
}

/* Author Info */

/* Reading Guide Section (Standalone) - Matches Summary Tabs */
.reading-guide-section {
    margin-bottom: 48px;
}

.reading-guide-tabs-header {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--border-light);
    margin-bottom: 24px;
}

.reading-guide-tab {
    background: transparent;
    border: none;
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.2s;
    position: relative;
    bottom: -2px;
}

.reading-guide-tab:hover {
    color: var(--primary-color);
}

.reading-guide-tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    font-weight: 600;
}

.reading-guide-tab-content {
    display: none;
}

.reading-guide-tab-content.active {
    display: block;
}

.guide-image {
    width: 100%;
    height: auto;
    cursor: pointer;
    transition: opacity 0.3s ease-in;
    display: block;
}

.guide-image:hover {
    opacity: 0.9;
}

.author-bio-text {
    font-size: 0.95rem;
    line-height: 1.7;
    color: var(--text-dark);
    margin: 0 0 20px 0;
}

/* Author Books Section */
.author-books-section {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #d0d0d0;
}

/* Responsive design for about section */
@media (max-width: 768px) {
    .author-books-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 12px;
    }
}

/* Summary Tabs */
.summary-tabs-section {
    margin-bottom: 48px;
}

.summary-tab-content {
    display: none;
}

.summary-tab-content.active {
    display: block;
}

.chapters-section {
    margin-bottom: 48px;
    padding-bottom: 32px;
    border-bottom: none;
}

.chapters-section > h3 {
    margin: 16px 0 20px 0;
    color: var(--ink);
    font-family: var(--font-serif);
    font-size: 1.5rem;
    font-weight: 600;
}

/* "Plain English version coming soon" pill — shown on books that don't
   have a modern English translation yet. Toggled by app.js based on
   whether any chapter has modern_english_text. */
.plain-english-coming-soon {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 12px 0 0 0;
    padding: 6px 14px 6px 12px;
    background-color: var(--paper-deep);
    border: 1px solid var(--rule-strong);
    border-radius: 999px;
    color: var(--text-light);
    font-size: 0.9rem;
    line-height: 1.2;
    /* Single line on desktop; allow wrap on narrow viewports where the
       pill would otherwise overflow the (cover-sharing) info column. */
    white-space: nowrap;
    max-width: 100%;
}

/* On narrow viewports, the book-detail-info column shrinks (cover takes
   ~40% of the row), so the pill needs to wrap and behave like a rounded
   rectangle rather than a single-line stadium. */
@media (max-width: 600px) {
    .plain-english-coming-soon {
        white-space: normal;
        border-radius: 14px;
        padding: 6px 12px;
    }
}

.plain-english-coming-soon.hidden {
    display: none;
}

.plain-english-coming-soon-icon {
    font-size: 1rem;
    line-height: 1;
}

/* Related Books Section */
.related-books-section {
    margin-bottom: 48px;
    padding-top: 16px;
    border-top: 1px solid var(--border-light);
}

.related-books-section > h3 {
    margin: 16px 0 24px 0;
    color: var(--ink);
    font-family: var(--font-serif);
    font-size: 1.5rem;
    font-weight: 600;
}

.related-books-scroll {
    display: flex;
    gap: 0.75rem;
    overflow-x: auto;
    overflow-y: visible;
    scroll-behavior: smooth;
    padding: 1rem 1rem;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.related-books-scroll::-webkit-scrollbar {
    display: none;
}

@media (max-width: 768px) {
    .related-books-scroll {
        padding: 0.75rem 0.75rem;
    }
}

@media (max-width: 480px) {
    .related-books-scroll {
        padding: 0.5rem 0.5rem;
    }
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.section-header h3 {
    font-size: 1.5rem;
    color: var(--primary-color);
    font-weight: 600;
    margin: 0;
}

.section-header h4 {
    font-size: 1.2rem;
    color: var(--primary-color);
    font-weight: 600;
    margin: 0;
}

.tts-button-inline {
    background: transparent;
    color: var(--secondary-color);
    border: 1px solid var(--secondary-color);
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
}

.tts-button-inline:hover {
    background: var(--secondary-color);
    color: white;
}

/* Summary Text */
.summary-text {
    /* font-size is set via JavaScript reading settings - default removed to allow inline styles to work */
    font-family: var(--font-serif);
    line-height: 1.75;
    color: var(--text-color);
}

.summary-text.preview {
    color: var(--text-color);
}

/* Concise Preview Container */
.concise-preview-container {
    position: relative;
    max-height: 300px;
    overflow: hidden;
    margin-bottom: 16px;
    transition: max-height 0.4s ease;
}

.concise-preview-container.expanded {
    max-height: none;
}

.concise-preview-text {
    position: relative;
}

.concise-preview-fade {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 120px;
    background: linear-gradient(to bottom, rgba(246,241,231,0), var(--paper));
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.concise-preview-fade.hidden {
    opacity: 0;
}

/* Medium Preview Container */
.medium-preview-container {
    position: relative;
    max-height: 300px;
    overflow: hidden;
    margin-bottom: 16px;
}

.medium-preview-text {
    position: relative;
}

.preview-fade {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 120px;
    background: linear-gradient(to bottom, rgba(246,241,231,0), var(--paper));
    pointer-events: none;
}

/* Chapters List */
.chapters-list {
    display: flex;
    flex-direction: column;
    border-top: 1px solid var(--rule);
}

/* Table-of-contents row: number · title · time · read check */
.chapter-box {
    display: grid;
    grid-template-columns: 2.25rem minmax(0, 1fr) auto 1.25rem;
    align-items: baseline;
    gap: 0 1rem;
    padding: 0.9rem 0.5rem;
    border-bottom: 1px solid var(--rule);
    color: var(--ink);
    text-decoration: none;
    transition: background 0.15s ease;
}

.chapter-box:hover {
    background: var(--paper-deep);
}

.chapter-box:hover .chapter-box-title {
    color: var(--accent);
}

.chapter-box:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
}

.chapter-box-num {
    color: var(--ink-muted);
    font-family: var(--font-serif);
    font-size: 1rem;
    text-align: right;
}

.chapter-box-title {
    margin: 0;
    color: var(--ink);
    font-family: var(--font-serif);
    font-size: 1.05rem;
    font-weight: 600;
}

.chapter-box-time {
    color: var(--ink-muted);
    font-size: 0.85rem;
    white-space: nowrap;
}

.chapter-box-check {
    visibility: hidden;
    color: var(--level-easy-fg);
    font-weight: 700;
}

.chapter-box.completed .chapter-box-check {
    visibility: visible;
}

@media (max-width: 480px) {
    .chapter-box {
        grid-template-columns: 1.6rem minmax(0, 1fr) auto;
        padding: 0.8rem 0.25rem;
    }

    .chapter-box-check {
        display: none;
    }

    .chapter-box.completed .chapter-box-num {
        color: var(--level-easy-fg);
    }
}

/* Section Headers (for two-level structure) */
.section-header {
    margin-top: 24px;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--border-color);
}

.section-header:first-child {
    margin-top: 0;
}

.section-header h4 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--ink);
    font-family: var(--font-serif);
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Indented chapters (for two-level structure) */
.chapter-box.indented {
    margin-left: 20px;
}

/* Medium Detail Section */
.medium-detail-section {
    background: var(--card-background);
    width: 100vw;
    position: relative;
    left: 50%;
    right: 50%;
    margin-left: -50vw;
    margin-right: -50vw;
    padding: 0;
}

.medium-detail-section > * {
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 20px;
    padding-right: 20px;
}

.medium-detail-section > *:first-child {
    padding-top: 16px;
}

.medium-detail-section > *:last-child {
    padding-bottom: 40px;
}

.medium-detail-header {
    margin-bottom: 32px;
}

.medium-detail-header h2 {
    font-size: 1.8rem;
    color: var(--primary-color);
    margin-bottom: 8px;
    line-height: 1.2;
}

.medium-detail-subtitle {
    font-size: 1rem;
    color: var(--text-light);
}

.medium-detail-content {
    margin-top: 24px;
}

/* Chapter Detail Section */
.chapter-detail-section {
    background: var(--card-background);
    width: 100vw;
    position: relative;
    left: 50%;
    right: 50%;
    margin-left: -50vw;
    margin-right: -50vw;
    padding: 51px 0 0 0; /* Top padding matches sticky header height exactly (51px) */
}

.chapter-detail-section > * {
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 20px;
    padding-right: 20px;
}

.chapter-detail-section > *:first-child {
    padding-top: 0; /* No extra padding needed with pagination */
}

.chapter-detail-section > *:last-child {
    padding-bottom: 40px;
}

.chapter-detail-content {
    /* Content is already contained within chapter-detail-section which has edge-to-edge white background */
}

/* Chapter Illustration */
.chapter-illustration-container {
    margin: 16px 0;
    text-align: center;
}

.chapter-illustration {
    max-width: 100%;
    max-height: 600px;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Responsive illustration sizing */
@media (max-width: 768px) {
    .chapter-illustration {
        max-height: none;
        width: 100%;
    }

    .chapter-illustration-container {
        margin: 32px -20px;
        width: calc(100% + 40px);
    }
}

.chapter-summary-content {
    margin-top: 16px;
    padding-top: 0;
}

.chapter-fulltext-section {
    margin-top: 16px;
}

.chapter-fulltext {
    /* font-size is set via JavaScript reading settings - default removed to allow inline styles to work */
    line-height: 1.75;
    color: var(--text-color);
    margin-top: 0;
}

/* Markdown formatting in summaries */
.summary-text h1,
.summary-text h2,
.summary-text h3,
.summary-text h4,
.chapter-summary h1,
.chapter-summary h2,
.chapter-summary h3,
.chapter-summary h4,
.summary-content h1,
.summary-content h2,
.summary-content h3,
.summary-content h4 {
    color: var(--primary-color);
    margin-top: 1.5em;
    margin-bottom: 0.5em;
    font-weight: 600;
}

.summary-text h1,
.chapter-summary h1,
.summary-content h1 {
    font-size: 1.8rem;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0.3em;
}

.summary-text h2,
.chapter-summary h2,
.summary-content h2 {
    font-size: 1.5rem;
}

.summary-text h3,
.chapter-summary h3,
.summary-content h3 {
    font-size: 1.3rem;
}

.summary-text h4,
.chapter-summary h4,
.summary-content h4 {
    font-size: 1.15rem;
}

.summary-text p,
.chapter-summary p,
.summary-content p,
.chapter-fulltext p {
    margin-bottom: 1em;
}

.summary-text ul,
.summary-text ol,
.chapter-summary ul,
.chapter-summary ol,
.summary-content ul,
.summary-content ol {
    margin: 1em 0;
    padding-left: 2em;
}

.summary-text li,
.chapter-summary li,
.summary-content li {
    margin-bottom: 0.5em;
}

.summary-text strong,
.chapter-summary strong,
.summary-content strong {
    font-weight: 600;
    color: var(--primary-color);
}

.summary-text em,
.chapter-summary em,
.summary-content em {
    font-style: italic;
}

.summary-text blockquote,
.chapter-summary blockquote,
.summary-content blockquote {
    border-left: 4px solid var(--secondary-color);
    margin: 1.5em 0;
    padding: 0.5em 1em;
    background: var(--background-color);
    font-style: italic;
}

.summary-text code,
.chapter-summary code,
.summary-content code {
    background: var(--background-color);
    padding: 0.2em 0.4em;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

.summary-text pre,
.chapter-summary pre,
.summary-content pre {
    background: var(--background-color);
    padding: 1em;
    border-radius: 5px;
    overflow-x: auto;
    margin: 1em 0;
}

.summary-text pre code,
.chapter-summary pre code,
.summary-content pre code {
    background: none;
    padding: 0;
}

.summary-text hr,
.chapter-summary hr,
.summary-content hr {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 2em 0;
}

/* Comprehensive View */

.chapter-toggle.expanded {
    transform: rotate(180deg);
}

.chapter-content.expanded {
    max-height: none;
    overflow: visible;
}

.chapter-summary {
    /* font-size is set via JavaScript reading settings - default removed to allow inline styles to work */
    line-height: 1.8;
    color: var(--text-color);
    padding-top: 16px;
}

/* Footer: one quiet row — note on the left, links on the right. */
.footer {
    padding: 28px 0;
    margin-top: 40px;
    margin-bottom: 100px; /* Space for persistent player */
    border-top: 1px solid var(--rule);
    color: var(--ink-muted);
    font-size: 0.88rem;
}

.footer-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px 24px;
}

.footer-note {
    margin: 0;
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 20px;
}

.footer-links a {
    color: var(--ink);
    font-weight: 500;
    text-decoration: none;
}

.footer-links a:hover {
    color: var(--accent);
}

@media (max-width: 600px) {
    .footer-row {
        flex-direction: column-reverse;
        text-align: center;
    }
}

/* Wrong-account notice (auth.js's checkAuthStatus 403 handling) — shown
   only when signed in with a Google account not on SUMMRA_ALLOWED_EMAILS.
   Amber/warning-toned, distinct from a plain signed-out visitor who never
   sees this at all. */
.wrong-account-banner {
    text-align: center;
    padding: 10px 24px;
    font-size: 0.85rem;
    background: var(--error-bg-light);
    color: var(--text-color);
    border-bottom: 1px solid var(--border-color);
}

/* Deliberately quiet — a way back in, not an invitation. No icon, no
   "with Google", small and faint. Matches OpenReader's sidebar treatment. */
.footer-signin {
    display: inline-block;
    margin-top: 12px;
    font-size: 0.75rem;
    color: var(--text-light);
    text-decoration: none;
    opacity: 0.6;
}

.footer-signin:hover {
    text-decoration: underline;
    opacity: 1;
}

/* Persistent Audio Player */

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

/* Full-Length View */

/* Summary Section */
.summary-section {
    margin-bottom: 16px;
    padding: 0px 16px 0px 16px;
}

/* Add padding and margin when expanded */
.summary-section:has(.summary-content:not(.collapsed)) .summary-section-header {
    margin-bottom: 12px;
}

.summary-content {
    font-size: 1.1rem;
    line-height: 1.8;
    color: var(--text-color);
    max-height: none;
    overflow: visible;
    transition: max-height 0.3s ease, padding 0.3s ease;
}

.summary-content.collapsed {
    max-height: 0;
    overflow: hidden;
    padding: 0;
}

/* Full Text Section */

/* Responsive Design */
@media (max-width: 768px) {
    .header-content {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .header-nav-buttons {
        flex-shrink: 0;
        white-space: nowrap;
    }

    .logo {
        font-size: 1.3rem;
    }

    .logo-icon {
        height: 30px;
    }

    .option-cards {
        grid-template-columns: 1fr;
    }

    .summary-content {
        padding: 20px;
    }

    .book-info h2 {
        font-size: 1.5rem;
    }

    /* Edge-to-edge white background is already applied via main section styles */
    .summary-section > *,
    .medium-detail-section > *,
    .chapter-detail-section > * {
        padding-left: 16px;
        padding-right: 16px;
    }

    /* Reduce margins between sections */
    .concise-summary-section,
    .medium-preview-section,
    .chapters-section {
        margin-bottom: 32px;
        padding-bottom: 24px;
    }

    /* Persistent player mobile layout */
    

    

    

    
}

/* ===== Hero Banners (Apple-style) ===== */

/* Fallback for browsers that don't support WebP */

/* Discover Hero */

/* Learn Hero */

/* Learn Features Grid - 3 Column Layout */

/* Responsive - Stack on mobile */

/* Read Hero */

/* Top 10 Carousel in Discover Section */

/* When viewport is smaller than carousel + buttons, switch to left-aligned mode */

/* Skeleton loading card for carousel */

/* Shimmer animation */
@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

/* Fade in animation when real books load */

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Mobile responsive */

@media (max-width: 480px) {

    .hero-banner-ctas {
        margin-top: 1.5rem;
    }
}

.hero-banner-ctas {
    display: flex;
    gap: 1rem;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 2rem;
}

.hero-cta-primary {
    background: var(--accent);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 980px;
    font-size: 1.0625rem;
    font-weight: 400;
    text-decoration: none;
    transition: background 0.2s ease;
    display: inline-block;
}

.hero-cta-primary:hover {
    background: var(--accent-hover);
}

.hero-cta-secondary {
    background: transparent;
    color: var(--hero-accent);
    padding: 0.75rem 1.5rem;
    border-radius: 980px;
    font-size: 1.0625rem;
    font-weight: 400;
    text-decoration: none;
    transition: background 0.2s ease;
    display: inline-block;
    border: 2px solid var(--hero-accent);
}

.hero-cta-secondary:hover {
    background: var(--paper-deep);
}

/* Hero Search Bar */
.hero-search-container {
    margin-top: 2rem;
    display: flex;
    justify-content: center;
}

.hero-search-wrapper {
    position: relative;
    width: 100%;
    max-width: 600px;
}

.hero-search-input {
    width: 100%;
    padding: 0.85rem 1.25rem;
    font: inherit;
    font-size: 1.05rem;
    border: 1px solid var(--rule-strong);
    border-radius: 999px;
    background: var(--surface);
    color: var(--ink);
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.hero-search-input:focus {
    border-color: var(--ink-muted);
    box-shadow: 0 0 0 3px rgba(138, 46, 46, 0.12);
}

.hero-search-input::placeholder {
    color: var(--ink-muted);
}

.hero-search-results {
    position: absolute;
    top: calc(100% + 0.5rem);
    left: 0;
    right: 0;
    background: var(--surface);
    border: 1px solid var(--rule);
    border-radius: 10px;
    box-shadow: 0 10px 28px rgba(43, 38, 34, 0.16);
    max-height: 340px;
    overflow-y: auto;
    z-index: 1000;
}

.hero-search-results.hidden {
    display: none;
}

.hero-search-result-item {
    padding: 0.7rem 1rem;
    cursor: pointer;
    border-bottom: 1px solid var(--rule);
    transition: background 0.2s ease;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.hero-search-result-item:last-child {
    border-bottom: none;
}

.hero-search-result-item:hover {
    background: var(--paper-deep);
}

.hero-search-result-cover {
    width: 40px;
    height: 60px;
    object-fit: cover;
    border-radius: 4px;
    flex-shrink: 0;
}

.hero-search-result-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    min-width: 0;
    text-align: left;
}

.hero-search-result-title {
    font-family: var(--font-serif);
    font-size: 1rem;
    font-weight: 600;
    color: var(--ink);
    margin: 0;
}

.hero-search-result-author {
    font-size: 0.875rem;
    color: var(--text-light);
    margin: 0;
}

.hero-search-result-author::before {
    content: "by ";
    font-style: italic;
}

.hero-search-no-results {
    padding: 2rem;
    text-align: center;
    color: var(--text-light);
    font-size: 1rem;
}

@media (max-width: 768px) {
    .hero-search-input {
        font-size: 1rem;
        padding: 0.875rem 1.25rem;
    }

    .hero-search-wrapper {
        max-width: 90%;
    }

    .hero-search-results {
        max-height: 155px; /* Show exactly 3 results on mobile without showing partial 4th item */
    }

    .hero-search-result-item {
        padding: 0.75rem 1rem;
    }

    .hero-search-result-cover {
        width: 32px;
        height: 48px;
    }

    .hero-search-result-title {
        font-size: 0.9rem;
    }

    .hero-search-result-author {
        font-size: 0.8rem;
    }
}

/* ===== Category Carousels ===== */
.categories-section {
    margin-bottom: 1rem;
    margin-top: 2.5rem;  /* More space after blue header */
}

.categories-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;  /* Less gap between carousels */
}

.category-carousel {
    margin-bottom: 0;
}

.category-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    padding: 0;
}

.category-title {
    font-family: var(--font-serif);
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--primary-color);
    margin: 0;
}

.view-all-link {
    color: var(--secondary-color);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    transition: color 0.2s;
}

.view-all-link:hover {
    color: var(--secondary-color-hover);
    text-decoration: underline;
}

.carousel-container {
    position: relative;
    width: 100%;
}

.carousel-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: white;
    border: 1px solid var(--border-subtle);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: all 0.2s;
}

.carousel-nav-btn:hover {
    background: #f7f7f7;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.carousel-nav-btn.left {
    left: -20px;
}

.carousel-nav-btn.right {
    right: -20px;
}

.carousel-nav-btn:disabled {
    visibility: hidden; /* nothing to scroll to on that side */
}

.carousel-scroll {
    display: flex;
    gap: 0.75rem;  /* Less gap between books */
    overflow-x: auto;  /* Allow horizontal scrolling */
    overflow-y: visible;  /* Allow vertical overflow for scaled cards */
    scroll-behavior: smooth;
    padding: 1rem 1rem;  /* Add padding to prevent clipping on all sides */
    scrollbar-width: none;  /* Firefox - hide scrollbar */
    -ms-overflow-style: none;  /* IE/Edge - hide scrollbar */
}

.carousel-scroll::-webkit-scrollbar {
    display: none;  /* Chrome/Safari - hide scrollbar */
}

/* Responsive carousel styling */
@media (max-width: 768px) {
    /* Hero Banners Responsive */

    .hero-banner-ctas {
        gap: 0.75rem;
        margin-top: 1.5rem;
    }

    .hero-cta-primary,
    .hero-cta-secondary {
        padding: 0.625rem 1.25rem;
        font-size: 1rem;
    }

    .category-title {
        font-size: 1.25rem;
    }

    .section-title {
        font-size: 1.5rem;
    }

    .carousel-scroll {
        padding: 0.75rem 0.75rem;  /* Reduce padding on tablet: 12px */
    }

    .categories-container {
        gap: 0.75rem;  /* Reduce gap between carousels */
    }

    .categories-section {
        margin-top: 1.25rem;  /* Reduce space after blue header */
    }

    .category-header {
        margin-bottom: 0.5rem;  /* Reduce gap between header and carousel */
    }
}

@media (max-width: 480px) {
    .category-title {
        font-size: 1.1rem;
    }

    .section-title {
        font-size: 1.3rem;
    }

    .carousel-scroll {
        padding: 0.25rem 0.5rem 0.5rem 0.5rem;  /* Reduce top padding on mobile: 4px top, 8px bottom/sides */
    }

    .categories-container {
        gap: 0.25rem;  /* 4px gap between carousels */
    }

    .categories-section {
        margin-top: 0.5rem;  /* 8px space after blue header */
    }

    .category-header {
        margin-bottom: 0;  /* 0px gap between header and carousel */
    }
}

/* ===== Reading Experience Enhancements ===== */

/* Reading Settings Toggle Button */
.back-button-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.reading-settings-toggle {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-color);
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.2s;
}

.reading-settings-toggle:hover {
    background: var(--background-color);
    border-color: var(--secondary-color);
}

/* Reading Progress Bar - Kindle Style */
.reading-progress-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 24px;
    background: transparent;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    z-index: 999;
    pointer-events: none;
}

.reading-progress-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 3px;
    background: rgba(0, 0, 0, 0.3);
    transition: width 0.2s ease;
    width: 0%;
}

.reading-progress-text {
    font-size: 0.9rem;
    color: rgba(0, 0, 0, 0.5);
    font-weight: 400;
    text-align: center;
    margin-top: 5px;
}

/* Progress bar colors for different themes */
.chapter-detail-section[data-theme="dark"] .reading-progress-fill {
    background: rgba(255, 255, 255, 0.3);
}

.chapter-detail-section[data-theme="dark"] .reading-progress-text {
    color: rgba(255, 255, 255, 0.5);
}

/* Next Chapter Button */

/* Chapter Reading Themes */
.chapter-detail-section[data-theme="light"] {
    background: white;
    color: #2c3e50;
}

/* When chapter section is active with light theme, set body background */
body:has(.chapter-detail-section[data-theme="light"]:not(.hidden)) {
    background: white;
}

.chapter-detail-section[data-theme="dark"] {
    background: var(--reading-theme-dark-bg);
    color: var(--reading-theme-dark-text);
}

/* When chapter section is active with dark theme, set body background */
body:has(.chapter-detail-section[data-theme="dark"]:not(.hidden)) {
    background: var(--reading-theme-dark-bg);
}

.chapter-detail-section[data-theme="dark"] .chapter-fulltext p,
.chapter-detail-section[data-theme="dark"] .chapter-summary-text,
.chapter-detail-section[data-theme="dark"] h2,
.chapter-detail-section[data-theme="dark"] h4 {
    color: var(--reading-theme-dark-text);
}

.chapter-detail-section[data-theme="dark"] .chapter-summary-box {
    background: #2a2a2a;
    border-left-color: #ffc107;
}

.chapter-detail-section[data-theme="dark"] .back-button {
    color: var(--reading-theme-dark-accent);
}

.chapter-detail-section[data-theme="dark"] .next-chapter-btn {
    color: var(--reading-theme-dark-text);
    border-color: var(--reading-theme-dark-border);
}

.chapter-detail-section[data-theme="dark"] .next-chapter-btn:hover {
    border-color: var(--reading-theme-dark-accent);
    color: var(--reading-theme-dark-accent);
    background: rgba(92, 179, 224, 0.1);
}

/* Medium Detail Reading Themes */
.medium-detail-section[data-theme="light"] {
    background: white;
    color: #2c3e50;
}

/* When medium section is active with light theme, set body background */
body:has(.medium-detail-section[data-theme="light"]:not(.hidden)) {
    background: white;
}

.medium-detail-section[data-theme="dark"] {
    background: var(--reading-theme-dark-bg);
    color: var(--reading-theme-dark-text);
}

/* When medium section is active with dark theme, set body background */
body:has(.medium-detail-section[data-theme="dark"]:not(.hidden)) {
    background: var(--reading-theme-dark-bg);
}

.medium-detail-section[data-theme="dark"] .summary-text,
.medium-detail-section[data-theme="dark"] h2,
.medium-detail-section[data-theme="dark"] h3,
.medium-detail-section[data-theme="dark"] h4 {
    color: var(--reading-theme-dark-text);
}

.medium-detail-section[data-theme="dark"] .back-button {
    color: var(--reading-theme-dark-accent);
}

/* Sticky Reading Header */
.sticky-reading-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: #000000 !important;
    border-bottom: 1px solid var(--sticky-header-accent);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
    transition: transform 0.3s ease;
    pointer-events: none;
    height: 51px; /* Fixed height: 34px content + 8px top padding + 8px bottom padding + 1px border = 51px */
    box-sizing: border-box; /* Include border in height */
}

.sticky-reading-header:not(.hidden) {
    pointer-events: auto;
}

.sticky-reading-header.hidden {
    transform: translateY(-100%);
    visibility: hidden;
}

.sticky-header-content {
    max-width: 100%;
    margin: 0;
    padding: 8px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    height: 34px; /* Fixed height: prevents layout shift during chapter transitions */
    box-sizing: content-box; /* Padding is added to height, total = 34px + 8px + 8px = 50px */
}

/* Three-column layout for sticky header */
.sticky-header-left {
    flex: 1 1 0;
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    overflow: hidden;
}

.sticky-header-center {
    flex: 0 0 auto;
    display: flex;
    justify-content: center;
    align-items: center;
}

.sticky-header-right {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Sticky header buttons */
.sticky-back-btn {
    background: var(--sticky-header-accent);
    border: 1px solid var(--sticky-header-border);
    color: var(--card-background) !important;
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.sticky-back-btn:hover {
    background: var(--sticky-header-active);
    border-color: var(--sticky-header-muted);
}

.sticky-chapter-title {
    color: var(--card-background);
    font-size: 0.9rem;
    font-weight: 400;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
    flex: 1 1 0;
}

/* Unified view toggle (Summary/Original/Modern/Side×Side) */
.unified-view-toggle {
    display: flex;
    gap: 0;
    background: #1a1a1a;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid var(--sticky-header-border);
}

.unified-view-btn {
    background: transparent;
    border: none;
    color: var(--sticky-header-muted);
    padding: 6px 14px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
    border-right: 1px solid var(--sticky-header-border);
}

.unified-view-btn:last-child {
    border-right: none;
}

.unified-view-btn:hover {
    background: var(--sticky-header-accent);
}

.unified-view-btn.active {
    background: var(--sticky-header-active);
    color: var(--card-background);
}

/* TTS and settings buttons */
.sticky-tts-btn,
.sticky-settings-btn {
    background: transparent;
    border: 1px solid var(--sticky-header-border);
    color: var(--card-background) !important;
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
}

.sticky-tts-btn:hover,
.sticky-settings-btn:hover {
    background: var(--sticky-header-accent);
    border-color: var(--sticky-header-muted);
}

/* Font Family Application - includes summary text, modern English, and side-by-side */
.chapter-detail-section[data-font="georgia"] .chapter-fulltext,
.chapter-detail-section[data-font="georgia"] .chapter-modern-english,
.chapter-detail-section[data-font="georgia"] .side-by-side-cell,
.chapter-detail-section[data-font="georgia"] .chapter-summary-text,
.chapter-detail-section[data-font="georgia"] .summary-text,
.medium-detail-section[data-font="georgia"] .summary-text {
    font-family: var(--reading-font-serif);
    font-optical-sizing: auto;
}

.chapter-detail-section[data-font="system"] .chapter-fulltext,
.chapter-detail-section[data-font="system"] .chapter-modern-english,
.chapter-detail-section[data-font="system"] .side-by-side-cell,
.chapter-detail-section[data-font="system"] .chapter-summary-text,
.chapter-detail-section[data-font="system"] .summary-text,
.medium-detail-section[data-font="system"] .summary-text {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

.chapter-detail-section[data-font="figtree"] .chapter-fulltext,
.chapter-detail-section[data-font="figtree"] .chapter-modern-english,
.chapter-detail-section[data-font="figtree"] .side-by-side-cell,
.chapter-detail-section[data-font="figtree"] .chapter-summary-text,
.chapter-detail-section[data-font="figtree"] .summary-text,
.medium-detail-section[data-font="figtree"] .summary-text {
    font-family: 'Figtree', 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* ===================================
   Image Lightbox Overlay
   =================================== */

/* Lightbox overlay - full screen dark background */
.lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.95);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: zoom-out;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.lightbox-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

/* Close button - top right corner */
.lightbox-close {
    position: absolute;
    top: 24px;
    right: 24px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
    font-size: 2rem;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    z-index: 10001;
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
    transform: scale(1.1);
}

/* Lightbox image - centered and scaled */
.lightbox-image {
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
    cursor: default;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

/* Make illustration clickable (pointer cursor) */
.chapter-illustration {
    cursor: pointer;
    transition: opacity 0.3s ease-in;
}

.chapter-illustration:hover {
    opacity: 0.9 !important; /* Override when loaded */
}

.chapter-illustration-container {
    position: relative;
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .lightbox-close {
        top: 16px;
        right: 16px;
        width: 44px;
        height: 44px;
        font-size: 1.5rem;
    }

    .lightbox-image {
        max-width: 95vw;
        max-height: 95vh;
    }
}

/* ===== Author Page Styles ===== */

#author-detail-section {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

.author-header {
    text-align: center;
    margin-bottom: 3rem;
    padding-bottom: 2rem;
    border-bottom: 2px solid var(--border-color);
}

.author-header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

.author-country {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
}

.author-bio-section,
.author-books-section,
.author-other-books-section {
    margin-bottom: 3rem;
}

.author-bio-section h2,
.author-books-section h2,
.author-other-books-section h2 {
    font-size: 1.75rem;
    margin-bottom: 1rem;
    color: var(--text-color);
}

.author-books-section h2 .count {
    color: var(--text-secondary);
    font-size: 1.25rem;
    font-weight: normal;
}

.author-long-bio {
    line-height: 1.8;
    color: var(--text-color);
}

.author-long-bio p {
    margin-bottom: 1rem;
}

/* Books carousel on author page */
.books-carousel {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 2rem;
    margin-top: 1.5rem;
}

/* Other books grid (non-platform books) */
.other-books-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
    margin-top: 1.5rem;
}

.other-books-column ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.other-books-column li {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-color);
    position: relative;
    padding-left: 1.5rem;
}

.other-books-column li:before {
    content: "📚";
    position: absolute;
    left: 0;
    top: 0.75rem;
}

.other-books-column li:last-child {
    border-bottom: none;
}

/* Author link styling */
.author-link {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.2s ease;
}

.author-link:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .author-header h1 {
        font-size: 2rem;
    }

    .other-books-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .books-carousel {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 1rem;
    }
}

/* ===========================
   Discover Page
   =========================== */

#discover-section {
    padding-top: 20px;
    animation: fadeIn 0.3s ease;
}

.discover-header {
    max-width: 640px;
    margin-bottom: 1.5rem;
}

.discover-header h2 {
    margin-bottom: 0.4rem;
    color: var(--ink);
    font-family: var(--font-serif);
    font-size: clamp(1.75rem, 4vw, 2.4rem);
    line-height: 1.15;
}

.discover-header p {
    color: var(--ink-muted);
    font-size: 1.02rem;
}

.discover-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem 2rem;
    padding: 1rem 0;
    border-top: 1px solid var(--rule);
    border-bottom: 1px solid var(--rule);
}

.discover-filter,
.discover-sort {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
}

.discover-filter-label {
    margin-right: 0.25rem;
    color: var(--ink-muted);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.filter-chip {
    padding: 0.35rem 0.85rem;
    border: 1px solid var(--rule-strong);
    border-radius: 999px;
    background: transparent;
    color: var(--ink);
    font: inherit;
    font-size: 0.88rem;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.filter-chip:hover {
    border-color: var(--ink-muted);
}

.filter-chip[aria-pressed="true"] {
    border-color: var(--ink);
    background: var(--ink);
    color: var(--paper);
}

.filter-chip:focus-visible,
.discover-sort select:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.discover-sort {
    margin-left: auto;
}

.discover-sort select {
    padding: 0.35rem 0.6rem;
    border: 1px solid var(--rule-strong);
    border-radius: 6px;
    background: var(--surface);
    color: var(--ink);
    font: inherit;
    font-size: 0.88rem;
}

.discover-count {
    margin: 1rem 0 1.25rem;
    color: var(--ink-muted);
    font-size: 0.9rem;
}

.discover-empty {
    padding: 3rem 0;
    color: var(--ink-muted);
    text-align: center;
}

.discover-empty button {
    margin-left: 0.5rem;
    padding: 0.4rem 0.9rem;
}

/* Filtering: the grid carries the active filters; non-matching cards hide.
   Works on the server-rendered page before any JS runs. */
.discover-grid[data-filter-grade="3-5"] > .book-card:not([data-grade="3-5"]),
.discover-grid[data-filter-grade="6-8"] > .book-card:not([data-grade="6-8"]),
.discover-grid[data-filter-grade="9-10"] > .book-card:not([data-grade="9-10"]),
.discover-grid[data-filter-grade="11-12"] > .book-card:not([data-grade="11-12"]),
.discover-grid[data-filter-ages="lg"] > .book-card:not([data-ages="lg"]),
.discover-grid[data-filter-ages="mg"] > .book-card:not([data-ages="mg"]),
.discover-grid[data-filter-ages="mg-plus"] > .book-card:not([data-ages="mg-plus"]),
.discover-grid[data-filter-ages="ug"] > .book-card:not([data-ages="ug"]),
.discover-grid[data-filter-school="yes"] > .book-card:not([data-school="yes"]),
.discover-grid[data-filter-plain="yes"] > .book-card:not([data-plain="yes"]),
.discover-grid[data-filter-length="short"] > .book-card:not([data-length="short"]),
.discover-grid[data-filter-length="medium"] > .book-card:not([data-length="medium"]),
.discover-grid[data-filter-length="long"] > .book-card:not([data-length="long"]) {
    display: none;
}

@media (max-width: 600px) {
    .discover-controls {
        flex-direction: column;
        align-items: flex-start;
    }

    .discover-filter .discover-filter-label {
        flex-basis: 100%;
    }

    .discover-sort {
        margin-left: 0;
    }
}

@media (max-width: 768px) {
    #discover-section {
        padding-top: 16px;
    }
}

@media (max-width: 480px) {
    #discover-section {
        padding-top: 12px;
    }
}

/* ===========================
   Modern English Side-by-Side View
   =========================== */

/* View Mode Toggle */

.view-mode-btn.active {
    background: var(--primary-color);
    color: white;
}

/* Header Controls Flexbox */

/* Modern English Text (single view) */
.chapter-modern-english {
    /* font-size is set via JavaScript reading settings - default removed to allow inline styles to work */
    line-height: 1.75;
    color: var(--text-color);
    margin-top: 16px;
}

.chapter-modern-english p {
    margin-bottom: 1em;
}

/* Side-by-Side Container */
.chapter-side-by-side {
    display: flex;
    flex-direction: column;
    gap: 0;
    max-width: 1400px;
    margin: 0 auto;
}

/* Side-by-Side Headers */
.side-by-side-headers {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #e8e8e8;
}

.side-by-side-header {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-light);
    text-align: left;
}

.side-by-side-header:first-child {
    padding-right: 1rem;
}

.side-by-side-header:last-child {
    padding-left: 1rem;
}

.side-by-side-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    align-items: start;
    margin-bottom: 0;
}

.side-by-side-cell {
    min-width: 0; /* Prevent overflow */
    /* font-size is set via JavaScript reading settings - default removed to allow inline styles to work */
    line-height: 1.75;
    color: var(--text-color);
}

.side-by-side-cell p {
    margin-bottom: 1.5em;
}

/* Add visual separation with subtle background for original text */
.side-by-side-cell.original {
    padding-right: 1rem;
    border-right: 1px solid var(--border-light);
}

.side-by-side-cell.modern {
    padding-left: 1rem;
}

/* Mobile Responsiveness */
@media (max-width: 1024px) {
    .side-by-side-headers {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }

    .side-by-side-header:first-child {
        padding-right: 0;
        padding-bottom: 0.5rem;
    }

    .side-by-side-header:last-child {
        padding-left: 0;
        padding-top: 0.5rem;
    }

    .side-by-side-row {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .side-by-side-cell.original {
        border-right: none;
        border-bottom: 2px solid var(--border-light);
        padding-right: 0;
        padding-bottom: 1rem;
    }

    .side-by-side-cell.modern {
        padding-left: 0;
        padding-top: 1rem;
    }
}

@media (max-width: 768px) {
    .view-mode-toggle {
        flex-wrap: wrap;
        gap: 0.25rem;
    }

    .view-mode-btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.85rem;
    }

    .header-controls {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .side-by-side-cell p {
        font-size: 1rem;
    }
}

/* ===========================
   Admin Features (Development Only)
   =========================== */

/* Admin Edit Button */

/* Update chapter header to flex layout */

/* Admin Modal */
.admin-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.6);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.admin-modal.hidden {
    opacity: 0;
    pointer-events: none;
}

.admin-modal-content {
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    width: 90%;
    max-width: 900px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.admin-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-light);
    background: var(--admin-modal-bg);
}

.admin-modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
    color: var(--primary-color);
}

.admin-modal-close {
    background: transparent;
    border: none;
    font-size: 2rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.admin-modal-close:hover {
    color: var(--text-dark);
}

.admin-modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.admin-form-group {
    margin-bottom: 20px;
}

.admin-form-group:last-child {
    margin-bottom: 0;
}

.admin-form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--primary-color);
    font-size: 0.95rem;
}

.admin-textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border-light);
    border-radius: 8px;
    font-size: 0.95rem;
    font-family: 'Courier New', monospace;
    line-height: 1.6;
    resize: vertical;
    transition: border-color 0.2s;
}

.admin-textarea:focus {
    outline: none;
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(138, 46, 46, 0.08);
}

.admin-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 20px 24px;
    border-top: 1px solid var(--border-light);
    background: var(--admin-modal-bg);
}

.admin-btn-primary,
.admin-btn-secondary {
    padding: 10px 24px;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.admin-btn-primary {
    background: #4caf50;
    color: white;
}

.admin-btn-primary:hover {
    background: #45a049;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.3);
}

.admin-btn-secondary {
    background: #e0e0e0;
    color: var(--text-dark);
}

.admin-btn-secondary:hover {
    background: #d5d5d5;
}

@media (max-width: 768px) {
    .admin-modal-content {
        width: 95%;
        max-height: 95vh;
    }

    .admin-modal-header,
    .admin-modal-body,
    .admin-modal-footer {
        padding: 16px;
    }

    .admin-textarea {
        font-size: 0.9rem;
    }
}

/* ===== Blog Styles ===== */

.blog-index-section,
.blog-post-section {
    padding: 20px 0;
}

.blog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 30px;
    margin-top: 30px;
}

.blog-card {
    background: var(--card-bg);
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
}

.blog-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

.blog-card-image {
    width: 100%;
    height: 200px;
    overflow: hidden;
}

.blog-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.blog-card:hover .blog-card-image img {
    transform: scale(1.05);
}

.blog-card-content {
    padding: 30px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.blog-card-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--text-primary);
    line-height: 1.3;
}

.blog-card-date {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-bottom: 15px;
}

.blog-card-excerpt {
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.blog-card-link {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    font-size: 1rem;
    transition: color 0.2s ease;
}

.blog-card-link:hover {
    color: var(--primary-dark);
}

.blog-post {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

.blog-post-header-image {
    width: 100%;
    max-height: 400px;
    overflow: hidden;
    border-radius: 12px;
    margin-bottom: 30px;
}

.blog-post-header-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.blog-post-header {
    margin-bottom: 40px;
}

.blog-back-link {
    display: inline-block;
    color: var(--primary-color);
    text-decoration: none;
    margin-bottom: 20px;
    font-size: 1rem;
    transition: color 0.2s ease;
}

.blog-back-link:hover {
    color: var(--primary-dark);
}

.blog-post-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 15px;
    line-height: 1.2;
    color: var(--text-primary);
}

.blog-post-meta {
    display: flex;
    gap: 20px;
    font-size: 0.95rem;
    color: var(--text-light);
}

.blog-post-author {
    font-weight: 500;
}

.blog-post-content {
    font-size: 1.1rem;
    line-height: 1.8;
    color: var(--text-secondary);
}

.blog-post-content h1,
.blog-post-content h2,
.blog-post-content h3,
.blog-post-content h4 {
    margin-top: 40px;
    margin-bottom: 20px;
    color: var(--text-primary);
}

.blog-post-content h2 {
    font-size: 2rem;
    font-weight: 600;
}

.blog-post-content h3 {
    font-size: 1.6rem;
    font-weight: 600;
}

.blog-post-content p {
    margin-bottom: 20px;
}

.blog-post-content ul,
.blog-post-content ol {
    margin-left: 30px;
    margin-bottom: 20px;
}

.blog-post-content li {
    margin-bottom: 10px;
}

.blog-post-content a {
    color: var(--primary-color);
    text-decoration: underline;
}

.blog-post-content a:hover {
    color: var(--primary-dark);
}

.blog-post-content strong {
    font-weight: 600;
}

.blog-post-content code {
    background: rgba(0, 0, 0, 0.05);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.95em;
}

.blog-post-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 30px 0;
}

.blog-post-content th,
.blog-post-content td {
    border: 1px solid var(--border-color);
    padding: 12px;
    text-align: left;
}

.blog-post-content th {
    background: rgba(0, 0, 0, 0.05);
    font-weight: 600;
}

.blog-empty,
.blog-error {
    text-align: center;
    padding: 60px 20px;
}

.blog-empty h2,
.blog-error h2 {
    font-size: 2rem;
    margin-bottom: 15px;
    color: var(--text-primary);
}

.blog-empty p,
.blog-error p {
    font-size: 1.1rem;
    color: var(--text-secondary);
}

@media (max-width: 768px) {
    .blog-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .blog-card {
        padding: 20px;
    }

    .blog-post-title {
        font-size: 1.8rem;
    }

    .blog-post-content {
        font-size: 1rem;
    }

    .blog-post-content h2 {
        font-size: 1.6rem;
    }

    .blog-post-content h3 {
        font-size: 1.3rem;
    }
}

/* iOS Install Banner */
.ios-install-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, var(--cta-gradient-start) 0%, var(--cta-gradient-end) 100%);
    color: white;
    padding: 16px 20px;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.15);
    z-index: 9999;
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

.ios-banner-content {
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: 1200px;
    margin: 0 auto;
}

.ios-banner-icon {
    font-size: 32px;
    flex-shrink: 0;
}

.ios-banner-text {
    flex: 1;
    min-width: 0;
}

.ios-banner-title {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 4px;
}

.ios-banner-subtitle {
    font-size: 13px;
    opacity: 0.95;
    display: flex;
    align-items: center;
    gap: 4px;
}

.ios-share-icon {
    width: 16px;
    height: 16px;
    display: inline-block;
    vertical-align: middle;
}

.ios-banner-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 20px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.ios-banner-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.ios-banner-close:active {
    background: rgba(255, 255, 255, 0.4);
}

@media (max-width: 768px) {
    .ios-install-banner {
        padding: 12px 16px;
    }

    .ios-banner-icon {
        font-size: 28px;
    }

    .ios-banner-title {
        font-size: 14px;
    }

    .ios-banner-subtitle {
        font-size: 12px;
    }
}

/* ===== User Account Modal ===== */

/* User account button */

/* Modal container */

/* Modal overlay */

/* Modal content */

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Close button */

/* Modal title */

/* Form styles */
.user-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--primary-color);
}

.form-group input {
    padding: 0.75rem;
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.2s ease;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(138, 46, 46, 0.08);
}

.form-group small {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Error message */
.form-error {
    background: var(--error-bg-light);
    border: 1px solid #fcc;
    color: #c33;
    padding: 0.75rem;
    border-radius: 6px;
    font-size: 0.9rem;
}

.form-error.hidden {
    display: none;
}

/* Buttons */
.btn-primary {
    background: var(--accent);
    color: var(--on-accent);
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius-control);
    font: inherit;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease;
}

.btn-primary:hover {
    background: var(--accent-hover);
}

.btn-primary:active {
    transform: scale(0.98);
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    background: var(--surface);
    color: var(--ink);
    padding: 0.7rem 1.2rem;
    border: 1px solid var(--rule-strong);
    border-radius: var(--radius-control);
    font: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.2s ease;
}

.btn-secondary:hover {
    border-color: var(--ink-muted);
    background: var(--paper-deep);
}

/* Modal footer */

.link-btn {
    background: none;
    border: none;
    color: var(--primary-color);
    cursor: pointer;
    font-weight: 500;
    padding: 0;
    text-decoration: underline;
}

.link-btn:hover {
    color: var(--secondary-color-hover);
}

/* View switching */

/* Account view */

/* Account stats */

/* Mobile responsiveness */

/* ===== Completed Chapter Styling ===== */

/* Completed chapter header styling in chapter view */
.chapter-header.completed {
    opacity: 0.8;
}

.chapter-header.completed h1,
.chapter-header.completed h2 {
    color: var(--text-muted);
}

/* Progress indicator badge */

/* Reading progress summary */

/* Mobile adjustments */
@media (max-width: 768px) {
    .chapter-box.completed::before {
        font-size: 1.25rem;
        right: 0.75rem;
    }

    .chapter-progress-badge {
        font-size: 0.75rem;
        padding: 0.2rem 0.6rem;
    }

    .reading-progress-summary {
        flex-direction: column;
        align-items: flex-start;
    }

    .progress-summary-icon {
        font-size: 1.5rem;
    }
}

/* ===== Resume Reading Button ===== */

/* Mobile adjustments */

/* ===========================
   Home (redesign 2026-10-12)
   =========================== */

.home-hero {
    display: grid;
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
    align-items: center;
    gap: 3.5rem;
    /* Full-bleed dark band; content stays on the header's 1160px column. */
    margin: 0 calc(50% - 50vw);
    padding: 4.5rem max(20px, calc(50vw - 580px)) 4rem;
    background: var(--ink);
    color: var(--paper);
}

.home-hero .hero-banner-title {
    margin-bottom: 1.1rem;
    color: var(--paper);
    font-family: var(--font-serif);
    font-size: clamp(2.3rem, 5vw, 3.5rem);
    font-weight: 600;
    line-height: 1.06;
    letter-spacing: -0.01em;
}

.home-hero .hero-banner-subtitle {
    max-width: 30rem;
    color: var(--rule-strong);
    font-family: var(--font-serif);
    font-size: 1.2rem;
    font-style: italic;
    line-height: 1.55;
}

.home-hero .hero-banner-ctas {
    justify-content: flex-start;
    margin-top: 2rem;
}

.home-hero .hero-cta-primary {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.8rem 1.4rem;
    border-radius: var(--radius-control);
    background: var(--paper);
    color: var(--ink);
    font-size: 1rem;
    font-weight: 600;
}

.home-hero .hero-cta-primary:hover {
    background: var(--surface);
}

/* The text thread */
.hero-thread-messages {
    display: grid;
}

.hero-sentence {
    display: flex;
    flex-direction: column;
    justify-content: flex-end; /* like a chat: newest message sits at the bottom */
    grid-area: 1 / 1;
    margin: 0;
}

.hero-sentence[hidden] {
    display: flex;
    visibility: hidden;
}

.hero-sentence-source {
    margin: 0 0 0.45rem 0.25rem;
    color: var(--rule-strong);
    font-size: 0.8rem;
    font-weight: 600;
}

.hero-sentence-source a {
    color: inherit;
    font-weight: 400;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.hero-bubble {
    max-width: 85%;
    margin: 0;
    padding: 0.85rem 1.1rem;
    border-radius: 18px;
}

.hero-bubble--original {
    align-self: flex-start;
    border-bottom-left-radius: 5px;
    background: var(--paper-deep);
    color: var(--ink-muted);
    font-family: var(--font-serif);
    font-size: 1.05rem;
    font-style: italic;
    line-height: 1.5;
}

.hero-bubble--plain {
    align-self: flex-end;
    margin-top: 1rem;
    border-bottom-right-radius: 5px;
    background: var(--accent-bright);
    color: #fff;
}

.hero-bubble--plain .hero-sentence-label {
    display: block;
    margin-bottom: 0.25rem;
    color: rgba(255, 255, 255, 0.78);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.04em;
}

.hero-sentence-plain {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 500;
    line-height: 1.45;
}

/* The reply pops in, like a message arriving — only when the reader asks
   for another example (app.js marks that example .is-new), not on load. */
.hero-sentence.is-new .hero-bubble--plain {
    animation: hero-reply-in 0.35s ease-out 0.2s both;
}

@keyframes hero-reply-in {
    from { opacity: 0; transform: translateY(8px) scale(0.97); }
}

@media (prefers-reduced-motion: reduce) {
    .hero-sentence.is-new .hero-bubble--plain {
        animation: none;
    }
}

.hero-sentence-next {
    display: block;
    margin: 1rem 0 0 auto;
    padding: 0;
    border: 0;
    background: none;
    color: var(--rule-strong);
    font: inherit;
    font-size: 0.92rem;
    font-weight: 600;
    cursor: pointer;
}

.hero-sentence-next:hover {
    color: var(--paper);
    text-decoration: underline;
    text-underline-offset: 4px;
}

/* Sections below the hero */
/* Each home section is a full-width band. The ink hero is the only coloured
   one: everything below it sits on one paper surface, and a rule above each
   later section's heading separates them. */
.home-section {
    margin: 0 calc(50% - 50vw);
    padding: 3.25rem max(20px, calc(50vw - 580px));
}

.home-band--paper {
    background: var(--paper);
}

.home-section:not(.hidden) ~ .home-section {
    padding-top: 0;
}

.home-section:not(.hidden) ~ .home-section > .home-section-head {
    padding-top: 2.5rem;
    border-top: 1px solid var(--rule-strong);
}

.home-section-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.home-section-head h2 {
    color: var(--ink);
    font-family: var(--font-serif);
    font-size: 1.9rem;
    font-weight: 600;
}

.home-section-sub {
    margin-top: 0.25rem;
    color: var(--ink-muted);
}

/* "… →" text links: one style everywhere. */
.home-section-link,
.learn-more-btn,
.discover-header a {
    color: var(--accent);
    font-size: 0.94rem;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}

.home-section-link:hover,
.learn-more-btn:hover,
.discover-header a:hover {
    color: var(--accent-hover);
    text-decoration: underline;
    text-underline-offset: 4px;
}

.top-10-carousel {
    position: relative;
}

.top-10-carousel .carousel-scroll {
    display: flex;
    gap: 1.25rem;
    padding: 0.5rem 0 1rem;
    overflow-x: auto;
    scroll-behavior: smooth;
    scrollbar-width: none;
}

.top-10-carousel .carousel-scroll::-webkit-scrollbar {
    display: none;
}

.skeleton-book-card {
    flex: 0 0 168px;
    aspect-ratio: 2 / 3;
    border-radius: 4px;
    background: var(--paper-deep);
}

/* Find a book at the right level: four grade cards into a filtered Discover. */
.grade-cards {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
}

.grade-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.7rem;
    padding: 1.25rem;
    border: 1px solid var(--rule);
    border-radius: 12px;
    background: var(--surface);
    color: var(--ink);
    text-decoration: none;
    transition: transform 0.15s ease;
}

.grade-card:hover {
    transform: translateY(-2px);
}

.grade-card .grade-tag {
    font-size: 0.82rem;
}

.grade-card-desc {
    margin: 0;
    color: var(--ink-muted);
    font-family: var(--font-serif);
    font-size: 1rem;
    line-height: 1.45;
}

.grade-card-count {
    margin-top: auto;
    color: var(--accent);
    font-size: 0.9rem;
    font-weight: 600;
}

.home-levels-how {
    display: inline-block;
    margin-top: 1.25rem;
}

/* Discover: "How we grade books", closed until asked for. */
.how-we-grade {
    scroll-margin-top: 90px; /* clear the sticky header when opened by link */
    margin: 0 0 1.5rem;
    padding: 0.9rem 1.25rem;
    border: 1px solid var(--rule);
    border-radius: 12px;
    background: var(--surface);
}

.how-we-grade summary {
    color: var(--accent);
    font-size: 0.94rem;
    font-weight: 600;
    cursor: pointer;
}

.how-we-grade[open] summary {
    margin-bottom: 1rem;
}

.level-notes {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.5rem 2rem;
}

.level-note h3 {
    margin: 0 0 0.4rem;
    color: var(--ink);
    font-size: 1rem;
    font-weight: 600;
}

.level-note p,
.level-footnote {
    margin: 0;
    color: var(--ink-muted);
    font-size: 0.92rem;
    line-height: 1.6;
}

.level-note a,
.level-footnote a {
    color: var(--accent);
    font-weight: 600;
}

.level-footnote {
    margin-top: 1.5rem;
    font-size: 0.85rem;
}

/* Header search: an inline field on wide screens; below 900px a magnifier
   opens it as a full-width bar under the header. */
.header-search {
    position: relative;
    display: flex;
    align-items: center;
    margin-left: auto;
}

.header-search-toggle {
    display: none;
    place-items: center;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--ink);
    cursor: pointer;
}

.header-search-toggle:hover,
.header-search.open .header-search-toggle {
    background: var(--paper-deep);
}

.header-search-panel {
    position: relative;
    width: 240px;
}

.header-search-panel::before {
    content: "";
    position: absolute;
    left: 0.8rem;
    top: 50%;
    width: 15px;
    height: 15px;
    transform: translateY(-50%);
    background: var(--ink-muted);
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-3.5-3.5'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-3.5-3.5'/%3E%3C/svg%3E") center / contain no-repeat;
    pointer-events: none;
}

.header-search-input {
    height: 36px;
    padding: 0 0.9rem 0 2.1rem;
    font-size: 0.9rem;
    border-color: var(--rule-strong);
    background: var(--surface);
}

.header-search-input:focus {
    border-color: var(--ink-muted);
    box-shadow: none;
}

.header-search-input::-webkit-search-cancel-button {
    -webkit-appearance: none;
}

.header-search .hero-search-results {
    left: auto;
    right: 0;
    width: min(380px, calc(100vw - 2rem));
}

@media (max-width: 899px) {
    /* The bar is its own full-width row of the header, in the flow, so it
       pushes the page (and its breadcrumb) down instead of covering it.
       display: contents makes the icon and bar items of .header-content. */
    .header-content {
        flex-wrap: wrap;
    }

    .header-search {
        display: contents;
    }

    .header-search-toggle {
        display: grid;
    }

    /* static: the results list anchors to .header (position: relative),
       outside .header-content, whose phone overflow-x scroll would clip it. */
    .header-search-panel {
        position: static;
        order: 1;
        flex: 0 0 100%;
        display: none;
        width: auto;
    }

    .header-search.open .header-search-panel {
        display: block;
    }

    .header-search-panel::before {
        left: calc(20px + 0.8rem);
        top: auto;
        bottom: 24px; /* header padding 12px + (40px input - 15px icon) / 2 */
        transform: none;
    }

    .header-search-input {
        height: 40px;
        font-size: 1rem;
    }

    .header-search .hero-search-results {
        left: 20px;
        right: 20px;
        width: auto;
        top: calc(100% - 8px);
    }
}

@media (max-width: 860px) {
    /* Phones: headline → tagline → the example → its "Show me another" →
       a full-width button, so the call to action follows the demo. */
    .home-hero {
        grid-template-columns: 1fr;
        gap: 0;
        padding-top: 2.5rem;
        padding-bottom: 2.5rem;
    }

    .home-hero-copy {
        display: contents;
    }

    .home-hero .hero-banner-title {
        order: 1;
        margin-bottom: 0.75rem;
        font-size: clamp(2.1rem, 9vw, 2.6rem);
    }

    .home-hero .hero-banner-subtitle {
        order: 2;
        margin: 0 0 1.25rem;
        font-size: 1.05rem;
    }

    .hero-thread {
        order: 3;
    }

    .home-hero .hero-banner-ctas {
        order: 4;
        margin-top: 1.5rem;
    }

    .home-hero .hero-cta-primary {
        width: 100%;
        justify-content: center;
    }

    .hero-bubble {
        max-width: 92%;
        padding: 0.7rem 0.95rem;
    }

    .hero-bubble--original {
        font-size: 0.95rem;
        line-height: 1.45;
    }

    .hero-bubble--plain {
        margin-top: 0.75rem;
    }

    .hero-sentence-plain {
        font-size: 1.02rem;
    }

    .grade-cards {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .level-notes {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .home-section-head h2 {
        font-size: 1.45rem;
    }
}

.header-signin {
    display: none;
    flex-shrink: 0;
    color: var(--accent);
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}

/* Phone header: the icon alone links home, leaving room for the nav links. */
@media (max-width: 600px) {
    .header .logo {
        display: none;
    }

    .header-nav-buttons {
        gap: 14px;
        margin-left: 4px;
    }

    .header-nav-btn {
        font-size: 0.9rem;
    }

    /* The footer's sign-in link is a long scroll away on a phone (and the
       reader has no footer), so phones also get one in the header. */
    .header-signin {
        display: block;
    }
}

/* Narrow phones: signed in, Library + Discover + Categories + search +
   account must still fit on one line at 360px. */
@media (max-width: 400px) {
    .header-content {
        gap: 8px;
    }

    .header-nav-buttons {
        gap: 10px;
        margin-left: 0;
    }

    .header-nav-btn {
        font-size: 0.85rem;
    }
}


.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Account: a circular initial in the header */
.header-account {
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 1px solid var(--rule-strong);
    border-radius: 50%;
    background: var(--surface);
    color: var(--accent);
    cursor: pointer;
}

.header-account:hover {
    border-color: var(--accent);
    background: var(--paper-deep);
}

.account-avatar {
    display: grid;
    place-items: center;
    font-family: var(--font-serif);
    font-size: 1rem;
    font-weight: 600;
    line-height: 1;
}

/* Account modal */
.user-modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: grid;
    place-items: center;
    padding: 16px;
}

.user-modal.hidden {
    display: none;
}

.user-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(43, 38, 34, 0.45);
}

.user-modal-content {
    position: relative;
    width: min(420px, 100%);
    padding: 1.75rem;
    border: 1px solid var(--rule);
    border-radius: 12px;
    background: var(--surface);
    color: var(--ink);
    box-shadow: 0 18px 48px rgba(43, 38, 34, 0.2);
}

.user-modal-close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--ink-muted);
    font-size: 1rem;
    cursor: pointer;
}

.user-modal-close:hover {
    background: var(--paper-deep);
    color: var(--ink);
}

.user-modal-title {
    margin: 0 0 1.1rem;
    font-family: var(--font-serif);
    font-size: 1.5rem;
    font-weight: 600;
}

.user-modal-subtitle,
.account-stats-description {
    margin: 0;
    color: var(--ink-muted);
    font-size: 0.9rem;
    line-height: 1.5;
}

.account-info {
    border-top: 1px solid var(--rule);
}

.account-item {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.65rem 0;
    border-bottom: 1px solid var(--rule);
    font-size: 0.92rem;
}

.account-label {
    color: var(--ink-muted);
}

.account-value {
    min-width: 0;
    overflow-wrap: anywhere;
    text-align: right;
}

.account-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin: 1.25rem 0 0.75rem;
}

.account-stat {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    padding: 0.85rem 1rem;
    border-radius: 10px;
    background: var(--paper);
}

.stat-value {
    font-family: var(--font-serif);
    font-size: 1.6rem;
    font-weight: 600;
    line-height: 1.1;
}

.stat-label {
    color: var(--ink-muted);
    font-size: 0.85rem;
}

.account-library-link {
    margin-top: 1.25rem;
}

/* Book page summary: heading, Short/Full switch, Listen */
.book-summary-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem 1rem;
    margin-bottom: 1.1rem;
}

.book-summary-title {
    margin: 0 auto 0 0;
    font-family: var(--font-serif);
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--ink);
}

.summary-switch {
    display: inline-flex;
    padding: 3px;
    border: 1px solid var(--rule);
    border-radius: var(--radius-control);
    background: var(--paper-deep);
}

.summary-tab {
    display: inline-flex;
    align-items: baseline;
    min-height: 34px;
    padding: 0.4rem 0.9rem;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--ink-muted);
    font: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
}

.summary-tab:hover {
    color: var(--ink);
}

.summary-tab.active {
    background: var(--surface);
    color: var(--ink);
    box-shadow: 0 1px 2px rgba(43, 38, 34, 0.12);
}

.summary-tab-time {
    margin-left: 0.15rem;
    color: var(--ink-muted);
    font-weight: 400;
}

#concise-summary-text,
.book-summary .summary-text {
    font-size: 1.08rem;
    color: var(--ink);
}

.summary-more {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.35rem 0;
    border: 0;
    background: none;
    color: var(--accent);
    font: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
}

.summary-more:hover {
    color: var(--accent-hover);
    text-decoration: underline;
    text-underline-offset: 4px;
}

.summary-more svg {
    transition: transform 0.2s ease;
}

.summary-more[aria-expanded="true"] svg {
    transform: rotate(180deg);
}

/* Listen: one outline button with a state (Listen / Preparing / Pause / Resume) */
.listen-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    min-height: 36px;
    padding: 0 0.9rem;
    border: 1px solid var(--rule-strong);
    border-radius: var(--radius-control);
    background: var(--surface);
    color: var(--ink);
    font: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
}

.listen-btn:hover {
    border-color: var(--ink-muted);
    background: var(--paper-deep);
}

.listen-btn svg {
    color: var(--accent);
}

.listen-btn.is-playing {
    border-color: var(--accent);
    color: var(--accent);
}

.listen-btn:disabled {
    cursor: progress;
    opacity: 0.75;
}

.listen-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid var(--rule-strong);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: listen-spin 0.8s linear infinite;
}

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

@media (max-width: 640px) {
    .book-summary-title {
        flex: 1 1 100%;
    }

    .book-summary-head {
        column-gap: 0.5rem;
    }

    .summary-switch {
        flex: 1 1 auto;
        min-width: 0;
    }

    .summary-tab {
        flex: 1;
        justify-content: center;
        padding: 0.4rem 0.5rem;
        white-space: nowrap;
    }

    .listen-btn {
        padding: 0 0.7rem;
    }
}
