:root {
    color-scheme: light;
    --bg: #f6f7fb;
    --surface: #ffffff;
    --surface-strong: #eef6f1;
    --text: #18212f;
    --muted: #647084;
    --line: #dfe4ec;
    --accent: #1967d2;
    --accent-dark: #11499c;
    --mint: #19a974;
    --sun: #f8c44f;
    --shadow: 0 18px 50px rgba(24, 33, 47, 0.08);
}

* {
    box-sizing: border-box;
}

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

a {
    color: inherit;
    text-decoration: none;
}

button,
.button {
    min-height: 40px;
    border: 0;
    border-radius: 8px;
    background: var(--accent);
    color: #fff;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font: inherit;
    font-weight: 700;
    padding: 0 16px;
}

.button.secondary {
    background: #e8edf5;
    color: var(--text);
}

button:hover,
.button:hover {
    background: var(--accent-dark);
}

.button.secondary:hover {
    background: #dbe3ef;
}

.topbar {
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 0 clamp(16px, 4vw, 48px);
    border-bottom: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(12px);
}

.brand,
.topnav {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand {
    font-weight: 800;
}

.brand-mark {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--accent), var(--mint));
    color: #fff;
    display: grid;
    place-items: center;
}

.topnav form {
    margin: 0;
}

.language-form select {
    min-height: 40px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--text);
    font: inherit;
    font-weight: 700;
    padding: 0 10px;
}

.sr-only {
    width: 1px;
    height: 1px;
    position: absolute;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
}

.page {
    width: min(1120px, calc(100vw - 32px));
    margin: 0 auto;
    padding: 36px 0 56px;
}

.messages {
    display: grid;
    gap: 10px;
    margin-bottom: 18px;
}

.message {
    margin: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    padding: 12px 14px;
}

.message.success {
    border-color: #bfe7d5;
    background: #effaf5;
    color: #116247;
}

.message.warning {
    border-color: #f7df9c;
    background: #fff8e0;
    color: #705000;
}

.dashboard-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 28px;
}

.dashboard-head h1 {
    margin: 4px 0 0;
    font-size: clamp(2rem, 6vw, 4rem);
    line-height: 1;
}

.eyebrow {
    margin: 0;
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 800;
    text-transform: uppercase;
}

.avatar {
    width: 92px;
    height: 92px;
    border-radius: 28px;
    background: var(--avatar-color, var(--accent));
    color: #fff;
    display: grid;
    flex: 0 0 auto;
    font-size: 2.25rem;
    font-weight: 900;
    place-items: center;
    box-shadow: var(--shadow);
}

.avatar.small {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    font-size: 1rem;
}

.grid {
    display: grid;
    gap: 18px;
}

.grid.two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.quiz-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 18px;
}

.panel,
.auth-panel,
.quiz-card,
.question-panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.panel {
    min-height: 320px;
    padding: 22px;
}

.panel h2 {
    margin: 0 0 18px;
    font-size: 1.05rem;
}

.quiz-card {
    min-height: 260px;
    padding: 22px;
    display: grid;
    gap: 18px;
    align-content: space-between;
}

.quiz-card h2 {
    margin: 6px 0 10px;
    font-size: 1.25rem;
}

.quiz-card p {
    color: var(--muted);
    margin: 0;
}

.quiz-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.quiz-meta span,
.stats div {
    border-radius: 8px;
    background: var(--surface-strong);
    padding: 8px 10px;
}

.stats {
    display: grid;
    gap: 10px;
    margin: 18px 0;
}

.stats div {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.stats dt,
.stats dd {
    margin: 0;
}

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

.stats dd {
    font-weight: 800;
}

.item-list,
.profile-grid {
    display: grid;
    gap: 12px;
}

.list-item,
.profile-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    min-height: 64px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfcff;
}

.profile-card {
    justify-content: flex-start;
}

.list-item strong,
.profile-card strong {
    display: block;
}

.list-item span,
.profile-card span,
.list-item time {
    color: var(--muted);
    font-size: 0.9rem;
}

.score {
    min-width: 44px;
    text-align: right;
    font-weight: 800;
    color: var(--mint);
}

.empty {
    margin: 0;
    color: var(--muted);
}

.text-link {
    display: inline-flex;
    margin-top: 16px;
    color: var(--accent);
    font-weight: 800;
}

.quiz-form {
    display: grid;
    gap: 18px;
}

.question-panel {
    padding: 22px;
}

.question-title,
.form-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.question-title {
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 800;
}

.question-panel h2 {
    margin: 12px 0 18px;
    font-size: 1.2rem;
}

.answer-field ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 10px;
}

.answer-field li label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    min-height: 44px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfcff;
    padding: 12px;
}

.answer-field input[type="radio"],
.answer-field input[type="checkbox"] {
    margin-top: 4px;
}

.answer-field textarea {
    width: 100%;
    min-height: 120px;
    border: 1px solid var(--line);
    border-radius: 8px;
    font: inherit;
    padding: 12px;
    resize: vertical;
}

.errorlist {
    color: #a2281d;
    margin: 0 0 10px;
}

.result-score {
    min-width: 120px;
    border-radius: 8px;
    background: var(--sun);
    color: #3d2a00;
    font-size: 1.6rem;
    font-weight: 900;
    padding: 16px;
    text-align: center;
}

.answer-review {
    display: grid;
    gap: 8px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfcff;
    padding: 12px;
}

.answer-review span {
    color: var(--muted);
}

.answer-review em {
    justify-self: start;
    border-radius: 999px;
    background: #eef2f8;
    color: var(--text);
    font-style: normal;
    font-weight: 800;
    padding: 5px 9px;
}

.answer-review em.correct {
    background: #e7f8ef;
    color: #116247;
}

.answer-review em.incorrect {
    background: #fff3f2;
    color: #a2281d;
}

.auth-shell {
    min-height: calc(100vh - 164px);
    display: grid;
    place-items: center;
}

.auth-panel {
    width: min(420px, 100%);
    padding: 28px;
}

.auth-panel h1 {
    margin: 0 0 24px;
    font-size: 2rem;
}

.auth-panel label {
    display: grid;
    gap: 8px;
    margin-bottom: 16px;
}

.auth-panel label span {
    color: var(--muted);
    font-weight: 700;
}

.auth-panel input {
    width: 100%;
    min-height: 44px;
    border: 1px solid var(--line);
    border-radius: 8px;
    font: inherit;
    padding: 8px 12px;
}

.auth-panel button {
    width: 100%;
}

.form-error {
    border-radius: 8px;
    background: #fff3f2;
    color: #a2281d;
    padding: 12px;
}

@media (max-width: 760px) {
    .grid.two {
        grid-template-columns: 1fr;
    }

    .dashboard-head {
        align-items: flex-start;
    }

    .avatar {
        width: 68px;
        height: 68px;
        border-radius: 16px;
        font-size: 1.5rem;
    }
}
