.reader-page { overflow: hidden; }
.reader-page .topbar, .reader-page .category-bar, .reader-page .featured, .reader-page .footer { display: none; }
.reader-page .product-main { width: 100%; max-width: none; height: 100dvh; margin: 0; padding: 0; }
.reader-shell { height: 100dvh; display: grid; grid-template-rows: auto 1fr; background: var(--bg); }
.reader-toolbar { min-height: 4.25rem; padding: .6rem 1rem; display: grid; grid-template-columns: minmax(12rem, 1fr) auto minmax(12rem, 1fr); align-items: center; gap: 1rem; border-bottom: 1px solid var(--line); background: var(--ground); }
.reader-book { min-width: 0; display: grid; }
.reader-book a { overflow: hidden; color: var(--ink); font-family: var(--font-reading); font-size: .9rem; text-decoration: none; text-overflow: ellipsis; white-space: nowrap; }
.reader-book span { overflow: hidden; color: var(--ink-faint); font-size: .66rem; text-overflow: ellipsis; white-space: nowrap; }
.page-controls, .reader-actions { display: flex; align-items: center; gap: .45rem; color: var(--ink-faint); font-size: .72rem; }
.reader-actions { justify-content: flex-end; }
.reader-toolbar button, .reader-toolbar input { min-width: 2.5rem; min-height: 2.5rem; color: var(--ink-soft); background: var(--surface); border: 1px solid var(--line); cursor: pointer; }
.reader-toolbar input { width: 3.4rem; padding: .4rem; text-align: center; }
#toggle-notebook { padding-inline: .8rem; }
#toggle-notebook span { min-width: 1.2rem; height: 1.2rem; margin-left: .3rem; display: inline-grid; place-items: center; color: var(--ground); background: var(--gold); border-radius: 50%; font-size: .62rem; }
.reader-workspace { min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 24rem; }
.reader-workspace.notebook-closed { grid-template-columns: 1fr 0; }
.pdf-workspace { position: relative; min-width: 0; overflow: auto; padding: 2rem; display: grid; place-items: start center; background: oklch(91% .018 78); }
.reader-status { min-height: 70vh; display: grid; place-items: center; align-content: center; gap: 1rem; color: var(--ink-faint); }
.reader-status p { max-width: 42ch; color: var(--text-dim); font-family: var(--font-reading); font-size: 1rem; line-height: 1.6; text-align: center; }
.reader-status a { min-height: 44px; display: inline-flex; align-items: center; color: var(--orange); font-size: .8rem; font-weight: 600; text-decoration: underline; text-underline-offset: 4px; }
.loader { width: 2rem; height: 2rem; border: 2px solid var(--line); border-top-color: var(--gold); border-radius: 50%; animation: reader-spin .8s linear infinite; }
@keyframes reader-spin { to { transform: rotate(360deg); } }
.pdf-page { position: relative; background: oklch(99% .005 80); box-shadow: 0 1.5rem 4rem oklch(35% .025 72 / .22); transform-origin: top center; }
#pdf-canvas { display: block; }
.text-layer { position: absolute; inset: 0; overflow: hidden; opacity: 1; line-height: 1; }
.text-layer span, .text-layer br { position: absolute; color: transparent; white-space: pre; transform-origin: 0 0; cursor: text; }
.text-layer ::selection { color: transparent; background: oklch(79% .13 83 / .7); }
.text-layer mark { color: transparent; background: oklch(82% .12 83 / .48); }
.selection-tools { position: fixed; z-index: 80; padding: .35rem; background: var(--surface-raised); border: 1px solid var(--line-strong); box-shadow: 0 .8rem 2rem oklch(35% .025 72 / .2); }
.selection-tools button { min-height: 2.5rem; padding: .55rem .8rem; color: var(--ground); background: var(--gold); border: 0; font-weight: 600; cursor: pointer; }
.reader-notebook { min-width: 0; overflow-y: auto; border-left: 1px solid var(--line); background: var(--ground); transition: opacity 220ms var(--ease-out); }
.reader-workspace.notebook-closed .reader-notebook { opacity: 0; pointer-events: none; }
.notebook-heading { position: sticky; top: 0; z-index: 2; padding: 1rem; display: flex; justify-content: space-between; background: var(--ground); border-bottom: 1px solid var(--line); }
.notebook-heading .eyebrow { margin-bottom: .35rem; }
.notebook-heading h2 { margin: 0; font-size: 1.35rem; }
.notebook-heading button { width: 2.5rem; height: 2.5rem; color: var(--ink-soft); background: none; border: 0; font-size: 1.5rem; cursor: pointer; }
.notebook-empty { padding: 2rem 1rem; color: var(--ink-soft); font-family: var(--font-reading); }
.notebook-empty span { color: var(--ink-faint); font-family: var(--font-ui); font-size: .72rem; }
.guest-reader-callout { display: grid; gap: .7rem; margin: 1rem; padding: 1.1rem; border: 1px solid var(--line-strong); background: var(--surface-raised); }
.guest-reader-callout p { color: var(--ink); font-family: var(--font-reading); font-size: .85rem; line-height: 1.5; }
.guest-reader-callout a { color: var(--green); font-size: .75rem; }
.guest-reader-callout a:last-child { color: var(--teal); }
.highlight-list { display: grid; }
.highlight-entry { padding: 1.25rem 1rem; border-bottom: 1px solid var(--line); }
.highlight-jump { margin-bottom: .8rem; padding: 0; color: var(--gold); background: none; border: 0; font-size: .68rem; font-weight: 600; text-transform: uppercase; cursor: pointer; }
.highlight-entry blockquote { margin: 0 0 1rem; color: var(--ink); font-family: var(--font-reading); font-size: .93rem; line-height: 1.6; }
.highlight-entry label { display: grid; gap: .35rem; color: var(--ink-faint); font-size: .68rem; }
.highlight-entry textarea { width: 100%; min-height: 4.5rem; padding: .65rem; resize: vertical; color: var(--ink); background: var(--surface); border: 1px solid var(--line); font-size: .78rem; line-height: 1.5; }
.save-note, .passage-chat button { min-height: 2.25rem; margin-top: .45rem; padding: .45rem .65rem; color: var(--ink); background: var(--surface-raised); border: 1px solid var(--line-strong); font-size: .72rem; cursor: pointer; }
.passage-chat { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.passage-chat summary { color: var(--gold); font-size: .75rem; cursor: pointer; }
.chat-messages { margin-top: .75rem; display: grid; gap: .5rem; }
.chat-messages p { margin: 0; padding: .65rem; color: var(--ink-soft); background: var(--surface); font-size: .75rem; }
.chat-messages p.assistant { font-family: var(--font-reading); font-size: .83rem; }
.chat-messages span { display: block; margin-bottom: .25rem; color: var(--ink-faint); font-family: var(--font-ui); font-size: .6rem; text-transform: uppercase; }
.chat-form { margin-top: .75rem; }
.chat-form textarea { min-height: 3.8rem; }
.delete-highlight { margin-top: 1rem; padding: 0; color: var(--ink-faint); background: none; border: 0; font-size: .68rem; text-decoration: underline; cursor: pointer; }
.delete-highlight:hover { color: var(--danger); }

@media (max-width: 56rem) {
    .reader-toolbar { grid-template-columns: 1fr auto; }
    .page-controls { grid-row: 2; grid-column: 1 / -1; justify-content: center; }
    .reader-actions > :not(#toggle-notebook) { display: none; }
    .reader-workspace { grid-template-columns: 1fr; }
    .reader-notebook { position: fixed; z-index: 70; inset: 0 0 0 auto; width: min(92vw, 24rem); box-shadow: -1rem 0 3rem oklch(35% .025 72 / .2); }
    .reader-workspace.notebook-closed .reader-notebook { transform: translateX(100%); }
    .pdf-workspace { padding: 1rem .5rem 6rem; }
}

@media (max-width: 420px) {
    .reader-toolbar { padding: .45rem .6rem; gap: .55rem; }
    .reader-book a { max-width: 58vw; }
    .page-controls { gap: .3rem; }
    .reader-toolbar button, .reader-toolbar input { min-width: 2.75rem; min-height: 2.75rem; }
    .pdf-workspace { padding-inline: 0; }
}

@media (prefers-reduced-motion: reduce) { .loader { animation-duration: 1.5s !important; } }
