@font-face {
    font-family: 'FuturaPT-Medium';
    src: url('fonts/FuturaPT-Medium.woff') format('woff');
    font-style: normal;
    font-weight: normal;
    font-display: swap;
}

@font-face {
    font-family: "Twemoji Country Flags";
    src: url("https://cdn.jsdelivr.net/npm/country-flag-emoji-polyfill@0.1.3/dist/TwemojiCountryFlags.woff2") format("woff2");
    font-display: swap;
}

.force-hidden,
.header-actions .force-hidden,
.header-actions .menu-toggle.force-hidden,
.header-actions .auth-container.force-hidden {
    display: none !important;
}

/* --- Preloader --- */
#preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #f9f7f2;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    transition: opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.8s;
}

.loader-content {
    text-align: center;
    width: 200px;
}

.loader-logo {
    margin-bottom: 25px;
    animation: loaderPulse 2s infinite ease-in-out;
}

@keyframes loaderPulse {

    0%,
    100% {
        transform: scale(1);
        opacity: 0.8;
    }

    50% {
        transform: scale(1.1);
        opacity: 1;
    }
}

.loader-line {
    width: 100%;
    height: 3px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 15px;
}

.loader-progress {
    width: 40%;
    height: 100%;
    background: #bb9d4b;
    /* Use golden accent */
    border-radius: 10px;
    animation: loaderProgress 1.5s infinite ease-in-out;
}

@keyframes loaderProgress {
    0% {
        transform: translateX(-100%);
    }

    100% {
        transform: translateX(250%);
    }
}

.loader-text {
    color: #8b8b8b;
    font-size: 0.75rem;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    font-weight: 500;
}

body.loading {
    overflow: hidden;
}

#preloader.fade-out {
    opacity: 0;
    visibility: hidden;
}

:root {
    --primary: #cbb58b;
    /* Gold */
    --primary-dark: #a68d5b;
    --accent: #bb9d4b;
    --accent-dark: #9a7d36;
    /* Golden Accent (previously Deep Red/Burgundy #8b0000) */
    --bg-light: #f9f7f2;
    --text-main: #2c3e50;
    --text-muted: #7f8c8d;
    --white: #ffffff;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
    --glass: rgba(255, 255, 255, 0.8);
    --radius: 12px;

    /* Default Reader Colors */
    --reader-bg: #f9f7f2;
    --reader-text: #2c3e50;
    --reader-muted: #7f8c8d;
    --reader-header-bg: #ffffff;
    --reader-main-bg: #dcd3bd;

    /* Default Fonts */
    --font-reader: 'Playfair Display', serif;
    --reader-font-size: 1.15rem;
}

.font-playfair {
    --font-reader: 'Playfair Display', serif;
}

.font-literata {
    --font-reader: 'Literata', serif;
}

.font-garamond {
    --font-reader: 'EB Garamond', serif;
}

.font-lora {
    --font-reader: 'Lora', serif;
}

.font-montserrat {
    --font-reader: 'Montserrat', sans-serif;
}

.font-inter {
    --font-reader: 'Inter', sans-serif;
}

.font-ruslan {
    --font-reader: 'Ruslan Display', cursive;
}

.theme-light {
    --reader-bg: #ffffff;
    --reader-text: #2c3e50;
    --reader-muted: #7f8c8d;
    --reader-header-bg: #ffffff;
    --reader-main-bg: #f0f0f0;
}

.theme-sepia {
    --reader-bg: #f4ecd8;
    --reader-text: #5b4636;
    --reader-muted: #8c7e6a;
    --reader-header-bg: #efead4;
    --reader-main-bg: #dcd3bd;
}

.theme-paper {
    --reader-bg: #e8e6e3;
    --reader-text: #333333;
    --reader-muted: #666666;
    --reader-header-bg: #dfddd9;
    --reader-main-bg: #c9c7c4;
}

.theme-ocean {
    --reader-bg: #e0f2f1;
    --reader-text: #004d40;
    --reader-muted: #4db6ac;
    --reader-header-bg: #d1e8e7;
    --reader-main-bg: #b2dfdb;
}

.theme-night {
    --reader-bg: #1a1a2e;
    --reader-text: #e2e2e2;
    --reader-muted: #9494a3;
    --reader-header-bg: #16213e;
    --reader-main-bg: #0f0f1a;
}

.theme-dark {
    --reader-bg: #121212;
    --reader-text: #e0e0e0;
    --reader-muted: #888888;
    --reader-header-bg: #1e1e1e;
    --reader-main-bg: #000000;
}

.theme-old {
    --reader-bg: #d4b483;
    --reader-text: #2b1d0e;
    --reader-muted: #8b5a2b;
    --reader-header-bg: #c1a173;
    --reader-main-bg: #8b5a2b;
    --font-reader: 'Ruslan Display', cursive;
}

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

h1 {
    font-family: 'FuturaPT-Medium', sans-serif;
    font-weight: 500;
    text-transform: uppercase;
}

h2,
h3,
.serif {
    font-family: 'Playfair Display', serif;
}

h5 {
    font-size: 0.7em;
}

html,
body {
    height: 100%;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-light);
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-light);
}

::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 10px;
}

/* Header */
header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 80px;
    background: rgba(62, 62, 62, 0.9) !important;
    backdrop-filter: blur(10px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 5%;
    border-bottom: none !important;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none !important;
    color: inherit;
    font-family: "FuturaPT-Medium", Arial, sans-serif;
}

.logo-container:hover {
    text-decoration: none !important;
}

.logo-icon {
    font-size: 2rem;
}

.logo-text {
    display: flex;
    flex-direction: column;
}

.logo-main {
    font-size: 1.2rem;
    font-weight: 800;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: #bb9d4b !important;
}

.logo-sub {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: rgba(255, 255, 255, 0.7) !important;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

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

/* Ensure all interactive header icons have identical dimensions */
.header-actions a.header-bible-link,
.header-actions a.header-music-link,
.header-actions .lang-btn,
.header-actions .auth-btn,
.header-actions .menu-toggle {
    width: 36px !important;
    height: 36px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 !important;
    margin: 0 !important;
    box-sizing: border-box !important;
    background: transparent !important;
    border: none !important;
    border-radius: 50% !important;
    transition: transform 0.2s ease, background-color 0.2s ease !important;
    cursor: pointer !important;
    outline: none !important;
}

.header-actions a.header-bible-link:hover,
.header-actions a.header-music-link:hover,
.header-actions .lang-btn:hover,
.header-actions .auth-btn:hover,
.header-actions .menu-toggle:hover {
    transform: scale(1.08) !important;
    background-color: rgba(0, 0, 0, 0.04) !important;
}

.header-actions .auth-btn img {
    width: 24px !important;
    height: 24px !important;
    border: 1px solid var(--accent, #8b0000) !important;
    border-radius: 50% !important;
}

.header-actions .menu-toggle {
    flex-direction: column !important;
    gap: 4px !important;
}

.header-actions .menu-toggle span {
    width: 18px !important;
    height: 2px !important;
    margin: 0 !important;
}

/* Telegram Mini App styles */
body.tg-app header {
    height: 60px;
    box-shadow: none !important;
    background: transparent !important;
    backdrop-filter: none !important;
}

body.tg-app .header-actions {
    width: 100%;
}

body.tg-app .lang-selector {
    margin-right: auto;
}

body.tg-app .logo-container {
    display: none;
}

body.tg-app main {
    padding-top: 60px;
}

body.tg-app .home-container,
body.tg-app .category-container,
body.tg-app .library-container {
    padding-top: 70px;
}

.menu-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px;
    z-index: 5001;
    /* Above mobile nav */
}

.menu-toggle span {
    display: block;
    width: 25px;
    height: 2px;
    background: var(--text-main);
    transition: 0.3s;
}

.menu-toggle.active span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.menu-toggle.active span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 80px;
    z-index: 1001;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    /* Desktop: transparent, no click interception */
}

nav ul {
    display: flex;
    gap: 30px;
    list-style: none;
    pointer-events: auto;
}

.mobile-only-header {
    display: none !important;
    /* Hidden on desktop */
}

@media (max-width: 1024px) {
    .menu-toggle {
        display: flex;
    }

    nav {
        top: 0;
        left: -100%;
        right: auto;
        width: 65vw;
        max-width: 65vw;
        height: 100%;
        background: rgba(255, 255, 255, 0.98);
        backdrop-filter: blur(15px);
        z-index: 5000;
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        justify-content: flex-start;
        padding-top: 0;
        transform: none;
        transition: left 0.4s cubic-bezier(0.16, 1, 0.3, 1);
        box-shadow: 10px 0 30px rgba(0, 0, 0, 0.1);
        pointer-events: auto;
    }

    nav.active {
        left: 0;
    }

    .mobile-only-header {
        display: flex !important;
        /* Visible on mobile */
        width: 100%;
    }

    .mobile-nav-links {
        list-style: none;
        padding: 0;
        margin: 0;
        display: flex;
        flex-direction: column;
    }

    .mobile-nav-links li {
        width: 100%;
        border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    }

    .mobile-nav-links a {
        display: block;
        padding: 20px 25px;
        font-size: 1.1rem;
        font-family: 'FuturaPT-Medium', Arial, sans-serif;
        font-weight: 500;
        color: var(--text-main);
        text-decoration: none;
        text-transform: uppercase;
        transition: 0.2s;
    }

    /* Mobile nav: outside header to avoid backdrop-filter stacking context */
    #mobile-nav-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: transparent;
        z-index: 4999;
    }

    .mobile-nav-links a:active {
        background: rgba(0, 0, 0, 0.03);
    }

    nav ul {
        flex-direction: column;
        align-items: flex-start;
        gap: 0;
        width: 100%;
        padding: 0 20px;
    }

    nav ul li {
        width: 100%;
        border-bottom: 1px solid #f0f0f0;
    }

    nav a {
        font-size: 1.2rem;
        font-weight: 600;
        padding: 18px 10px;
        display: block;
        width: 100%;
    }

    /* Removed .nav-close-btn styles as we use .settings-close now */
}

nav a {
    text-decoration: none;
    color: #fff;
    font-family: 'FuturaPT-Medium', Arial, sans-serif;
    font-weight: 500;
    font-size: 14px;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    transition: 0.3s;
    position: relative;
}

nav a:hover {
    color: #bb9d4b;
}

.auth-btn {
    background: var(--accent);
    color: var(--white);
    padding: 10px 24px;
    border-radius: 30px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: 0.3s;
    box-shadow: 0 4px 15px rgba(139, 0, 0, 0.2);
}

.auth-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(139, 0, 0, 0.3);
}

/* Language Selector */
.lang-selector {
    position: relative;
    display: inline-block;
    margin-right: 15px;
}

.lang-btn {
    background: transparent !important;
    border: none !important;
    padding: 4px !important;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
}

.lang-btn:hover {
    transform: scale(1.08);
}

.lang-icon,
.ortholib-lang-flag {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 22px !important;
    height: 16px !important;
    overflow: hidden !important;
    line-height: 1 !important;
    flex-shrink: 0 !important;
}

.lang-icon img,
.ortholib-lang-flag img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    display: block !important;
    border-radius: 2px !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15) !important;
}

.lang-current {
    display: none !important;
}

.lang-arrow {
    display: none !important;
}

.lang-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    background: var(--white);
    min-width: 180px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: 0.3s;
    z-index: 1100;
    max-height: 280px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--primary) transparent;
    padding: 8px 0;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.lang-dropdown::-webkit-scrollbar {
    width: 6px;
}

.lang-dropdown::-webkit-scrollbar-track {
    background: transparent;
}

.lang-dropdown::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 3px;
}

.lang-selector:hover .lang-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.lang-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 20px;
    color: var(--text-main);
    text-decoration: none;
    font-size: 0.9rem;
    transition: 0.2s;
}

.lang-option:hover {
    background: var(--bg-light);
    color: var(--accent);
}

.lang-option.active {
    font-weight: 700;
    color: var(--accent);
    background: rgba(139, 0, 0, 0.05);
}

.lang-option.active::after {
    content: '✓';
    font-size: 0.85rem;
    color: var(--accent);
    flex-shrink: 0;
}

.install-btn {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary-dark);
    padding: 8px 20px;
    border-radius: 30px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: 0.3s;
    display: inline-flex;
    align-items: center;
}

.install-btn:hover {
    background: var(--primary);
    color: var(--white);
    transform: translateY(-2px);
}

.footer-install-btn {
    border: 1px solid #ddd;
    color: var(--text-main);
    background: var(--white);
    padding: 10px 15px;
    border-radius: 12px;
    justify-content: center;
    width: 100%;
}

.footer-install-btn:hover {
    background: var(--bg-light);
    color: var(--primary);
    border-color: var(--primary);
}

/* App Download Badges */
.app-store-btn,
.play-store-btn {
    display: flex;
    align-items: center;
    background: #000;
    color: #fff;
    padding: 6px 14px;
    border-radius: 12px;
    text-decoration: none;
    transition: transform 0.2s, box-shadow 0.2s;
    width: 100%;
    box-sizing: border-box;
}

.app-store-btn:hover,
.play-store-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.app-btn-text {
    display: flex;
    flex-direction: column;
    margin-left: 10px;
    align-items: flex-start;
}

.app-btn-small {
    font-size: 0.65rem;
    line-height: 1;
    opacity: 0.8;
}

.app-btn-large {
    font-size: 1.1rem;
    font-weight: 600;
    line-height: 1.2;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* Hero Section */
.hero {
    width: 100%;
    height: 100vh;
    height: 100dvh;
    background: linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5)), url('img/library.jpeg');
    background-size: cover;
    background-position: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: var(--white);
    padding: 0 20px;
}

.hero h1 {
    font-size: 3.5rem;
    margin-bottom: 10px;
    max-width: 900px;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
    text-transform: uppercase;
}

.hero-stats {
    display: flex;
    gap: 30px;
    margin-bottom: 25px;
    font-size: 1.1rem;
    font-weight: 500;
    text-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
}

/* --- Modern Search Redesign --- */
.search-wrapper {
    width: 100%;
    max-width: 700px;
    margin: 0 auto;
    position: relative;
    z-index: 10;
}

.search-field {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 100px;
    display: flex;
    align-items: center;
    padding: 6px;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 15px 45px rgba(0, 0, 0, 0.2);
}

.search-wrapper:hover .search-field,
.search-wrapper:focus-within .search-field {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.4);
    box-shadow: 0 20px 55px rgba(0, 0, 0, 0.3);
    transform: translateY(-2px);
}

.search-prefix {
    padding: 0 15px 0 20px;
    color: rgba(255, 255, 255, 0.7);
    display: flex;
    align-items: center;
}

.search-field .search-input {
    flex: 1;
    background: transparent !important;
    border: none !important;
    color: #fff !important;
    font-size: 1.1rem;
    padding: 12px 0 !important;
    outline: none !important;
    box-shadow: none !important;
}

.search-field .search-input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.search-suffix {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-right: 4px;
}

.search-clear-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    opacity: 0;
    transition: 0.3s;
    transform: scale(0.8);
    pointer-events: none;
}

.search-wrapper:focus-within .search-clear-btn {
    opacity: 1;
    transform: scale(1);
    pointer-events: auto;
}

.search-go-btn {
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 10px 24px;
    border-radius: 100px;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    transition: 0.3s;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.search-go-btn:hover {
    background: var(--primary-dark);
    transform: scale(1.05);
}

/* Dropdown */
.modern-dropdown {
    position: absolute;
    top: calc(100% + 15px);
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(15px);
    border-radius: 24px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    display: none;
    max-height: 60vh;
    overflow-y: auto;
    border: 1px solid rgba(0, 0, 0, 0.05);
    animation: searchSlideDown 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 100;
}

@keyframes searchSlideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Search Backdrop */
.search-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 5999;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: 0.3s;
}

@media (max-width: 768px) {
    body.search-active .search-backdrop {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
    }
}

@media (max-width: 768px) {
    .search-wrapper.hero-search {
        max-width: 100%;
        margin-bottom: 25px;
    }

    .search-wrapper.active {
        position: fixed !important;
        top: 0 !important;
        /* Теперь в самом верху поверх всего */
        left: 0 !important;
        width: 100% !important;
        height: 70px !important;
        background: #fff;
        padding: 10px 15px;
        z-index: 6000;
        display: flex;
        align-items: center;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
        margin: 0 !important;
    }

    .search-wrapper.active .search-field {
        background: #f5f5f5;
        border: none;
        width: 100%;
        box-shadow: none;
        backdrop-filter: none;
    }

    .search-wrapper.active .search-input {
        color: var(--text-main) !important;
    }

    .search-wrapper.active .search-input::placeholder {
        color: #999;
    }

    .search-wrapper.active .search-prefix {
        color: #999;
    }

    .search-wrapper.active .search-go-btn {
        display: none !important;
    }

    .search-go-btn {
        display: none !important;
    }

    .search-field {
        padding-right: 10px;
    }

    .search-wrapper.active .search-clear-btn {
        opacity: 1;
        transform: scale(1.2);
        color: #999;
        font-size: 1.2rem;
        background: transparent;
        pointer-events: auto;
    }

    .search-wrapper.active .modern-dropdown {
        top: 70px !important;
        height: calc(100vh - 70px) !important;
        max-height: calc(100vh - 70px) !important;
        border-radius: 0;
        box-shadow: none;
    }

    .hero {
        padding-top: 50px !important;
        /* Еще выше в обычном состоянии */
    }

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

    .hero-stats {
        font-size: 0.9rem;
        gap: 15px;
        flex-direction: column;
        gap: 5px;
    }
}

.search-result-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px 20px;
    cursor: pointer;
    transition: 0.2s;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover {
    background: rgba(0, 0, 0, 0.02);
}

.search-result-cover {
    width: 40px;
    height: 55px;
    object-fit: cover;
    border-radius: 6px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.search-result-info {
    flex: 1;
}

.search-result-title {
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 2px;
    color: var(--text-main);
}

.search-result-author {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.search-result-snippet {
    font-size: 0.8rem;
    color: #666;
    font-style: italic;
    margin-top: 4px;
}

.search-result-type {
    font-size: 0.7rem;
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: 800;
    text-transform: uppercase;
}

.type-book {
    background: #e3f2fd;
    color: #1976d2;
}

.type-text {
    background: #fff3e0;
    color: #f57c00;
}

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

.search-trigger {
    transition: 0.3s;
}

.search-trigger:hover {
    color: var(--accent);
    background: rgba(0, 0, 0, 0.05);
}

.full-search #search-results-dropdown {
    width: 100%;
    max-width: 900px;
    background: white;
    border-radius: 12px;
    margin-top: 15px;
    max-height: 70vh;
    overflow-y: auto;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    border: 1px solid #eee;
}

/* Categories Section */
.categories {
    padding: 80px 5%;
    background: var(--bg-light);
}

.section-padding {
    padding: 50px 5%;
}

.section-title {
    font-family: "FuturaPT-Medium", Arial, sans-serif;
    font-weight: 500;
    font-size: 34px;
    line-height: 140%;
    color: #bb9d4b;
    border-bottom: solid 3px #bb9d4b;
    width: fit-content;
    margin: 18px auto 36px;
    text-align: center;
    position: relative;
}

.section-title::after {
    display: none !important;
}

.categories-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px 20px;
    max-width: 1000px;
    margin: 0 auto;
    line-height: 1.8;
}

.category-link {
    color: var(--text-main);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    padding: 2px 0;
    position: relative;
    transition: color 0.25s ease;
    white-space: nowrap;
}

.category-link::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 1.5px;
    background: var(--accent);
    transition: width 0.3s ease;
}

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

.category-link:hover::before {
    width: 100%;
}

@media (max-width: 600px) {
    .categories-grid {
        gap: 4px 14px;
    }

    .category-link {
        font-size: 0.85rem;
    }
}

/* Book Shelf */
/* Shelf Controls */
.shelf-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 30px;
    max-width: 1000px;
    margin-left: auto;
    margin-right: auto;
}

.shelf-tabs {
    display: flex;
    gap: 6px;
}

.shelf-tab {
    padding: 8px 20px;
    border: 1.5px solid #e0e0e0;
    background: transparent;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
    color: var(--text-muted);
}

.shelf-tab:hover {
    border-color: var(--primary);
    color: var(--text-main);
}

.shelf-tab.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.shelf-limit {
    display: flex;
    align-items: center;
    gap: 6px;
}

.shelf-limit-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-right: 4px;
}

.limit-btn {
    width: 36px;
    height: 30px;
    border: 1px solid #e0e0e0;
    background: transparent;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-muted);
}

.limit-btn:hover {
    border-color: var(--primary);
    color: var(--text-main);
}

.limit-btn.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

@media (max-width: 600px) {
    .shelf-controls {
        justify-content: center;
    }

    .shelf-tab {
        padding: 6px 14px;
        font-size: 0.8rem;
    }
}

/* News Section */
.news-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 25px;
    max-width: 1000px;
    margin: 0 auto;
}

.news-card {
    background: var(--white);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.06);
    border: 1px solid rgba(0, 0, 0, 0.04);
    transition: all 0.3s ease;
}

.news-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.news-card-img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    display: block;
}

.news-card-body {
    padding: 20px;
}

.news-card-date {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

.news-card-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 8px;
    line-height: 1.4;
    color: var(--text-main);
}

.news-card-text {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.news-empty {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

@media (max-width: 600px) {
    .news-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
}

.books-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 45px 30px;
    padding: 20px 10px;
    perspective: 1200px;
}

.book-card-3d {
    position: relative;
    width: 100%;
    cursor: pointer;
    transition: transform 0.4s ease;
    transform-style: preserve-3d;
}

.book-card-3d:hover {
    transform: translateY(-10px) rotateY(-8deg) rotateX(2deg) scale(1.02);
}

.book-volume {
    position: relative;
    width: 100%;
    aspect-ratio: 2 / 3;
    transform-style: preserve-3d;
    transition: box-shadow 0.4s ease;
    box-shadow: 10px 20px 30px rgba(0, 0, 0, 0.15), inset 4px 0 10px rgba(0, 0, 0, 0.1);
    border-radius: 4px 12px 12px 4px;
    background: #fff;
}

.book-card-3d:hover .book-volume {
    box-shadow: 25px 35px 50px rgba(0, 0, 0, 0.25), inset 4px 0 10px rgba(0, 0, 0, 0.1);
}

/* Страницы книги сбоку */
.book-volume::before {
    content: '';
    position: absolute;
    right: -12px;
    top: 4px;
    bottom: 4px;
    width: 12px;
    background: repeating-linear-gradient(to bottom, #f4f4f4 0, #f4f4f4 2px, #e0e0e0 3px);
    transform: rotateY(90deg);
    transform-origin: right;
    border-radius: 0 4px 4px 0;
}

/* Страницы книги снизу */
.book-volume::after {
    content: '';
    position: absolute;
    bottom: -12px;
    left: 4px;
    right: 4px;
    height: 12px;
    background: repeating-linear-gradient(to right, #f4f4f4 0, #f4f4f4 2px, #e0e0e0 3px);
    transform: rotateX(-90deg);
    transform-origin: bottom;
    border-radius: 0 0 4px 4px;
}

/* Тень корешка (левый край) */
.spine-shadow {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 15px;
    background: linear-gradient(to right, rgba(255, 255, 255, 0.4), rgba(0, 0, 0, 0.15) 30%, rgba(255, 255, 255, 0.1) 50%, rgba(0, 0, 0, 0.3));
    border-radius: 4px 0 0 4px;
    z-index: 10;
}

.book-cover-img {
    position: absolute;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 4px 12px 12px 4px;
}

/* Блик на обложке */
.glare {
    position: absolute;
    top: 0;
    left: 25px;
    width: 30%;
    height: 100%;
    background: linear-gradient(to right, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0) 100%);
    transform: skewX(-10deg);
    z-index: 6;
}

.book-overlay {
    position: absolute;
    inset: 0;
    border-radius: 4px 12px 12px 4px;
    z-index: 8;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.5) 0%, rgba(0, 0, 0, 0.2) 50%, rgba(0, 0, 0, 0.85) 100%) !important;
    padding: 25% 17% 20% 23% !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: space-between !important;
    box-sizing: border-box;
}

.book-rating {
    position: absolute;
    /* Рейтинг отвязываем от flex и кидаем в правый верхний угол */
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    color: #ffd700;
    padding: 4px 8px;
    /* Чуть компактнее */
    border-radius: 20px;
    font-size: 0.75rem;
    /* Шрифт меньше */
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 4px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 215, 0, 0.2);
}

.book-overlay-bottom {
    transform: translateY(0);
    opacity: 1;
    transition: 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.book-overlay-top {
    transform: translateY(0);
    opacity: 1;
    padding-right: 10px;
    /* Leave space for the rating star on the right */
}

/* Hover effect removed as it is now default */



.book-overlay-title {
    color: #fff;
    font-size: 0.95rem;
    line-height: 1.2;
    margin-bottom: 6px;
    text-shadow: 0 2px 5px rgba(0, 0, 0, 0.8);
    display: -webkit-box;
    -webkit-line-clamp: 5;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.book-overlay-author {
    color: #e0e0e0;
    font-size: 0.8rem;
    margin-bottom: 15px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
}

.book-read-btn {
    display: inline-block;
    width: auto;
    background: #51331d;
    color: #fff;
    padding: 4px 12px;
    border-radius: 5px;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    text-align: center;
    transition: 0.3s;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    margin-top: 5px;
}

.book-card-3d:hover .book-read-btn {
    background: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(139, 0, 0, 0.4);
}

/* Автоматическое обрезание длинных названий и авторов на главной */
.book-info-minimal {
    margin-top: 12px;
    text-align: center;
    width: 100%;
    overflow: hidden;
}

.book-title-min {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-main);
    margin: 5px 0 2px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}

.book-author-min {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}

/* Search Overlay & Active State */
.search-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1500;
    display: none;
    opacity: 0;
    transition: opacity 0.3s;
}

.search-overlay.active {
    display: block;
    opacity: 1;
}

.search-container.active {
    z-index: 1501;
}

@media (max-width: 768px) {
    .search-container.active {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        padding: 15px !important;
        background: var(--white);
        border-radius: 0;
        margin: 0;
    }

    .search-container.active .search-input {
        box-shadow: none;
        border: 1px solid #ddd;
    }

    .search-container.active #search-results-dropdown {
        top: 70px !important;
        max-height: calc(100vh - 70px) !important;
        border-radius: 0;
        box-shadow: none;
    }
}

/* Search Dropdown Styles */
.search-result-item {
    padding: 12px 15px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    gap: 15px;
}

.search-result-item:hover {
    background: #f9f9f9;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-cover {
    width: 40px;
    height: 55px;
    object-fit: cover;
    border-radius: 4px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.search-result-info {
    flex: 1;
}

.search-result-title {
    font-weight: 600;
    font-size: 1rem;
    color: #2c3e50;
    margin: 0 0 4px 0;
}

.search-result-author {
    font-size: 0.85rem;
    color: #666;
    margin: 0;
}

.search-result-snippet {
    font-size: 0.85rem;
    color: #555;
    margin: 5px 0 0 0;
    font-style: italic;
    background: #f0f0f0;
    padding: 6px;
    border-radius: 4px;
}

.search-result-type {
    font-size: 0.75rem;
    padding: 3px 6px;
    border-radius: 4px;
    font-weight: bold;
}

.type-book {
    background: #e3f2fd;
    color: #1976d2;
    border: 1px solid #bbdefb;
}

.type-text {
    background: #fff3e0;
    color: #f57c00;
    border: 1px solid #ffe0b2;
}

/* In-Book Search Highlight */
.search-highlight {
    background-color: rgba(255, 235, 59, 0.6);
    border-radius: 2px;
    padding: 0 2px;
    font-weight: bold;
    box-shadow: 0 0 4px rgba(255, 235, 59, 0.8);
}

.letter-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--white);
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 8px;
    text-decoration: none;
    color: var(--text-main);
    font-weight: 600;
    transition: 0.3s;
}

.letter-btn:hover {
    background: var(--primary);
    color: var(--white);
    transform: scale(1.1);
}

/* Reader View */
.reader-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--reader-bg);
    color: var(--reader-text);
    z-index: 7000;
    display: none;
    flex-direction: column;
    transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    /* Prevent any outer scrolling */
    touch-action: none;
    /* Block browser touch gestures (zoom/pan) */
}

.reader-header {
    height: 70px;
    padding: 0 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--reader-header-bg);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    z-index: 7100;
}

.icon-btn {
    background: none;
    border: none;
    font-size: 1.3rem;
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.2s;
    color: var(--reader-text);
}

.icon-btn:hover {
    background: rgba(0, 0, 0, 0.05);
}

.reader-main {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    /* Центрируем разворот */
    padding: 20px;
    background: var(--reader-main-bg);
    overflow: hidden;
    /* Скрываем левую часть разворота */
    position: relative;
    touch-action: none;
}

#book-container,
.book-container-active {
    box-shadow: 0 30px 100px rgba(0, 0, 0, 0.3);
    background: var(--reader-bg);
    touch-action: none;
    position: relative;
}

.page,
.page * {
    font-family: var(--font-reader) !important;
}

.page {
    padding: 25px 50px 15px 50px;
    background-color: var(--reader-bg);
    color: var(--reader-text);
    font-size: inherit;
    line-height: 1.6;
    text-align: left;
    hyphens: auto;
    -webkit-hyphens: auto;
    -ms-hyphens: auto;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    user-select: none;

    /* Hardware acceleration for smooth flipping */
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    transform: translateZ(0);
    will-change: transform;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

.page-inner {
    flex: 1;
    overflow: hidden;
}

.measure-temp {
    display: block !important;
    position: absolute !important;
    visibility: hidden !important;
    height: auto !important;
    max-height: none !important;
    flex: none !important;
    overflow: visible !important;
    box-sizing: border-box !important;
}

.blank-page {
    background: var(--reader-bg) !important;
    border: none !important;
    box-shadow: none !important;
    pointer-events: none !important;
}

.blank-page * {
    display: none !important;
}

.page-num {
    text-align: center;
    font-size: 0.8rem;
    color: var(--reader-muted);
    padding-top: 10px;
    padding-bottom: 5px;
    height: 30px;
    box-sizing: border-box;
}

.page-inner p {
    margin-bottom: 0.8em;
    text-indent: 1.5em;
    /* Красная строка */
}

/* Bible Reference Links in Books */
.bible-ref-link {
    color: var(--accent);
    text-decoration: none;
    border-bottom: 1px dashed rgba(139, 0, 0, 0.4);
    transition: all 0.2s ease;
    cursor: pointer;
    font-weight: 500;
}

.bible-ref-link:hover {
    color: var(--primary-dark);
    border-bottom-color: var(--primary-dark);
    background-color: rgba(139, 0, 0, 0.05);
    border-radius: 3px;
    padding: 0 2px;
    margin: 0 -2px;
}

/* Убираем отступ у первого параграфа на странице, если это начало главы или просто первая строка */
.page-inner p:first-of-type {
    text-indent: 0;
}

/* Если внутри есть заголовки - центрируем их */
.page-inner h1,
.page-inner h2,
.page-inner h3 {
    text-align: center;
    text-indent: 0;
    margin: 1em 0;
    color: var(--accent);
}

/* Переплет: тень зависит от того, какая это страница в развороте */
/* На мобильных (portrait) тень всегда слева */
@media (max-width: 1024px) {
    .page {
        box-shadow: inset 5px 0 10px rgba(0, 0, 0, 0.05) !important;
    }
}

/* На десктопе тени для левой и правой страниц разворота */
/* Библиотека PageFlip добавляет классы --left и --right */
.page.--left {
    box-shadow: inset -5px 0 10px rgba(0, 0, 0, 0.1);
}

.page.--right {
    box-shadow: inset 5px 0 10px rgba(0, 0, 0, 0.1);
}

/* Page numbers inside pages */
.page-num {
    position: absolute;
    bottom: 15px;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 0.8rem;
    color: var(--reader-text);
    opacity: 0.55;
    height: 30px;
    line-height: 30px;
    box-sizing: border-box;
    pointer-events: none;
}

.page h1 {
    font-size: 1.8rem;
    color: var(--accent);
    margin-bottom: 30px;
    text-align: center;
}

/* Cover page background image (dimmed) */
.cover-bg {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0.12;
    filter: blur(3px) saturate(0.6);
    transform: scale(1.05);
    /* slight zoom to hide blur edges */
    z-index: 0;
    pointer-events: none;
}

.cover-content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    text-align: center;
    padding: 40px 30px;
    box-sizing: border-box;
}

.cover-content h1 {
    font-size: 1.8rem;
    color: var(--accent);
    margin-bottom: 15px;
    font-family: 'Playfair Display', serif;
    line-height: 1.3;
}

.cover-content p {
    font-size: 1rem;
    color: var(--reader-muted);
    font-style: italic;
    margin: 0;
}

/* Hard cover style using attribute */
.page[data-density="hard"] {
    background-color: var(--accent);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px;
}

.page[data-density="hard"] h2 {
    font-size: 2.5rem;
    border: 2px solid var(--primary);
    padding: 40px 20px;
}

.reader-footer {
    height: 70px;
    padding: 0 5%;
    background: var(--white);
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    z-index: 100;
}

.progress-container {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

#page-slider {
    width: 100%;
    accent-color: var(--primary);
}

.page-info {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: center;
    font-weight: 700;
    text-transform: uppercase;
}

/* Sidebar */
.sidebar {
    position: fixed;
    top: 0;
    right: -350px;
    width: 350px;
    height: 100%;
    background: var(--white);
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.1);
    z-index: 8000;
    transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
}

.sidebar.active {
    right: 0;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-content {
    padding: 20px;
    overflow-y: auto;
}

/* Popover Settings */
.popover {
    position: fixed;
    bottom: 80px;
    right: 30px;
    width: 280px;
    background: var(--white);
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    z-index: 8050;
    display: none;
    flex-direction: column;
    gap: 20px;
}

.setting-item label {
    display: block;
    font-size: 0.8rem;
    font-weight: 700;
    margin-bottom: 10px;
    text-transform: uppercase;
    color: var(--text-muted);
}

.theme-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.theme-swatch {
    height: 40px;
    border-radius: 8px;
    cursor: pointer;
    border: 2px solid transparent;
}

.theme-swatch.active {
    border-color: var(--primary);
}

.theme-swatch.light {
    background: #fff;
    border: 1px solid #ddd;
}

.theme-swatch.sepia {
    background: #f4ecd8;
}

.theme-swatch.dark {
    background: #1a1a1a;
}

/* Themes */
.reader-overlay.theme-sepia .page {
    background-color: #f4ecd8;
    color: #5b4636;
}

.reader-overlay.theme-sepia .reader-header,
.reader-overlay.theme-sepia .reader-footer {
    background-color: #efdfbb;
}

.reader-overlay.theme-dark .page {
    background-color: #1a1a1a;
    color: #ccc;
}

.reader-overlay.theme-dark .reader-header,
.reader-overlay.theme-dark .reader-footer {
    background-color: #111;
    border-color: #333;
}

.reader-overlay.theme-dark .icon-btn {
    color: #fff;
}

/* Mobile Adjustments */
@media (max-width: 1100px) {
    header {
        height: 70px;
        padding: 0 10px;
        gap: 10px;
    }

    header .logo-container {
        gap: 6px;
    }

    header .logo-icon {
        font-size: 1.5rem;
    }

    header .logo-sub {
        display: none;
    }

    header .logo-main {
        font-size: 1rem;
    }

    header .auth-btn,
    header .install-btn {
        padding: 6px 12px;
        font-size: 0.75rem;
        white-space: nowrap;
    }

    #book-container {
        flex-shrink: 0;
    }

    nav {
        display: none;
    }

    .hero {
        padding: 100px 20px 60px;
        min-height: auto;
    }

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

    .hero-search {
        margin-top: 25px;
    }

    .hero-search .search-input {
        padding: 15px 25px;
        padding-right: 55px;
        font-size: 1rem;
    }

    .hero-search .search-btn {
        width: 38px;
        height: 38px;
        right: 8px;
    }

    .hero p {
        font-size: 1rem;
    }

    .search-input {
        padding: 15px 20px;
        font-size: 1rem;
    }

    .section-padding {
        padding: 40px 15px;
    }

    .section-title {
        font-size: 25px;
        line-height: 29px;
        border-bottom: solid 2px #bb9d4b;
        margin: 15px auto 20px;
    }

    .categories-grid {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
        gap: 15px;
    }

    .category-card {
        padding: 20px;
    }

    .category-icon {
        font-size: 2rem;
    }

    .books-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 15px;
    }

    .reader-main {
        padding: 0;
        /* Убираем отступ, чтобы скрыть полосу слева */
        justify-content: flex-start !important;
    }

    .page {
        padding: 20px 20px 10px 20px;
        /* Меньше отступов внутри страницы */
    }

    #book-container,
    .book-container-active {
        margin: 0;
        /* Сдвигаем на 50% (скрыть левую страницу) и еще на 12px влево, чтобы скрыть корешок/зазор */
        transform: translateX(calc(-50% - 12px)) !important;
    }

    .letter-btn {
        width: 35px;
        height: 35px;
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .hero h1 {
        font-size: 1.8rem;
    }

    .logo-main {
        font-size: 1rem;
    }

    .auth-btn {
        padding: 8px 15px;
        font-size: 0.8rem;
    }
}

/* ============================================================
   МОБИЛЬНЫЕ КНОПКИ ЛИСТАНИЯ (скрыты на десктопе через JS)
   ============================================================ */
.mobile-nav-btn {
    display: none;
    /* JS переключает на flex на мобильных */
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: rgba(203, 181, 139, 0.25);
    color: var(--accent);
    font-size: 1.4rem;
    cursor: pointer;
    transition: background 0.2s, transform 0.15s;
    z-index: 10;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.mobile-nav-btn:active {
    background: rgba(139, 0, 0, 0.15);
    transform: scale(0.92);
}

/* reader-main уже flex; кнопки встают по бокам контейнера */
@media (max-width: 1024px) {
    .reader-main {
        flex-direction: row;
        /* кнопка — книга — кнопка */
        align-items: center;
        justify-content: center;
        gap: 6px;
        padding: 8px 4px;
    }

    #book-container {
        flex-shrink: 0;
        /* не сжимаем книгу */
    }
}

/* На совсем узком экране кнопки чуть меньше */
@media (max-width: 480px) {
    .mobile-nav-btn {
        width: 36px;
        height: 36px;
        font-size: 1.1rem;
    }
}

/* --- БОКОВАЯ ПАНЕЛЬ ЗАКЛАДОК --- */
.sidebar {
    position: fixed;
    top: 0;
    right: -320px;
    width: 320px;
    height: 100%;
    background: #fff;
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.1);
    z-index: 8000;
    transition: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
}

.sidebar.active {
    right: 0;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-header h3 {
    font-family: 'Playfair Display', serif;
    color: var(--accent);
    margin: 0;
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.bookmark-item {
    background: var(--bg-light);
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: 0.2s;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid transparent;
}

.bookmark-item:hover {
    background: #fff;
    border-color: var(--primary);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    transform: translateY(-2px);
}

.bookmark-title {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-main);
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.bookmark-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.bookmark-snippet {
    font-size: 0.75rem;
    color: var(--reader-muted, #999);
    font-style: italic;
    margin: 4px 0;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.delete-bookmark {
    background: none;
    border: none;
    color: #ccc;
    cursor: pointer;
    font-size: 1.1rem;
    padding: 5px;
    transition: 0.2s;
}

.delete-bookmark:hover {
    color: var(--primary);
}

/* --- Стили для кнопок навигации в ридере --- */
.mobile-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(5px);
    border: 1px solid rgba(0, 0, 0, 0.05);
    color: var(--accent);
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.3s;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.mobile-nav-btn:hover {
    background: #fff;
    transform: translateY(-50%) scale(1.1);
}

.mobile-nav-prev {
    left: 20px;
}

.mobile-nav-next {
    right: 20px;
}

@media (min-width: 1025px) {
    .mobile-nav-btn {
        display: none !important;
    }
}

/* --- СТРАНИЦА РЕЙТИНГА В КОНЦЕ КНИГИ --- */
.rating-page-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    width: 100%;
    height: 100%;
    padding: 10px;
    position: relative;
    z-index: 100;
    /* Поднимаем выше слоев перелистывания */
}

.finish-icon {
    font-size: 2.2rem;
    color: var(--primary);
    margin-bottom: 10px;
    opacity: 0.8;
}

.star-rating-ui {
    display: flex;
    flex-direction: row-reverse;
    justify-content: center;
    gap: 4px;
    /* Еще плотнее друг к другу */
}

.star-rating-ui input {
    display: none;
}

.star-rating-ui label {
    font-size: 2rem;
    color: rgba(255, 255, 255, 0.2);
    cursor: pointer;
    transition: 0.2s;
}

.star-rating-ui label:hover,
.star-rating-ui label:hover~label,
.star-rating-ui input:checked~label {
    color: var(--primary);
    transform: scale(1.1);
}

.close-reader-final-btn {
    margin-top: 20px;
    padding: 10px 25px;
    background: transparent;
    border: 2px solid var(--primary);
    /*    color: var(--white); */
    border-radius: 30px;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 0.9rem;
    transition: 0.3s;
}

.close-reader-final-btn:hover {
    background: var(--primary);
    color: var(--accent);
    transform: translateY(-2px);
}

.theme-old .page {
    background: radial-gradient(circle, #e6ccb2 0%, #b08968 100%) !important;
    box-shadow: inset 0 0 100px rgba(0, 0, 0, 0.3) !important;
}

.theme-old .page-inner {
    text-shadow: 1px 1px 0px rgba(255, 255, 255, 0.1);
    font-weight: 500;
}

.theme-old h1,
.theme-old h2,
.theme-old h3 {
    color: #5d0000 !important;
    font-family: 'Ruslan Display', cursive !important;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.theme-swatch.old {
    background: #d4b483;
    border: 2px solid #8b5a2b;
}

.theme-swatch.old::after {
    content: '✥';
    color: #8b5a2b;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
}

/* Reader Loader */
.reader-loader {
    position: absolute;
    inset: 0;
    background: #dcd3bd;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 7200;
    transition: 0.5s ease-out;
}

.loader-content {
    text-align: center;
    color: var(--accent);
}

.loader-icon-container {
    width: 100px;
    height: 100px;
    margin: 0 auto 30px;
    position: relative;
    animation: loaderPulse 2s infinite ease-in-out;
}

.loader-book-icon {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

@keyframes loaderPulse {
    0% {
        transform: scale(1);
        filter: drop-shadow(0 0 0 rgba(139, 0, 0, 0));
    }

    50% {
        transform: scale(1.1);
        filter: drop-shadow(0 0 20px rgba(139, 0, 0, 0.4));
    }

    100% {
        transform: scale(1);
        filter: drop-shadow(0 0 0 rgba(139, 0, 0, 0));
    }
}

.loader-text {
    font-family: 'Playfair Display', serif;
    font-style: italic;
    font-size: 1.1rem;
    margin-top: 15px;
    opacity: 0.8;
}

.loader-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 10px;
}

.loader-dots span {
    width: 8px;
    height: 8px;
    background: var(--accent);
    border-radius: 50%;
    animation: dots 1.4s infinite ease-in-out both;
}

.loader-dots span:nth-child(1) {
    animation-delay: -0.32s;
}

.loader-dots span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes rotateScale {
    0% {
        transform: scale(1) rotate(0deg);
        opacity: 0.5;
    }

    50% {
        transform: scale(1.2) rotate(180deg);
        opacity: 1;
    }

    100% {
        transform: scale(1) rotate(360deg);
        opacity: 0.5;
    }
}

@keyframes dots {

    0%,
    80%,
    100% {
        transform: scale(0);
    }

    40% {
        transform: scale(1.0);
    }
}


/* Settings Panel & Sidebar Drawers */
.settings-panel,
.sidebar {
    position: fixed;
    top: 0;
    right: 0;
    width: 65vw;
    max-width: 65vw;
    height: 100%;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(15px);
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.1);
    z-index: 99999;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.settings-panel.active,
.sidebar.active {
    transform: translateX(0);
}

.settings-header,
.sidebar-header {
    padding: 12px 18px;
    background: var(--bg-light);
    color: var(--text-main);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.settings-header h3,
.sidebar-header h3 {
    margin: 0;
    font-size: 1.15rem;
    font-family: 'Playfair Display', serif;
    word-break: break-word;
}

.settings-close,
.sidebar-header button {
    background: none;
    border: none;
    color: var(--text-main);
    cursor: pointer;
    font-size: 1.2rem;
}

@media (max-width: 600px) {

    .settings-panel,
    .sidebar {
        width: 100%;
    }
}

/* Dark Mode Support for Panels */
.theme-dark .settings-panel,
.theme-dark .sidebar,
.theme-night .settings-panel,
.theme-night .sidebar {
    background: rgba(30, 30, 30, 0.98);
    color: #e0e0e0;
}

.theme-dark .settings-header,
.theme-dark .sidebar-header,
.theme-night .settings-header,
.theme-night .sidebar-header {
    background: #1a1a1a;
}

/* Byzantine Dome Mobile Menu */
#mobile-menu {
    border-radius: 60px 0 0 60px / 50% 0 0 50% !important;
    /* Sweeping curved left edge */
    border-left: 2px solid #bb9d4b !important;
    /* Elegant gold line */
    background: rgba(18, 18, 18, 0.95) !important;
    /* Deep charcoal glassmorphic background */
    backdrop-filter: blur(25px) !important;
    -webkit-backdrop-filter: blur(25px) !important;
    box-shadow: -15px 0 40px rgba(0, 0, 0, 0.5) !important;
    overflow: hidden;
    transition: transform 0.55s cubic-bezier(0.22, 1, 0.36, 1) !important;
    /* Smooth liturgical ease-out */
}

#mobile-menu::before {
    content: '';
    position: absolute;
    top: -50px;
    left: -50px;
    width: 150px;
    height: 150px;
    background: radial-gradient(circle, rgba(187, 157, 75, 0.15) 0%, transparent 70%);
    pointer-events: none;
    z-index: 1;
}

#mobile-menu .settings-header {
    background: transparent !important;
    border-bottom: 1px solid rgba(187, 157, 75, 0.15) !important;
    padding: 24px 20px !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    position: relative !important;
}

#mobile-menu .settings-header h3 {
    color: #bb9d4b !important;
    font-family: 'Playfair Display', serif;
    font-size: 1.4rem;
    margin: 0 !important;
    text-align: center !important;
    width: 100% !important;
    padding-left: 20px !important;
    /* compensate for left curve */
    padding-right: 20px !important;
}

#mobile-menu .settings-close {
    position: absolute !important;
    right: 20px !important;
    top: calc(50% - 18px) !important;
    color: #e0e0e0 !important;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

#mobile-menu .settings-close:hover {
    background: rgba(187, 157, 75, 0.2) !important;
    color: #bb9d4b !important;
    transform: rotate(90deg) !important;
}

#mobile-menu .mobile-nav-links {
    list-style: none;
    padding: 15px 10px !important;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

#mobile-menu .mobile-nav-links li {
    border: none !important;
    width: 100%;
}

#mobile-menu .mobile-nav-links a {
    display: flex !important;
    align-items: center;
    gap: 16px;
    padding: 16px 20px !important;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05) !important;
    text-decoration: none;
    text-transform: none !important;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

#mobile-menu .mobile-nav-links a:hover,
#mobile-menu .mobile-nav-links a:active {
    background: rgba(187, 157, 75, 0.1) !important;
    border-color: rgba(187, 157, 75, 0.3) !important;
    transform: translateX(-5px);
}

#mobile-menu .mobile-link-icon {
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: rgba(187, 157, 75, 0.1);
    border-radius: 12px;
    transition: transform 0.3s ease;
}

#mobile-menu .mobile-nav-links a:hover .mobile-link-icon {
    transform: scale(1.1) rotate(5deg);
}

#mobile-menu .mobile-link-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    text-align: left;
}

#mobile-menu .mobile-link-title {
    font-size: 1.15rem;
    font-weight: 600;
    color: #ffffff !important;
    font-family: 'FuturaPT-Medium', Arial, sans-serif;
}

#mobile-menu .mobile-nav-links a:hover .mobile-link-title {
    color: #bb9d4b !important;
}

#mobile-menu .mobile-link-desc {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.5) !important;
    font-weight: 400;
}

.theme-dark #mobile-menu,
.theme-night #mobile-menu {
    background: rgba(12, 12, 12, 0.97) !important;
}

@media (max-width: 600px) {
    #mobile-menu {
        width: 85vw !important;
        max-width: 85vw !important;
    }
}

.settings-body {
    padding: 12px 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.settings-section {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.section-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #888;
    font-weight: 700;
}

.control-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.control-btn {
    flex: 1;
    padding: 8px;
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: 0.2s;
}

.control-btn:hover {
    background: #eee;
}

.theme-selector {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.theme-swatch {
    width: 35px;
    height: 35px;
    flex-shrink: 0;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: 0.2s;
}

.theme-swatch.active {
    border-color: var(--primary);
    transform: scale(1.1);
}

.theme-swatch.light {
    background: #ffffff;
    border: 1px solid #ddd;
}

.theme-swatch.sepia {
    background: #f4ecd8;
    border: 1px solid #e2d7b5;
}

.theme-swatch.paper {
    background: #e8e6e3;
    border: 1px solid #c2c2c2;
}

.theme-swatch.ocean {
    background: #e0f2f1;
    border: 1px solid #b2dfdb;
}

.theme-swatch.night {
    background: #1a1a2e;
    border: 1px solid #0f0f1a;
}

.theme-swatch.dark {
    background: #2c2c2c;
    border: 1px solid #444;
}

.font-selector {
    display: flex;
    gap: 8px;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: none;
}

.font-selector::-webkit-scrollbar {
    display: none;
}

.font-option {
    flex: 1 0 40px;
    height: 45px;
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.2rem;
    transition: 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.font-option.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    transform: scale(1.05);
}

.voice-btn {
    flex: 1;
    padding: 8px;
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: 0.2s;
}

.voice-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

@media (max-width: 768px) {
    .hero h1 {
        font-size: 2rem;
        margin-bottom: 15px;
        line-height: 1.3;
    }

    .hero p {
        font-size: 1rem;
    }

    .hero {
        padding: 0 15px;
    }
}

/* Animation Toggle Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 22px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked+.slider {
    background-color: var(--primary);
}

input:checked+.slider:before {
    transform: translateX(22px);
}

/* Search Filters */
.search-filters {
    display: none;
    gap: 10px;
    margin-top: 15px;
    padding: 0 5px;
    overflow-x: auto;
    -ms-overflow-style: none;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    z-index: 6001;
    position: relative;
}

.search-filters::-webkit-scrollbar {
    display: none;
}

.search-active .search-filters,
.search-wrapper.active .search-filters {
    display: flex;
}

.filter-chip {
    padding: 8px 16px;
    border-radius: 25px;
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(5px);
    border: 1px solid rgba(0, 0, 0, 0.08);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #ffffff;
    white-space: nowrap;
    font-weight: 500;
}

.filter-chip.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    box-shadow: 0 5px 15px rgba(139, 0, 0, 0.25);
    transform: translateY(-2px);
}

.filter-chip:hover:not(.active) {
    background: rgba(255, 255, 255, 0.7);
    border-color: var(--primary);
    color: var(--primary);
}

@media (max-width: 768px) {
    .search-wrapper.active .search-filters {
        position: fixed;
        top: 80px;
        left: 0;
        width: 100%;
        padding: 10px 20px;
        background: transparent;
        margin-top: 0;
        display: flex;
    }

    .search-wrapper.active #search-results-dropdown {
        top: 140px !important;
        max-height: calc(100vh - 140px) !important;
    }
}

/* --- News Enhancement --- */
.news-card-text {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: all 0.3s;
}

.news-card.expanded .news-card-text {
    -webkit-line-clamp: unset;
}

.news-card {
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.news-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.all-news-btn-container {
    text-align: center;
    margin-top: 30px;
    width: 100%;
}

.all-news-btn {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary-dark);
    padding: 12px 30px;
    border-radius: 30px;
    text-decoration: none;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: 0.3s;
    display: inline-block;
}

.all-news-btn:hover {
    background: var(--primary);
    color: var(--white);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(203, 181, 139, 0.4);
}

/* --- Global Header & Footer Color Scheme --- */

nav.desktop-nav a {
    color: #ffffff !important;
}

nav.desktop-nav a:hover {
    color: #bb9d4b !important;
}

nav.desktop-nav a::after {
    background: #bb9d4b !important;
}

/* Mobile Toggle Hamburger */
.menu-toggle span {
    background: #ffffff !important;
}

/* Header Actions & Language Selector */
.lang-btn {
    color: #ffffff !important;
    background: rgba(255, 255, 255, 0.1) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
}

.auth-btn {
    background: #bb9d4b !important;
    color: #ffffff !important;
    box-shadow: 0 4px 15px rgba(187, 157, 75, 0.2) !important;
}

.auth-btn:hover {
    background: #a68d5b !important;
    box-shadow: 0 6px 20px rgba(187, 157, 75, 0.4) !important;
}

/* Footer overrides from reference layout (Deprecated, styling moved to footer block at end) */

/* Active state for category links */
.category-link.active {
    color: var(--accent) !important;
    font-weight: 700 !important;
}

.category-link.active::before {
    width: 100% !important;
}

/* Compact Categories Section styling */
.category-search-container {
    max-width: 500px;
    margin: 0 auto 20px auto;
    position: relative;
    padding: 0 15px;
}

.category-search-container input {
    width: 100%;
    padding: 12px 20px 12px 45px;
    border: 1px solid #eae6df;
    border-radius: 30px;
    background: #fdfcfa url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23888888' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'%3E%3C/circle%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'%3E%3C/line%3E%3C/svg%3E") no-repeat 18px center;
    color: var(--text-main);
    font-size: 0.95rem;
    font-family: inherit;
    outline: none;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.02);
}

.category-search-container input:focus {
    border-color: var(--accent);
    background-color: #ffffff;
    box-shadow: 0 4px 15px rgba(139, 0, 0, 0.06);
}

.categories-wrapper {
    position: relative;
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 15px;
}

.categories-grid-container {
    position: relative;
}

.category-link.hidden-category {
    display: none !important;
}

.categories-grid-container.expanded .category-link.hidden-category {
    display: inline-block !important;
}

.expand-categories-btn {
    display: block;
    margin: 15px auto 0 auto;
    background: #fdfcfa;
    border: 1px solid #eae6df;
    color: var(--accent);
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    padding: 8px 24px;
    border-radius: 20px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.02);
}

.expand-categories-btn:hover {
    background: #f4efeb;
    border-color: var(--accent);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(139, 0, 0, 0.05);
}

/* Separation dots between category text links */
.category-link {
    display: inline-block !important;
}

.category-link::after {
    content: ' ·';
    margin-left: 10px;
    color: #bb9d4b;
    /* elegant gold color */
    font-weight: 900;
    font-size: 1.1rem;
    display: inline-block;
    pointer-events: none;
    user-select: none;
}

.category-link:last-child::after {
    content: none !important;
}

/* Скрываем текстовую информацию под карточкой книги */
.book-info-minimal {
    display: none !important;
}

/* --- МОБИЛЬНЫЕ СТИЛИ (ОПТИМИЗАЦИЯ ДЛЯ КОМПАКТНОСТИ) --- */
@media (max-width: 768px) {

    /* Сетка книг: 2 колонки на мобильных, плотно и красиво */
    .books-grid {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)) !important;
        gap: 20px 12px !important;
        padding: 8px 4px !important;
    }

    /* Категории (Разделы): компактный текстовый список с разделителем */
    .categories-grid {
        display: block !important;
        text-align: center !important;
        padding: 0 10px !important;
        max-width: 100% !important;
    }

    .category-link {
        display: inline-block !important;
        font-size: 0.85rem !important;
        font-weight: 500 !important;
        color: var(--text-main) !important;
        white-space: nowrap !important;
        text-align: center !important;
        background: none !important;
        border: none !important;
        padding: 2px 0 !important;
        margin: 0 !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        position: relative !important;
    }

    .category-link::after {
        content: ' ·' !important;
        margin-left: 8px !important;
        color: #bb9d4b !important;
        font-weight: 900 !important;
        font-size: 1.1rem !important;
        display: inline-block !important;
        pointer-events: none !important;
    }

    .category-link:last-child::after {
        content: none !important;
    }

    /* Отступы секций делаем компактнее, чтобы убрать эффект разбросанности */
    .section-padding {
        padding: 25px 4% !important;
    }

    .section-title {
        font-size: 24px !important;
        line-height: 29px !important;
        border-bottom: solid 2px #bb9d4b !important;
        margin: 15px auto 20px !important;
    }

    .section-title::after {
        display: none !important;
    }

    /* Отображаем информацию прямо НА обложке книги */
    .book-overlay-bottom {
        display: block !important;
        transform: translateY(0) !important;
        opacity: 1 !important;
    }

    /* Оверлей обложки: затемняем к низу, чтобы белый текст читался */
    .book-overlay {
        background: linear-gradient(to bottom, rgba(0, 0, 0, 0.6) 0%, rgba(0, 0, 0, 0.1) 40%, rgba(0, 0, 0, 0.85) 100%) !important;
        padding: 50px 20px 50px 38px !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: space-between !important;
    }

    /* Сжимаем текст оверлея на телефонах, чтобы он не вылезал из книги */
    .book-overlay-title {
        font-size: 0.8rem !important;
        line-height: 1.15 !important;
        margin-bottom: 2px !important;
        text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9) !important;
    }

    .book-overlay-author {
        font-size: 0.68rem !important;
        margin-bottom: 4px !important;
        text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9) !important;
    }

    /* Делаем кнопку "Читать" / "Продолжить" очень компактной */
    .book-read-btn {
        padding: 3px 8px !important;
        font-size: 0.65rem !important;
        border-radius: 4px !important;
        margin-top: 2px !important;
        display: inline-block !important;
    }

    /* Звездочку рейтинга на обложке делаем более компактной на мобильных */
    .book-rating {
        top: 6px !important;
        right: 6px !important;
        padding: 2px 6px !important;
        font-size: 0.65rem !important;
        border-radius: 12px !important;
    }

    /* Управление вкладками полки (делаем компактными) */
    .shelf-controls {
        gap: 8px !important;
        margin-bottom: 15px !important;
    }

    .shelf-tabs {
        gap: 4px !important;
    }

    .shelf-tab {
        padding: 5px 12px !important;
        font-size: 0.75rem !important;
    }

    .shelf-limit {
        gap: 4px !important;
    }

    .shelf-limit-label {
        font-size: 0.75rem !important;
    }

    .limit-btn {
        width: 28px !important;
        height: 24px !important;
        font-size: 0.75rem !important;
    }

    /* Сжимаем новости */
    .news-card-body {
        padding: 12px !important;
    }

    .news-card-title {
        font-size: 0.95rem !important;
        margin-bottom: 4px !important;
    }

    .news-card-text {
        font-size: 0.78rem !important;
    }

    .news-card-date {
        font-size: 0.7rem !important;
        margin-bottom: 4px !important;
    }
}

/* --- СТИЛИ ДЛЯ РАЗДЕЛА ДОНАТОВ (PREMIUM) --- */
#donations {
    position: relative;
    background:
        linear-gradient(135deg, rgba(30, 10, 10, 0.5) 0%, rgba(15, 15, 40, 0.6) 100%),
        url('img/donation_bg.png') center center / cover no-repeat;
    border: none;
    overflow: hidden;
    padding: 70px 5%;
}

/* Золотое свечение по краям */
#donations::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse at 10% 50%, rgba(187, 157, 75, 0.12) 0%, transparent 60%),
        radial-gradient(ellipse at 90% 50%, rgba(187, 157, 75, 0.10) 0%, transparent 60%);
    pointer-events: none;
}

/* Тонкая золотая линия сверху */
#donations::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, #bb9d4b, #f0d080, #bb9d4b, transparent);
}

.donation-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0;
    position: relative;
    z-index: 1;
}

/* Glassmorphism карточка */
.donation-card {
    display: flex;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(187, 157, 75, 0.3);
    border-radius: 24px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow:
        0 8px 40px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
    align-items: center;
    gap: 0;
    padding: 0;
    overflow: hidden;
}

/* Левая часть с текстом */
.donation-info {
    flex: 1.2;
    padding: 45px 50px;
}

.donation-info .section-title {
    color: #f0d080 !important;
    text-shadow: 0 0 30px rgba(187, 157, 75, 0.5);
    font-family: 'Playfair Display', serif;
}

.donation-description {
    font-size: 0.95rem;
    line-height: 1.7;
    color: rgba(255, 255, 255, 0.72);
    margin-bottom: 14px;
}

.donation-meta {
    margin-top: 28px;
}

.donation-platform {
    display: inline-flex;
    align-items: center;
    background: rgba(187, 157, 75, 0.12);
    padding: 7px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #f0d080;
    border: 1px solid rgba(187, 157, 75, 0.35);
    letter-spacing: 0.3px;
}

.donation-platform img {
    filter: brightness(10) sepia(1) saturate(3) hue-rotate(5deg);
    opacity: 0.85;
}

/* Правая часть с баночкой */
.donation-action {
    flex: 0.8;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 45px 40px;
    text-align: center;
    border-left: 1px solid rgba(187, 157, 75, 0.2);
    background: rgba(0, 0, 0, 0.15);
}

/* Анимированная баночка */
.mono-jar-visual {
    position: relative;
    width: 120px;
    height: 160px;
    margin-bottom: 24px;
    filter: drop-shadow(0 8px 20px rgba(187, 157, 75, 0.35));
}

.mono-jar {
    width: 90px;
    height: 130px;
    border: 3px solid rgba(187, 157, 75, 0.7);
    border-radius: 20px 20px 30px 30px;
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    overflow: hidden;
    background: rgba(255, 255, 255, 0.08);
    box-shadow:
        inset 0 10px 20px rgba(0, 0, 0, 0.3),
        0 0 25px rgba(187, 157, 75, 0.15);
}

.mono-jar-lid {
    width: 50px;
    height: 12px;
    background: linear-gradient(135deg, #f0d080, #bb9d4b);
    border: 2px solid rgba(187, 157, 75, 0.5);
    border-radius: 4px 4px 2px 2px;
    position: absolute;
    top: -4px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
    box-shadow: 0 2px 8px rgba(187, 157, 75, 0.4);
}

.mono-jar-body {
    width: 100%;
    height: 100%;
    position: relative;
}

.mono-jar-liquid {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 55%;
    background: linear-gradient(135deg, #c0392b, #e74c3c, #f39c12);
    border-top: 2px solid rgba(231, 76, 60, 0.6);
    animation: wave 3s infinite ease-in-out alternate;
}

.mono-jar-label {
    position: absolute;
    top: 35%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.55);
    border: 1px solid rgba(187, 157, 75, 0.5);
    padding: 2px 8px;
    font-size: 0.6rem;
    font-weight: 700;
    border-radius: 4px;
    color: #f0d080;
    letter-spacing: 1px;
    z-index: 3;
}

.mono-jar-coins {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: 4;
}

.mono-jar-coins span {
    position: absolute;
    font-size: 1.1rem;
    animation: dropCoin 2.5s infinite ease-in-out;
    opacity: 0;
}

.mono-jar-coins span:nth-child(1) {
    left: 20%;
    animation-delay: 0s;
}

.mono-jar-coins span:nth-child(2) {
    left: 45%;
    animation-delay: 0.8s;
}

.mono-jar-coins span:nth-child(3) {
    left: 70%;
    animation-delay: 1.6s;
}

@keyframes wave {
    0% {
        transform: skewY(-2deg) translateY(0);
    }

    100% {
        transform: skewY(2deg) translateY(-4px);
    }
}

@keyframes dropCoin {
    0% {
        top: -20px;
        opacity: 0;
        transform: rotate(0deg);
    }

    25% {
        opacity: 1;
    }

    75% {
        top: 65%;
        opacity: 0.8;
        transform: rotate(180deg);
    }

    100% {
        top: 85%;
        opacity: 0;
        transform: rotate(360deg);
    }
}

/* Золотая кнопка */
.donate-btn-mono {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(135deg, #c0392b 0%, #e74c3c 50%, #c0392b 100%);
    background-size: 200% auto;
    color: #ffffff !important;
    text-decoration: none;
    padding: 15px 32px;
    border-radius: 14px;
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: 0.3px;
    box-shadow:
        0 4px 20px rgba(192, 57, 43, 0.5),
        0 0 0 1px rgba(255, 255, 255, 0.08) inset;
    transition: all 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
    border: none;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

/* Блик на кнопке */
.donate-btn-mono::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 60%;
    height: 100%;
    background: linear-gradient(120deg, transparent, rgba(255, 255, 255, 0.15), transparent);
    transition: left 0.5s ease;
}

.donate-btn-mono:hover::before {
    left: 150%;
}

.donate-btn-mono:hover {
    transform: translateY(-4px);
    box-shadow:
        0 10px 35px rgba(192, 57, 43, 0.6),
        0 0 0 1px rgba(255, 255, 255, 0.1) inset;
    background-position: right center;
}

.donate-btn-mono:active {
    transform: translateY(-1px);
}

/* Подпись под кнопкой */
.donate-btn-mono+.donation-hint {
    margin-top: 14px;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.4);
}

/* Мобильная адаптивность */
@media (max-width: 768px) {
    #donations {
        padding: 40px 5%;
    }

    .donation-card {
        flex-direction: column;
    }

    .donation-info {
        padding: 0;
        text-align: center;
    }

    .donation-info .section-title {
        text-align: center !important;
    }

    .donation-action {
        border-left: none;
        border-top: 1px solid rgba(187, 157, 75, 0.2);
        padding: 10px;
        width: 100%;
        background: transparent;
    }
}


.donation-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 15px;
}

.donation-card {
    display: flex;
    background: #ffffff;
    border: 1px solid #eae6df;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.03);
    align-items: center;
    gap: 15px;
    padding: 15px 20px;
}

.donation-info {
    flex: 1.2;
}

.donation-description {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-muted);
    margin-bottom: 15px;
}

.donation-meta {
    margin-top: 15px;
}

.donation-platform {
    display: inline-flex;
    align-items: center;
    background: #f4efeb;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-main);
    border: 1px solid #eae6df;
}

.donation-platform img {
    filter: none;
    opacity: 1;
}

.donation-action {
    flex: 0 0 160px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-left: 1px solid #f0ede4;
    padding-left: 15px;
    text-align: center;
    background: transparent;
}

/* Анимированная баночка Monobank в стиле CSS */
.mono-jar-visual {
    position: relative;
    width: 120px;
    height: 160px;
    margin-bottom: 0px;
    transform: scale(0.65);
    transform-origin: center bottom;
}

.mono-jar {
    width: 90px;
    height: 130px;
    border: 4px solid #2c3e50;
    border-radius: 20px 20px 30px 30px;
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    overflow: hidden;
    background: rgba(255, 255, 255, 0.6);
    box-shadow: inset 0 10px 20px rgba(0, 0, 0, 0.05);
}

.mono-jar-lid {
    width: 50px;
    height: 12px;
    background: #bb9d4b;
    border: 3px solid #2c3e50;
    border-radius: 4px 4px 2px 2px;
    position: absolute;
    top: -4px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
}

.mono-jar-body {
    width: 100%;
    height: 100%;
    position: relative;
}

.mono-jar-liquid {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 55%;
    background: linear-gradient(135deg, #ff4e50, #f9d423);
    /* Яркий градиент жидкости Monobank */
    border-top: 3px solid #ff4e50;
    animation: wave 3s infinite ease-in-out alternate;
}

.mono-jar-label {
    position: absolute;
    top: 35%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #ffffff;
    border: 2px solid #2c3e50;
    padding: 2px 8px;
    font-size: 0.65rem;
    font-weight: 700;
    border-radius: 4px;
    color: #2c3e50;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    z-index: 3;
}

.mono-jar-coins {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: 1;
}

.mono-jar-coins span {
    position: absolute;
    font-size: 1.2rem;
    animation: dropCoin 2.5s infinite ease-in-out;
    opacity: 0;
}

.mono-jar-coins span:nth-child(1) {
    left: 20%;
    animation-delay: 0s;
}

.mono-jar-coins span:nth-child(2) {
    left: 45%;
    animation-delay: 0.8s;
}

.mono-jar-coins span:nth-child(3) {
    left: 70%;
    animation-delay: 1.6s;
}

@keyframes wave {
    0% {
        transform: skewY(-2deg);
    }

    100% {
        transform: skewY(2deg);
    }
}

@keyframes dropCoin {
    0% {
        top: -20px;
        opacity: 0;
        transform: translateY(0) rotate(0deg);
    }

    30% {
        opacity: 1;
    }

    70% {
        top: 60%;
        opacity: 0.8;
        transform: translateY(0) rotate(180deg);
    }

    100% {
        top: 85%;
        opacity: 0;
        transform: translateY(5px) rotate(360deg);
    }
}

/* Кнопка доната */
.donate-btn-mono {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #ff4e50;
    /* Яркий и привлекательный цвет Monobank */
    background: linear-gradient(135deg, #e53935, #ff1744);
    color: #ffffff !important;
    text-decoration: none;
    padding: 10px 20px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 0.9rem;
    box-shadow: 0 4px 15px rgba(229, 57, 53, 0.3);
    transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
    border: none;
    cursor: pointer;
}

.donate-btn-mono:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(229, 57, 53, 0.45);
    background: linear-gradient(135deg, #d32f2f, #f50057);
}

.donate-btn-mono:active {
    transform: translateY(-1px);
}

/* Мобильная адаптивность для донатов */
@media (max-width: 768px) {
    .donation-card {
        flex-direction: column;
        padding: 15px;
        gap: 10px;
    }

    .donation-action {
        border-left: none;
        border-top: 1px solid #f0ede4;
        padding-left: 0;
        padding-top: 15px;
        width: 100%;
    }

    .donation-info {
        text-align: center;
    }

    .donation-info h2 {
        text-align: center !important;
    }
}

/* PREMIUM DONATION CARD */
.premium-donation-wrapper {
    position: relative;
    max-width: 900px;
    margin: 0 auto;
    padding: 0 15px;
}

.premium-donation-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 80%;
    height: 80%;
    background: radial-gradient(circle, rgba(255, 78, 80, 0.15) 0%, rgba(255, 78, 80, 0) 70%);
    transform: translate(-50%, -50%);
    z-index: 0;
    pointer-events: none;
}

.premium-donation-card {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    /* background: linear-gradient(145deg, #1f1f1f, #141414); */
    /* border: 1px solid rgba(255, 255, 255, 0.08); */
    /* border-radius: 20px; */
    padding: 25px 35px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    gap: 30px;
}

.premium-donation-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.15), transparent);
}

.premium-donation-content {
    flex: 1;
}

.premium-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 4px 12px;
    border-radius: 30px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #e0e0e0;
    margin-bottom: 12px;
}

.premium-mono-logo {
    height: 14px;
    filter: brightness(0) invert(1);
}

.premium-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 10px;
    margin-top: 0;
}

.premium-desc {
    font-size: 0.9rem;
    line-height: 1.5;
    color: #f0f0f0;
    margin: 0;
}

.premium-action-area {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    background: rgba(0, 0, 0, 0.2);
    padding: 20px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.03);
}

/* SLEEK JAR */
.premium-jar-wrapper {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.premium-jar-lid {
    width: 38px;
    height: 10px;
    background: linear-gradient(180deg, #4a4a4a, #1a1a1a);
    border-radius: 3px 3px 0 0;
    z-index: 2;
    border-bottom: 2px solid #000;
    box-shadow: inset 0 1px 3px rgba(255, 255, 255, 0.3);
}

.premium-jar {
    position: relative;
    width: 58px;
    height: 76px;
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-top: none;
    border-radius: 5px 5px 16px 16px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(4px);
    overflow: hidden;
    box-shadow: inset 0 -4px 12px rgba(0, 0, 0, 0.3);
}

.premium-jar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: rgba(255, 255, 255, 0.4);
}

.premium-jar-liquid {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 50%;
    background: linear-gradient(180deg, #ffb347, #ff7b00);
    box-shadow: inset 0 3px 8px rgba(0, 0, 0, 0.2);
}

.premium-jar-label {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.95);
    color: #000;
    font-size: 0.55rem;
    padding: 2px 5px;
    border-radius: 3px;
    font-weight: 800;
    letter-spacing: 0.3px;
    z-index: 3;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.premium-jar-glare {
    position: absolute;
    top: 0;
    left: 6px;
    width: 10px;
    height: 100%;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.3), transparent);
    transform: skewX(-10deg);
    z-index: 2;
}

.premium-jar-coins {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: 1;
}

/* ── Coin Unit: container for one coin + its particles ── */
.coin-unit {
    position: absolute;
    left: var(--coin-x, 50%);
    top: -20px;
    width: 0;
    height: 0;
    animation: coin-fall 1.2s var(--coin-delay, 0s) infinite ease-in;
}

/* ── The golden coin itself ── */
.coin-body {
    position: absolute;
    width: 12px;
    height: 12px;
    left: -6px;
    top: -6px;
    background: radial-gradient(circle at 30% 30%, #fff69d 0%, #ffd700 40%, #d4af37 80%, #aa7c11 100%);
    border: 1px solid #aa7c11;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4), inset 0 1px 1px rgba(255, 255, 255, 0.8);
    animation: coin-spin 1.2s var(--coin-delay, 0s) infinite ease-in;
}

/* ── Particle container: hidden until explosion phase ── */
.coin-particles {
    position: absolute;
    top: 0;
    left: 0;
    width: 0;
    height: 0;
}

/* ── Individual particles ── */
.coin-particles i {
    position: absolute;
    display: block;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: radial-gradient(circle, #ffe88a 0%, #ffbf00 50%, #d4a017 100%);
    box-shadow: 0 0 4px rgba(255, 200, 0, 0.6);
    opacity: 0;
    top: -2.5px;
    left: -2.5px;
    animation: coin-particle-burst 1.2s var(--coin-delay, 0s) infinite ease-in;
}

/* Vary particle sizes for organic feel */
.coin-particles i:nth-child(odd) {
    width: 4px;
    height: 4px;
    top: -2px;
    left: -2px;
}

.coin-particles i:nth-child(3),
.coin-particles i:nth-child(6) {
    width: 3px;
    height: 3px;
    top: -1.5px;
    left: -1.5px;
}

/* ── Keyframes: Container moves from top to liquid surface ── */
/* Only controls position! Opacity is handled by children independently */
@keyframes coin-fall {
    0% {
        top: -20px;
    }
    /* Container reaches liquid surface */
    50% {
        top: 38px;
    }
    /* Stay at surface for particle explosion to play */
    100% {
        top: 38px;
    }
}

/* ── Keyframes: Coin spins while falling, vanishes on impact ── */
@keyframes coin-spin {
    0% {
        transform: rotate(0deg) scale(0.6);
        opacity: 0;
    }
    4% {
        opacity: 1;
        transform: rotate(20deg) scale(1);
    }
    50% {
        transform: rotate(200deg) scale(1);
        opacity: 1;
    }
    /* Instant dissolve on impact */
    51% {
        transform: rotate(210deg) scale(0);
        opacity: 0;
    }
    100% {
        transform: rotate(210deg) scale(0);
        opacity: 0;
    }
}

/* ── Keyframes: Particles explode the INSTANT coin hits surface ── */
/* Particles appear at exactly 50% (same frame coin disappears) and burst outward by 65% */
@keyframes coin-particle-burst {
    0%, 49% {
        /* Invisible while coin is falling */
        opacity: 0;
        transform: translate(0, 0) scale(0);
        filter: blur(0px);
    }
    /* BANG – particles appear at impact */
    50% {
        opacity: 1;
        transform: translate(0, 0) scale(1.3);
        filter: blur(0px);
    }
    /* Particles fly outward and fade */
    62% {
        opacity: 0.3;
        transform: translate(var(--tx, 10px), var(--ty, -10px)) scale(0.5);
        filter: blur(1px);
    }
    70% {
        opacity: 0;
        transform: translate(var(--tx, 10px), var(--ty, -10px)) scale(0.1);
        filter: blur(3px);
    }
    100% {
        opacity: 0;
        transform: translate(var(--tx, 10px), var(--ty, -10px)) scale(0);
        filter: blur(3px);
    }
}

.premium-donate-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #ff4e50, #c0392b);
    color: #ffffff !important;
    text-decoration: none;
    padding: 10px 20px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 0.9rem;
    box-shadow: 0 6px 18px rgba(255, 78, 80, 0.25);
    transition: all 0.3s ease;
}

.premium-donate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 22px rgba(255, 78, 80, 0.4);
    background: linear-gradient(135deg, #ff6b6b, #e53935);
}

/* MOBILE RESPONSIVE */
@media (max-width: 768px) {
    .premium-donation-card {
        flex-direction: column;
        padding: 20px 15px;
        gap: 20px;
    }

    .premium-badge {
        margin-bottom: 10px;
        padding: 3px 10px;
        font-size: 0.75rem;
    }

    .premium-title {
        font-size: 1.3rem;
        text-align: center;
    }

    .premium-desc {
        text-align: center;
        font-size: 0.85rem;
    }

    .premium-action-area {
        width: 100%;
        padding: 16px 15px;
        box-sizing: border-box;
        gap: 14px;
    }

    .premium-donate-btn {
        width: 100%;
        justify-content: center;
        box-sizing: border-box;
    }
}

/* --- MULTI-DONATION STYLES --- */
.donation-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 16px;
    margin-bottom: 5px;
}

.donation-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 10px;
    color: #cccccc;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    font-size: 0.85rem;
    font-weight: 600;
    user-select: none;
}

.donation-option:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.15);
    color: #ffffff;
    transform: translateX(4px);
}

.donation-option.active {
    background: rgba(187, 157, 75, 0.12);
    border-color: rgba(187, 157, 75, 0.4);
    color: #bb9d4b;
    box-shadow: 0 4px 20px rgba(187, 157, 75, 0.08);
}

.donation-option-icon {
    font-size: 1.1rem;
    width: 18px;
    text-align: center;
    display: inline-flex;
    justify-content: center;
    align-items: center;
}

.donation-option img.donation-option-icon {
    height: 12px;
    width: auto;
}

.premium-action-views {

    position: relative;
    min-height: 210px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.premium-action-views .premium-action-area {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.95);
    width: 100%;
    display: none;
    opacity: 0;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    background: rgba(0, 0, 0, 0.2);
    padding: 16px 20px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.03);
    box-sizing: border-box;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.premium-action-views .premium-action-area.active {
    position: relative;
    top: 0;
    left: 0;
    transform: translate(0, 0) scale(1);
    display: flex;
    opacity: 1;
}

/* ЮMoney styling */
.yoomoney-liquid {
    background: linear-gradient(180deg, #d39dff, #8b3dfa) !important;
}

.yoomoney-coin {
    color: #ffffff;
    font-weight: 700;
}

.yoomoney-btn {
    background: linear-gradient(135deg, #8b3dfa, #6200ea) !important;
    box-shadow: 0 6px 18px rgba(139, 61, 250, 0.25) !important;
}

.yoomoney-btn:hover {
    box-shadow: 0 8px 22px rgba(139, 61, 250, 0.4) !important;
    background: linear-gradient(135deg, #a970ff, #8b3dfa) !important;
}

/* Sub / Membership styling */
.sub-liquid {
    background: linear-gradient(180deg, #ffa480, #ff5a19) !important;
}

.sub-coin {
    font-size: 1.1rem;
}

.sub-links-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}

.boosty-btn {
    background: linear-gradient(135deg, #ff5a19, #d84315) !important;
    box-shadow: 0 6px 18px rgba(255, 90, 25, 0.25) !important;
}

.boosty-btn:hover {
    box-shadow: 0 8px 22px rgba(255, 90, 25, 0.4) !important;
    background: linear-gradient(135deg, #ff7b42, #ff5a19) !important;
}

.patreon-btn {
    background: linear-gradient(135deg, #ff424d, #c2185b) !important;
    box-shadow: 0 6px 18px rgba(255, 66, 77, 0.25) !important;
}

.patreon-btn:hover {
    box-shadow: 0 8px 22px rgba(255, 66, 77, 0.4) !important;
    background: linear-gradient(135deg, #ff6b74, #ff424d) !important;
}

/* Crypto View styling */
.crypto-addresses-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
}

.crypto-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 2px;
    text-align: left;
    width: 100%;
}

.crypto-address-row {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 6px 10px;
    border-radius: 10px;
    width: 100%;
    box-sizing: border-box;
}

.crypto-badge-tag {
    font-size: 0.6rem;
    font-weight: 800;
    padding: 3px 5px;
    border-radius: 5px;
    color: #fff;
    min-width: 32px;
    text-align: center;
    letter-spacing: 0.5px;
}

.crypto-badge-tag.btc {
    background: #f7931a;
}

.crypto-badge-tag.eth {
    background: #627eea;
}

.crypto-badge-tag.usdt {
    background: #26a17b;
}

.crypto-address-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    text-align: left;
}

.crypto-label {
    font-size: 0.6rem;
    color: rgba(255, 255, 255, 0.35);
    font-weight: 600;
    margin-bottom: 1px;
}

.crypto-address-input {
    background: transparent;
    border: none;
    color: #e0e0e0;
    font-size: 0.7rem;
    padding: 0;
    width: 100%;
    outline: none;
    font-family: 'Inter', monospace;
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
    cursor: default;
}

.crypto-copy-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #cccccc;
    font-size: 0.65rem;
    font-weight: 600;
    padding: 5px 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.crypto-copy-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

.crypto-copy-btn.copied {
    background: #2e7d32 !important;
    border-color: #388e3c !important;
    color: #ffffff !important;
}

@media (max-width: 768px) {
    .premium-action-views {
        width: 100%;
        min-height: auto;
    }

    .premium-action-views .premium-action-area {
        position: relative !important;
        top: 0 !important;
        left: 0 !important;
        transform: none !important;
        width: 100% !important;
        display: none !important;
        opacity: 0 !important;
    }

    .premium-action-views .premium-action-area.active {
        display: flex !important;
        opacity: 1 !important;
    }

    .donation-option:hover {
        transform: none;
    }
}

@media (max-width: 500px) {
    .donation-options {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 6px;
    }

    .donation-option {
        padding: 7px 5px;
        font-size: 0.75rem;
        gap: 6px;
        justify-content: center;
        border-radius: 8px;
    }

    .donation-option-icon {
        font-size: 0.95rem;
    }
}

/* Bookshelf Pagination ("Show More" flow) */
.shelf-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 30px;
    margin-bottom: 40px;
    width: 100%;
}

.shelf-load-more-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    width: 100%;
    max-width: 400px;
    padding: 0 20px;
}

.shelf-progress-info {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-family: 'Inter', sans-serif;
    font-weight: 500;
}

.shelf-progress-info span {
    font-weight: 700;
    color: var(--text-main);
}

.shelf-progress-bar {
    width: 100%;
    height: 6px;
    background: rgba(0, 0, 0, 0.06);
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}

.shelf-progress-line {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--primary-dark));
    border-radius: 10px;
    width: 0%;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.shelf-load-more-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 42px;
    padding: 0 32px;
    border: 1.5px solid var(--primary);
    background: transparent;
    border-radius: 25px;
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-main);
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.02);
}

.shelf-load-more-btn:hover:not(:disabled) {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(139, 0, 0, 0.03);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(139, 0, 0, 0.08);
}

.shelf-load-more-btn:active:not(:disabled) {
    transform: translateY(0);
}

.shelf-load-more-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    background: #f9f9f9;
    border-color: #ddd;
    color: #999;
}

.shelf-load-more-btn .spinner-svg {
    display: none;
}

.shelf-all-loaded {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    padding: 10px 20px;
    background: rgba(0, 0, 0, 0.02);
    border-radius: 15px;
    letter-spacing: 0.5px;
}

.shelf-loading-placeholder {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 0;
    color: var(--text-muted);
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    font-weight: 500;
    letter-spacing: 0.5px;
}

/* Spinner rotation */
@keyframes shelfSpin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.spinner-svg {
    width: 18px;
    height: 18px;
    animation: shelfSpin 0.8s linear infinite;
}

.spinner-svg circle {
    stroke: currentColor;
    stroke-linecap: round;
    animation: shelfDash 1.5s ease-in-out infinite;
}

@keyframes shelfDash {
    0% {
        stroke-dasharray: 1, 150;
        stroke-dashoffset: 0;
    }

    50% {
        stroke-dasharray: 90, 150;
        stroke-dashoffset: -35;
    }

    100% {
        stroke-dasharray: 90, 150;
        stroke-dashoffset: -124;
    }
}

/* Dynamic fadeIn and slide up animation for shelf books */
@keyframes shelfFadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px) rotateY(-2deg);
    }

    to {
        opacity: 1;
        transform: translateY(0) rotateY(0deg);
    }
}

.book-card-3d.fade-in-up {
    opacity: 0;
    animation: shelfFadeInUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Кликабельные элементы оглавления */
.toc-flex-row {
    display: flex !important;
    justify-content: space-between !important;
    align-items: baseline !important;
    position: relative;
    overflow: hidden;
}

.toc-dots {
    flex-grow: 1;
    border-bottom: 2px dotted rgba(255, 255, 255, 0.3);
    margin: 0 8px;
    position: relative;
    top: -4px;
    opacity: 0.5;
}

.theme-light .toc-dots,
.theme-sepia .toc-dots,
.theme-paper .toc-dots,
.theme-old .toc-dots {
    border-bottom-color: rgba(0, 0, 0, 0.3);
}

.toc-page-num {
    flex-shrink: 0;
    font-weight: 700;
    font-size: 0.9em;
    color: var(--reader-text);
    opacity: 0.8;
}

.page-inner .o,
.page-inner .h1o,
.page-inner .h2o,
.page-inner .h3o,
.page-inner .h4o,
.page-inner .h6o,
.page-inner .titleo,
.page-inner .toc-wrapper-p {
    font-size: 0.9em !important;
    font-weight: 700 !important;
    margin: 8px 0 !important;
    line-height: 1.3 !important;
}

.page-inner .h5o {
    font-size: 0.7em !important;
    font-weight: 700 !important;
    margin: 8px 0 !important;
    line-height: 1.3 !important;
}

.toc-clickable-item {
    cursor: pointer;
    transition: color 0.2s ease;
    display: inline;
    text-decoration: underline;
}

.toc-clickable-item:hover {
    color: var(--accent);
}

.theme-night .toc-clickable-item:hover,
.theme-dark .toc-clickable-item:hover {
    color: var(--primary);
}

nav.desktop-nav a {
    pointer-events: auto !important;
    position: relative;
    z-index: 9999;
}

/* --- Authentication Modal & Profile Dropdown --- */
.auth-container {
    display: inline-block;
}

.auth-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 1.4rem;
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    transition: background 0.3s;
    outline: none;
}

.auth-btn img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--accent);
}

.auth-btn:hover {
    background: rgba(0, 0, 0, 0.05);
}

.auth-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    background: var(--white);
    min-width: 220px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s ease;
    z-index: 9000;
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, 0.05);
    padding: 10px 0;
}

.auth-dropdown.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.auth-dropdown-user {
    padding: 10px 20px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    margin-bottom: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.auth-dropdown-user-name {
    font-weight: 600;
    color: var(--text-main);
    font-size: 0.95rem;
}

.auth-dropdown-user-email {
    font-size: 0.75rem;
    color: #888;
}

.auth-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    color: var(--text-main);
    text-decoration: none;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.2s;
    background: transparent;
    border: none;
    width: 100%;
    text-align: left;
}

.auth-dropdown-item:hover {
    background: rgba(0, 0, 0, 0.03);
    color: var(--accent);
}

/* Auth Modal Window */
.auth-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
}

.auth-modal.active {
    display: flex;
}

.auth-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
}

.auth-modal-content {
    position: relative;
    background: var(--white);
    width: 90%;
    max-width: 400px;
    border-radius: 16px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
    z-index: 10001;
    overflow: hidden;
    padding: 30px 24px;
    text-align: center;
    border: 1px solid rgba(0, 0, 0, 0.05);
    animation: authModalShow 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes authModalShow {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.auth-modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: transparent;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: #999;
    transition: color 0.2s;
}

.auth-modal-close:hover {
    color: #333;
}

.auth-modal-header h3 {
    font-family: 'Playfair Display', serif;
    font-size: 1.5rem;
    color: var(--text-main);
    margin: 0 0 10px 0;
}

.auth-modal-header p {
    font-size: 0.85rem;
    color: #666;
    line-height: 1.5;
    margin: 0 0 25px 0;
}

/* --- CABINET SIDEBAR & USER PANEL --- */
.profile-sidebar {
    background: rgba(255, 255, 255, 0.85) !important;
    backdrop-filter: blur(20px);
    border-left: 1px solid rgba(255, 255, 255, 0.3);
}

.cabinet-content {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.cabinet-user-profile {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 20px 15px;
    background: rgba(139, 0, 0, 0.03);
    border-radius: 12px;
    margin-bottom: 20px;
    border: 1px solid rgba(139, 0, 0, 0.05);
}

.cabinet-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--primary);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.cabinet-user-info h4 {
    font-family: 'Playfair Display', serif;
    font-size: 1.15rem;
    margin: 0;
    color: var(--text-main);
}

.cabinet-user-info span {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.cabinet-stats {
    display: flex;
    justify-content: space-around;
    padding: 15px 10px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.02);
    margin-bottom: 25px;
    border: 1px solid rgba(0, 0, 0, 0.03);
}

.stat-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.stat-val {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--accent);
}

.stat-lbl {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cabinet-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 20px;
}

.cabinet-tab-btn {
    padding: 10px 8px;
    font-size: 0.8rem;
    font-weight: 600;
    background: rgba(0, 0, 0, 0.02);
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-main);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.cabinet-tab-btn:hover {
    background: rgba(139, 0, 0, 0.02);
    border-color: var(--primary);
}

.cabinet-tab-btn.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
    box-shadow: 0 4px 10px rgba(139, 0, 0, 0.15);
}

.cabinet-books-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 400px;
    overflow-y: auto;
    padding-right: 5px;
}

.cabinet-book-item {
    display: flex;
    gap: 12px;
    padding: 10px;
    background: #fff;
    border-radius: 10px;
    border: 1px solid rgba(0, 0, 0, 0.03);
    cursor: pointer;
    transition: all 0.25s ease;
}

.cabinet-book-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.05);
    border-color: var(--primary);
}

.cabinet-book-cover {
    width: 45px;
    height: 65px;
    object-fit: cover;
    border-radius: 4px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.cabinet-book-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
}

.cabinet-book-title {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cabinet-book-author {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* --- REVIEWS & RATING DETAILS --- */
.book-details-modal-content {
    background: rgba(255, 255, 255, 0.95) !important;
    backdrop-filter: blur(25px);
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.details-tab-btn {
    transition: all 0.3s;
}

.details-tab-btn:hover {
    color: var(--accent) !important;
}

.rev-star {
    transition: all 0.15s;
}

.rev-star:hover {
    transform: scale(1.2);
}

.review-item {
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.02);
    transition: transform 0.2s;
}

.review-item:hover {
    transform: translateX(3px);
}

/* --- TTS Reader Highlight Styles --- */
.tts-word {
    transition: background-color 0.15s ease, color 0.15s ease;
}

.tts-word-active {
    background-color: rgba(212, 175, 55, 0.35);
    /* Elegant gold glow */
    color: var(--accent) !important;
    /* Deep red text for accent */
    border-radius: 3px;
    opacity: 0.7;
}

.email-auth-form {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

#email-step,
#code-step {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.auth-input {
    width: 100%;
    max-width: 280px;
    padding: 12px 16px;
    margin-bottom: 15px;
    border: 2px solid #e0dbd1;
    /* Выраженный серо-бежевый бордюр */
    border-radius: 8px;
    background: #ffffff;
    /* Белый фон, чтобы выделялся на фоне контента */
    color: var(--text-main, #2c3e50);
    font-size: 1rem;
    outline: none;
    transition: all 0.3s ease;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05);
    /* Внутренняя тень */
}

.auth-input:hover {
    border-color: var(--primary, #cbb58b);
}

.auth-input:focus {
    border-color: var(--accent, #8b0000);
    box-shadow: 0 0 0 3px rgba(139, 0, 0, 0.12), inset 0 1px 3px rgba(0, 0, 0, 0.05);
}

.auth-btn {
    width: 100%;
    max-width: 280px;
    padding: 12px 15px;
    background: var(--accent, #8b0000);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s, transform 0.1s;
}

.auth-btn:active {
    transform: scale(0.98);
}

.auth-btn:hover {
    filter: brightness(1.1);
}

.auth-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.auth-code-msg {
    font-size: 0.9rem;
    color: var(--text-main, #2c3e50);
    text-align: center;
    margin-bottom: 15px;
}

.auth-back-btn {
    margin-top: 10px;
    background: none;
    border: none;
    color: var(--text-main, #2c3e50);
    opacity: 0.7;
    font-size: 0.85rem;
    text-decoration: underline;
    cursor: pointer;
}

.auth-back-btn:hover {
    opacity: 1;
}

/* ============================================================
   GOOGLE TRANSLATE & MACHINE TRANSLATION STYLES
   ============================================================ */

/* Prevent flash of untranslated content in EN mode */
html.translating-active body>*:not(#preloader) {
    opacity: 0 !important;
    pointer-events: none !important;
}

body>*:not(#preloader) {
    transition: opacity 0.25s ease-in-out;
}

/* Hide Google Translate Banner and elements */
.goog-te-banner-frame,
.goog-te-banner-frame.skiptranslate,
iframe.goog-te-banner-frame {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    width: 0 !important;
}

body {
    top: 0 !important;
    position: static !important;
}

.goog-te-gadget {
    display: none !important;
    height: 0 !important;
    width: 0 !important;
}

#google_translate_element {
    display: none !important;
    height: 0 !important;
    width: 0 !important;
}

.goog-tooltip {
    display: none !important;
}

.goog-tooltip:hover {
    display: none !important;
}

.goog-text-highlight {
    background-color: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

#goog-gt-tt,
#goog-gt-tt *,
.goog-te-balloon-frame,
.goog-te-menu-frame,
iframe.goog-te-menu-frame,
.goog-te-menu-value,
.goog-te-spinner,
.goog-te-spinner-animation,
.goog-te-spinner-path,
.goog-te-spinner-wrapper,
.goog-te-spinner-container,
.goog-te-spinner-parent {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    width: 0 !important;
    height: 0 !important;
}

/* Reader Images */
.page-inner img {
    max-width: 100%;
    height: auto;
    max-height: 80vh;
    object-fit: contain;
    display: block;
    margin: 10px auto;
}

/* Suppress Google Translate text highlight on click */
.goog-text-highlight,
font {
    background-color: transparent !important;
    box-shadow: none !important;
}

/* Telegram / Blog News styles based on Orthodox News theme */
@font-face {
    font-family: 'FuturaPT-Medium';
    src: url('fonts/FuturaPT-Medium.woff') format("woff");
    font-style: normal;
    font-weight: normal;
    font-display: swap;
}

#latest-news {
    background: #f2f2f2 !important;
}

.news_item {
    width: 340px;
    position: relative;
    margin-bottom: 30px;
    transition: .3s;
    padding: 15px;
    background: var(--white);
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.03);
    cursor: pointer;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.news_item:hover {
    transform: scale(1.1);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.08);
}

.news_date {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

.news_date_icon {
    display: inline-flex;
    align-items: center;
    margin-right: 6px;
}

.news_date_time {
    font-family: "FuturaPT-Medium", Arial, sans-serif;
    font-weight: 400;
    color: #959595;
    font-size: 12px;
    line-height: 1.2;
    margin-left: 4px;
}

.news_h3 {
    font-family: "FuturaPT-Medium", Arial, sans-serif;
    font-weight: 700;
    font-style: normal;
    color: #000000;
    font-size: 24px;
    line-height: 1.4;
    letter-spacing: 0px;
    margin-bottom: 15px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    text-overflow: ellipsis;
}

.news_text {
    font-family: "FuturaPT-Medium", Arial, sans-serif;
    font-style: normal;
    color: #878787;
    font-size: 14px;
    line-height: 1.6;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
}

.news_item.expanded .news_text {
    display: block;
    -webkit-line-clamp: unset;
}

.news_wrapper {
    display: flex;
    flex-wrap: wrap;
    max-width: 1200px;
    margin: 0 auto;
    justify-content: space-around;
}

/* About Modal Window styling */
.about-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
}

.about-modal.active {
    display: flex;
}

.about-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    transition: opacity 0.3s ease;
}

.about-modal-content {
    position: relative;
    background: var(--white);
    width: 90%;
    max-width: 750px;
    max-height: 85vh;
    border-radius: 20px;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.25);
    z-index: 10001;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(0, 0, 0, 0.05);
    animation: aboutModalShow 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.theme-dark .about-modal-content,
.theme-night .about-modal-content {
    background: #1e1e1e;
    color: #e0e0e0;
    border-color: rgba(255, 255, 255, 0.05);
}

@keyframes aboutModalShow {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.about-modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.04);
    border: none;
    font-size: 1.1rem;
    cursor: pointer;
    color: #888;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.about-modal-close:hover {
    background: rgba(0, 0, 0, 0.08);
    color: #333;
}

.theme-dark .about-modal-close,
.theme-night .about-modal-close {
    background: rgba(255, 255, 255, 0.04);
    color: #bbb;
}

.theme-dark .about-modal-close:hover,
.theme-night .about-modal-close:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

.about-modal-header {
    padding: 20px 24px 10px 24px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.theme-dark .about-modal-header,
.theme-night .about-modal-header {
    border-bottom-color: rgba(255, 255, 255, 0.05);
}

.about-modal-header h2 {
    font-family: 'Playfair Display', serif;
    font-size: 1.4rem;
    color: var(--text-main);
    margin: 0;
}

.about-modal-body {
    padding: 15px 24px 24px 24px;
    overflow-y: auto;
    font-size: 0.88rem;
    line-height: 1.5;
    color: var(--text-main);
}

.about-modal-body p {
    margin-bottom: 12px;
    text-align: left;
}

.about-highlight-box {
    background: linear-gradient(135deg, rgba(203, 181, 139, 0.15) 0%, rgba(203, 181, 139, 0.05) 100%);
    border-left: 4px solid #cbb58b;
    padding: 12px 16px;
    border-radius: 0 12px 12px 0;
    margin-bottom: 16px;
    font-weight: 500;
}

.about-section-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.1rem;
    margin: 20px 0 12px 0;
    color: #cbb58b;
    border-bottom: 1px dashed rgba(203, 181, 139, 0.3);
    padding-bottom: 4px;
}

.principles-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin: 14px 0;
}

@media (max-width: 600px) {
    .principles-grid {
        grid-template-columns: 1fr;
    }
}

.principle-card {
    background: rgba(0, 0, 0, 0.02);
    border: 1px solid rgba(0, 0, 0, 0.04);
    border-radius: 12px;
    padding: 12px;
    transition: all 0.2s ease;
}

.theme-dark .principle-card,
.theme-night .principle-card {
    background: rgba(255, 255, 255, 0.02);
    border-color: rgba(255, 255, 255, 0.04);
}

.principle-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.05);
    background: rgba(203, 181, 139, 0.05);
}

.principle-card h4 {
    margin: 0 0 6px 0;
    color: #cbb58b;
    font-size: 0.92rem;
    font-weight: 600;
}

.about-list {
    list-style: none;
    padding: 0;
    margin: 12px 0;
}

.about-list li {
    position: relative;
    padding-left: 24px;
    margin-bottom: 6px;
}

.about-list li::before {
    content: "•";
    position: absolute;
    left: 8px;
    color: #cbb58b;
    font-weight: bold;
}

/* Hide the old language hover dropdown */
.lang-dropdown,
.lang-selector:hover .lang-dropdown {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
}

/* Premium Language Selector Modal Styles */
.ortholib-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 12000;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 6vh;
    box-sizing: border-box;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.ortholib-modal.active {
    opacity: 1;
    visibility: visible;
}

.ortholib-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(18, 18, 18, 0.4);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.ortholib-modal-content {
    position: relative;
    background: #fdfcf7;
    /* Warm book paper background */
    border: 1px solid rgba(139, 0, 0, 0.1);
    border-radius: 24px;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 40px 24px 20px 24px;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.25);
    z-index: 12001;
    transform: scale(0.92) translateY(10px);
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    scrollbar-width: thin;
    scrollbar-color: var(--primary) transparent;
}

.ortholib-modal.active .ortholib-modal-content {
    transform: scale(1) translateY(0);
}

.ortholib-modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(0, 0, 0, 0.04);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1rem;
    color: var(--text-main);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s ease;
}

.ortholib-modal-close:hover {
    background: rgba(139, 0, 0, 0.08);
    color: var(--primary);
    transform: rotate(90deg) scale(1.05);
}

.ortholib-modal-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.5rem;
    margin: 0 0 20px 0;
    color: var(--text-main);
    text-align: center;
    letter-spacing: 0.5px;
    border-bottom: 2px solid rgba(139, 0, 0, 0.08);
    padding-bottom: 10px;
}

.ortholib-lang-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
}

.ortholib-lang-card {
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 12px;
    padding: 10px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    text-align: left;
    outline: none;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.01);
}

.ortholib-lang-card:hover {
    background: rgba(139, 0, 0, 0.03);
    border-color: rgba(139, 0, 0, 0.15);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(139, 0, 0, 0.05);
}

.ortholib-lang-card.active {
    background: rgba(139, 0, 0, 0.07);
    border-color: var(--primary, #8b0000);
    box-shadow: 0 5px 15px rgba(139, 0, 0, 0.1);
}

.ortholib-lang-flag {
    font-size: 1.6rem;
    line-height: 1;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
    transition: transform 0.2s ease;
}

.ortholib-lang-card:hover .ortholib-lang-flag {
    transform: scale(1.1);
}

.ortholib-lang-name {
    font-family: 'Inter', sans-serif;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-main);
    line-height: 1.2;
}

body.ortholib-modal-open {
    overflow: hidden !important;
}

/* Custom Scrollbar for Modal content */
.ortholib-modal-content::-webkit-scrollbar {
    width: 6px;
}

.ortholib-modal-content::-webkit-scrollbar-track {
    background: transparent;
}

.ortholib-modal-content::-webkit-scrollbar-thumb {
    background: var(--primary, #8b0000);
    border-radius: 3px;
}

@media (max-width: 768px) {
    .ortholib-modal-content {
        padding: 35px 15px 16px 15px;
        width: 92%;
    }

    .ortholib-lang-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 8px;
    }
}

@media (max-width: 480px) {
    .ortholib-lang-grid {
        grid-template-columns: repeat(auto-fill, minmax(105px, 1fr));
        gap: 6px;
    }

    .ortholib-lang-card {
        padding: 8px 10px;
        border-radius: 10px;
        gap: 6px;
    }

    .ortholib-lang-flag {
        font-size: 1.4rem;
    }

    .ortholib-lang-name {
        font-size: 0.8rem;
    }
}

/* PDF Badge & Reader Container Styles */
.book-volume {
    position: relative;
}

.pdf-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: #e74c3c;
    color: #fff;
    font-size: 0.75rem;
    font-weight: bold;
    padding: 3px 8px;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    z-index: 10;
    pointer-events: none;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-family: 'Inter', sans-serif;
}

#pdf-container {
    width: 100%;
    height: 100%;
    background: #f5f5f5;
    border-radius: 4px;
    overflow: hidden;
}

#pdf-iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* ============ Footer Redesign ============ */
.footer {
    width: 100% !important;
    background: linear-gradient(180deg, #090815 0%, #05040a 100%) !important;
    border-top: 1px solid rgba(255, 255, 255, 0.08) !important;
    padding: 60px 40px 30px 40px !important;
    box-sizing: border-box !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    gap: 40px !important;
    min-height: auto !important;
}

.footer-main-grid {
    display: grid;
    grid-template-columns: 2.5fr 1.8fr 2fr;
    gap: 40px;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

.footer-brand-column {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 20px;
}

.footer_logo_container,
a.footer_logo_container {
    display: flex !important;
    align-items: center !important;
    text-decoration: none !important;
    color: #ffffff !important;
    transition: transform 0.3s ease;
    margin-bottom: 0 !important;
}

.footer_logo_container:hover {
    transform: translateY(-2px);
}

.footer_logo {
    width: 65px !important;
    height: auto !important;
    flex-shrink: 0;
    filter: drop-shadow(0 4px 10px rgba(187, 157, 75, 0.2));
}

.footer_title {
    color: #ffffff !important;
    font-family: 'Playfair Display', serif !important;
    font-size: 1.05rem !important;
    line-height: 1.4 !important;
    text-transform: none !important;
    font-weight: 600 !important;
    margin-left: 15px !important;
    text-align: left !important;
}

.footer-links-column {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.footer-links-title,
.footer-app-title {
    color: #bb9d4b;
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin: 0 0 5px 0;
}

.footer-links-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.footer_link,
a.footer_link {
    color: rgba(255, 255, 255, 0.75) !important;
    font-family: 'Inter', sans-serif !important;
    font-size: 0.95rem !important;
    border-bottom: none !important;
    transition: color 0.25s ease !important;
    text-decoration: none !important;
    width: fit-content;
    margin: 0 !important;
}

.footer_link:hover,
a.footer_link:hover {
    color: #bb9d4b !important;
}

.footer-app-column {
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: flex-start;
}

.app-downloads {
    display: flex !important;
    flex-direction: column !important;
    gap: 10px !important;
    width: 100% !important;
    max-width: 240px !important;
}

.app-store-btn,
.play-store-btn {
    display: flex !important;
    align-items: center !important;
    background: rgba(255, 255, 255, 0.03) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    color: #ffffff !important;
    padding: 8px 16px !important;
    border-radius: 12px !important;
    text-decoration: none !important;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1) !important;
    width: 100% !important;
    box-sizing: border-box !important;
    backdrop-filter: blur(10px);
}

.app-store-btn:hover,
.play-store-btn:hover {
    background: rgba(255, 255, 255, 0.08) !important;
    border-color: rgba(187, 157, 75, 0.5) !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3) !important;
}

.app-store-btn svg,
.play-store-btn svg {
    color: #ffffff;
    opacity: 0.9;
    transition: color 0.3s;
    flex-shrink: 0;
}

.app-store-btn:hover svg,
.play-store-btn:hover svg {
    color: #bb9d4b;
}

.app-btn-text {
    margin-left: 12px !important;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.app-btn-small {
    font-size: 0.65rem !important;
    opacity: 0.6 !important;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    line-height: 1.2 !important;
}

.app-btn-large {
    font-size: 0.95rem !important;
    font-weight: 600 !important;
    line-height: 1.2 !important;
}

/* Stats Badges */
.footer-stats-badges {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.stat-badge {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.6);
    font-family: 'Inter', sans-serif;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.stat-badge:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(187, 157, 75, 0.3);
}

.stat-badge strong {
    color: #bb9d4b;
    font-weight: 600;
}

/* Pulsing dot for online status */
.online-dot {
    width: 7px;
    height: 7px;
    background-color: #2ecc71;
    border-radius: 50%;
    display: inline-block;
    position: relative;
    margin-right: 2px;
}

.online-dot::after {
    content: '';
    width: 100%;
    height: 100%;
    background-color: #2ecc71;
    border-radius: 50%;
    position: absolute;
    top: 0;
    left: 0;
    animation: online-pulse 1.8s infinite ease-in-out;
}

@keyframes online-pulse {
    0% {
        transform: scale(1);
        opacity: 0.8;
    }

    100% {
        transform: scale(2.6);
        opacity: 0;
    }
}

/* Bottom Copyright Bar */
.footer-bottom-bar {
    width: 100%;
    max-width: 1200px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding-top: 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.footer_copyright {
    color: rgba(255, 255, 255, 0.4) !important;
    font-family: 'Inter', sans-serif !important;
    font-size: 0.8rem !important;
    margin: 0 !important;
}

@media (max-width: 900px) {
    .footer-main-grid {
        grid-template-columns: 1fr;
        gap: 30px;
    }

    .footer {
        padding: 40px 20px 20px 20px !important;
        gap: 30px !important;
    }

    .footer-bottom-bar {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
}


/* ============ Back to Top Button ============ */
.back_to_top {
    display: block;
    width: 48px;
    height: 48px;
    position: fixed;
    right: 40px;
    color: #ffffff;
    background: #cbb58b;
    bottom: -50px;
    transition: .3s;
    visibility: hidden;
    opacity: 0;
    cursor: pointer;
    z-index: 500;
    border: none;
    border-radius: 4px;
}

.back_to_top:after {
    width: 27px;
    height: 11px;
    background: transparent url("data:image/svg+xml,%3Csvg width='27' height='11' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M4.50495 5.78413L0.205241 1.25827C-0.0684138 0.970375 -0.0684138 0.503596 0.205241 0.215836C0.478652 -0.0719461 0.922098 -0.071946 1.19549 0.215837L5.00007 4.22052L8.80452 0.215953C9.07805 -0.0718292 9.52145 -0.0718292 9.79486 0.215953C10.0684 0.503736 10.0684 0.970492 9.79486 1.25839L5.49508 5.78425C5.35831 5.92814 5.17925 6 5.00009 6C4.82085 6 4.64165 5.928 4.50495 5.78413Z' fill='%23fff'/%3E%3C/svg%3E%0A") no-repeat center / cover;
    position: absolute;
    right: 10px;
    bottom: 50%;
    transform: translateY(50%) rotate(180deg);
    content: '';
    display: block;
}

.back_to_top_visible {
    visibility: visible;
    opacity: 1;
    bottom: 40px;
}

.back_to_top:hover {
    background: #a8884a;
}

@media (max-width: 768px) {
    .back_to_top {
        width: 40px;
        height: 40px;
        right: 5%;
    }

    .back_to_top:after {
        right: 6px;
    }
}

/* ============ Dynamic Header & Mobile Menu Restructuring ============ */

/* Bible icon styling */
.header-bible-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    font-size: 1.6rem !important;
    transition: transform 0.2s ease, opacity 0.2s ease;
    margin-right: 5px;
    cursor: pointer;
    color: #ffffff !important;
}
.header-bible-link:hover {
    transform: scale(1.1);
    opacity: 0.9;
}

/* User profile header inside mobile menu */
.menu-header-user {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    justify-content: center;
    text-align: center;
}
.menu-avatar {
    display: none !important;
}
.menu-user-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
    align-items: center;
}
.menu-user-name {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-main);
    margin: 0;
    font-family: 'Inter', sans-serif;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.menu-user-email {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Reading Now list inside mobile menu */
.menu-cabinet-section {
    padding: 15px 20px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}
.menu-section-title {
    font-size: 0.9rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--accent);
    margin-bottom: 12px;
    font-family: 'Inter', sans-serif;
    text-align: left;
}
.menu-reading-now-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.menu-reading-book-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.02);
    border: 1px solid rgba(0, 0, 0, 0.04);
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.1s ease;
    text-align: left;
}
.menu-reading-book-item:hover {
    background: rgba(0, 0, 0, 0.04);
    transform: translateY(-1px);
}
.menu-book-cover {
    width: 38px;
    height: 54px;
    border-radius: 4px;
    object-fit: cover;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.menu-book-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}
.menu-book-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.menu-book-author {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.menu-progress-container {
    margin-top: 4px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.menu-progress-bar {
    width: 100%;
    height: 4px;
    background: #e2e8f0;
    border-radius: 2px;
    overflow: hidden;
}
.menu-progress-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 2px;
}
.menu-progress-text {
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* Logout styling in menu */
.menu-logout-btn {
    width: 100%;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    background: rgba(0,0,0,0.02);
    color: #b33;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}
.menu-logout-btn:hover {
    background: #fee2e2 !important;
    border-color: #fca5a5 !important;
    color: #991b1b !important;
}

/* Make sure menu-toggle is visible and formatted properly in dark header */
#menu-toggle span {
    background: #ffffff !important;
}

/* Cabinet Stats inside Menu */
#menu-cabinet-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
    background: rgba(0, 0, 0, 0.02);
    border: 1px solid rgba(0, 0, 0, 0.04);
    border-radius: 8px;
    padding: 6px;
    text-align: center;
}
#menu-cabinet-stats .stat-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
}
#menu-cabinet-stats .stat-val {
    font-size: 1rem;
    font-weight: 700;
    color: var(--accent);
    line-height: 1.1;
}
#menu-cabinet-stats .stat-lbl {
    font-size: 0.6rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.2px;
    margin-top: 0;
}

/* Cabinet Tabs inside Menu */
#menu-cabinet-tabs {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
}
#menu-cabinet-tabs .cabinet-tab-btn {
    background: rgba(0, 0, 0, 0.02);
    border: 1px solid rgba(0, 0, 0, 0.04);
    border-radius: 8px;
    padding: 8px 4px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-main);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}
#menu-cabinet-tabs .cabinet-tab-btn:hover {
    background: rgba(0, 0, 0, 0.04);
}
#menu-cabinet-tabs .cabinet-tab-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #ffffff;
    box-shadow: 0 4px 10px rgba(187, 157, 75, 0.2);
}

/* Book list scroll wrapper in menu */
#menu-cabinet-books-list {
    max-height: 250px;
    overflow-y: auto;
    padding-right: 4px;
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
#menu-cabinet-books-list::-webkit-scrollbar {
    width: 4px;
}
#menu-cabinet-books-list::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 4px;
}

/* Readability fixes for mobile menu */
#mobile-menu {
    background: #ffffff !important; /* Fully opaque background to prevent bleed-through */
    color: #1e293b !important;
}
#mobile-menu .settings-header {
    background: #f8fafc !important;
    border-bottom: 1px solid #e2e8f0 !important;
}
#mobile-menu .settings-header h3,
#mobile-menu .menu-user-name {
    color: #0f172a !important; /* Extremely dark/high-contrast for headers */
}
#mobile-menu .menu-user-email {
    color: #475569 !important;
}
#mobile-menu .mobile-nav-links a {
    color: #1e293b !important;
}
#mobile-menu .mobile-link-title {
    color: #0f172a !important;
    font-weight: 700 !important;
}
#mobile-menu .mobile-link-desc {
    color: #475569 !important; /* Darker gray for description contrast */
}
#mobile-menu .menu-book-title {
    color: #0f172a !important;
}
#mobile-menu .menu-book-author {
    color: #475569 !important;
}
#mobile-menu .menu-progress-text {
    color: #475569 !important;
}

/* Dark mode support for mobile menu readability */
.theme-dark #mobile-menu,
.theme-night #mobile-menu,
.theme-dark .settings-panel,
.theme-night .settings-panel {
    background: #121216 !important; /* Deep opaque dark background */
    color: #f1f5f9 !important;
}
.theme-dark #mobile-menu .settings-header,
.theme-night #mobile-menu .settings-header {
    background: #1a1a22 !important;
    border-bottom: 1px solid #2d2d3d !important;
}
.theme-dark #mobile-menu .settings-header h3,
.theme-dark #mobile-menu .menu-user-name,
.theme-night #mobile-menu .settings-header h3,
.theme-night #mobile-menu .menu-user-name {
    color: #ffffff !important;
}
.theme-dark #mobile-menu .menu-user-email,
.theme-night #mobile-menu .menu-user-email {
    color: #94a3b8 !important;
}
.theme-dark #mobile-menu .mobile-nav-links a,
.theme-night #mobile-menu .mobile-nav-links a {
    color: #e2e8f0 !important;
}
.theme-dark #mobile-menu .mobile-link-title,
.theme-night #mobile-menu .mobile-link-title {
    color: #ffffff !important;
}
.theme-dark #mobile-menu .mobile-link-desc,
.theme-night #mobile-menu .mobile-link-desc {
    color: #94a3b8 !important;
}
.theme-dark #mobile-menu .menu-book-title,
.theme-night #mobile-menu .menu-book-title {
    color: #ffffff !important;
}
.theme-dark #mobile-menu .menu-book-author,
.theme-night #mobile-menu .menu-book-author,
.theme-dark #mobile-menu .menu-progress-text,
.theme-night #mobile-menu .menu-progress-text {
    color: #94a3b8 !important;
}

/* Desktop-only text navigation links in header */
.header-link-text {
    display: none;
}
.header-icon-img {
    display: block;
}

@media (min-width: 769px) {
    .header-link-text {
        display: inline !important;
        color: #ffffff !important;
        font-weight: 500 !important;
        font-size: 0.95rem !important;
        font-family: 'Inter', sans-serif !important;
        transition: color 0.2s ease !important;
    }
    .header-actions a.header-bible-link:hover .header-link-text,
    .header-actions a.header-music-link:hover .header-link-text,
    .header-actions a.header-bible-link.active .header-link-text,
    .header-actions a.header-music-link.active .header-link-text {
        color: #bb9d4b !important;
    }
    .header-icon-img {
        display: none !important;
    }
    .header-actions a.header-bible-link,
    .header-actions a.header-music-link {
        width: auto !important;
        height: auto !important;
        border-radius: 4px !important;
        padding: 6px 12px !important;
        background: transparent !important;
        text-decoration: none !important;
    }
    .header-actions a.header-bible-link:hover,
    .header-actions a.header-music-link:hover {
        background-color: rgba(255, 255, 255, 0.05) !important;
        transform: none !important;
    }
    .header-actions a.header-bible-link.active,
    .header-actions a.header-music-link.active {
        background-color: rgba(255, 255, 255, 0.08) !important;
        border-bottom: 2px solid #bb9d4b !important;
        border-radius: 4px 4px 0 0 !important;
        transform: none !important;
    }
}