:root {
    --bg-color: #0f0f0f;
    --text-color: #e0e0e0;
    --accent-color: #666;
    --input-bg: rgba(255,255,255,0.05);
    --button-bg: #2a2a2a;
    --button-hover-bg: #3a3a3a;
    --border-color: #444;
    --quote-border: #666;
    --error-color: #ff4444;
}

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    font-family: 'Fira Code', monospace;
    background-color: var(--bg-color);
    color: var(--text-color);
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 0;
}

body {
    display: flex;
    flex-direction: column;
}

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

#background-sigil {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    opacity: 0.05;
}

h1 {
    text-align: center;
    font-size: 1.5em;
    margin-bottom: 30px;
}

input, button, select, textarea {
    width: 100%;
    padding: 10px;
    margin-bottom: 10px;
    background-color: rgba(30, 30, 30, 0.7) !important;
    border: 1px solid var(--border-color);
    color: white !important;
    font-family: 'Fira Code', monospace;
    font-size: 14px;
    box-sizing: border-box;
}

button, .invoke-button, .file-upload-button {
    cursor: pointer;
    transition: all 0.3s ease;
}

button:hover {
    background-color: var(--button-hover-bg);
    box-shadow: 0 0 15px rgba(255,255,255,0.2);
}

#results {
    margin-top: 20px;
    width: 100%;
    max-height: 80vh; /* Increased height for main container */
    overflow-y: auto;
    padding: 10px;
    box-sizing: border-box;
    padding-right: 15px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

.quotes-container {
    max-height: 500px;
    overflow-y: auto;
    padding: 10px;
    background-color: var(--bg-color);
    border-radius: 5px;
    margin-top: 10px;
}

.quote {
    margin-bottom: 15px;
    padding: 12px;
    border-radius: 4px;
    background-color: rgba(0, 0, 0, 0.2);
    transition: background-color 0.2s;
    position: relative;
}

.quote-header {
    margin-bottom: 8px;
    display: flex;
    justify-content: flex-end;
}

.quote-strategy {
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 4px;
    background-color: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.8);
    cursor: help;
    transition: background-color 0.2s;
}

.quote-strategy:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.quote.complete .quote-strategy {
    border-left: 3px solid #4caf50;
}

.quote.incomplete .quote-strategy {
    border-left: 3px solid #ff9800;
}

.quote:hover {
    background-color: rgba(0, 0, 0, 0.4);
}

.quote-info {
    font-size: 0.8em;
    color: var(--accent-color);
    margin-top: 5px;
}

.ascii-art {
    font-size: 10px;
    line-height: 10px;
    white-space: pre;
    font-family: 'Fira Code', monospace;
    color: var(--accent-color);
    text-align: center;
    margin: 20px auto;
    max-width: 800px;
}

.error {
    color: var(--error-color);
    font-weight: bold;
}

.title-container {
    position: relative;
    height: 120px;
    margin-bottom: 35px;
    text-align: center;
    background: var(--bg-color) !important;
    overflow: visible;
    z-index: 1;
}

#titleCanvas {
    position: absolute !important;
    top: 0 !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    width: 100% !important;
    max-width: 800px !important;
    height: 100% !important;
    z-index: 5 !important;
    background: transparent !important;
}

.search-form {
    margin-top: 20px;
    position: relative;
    z-index: 5;
    background-color: transparent !important;
    padding: 0;
}

/* Add some spacing between the form and content */
.content {
    position: relative;
    margin: 0 auto;
    padding: 20px;
    max-width: 800px;
    width: 100%;
    box-sizing: border-box;
    z-index: 2;
    background-color: var(--bg-color);
}

/* Sidebar styling */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100%;
    width: 120px;
    background-color: var(--bg-color);
    padding-top: 200px;
    padding-left: 60px;
    z-index: 1000;
    overflow-y: auto;
}

.sidebar a {
    display: block;
    color: var(--text-color);
    padding: 10px 10px;
    text-decoration: none;
    font-size: 13px;
    transition: background 0.1s ease;
    border: none;
}

.sidebar a:hover {
    background-color: var(--button-hover-bg);
}

/* Add just the sidebar-title style */
.sidebar-title {
    font-family: 'Fira Code', monospace;
    font-size: 16px;
    font-weight: bold;
    text-align: left;
    color: #d8d8d8;
    margin-top: 10px;
    padding: 10px 10px;
    border: none;
    outline: none;
    letter-spacing: 0.5px;
}

.file-upload {
    margin: 10px 0;
}

.file-label {
    display: inline-block;
    padding: 8px 12px;
    background-color: var(--button-bg);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.file-label:hover {
    background-color: var(--button-hover-bg);
}

#fileInput {
    display: none;
}

@media (max-width: 768px) {
    .container {
        padding: 10px;
        margin-top: 50px;
    }
    
    h1 {
        font-size: 1.3em;
    }

    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
        padding-top: 10px;
        padding-left: 0;
    }

    .sidebar a {
        float: left;
        padding: 10px;
    }

    #content {
        margin-left: 0;
        height: auto;
        overflow-y: visible; /* Change from auto to visible */
        height: auto; /* Set to auto to avoid height issues */
    }     

    .title-container {
        height: 150px;
    }
    
    .ascii-art {
        font-size: 8px;
        line-height: 8px;
    }
}

.processing-info {
    background-color: var(--bg-color);
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 5px;
    border: 1px solid var(--border-color);
}

.processing-info p {
    margin: 5px 0;
    font-size: 0.9em;
    color: var(--accent-color);
}

/* Create a more uniform scientific theme for the program box */

/* Main container */
.input-group {
    margin-bottom: 20px;
    padding: 20px;
    background-color: rgba(33, 35, 38, 0.95) !important;
    border-radius: 3px;
    border: 1px solid #333;
}

/* Form elements */
.form-group {
    margin-bottom: 15px;
    width: 100%;
    padding: 0;
}

/* Form group label */
.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #b8b8b8;
    font-family: 'Fira Code', monospace;
    font-size: 13px;
    font-weight: normal;
    letter-spacing: 0.5px;
}

/* Scientific input styling */
input, select, textarea {
    width: 100%;
    padding: 8px 10px;
    margin-bottom: 10px;
    background-color: rgba(35, 37, 40, 0.9) !important;
    border: 1px solid #333;
    color: #d8d8d8 !important;
    font-family: 'Fira Code', monospace;
    font-size: 13px;
    box-sizing: border-box;
}

/* Remove hover effects */
button:hover, .invoke-button:hover, .file-upload-button:hover {
    background-color: rgba(35, 37, 40, 0.9) !important;
    box-shadow: none !important;
}

/* Consistent source inputs */
.source-inputs {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 100%;
    margin-top: 5px;
    background-color: transparent;
}

/* File upload container */
.file-upload-container {
    background-color: rgba(35, 37, 40, 0.9);
    border-radius: 3px;
    padding: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid #333;
}

/* File button styling */
.file-upload-button {
    background-color: rgba(35, 37, 40, 0.9) !important;
    color: #d8d8d8 !important;
    border: 1px solid #333;
    padding: 8px 12px;
    white-space: nowrap;
    width: auto;
    margin-bottom: 0;
    cursor: pointer;
    transition: none;
    font-size: 13px;
}

/* File name styling */
#fileName {
    color: #999 !important;
    font-size: 13px;
    font-family: 'Fira Code', monospace;
}

/* Submit button styling */
.invoke-button {
    background-color: rgba(35, 37, 40, 0.9) !important;
    color: #d8d8d8 !important;
    width: 100%;
    padding: 10px;
    margin-top: 20px;
    font-weight: normal;
    border: 1px solid #333;
    cursor: pointer;
    transition: none;
    letter-spacing: 0.5px;
    font-size: 13px;
}

/* Remove old source button styles */
.source-buttons,
.source-button {
    display: none;
}

#loading {
    text-align: center;
    margin: 20px 0;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

#loading p {
    margin-top: 10px;
    font-family: 'Fira Code', monospace;
}

.error {
    color: var(--error-color);
    padding: 10px;
    margin: 10px 0;
    background: rgba(255,68,68,0.1);
    border-radius: 4px;
}

.no-results {
    color: #fff;
    text-align: center;
    padding: 20px;
    font-family: 'Fira Code', monospace;
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

.results-list {
    margin-top: 20px;
}

.quote-text {
    color: #fff;
    margin-bottom: 10px;
    line-height: 1.5;
}

.quote-sum {
    color: #3498db;
    font-weight: bold;
    margin-bottom: 5px;
}

.quote-breakdown {
    color: #aaa;
    font-size: 0.9em;
    margin-top: 5px;
    font-family: 'Fira Code', monospace;
}

.results-list h3 {
    color: #fff;
    margin: 20px 0 10px;
    font-family: 'Fira Code', monospace;
    font-size: 1.2em;
}

.summary {
    margin-top: 20px;
    padding: 15px;
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    font-family: 'Fira Code', monospace;
}

.summary p {
    color: #fff;
    margin: 5px 0;
}

.summary-box {
    background: rgba(40, 40, 40, 0.4);
    border: 1px solid var(--border-color);
    padding: 20px;
    margin-bottom: 20px;
    border-radius: 4px;
}

.summary-box p {
    margin: 5px 0;
    color: var(--text-color);
    font-family: 'Fira Code', monospace;
    font-size: 14px;
}

#quotes-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    overflow-y: visible; /* Remove nested scrolling */
    padding-right: 10px;
}

#quotes-container h3 {
    color: var(--text-color);
    font-family: 'Fira Code', monospace;
    font-size: 16px;
    margin: 20px 0 10px;
    padding-bottom: 5px;
    border-bottom: none;
}

.quote {
    background: rgba(40, 40, 40, 0.4);
    border: 1px solid var(--border-color);
    padding: 15px;
    margin-bottom: 15px;
    border-radius: 4px;
    background-color: var(--bg-color);
}

.quote.complete {
    border-left: 4px solid #4CAF50;
}

.quote.incomplete {
    border-left: 4px solid #FFC107;
}

.quote-text {
    color: var(--text-color);
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 10px;
}

.quote-sum {
    color: var(--accent-color);
    font-size: 13px;
    margin-bottom: 5px;
}

.quote-breakdown {
    color: var(--accent-color);
    font-size: 12px;
    font-family: 'Fira Code', monospace;
}

.error {
    color: #ff4444;
    background: rgba(255, 68, 68, 0.1);
    padding: 15px;
    border-radius: 4px;
    margin: 20px 0;
    font-family: 'Fira Code', monospace;
}

/* Advanced Analytics Styles */
.analytics-section {
    margin-top: 30px;
    padding: 15px;
    border-radius: 5px;
    background-color: rgba(0, 0, 0, 0.2);
}

.toggle-analytics-btn {
    background-color: var(--button-bg);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: background-color 0.2s;
    font-family: 'Fira Code', monospace;
    width: auto;
    display: inline-block;
}

.toggle-analytics-btn:hover {
    background-color: var(--button-hover-bg);
}

.analytics-content {
    max-height: none; /* Remove max height limitation */
    overflow-y: visible; /* Remove nested scrolling */
    padding: 10px;
}

.analytics-overall {
    margin-bottom: 20px;
}

.analytics-strategies {
    margin-bottom: 20px;
}

.analytics-overall h3 {
    font-size: 16px;
    margin-bottom: 10px;
    padding-bottom: 5px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.analytics-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    max-width: 100%;
}

.analytics-item {
    background-color: rgba(30, 30, 30, 0.5);
    padding: 10px;
    border-radius: 4px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.analytics-value {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 0.25rem;
}

.analytics-label {
    font-size: 0.7rem;
    color: var(--accent-color);
}

.analytics-distributions h3,
.analytics-strategies h3,
.analytics-overall h3 {
    margin-top: 20px;
    margin-bottom: 10px;
    font-size: 16px;
    padding-bottom: 5px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.analytics-table {
    width: 100%;
    border-collapse: collapse;
    margin: 10px 0 20px;
    font-size: 0.75rem;
    table-layout: fixed;
}

.analytics-table th, 
.analytics-table td {
    padding: 4px 6px;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.analytics-table th {
    background-color: var(--button-bg);
    font-weight: 600;
    color: var(--text-color);
}

.analytics-table tr:hover {
    background-color: var(--button-hover-bg);
}

.analytics-distributions h3 {
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
}

.analytics-distributions {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    max-width: 100%;
    margin-top: 10px;
}

.distribution-card {
    background-color: var(--button-bg);
    padding: 8px;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    max-width: 100%;
    position: relative; /* For tooltip positioning */
}

.distribution-card h4 {
    margin: 0 0 3px 0;
    font-size: 11px;
    color: var(--text-color);
    display: flex;
    align-items: center;
    justify-content: center;
}

.distribution-card h4::after {
    content: "ⓘ";
    display: inline-block;
    margin-left: 5px;
    font-size: 10px;
    opacity: 0.7;
    cursor: help;
}

.distribution-card h4:hover::after {
    opacity: 1;
}

.distribution-card .tooltip {
    visibility: hidden;
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.85);
    color: #fff;
    text-align: center;
    padding: 5px 8px;
    border-radius: 4px;
    font-size: 10px;
    width: 150px;
    z-index: 100;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
}

.distribution-card h4:hover + .tooltip {
    visibility: visible;
    opacity: 1;
}

.word-count-chart {
    display: flex;
    align-items: flex-end;
    height: 70px;
    gap: 1px;
    max-width: 100%;
    margin-top: 2px;
}

.chart-bar-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 0;
}

.chart-bar {
    width: 90%;
    background-color: var(--accent-color);
    border-radius: 1px 1px 0 0;
    transition: height 0.3s ease;
    position: relative; /* For positioning the count indicator */
}

.count-indicator {
    position: absolute;
    top: -15px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 8px;
    color: var(--text-color);
    background-color: rgba(0, 0, 0, 0.5);
    padding: 1px 3px;
    border-radius: 2px;
    white-space: nowrap;
}

.chart-label {
    margin-top: 2px;
    font-size: 8px;
    color: var(--accent-color);
}

/* Responsive styles for analytics */
@media (max-width: 992px) {
    .analytics-distributions {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .analytics-distributions {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .analytics-table {
        font-size: 0.75rem;
    }
    
    .analytics-table th, 
    .analytics-table td {
        padding: 0.4rem 0.2rem;
    }
}

@media (max-width: 500px) {
    .analytics-grid {
        grid-template-columns: 1fr 1fr;
    }
    
    .analytics-value {
        font-size: 1.1rem;
    }
    
    .analytics-label {
        font-size: 0.65rem;
    }
    
    .analytics-table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
        width: 100%;
        font-size: 0.7rem;
    }
}

/* Scientific Paper Styles */
.about-content {
    max-width: 900px;
    margin: 0 auto;
    margin-left: 0; /* Remove the margin for sidebar */
    padding: 3rem;
    background: transparent;
    font-family: 'Merriweather', 'Georgia', serif;
    line-height: 1.9;
    color: #c0c8d0;
    letter-spacing: 0.3px;
    position: relative;
}

/* Style for hyperlinks in the about paper */
.about-content a {
    color: #c0c8d0;
    text-decoration: none;
    border-bottom: 1px solid rgba(192, 200, 208, 0.3);
    transition: border-color 0.3s ease;
}

.about-content a:hover {
    border-bottom-color: #c0c8d0;
}

/* Style for reference links */
.references-list a {
    color: #c0c8d0;
    text-decoration: none;
    border-bottom: 1px solid rgba(192, 200, 208, 0.3);
    transition: border-color 0.3s ease;
}

.references-list a:hover {
    border-bottom-color: #c0c8d0;
}

.about-section {
    margin-bottom: 5rem;
    padding-bottom: 2rem;
    text-align: left;
}

.about-section:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
}

/* Fixed sidebar for table of contents - repositioned */
.toc-sidebar {
    position: fixed;
    top: 200px;
    right: 5%;
    width: 200px;
    max-height: 70vh;
    background-color: rgba(16, 18, 20, 0.2); /* Much more transparent */
    overflow-y: auto;
    padding: 1.5rem 1rem;
    box-shadow: none; /* No shadow/glow */
    z-index: 100;
    border-radius: 5px;
    border: none; /* No border */
    transition: opacity 0.3s ease;
}

.toc-sidebar h2 {
    color: #d4d4d4;
    font-size: 1.1rem;
    margin: 0 0 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(125, 127, 131, 0.15);
    font-family: 'Playfair Display', 'Times New Roman', serif;
    letter-spacing: 0.3px;
    font-weight: 400;
    text-align: left;
}

.toc-sidebar ol {
    list-style-type: none;
    padding: 0;
    margin: 0;
}

.toc-sidebar li {
    margin: 0.5rem 0;
    font-size: 0.85rem;
}

.toc-sidebar a {
    color: #d4d4d4;
    text-decoration: none;
    display: block;
    padding: 0.25rem 0;
    transition: none; /* Remove hover transition */
}

.toc-sidebar a:hover {
    color: #d4d4d4; /* Keep the same color on hover */
    text-decoration: none; /* Remove underline on hover */
    background: none; /* Remove background on hover */
}

/* Hide TOC sidebar when not on about page */
body:not([data-page="about"]) .toc-sidebar {
    display: none;
}

/* Title section - refined zen style */
.title-container {
    background: transparent;
    color: #9a9d9e;
    padding: 4rem 0 3rem;
    margin-bottom: 4rem;
    text-align: left;
    border-bottom: 1px solid rgba(125, 127, 131, 0.15);
}

.title-container h1 {
    font-size: 2.6rem;
    margin: 0;
    font-weight: 400;
    font-family: 'Playfair Display', 'Times New Roman', serif;
    letter-spacing: 1.5px;
    color: #d4d4d4;
    line-height: 1.4;
    text-transform: uppercase;
    font-weight: 300;
}

.title-container .subtitle {
    font-size: 1.3rem;
    margin: 2rem 0 0;
    opacity: 0.85;
    font-family: 'Playfair Display', 'Times New Roman', serif;
    color: #9a9d9e;
    font-weight: 300;
    line-height: 1.6;
}

/* Section headings with refined spacing */
.about-section h2 {
    color: #d4d4d4;
    font-size: 1.9rem;
    margin: 4rem 0 2.5rem;
    padding-bottom: 0.6rem;
    border-bottom: 1px solid rgba(125, 127, 131, 0.15);
    font-family: 'Playfair Display', 'Times New Roman', serif;
    letter-spacing: 0.3px;
    font-weight: 400;
    text-align: left;
    line-height: 1.4;
}

.about-section h3 {
    color: #9a9d9e;
    font-size: 1.6rem;
    margin: 3rem 0 2rem;
    font-family: 'Playfair Display', 'Times New Roman', serif;
    letter-spacing: 0.2px;
    font-weight: 400;
    text-align: left;
    line-height: 1.4;
}

.about-section p {
    margin-bottom: 2rem;
    text-align: left;
    color: #c0c8d0;
    line-height: 1.9;
    font-size: 1.05rem;
}

/* Code blocks - simple, no syntax highlighting */
pre.code-example {
    background: rgba(16, 18, 20, 0.9);
    border-radius: 5px;
    padding: 2rem;
    margin: 2rem 0;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 0.95rem;
    line-height: 1.7;
    overflow-x: auto;
    color: #d4d4d4;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.15);
}

pre.code-example code {
    display: block;
    white-space: pre;
    color: #d4d4d4;
    font-family: inherit;
}

/* Hide original table of contents */
.about-section:first-child {
    display: none;
}

/* Reduced padding for home page content */
body[data-page="home"] .content,
.content[data-page="home"] {
    padding-top: 10px; /* Reduced from whatever it was before */
}

/* Title container with reduced top spacing for home page */
body[data-page="home"] .title-container,
div[data-page="home"] .title-container {
    padding-top: 1rem; /* Reduced padding for home page */
    margin-bottom: 2rem;
}

/* Keep normal spacing for about page */
body[data-page="about"] .title-container,
div[data-page="about"] .title-container {
    padding: 4rem 0 3rem; /* Original padding */
    margin-bottom: 4rem;
}