:root {
    --bg: #f1f5f9;
    --panel: #ffffff;
    --ink: #172033;
    --muted: #64748b;
    --line: #d8e2ee;
    --blue: #1d72d2;
    --green: #087f5b;
    --red: #b42318;
    --amber: #b7791f;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
    margin: 0;
    background: linear-gradient(180deg, #eef5fb 0%, #f8fafc 42%, #eef2f7 100%);
    color: var(--ink);
    font-family: Arial, sans-serif;
}
.list-hero, .runner-header {
    background: #10213d;
    color: #fff;
    padding: 22px 28px;
    border-bottom: 4px solid var(--blue);
}
.list-hero {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
}
.hero-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}
.runner-header {
    display: grid;
    grid-template-columns: auto auto minmax(0, 1fr) 132px;
    gap: 18px;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 20;
}
.eyebrow {
    margin: 0 0 6px;
    color: #b9d7ff;
    font-weight: 800;
    font-size: 13px;
}
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: 27px; }
h2 { font-size: 18px; color: #10213d; }
.list-hero p, .runner-title p { color: #d4e2f4; margin-bottom: 0; }
.nav-link {
    color: #10213d;
    background: #e8f3ff;
    border-radius: 8px;
    padding: 10px 12px;
    text-decoration: none;
    font-weight: 800;
    justify-self: start;
}
.timer {
    justify-self: end;
    background: #e8f3ff;
    color: #10213d;
    border-radius: 8px;
    padding: 11px 14px;
    font-weight: 900;
    font-size: 20px;
}
.list-shell, .runner-shell {
    max-width: 1180px;
    margin: 0 auto;
    padding: 18px;
}
.filter-panel {
    display: grid;
    grid-template-columns: minmax(220px, 2fr) repeat(4, minmax(130px, 1fr)) 110px;
    gap: 10px;
    margin-bottom: 14px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px;
    align-items: end;
}
label {
    display: block;
    color: #24324a;
    font-weight: 800;
    font-size: 13px;
    margin-bottom: 6px;
}
input, select {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px;
    font-size: 16px;
    background: #fff;
}
button {
    border: 0;
    border-radius: 8px;
    background: var(--blue);
    color: #fff;
    padding: 12px 14px;
    font-weight: 800;
    cursor: pointer;
}
.summary {
    color: var(--muted);
    margin-bottom: 14px;
}
.exam-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}
.exam-card, .nav-panel, .question-panel, .result-panel, .setup-panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 16px;
    box-shadow: 0 14px 40px rgba(16, 33, 61, 0.08);
}
.exam-card h2 { margin-bottom: 8px; }
.exam-meta {
    color: var(--muted);
    line-height: 1.5;
    margin-bottom: 12px;
}
.tag-row {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin: 10px 0;
}
.tag {
    background: #e8f3ff;
    color: #123761;
    border-radius: 999px;
    padding: 5px 8px;
    font-size: 12px;
    font-weight: 800;
}
.status-pill {
    display: inline-block;
    border-radius: 999px;
    padding: 5px 8px;
    font-size: 12px;
    font-weight: 900;
    background: #e8eef7;
    color: #20324d;
}
.status-pill.published { background: #d8f3e9; color: #075f46; }
.status-pill.draft { background: #fff1d6; color: #8a5a12; }
.status-pill.archived { background: #e8eef7; color: #475569; }
.card-actions {
    display: flex;
    gap: 8px;
}
.open-btn {
    display: inline-block;
    background: var(--blue);
    color: #fff;
    border-radius: 8px;
    padding: 10px 12px;
    text-decoration: none;
    font-weight: 800;
}
.disabled {
    opacity: 0.58;
}
.runner-shell {
    display: grid;
    grid-template-columns: 270px minmax(0, 1fr);
    gap: 16px;
}
.nav-panel {
    align-self: start;
    position: sticky;
    top: 16px;
}
.dots {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 12px 0 16px;
}
.progress-mini {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px;
    background: #f8fbff;
    display: flex;
    justify-content: space-between;
    gap: 10px;
    color: var(--muted);
}
.progress-mini strong {
    color: var(--ink);
}
.dot {
    width: 34px;
    height: 34px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: #fff;
    color: #24324a;
    font-weight: 900;
    padding: 0;
}
.dot.active { background: var(--blue); color: #fff; }
.dot.answered { background: #e8f3ff; border-color: #9cc7f3; }
.dot.correct { border-color: var(--green); box-shadow: 0 0 0 3px rgba(8, 127, 91, 0.16); }
.dot.wrong { border-color: var(--red); box-shadow: 0 0 0 3px rgba(180, 35, 24, 0.16); }
.finish-btn, .restart-btn { width: 100%; }
.finish-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}
.setup-panel {
    min-height: 420px;
    display: grid;
    align-content: center;
}
.setup-panel h2 {
    font-size: 28px;
    margin-bottom: 8px;
}
.setup-panel p {
    color: var(--muted);
}
.mode-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin-top: 18px;
}
.mode-card {
    background: #fff;
    color: var(--ink);
    border: 1px solid var(--line);
    min-height: 150px;
    text-align: left;
    display: grid;
    align-content: start;
    gap: 10px;
    transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}
.mode-card:hover {
    transform: translateY(-2px);
    border-color: #9cc7f3;
    box-shadow: 0 18px 36px rgba(29, 114, 210, 0.14);
}
.mode-card.primary {
    background: #10213d;
    border-color: #10213d;
    color: #fff;
}
.mode-card span {
    display: block;
    font-size: 20px;
}
.mode-card small {
    color: inherit;
    opacity: 0.78;
    line-height: 1.5;
    font-weight: 600;
}
.question-count {
    color: var(--muted);
    font-weight: 800;
    margin-bottom: 10px;
}
.question-text {
    font-size: 22px;
    line-height: 1.35;
    margin-bottom: 18px;
    font-weight: 800;
}
.question-image-wrap {
    margin: 0 0 18px;
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    padding: 12px;
}
.question-image {
    display: block;
    width: 100%;
    max-height: 620px;
    object-fit: contain;
}
.question-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.mode-chip {
    border-radius: 999px;
    background: #eef6ff;
    color: #123761;
    padding: 7px 10px;
    font-size: 12px;
    font-weight: 900;
}
.option {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    width: 100%;
    background: #f8fbff;
    border: 1px solid var(--line);
    color: var(--ink);
    text-align: left;
    margin-bottom: 10px;
    padding: 13px;
    transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}
.option:hover:not(:disabled) {
    transform: translateY(-1px);
    border-color: #9cc7f3;
}
.option.selected {
    background: #eef6ff;
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(29, 114, 210, 0.12);
}
.option:disabled {
    cursor: default;
}
.option.correct {
    background: #d8f3e9;
    border-color: var(--green);
    color: #075f46;
}
.option.wrong {
    background: #ffe3e0;
    border-color: var(--red);
    color: #971b12;
}
.question-feedback {
    border-radius: 8px;
    padding: 13px;
    margin-top: 12px;
    border: 1px solid var(--line);
}
.question-feedback.correct {
    background: #d8f3e9;
    border-color: rgba(8, 127, 91, 0.35);
}
.question-feedback.wrong {
    background: #fff1f0;
    border-color: rgba(180, 35, 24, 0.28);
}
.question-feedback.empty {
    background: #fff8e8;
    border-color: rgba(183, 121, 31, 0.28);
}
.question-feedback p {
    margin: 6px 0 0;
    color: var(--ink);
    line-height: 1.55;
}
.runner-controls {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-top: 16px;
}
.runner-controls button {
    background: #e8eef7;
    color: #20324d;
}
.result-panel {
    grid-column: 2;
}
.score-wrap {
    display: grid;
    grid-template-columns: 170px minmax(0, 1fr);
    gap: 18px;
    align-items: center;
    margin-bottom: 20px;
}
.score-ring {
    width: 160px;
    height: 160px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: conic-gradient(var(--blue) 0deg, #e6edf7 0deg);
    position: relative;
}
.score-ring::after {
    content: "";
    position: absolute;
    inset: 16px;
    background: #fff;
    border-radius: 50%;
}
.score-ring span {
    position: relative;
    z-index: 1;
    font-size: 28px;
    font-weight: 900;
}
.stat-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 12px 0;
}
.stat {
    border-radius: 999px;
    padding: 8px 10px;
    font-weight: 800;
}
.stat.good { background: #d8f3e9; color: #075f46; }
.stat.bad { background: #ffe3e0; color: #971b12; }
.stat.neutral { background: #e8eef7; color: #20324d; }
.save-status {
    color: var(--muted);
    font-weight: 800;
    margin: 8px 0;
}
.save-status.success { color: var(--green); }
.save-status.warning { color: var(--amber); }
.save-status.error { color: var(--red); }
.result-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 10px 0;
}
.open-btn.secondary {
    background: #e8f3ff;
    color: #10213d;
}
.restart-btn.inline {
    width: auto;
    background: #e8eef7;
    color: #20324d;
}
.review-list {
    display: grid;
    gap: 10px;
}
.review-item {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 13px;
    background: #fbfdff;
}
.review-item.correct { border-left: 5px solid var(--green); }
.review-item.wrong { border-left: 5px solid var(--red); }
.review-item.empty { border-left: 5px solid var(--amber); }
.empty-state {
    color: var(--muted);
    text-align: center;
    padding: 28px;
}
.guest-gate {
    min-height: 420px;
    display: grid;
    align-content: center;
    justify-items: center;
    text-align: center;
    gap: 16px;
    border: 1px solid #cfe0f4;
    border-radius: 8px;
    padding: 34px 22px;
    background:
        linear-gradient(135deg, rgba(29, 114, 210, 0.12), rgba(15, 185, 244, 0.08)),
        #fff;
}
.guest-gate-icon {
    width: 64px;
    height: 64px;
    display: grid;
    place-items: center;
    border-radius: 18px;
    background: #e8f3ff;
    color: var(--blue);
    font-size: 30px;
    font-weight: 900;
}
.guest-gate-kicker {
    margin: 0;
    color: var(--blue);
    font-size: 13px;
    font-weight: 900;
    text-transform: uppercase;
}
.guest-gate h2 {
    max-width: 620px;
    margin: 0;
    color: #10213d;
    font-size: 30px;
    line-height: 1.15;
}
.guest-gate p {
    max-width: 640px;
    margin: 0;
    color: var(--muted);
    line-height: 1.65;
}
.guest-gate-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 4px;
}
.guest-gate-actions a {
    min-width: 132px;
    text-align: center;
}
.guest-gate-note {
    border: 1px solid #d8e2ee;
    border-radius: 8px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.72);
    color: #475569;
    font-size: 13px;
}
.nav-link.secondary {
    background: #eef4fb;
    color: #123761;
}
@media (max-width: 980px) {
    .exam-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .runner-shell { grid-template-columns: 1fr; }
    .result-panel { grid-column: 1; }
    .nav-panel { position: static; }
    .filter-panel { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .setup-panel { min-height: auto; }
}
@media (max-width: 680px) {
    body {
        background: #eef2f7;
    }

    .list-hero,
    .runner-header {
        display: grid;
        grid-template-columns: 1fr;
        gap: 10px;
        padding: 14px 14px 16px;
        position: static;
    }

    .runner-title {
        min-width: 0;
    }

    .runner-title h1,
    .list-hero h1 {
        font-size: 22px;
        line-height: 1.18;
        margin-bottom: 5px;
        overflow-wrap: anywhere;
    }

    .list-hero p,
    .runner-title p {
        font-size: 14px;
        line-height: 1.45;
    }

    .timer,
    .nav-link {
        justify-self: stretch;
        display: flex;
        align-items: center;
        justify-content: center;
        min-height: 40px;
        margin-top: 0;
        text-align: center;
    }

    .timer {
        width: fit-content;
        min-width: 96px;
        justify-self: start;
        font-size: 18px;
    }

    .list-shell,
    .runner-shell {
        padding: 10px;
    }

    .runner-shell {
        gap: 10px;
    }

    .exam-grid,
    .filter-panel,
    .score-wrap,
    .mode-grid {
        grid-template-columns: 1fr;
    }

    .filter-panel,
    .exam-card,
    .nav-panel,
    .question-panel,
    .result-panel,
    .setup-panel {
        padding: 12px;
        box-shadow: 0 8px 22px rgba(16, 33, 61, 0.06);
    }

    .nav-panel {
        order: -1;
    }

    .dots {
        gap: 6px;
    }

    .dot {
        width: 34px;
        height: 34px;
        border-radius: 8px;
    }

    .question-card-top {
        align-items: flex-start;
    }

    .question-text {
        font-size: 18px;
        line-height: 1.4;
    }

    .question-image-wrap {
        padding: 8px;
        margin-bottom: 12px;
    }

    .question-image {
        max-height: 520px;
    }

    .option {
        min-height: 46px;
        padding: 12px;
    }

    .runner-controls,
    .result-actions,
    .card-actions {
        display: grid;
        grid-template-columns: 1fr;
    }

    .runner-controls button,
    .result-actions a,
    .result-actions button,
    .card-actions a,
    .open-btn {
        width: 100%;
        text-align: center;
        justify-content: center;
    }

    .guest-gate {
        min-height: 360px;
        padding: 24px 14px;
        gap: 12px;
    }

    .guest-gate-icon {
        width: 54px;
        height: 54px;
        border-radius: 14px;
        font-size: 25px;
    }

    .guest-gate h2 {
        font-size: 23px;
    }

    .guest-gate p {
        font-size: 14px;
        line-height: 1.55;
    }

    .guest-gate-actions {
        width: 100%;
        display: grid;
        grid-template-columns: 1fr;
    }

    .guest-gate-actions a {
        width: 100%;
    }

    .score-ring {
        width: 132px;
        height: 132px;
        margin: 0 auto;
    }

    .score-ring span {
        font-size: 24px;
    }
}

@media (max-width: 420px) {
    .runner-title h1,
    .list-hero h1 {
        font-size: 20px;
    }

    .dot {
        width: 32px;
        height: 32px;
        font-size: 13px;
    }

    .mode-chip {
        max-width: 110px;
        text-align: center;
    }
}
