:root {
    --bg-color: #0f1a2a;
    --text-color: #e8e8e8;
    --accent-color: #ff8800;
    --highlight-color: #2d3e56;
    --variant-color: #5a6d8a;
    --header-bg: #0f1a2a;
    --max-width: 800px;
}

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

body {
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 18px;
    line-height: 1.7;
    color: var(--text-color);
    background-color: var(--bg-color);
}

header {
    position: relative;
    background-color: var(--header-bg);
    color: white;
    padding: 2rem 1rem 1rem;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    font-weight: normal;
    color: var(--accent-color);
    text-shadow:
        0 0 10px rgba(255, 136, 0, 0.8),
        0 0 20px rgba(255, 136, 0, 0.6),
        0 0 30px rgba(255, 136, 0, 0.4),
        0 0 40px rgba(255, 136, 0, 0.2);
    letter-spacing: 0.05em;
}

.subtitle {
    font-size: 1rem;
    opacity: 0.9;
    font-style: italic;
    margin-bottom: 1rem;
}

.base-selector {
    margin: 1rem 0 1.5rem;
}

.base-selector label {
    font-size: 0.9rem;
    margin-right: 0.5rem;
    opacity: 0.9;
}

.base-select {
    background-color: rgba(255,255,255,0.9);
    color: #2c2c2c;
    border: 2px solid rgba(255,255,255,0.5);
    padding: 0.4rem 0.8rem;
    font-size: 0.9rem;
    border-radius: 4px;
    cursor: pointer;
    font-family: inherit;
}

.base-select:hover {
    background-color: white;
}

.base-select:focus {
    outline: none;
    border-color: var(--accent-color);
}

.chapter-nav {
    display: flex;
    justify-content: flex-start;
    gap: 0.5rem;
    margin-top: 1.5rem;
    overflow-x: auto;
    padding: 0.5rem;
    max-width: 100%;
    -webkit-overflow-scrolling: touch;
}

.chapter-nav::-webkit-scrollbar {
    height: 6px;
}

.chapter-nav::-webkit-scrollbar-track {
    background: rgba(255,255,255,0.1);
}

.chapter-nav::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.3);
    border-radius: 3px;
}

.chapter-nav::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.5);
}

.nav-btn {
    background-color: rgba(255,255,255,0.1);
    color: white;
    border: 2px solid rgba(255,255,255,0.3);
    padding: 0.5rem 1.5rem;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 4px;
}

.nav-btn:hover {
    background-color: rgba(255,255,255,0.2);
}

.nav-btn.active {
    background-color: var(--accent-color);
    border-color: var(--accent-color);
}

main {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 2rem 1rem;
}

#info-panel {
    background-color: var(--highlight-color);
    padding: 1rem 1.5rem;
    margin-bottom: 2rem;
    border-radius: 8px;
    border-left: 4px solid var(--accent-color);
}

#info-panel p {
    margin: 0.5rem 0;
    font-size: 0.95rem;
}

.instructions {
    font-style: italic;
    color: #b0b0b0;
}

#text-display {
    background: #243447;
    padding: 3rem 2.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.3);
    min-height: 400px;
}

#text-display p {
    margin-bottom: 1.2rem;
    text-align: justify;
    text-indent: 1.5rem;
}

#text-display p:first-child {
    text-indent: 0;
}

/* Paragraph-level variants (block display) */
p.variant {
    background-color: var(--highlight-color);
    border-left: 4px solid var(--variant-color);
    cursor: help;
    padding: 0.5rem 1rem;
    margin: 0.5rem 0;
    transition: all 0.2s ease;
    position: relative;
    border-radius: 4px;
}

p.variant:hover {
    background-color: rgba(90, 109, 138, 0.4);
    box-shadow: 0 2px 8px rgba(255, 136, 0, 0.3);
}

/* Sentence-level variants (inline display) */
span.variant {
    background-color: var(--highlight-color);
    border-bottom: 2px solid var(--variant-color);
    cursor: help;
    padding: 0.1rem 0.2rem;
    transition: all 0.2s ease;
    position: relative;
    border-radius: 2px;
}

span.variant:hover {
    background-color: rgba(90, 109, 138, 0.4);
    box-shadow: 0 1px 4px rgba(255, 136, 0, 0.3);
}

.tooltip {
    position: absolute;
    background: #2d3e56;
    border: 2px solid var(--accent-color);
    border-radius: 8px;
    padding: 1rem;
    max-width: 500px;
    max-height: 400px;
    overflow-y: auto;
    box-shadow: 0 4px 16px rgba(0,0,0,0.5);
    z-index: 1000;
    font-size: 0.9rem;
    color: var(--text-color);
}

.tooltip.hidden {
    display: none;
}

.tooltip-header {
    font-weight: bold;
    color: var(--accent-color);
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

#variant-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

#variant-list li {
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    transition: background-color 0.2s ease;
}

#variant-list li:last-child {
    border-bottom: none;
}

#variant-list li:before {
    content: "→ ";
    color: var(--accent-color);
    font-weight: bold;
}

.variant-item.expandable {
    cursor: pointer;
    padding: 0.6rem 0.5rem;
    border-radius: 4px;
}

.variant-item.expandable:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.variant-item.expanded {
    background-color: rgba(255, 255, 255, 0.08);
    padding: 0.8rem;
    margin: 0.5rem 0;
}

.variant-text {
    display: block;
    margin-bottom: 0.25rem;
}

.version-count {
    font-size: 0.85em;
    color: #a0a0a0;
    font-style: italic;
    margin-left: 0.5rem;
    display: inline;
}

.expand-hint {
    display: block;
    font-size: 0.75em;
    color: var(--accent-color);
    font-style: italic;
    margin-top: 0.25rem;
    opacity: 0.7;
}

.variant-item.expandable:hover .expand-hint {
    opacity: 1;
}

.version-details {
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px dashed rgba(255, 255, 255, 0.2);
    font-size: 0.8em;
    color: #b0b0b0;
    font-family: 'Courier New', monospace;
}

/* Omissions - paragraphs missing in some versions */
.variant-item.omission {
    background-color: rgba(255, 152, 0, 0.15);
    border-left: 3px solid #ff9800;
    padding-left: 0.5rem;
}

.variant-item.omission .variant-text {
    font-style: italic;
    color: #ffb74d;
}

.variant-item.omission:hover {
    background-color: rgba(255, 152, 0, 0.25);
}

.variant-item.omission:before {
    content: "⊘ ";
    color: #ff9800;
}

/* Agreements - same text as base version */
.variant-item.agreement {
    background-color: rgba(76, 175, 80, 0.15);
    border-left: 3px solid #66bb6a;
    padding-left: 0.5rem;
}

.variant-item.agreement .variant-text {
    font-style: italic;
    color: #81c784;
}

.variant-item.agreement:hover {
    background-color: rgba(76, 175, 80, 0.25);
}

.variant-item.agreement:before {
    content: "≡ ";
    color: #4caf50;
}

footer {
    text-align: center;
    padding: 2rem 1rem;
    color: #a0a0a0;
    font-size: 0.9rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: 3rem;
}

footer a {
    color: var(--accent-color);
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

/* Loading state */
.loading {
    text-align: center;
    padding: 3rem;
    color: #999;
    font-style: italic;
}

/* Responsive */

/* Tablet and below */
@media (max-width: 768px) {
    body {
        font-size: 16px;
    }

    header {
        padding: 1.5rem 1rem 0.75rem;
    }

    header h1 {
        font-size: 2rem;
        text-shadow:
            0 0 8px rgba(255, 136, 0, 0.8),
            0 0 16px rgba(255, 136, 0, 0.6),
            0 0 24px rgba(255, 136, 0, 0.4);
    }

    .subtitle {
        font-size: 0.9rem;
    }

    main {
        padding: 1.5rem 1rem;
    }

    #text-display {
        padding: 2rem 1.5rem;
    }

    .tooltip {
        max-width: 280px;
    }
}

/* Mobile */
@media (max-width: 640px) {
    body {
        font-size: 15px;
    }

    header {
        padding: 1rem 0.75rem 0.5rem;
    }

    header h1 {
        font-size: 1.75rem;
        text-shadow:
            0 0 6px rgba(255, 136, 0, 0.8),
            0 0 12px rgba(255, 136, 0, 0.6),
            0 0 18px rgba(255, 136, 0, 0.4);
    }

    .subtitle {
        font-size: 0.85rem;
    }

    .nav-btn {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }

    .chapter-nav {
        gap: 0.4rem;
        padding: 0.5rem 0;
    }

    main {
        padding: 1rem 0.75rem;
    }

    #info-panel {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }

    #text-display {
        padding: 1.5rem 1rem;
    }

    #text-display p {
        text-align: left;
        text-indent: 0;
    }

    .tooltip {
        max-width: calc(100vw - 2rem);
        left: 1rem !important;
        right: 1rem;
    }

    footer {
        padding: 1.5rem 1rem;
        font-size: 0.85rem;
    }
}
