:root {
    --bg: #010409;
    --header: #0d1117;
    --card: #161b22;
    --border: #30363d;
    --primary: #f85149;
    --accent: #ff7b72;
    --success: #f85149;
    --danger: #da3633;
    --warning: #d29922;
    --text: #c9d1d9;
    --white: #f0f6fc;
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Source Sans 3', sans-serif;
    background: var(--bg);
    color: var(--text);
    margin: 0;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

.header {
    background: linear-gradient(135deg, #0d1117 0%, #161b22 50%, #0d1117 100%);
    color: #fff;
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 20px rgba(47, 129, 247, 0.15);
    flex-shrink: 0;
    z-index: 10;
    border-bottom: 2px solid var(--primary);
}

.header-container {
    display: flex;
    align-items: center;
}

#home-btn, #restart-btn, #menu-toggle {
    margin-right: 8px;
    padding: 6px 10px;
}

.header-title {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.1em;
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--primary);
}

.header-title span {
    color: var(--primary);
}

.progress-text {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9em;
    font-weight: 700;
    color: var(--warning);
    background: rgba(0, 0, 0, 0.4);
    padding: 4px 12px;
    border-radius: 6px;
    border: 1px solid rgba(210, 153, 34, 0.3);
}

.main {
    display: none; /* Hidden by default, shown via JS as 'flex' */
    flex: 1;
    overflow: hidden;
    position: relative;
}

/* Sidebar behavior */
.sidebar {
    width: 260px;
    background: var(--header);
    border-right: 1px solid var(--border);
    overflow-y: auto;
    padding: 12px;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
    align-content: start;
    flex-shrink: 0;
    transition: transform 0.3s ease;
}

.content {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

.card {
    background: var(--card);
    max-width: 900px;
    width: 100%;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    margin-bottom: 40px;
    border: 1px solid var(--border);
}

/* Navigation Buttons */
.nav-btn {
    height: 34px;
    border: 1px solid var(--border);
    background: var(--card);
    cursor: pointer;
    font-weight: 700;
    font-size: 0.82em;
    border-radius: 5px;
    transition: all 0.15s;
    color: #8b949e;
    font-family: 'JetBrains Mono', monospace;
}

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

.nav-btn.answered-correct {
    background: #051d0f;
    border-color: var(--success);
    color: #3fb950;
}

.nav-btn.answered-wrong {
    background: #2d0b09;
    border-color: var(--danger);
    color: #ff7b72;
}

.nav-btn.flagged {
    border: 2px solid var(--warning);
}

/* Questions and Options */
.q-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 10px;
}

.tag {
    background: var(--primary);
    color: white;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.7em;
    font-weight: 700;
    text-transform: uppercase;
    font-family: 'JetBrains Mono', monospace;
}

.q-num {
    color: #8b949e;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8em;
}

.q-text {
    font-size: 1.1em;
    font-weight: 600;
    margin-bottom: 20px;
    line-height: 1.5;
    color: var(--white);
}

.option {
    width: 100%;
    text-align: left;
    padding: 14px 18px;
    margin-bottom: 10px;
    background: var(--header);
    border: 2px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    font-size: 1em;
    transition: all 0.2s;
    color: #c9d1d9;
}

.option.opt-correct {
    border-color: var(--success);
    background: rgba(46, 160, 67, 0.15);
    color: #3fb950;
}

.option.opt-wrong {
    border-color: var(--danger);
    background: rgba(248, 81, 73, 0.1);
    color: #ff7b72;
}

.option.opt-dim {
    opacity: 0.5;
}

.option.locked {
    cursor: default;
}

.option.selected {
    border-color: var(--primary);
    background: rgba(248, 81, 73, 0.1);
}

.options {
    display: flex;
    flex-direction: column;
}

.explanation-box {
    margin-top: 20px;
    padding: 15px;
    background: rgba(163, 113, 247, 0.1);
    border: 1px solid rgba(163, 113, 247, 0.2);
    border-radius: 8px;
    font-size: 0.95em;
    color: #d2a8ff;
    line-height: 1.5;
}

.next-btn-wrap {
    text-align: center;
    margin-top: 20px;
}

.footer {
    display: none; /* Hidden by default */
    background: var(--header);
    padding: 10px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

#status {
    font-weight: 700;
    color: #8b949e;
    font-size: 0.9em;
    font-family: 'JetBrains Mono', monospace;
}

#next-footer-btn {
    display: none;
    margin-left: 10px;
}

.show {
    display: inline-block !important;
}

.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 1em;
    font-weight: 700;
    cursor: pointer;
    color: white;
    transition: background 0.2s;
}

.btn-p { background: var(--primary); }
.btn-p:hover { background: #da3633; }
.btn-s { background: #21262d; border: 1px solid var(--border); }
.btn-s:hover { background: #30363d; }
.btn-w { background: var(--warning); color: #111; }
.btn-w:hover { background: #e3b341; }
.btn-g { background: var(--success); }
.btn-g:hover { background: #3fb950; }

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .sidebar {
        position: absolute;
        left: 0;
        top: 0;
        bottom: 0;
        z-index: 100;
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .header-title {
        font-size: 0.9em;
    }

    .content {
        padding: 10px;
    }
    }

    /* Version Tag */
    .version-tag {
    position: fixed;
    bottom: 5px;
    right: 10px;
    font-size: 0.65em;
    color: #444;
    font-family: 'JetBrains Mono', monospace;
    pointer-events: none;
    z-index: 3000;
    }

    .card {
        padding: 15px;
    }

    .btn {
        padding: 6px 12px;
        font-size: 0.9em;
    }
}

#start-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg);
    z-index: 2000;
    overflow-y: auto;
    display: block;
}

.start-box p {
    font-size: 1em;
    line-height: 1.6;
    color: #8b949e;
    margin: 20px 0;
}

.stats {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin: 20px 0;
}

.stat {
    text-align: center;
}

.stat-num {
    font-size: 1.5em;
    font-weight: 700;
    color: var(--primary);
    font-family: 'JetBrains Mono', monospace;
}

.stat-label {
    font-size: 0.7em;
    color: #8b949e;
    text-transform: uppercase;
    letter-spacing: 1px;
}

#results-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg);
    z-index: 2000;
    overflow-y: auto;
    display: none; /* Hidden by default */
}

.results-content {
    background: var(--card);
    padding: 30px;
    border-radius: 12px;
    max-width: 800px;
    width: 100%;
    text-align: center;
    border: 1px solid var(--border);
    margin-bottom: 20px;
}

.results-content h1 {
    margin: 0;
    color: var(--white);
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.8em;
}

.score-circle {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2.5em;
    font-weight: 900;
    color: white;
    margin: 20px auto;
    background: linear-gradient(135deg, var(--accent), var(--primary));
    border: 4px solid var(--border);
}

#raw-score {
    font-size: 1.1em;
    color: #8b949e;
    margin-bottom: 20px;
    font-family: 'JetBrains Mono', monospace;
}

.review-item {
    text-align: left;
    background: var(--card);
    padding: 15px;
    margin-bottom: 10px;
    border-radius: 8px;
    border-left: 4px solid #444;
    width: 100%;
    max-width: 800px;
    border: 1px solid var(--border);
}

.review-item.correct { border-left-color: var(--success); }
.review-item.wrong { border-left-color: var(--danger); }

.review-item strong { color: var(--white); font-size: 0.95em; }

.review-explanation {
    margin-top: 10px;
    font-size: 0.85em;
    color: #8b949e;
    background: rgba(163, 113, 247, 0.1);
    padding: 10px;
    border-radius: 6px;
}

#review-list {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.center-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    min-height: 100%;
    width: 100%;
    padding: 20px;
}

.start-box {
    background: var(--card);
    padding: 40px;
    border-radius: 12px;
    max-width: 500px;
    width: 100%;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    border: 1px solid var(--border);
}

.start-box h1 {
    margin: 0;
    color: var(--primary);
    font-family: 'JetBrains Mono', monospace;
    font-size: 2em;
}

.start-box h1 span {
    color: var(--primary);
}

.subtitle {
    font-size: 0.8em;
    color: #8b949e;
    margin-bottom: 20px;
    font-family: 'JetBrains Mono', monospace;
    letter-spacing: 2px;
    text-transform: uppercase;
}

/* High Score & Start Actions */
.high-score-box {
    margin: 15px 0;
    padding: 10px;
    background: rgba(46, 160, 67, 0.1);
    border: 1px solid rgba(46, 160, 67, 0.2);
    border-radius: 8px;
    color: var(--success);
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    font-size: 0.95em;
    display: none; /* Shown via JS if score exists */
}

.start-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 25px;
}

.start-actions .btn {
    width: 100%;
}

