html {
    scroll-behavior: smooth;
}
:root {
    --primary-color: #667eea;
    --secondary-color: #764ba2;
    --text-color: #212529; /* Dark gray for text */
    --text-color-muted: #6c757d; /* Lighter gray for subtitles */
    --bg-color: #f8f9fa; /* Light gray page background */
    --bg-surface: white; /* White for cards, headers, etc. */
    --border-color: #dee2e6; /* Light border color */
    --heading-font: 'Lora', serif;
    --body-font: 'Poppins', sans-serif;
    --success-color: #28a745;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --gradient-bg: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
}

html[data-theme='dark'] {
    --primary-color: #7a8efb;
    --secondary-color: #8f6bc8;
    --text-color: #ecf0f1;
    --text-color-muted: #95a5a6;
    --bg-color: #121212;
    --bg-surface: #1e1e1e;
    --border-color: #333;
    --success-color: #34c759;
    --warning-color: #ffc107;
    --danger-color: #ff453a;
    --gradient-bg: linear-gradient(135deg, #2c2c2c 0%, #1a1a1a 100%);
}

body {
    margin: 0;
    font-family: var(--body-font);
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
}
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}
.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-surface);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}
.header-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    gap: 40px;
}
.theme-control-area {
    display: flex;
    flex-direction: column;
    align-items: center;
}
.theme-switcher {
    background: none;
    border: 2px solid var(--border-color);
    color: var(--text-color);
    padding: 8px 12px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9em;
    transition: all 0.3s ease;
}
.theme-switcher:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}
.version-tag {
    font-size: 0.7em;
    color: var(--text-color-muted);
    margin-top: 2px;
    font-family: var(--body-font);
}
.logo {
    font-family: var(--heading-font);
    font-size: 1.8em;
    font-weight: 700;
    text-decoration: none;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.header-user-name {
    font-weight: 600;
    color: var(--text-color);
    display: none; /* Hidden by default */
    align-items: center;
    gap: 8px;
}
.header-user-name::before {
    content: '👤';
    font-size: 1.2em;
}
.header-auth-controls {
    display: flex;
    gap: 10px;
}
.dashboard-btn {
    font-family: var(--body-font);
    font-weight: 600;
    text-decoration: none;
    color: var(--primary-color);
    background: var(--bg-surface);
    border: 2px solid var(--primary-color);
    padding: 10px 20px;
    border-radius: 25px;
    transition: all 0.3s ease;
    cursor: pointer;
}
.dashboard-btn:hover {
    background: var(--primary-color);
    color: white;
}
.sign-out-btn {
    /* This will share styles with sign-in-btn but we can override */
    cursor: pointer;
    border: none;
}
.sign-in-btn {
    font-family: var(--body-font);
    font-weight: 600;
    text-decoration: none;
    color: #fff;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    padding: 12px 24px;
    border-radius: 25px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}
.sign-in-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
    color: #fff;
    text-decoration: none;
}

/* Hero Section */
.hero {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    padding: 100px 20px;
    text-align: center;
    position: relative;
    overflow: hidden;
}
.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grid" width="10" height="10" patternUnits="userSpaceOnUse"><path d="M 10 0 L 0 0 0 10" fill="none" stroke="rgba(255,255,255,0.1)" stroke-width="0.5"/></pattern></defs><rect width="100" height="100" fill="url(%23grid)"/></svg>');
    animation: float 20s ease-in-out infinite;
}
@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-20px); }
}
.hero-content {
    position: relative;
    z-index: 2;
    max-width: 800px;
    margin: 0 auto;
}
.hero h1 {
    font-family: var(--heading-font);
    font-size: clamp(3em, 8vw, 4.5em);
    margin-bottom: 20px;
    line-height: 1.2;
    text-shadow: 0 2px 10px rgba(0,0,0,0.3);
    color: white;
}
.hero p {
    font-size: clamp(1.1em, 3vw, 1.4em);
    font-weight: 300;
    margin: 0 auto 40px auto;
    opacity: 0.95;
    max-width: 600px;
    text-shadow: 0 1px 5px rgba(0,0,0,0.2);
    color: white;
}
.hero-cta {
    display: inline-block;
    background: white;
    color: var(--primary-color);
    padding: 15px 35px;
    border-radius: 30px;
    text-decoration: none;
    font-weight: 600;
    font-size: 1.1em;
    transition: all 0.3s ease;
    box-shadow: 0 8px 25px rgba(0,0,0,0.2);
    margin: 0 8px 8px 0;
    min-width: 200px;
    text-align: center;
}
.hero-cta:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 35px rgba(0,0,0,0.3);
    text-decoration: none;
}

.hero-cta.green-btn {
    background: #28a745;
    color: white;
    box-shadow: 0 8px 25px rgba(40, 167, 70, 0.4);
}

.hero-cta.blue-btn {
    background: #17a2b8;
    color: white;
    box-shadow: 0 8px 25px rgba(23, 162, 184, 0.4);
}

.hero-cta.blue-btn:hover {
    background: #138496;
    color: white;
}

/* Labs Grid Section */
.labs-section {
    padding: 100px 20px;
    background: var(--bg-color);
}
.labs-header {
    text-align: center;
    margin-bottom: 80px;
}
.labs-header h2 {
    font-family: var(--heading-font);
    font-size: clamp(2.5em, 6vw, 3.5em);
    margin-bottom: 20px;
    color: var(--primary-color);
}
.labs-subtitle {
    font-size: 1.2em;
    color: var(--text-color-muted);
    max-width: 600px;
    margin: 0 auto;
}

.labs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 40px;
    margin-top: 60px;
}

.lab-card {
    background: var(--bg-surface);
    border-radius: 20px;
    padding: 40px 30px;
    text-align: center;
    transition: all 0.4s ease;
    border: 2px solid var(--border-color);
    position: relative;
    overflow: hidden;
}
.lab-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(102, 126, 234, 0.1), transparent);
    transition: left 0.6s ease;
}
.lab-card:hover::before {
    left: 100%;
}
.lab-card:hover {
    transform: translateY(-10px);
    border-color: var(--primary-color);
    box-shadow: 0 20px 40px rgba(102, 126, 234, 0.2);
}

.lab-icon {
    font-size: 4em;
    margin-bottom: 20px;
    display: block;
}
.lab-card h3 {
    font-family: var(--heading-font);
    font-size: 1.8em;
    margin-bottom: 15px;
    color: var(--primary-color);
}
.lab-description {
    color: var(--text-color-muted);
    margin-bottom: 30px;
    line-height: 1.7;
}
.lab-status {
    display: inline-block;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9em;
    font-weight: 600;
    margin-bottom: 25px;
}
.status-active {
    background: rgba(40, 167, 69, 0.1);
    color: var(--success-color);
    border: 1px solid rgba(40, 167, 69, 0.2);
}
.status-beta {
    background: rgba(255, 193, 7, 0.1);
    color: #856404;
    border: 1px solid rgba(255, 193, 7, 0.2);
}
.status-coming {
    background: rgba(108, 117, 125, 0.1);
    color: #6c757d;
    border: 1px solid rgba(108, 117, 125, 0.2);
}

.lab-btn {
    display: inline-block;
    padding: 12px 30px;
    border-radius: 25px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    border: 2px solid var(--border-color);
    color: var(--primary-color);
    background: var(--bg-surface);
    margin: 0 4px 8px 0;
    min-width: 120px;
    text-align: center;
}
.lab-btn:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
    border-color: var(--primary-color);
    text-decoration: none;
}
.lab-btn.active {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    border-color: transparent;
}
.lab-btn.active:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
    color: white;
}
.lab-btn:disabled {
    background: #f8f9fa;
    color: #6c757d;
    border-color: #dee2e6;
    cursor: not-allowed;
    transform: none;
}
.lab-btn:disabled:hover {
    background: #f8f9fa;
    color: #6c757d;
    transform: none;
}

/* Features Section */
.features {
    padding: 100px 20px;
    background: var(--gradient-bg);
}
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 40px;
    margin-top: 60px;
}
.feature-card {
    background: var(--bg-surface);
    padding: 30px;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
}
.feature-icon {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px auto;
    font-size: 1.5em;
    color: white;
}
.feature-card h4 {
    font-family: var(--heading-font);
    margin-bottom: 15px;
    color: var(--primary-color);
}
.feature-card p {
    color: var(--text-color-muted);
    line-height: 1.6;
}

/* Demo Showcase */
.demo-showcase {
    padding: 80px 20px;
    background: var(--gradient-bg);
}

.demo-card {
    background: var(--bg-surface);
    border-radius: 20px;
    padding: 40px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.demo-card.reading {
    border-color: #28a745;
}

.demo-card.writing {
    border-color: var(--primary-color);
}

.demo-card h3 {
    font-family: var(--heading-font);
    margin-bottom: 15px;
}

.demo-card.reading h3 {
    color: #28a745;
}

.demo-card.writing h3 {
    color: var(--primary-color);
}

.demo-card p {
    color: var(--text-color-muted);
    margin-bottom: 25px;
    line-height: 1.6;
}

.demo-card a {
    display: inline-block;
    padding: 15px 30px;
    border-radius: 25px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    color: white;
}

.demo-card.reading a {
    background: #28a745;
}

.demo-card.reading a:hover {
    background: #218838;
    transform: translateY(-2px);
    color: white;
    text-decoration: none;
}

.demo-card.writing a {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
}

.demo-card.writing a:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
    color: white;
    text-decoration: none;
}

.demo-features {
    margin-top: 15px;
    font-size: 0.9em;
    color: var(--text-color-muted);
}

/* Footer */
.main-footer {
    background: var(--primary-color);
    color: white;
    text-align: center;
    padding: 60px 20px 40px 20px;
    margin-top: 0;
}
.footer-content {
    max-width: 600px;
    margin: 0 auto;
}
.footer-content h3 {
    font-family: var(--heading-font);
    margin-bottom: 20px;
    color: white;
}
.footer-content p {
    opacity: 0.9;
    margin-bottom: 30px;
    color: white;
}
.footer-links {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-bottom: 30px;
}
.footer-links a {
    color: white;
    text-decoration: none;
    opacity: 0.8;
    transition: opacity 0.3s ease;
}
.footer-links a:hover {
    opacity: 1;
    color: white;
    text-decoration: none;
}
.footer-bottom {
    border-top: 1px solid rgba(255,255,255,0.2);
    padding-top: 20px;
    opacity: 0.7;
    color: white;
}

/* Messages */
.message {
    padding: 12px 20px;
    border-radius: 8px;
    margin: 15px 0;
    font-weight: 600;
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.message.show {
    opacity: 1;
    transform: translateY(0);
}

.message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.message.info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

.message.warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.message-close {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: inherit;
    opacity: 0.7;
    padding: 0;
    margin-left: 15px;
}

.message-close:hover {
    opacity: 1;
}

/* Message Container */
.message-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    max-width: 400px;
    width: 100%;
}

/* Responsive Design */
@media (max-width: 768px) {
    .labs-grid {
        grid-template-columns: 1fr;
        gap: 30px;
    }
    .lab-card {
        padding: 30px 20px;
    }
    .features-grid {
        grid-template-columns: 1fr;
        gap: 30px;
    }
    .footer-links {
        flex-direction: column;
        gap: 15px;
    }
    .hero-content div {
        max-width: 100%;
    }
    .hero-cta {
        margin: 8px 0;
        display: block;
        min-width: 250px;
    }
    .message-container {
        right: 10px;
        left: 10px;
        max-width: none;
    }
}

/* Coming Soon Animation */
.coming-soon {
    position: relative;
}
.coming-soon::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 10px,
        rgba(108, 117, 125, 0.1) 10px,
        rgba(108, 117, 125, 0.1) 20px
    );
    pointer-events: none;
}

/* ==========================================================================
   Bookshelf / Reader Page Styles
   ========================================================================== */

.reader-hero-section {
    background: var(--gradient-bg);
    padding: 80px 20px;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
}

.reader-hero-section h1 {
    font-family: var(--heading-font);
    font-size: clamp(2.5em, 6vw, 4em);
    color: var(--primary-color);
    margin-bottom: 15px;
}

.reader-hero-section .hero-tagline {
    font-size: 1.3em;
    color: var(--text-color-muted);
    margin-bottom: 20px;
    font-style: italic;
}

.reader-hero-section p {
    max-width: 700px;
    margin: 0 auto 30px auto;
    color: var(--text-color);
}

.hero-stats {
    display: flex;
    justify-content: center;
    gap: 40px;
    flex-wrap: wrap;
}

.stat-item {
    text-align: center;
}

.stat-number {
    font-size: 2.5em;
    font-weight: 700;
    color: var(--primary-color);
}

.stat-label {
    font-size: 0.9em;
    color: var(--text-color-muted);
    font-weight: 600;
}

.marketplace-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
}

.section {
    margin-bottom: 60px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 15px;
}

.section-title {
    font-family: var(--heading-font);
    font-size: 2.2em;
    color: var(--primary-color);
}

.view-all-btn {
    background: var(--bg-surface);
    color: var(--primary-color);
    padding: 8px 16px;
    border-radius: 20px;
    text-decoration: none;
    font-weight: 600;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.view-all-btn:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.books-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
}

.book-card {
    background: var(--bg-surface);
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

.book-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
}

.book-cover {
    height: 200px;
    background: var(--gradient-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4em;
    color: var(--text-color-muted);
}

.book-info {
    padding: 20px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.book-info h3 {
    font-family: var(--heading-font);
    font-size: 1.3em;
    margin-bottom: 5px;
    color: var(--text-color);
}

.book-author {
    font-size: 0.9em;
    color: var(--text-color-muted);
    margin-bottom: 15px;
}

.book-description {
    font-size: 0.95em;
    margin-bottom: 20px;
    flex-grow: 1;
}

.book-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
}

.book-price {
    font-weight: 700;
    font-size: 1.1em;
    color: var(--success-color);
}

.book-rating {
    font-size: 0.9em;
    color: var(--text-color-muted);
}

.join-authors-cta {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    padding: 50px 30px;
    border-radius: 20px;
    text-align: center;
    margin-top: 60px;
}

.join-authors-cta h2 {
    font-family: var(--heading-font);
    font-size: 2.5em;
    margin-bottom: 15px;
}

.join-authors-cta p {
    max-width: 600px;
    margin: 0 auto 30px auto;
    opacity: 0.9;
}

.cta-buttons {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

.cta-btn {
    background: white;
    color: var(--primary-color);
    padding: 12px 25px;
    border-radius: 25px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.cta-btn:hover {
    transform: translateY(-2px);
}

.cta-btn.secondary {
    background: transparent;
    border-color: white;
    color: white;
}

.author-spotlight {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 40px;
    display: flex;
    gap: 30px;
    align-items: center;
}

.author-avatar {
    font-size: 5em;
    flex-shrink: 0;
}

.author-details h3 {
    font-family: var(--heading-font);
    font-size: 1.8em;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.author-bio {
    color: var(--text-color-muted);
    margin-bottom: 20px;
    line-height: 1.7;
}

.author-stats {
    display: flex;
    gap: 30px;
    border-top: 1px solid var(--border-color);
    padding-top: 20px;
}

.author-stat-number {
    font-size: 1.5em;
    font-weight: 700;
    color: var(--text-color);
}

.author-stat-label {
    font-size: 0.8em;
    color: var(--text-color-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.genre-filters {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.genre-filter {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    padding: 8px 16px;
    border-radius: 20px;
    text-decoration: none;
    color: var(--text-color-muted);
    font-weight: 500;
    transition: all 0.3s ease;
}

.genre-filter:hover, .genre-filter.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.new-releases-banner {
    background: linear-gradient(135deg, var(--success-color) 0%, #218838 100%);
    color: white;
    padding: 40px 30px;
    border-radius: 20px;
    text-align: center;
    margin-bottom: 60px;
}

.new-releases-banner h2 {
    font-family: var(--heading-font);
    font-size: 2.2em;
    margin-bottom: 10px;
}

.banner-subtitle {
    opacity: 0.9;
    margin-bottom: 25px;
}

.banner-cta {
    background: white;
    color: var(--success-color);
    padding: 10px 20px;
    border-radius: 20px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
}

.banner-cta:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

/* ==========================================================================
   Stellan Studio Page Styles
   ========================================================================== */

.loading-section {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 60vh;
    text-align: center;
    color: var(--text-color-muted);
}

.loading-section .spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-section p {
    font-size: 1.2em;
    font-weight: 600;
}

.stellan-hero {
    padding: 80px 20px;
    text-align: center;
    background: var(--gradient-bg);
    border-bottom: 1px solid var(--border-color);
}

.stellan-logo {
    font-size: 4em;
    margin-bottom: 20px;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.stellan-hero .hero-title {
    font-family: var(--heading-font);
    font-size: clamp(2.5em, 6vw, 4em);
    color: var(--primary-color);
    margin-bottom: 15px;
}

.stellan-hero .hero-subtitle {
    font-size: 1.3em;
    color: var(--text-color-muted);
    margin-bottom: 20px;
    font-weight: 500;
}

.stellan-hero .hero-description {
    max-width: 700px;
    margin: 0 auto;
    color: var(--text-color);
    line-height: 1.7;
}

.stellan-actions {
    padding: 80px 20px;
}

.action-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    max-width: 1100px;
    margin: 0 auto;
}

.action-card {
    background: var(--bg-surface);
    border-radius: 20px;
    padding: 40px 30px;
    text-align: center;
    box-shadow: 0 10px 25px rgba(0,0,0,0.05);
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

.action-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 35px rgba(0,0,0,0.1);
}

.card-icon {
    font-size: 3em;
    margin-bottom: 20px;
    display: block;
}

.card-title {
    font-family: var(--heading-font);
    font-size: 1.5em;
    color: var(--primary-color);
    font-weight: 700;
    margin-bottom: 15px;
}

.card-description {
    color: var(--text-color-muted);
    line-height: 1.6;
    margin-bottom: 25px;
    flex-grow: 1;
}

.card-button {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 25px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    margin-top: auto;
}

.card-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
    color: white;
    text-decoration: none;
}

.card-button.secondary {
    background: var(--success-color);
}

.card-button.secondary:hover {
    box-shadow: 0 8px 25px rgba(40, 167, 69, 0.4);
}

.action-cards.author-cards {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.panel-handle {
    position: fixed;
    top: 50%;
    right: 0;
    transform: translateY(-50%);
    width: 40px;
    height: 100px;
    background: var(--primary-color);
    border: 1px solid var(--border-color);
    border-right: none;
    border-radius: 20px 0 0 20px;
    box-shadow: -3px 0 15px rgba(0,0,0,0.1);
    cursor: pointer;
    z-index: 1000;
    display: none; /* Hidden by default */
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
    transition: all 0.3s ease;
}

.panel-handle.show {
    display: flex;
}


/* ==========================================================================
   Library Page Styles
   ========================================================================== */

.library-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 40px 0;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
    flex-wrap: wrap;
    gap: 20px;
}

.library-title-main h1 {
    font-family: var(--heading-font);
    color: var(--primary-color);
    margin: 0 0 5px 0;
}

.library-title-main p {
    color: var(--text-color-muted);
    margin: 0;
}

.library-stats {
    display: flex;
    gap: 20px;
    align-items: center;
}

.library-stats .stat-item {
    background: var(--bg-surface);
    padding: 12px 20px;
    border-radius: 10px;
    text-align: center;
    border: 1px solid var(--border-color);
}

.library-stats .stat-number {
    font-size: 1.5em;
    font-weight: 700;
    color: var(--primary-color);
    display: block;
}

.library-stats .stat-label {
    font-size: 0.9em;
    color: var(--text-color-muted);
    font-weight: 600;
}

.upload-new-btn {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 25px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 16px;
}

.upload-new-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

.books-container {
    margin-top: 30px;
}

.books-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 25px;
}

.library-book-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 15px;
    padding: 25px;
    transition: all 0.3s ease;
    display: flex;
    gap: 20px;
}

.library-book-card:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.1);
}

.library-book-card .book-cover {
    width: 80px;
    height: 120px;
    border-radius: 8px;
    background: var(--gradient-bg);
    flex-shrink: 0;
}

.library-book-card .book-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 6px;
}

.library-book-card .book-details {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.library-book-card .book-title {
    font-size: 1.2em;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 10px;
}

.library-book-card .book-status {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 15px;
    display: inline-block;
}

.status-published { background: rgba(40, 167, 69, 0.1); color: var(--success-color); }
.status-audit-pending { background: rgba(255, 193, 7, 0.1); color: var(--warning-color); }
.status-draft { background: rgba(220, 53, 69, 0.1); color: var(--danger-color); }
.status-processing { background: rgba(23, 162, 184, 0.1); color: #0c5460; }

.library-book-card .book-actions {
    display: flex;
    gap: 10px;
    margin-top: auto;
}

.library-book-card .book-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: 600;
    transition: all 0.3s ease;
    flex: 1;
}

.library-book-card .book-btn:hover {
    transform: translateY(-1px);
}

.library-book-card .book-btn.secondary { background: var(--text-color-muted); }
.library-book-card .book-btn.danger { background: var(--danger-color); }

.upload-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    z-index: 2000;
    align-items: center;
    justify-content: center;
    -webkit-backdrop-filter: blur(5px);
    backdrop-filter: blur(5px);
}

.upload-modal.show {
    display: flex;
}

.upload-dialog {
    background: var(--bg-surface);
    border-radius: 20px;
    padding: 40px;
    max-width: 700px;
    width: 95%;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.upload-title {
    color: var(--primary-color);
    font-size: 1.8em;
    font-weight: 700;
    margin-bottom: 10px;
    text-align: center;
}

.upload-subtitle {
    color: var(--text-color-muted);
    line-height: 1.6;
    text-align: center;
    margin-bottom: 30px;
}

/* Other modal styles like upload-zone, form-grid, etc. can be adapted similarly */

/* ==========================================================================
   User Side Panel
   ========================================================================== */

.user-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 320px;
    height: 100%;
    background: var(--bg-surface);
    border-left: 1px solid var(--border-color);
    box-shadow: -5px 0 25px rgba(0,0,0,0.1);
    z-index: 1001;
    transform: translateX(100%);
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    display: flex;
    flex-direction: column;
}

.user-panel.show {
    transform: translateX(0);
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.panel-header h2 {
    margin: 0;
    font-family: var(--heading-font);
    font-size: 1.5em;
    color: var(--primary-color);
}

.panel-close-btn {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-color-muted);
    cursor: pointer;
    padding: 5px;
    line-height: 1;
}

.panel-content {
    padding: 20px;
    overflow-y: auto;
    flex-grow: 1;
}

.role-content {
    display: none; /* Hidden by default */
}

.role-content.active {
    display: block; /* Shown by JS */
}

.role-content h4 {
    font-family: var(--heading-font);
    color: var(--text-color);
    margin-top: 0;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 10px;
}

.panel-button {
    display: block;
    width: 100%;
    padding: 15px;
    margin-bottom: 10px;
    text-align: center;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    transition: transform 0.2s ease;
}

.panel-button:hover {
    transform: translateY(-2px);
    color: white;
}

.panel-button.secondary {
    background: var(--bg-surface);
    color: var(--primary-color);
    border: 1px solid var(--border-color);
}

/* ==========================================================================
   Demo Reader Page Styles
   ========================================================================== */

.demo-intro {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
    padding: 40px 20px;
    text-align: center;
}

.demo-intro h1 {
    font-family: var(--heading-font);
    font-size: 2.5em;
    color: #856404;
    margin-bottom: 15px;
}

.demo-intro p {
    font-size: 1.2em;
    color: #856404;
    max-width: 800px;
    margin: 0 auto 30px auto;
}

.demo-features {
    display: flex;
    justify-content: center;
    gap: 30px;
    flex-wrap: wrap;
    margin-top: 20px;
}

.demo-feature {
    background: white;
    padding: 15px 25px;
    border-radius: 25px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    font-weight: 600;
    color: var(--primary-color);
}

.reading-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 40px 20px;
}

.book-selector {
    background: var(--bg-surface);
    border-radius: 15px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.05);
    border: 1px solid var(--border-color);
}

.book-selector h2 {
    font-family: var(--heading-font);
    color: var(--primary-color);
    margin-bottom: 20px;
    text-align: center;
}

.demo-books {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.demo-book {
    background: var(--bg-color);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.demo-book:hover {
    border-color: var(--primary-color);
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.2);
}

.demo-book.selected {
    border-color: var(--success-color);
    background: rgba(40, 167, 69, 0.05);
}

.book-icon {
    font-size: 3em;
    margin-bottom: 15px;
}

.book-title {
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 8px;
}

.book-description {
    font-size: 0.9em;
    color: var(--text-color-muted);
}

.reading-area {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 15px;
    padding: 40px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.05);
    min-height: 400px;
    position: relative;
}

.reading-content {
    font-size: 18px;
    line-height: 1.8;
    max-width: 700px;
    margin: 0 auto;
}

.reading-content p {
    margin-bottom: 25px;
}

.demo-content-title {
    font-family: var(--heading-font);
    color: var(--primary-color);
    margin-bottom: 30px;
    text-align: center;
}

.highlight-word {
    background: rgba(102, 126, 234, 0.2);
    padding: 2px 4px;
    border-radius: 3px;
    cursor: help;
    transition: all 0.3s ease;
}

.highlight-word:hover {
    background: rgba(102, 126, 234, 0.4);
}

.highlight-word.selected {
    background: rgba(40, 167, 69, 0.3);
}

.ai-tutor {
    position: fixed;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    width: 300px;
    background: var(--bg-surface);
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    z-index: 1000;
    display: none;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.ai-tutor.show {
    display: block;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from { transform: translateX(100%) translateY(-50%); }
    to { transform: translateX(0) translateY(-50%); }
}

.tutor-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.tutor-title {
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.close-tutor {
    background: none;
    border: none;
    color: white;
    font-size: 18px;
    cursor: pointer;
    padding: 5px;
    border-radius: 3px;
    transition: background 0.3s ease;
}

.close-tutor:hover {
    background: rgba(255,255,255,0.2);
}

.tutor-content {
    padding: 20px;
    max-height: 400px;
    overflow-y: auto;
}

.word-info {
    margin-bottom: 20px;
}

.selected-word {
    font-size: 1.3em;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.definition {
    background: var(--bg-color);
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid var(--primary-color);
    margin-bottom: 15px;
}

.definition-label {
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 5px;
}

.context-help {
    background: rgba(40, 167, 69, 0.1);
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid var(--success-color);
}

.context-label {
    font-weight: 600;
    color: var(--success-color);
    margin-bottom: 5px;
}

.demo-actions {
    background: var(--gradient-bg);
    border: 1px solid var(--border-color);
    border-radius: 15px;
    padding: 30px;
    margin: 30px 0;
    text-align: center;
}

.demo-actions h3 {
    color: var(--primary-color);
    margin-bottom: 15px;
}

.demo-progress {
    background: var(--border-color);
    height: 8px;
    border-radius: 4px;
    margin: 20px 0;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--success-color);
    width: 0%;
    transition: width 0.5s ease;
}

.upgrade-cta {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 25px;
}

.cta-btn {
    padding: 12px 25px;
    border-radius: 25px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
}

.cta-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
}

.cta-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

.cta-secondary {
    background: var(--success-color);
    color: white;
}

.cta-secondary:hover {
    background: #218838;
    transform: translateY(-2px);
}

.instructions {
    background: rgba(23, 162, 184, 0.1);
    border: 1px solid rgba(23, 162, 184, 0.2);
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 30px;
    text-align: center;
}

.instructions h4 {
    color: #0c5460;
    margin-bottom: 10px;
}

.instructions p {
    color: #0c5460;
    margin: 0;
}

html[data-theme='dark'] .instructions {
    background: rgba(23, 162, 184, 0.2);
    border-color: rgba(23, 162, 184, 0.4);
}

html[data-theme='dark'] .instructions h4,
html[data-theme='dark'] .instructions p {
    color: #9eeaf9;
}

html[data-theme='dark'] .demo-intro {
    background: linear-gradient(135deg, #4d4321 0%, #615420 100%);
}

html[data-theme='dark'] .demo-intro h1,
html[data-theme='dark'] .demo-intro p {
    color: #ffeaa7;
}

html[data-theme='dark'] .demo-feature {
    background: var(--bg-surface);
    color: var(--primary-color);
}

@media (max-width: 768px) {
    .ai-tutor {
        position: fixed;
        right: 10px;
        left: 10px;
        top: auto;
        bottom: 20px;
        width: auto;
        transform: none;
    }

    .ai-tutor.show {
        animation: slideUp 0.3s ease-out;
    }

    @keyframes slideUp {
        from { transform: translateY(100%); }
        to { transform: translateY(0); }
    }

    .reading-area {
        padding: 20px;
    }

    .demo-books {
        grid-template-columns: 1fr;
    }

    .upgrade-cta {
        flex-direction: column;
        align-items: center;
    }
}
}
