* {
    box-sizing: border-box;
}

:root {
    --bg: #f5f7fb;
    --card: #ffffff;
    --text: #18212f;
    --muted: #667085;
    --line: #e4e7ec;
    --primary: #111827;
    --primary-soft: #eef2ff;
    --success: #137333;
    --success-bg: #eaf7ee;
    --danger: #b42318;
    --danger-bg: #fff1f0;
    --warning: #9a6700;
    --warning-bg: #fff8df;
}

html, body {
    min-height: 100%;
}

body {
    margin: 0;
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--text);
}

a {
    color: inherit;
}

.container {
    width: min(1100px, calc(100% - 32px));
    margin: 0 auto;
}

.page-center {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 32px 0;
}

.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 20px;
    box-shadow: 0 14px 40px rgba(16, 24, 40, 0.06);
}

.login-card {
    width: min(520px, 100%);
    padding: 28px;
}

h1, h2, h3, p {
    margin-top: 0;
}

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

.field {
    margin-bottom: 18px;
}

label {
    display: block;
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 8px;
}

input[type="text"] {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 13px 14px;
    font: inherit;
    outline: none;
}

input[type="text"]:focus {
    border-color: #98a2b3;
    box-shadow: 0 0 0 4px rgba(152, 162, 179, 0.14);
}

button, .btn {
    border: 0;
    border-radius: 12px;
    padding: 12px 18px;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

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

.btn-secondary {
    background: white;
    border: 1px solid var(--line);
    color: var(--text);
}

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

.btn-block {
    width: 100%;
}

.alert {
    border-radius: 12px;
    padding: 12px 14px;
    margin-bottom: 18px;
    font-size: 14px;
}

.alert-danger {
    background: var(--danger-bg);
    color: var(--danger);
}

.alert-warning {
    background: var(--warning-bg);
    color: var(--warning);
}

.exam-page {
    user-select: none;
    -webkit-user-select: none;
}

.exam-page img {
    -webkit-user-drag: none;
    user-drag: none;
}

.exam-header {
    position: sticky;
    top: 0;
    z-index: 10;
    background: rgba(245, 247, 251, 0.96);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--line);
}

.exam-header-inner {
    min-height: 76px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.exam-title {
    font-weight: 800;
}

.timer {
    font-variant-numeric: tabular-nums;
    font-size: 22px;
    font-weight: 800;
    border: 1px solid var(--line);
    background: white;
    padding: 10px 14px;
    border-radius: 12px;
}

.exam-layout {
    padding: 28px 0 48px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 290px;
    gap: 22px;
    align-items: start;
}

.question-card {
    padding: 26px;
}

.question-meta {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    color: var(--muted);
    font-size: 14px;
    margin-bottom: 18px;
}

.question-text {
    font-size: 20px;
    line-height: 1.6;
    margin-bottom: 20px;
    white-space: pre-wrap;
}

.question-image,
.option-image {
    max-width: 100%;
    border-radius: 12px;
    display: block;
    margin: 12px 0;
}

.options {
    display: grid;
    gap: 12px;
}

.option {
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 14px 16px;
    display: flex;
    gap: 12px;
    align-items: flex-start;
    cursor: pointer;
    transition: 0.15s ease;
    background: white;
}

.option:hover {
    border-color: #98a2b3;
}

.option.selected {
    border-color: #475467;
    background: #f9fafb;
    box-shadow: inset 0 0 0 1px #475467;
}

.option input {
    margin-top: 4px;
}

.option-label {
    font-weight: 800;
    min-width: 26px;
}

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

.sidebar-card {
    padding: 18px;
    position: sticky;
    top: 100px;
}

.progress-text {
    font-size: 14px;
    color: var(--muted);
    margin-bottom: 12px;
}

.number-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    margin-bottom: 18px;
}

.number-btn {
    min-width: 0;
    padding: 9px 6px;
    border-radius: 9px;
    border: 1px solid var(--line);
    background: white;
    color: var(--text);
    font-size: 13px;
}

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

.number-btn.answered:not(.active) {
    background: var(--success-bg);
    color: var(--success);
    border-color: #abefc6;
}

.status {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 13px;
    color: var(--muted);
}

.dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #98a2b3;
}

.dot.online {
    background: #17b26a;
}

.dot.offline {
    background: #f04438;
}

.result-card {
    width: min(700px, 100%);
    padding: 30px;
}

.score {
    font-size: 72px;
    font-weight: 900;
    line-height: 1;
    margin: 18px 0 8px;
}

.result-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin: 24px 0;
}

.stat {
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 16px;
}

.stat strong {
    display: block;
    font-size: 26px;
    margin-bottom: 3px;
}

.small {
    font-size: 13px;
}

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

    .sidebar-card {
        position: static;
        order: -1;
    }

    .number-grid {
        grid-template-columns: repeat(8, 1fr);
    }
}

@media (max-width: 560px) {
    .container {
        width: min(100% - 20px, 1100px);
    }

    .exam-header-inner {
        min-height: 68px;
    }

    .exam-title .muted {
        display: none;
    }

    .timer {
        font-size: 18px;
        padding: 8px 10px;
    }

    .question-card {
        padding: 18px;
    }

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

    .number-grid {
        grid-template-columns: repeat(5, 1fr);
    }

    .result-grid {
        grid-template-columns: 1fr;
    }

    .score {
        font-size: 58px;
    }
}
