:root {
    --header-h: 62px;
    --footer-h: 46px;
    --nav-h: 60px;
    --bg: #111114;
    --surface: #18181c;
    --surface2: #1e1e24;
    --border: #2a2a33;
    --accent: #2E75B6;
    --accent-dim: #1a4a78;
    --text: #e2e2e8;
    --text-muted: #888896;
    --text-faint: #44444f;
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-user-select: none;
    -moz-user-select: none;
    user-select: none;
    -webkit-user-drag: none;
}

html {
    height: 100%;
    overflow: hidden;
}

body {
    height: 100%;
    overflow: hidden;
    background: var(--bg);
    font-family: 'Noto Sans', system-ui, sans-serif;
    color: var(--text);
    display: flex;
    flex-direction: column;
}

@media print {
    body {
        display: none !important;
    }
}

.site-header {
    flex-shrink: 0;
    height: var(--header-h);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    z-index: 100;
}

.header-inner {
    height: 100%;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    flex-shrink: 0;
}

.brand-icon img {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    display: block;
}

.brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}

.brand-name {
    font-family: 'Cinzel', Georgia, serif;
    font-size: 1rem;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: 0.03em;
    white-space: nowrap;
}

.brand-sub {
    font-size: 0.62rem;
    color: var(--text-muted);
    letter-spacing: 0.09em;
    text-transform: uppercase;
    white-space: nowrap;
}

.header-contact {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    flex-shrink: 0;
}

.contact-row {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.78rem;
    white-space: nowrap;
    transition: color 0.15s;
}

    .contact-row svg {
        width: 14px;
        height: 14px;
        flex-shrink: 0;
        opacity: 0.7;
    }

    .contact-row:hover {
        color: var(--accent);
    }

.site-main {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.reader-shell {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.page-wrap {
    flex: 1;
    min-height: 0;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: var(--surface);
    padding: 10px;
    touch-action: none;
}

    .page-wrap img {
        display: block;
        max-width: 100%;
        max-height: 100%;
        width: auto;
        height: auto;
        object-fit: contain;
        pointer-events: none;          
        -webkit-user-drag: none;
        box-shadow: 0 4px 36px rgba(0,0,0,0.65);
        border-radius: 1px;
        will-change: transform;
    }

    .page-wrap.zoomed {
        cursor: grab;
    }

        .page-wrap.zoomed:active {
            cursor: grabbing;
        }

.page-shimmer {
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, var(--surface) 25%, var(--surface2) 50%, var(--surface) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.4s infinite linear;
    display: none;
    z-index: 2;
}

    .page-shimmer.active {
        display: block;
    }

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

.nav-bar {
    flex-shrink: 0;
    height: var(--nav-h);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 0 16px;
    background: var(--surface);
    border-top: 1px solid var(--border);
}

.nav-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1.5px solid var(--border);
    background: var(--surface2);
    color: var(--text-muted);
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s, color 0.15s, border-color 0.15s, transform 0.1s;
    touch-action: manipulation;
}

    .nav-btn svg {
        width: 18px;
        height: 18px;
    }

    .nav-btn:hover:not(.disabled) {
        background: var(--accent);
        border-color: var(--accent);
        color: #fff;
        transform: scale(1.07);
    }

    .nav-btn:active:not(.disabled) {
        transform: scale(0.94);
    }

    .nav-btn.disabled, .nav-btn:disabled {
        opacity: 0.2;
        cursor: default;
        pointer-events: none;
    }

    .nav-btn.fit-btn.active {
        background: var(--accent-dim);
        border-color: var(--accent);
        color: var(--accent);
    }

.page-counter {
    display: flex;
    align-items: baseline;
    gap: 3px;
    font-family: 'Courier New', monospace;
    min-width: 68px;
    justify-content: center;
}

.current-page {
    font-size: 1.15rem;
    font-weight: 700;
    color: #fff;
    min-width: 2.2ch;
    text-align: right;
}

.separator {
    color: var(--text-faint);
}

.total-pages {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.jump-wrap {
    display: flex;
    align-items: center;
    gap: 4px;
}

.jump-input {
    width: 58px;
    height: 34px;
    background: var(--surface2);
    border: 1.5px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-family: 'Courier New', monospace;
    font-size: 0.88rem;
    text-align: center;
    padding: 0 4px;
    outline: none;
    transition: border-color 0.15s;
    -webkit-user-select: text;
    user-select: text;
    -moz-appearance: textfield;
}

    .jump-input::-webkit-inner-spin-button,
    .jump-input::-webkit-outer-spin-button {
        display: none;
    }

    .jump-input:focus {
        border-color: var(--accent);
    }

.jump-btn {
    height: 34px;
    padding: 0 10px;
    background: var(--surface2);
    border: 1.5px solid var(--border);
    border-radius: 6px;
    color: var(--text-muted);
    font-size: 0.78rem;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    touch-action: manipulation;
}

    .jump-btn:hover {
        background: var(--accent);
        border-color: var(--accent);
        color: #fff;
    }

.site-footer {
    flex-shrink: 0;
    height: var(--footer-h);
    background: var(--surface);
    border-top: 1px solid var(--border);
}

.footer-inner {
    height: 100%;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.footer-copy {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.7rem;
    color: var(--text-muted);
    flex-wrap: wrap;
}

.footer-divider {
    color: var(--text-faint);
}

.footer-note {
    color: var(--text-faint);
}

.footer-social {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.social-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.15s, background 0.15s;
}

    .social-link svg {
        width: 15px;
        height: 15px;
    }

    .social-link:hover {
        color: #fff;
        background: var(--accent-dim);
    }

@media (max-width: 600px) {
    :root {
        --header-h: 52px;
        --footer-h: 40px;
        --nav-h: 52px;
    }

    .header-inner {
        padding: 0 12px;
        gap: 8px;
    }

    .brand-sub {
        display: none;
    }

    .brand-name {
        font-size: 0.9rem;
    }

    .brand-icon img {
        width: 28px;
        height: 28px;
    }

    .contact-row span {
        display: none;
    }

    .contact-row svg {
        width: 18px;
        height: 18px;
        opacity: 1;
    }

    .header-contact {
        flex-direction: row;
        gap: 10px;
    }

    .page-wrap {
        padding: 4px;
    }

        .page-wrap img {
            width: 100%;
            height: auto;
            max-height: 100%;
        }

    .nav-bar {
        gap: 8px;
        padding: 0 8px;
    }

    .nav-btn {
        width: 40px;
        height: 40px;
    }

    .jump-wrap {
        display: none;
    }

    .footer-inner {
        padding: 0 12px;
    }

    .footer-note {
        display: none;
    }

    .footer-divider {
        display: none;
    }

    .footer-copy {
        font-size: 0.62rem;
    }

    .social-link {
        width: 24px;
        height: 24px;
    }

        .social-link svg {
            width: 13px;
            height: 13px;
        }

    .footer-social {
        gap: 6px;
    }
}

@media (max-height: 480px) and (orientation: landscape) {
    :root {
        --header-h: 42px;
        --nav-h: 40px;
        --footer-h: 0px;
    }

    .site-footer {
        display: none;
    }

    .brand-sub, .contact-row span {
        display: none;
    }

    .brand-icon img {
        width: 22px;
        height: 22px;
    }

    .page-wrap {
        padding: 3px;
    }

    .nav-btn {
        width: 36px;
        height: 36px;
    }
}
