:root {
    color-scheme: dark;
    --bg: #fff956;
    --panel: #ffa63940;
    --panel-strong: #ffbb2840;
    --text: #f8f7ff;
    --muted: #ffd0c5;
    --accent: #ff7a59;
    --accent-strong: #ff4f6d;
    --border: #fff876;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    color: var(--text);
    background-color: #0f1220;
    background-image:
        linear-gradient(135deg, rgba(4, 7, 16, 0.75) 0%, rgba(4, 7, 16, 0.45) 100%),
        url("5350369923638692618.jpg?auto=format&fit=crop&w=1800&q=80");
    background-position: center;
    background-size: cover;
    background-repeat: no-repeat;
    background-attachment: fixed;
    transition: background 0.6s ease, color 0.3s ease;
}

body.reader-page {
    overflow: hidden;
}

img {
    display: block;
    width: 100%;
}

a {
    color: inherit;
    text-decoration: none;
}

.page-shell {
    max-width: 1100px;
    margin: 0 auto;
    padding: 32px 20px 64px;
    animation: pageFadeIn 0.42s ease;
}

.hero,
.info-card,
.feature-card,
.page-card,
.profile-card,
.chapter-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 24px;
    backdrop-filter: blur(16px);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.3);
}

.hero {
    padding: 48px;
    text-align: center;
}

.hero--simple {
    max-width: 560px;
    margin: 0 auto;
    padding: 72px 24px;
}

.hero h1,
.info-card h1,
.section-title {
    margin: 0 0 16px;
    font-size: clamp(2rem, 4vw, 2.8rem);
}

.hero p,
.info-card p,
.chapter-card p,
.page-card p,
.profile-card p {
    color: var(--muted);
    line-height: 1.7;
    font-size: 1rem;
}

.eyebrow {
    display: inline-block;
    margin-bottom: 12px;
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(255, 122, 89, 0.16);
    color: #ffd3c7;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    font-size: 0.8rem;
}

.hero__actions,
.button-row,
.social-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
    margin-top: 24px;
}

.hero__actions--stack {
    flex-direction: column;
    align-items: center;
    gap: 14px;
    margin-top: 28px;
}

.button,
.button--small,
.social-button,
.nav-link,
.nav-list__item,
.page-chip,
.page-nav,
.popup-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 18px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--panel-strong);
    color: var(--text);
    transition: transform 160ms ease, background 160ms ease;
    cursor: pointer;
}

.button:hover,
.button--small:hover,
.social-button:hover,
.nav-link:hover,
.nav-list__item:hover,
.page-chip:hover,
.page-nav:hover,
.popup-close:hover {
    transform: translateY(-2px);
    background: rgba(255, 122, 89, 0.24);
}

.button--primary {
    background: linear-gradient(90deg, var(--accent), var(--accent-strong));
    border-color: transparent;
}

.button--secondary {
    background: rgba(255, 255, 255, 0.12);
}

.button--small {
    padding: 10px 14px;
    font-size: 0.95rem;
}

.button--wide {
    width: min(320px, 100%);
    padding: 14px 20px;
    border-radius: 12px;
    justify-content: center;
}

.card-grid,
.page-grid,
.profile-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
    margin-top: 24px;
}

.feature-card,
.chapter-card,
.page-card,
.profile-card {
    padding: 24px;
}

.profile-stack {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 24px;
}

.profile-card--row {
    display: flex;
    align-items: center;
    gap: 20px;
}

.profile-card__image {
    width: 180px;
    height: 180px;
    object-fit: cover;
    border-radius: 16px;
    flex-shrink: 0;
}

.profile-card__body h2 {
    margin-top: 0;
}

.feature-card h2,
.chapter-card h2,
.page-card h2,
.profile-card h2 {
    margin: 0 0 10px;
    font-size: 1.35rem;
}

.feature-card .button {
    margin-top: 16px;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    padding: 16px 0 8px;
    background: rgba(2, 3, 10, 0.7);
    backdrop-filter: blur(18px);
}

.topbar__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px;
}

.nav-panel {
    position: fixed;
    top: 84px;
    right: 20px;
    z-index: 60;
    width: min(280px, calc(100vw - 40px));
    max-height: calc(100vh - 110px);
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: rgba(7, 10, 21, 0.96);
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.35);
    overflow: hidden;
}

.nav-panel[hidden] {
    display: none;
}

.nav-panel__section + .nav-panel__section {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.nav-panel__section h3 {
    margin: 0 0 8px;
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #ffd3c7;
}

.nav-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nav-list--scroll {
    max-height: 280px;
    padding-right: 4px;
    overflow-y: auto;
}

.nav-list__item,
.page-chip {
    width: 100%;
    text-align: left;
    padding: 10px 12px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text);
    cursor: pointer;
}

.nav-list__item:hover,
.page-chip:hover {
    background: rgba(255, 122, 89, 0.2);
}

.page-chip.is-active {
    background: linear-gradient(90deg, var(--accent), var(--accent-strong));
    border-color: transparent;
}

.info-card {
    padding: 32px;
    margin-top: 24px;
}

.chapter-hero {
    display: none;
}

.chapter-stack {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    max-width: 360px;
    margin: 20px auto 0;
}

.chapter-stack .button + .button {
    margin-top: 2px;
}

.page-shell--reader {
    max-width: none;
    width: 100%;
    min-height: 100vh;
    padding: 0;
}

.reader-shell {
    position: relative;
    width: 100%;
    height: calc(100vh - 72px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 88px 88px;
}

.reader-frame {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: 12px;
    border-radius: 24px;
    background: transparent;
    border: 0;
}

.reader-image {
    width: auto;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 16px;
    background: #05070d;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
    opacity: 0;
    transform: translateX(0) scale(1);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.reader-caption {
    position: fixed;
    left: 50%;
    bottom: 18px;
    transform: translateX(-50%);
    z-index: 70;
    padding: 10px 16px;
    border-radius: 999px;
    background: rgba(7, 10, 21, 0.88);
    border: 1px solid var(--border);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.28);
}

.reader-caption span {
    display: inline-block;
    font-weight: 600;
    color: #ffd3c7;
}

.reader-caption p {
    display: none;
}

.page-nav {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    width: 52px;
    height: 52px;
    border: 0;
    border-radius: 50%;
    background: rgba(7, 10, 21, 0.84);
    color: var(--text);
    font-size: 1.3rem;
    cursor: pointer;
    z-index: 70;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.28);
}

.page-nav--left {
    left: 16px;
}

.page-nav--right {
    right: 16px;
}

.reader-zoom-btn {
    position: fixed;
    right: 20px;
    bottom: 80px;
    z-index: 80;
    width: 46px;
    height: 46px;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: rgba(7, 10, 21, 0.9);
    color: var(--text);
    font-size: 1.1rem;
    cursor: pointer;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.28);
}

.reader-zoom-btn.is-active {
    background: linear-gradient(90deg, var(--accent), var(--accent-strong));
    border-color: transparent;
}

.popup-overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(2, 3, 10, 0.88);
    animation: popupFadeIn 0.25s ease;
}

.popup-overlay[hidden] {
    display: none;
}

.popup-card {
    position: relative;
    max-width: 640px;
    width: 100%;
    padding: 20px;
    border-radius: 24px;
    background: var(--panel);
    border: 1px solid var(--border);
    animation: popupCardIn 0.28s ease;
}

.popup-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 38px;
    height: 38px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.14);
    color: var(--text);
    font-size: 1.2rem;
    cursor: pointer;
}

.popup-card img {
    border-radius: 16px;
}

@keyframes readerFadeIn {
    from {
        opacity: 0;
        transform: translateX(18px) scale(0.985);
    }
    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

@keyframes panelFadeIn {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pageFadeIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes popupFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes popupCardIn {
    from {
        opacity: 0;
        transform: scale(0.97) translateY(8px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.nav-panel.is-visible {
    animation: panelFadeIn 0.24s ease;
}

@media (max-width: 860px) {
    .card-grid,
    .page-grid,
    .profile-grid {
        grid-template-columns: 1fr;
    }

    .hero,
    .info-card,
    .feature-card,
    .page-card,
    .profile-card {
        padding: 20px;
    }

    .reader-shell {
        padding: 20px 20px 84px;
    }

    .page-nav {
        width: 44px;
        height: 44px;
    }

    .profile-card--row {
        flex-direction: column;
        align-items: flex-start;
    }

    .profile-card__image {
        width: 100%;
        height: auto;
        max-height: 260px;
    }
}
