:root {
    --teal: #079b91;
    --teal-dark: #05746f;
    --teal-soft: #e7f8f6;
    --navy: #202337;
    --navy-2: #2f334b;
    --ink: #171a2a;
    --muted: #667085;
    --line: #dde3ec;
    --bg: #f4f7fb;
    --surface: rgba(255, 255, 255, .94);
    --green: #12805c;
    --red: #b42318;
    --amber: #b54708;
    --shadow: 0 22px 60px rgba(31, 41, 55, .12);
    --shadow-soft: 0 12px 28px rgba(31, 41, 55, .08);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 92px;
}

body {
    margin: 0;
    background:
        radial-gradient(circle at top left, rgba(7, 155, 145, .14), transparent 34rem),
        linear-gradient(180deg, #f8fafc 0%, var(--bg) 38%, #eef3f8 100%);
    color: var(--ink);
    font-family: Inter, "Segoe UI", Arial, Helvetica, sans-serif;
    font-size: 16px;
}

a {
    color: var(--teal-dark);
    text-decoration: none;
}

.page {
    min-height: 100vh;
    padding: clamp(14px, 3vw, 28px);
}

.center-shell {
    max-width: 520px;
    width: 100%;
    margin: clamp(16px, 5vw, 42px) auto;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: clamp(22px, 4vw, 34px);
    box-shadow: var(--shadow);
    backdrop-filter: blur(12px);
}

.logo {
    display: block;
    width: clamp(138px, 42vw, 208px);
    max-width: 70%;
    margin: 0 auto 28px;
}

h1, h2, h3 {
    margin: 0 0 14px;
    color: var(--navy);
}

h1 {
    font-size: clamp(24px, 5vw, 34px);
    line-height: 1.15;
}

h2 {
    font-size: clamp(20px, 4vw, 26px);
    line-height: 1.2;
}

h3 {
    font-size: clamp(16px, 3.5vw, 20px);
    line-height: 1.25;
}

p {
    line-height: 1.55;
}

.muted {
    color: var(--muted);
}

.form-grid {
    display: grid;
    gap: 14px;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin: 18px 0;
}

.info-tile {
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #f8fafc;
    padding: 14px;
}

.info-tile span {
    display: block;
    color: var(--muted);
    font-size: 13px;
    margin-bottom: 4px;
}

.info-tile strong {
    color: var(--navy);
    font-size: 18px;
}

.button-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 18px;
}

label {
    display: grid;
    gap: 6px;
    font-weight: 700;
}

input, select, textarea {
    width: 100%;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    padding: 12px 14px;
    font: inherit;
    background: #fff;
    transition: border-color .15s ease, box-shadow .15s ease;
}

input:focus, select:focus, textarea:focus {
    border-color: var(--teal);
    box-shadow: 0 0 0 4px rgba(7, 155, 145, .13);
    outline: none;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    border: 0;
    border-radius: 12px;
    padding: 11px 18px;
    background: var(--teal);
    color: #fff;
    font-weight: 700;
    cursor: pointer;
    transition: transform .12s ease, background .12s ease, box-shadow .12s ease;
}

.btn:hover {
    background: var(--teal-dark);
    transform: translateY(-1px);
}

.btn.secondary {
    background: var(--navy);
}

.btn.light {
    background: #eef3f8;
    color: var(--navy);
    border: 1px solid #dbe3ee;
}

.btn.danger {
    background: var(--red);
}

.alert {
    padding: 13px 15px;
    border-radius: 14px;
    margin: 14px 0;
    border: 1px solid var(--line);
    background: #fff;
}

.alert.error {
    color: var(--red);
    border-color: #fecaca;
    background: #fff5f5;
}

.alert.success {
    color: var(--green);
    border-color: #bbf7d0;
    background: #f0fdf4;
}

.app-header {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px clamp(14px, 3vw, 28px);
    background: rgba(255, 255, 255, .92);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 8px 24px rgba(32, 35, 55, .06);
    backdrop-filter: blur(12px);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 800;
    color: var(--navy);
}

.brand img {
    width: 42px;
    height: 42px;
    object-fit: contain;
}

.content {
    max-width: 1200px;
    margin: 0 auto;
    padding: clamp(14px, 3vw, 24px);
}

.quiz-layout {
    display: grid;
    grid-template-columns: minmax(220px, 250px) minmax(0, 1fr);
    gap: 22px;
}

.panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: clamp(16px, 2.5vw, 24px);
    box-shadow: var(--shadow-soft);
}

.nav-panel {
    align-self: start;
}

.question-panel {
    min-height: 520px;
}

.timer {
    font-size: clamp(22px, 5vw, 28px);
    font-weight: 800;
    color: var(--navy);
    letter-spacing: .02em;
}

.question-nav {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    margin-top: 16px;
}

.jump-question {
    display: none;
    margin-top: 12px;
    width: 100%;
}

.qnav {
    min-height: 38px;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    background: #fff;
    color: var(--navy);
    cursor: pointer;
    font-weight: 700;
}

.qnav.answered {
    background: var(--teal-soft);
    border-color: var(--teal);
    color: var(--teal-dark);
    box-shadow: inset 0 0 0 1px rgba(7, 155, 145, .18);
}

.qnav.active {
    background: var(--navy);
    border-color: var(--navy);
    color: #fff;
}

.qnav.active.answered {
    background: var(--navy);
    border-color: var(--navy);
    color: #fff;
}

.theme-title {
    margin: 4px 0 12px;
    font-size: 13px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .04em;
}

.option {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 14px;
    border: 1px solid #dbe3ee;
    border-radius: 14px;
    margin: 11px 0;
    cursor: pointer;
    line-height: 1.45;
    transition: border-color .12s ease, background .12s ease, box-shadow .12s ease;
}

.option input {
    width: auto;
    margin-top: 3px;
}

.option:has(input:checked) {
    border-color: var(--teal);
    background: #effdfa;
    box-shadow: inset 3px 0 0 var(--teal);
}

.question-actions {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: 20px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 14px;
}

.stat {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 18px;
    box-shadow: 0 10px 24px rgba(32, 35, 55, 0.04);
}

.stat strong {
    display: block;
    margin-top: 8px;
    font-size: 28px;
    color: var(--navy);
}

.dashboard-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(340px, .9fr);
    gap: 16px;
    margin-top: 16px;
}

.bar-row {
    display: grid;
    grid-template-columns: 130px 1fr 56px;
    gap: 10px;
    align-items: center;
    margin: 12px 0;
}

.bar-track {
    height: 14px;
    background: #e8eef6;
    border-radius: 99px;
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    background: var(--teal);
}

.bar-fill.red {
    background: var(--red);
}

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    min-width: 760px;
}

th, td {
    border-bottom: 1px solid var(--line);
    padding: 12px;
    text-align: left;
    vertical-align: top;
}

th {
    color: var(--navy);
    background: #f1f5f9;
    font-size: 13px;
}

.answer-list {
    display: grid;
    gap: 12px;
}

.answer-detail {
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 16px;
    background: #fff;
}

.answer-detail.correct {
    border-color: #bbf7d0;
    background: #f7fef9;
}

.answer-detail.wrong {
    border-color: #fecaca;
    background: #fff7f7;
}

.badge {
    display: inline-flex;
    border-radius: 999px;
    padding: 5px 9px;
    font-weight: 800;
    font-size: 12px;
}

.badge.green {
    color: var(--green);
    background: #dcfce7;
}

.badge.red {
    color: var(--red);
    background: #fee2e2;
}

.badge.amber {
    color: var(--amber);
    background: #fef3c7;
}

.admin-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

@media (max-width: 860px) {
    .quiz-layout,
    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .quiz-layout {
        display: flex;
        flex-direction: column;
    }

    .quiz-layout .question-panel {
        order: 1;
    }

    .quiz-layout .nav-panel {
        order: 2;
    }

    .app-header {
        position: static;
        align-items: flex-start;
        flex-direction: column;
        padding: 12px 14px;
    }

    .brand {
        width: 100%;
    }

    .brand img {
        width: 38px;
        height: 38px;
    }

    .admin-nav {
        width: 100%;
        overflow-x: auto;
        padding-bottom: 2px;
    }

    .admin-nav .btn {
        white-space: nowrap;
    }

    .question-nav {
        grid-template-columns: repeat(10, minmax(34px, 1fr));
    }

    .jump-question {
        display: inline-flex;
    }

    .question-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

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

@media (max-width: 560px) {
    body {
        font-size: 15px;
    }

    input, select, textarea {
        min-height: 44px;
        font-size: 16px;
    }

    .center-shell {
        border-radius: 16px;
        box-shadow: 0 10px 24px rgba(32, 35, 55, 0.08);
    }

    .panel {
        padding: 14px;
    }

    .quiz-layout {
        gap: 12px;
    }

    .question-nav {
        grid-template-columns: repeat(5, minmax(40px, 1fr));
    }

    .option {
        padding: 11px;
    }

    .bar-row {
        grid-template-columns: 1fr;
        gap: 6px;
    }

    .stat strong {
        font-size: 24px;
    }

    .table-wrap {
        margin-inline: -6px;
        padding-inline: 6px;
    }
}

@media (max-width: 380px) {
    .question-actions {
        grid-template-columns: 1fr;
    }
}
