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

:root {
    /* Background and text colors */
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;

    /* Level colors will be injected dynamically by JavaScript from levels.json */
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    background: var(--bg-primary);
    min-height: 100vh;
    color: var(--text-primary);
}

/* Dark scrollbar styling */
* {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.3) rgba(255, 255, 255, 0.1);
}

*::-webkit-scrollbar {
    width: 12px;
}

*::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

*::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 6px;
}

*::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.4);
}

.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar Styles */
.sidebar {
    width: 320px;
    background: var(--bg-secondary);
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    position: fixed;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-content {
    padding: 2.5rem 1.5rem;
}

.sidebar-title {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, #10b981 0%, #8b5cf6 50%, #f59e0b 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sidebar-description {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 2.5rem;
}

.level-buttons {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.level-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid transparent;
    border-radius: 12px;
    padding: 1.25rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    position: relative;
    overflow: hidden;
}

.level-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--level-1-color);
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* Level button ::before styles are generated dynamically by JavaScript */

.level-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateX(4px);
}

.level-btn:hover::before {
    opacity: 1;
}

.level-btn.active::before {
    opacity: 1;
}

/* Level button .active styles are generated dynamically by JavaScript */

/* Context Button Styles */
.context-btn {
    border: 2px solid rgba(255, 255, 255, 0.2);
    margin-bottom: 0.5rem;
}

.context-btn .level-number {
    font-size: 1.5rem;
}

.context-btn:hover {
    transform: translateX(4px) scale(1.02);
}

/* Sidebar Divider */
.sidebar-divider {
    height: 1px;
    background: linear-gradient(to right, transparent, rgba(255, 255, 255, 0.2), transparent);
    margin: 1.5rem 0;
}

.level-number {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-secondary);
    letter-spacing: 0.05em;
}

.level-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.level-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Sidebar Credits */
.sidebar-credits {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.credits-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.credits-names {
    font-size: 0.9rem;
    color: var(--text-primary);
    line-height: 1.6;
}

/* Main Content Styles */
.main-content {
    flex: 1;
    margin-left: 320px;
    padding: 3rem;
}

.text-container {
    max-width: 900px;
    margin: 0 auto;
}

.current-level-indicator {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 0.75rem 1.25rem;
    margin-bottom: 2rem;
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.indicator-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.indicator-value {
    font-size: 0.9rem;
    color: var(--text-primary);
    font-weight: 600;
}

.text-content {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 16px;
    padding: 3rem;
    font-size: 1.15rem;
    line-height: 1.9;
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Context text paragraph styles */
.text-content p {
    margin-bottom: 1.5rem;
}

.text-content p:first-child {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--text-primary);
}

.text-content p:last-child {
    margin-bottom: 0;
}

/* Article Metadata Styles */
.article-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    line-height: 1.3;
}

.article-author,
.article-date,
.article-source {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-right: 1rem;
}

.article-author::before {
    content: "By ";
}

.article-date::before {
    content: "• ";
    margin-right: 0.5rem;
}

.article-source::before {
    content: "• ";
    margin-right: 0.5rem;
}

/* Add spacing after metadata section */
.article-title + br,
.article-author + br,
.article-date + br,
.article-source + br {
    display: block;
    margin-bottom: 1.5rem;
}

/* Highlight Styles */
.highlight {
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    font-weight: 500;
    border-bottom: 2px solid;
}

/* Highlight styles for all levels are generated dynamically by JavaScript */

/* Tooltip Styles */
.tooltip-bubble {
    position: fixed;
    background: var(--bg-secondary);
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    padding: 0;
    max-width: 400px;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
    transform: translateY(-10px);
    border: 2px solid;
    overflow: hidden;
}

/* Tooltip bubble border colors are generated dynamically by JavaScript */

.tooltip-bubble.show {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.tooltip-header {
    padding: 0.75rem 1.25rem;
    font-weight: 600;
    font-size: 0.85rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

/* Tooltip header colors are generated dynamically by JavaScript */

.tooltip-content {
    padding: 1.25rem;
    color: var(--text-primary);
    font-size: 0.95rem;
    line-height: 1.7;
}

.tooltip-arrow {
    position: absolute;
    width: 16px;
    height: 16px;
    background: var(--bg-secondary);
    transform: rotate(45deg);
    bottom: -9px;
    left: 50%;
    margin-left: -8px;
    border-bottom: 2px solid;
    border-right: 2px solid;
}

/* Tooltip arrow colors are generated dynamically by JavaScript */

/* Responsive Design */
@media (max-width: 1024px) {
    .sidebar {
        width: 280px;
    }

    .main-content {
        margin-left: 280px;
        padding: 2rem;
    }

    .text-content {
        padding: 2rem;
    }
}

@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
    }

    .sidebar {
        position: static;
        width: 100%;
        height: auto;
        border-right: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    .sidebar-content {
        padding: 1.5rem;
    }

    .level-buttons {
        flex-direction: row;
        overflow-x: auto;
    }

    .level-btn {
        min-width: 180px;
    }

    .main-content {
        margin-left: 0;
        padding: 1.5rem;
    }

    .text-content {
        padding: 1.5rem;
        font-size: 1rem;
    }

    .tooltip-bubble {
        max-width: 300px;
    }
}
