.topbar-actions {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    flex-wrap: wrap;
}

.library-shelf-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 18px 0 22px;
}

.library-shelf-tab {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    padding: 0 14px;
    border-radius: 999px;
    border: 1px solid var(--surface-border);
    background: var(--panel-strong);
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.92rem;
    touch-action: manipulation;
}

.library-shelf-tab.is-active {
    background: var(--accent-soft, var(--panel-strong));
    color: var(--text-primary);
    border-color: currentColor;
}

.library-shelf-tab:focus-visible {
    outline: 2px solid var(--accent, currentColor);
    outline-offset: 3px;
}

.library-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 18px;
}

.library-card {
    display: grid;
    gap: 10px;
}

.library-card-badges {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 6px;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 999px;
    background: var(--accent-soft, var(--panel-strong));
    color: var(--text-primary);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.progress-bar {
    position: relative;
    height: 6px;
    border-radius: 999px;
    background: rgba(143, 69, 34, 0.14);
    overflow: hidden;
}

.progress-bar-fill {
    position: absolute;
    inset: 0 auto 0 0;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--accent), var(--accent-strong));
}

.topnav-link {
    position: relative;
    padding-bottom: 4px;
}

.topnav-link.is-active {
    color: var(--text-primary);
}

.topnav-link.is-active::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -2px;
    height: 2px;
    border-radius: 999px;
    background: currentColor;
}

.pill-link,
.environment-badge,
.badge-chip {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 0 12px;
    border-radius: 999px;
    border: 1px solid var(--surface-border);
    background: var(--panel-strong);
    color: var(--text-muted);
    font-size: 0.9rem;
}

.oauth-button-row {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    margin-top: 26px;
}

.auth-page .page-title {
    max-width: 720px;
    font-size: 56px;
    line-height: 1.04;
}

.oauth-button {
    min-width: 220px;
}

.oauth-button.is-disabled {
    cursor: default;
    opacity: 0.72;
}

.status-banner {
    display: grid;
    gap: 8px;
    margin-top: 22px;
    padding: 18px 20px;
    border: 1px solid var(--surface-border);
    border-radius: 22px;
    background: var(--panel-strong);
}

.status-title,
.status-copy,
.auth-note {
    margin: 0;
}

.status-title {
    font-weight: 700;
}

.status-copy,
.auth-note {
    color: var(--text-muted);
    line-height: 1.7;
}

.error-banner {
    border-color: rgba(201, 103, 76, 0.34);
    background: rgba(201, 103, 76, 0.08);
}

.success-banner {
    border-color: rgba(82, 148, 111, 0.34);
    background: rgba(82, 148, 111, 0.1);
}

.warning-banner {
    border-color: rgba(186, 144, 74, 0.34);
    background: rgba(186, 144, 74, 0.1);
}

.pill-link:hover,
.pill-link:focus-visible,
.footer-nav a:hover,
.footer-nav a:focus-visible {
    color: var(--text-primary);
}

.environment-badge {
    font-weight: 700;
    text-transform: capitalize;
}

.page-stack,
.app-page {
    display: grid;
    gap: 40px;
    margin-top: 40px;
}

.page-section,
.app-page-header,
.not-found-panel {
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.two-column-layout,
.library-grid,
.dashboard-grid,
.stats-grid {
    display: grid;
    gap: 18px;
}

.two-column-layout,
.library-grid,
.dashboard-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.stats-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.panel-card,
.stat-card,
.shelf-card,
.reader-sidebar,
.reader-page {
    padding: 24px;
    border: 1px solid var(--surface-border);
    border-radius: 8px;
    background: var(--panel-background);
    box-shadow: none;
}

.section-label,
.stat-label,
.shelf-meta {
    margin: 0 0 10px;
    color: var(--accent);
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.page-title,
.section-heading h2,
.panel-card h2,
.shelf-card h3,
.reader-page h2 {
    margin: 0;
    font-family: var(--font-accent);
    font-weight: 700;
    line-height: 1.05;
}

.page-title {
    font-size: 64px;
}

.page-subtitle,
.panel-copy,
.stat-detail,
.shelf-card p,
.reader-page p,
.inline-metadata,
.not-found-panel p {
    color: var(--text-muted);
    line-height: 1.7;
}

.page-subtitle {
    max-width: 44rem;
    margin: 16px 0 0;
    font-size: 1.08rem;
}

.section-heading,
.reader-toolbar,
.inline-metadata,
.badge-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.badge-row {
    margin-bottom: 16px;
}

.inline-metadata {
    margin: 18px 0 0;
}

.inline-metadata span:not(:last-child)::after {
    content: "•";
    margin-left: 12px;
    color: var(--surface-border);
}

.stat-value {
    margin: 0;
    font-size: 42px;
    font-weight: 700;
}

.stat-detail {
    margin: 12px 0 0;
}

.hero-split {
    grid-template-columns: minmax(0, 1.18fr) minmax(320px, 0.82fr);
}

.hero-split h1 {
    max-width: 760px;
    font-size: 64px;
    letter-spacing: 0;
}

.hero-split .hero-text {
    max-width: 660px;
}

.book-hero,
.author-hero,
.reader-shell {
    display: grid;
    gap: 22px;
}

.book-hero {
    grid-template-columns: minmax(280px, 0.8fr) minmax(0, 1.2fr);
    align-items: stretch;
}

.book-cover-card {
    padding: 20px;
    border: 1px solid var(--surface-border);
    border-radius: 8px;
    background: var(--panel-strong);
    box-shadow: none;
}

.book-cover-art {
    display: grid;
    align-content: space-between;
    min-height: 100%;
    padding: 32px;
    border-radius: 8px;
    background: linear-gradient(180deg, #1d1d1f, #3a3a3c);
    color: #fff7f0;
}

.book-cover-art .book-cover-title {
    margin: 12px 0;
    font-family: var(--font-accent);
    font-size: 54px;
    line-height: 1.02;
}

.book-cover-series {
    margin: 0;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    font-size: 0.82rem;
}

.book-copy,
.author-hero,
.app-page-header {
    align-items: start;
}

.preview-panel {
    background: linear-gradient(180deg, var(--accent-soft), var(--panel-background));
}

.text-link {
    color: var(--accent);
    font-weight: 700;
}

.author-hero {
    grid-template-columns: minmax(0, 1.2fr) minmax(260px, 0.8fr);
}

.spotlight-card {
    align-self: stretch;
}

.shelf-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
}

.shelf-card {
    transition: transform 140ms ease, border-color 140ms ease;
}

.shelf-card:hover,
.shelf-card:focus-visible {
    transform: translateY(-1px);
    border-color: var(--accent);
}

.shelf-card h3 {
    font-size: 28px;
    margin-bottom: 10px;
}

.app-page-header {
    display: flex;
    justify-content: space-between;
    gap: 20px;
}

.bullet-list {
    margin: 18px 0 0;
    padding-left: 18px;
    color: var(--text-muted);
    line-height: 1.9;
}

.reader-shell {
    grid-template-columns: minmax(260px, 0.72fr) minmax(0, 1.28fr);
    align-items: start;
}

@media (min-width: 1180px) {
    .reader-sidebar {
        position: sticky;
        top: 16px;
        max-height: calc(100dvh - 32px);
        overflow-y: auto;
    }
}

@media (min-width: 1500px) {
    .reader-shell {
        grid-template-columns: minmax(300px, 0.58fr) minmax(0, 1.42fr);
    }

    .reader-demo-stage {
        min-height: clamp(640px, 78vh, 1100px);
    }

    .reader-canvas {
        min-height: clamp(600px, 74vh, 1040px);
    }
}

@media (min-width: 1920px) {
    .reader-demo-stage {
        min-height: clamp(720px, 82vh, 1280px);
    }

    .reader-canvas {
        min-height: clamp(680px, 80vh, 1220px);
    }

    .reader-immersive-button {
        min-width: 52px;
        min-height: 48px;
        font-size: 1.05rem;
    }

    .reader-immersive-button:focus-visible {
        outline-width: 3px;
    }
}

.author-studio-grid {
    display: grid;
    grid-template-columns: minmax(320px, 0.9fr) minmax(0, 1.1fr);
    gap: 18px;
}

.reader-demo-shell {
    align-items: stretch;
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
    gap: 16px;
}

.reader-preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 18px 22px;
}

.reader-preview-heading {
    display: grid;
    gap: 6px;
    min-width: 0;
}

.reader-preview-heading h2,
.reader-status-card h2 {
    margin: 0;
    font-family: var(--font-accent);
    line-height: 1.06;
}

.reader-preview-heading .panel-copy,
.reader-status-card .panel-copy {
    margin: 0;
}

.reader-preview-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 10px;
}

.reader-preview-main {
    display: grid;
    grid-template-columns: minmax(210px, 260px) minmax(0, 1fr);
    min-height: min(74vh, 900px);
    border: 1px solid var(--surface-border);
    border-radius: 24px;
    background: var(--panel-background);
    box-shadow: var(--shadow-card);
    overflow: hidden;
}

.reader-preview-sidebar {
    display: grid;
    align-content: start;
    gap: 18px;
    position: static;
    min-height: 0;
    max-height: none;
    padding: 20px 16px;
    border: 0;
    border-right: 1px solid var(--surface-border);
    border-radius: 0;
    background: rgba(255, 255, 255, 0.34);
    box-shadow: none;
    overflow: auto;
}

:root[data-theme="dark"] .reader-preview-sidebar {
    background: rgba(20, 27, 31, 0.48);
}

.reader-upload-button {
    position: relative;
    overflow: hidden;
}

.reader-upload-input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.reader-control-group,
.reader-status-card {
    display: grid;
    gap: 10px;
}

.reader-settings-drawer {
    display: grid;
    gap: 12px;
    border-top: 1px solid var(--surface-border);
    padding-top: 14px;
}

.reader-settings-drawer summary {
    color: var(--text-primary);
    cursor: pointer;
    font-weight: 700;
}

.reader-settings-grid {
    display: grid;
    gap: 16px;
    padding-top: 12px;
}

.reader-page {
    padding: clamp(24px, 4vw, 56px);
    background: rgba(255, 252, 247, 0.92);
}

:root[data-theme="dark"] .reader-page {
    background: rgba(14, 18, 24, 0.96);
}

.segmented-control {
    display: inline-flex;
    gap: 8px;
    padding: 6px;
    border: 1px solid var(--surface-border);
    border-radius: 999px;
    background: var(--button-secondary);
    width: fit-content;
}

.segmented-control-button {
    padding: 9px 16px;
    min-height: 44px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.segmented-control-button[aria-pressed="true"],
.segmented-control-button.is-active {
    background: var(--panel-strong);
    color: var(--text-primary);
    box-shadow: inset 0 0 0 1px var(--surface-border);
}

.segmented-control-button:focus-visible,
.reader-toc-button:focus-visible,
.reader-bookmark-remove:focus-visible {
    outline: 2px solid var(--accent, currentColor);
    outline-offset: 2px;
}

.reader-font-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.reader-font-size-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 84px;
    min-height: 44px;
    padding: 0 16px;
    border: 1px solid var(--surface-border);
    border-radius: 999px;
    background: var(--panel-strong);
    color: var(--text-primary);
    font-weight: 700;
}

.reader-toc-list {
    display: grid;
    gap: 4px;
}

.reader-toc-button {
    width: 100%;
    padding: 9px 10px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--text-primary);
    cursor: pointer;
    font: inherit;
    line-height: 1.25;
    text-align: left;
}

.reader-toc-button:hover,
.reader-toc-button[aria-current="true"] {
    background: var(--accent-soft);
}

.reader-bookmarks-list {
    display: grid;
    gap: 6px;
}

.reader-bookmark-row {
    display: flex;
    align-items: stretch;
    gap: 6px;
}

.reader-bookmark-button {
    flex: 1;
}

.reader-bookmark-remove {
    appearance: none;
    min-width: 36px;
    padding: 0 10px;
    border: 1px solid var(--surface-border);
    border-radius: 14px;
    background: var(--panel-strong);
    color: var(--text-primary);
    font: inherit;
    cursor: pointer;
}

.reader-bookmark-remove:hover,
.reader-bookmark-remove:focus-visible {
    background: var(--accent-soft, var(--panel-strong));
}

.reader-immersive-button.is-active {
    background: var(--accent-soft, var(--panel-strong));
    border-color: currentColor;
}

.reader-article {
    display: grid;
    gap: 14px;
}

.reader-demo-article {
    position: relative;
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto;
    min-width: 0;
    min-height: 0;
    padding: 22px 74px 0;
    background: rgba(12, 16, 20, 0.035);
}

:root[data-theme="dark"] .reader-demo-article {
    background: #101418;
}

.reader-demo-stage {
    display: grid;
    min-height: clamp(520px, 70vh, 900px);
    padding: 18px;
    border: 1px solid var(--surface-border);
    border-radius: 8px;
    background: var(--panel-strong);
    box-shadow: none;
    overflow: hidden;
}

:root[data-theme="dark"] .reader-demo-stage {
    background: #14181f;
    box-shadow: none;
}

.reader-empty-state {
    display: grid;
    align-content: center;
    justify-items: start;
    gap: 12px;
    min-height: 100%;
    padding: clamp(24px, 4vw, 48px);
    border: 1px dashed var(--surface-border);
    border-radius: 8px;
    background: var(--panel-background);
}

:root[data-theme="dark"] .reader-empty-state {
    background: #14181f;
}

.reader-empty-state h2 {
    margin: 0;
    font-family: var(--font-accent);
    line-height: 1.04;
    font-size: 44px;
}

.reader-canvas {
    width: 100%;
    height: 100%;
    min-height: clamp(480px, 66vh, 860px);
    overflow: hidden;
    border-radius: 8px;
    background: var(--panel-background);
}

:root[data-theme="dark"] .reader-canvas {
    background: #14181f;
}

.reader-canvas iframe {
    width: 100%;
    height: 100%;
    border: 0;
    border-radius: inherit;
    background: transparent;
}

.reader-stage-arrow {
    position: absolute;
    top: calc(50% - 24px);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    padding: 0;
    border: 1px solid var(--surface-border);
    border-radius: 999px;
    background: color-mix(in srgb, var(--panel-background) 92%, transparent);
    box-shadow: 0 8px 18px rgba(31, 27, 20, 0.10);
    color: var(--text-primary);
    cursor: pointer;
    z-index: 2;
}

.reader-stage-arrow.previous {
    left: 22px;
}

.reader-stage-arrow.next {
    right: 22px;
}

.reader-stage-arrow:disabled {
    cursor: default;
    opacity: 0.38;
}

.reader-stage-arrow:not(:disabled):hover,
.reader-stage-arrow:not(:disabled):focus-visible {
    border-color: var(--accent);
    outline: 2px solid transparent;
}

.reader-stage-arrow:focus-visible {
    outline-color: currentColor;
    outline-offset: 2px;
}

.reader-stage-arrow-icon {
    display: block;
    fill: none;
    width: 22px;
    height: 22px;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2.4;
}

.reader-timeline {
    display: grid;
    grid-template-columns: minmax(160px, 1fr) minmax(220px, 4fr) auto;
    align-items: center;
    gap: 14px;
    min-height: 58px;
    color: var(--text-primary);
}

.reader-progress {
    width: 100%;
    accent-color: var(--accent);
}

.reader-progress-label {
    min-width: 42px;
    color: var(--text-muted);
    font-size: 0.88rem;
    text-align: right;
}

.reader-demo-article:fullscreen {
    display: block;
    width: 100vw;
    height: 100vh;
    padding: 0;
    background: var(--panel-background);
}

.reader-demo-article:fullscreen .reader-demo-stage {
    width: 100%;
    height: 100%;
    min-height: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
}

.reader-demo-article:fullscreen .reader-canvas {
    width: 100%;
    height: 100%;
    min-height: 0;
    border-radius: 0;
}

.reader-demo-article:fullscreen .reader-stage-arrow,
.reader-demo-article:fullscreen .reader-timeline {
    display: none;
}

@media (max-width: 920px) {
    .reader-preview-header {
        align-items: stretch;
        flex-direction: column;
    }

    .reader-preview-actions {
        justify-content: flex-start;
    }

    .reader-preview-main {
        grid-template-columns: 1fr;
    }

    .reader-preview-sidebar {
        max-height: 34vh;
        border-right: 0;
        border-bottom: 1px solid var(--surface-border);
    }

    .reader-demo-article {
        padding-left: 58px;
        padding-right: 58px;
    }

    .reader-stage-arrow.previous {
        left: 8px;
    }

    .reader-stage-arrow.next {
        right: 8px;
    }

    .reader-timeline {
        grid-template-columns: 1fr;
    }

    .reader-progress-label {
        text-align: left;
    }
}

.reader-immersive-bar {
    position: fixed;
    top: max(12px, env(safe-area-inset-top, 0px));
    right: max(12px, env(safe-area-inset-right, 0px));
    z-index: 40;
    display: inline-flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px;
    border-radius: 999px;
    border: 1px solid var(--surface-border);
    background: var(--panel-background);
    box-shadow: var(--shadow-card);
    transform: translateY(0);
    transition: opacity 180ms ease, transform 180ms ease;
}

.reader-immersive-button {
    appearance: none;
    min-width: 44px;
    min-height: 44px;
    padding: 0 12px;
    border: 1px solid var(--surface-border);
    border-radius: 999px;
    background: var(--panel-strong);
    color: var(--text-primary);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.reader-immersive-button:hover,
.reader-immersive-button:focus-visible {
    background: var(--accent-soft, var(--panel-strong));
    outline: 2px solid transparent;
    outline-offset: 2px;
}

.reader-immersive-button:focus-visible {
    outline-color: currentColor;
}

.reader-immersive-exit {
    background: var(--panel-background);
    font-weight: 700;
}

body.is-reader-immersive {
    overflow: hidden;
    overscroll-behavior: contain;
}

body.is-reader-immersive .site-shell-app > header,
body.is-reader-immersive .site-shell-app > .footer,
body.is-reader-immersive .app-page > .app-page-header,
body.is-reader-immersive .platform-diagnostics,
body.is-reader-immersive .reader-preview-header,
body.is-reader-immersive .reader-sidebar,
body.is-reader-immersive .reader-stage-arrow,
body.is-reader-immersive .reader-timeline,
body.is-reader-immersive .reader-toolbar {
    display: none !important;
}

body.is-reader-immersive .app-page {
    padding: 0 !important;
    margin: 0 !important;
    max-width: none !important;
}

body.is-reader-immersive .reader-shell {
    position: fixed;
    inset: 0;
    z-index: 35;
    display: block;
    padding: 0;
    margin: 0;
    background: var(--panel-background);
}

body.is-reader-immersive .reader-article,
body.is-reader-immersive .reader-demo-article {
    display: block;
    height: 100dvh;
    min-height: 100dvh;
    margin: 0;
    padding: 0;
}

body.is-reader-immersive .reader-demo-stage {
    height: 100dvh;
    min-height: 100dvh;
    margin: 0;
    padding: clamp(12px, 3vw, 36px);
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

body.is-reader-immersive .reader-canvas {
    height: 100%;
    min-height: 0;
    max-width: min(72ch, 100%);
    margin: 0 auto;
    border-radius: 12px;
}

@media (prefers-reduced-motion: reduce) {
    .reader-immersive-bar,
    .shelf-card,
    .button {
        transition: none !important;
    }

    .shelf-card:hover,
    .shelf-card:focus-visible,
    .button:hover,
    .button:focus-visible {
        transform: none !important;
    }
}

@media (max-width: 640px) {
    .reader-immersive-bar {
        top: max(8px, env(safe-area-inset-top, 0px));
        right: max(20px, env(safe-area-inset-right, 0px));
        left: max(20px, env(safe-area-inset-left, 0px));
        padding: 6px;
        gap: 4px;
        flex-wrap: nowrap;
        justify-content: space-around;
        overflow-x: auto;
    }

    .reader-immersive-button {
        min-width: 40px;
        min-height: 40px;
        padding: 0 8px;
        font-size: 0.92rem;
    }

    body.is-reader-immersive .reader-demo-stage {
        padding: max(8px, env(safe-area-inset-left, 0px));
        padding-top: calc(max(8px, env(safe-area-inset-top, 0px)) + 56px);
        padding-bottom: max(8px, env(safe-area-inset-bottom, 0px));
    }
}

.reader-footnote-overlay {
    position: fixed;
    inset: 0;
    z-index: 50;
    pointer-events: none;
}

.reader-footnote-popover {
    position: absolute;
    width: min(420px, calc(100vw - 32px));
    max-height: min(42vh, 360px);
    padding: 14px 16px 16px;
    overflow: visible;
    border: 1px solid var(--surface-border);
    border-radius: 8px;
    background: var(--panel-background);
    box-shadow: var(--shadow-soft);
    pointer-events: auto;
}

.reader-footnote-popover::before {
    content: "";
    position: absolute;
    left: var(--reader-footnote-anchor-x, 50%);
    width: 12px;
    height: 12px;
    background: var(--panel-background);
    transform: translateX(-50%) rotate(45deg);
}

.reader-footnote-popover[data-placement="below"]::before {
    top: -7px;
    border-top: 1px solid var(--surface-border);
    border-left: 1px solid var(--surface-border);
}

.reader-footnote-popover[data-placement="above"]::before {
    bottom: -7px;
    border-right: 1px solid var(--surface-border);
    border-bottom: 1px solid var(--surface-border);
}

.reader-footnote-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    margin-bottom: 6px;
}

.reader-footnote-header .section-label {
    color: var(--text-muted);
}

.reader-footnote-body {
    margin-top: 0;
    max-height: min(32vh, 280px);
    overflow: auto;
    color: var(--text-primary);
    line-height: 1.78;
}

.reader-footnote-body > :first-child {
    margin-top: 0;
}

.reader-footnote-body p,
.reader-footnote-body li,
.reader-footnote-body blockquote {
    color: var(--text-primary);
}

.reader-footnote-body ul,
.reader-footnote-body ol {
    margin: 0;
    padding-left: 0;
}

.reader-footnote-body li {
    list-style: none;
}

.reader-footnote-close {
    flex-shrink: 0;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    appearance: none;
    width: 24px;
    height: 24px;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
    color: var(--text-muted);
    cursor: pointer;
    font: inherit;
    font-size: 0.82rem;
    font-weight: 700;
    line-height: 1;
}

.reader-footnote-close:hover,
.reader-footnote-close:focus-visible {
    background: transparent;
    color: var(--text-primary);
}

.reader-footnote-close:focus,
.reader-footnote-close:focus-visible {
    outline: none;
}

.reader-page p {
    max-width: 34rem;
    margin: 0 auto 1.5rem;
    font-family: var(--font-accent);
    font-size: 1.16rem;
    line-height: 1.95;
    color: var(--text-primary);
}

.not-found-panel {
    text-align: center;
}

.footer-brand {
    display: grid;
    gap: 4px;
}

.footer-brand p {
    margin: 0;
}

.footer-nav {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.footer-nav a {
    color: var(--text-muted);
}

.author-upload-card,
.author-preview-card,
.author-preview-empty,
.author-preview-copy {
    display: grid;
    gap: 14px;
}

.author-preview-content {
    display: grid;
    grid-template-columns: minmax(220px, 0.72fr) minmax(0, 1.28fr);
    gap: 24px;
    align-items: start;
}

.author-preview-empty {
    align-content: center;
    min-height: 100%;
    padding: clamp(24px, 4vw, 44px);
    border: 1px dashed var(--surface-border);
    border-radius: 8px;
    background: var(--panel-background);
}

:root[data-theme="dark"] .author-preview-empty {
    background: rgba(12, 16, 22, 0.58);
}

.author-preview-cover {
    min-width: 0;
}

.author-cover-frame {
    display: grid;
    place-items: center;
    min-height: 420px;
    padding: 20px;
    border: 1px solid var(--surface-border);
    border-radius: 8px;
    background: var(--panel-strong);
    box-shadow: none;
}

:root[data-theme="dark"] .author-cover-frame {
    background: var(--panel-strong);
}

.author-cover-frame img {
    width: 100%;
    max-width: 320px;
    max-height: 460px;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: none;
}

.author-cover-placeholder {
    display: grid;
    place-items: center;
    width: min(100%, 320px);
    min-height: 420px;
    padding: 28px;
    border-radius: 8px;
    background: linear-gradient(180deg, #1d1d1f, #3a3a3c);
    color: #fff7f0;
    text-align: center;
    font-family: var(--font-accent);
    font-size: 1.8rem;
    line-height: 1.1;
}

.author-metadata-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin: 0;
}

.author-metadata-list div {
    padding: 14px 16px;
    border: 1px solid var(--surface-border);
    border-radius: 18px;
    background: var(--panel-strong);
}

.author-metadata-list dt,
.author-metadata-list dd {
    margin: 0;
}

.author-metadata-list dt {
    color: var(--accent);
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.author-metadata-list dd {
    margin-top: 8px;
    color: var(--text-primary);
    font-weight: 600;
    line-height: 1.5;
}

.author-summary-list {
    display: grid;
    gap: 10px;
    margin: 0;
    padding-left: 20px;
    color: var(--text-muted);
}

.onboarding-form {
    display: grid;
    gap: 22px;
    margin-top: 26px;
}

.role-card-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.role-card {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 16px;
    align-items: start;
    padding: 22px;
    border: 1px solid var(--surface-border);
    border-radius: 24px;
    background: var(--panel-background);
    box-shadow: var(--shadow-card);
    cursor: pointer;
}

.role-card:has(input:checked) {
    border-color: var(--accent);
    background: var(--accent-soft);
}

.role-card input {
    width: 20px;
    height: 20px;
    margin-top: 4px;
    accent-color: var(--accent);
}

.role-card-copy {
    display: grid;
    gap: 8px;
}

.role-card-title {
    color: var(--text-primary);
    font-family: var(--font-accent);
    font-size: 1.65rem;
    line-height: 1.05;
}

.button[aria-disabled="true"] {
    pointer-events: none;
    opacity: 0.72;
}

@media (max-width: 1100px) {
    .stats-grid,
    .shelf-row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .book-hero,
    .author-hero,
    .author-preview-content,
    .author-studio-grid,
    .reader-shell,
    .hero-split {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 820px) {
    .app-page-header,
    .author-metadata-list,
    .role-card-grid,
    .two-column-layout,
    .library-grid,
    .dashboard-grid,
    .stats-grid,
    .shelf-row {
        grid-template-columns: 1fr;
    }

    .app-page-header {
        flex-direction: column;
    }

    .footer-nav {
        justify-content: flex-start;
    }

    .reader-action-grid {
        grid-template-columns: 1fr;
    }

    .oauth-button {
        min-width: 0;
        width: 100%;
    }

    .page-title,
    .auth-page .page-title,
    .hero-split h1 {
        font-size: 46px;
    }

    .book-cover-art .book-cover-title,
    .reader-empty-state h2 {
        font-size: 38px;
    }
}

@media (max-width: 640px) {
    .page-section,
    .app-page-header,
    .not-found-panel,
    .panel-card,
    .stat-card,
    .shelf-card,
    .reader-sidebar,
    .reader-page {
        padding: 20px;
        border-radius: 8px;
    }

    .page-section,
    .app-page-header,
    .not-found-panel {
        padding: 0;
    }

    .book-cover-card {
        padding: 14px;
    }

    .book-cover-art {
        padding: 24px;
    }

    .reader-demo-stage,
    .reader-footnote-popover {
        padding: 18px;
        border-radius: 8px;
    }

    .role-card {
        padding: 18px;
        border-radius: 8px;
    }

    .page-title,
    .auth-page .page-title,
    .hero-split h1 {
        font-size: 40px;
    }

    .stat-value {
        font-size: 34px;
    }

    .shelf-card h3 {
        font-size: 25px;
    }
}

@media (min-width: 1500px) {
    .site-shell {
        width: min(1480px, calc(100% - 48px));
    }

    .reader-page p {
        max-width: 42rem;
        font-size: 1.36rem;
    }
}
