:root {
    --bg: #ffffff;
    --surface: #f7f9fb;
    --text: #121212;
    --text-muted: #666;
    --border: #e8edf2;
    --accent: #00bcd4;
    --accent-soft: #e7fbff;
    --radius: 14px;
    --shadow: 0 4px 20px rgba(0, 0, 0, .04);
    --container: 1280px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: "Inter", sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

html[data-reader-theme="dark"] {
    color-scheme: dark;
    --bg: #121417;
    --surface: #1a1e23;
    --text: #e8e3da;
    --text-muted: #aaa69f;
    --border: #30363d;
    --accent: #67d9e9;
    --accent-soft: #17343a;
    --shadow: 0 4px 20px rgba(0, 0, 0, .24);
}

html[data-reader-theme="dark"] .header,
html[data-reader-theme="dark"] .book-card,
html[data-reader-theme="dark"] .tags a,
html[data-reader-theme="dark"] footer {
    background: var(--surface);
}

html[data-reader-theme="dark"] .search {
    color: var(--text);
    background: #101214;
}

html[data-reader-theme="dark"] .genres span {
    color: #9be5ed;
}

a {
    text-decoration: none;
    color: inherit;
}

.container {
    width: min(100% - 32px, var(--container));
    margin: 0 auto;
}

.header {
    border-bottom: 1px solid var(--border);
    background: white;
    position: sticky;
    top: 0;
    z-index: 10;
}

    .header .container {
        height: 72px;
        display: flex;
        align-items: center;
    }

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: auto;
}

.logo {
    font-weight: 700;
    font-size: 1.3rem;
}

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

nav {
    display: flex;
    gap: 24px;
}

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

        nav a:hover {
            color: var(--accent);
        }

.search {
    width: 260px;
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 12px 18px;
    outline: none;
}

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

.hero {
    padding: 80px 0;
    text-align: center;
}

    .hero h1 {
        font-size: 3rem;
        line-height: 1.1;
        margin-bottom: 16px;
    }

    .hero p {
        color: var(--text-muted);
        max-width: 700px;
        margin: 0 auto;
    }

.section {
    padding-bottom: 64px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 24px;
}

    .section-header a {
        color: var(--accent);
    }

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

.book-card {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: .2s;
    box-shadow: var(--shadow);
}

    .book-card:hover {
        transform: translateY(-3px);
        border-color: var(--accent);
    }

.cover {
    height: 220px;
    background: linear-gradient(135deg, #d8f8ff, #f4fdff);
}

.book-content {
    padding: 18px;
}

    .book-content h3 {
        margin-bottom: 8px;
        font-size: 1.05rem;
    }

.meta {
    color: var(--text-muted);
    font-size: .9rem;
    margin-bottom: 12px;
}

.genres {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

    .genres span {
        background: var(--accent-soft);
        color: #0f6c78;
        padding: 4px 10px;
        border-radius: 999px;
        font-size: .8rem;
    }

.chapter {
    font-size: .9rem;
    color: var(--accent);
    font-weight: 600;
}

.site-theme-toggle {
    padding: 8px 12px;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
    cursor: pointer;
    font: inherit;
    font-size: .9rem;
}

.site-theme-toggle:hover,
.site-theme-toggle:focus-visible {
    border-color: var(--accent);
    outline: none;
}

.cookie-notice {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 20px;
    width: min(560px, calc(100% - 32px));
    padding: 18px;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.cookie-notice p {
    margin: 4px 0 0;
    color: var(--text-muted);
    font-size: .9rem;
}

.cookie-notice a {
    color: var(--accent);
    text-decoration: underline;
}

.cookie-notice__accept {
    flex: none;
    padding: 9px 14px;
    color: #062c31;
    background: var(--accent);
    border: 0;
    border-radius: 8px;
    cursor: pointer;
    font: inherit;
    font-weight: 600;
}

.age-restriction {
    min-height: calc(100vh - 160px);
    display: grid;
    place-items: center;
    padding-top: 48px;
    padding-bottom: 48px;
}

.age-restriction__card {
    width: min(100%, 600px);
    padding: 32px;
    text-align: center;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.age-restriction__label {
    display: inline-block;
    margin-bottom: 12px;
    padding: 4px 10px;
    color: #fff;
    background: #a52a2a;
    border-radius: 999px;
    font-weight: 700;
}

.age-restriction__card h1 {
    margin-bottom: 12px;
}

.age-restriction__card p {
    color: var(--text-muted);
}

.age-restriction__actions {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 24px;
}

.age-restriction__confirm,
.age-restriction__decline {
    padding: 10px 16px;
    border-radius: 8px;
    font: inherit;
    font-weight: 600;
}

.age-restriction__confirm {
    color: #062c31;
    background: var(--accent);
    border: 0;
    cursor: pointer;
}

.age-restriction__decline {
    border: 1px solid var(--border);
}

.reader-header {
    padding-top: 32px;
}

.legal-page {
    max-width: 900px;
    padding-top: 48px;
    padding-bottom: 64px;
}

.legal-page h1,
.legal-page h2 {
    line-height: 1.25;
}

.legal-page h1 {
    margin-bottom: 24px;
}

.legal-page h2 {
    margin: 32px 0 12px;
    font-size: 1.25rem;
}

.legal-page p {
    margin-bottom: 12px;
}

.legal-page a {
    color: var(--accent);
    text-decoration: underline;
}

.reader-content {
    max-width: 800px;
    padding-top: 28px;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(1.1rem, 1rem + .35vw, 1.25rem);
    line-height: 1.85;
}

.reader-content p {
    margin-bottom: 1.25em;
}

html[data-reader-theme="dark"] .reader-content {
    color: #e4dfd5;
}

.compact .cover {
    height: 160px;
}

.rating {
    margin-top: 12px;
    font-weight: 600;
}

.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

    .tags a {
        border: 1px solid var(--border);
        padding: 10px 16px;
        border-radius: 999px;
        background: white;
        transition: .2s;
    }

        .tags a:hover {
            border-color: var(--accent);
            color: var(--accent);
        }

@media (max-width: 768px) {

    .header .container {
        flex-wrap: wrap;
        height: auto;
        padding: 16px 0;
        gap: 16px;
    }

    .header-actions {
        width: 100%;
    }

    .cookie-notice {
        right: 16px;
        bottom: 16px;
        align-items: flex-start;
        flex-direction: column;
        gap: 12px;
    }

    nav {
        order: 3;
        width: 100%;
        justify-content: center;
    }

    .search {
        width: auto;
        flex: 1;
        max-height: 48px;
        transition: max-height .2s ease, padding .2s ease, border-width .2s ease, opacity .15s ease;
    }

    .header--search-hidden .container {
        gap: 0;
    }

    .header--search-hidden .search {
        max-height: 0;
        padding-top: 0;
        padding-bottom: 0;
        border-width: 0;
        opacity: 0;
        pointer-events: none;
    }

    .hero h1 {
        font-size: 2rem;
    }
}
