:root {
    --bg-color: #0d0e12;
    --text-color: #f3f4f6;
    --card-bg: rgba(22, 24, 33, 0.7);
    --accent-color: #ff4a5a;
    --accent-glow: rgba(255, 74, 90, 0.25);
    --muted-color: #9ca3af;
    --border-color: rgba(255, 255, 255, 0.08);
    --chip-bg: #1a1d29;
}

html.dark {
    /* Keeping color system consistent */
    --bg-color: #0d0e12;
    --text-color: #f3f4f6;
    --card-bg: rgba(22, 24, 33, 0.7);
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    padding: 0;
    line-height: 1.8;
    background-image: radial-gradient(circle at 50% -20%, #1e1b4b 0%, var(--bg-color) 70%);
    background-attachment: fixed;
}

.container {
    width: 90%;
    max-width: 800px;
    margin: 0 auto;
}

/* Elegant Navbar Alignment */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2rem 0;
    border-bottom: 1px solid var(--border-color);
}

.navbar .logo {
    font-size: 1.4rem;
    font-weight: 800;
    text-decoration: none;
    color: var(--text-color);
    letter-spacing: -0.5px;
}

.navbar nav a {
    text-decoration: none;
    color: var(--muted-color);
    font-weight: 500;
    transition: color 0.2s;
}

.navbar nav a:hover {
    color: var(--accent-color);
}

/* Hero Text Design */
.hero {
    text-align: center;
    padding: 4.5rem 0 2rem 0;
}

.hero h1 {
    font-size: 2.8rem;
    font-weight: 800;
    margin-bottom: 0.75rem;
    background: linear-gradient(to right, #ffffff, #9ca3af);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero p {
    color: var(--muted-color);
    font-size: 1.1rem;
}

/* Category Navigation Button Section */
.category-nav {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
    margin: 2.5rem 0;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.category-chip {
    display: inline-flex;
    align-items: center;
    background: var(--chip-bg);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    padding: 0.6rem 1.2rem;
    border-radius: 12px;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.category-chip:hover {
    border-color: var(--accent-color);
    box-shadow: 0 0 15px var(--accent-glow);
    transform: translateY(-2px);
    color: #ffffff;
}

.category-chip.active {
    background: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
    box-shadow: 0 4px 20px var(--accent-glow);
}

/* Premium Card Layout UI */
.poem-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 2.5rem;
    border-radius: 16px;
    margin: 2rem 0;
    transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

.poem-card:hover {
    transform: translateY(-4px);
    border-color: rgba(255, 74, 90, 0.3);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

/* Modern Pill Badges */
.tag-badge-link {
    text-decoration: none;
    display: inline-block;
    margin-bottom: 1rem;
}

.tag-badge {
    background: rgba(255, 74, 90, 0.1);
    color: var(--accent-color);
    border: 1px solid rgba(255, 74, 90, 0.2);
    padding: 0.35rem 0.8rem;
    font-size: 0.8rem;
    border-radius: 8px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.poem-card h2 {
    margin: 0.5rem 0 1rem 0;
    font-size: 1.8rem;
    font-weight: 700;
}

.poem-card h2 a {
    color: var(--text-color);
    text-decoration: none;
    transition: color 0.2s;
}

.poem-card h2 a:hover {
    color: var(--accent-color);
}

.meta {
    font-size: 0.85rem;
    color: var(--muted-color);
    margin-bottom: 1.25rem;
    display: flex;
    gap: 15px;
}

.excerpt {
    color: #d1d5db;
    font-size: 1.1rem;
    line-height: 1.8;
    margin-bottom: 1.5rem;
}

/* Clean CTA Link Button style */
.read-more {
    display: inline-block;
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 700;
    font-size: 0.95rem;
    transition: transform 0.2s;
}

.read-more:hover {
    transform: translateX(4px);
}

footer {
    text-align: center;
    padding: 3rem 0;
    font-size: 0.85rem;
    color: var(--muted-color);
    border-top: 1px solid var(--border-color);
    margin-top: 6rem;
}


/* Premium Single Poem Structural Shell */
.single-poem-container {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 24px;
    padding: 3.5rem 2.5rem;
    margin-top: 2rem;
    box-shadow: 0 20px 40px rgba(0,0,0,0.3);
}

.poem-header-wrapper {
    text-align: center;
    margin-bottom: 2rem;
}

.poem-header-wrapper h1 {
    font-size: 2.6rem;
    margin: 1rem 0;
    letter-spacing: -0.5px;
}

.poem-dashboard-meta {
    display: flex;
    justify-content: center;
    gap: 20px;
    color: var(--muted-color);
    font-size: 0.9rem;
    font-weight: 500;
}

/* Toolkit Reading Adjustments Design */
.reading-toolkit {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 2.5rem;
    background: rgba(255, 255, 255, 0.03);
    padding: 6px;
    border-radius: 12px;
    width: max-content;
    margin-left: auto;
    margin-right: auto;
    border: 1px solid var(--border-color);
}

.reading-toolkit button {
    background: transparent;
    border: none;
    color: var(--text-color);
    padding: 0.4rem 0.8rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.reading-toolkit button:hover, .active-toolkit-btn {
    background: rgba(255, 255, 255, 0.1);
    color: var(--accent-color) !important;
}

/* Beautiful Centered Poem Text Engine Setup */
.poem-body-workspace {
    font-size: 1.35rem;
    text-align: left;
    display: inline-block;
    margin: 1rem auto 3.5rem auto;
    font-family: 'Georgia', serif;
    width: 100%;
    max-width: fit-content;
    white-space: pre-wrap;
    color: #e5e7eb;
}

.single-poem-container {
    text-align: center; /* Forces the inline-block block container to stay centered */
}

/* Engagement & Call To Actions Systems */
.engagement-bar {
    display: flex;
    justify-content: center;
    gap: 15px;
    border-top: 1px solid var(--border-color);
    padding-top: 2.5rem;
    flex-wrap: wrap;
}

.action-btn-like, .action-btn-share {
    border: none;
    padding: 0.8rem 1.8rem;
    border-radius: 14px;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    transition: all 0.25s ease;
}

.action-btn-like {
    background: linear-gradient(135deg, #ff4a75, #ff4a5a);
    color: white;
    box-shadow: 0 4px 15px rgba(255, 74, 90, 0.3);
}

.action-btn-share {
    background: #25D366;
    color: white;
    box-shadow: 0 4px 15px rgba(37, 211, 102, 0.2);
}

.action-btn-like:hover, .action-btn-share:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 74, 90, 0.4);
    filter: brightness(1.1);
}

.back-home-link {
    color: var(--muted-color);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s;
}
.back-home-link:hover {
    color: var(--accent-color);
}

/* Immersive Focus Mode Engine Overrides */
body.focus-mode-active header,
body.focus-mode-active footer,
body.focus-mode-active .poem-header-wrapper,
body.focus-mode-active .engagement-bar,
body.focus-mode-active .back-home-link {
    opacity: 0.05;
    pointer-events: none;
    transition: opacity 0.4s ease;
}
body.focus-mode-active .single-poem-container {
    border-color: transparent;
    background: transparent;
    box-shadow: none;
}


/* Dashboard Structural Element Shells */
.dashboard-shell {
    margin-top: 3rem;
}
.dashboard-header {
    text-align: center;
    margin-bottom: 3rem;
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 3rem;
}

.metric-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    padding: 2rem;
    border-radius: 16px;
    text-align: center;
    backdrop-filter: blur(10px);
}
.metric-card h3 {
    margin: 0 0 0.5rem 0;
    font-size: 0.95rem;
    color: var(--muted-color);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.metric-card .num {
    font-size: 2.2rem;
    font-weight: 800;
}

.sync-action-box {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    padding: 2.5rem;
    border-radius: 20px;
}
.sync-action-box h2 {
    margin-top: 0;
}

/* Operational Status Notification Indicator Rails */
.status-indicator-strip {
    padding: 0.8rem 1.2rem;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    margin: 1.5rem 0;
    background: rgba(37, 211, 102, 0.1);
    border: 1px solid rgba(37, 211, 102, 0.2);
    color: #25D366;
}
.status-indicator-strip.warning-mode {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.2);
    color: #f59e0b;
}
.status-indicator-strip.error-mode {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.sync-dashboard-btn {
    background: var(--text-color);
    color: var(--bg-color);
    border: none;
    padding: 1rem 2rem;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
}
.sync-dashboard-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(255, 255, 255, 0.1);
}
.sync-dashboard-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.log-output-box {
    margin-top: 1.5rem;
    background: rgba(0,0,0,0.3);
    border: 1px solid var(--border-color);
    padding: 1.2rem;
    border-radius: 10px;
    font-family: monospace;
    font-size: 0.85rem;
    line-height: 1.6;
    color: #9ca3af;
}



/* "Feeling Lucky" Discovery Control Style */
.lucky-btn {
    display: inline-block;
    background: rgba(255, 255, 255, 0.05);
    border: 1px dashed rgba(255, 74, 90, 0.4);
    color: var(--text-color);
    padding: 0.6rem 1.4rem;
    border-radius: 30px;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.25s ease;
}
.lucky-btn:hover {
    background: linear-gradient(135deg, rgba(255, 74, 90, 0.15), rgba(30, 27, 75, 0.4));
    border-color: var(--accent-color);
    box-shadow: 0 0 15px var(--accent-glow);
    transform: translateY(-1px);
}

/* Premium Featured Component Design Layouts */
.featured-section-wrapper {
    margin: 3rem 0;
    position: relative;
}
.featured-ribbon {
    position: absolute;
    top: -12px;
    left: 20px;
    background: #f59e0b;
    color: #0d0e12;
    font-size: 0.75rem;
    font-weight: 800;
    padding: 0.25rem 0.75rem;
    border-radius: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
    z-index: 2;
}
.featured-card {
    background: linear-gradient(145deg, rgba(30, 27, 75, 0.4), rgba(22, 24, 33, 0.8));
    border: 1px solid rgba(245, 158, 11, 0.25);
    padding: 2.5rem;
    border-radius: 20px;
    backdrop-filter: blur(10px);
}
.featured-card h2 {
    font-size: 2rem;
    margin: 0.75rem 0;
}
.featured-card h2 a {
    color: #ffffff;
    text-decoration: none;
}
.featured-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1.5rem;
    border-top: 1px solid var(--border-color);
    padding-top: 1rem;
}

/* Card Row Metrics Alignment Grid */
.card-top-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.card-metrics {
    display: inline-flex;
    gap: 12px;
    font-size: 0.85rem;
    color: var(--muted-color);
    font-weight: 600;
    background: rgba(255, 255, 255, 0.03);
    padding: 0.25rem 0.6rem;
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.meta-date {
    font-size: 0.8rem;
    color: var(--muted-color);
    margin: -0.5rem 0 1rem 0;
}
.section-title-label {
    font-size: 1.1rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--muted-color);
    margin-bottom: 1rem;
    border-left: 3px solid var(--accent-color);
    padding-left: 10px;
}


/* Audio Stream Component Styling */
.audio-stream-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    padding: 1.5rem;
    border-radius: 16px;
    margin: 1.5rem auto;
    max-width: 450px;
    text-align: center;
}
.audio-title {
    margin-top: 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--muted-color);
}

/* Floating Inline Contextual Popover Selection Bar Pill */
.floating-selection-share-pill {
    background: #ffffff;
    border-radius: 30px;
    padding: 4px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    z-index: 999;
}
.floating-selection-share-pill button {
    background: #0d0e12;
    color: #ffffff;
    border: none;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s;
}
.floating-selection-share-pill button:hover {
    background: var(--accent-color);
}

/* Print PDF layout elements styling rules variables */
.pdf-download-link-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--accent-color) !important;
    border-radius: 8px;
}




/* ==========================================
   HIGH-FIDELITY BROWSER-TO-PDF PRINT STYLES
   ========================================== */
/* ==========================================
   HIGH-FIDELITY BROWSER-TO-PDF PRINT STYLES
   ========================================== */
@media print {
    /* 1. Hide every interactive dashboard and navigation utility */
    header, 
    footer, 
    .reading-toolkit, 
    .audio-stream-card, 
    .engagement-bar, 
    .back-home-link,
    #theme-toggle {
        display: none !important;
    }

    /* 2. Reset global environment parameters */
    html, body {
        background-color: #ffffff !important;
        background-image: none !important;
        color: #000000 !important;
        font-family: 'Segoe UI', system-ui, sans-serif !important;
        margin: 0;
        padding: 0;
        width: 100%;
    }

    /* 3. Strip layout containment behaviors to allow smooth page breaks */
    .single-poem-container {
        border: none !important;
        background: transparent !important;
        box-shadow: none !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        padding: 0 !important;
        margin: 0 !important;
        display: block !important;
    }

    /* 4. Format and bind the title layout tightly */
    .poem-header-wrapper {
        text-align: center !important;
        margin-bottom: 30pt !important;
        page-break-after: avoid; /* Prevents the title from getting stuck alone on a page */
        break-after: avoid;
    }

    .poem-header-wrapper h1 {
        color: #000000 !important;
        font-size: 26pt !important;
        margin: 0 0 5pt 0 !important;
    }

    .poem-dashboard-meta {
        color: #555555 !important;
        font-size: 10pt !important;
        justify-content: center !important;
    }

    /* 5. Optimize the text flow engine for long poetry */
    .poem-body-workspace {
        color: #000000 !important;
        font-size: 15pt !important;
        line-height: 1.8 !important;
        font-family: Georgia, serif !important;
        margin: 0 auto !important;
        display: block !important;
        white-space: pre-wrap !important;
        text-align: left !important;
        max-width: 100% !important;
        
        /* Permits continuous flowing over multiple printable sheets */
        page-break-inside: auto !important; 
        break-inside: auto !important;
    }

    /* 6. Prevent a stanza from splitting awkwardly across sheets if possible */
    .poem-body-workspace br {
        page-break-inside: avoid;
        break-inside: avoid;
    }
}




/* ==========================================
   GLOBAL AUDIO CONTROLLER PILL COMPONENT
   ========================================== */
.floating-music-pill {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 9999;
}

.music-pill-btn {
    background: rgba(22, 24, 33, 0.85);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 0.7rem 1.3rem;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.music-pill-btn:hover {
    transform: translateY(-3px);
    border-color: var(--accent-color);
    box-shadow: 0 15px 30px var(--accent-glow);
}

/* Accent Glow Ring indicator when music engine is actively running */
.music-pill-btn.music-is-playing {
    border-color: rgba(37, 211, 102, 0.4);
    box-shadow: 0 4px 20px rgba(37, 211, 102, 0.15);
}

.music-pill-btn.music-is-playing .music-icon-graphic {
    animation: pulseIcon 1.5s infinite ease-in-out;
    display: inline-block;
}

/* Custom interactive animation scale for playing status indicators */
@keyframes pulseIcon {
    0% { transform: scale(1); }
    50% { transform: scale(1.2) rotate(5deg); color: var(--accent-color); }
    100% { transform: scale(1); }
}

/* Ensure the control overlay pill doesn't print onto physical PDF documents */
@media print {
    .floating-music-pill, #ambient-music-controller {
        display: none !important;
    }
}


