:root {
    --bg-color: #0b0b0c;
    --text-primary: #e5e5eb;
    --text-secondary: #8e8e93;
    --accent: #dc1e1e;
    --border-card: rgba(255, 255, 255, 0.08);
    --font-heading: 'Cormorant Garamond', serif;
    --font-body: 'PT Serif', serif;
    --font-ui: 'Montserrat', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: var(--font-body);
    line-height: 1.8;
    overflow: hidden;
}

.reader-container {
    display: flex;
    width: 100vw;
    height: 100vh;
}

.reader-sidebar {
    width: 320px;
    background-color: #0f0f11;
    border-right: 1px solid var(--border-card);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 30px;
    z-index: 10;
    flex-shrink: 0;
}

.sidebar-header h2 {
    font-family: var(--font-heading);
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--text-primary);
    margin-top: 15px;
}

.sidebar-sub {
    font-family: var(--font-ui);
    font-size: 11px;
    color: var(--accent);
    letter-spacing: 2px;
    text-transform: uppercase;
    font-weight: 700;
}

.back-link {
    font-family: var(--font-ui);
    font-size: 12px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.3s;
}

.back-link:hover {
    color: var(--accent);
}

.chapter-menu {
    flex-grow: 1;
    margin-top: 40px;
    overflow-y: auto;
}

.chapter-menu h3 {
    font-family: var(--font-ui);
    font-size: 11px;
    color: var(--text-secondary);
    letter-spacing: 2px;
    margin-bottom: 15px;
}

.chapter-links {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.nav-ch-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-family: var(--font-ui);
    font-size: 13px;
    font-weight: 500;
    transition: all 0.3s;
    border-left: 2px solid transparent;
    padding-left: 10px;
}

.nav-ch-link:hover, .nav-ch-link.active {
    color: var(--text-primary);
    border-left-color: var(--accent);
}

.audio-control-panel {
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--border-card);
    border-radius: 12px;
    padding: 20px;
    margin-top: 20px;
}

.audio-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
}

.pulse-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: var(--accent);
    display: inline-block;
    box-shadow: 0 0 10px var(--accent);
    transition: all 0.3s;
}

.pulse-indicator.paused {
    background-color: #555;
    box-shadow: none;
}

.track-title {
    font-family: var(--font-ui);
    font-size: 12px;
    font-weight: 700;
    color: var(--text-primary);
}

.visualizer-container {
    width: 100%;
    height: 60px;
    background: rgba(0,0,0,0.3);
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 15px;
}

#visualizer {
    width: 100%;
    height: 100%;
}

.btn-audio {
    width: 100%;
    font-family: var(--font-ui);
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    background: var(--accent);
    color: #fff;
    border: none;
    padding: 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-audio:hover {
    background: #ff2a2a;
}

.volume-slider-container {
    margin-top: 15px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.volume-slider-container label {
    font-family: var(--font-ui);
    font-size: 11px;
    color: var(--text-secondary);
}

#volume {
    width: 100%;
    accent-color: var(--accent);
    cursor: pointer;
}

.audio-tip {
    font-family: var(--font-ui);
    font-size: 9px;
    color: #555558;
    margin-top: 10px;
    text-align: center;
    line-height: 1.3;
}

.reading-pane {
    flex-grow: 1;
    overflow-y: auto;
    padding: 80px 60px;
    background-color: var(--bg-color);
}

.book-container {
    max-width: 760px;
    margin: 0 auto;
}

.reader-page {
    padding-bottom: 120px;
    margin-bottom: 80px;
    border-bottom: 1px solid var(--border-card);
}

.reader-page:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.reader-page h2 {
    font-family: var(--font-heading);
    font-size: 40px;
    color: var(--text-primary);
    margin-bottom: 40px;
    line-height: 1.2;
    border-bottom: 1px solid rgba(220, 30, 30, 0.2);
    padding-bottom: 10px;
}

.reader-page h3 {
    font-family: var(--font-heading);
    font-size: 24px;
    color: var(--accent);
    margin-top: 40px;
    margin-bottom: 20px;
}

.reader-page p {
    font-size: 18px;
    margin-bottom: 24px;
    color: #d1d1d6;
    text-align: justify;
}

.drop-cap::first-letter {
    font-family: var(--font-heading);
    float: left;
    font-size: 72px;
    line-height: 52px;
    padding-top: 4px;
    padding-right: 10px;
    color: var(--accent);
    font-weight: 700;
}

.illustration {
    width: 100%;
    margin: 40px 0;
    border: 1px solid var(--border-card);
    border-radius: 8px;
    overflow: hidden;
    background: #000;
}

.illustration img {
    width: 100%;
    height: auto;
    display: block;
    filter: grayscale(1) contrast(1.3);
}

.mobile-nav-bar {
    display: none;
}

/* Cover styling */
.reader-page.cover {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 80vh;
    border-bottom: 1px solid var(--border-card);
}

.reader-page.cover .cover-image {
    width: 320px;
    height: 430px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    border: 1px solid var(--border-card);
    border-radius: 12px;
    position: relative;
    box-shadow: 0 30px 60px rgba(0,0,0,0.8);
}

.cover-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0.2) 60%);
    border-radius: 12px;
}

.cover-content {
    position: absolute;
    bottom: 40px;
    left: 20px;
    right: 20px;
    text-align: center;
}

.cover-content h1 {
    font-family: var(--font-heading);
    font-size: 32px;
    color: var(--accent);
    margin-bottom: 5px;
    letter-spacing: 1px;
}

.cover-content .subtitle {
    font-family: var(--font-ui);
    font-size: 12px;
    color: var(--text-primary);
    letter-spacing: 4px;
}

.cover-content .tagline {
    font-family: var(--font-heading);
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* Lock overlays */
.reader-page.locked {
    position: relative;
}

.reader-page.locked .content-wrapper {
    filter: blur(8px);
    pointer-events: none;
    user-select: none;
    opacity: 0.3;
}

.lock-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(11, 11, 12, 0.7);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 5;
    padding: 20px;
}

.lock-card {
    background: rgba(20, 20, 22, 0.95);
    border: 1px solid var(--accent);
    box-shadow: 0 0 35px rgba(220, 30, 30, 0.2);
    border-radius: 16px;
    padding: 45px 30px;
    max-width: 480px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.lock-icon {
    font-size: 40px;
    margin-bottom: 5px;
}

.lock-card h3 {
    font-family: var(--font-heading);
    font-size: 24px;
    color: var(--text-primary);
    margin: 0 !important;
    border-bottom: none !important;
    padding-bottom: 0 !important;
}

.lock-card p {
    font-size: 14px !important;
    line-height: 1.6 !important;
    color: var(--text-secondary) !important;
    margin-bottom: 10px !important;
    text-align: center !important;
}

.btn-lock-unlock {
    display: inline-block;
    background: var(--accent);
    color: #fff;
    text-decoration: none;
    font-family: var(--font-ui);
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    padding: 12px 30px;
    border-radius: 30px;
    box-shadow: 0 10px 20px rgba(220, 30, 30, 0.3);
    transition: all 0.3s;
    cursor: pointer;
    border: none;
}

.btn-lock-unlock:hover {
    background: #ff2a2a;
    transform: translateY(-2px);
    box-shadow: 0 12px 25px rgba(220, 30, 30, 0.5);
}

/* Mobile responsive styling */
@media (max-width: 968px) {
    .reader-container {
        flex-direction: column;
    }
    
    .reading-pane {
        padding: 80px 20px 80px 20px;
        height: 100vh;
        overflow-y: auto;
    }
    
    .reader-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 60px;
        padding: 0 15px;
        border-right: none;
        border-bottom: 1px solid var(--border-card);
        background: #0f0f11;
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        z-index: 1000;
    }
    
    .sidebar-header, .chapter-menu, .audio-tip, .visualizer-container, .volume-slider-container {
        display: none;
    }
    
    .user-auth-panel {
        background: transparent;
        border: none;
        padding: 0;
        margin: 0;
        width: auto;
    }
    
    .auth-title {
        display: none;
    }
    
    .user-info {
        margin-bottom: 0;
        gap: 8px;
    }
    
    .user-avatar {
        width: 30px;
        height: 30px;
    }
    
    .user-name {
        font-size: 11px;
    }
    
    .access-status {
        font-size: 9px;
    }
    
    .btn-logout {
        padding: 4px 8px;
        font-size: 9px;
        width: auto;
        margin-top: 0;
    }
    
    .audio-control-panel {
        width: auto;
        margin-top: 0;
        padding: 0;
        display: flex;
        align-items: center;
        gap: 10px;
        border: none;
        background: transparent;
    }
    
    .audio-header {
        margin-bottom: 0;
    }
    
    .track-title {
        display: none;
    }
    
    .btn-audio {
        width: auto;
        padding: 6px 12px;
        font-size: 10px;
        border-radius: 4px;
    }
    
    .mobile-nav-bar {
        display: flex;
        justify-content: space-between;
        align-items: center;
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        background: rgba(11,11,12,0.95);
        backdrop-filter: blur(15px);
        -webkit-backdrop-filter: blur(15px);
        padding: 10px 20px;
        border-top: 1px solid var(--border-card);
        z-index: 1000;
        height: 60px;
    }
    
    .nav-btn {
        background: var(--accent);
        color: #fff;
        border: none;
        padding: 8px 16px;
        border-radius: 4px;
        cursor: pointer;
        font-family: var(--font-ui);
        font-size: 12px;
        font-weight: 700;
    }
    
    #page-indicator {
        font-family: var(--font-ui);
        font-size: 13px;
        font-weight: 700;
        color: var(--text-primary);
    }
    
    .reader-page h2 {
        font-size: 28px;
        margin-bottom: 25px;
    }
    
    .reader-page p {
        font-size: 16px;
    }
    
    .lock-card {
        padding: 25px 20px;
    }
}

/* Authorization Panel and Lock Enhancements */
.lock-divider {
    width: 100%;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    line-height: 0.1em;
    margin: 15px 0;
}
.lock-divider span {
    background: #141416;
    padding: 0 10px;
    font-size: 11px;
    color: var(--text-secondary);
    font-family: var(--font-ui);
    text-transform: uppercase;
    letter-spacing: 1px;
}
.telegram-login-container {
    margin-top: 10px;
    display: flex;
    justify-content: center;
}
.login-error-msg {
    color: var(--accent);
    font-family: var(--font-ui);
    font-size: 11px;
    margin-top: 5px;
    height: 15px;
}
.user-auth-panel {
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--border-card);
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 15px;
}
.auth-title {
    font-family: var(--font-ui);
    font-size: 10px;
    text-transform: uppercase;
    color: var(--text-secondary);
    letter-spacing: 1px;
    margin-bottom: 8px;
}
.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}
.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #333;
    border: 1px solid var(--border-card);
}
.user-details {
    display: flex;
    flex-direction: column;
}
.user-name {
    font-family: var(--font-ui);
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
}
.access-status {
    font-family: var(--font-ui);
    font-size: 11px;
    color: var(--text-secondary);
}
.access-status.granted {
    color: #4cd964;
    font-weight: 700;
}
.btn-logout {
    width: 100%;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border-card);
    color: var(--text-secondary);
    font-family: var(--font-ui);
    font-size: 11px;
    font-weight: 700;
    padding: 6px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s;
}
.btn-logout:hover {
    background: rgba(220, 30, 30, 0.1);
    border-color: var(--accent);
    color: var(--accent);
}
}
