:root {
    color-scheme: dark;
    font-family: Arial, sans-serif;
    background: #101010;
    color: #f4f1e9;
    --reader-gold: #ceb542;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
a { color: inherit; }
button, input { font: inherit; }
button, .reader-actions a, .message-actions a {
    border: 1px solid #515151;
    border-radius: 4px;
    padding: 10px 14px;
    color: inherit;
    background: #1c1c1c;
    text-decoration: none;
    cursor: pointer;
}
button:hover:not(:disabled), .reader-actions a:hover, .message-actions a:hover { border-color: var(--reader-gold); }
button:disabled { opacity: .4; cursor: default; }
:focus-visible { outline: 2px solid var(--reader-gold); outline-offset: 4px; }
.reader-header {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 22px;
    padding: 18px 28px;
    border-bottom: 1px solid #39352a;
    background: #080808;
}
.reader-brand { min-width: 136px; text-align: center; text-decoration: none; }
.reader-brand span { display: block; font: 38px/1 Georgia, serif; letter-spacing: -2px; }
.reader-brand small { display: block; margin-top: 6px; font-size: 10px; letter-spacing: 3px; }
.reader-heading { flex: 1; min-width: 180px; }
.reader-kicker { color: var(--reader-gold); font-size: 11px; letter-spacing: 2px; text-transform: uppercase; }
.reader-heading h1 { margin: 6px 0; font: 25px/1.2 Georgia, serif; overflow-wrap: anywhere; }
.reader-heading p { margin: 0; color: #bdb9af; font-size: 12px; }
.reader-actions { display: flex; flex-wrap: wrap; gap: 8px; font-size: 12px; }
.reader-message { max-width: 650px; margin: 12vh auto; padding: 24px; text-align: center; }
.reader-message h2 { margin: 16px 0; font: 32px/1.2 Georgia, serif; }
.reader-message p { color: #bdb9af; line-height: 1.7; }
.message-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 24px; font-size: 13px; }
.reader-stage { display: flex; justify-content: center; align-items: center; gap: 24px; padding: 24px; }
.reader-arrow { flex: 0 0 46px; font-size: 36px; padding: 4px 10px; }
.page-container {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: min(66vw, 650px);
    aspect-ratio: 1191 / 1637;
    max-height: 72vh;
    background: #1b1b1b;
}
.page-image { width: 100%; height: 100%; object-fit: contain; box-shadow: 0 18px 60px #0009; }
.page-container[aria-busy="true"] .page-image { opacity: .25; }
.page-status { position: absolute; inset: 42% 10% auto; text-align: center; padding: 12px; background: #101010ed; line-height: 1.5; }
.retry-page { position: absolute; top: 65%; }
.reader-footer { max-width: 1050px; margin: 0 auto; padding: 0 24px 24px; }
.reader-hint { text-align: center; color: #bdb9af; font-size: 12px; }
.reader-progress { display: flex; align-items: center; gap: 22px; max-width: 650px; margin: 18px auto 0; font-size: 13px; }
.reader-progress label { white-space: nowrap; }
.reader-progress input { flex: 1; min-width: 0; accent-color: var(--reader-gold); }
.reader-thumbnails { display: flex; gap: 12px; overflow-x: auto; padding: 12px 4px; }
.reader-thumbnail { flex: 0 0 76px; padding: 4px; }
.reader-thumbnail img { display: block; width: 66px; height: 92px; object-fit: contain; background: #252525; }
.reader-thumbnail span { display: block; margin: 5px 0 1px; font-size: 11px; }
.reader-thumbnail[aria-current="page"] { border: 2px solid var(--reader-gold); }
.zoom-dialog { width: 96vw; max-width: 1400px; height: 94vh; max-height: 94vh; padding: 0; border: 1px solid #515151; background: #101010; color: inherit; }
.zoom-dialog::backdrop { background: #000d; }
.zoom-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 18px; border-bottom: 1px solid #515151; }
.zoom-toolbar p { margin: 0; }
.zoom-content { height: calc(100% - 67px); overflow: auto; text-align: center; }
.zoom-content img { display: block; width: auto; max-width: none; margin: 16px auto; }
.reader-notification { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 5; max-width: 90vw; margin: 0; padding: 14px 20px; background: #ceb542; color: #101010; border-radius: 4px; box-shadow: 0 4px 25px #0008; }
.reader-has-book .page-container { max-height: none; flex-shrink: 0; background: transparent; }
#page-book { position: relative; transform: translateX(var(--book-shift, 0%)); transition: transform .7s cubic-bezier(.2,.7,.2,1); box-shadow: 0 24px 70px #0009; touch-action: pan-y; }
.reader-book-page { position: relative; background: #fff; overflow: hidden; }
.reader-book-page img { display: block; width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
.reader-book-page.--left::after, .reader-book-page.--right::after { content: ""; position: absolute; top: 0; bottom: 0; width: 32px; pointer-events: none; }
.reader-book-page.--left::after { right: 0; background: linear-gradient(90deg, transparent, #0003); }
.reader-book-page.--right::after { left: 0; background: linear-gradient(270deg, transparent, #0003); }
.reader-book-error { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 20px; background: #1c1c1c; color: #f4f1e9; text-align: center; }
@media (prefers-reduced-motion: reduce) {
    #page-book { transition: none; }
}
@media (max-width: 700px) {
    .reader-header { gap: 14px; padding: 16px; }
    .reader-brand { min-width: 100px; }
    .reader-brand span { font-size: 30px; }
    .reader-heading { min-width: 140px; }
    .reader-heading h1 { font-size: 22px; }
    .reader-actions { width: 100%; }
    .reader-actions button, .reader-actions a { flex: 1 0 auto; padding: 10px; }
    .reader-stage { gap: 8px; padding: 18px 8px; }
    .reader-arrow { flex-basis: 32px; padding: 4px; }
    .page-container { width: calc(100vw - 96px); max-height: none; }
    .reader-footer { padding: 0 16px 22px; }
    .reader-progress { gap: 12px; }
    .reader-message h2 { font-size: 27px; }
}
