:root {
    --accent: #c0392b;
    --accent-dark: #a0281f;
    --green: #2ecc71;
    --muted: #888;
    --bg: #f2f4f8;
    --card: #fff;
}

html,
body {
    height: 100%;
    margin: 0;
    font-family: "Segoe UI", Arial, sans-serif;
    background: var(--bg)
}

.app {
    display: flex;
    height: 100vh;
    gap: 18px;
    padding: 18px;
    box-sizing: border-box;
}

/* LEFT NAV */
.left-nav {
    width: 255px;
    background: var(--card);
    border-radius: 10px;
    padding: 12px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.06);
    overflow: auto;
}

.left-nav h3 {
    margin: 0 0 8px 0;
    font-size: 16px;
    color: #222;
}

.section-item {
    border-radius: 8px;
    padding: 8px;
    margin-bottom: 10px;
    border: 1px solid #eee;
}

.section-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
}

.section-title .label {
    font-weight: 600;
    color: #333
}

.section-title .count {
    font-size: 12px;
    color: var(--muted)
}

.subboxes {
    margin-top: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    /* space between boxes */
}

.subbox {
    width: 30px;
    /* ⭐ small enough to guarantee 5 per row */
    height: 18px;
    border-radius: 4px;
    background: var(--accent);
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.06);
}

.subbox.answered {
    background: var(--green);
}

.subbox.unanswered {
    background: var(--accent);
}

.subbox:hover {
    transform: translateY(-1px);
}


/* MAIN CONTENT */
.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.controls {
    display: flex;
    gap: 8px;
    align-items: center;
}

button {
    padding: 10px 14px;
    border-radius: 8px;
    border: 0;
    background: #0066ff;
    color: #fff;
    cursor: pointer;
    font-weight: 600;
}

button.ghost {
    background: transparent;
    color: #0066ff;
    border: 1px solid #cfe0ff
}

.paper {
    background: var(--card);
    border-radius: 10px;
    padding: 18px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.06);
    overflow: auto;
}

/* question block */
.q-block {
    padding: 12px;
    border-radius: 8px;
    margin: 10px 0;
    border: 1px solid #eee;
    background: #fafafa;
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.q-index {
    width: 48px;
    flex: 0 0 48px;
    text-align: left;
    color: #333;
    font-weight: 700;
    font-size: 18px;
}

/* q-body holds question text and controls */
.q-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px
}

.q-meta {
    min-width: 170px;
    flex: 0 0 170px
}

.q-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 220px;
}

/* pre for question text */
pre.q-text {
    display: inline;
    font-family: inherit;
    font-size: 18px;
    background: transparent;
    border: none;
    padding: 0;
    margin: 0;
    white-space: pre-wrap;
    color: #222;
}

/* pre for options */
pre.opt-pre {
    display: inline-block;
    font-family: inherit;
    font-size: 16px;
    background: transparent;
    border: none;
    padding: 0;
    margin: 0;
    white-space: normal;
    /* IMPORTANT FIX */
    color: #222;
}

/* inputs */
input[type="text"],
select,
textarea {
    width: 100%;
    padding: 8px;
    border-radius: 6px;
    border: 1px solid #bbb;
    font-size: 15px;
    margin-top: 6px;
    box-sizing: border-box;
}

/* ----------- FIXED MCQ HORIZONTAL OPTION B ----------- */

.mcq-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 6px;
}

/* each option block behaves like a pill */
.mcq-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid #e1e1e1;
    background: #fff;
    cursor: pointer;
    user-select: none;
    font-size: 15px;
    white-space: nowrap;
    /* keep text on same line */
}

.mcq-option input {
    flex-shrink: 0;
}

.mcq-option:hover {
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.06);
}

/* match table */
.match-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 8px
}

.match-table td {
    padding: 8px;
    border: 1px solid #eee;
    vertical-align: middle
}

.match-left {
    width: 50%;
    font-weight: 600;
}

.match-right {
    width: 50%;
}

/* highlight when navigated */
.highlight {
    box-shadow: 0 0 0 3px rgba(0, 150, 80, 0.08);
    border-color: #b7f0cf;
}

/* result */
#result {
    margin-top: 12px;
    padding: 12px;
    border-radius: 8px;
    background: #e9ffe9;
    border-left: 6px solid #00a000;
    display: none
}

/* responsive */
@media (max-width:900px) {
    .app {
        flex-direction: column
    }

    .left-nav {
        width: 100%;
        display: flex;
        overflow-x: auto
    }

    .q-block {
        flex-direction: column;
    }

    .q-actions {
        min-width: 100%;
    }
}

.right-title {
    font-size: 22px;
    font-weight: 700;
    color: #333;
    margin: 0;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 2px solid #eee;
    display: none;
}