/* Skip-link — видим только при фокусе с клавиатуры */
.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    background: #000;
    color: #fff;
    padding: 0.5em 1em;
    z-index: 1000;
}
.skip-link:focus {
    left: 0;
}

/* Виден только скринридерам: визуально скрыт, но читается вслух */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    border: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

/* Базовые стили для доступности */
body {
    font-family: sans-serif;
    line-height: 1.6;
    margin: 0;
    padding: 0;
}

main {
    max-width: 60rem;
    margin: 0 auto;
    padding: 1rem;
}

header {
    background: #1a5276;
    color: #fff;
    padding: 1rem;
}

header a {
    color: #d4efff;
}

nav ul {
    list-style: none;
    padding: 0;
    display: flex;
    gap: 1rem;
}

fieldset {
    margin: 1rem 0;
    padding: 1rem;
    border: 2px solid #1a5276;
    border-radius: 4px;
}

legend {
    font-weight: bold;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 0.5rem;
    border: 1px solid #ccc;
    text-align: left;
}

button, input[type="submit"] {
    background: #1a5276;
    color: #fff;
    border: none;
    padding: 0.5rem 1.5rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
}

button:hover, input[type="submit"]:hover {
    background: #2980b9;
}

/* Видимый фокус для навигации с клавиатуры (важно для слабовидящих) */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
    outline: 3px solid #ffbf00;
    outline-offset: 2px;
}

/* Сообщения. Не полагаемся только на цвет — добавляем рамку и подпись. */
.message {
    padding: 0.75rem 1rem;
    margin: 1rem 0;
    border-radius: 4px;
    border-left: 6px solid;
}

.message-error {
    background: #fdecea;
    border-color: #a00000;
    color: #5c0000;
}

.message-success {
    background: #e7f6ec;
    border-color: #1b7a3d;
    color: #0e3d1f;
}

.message-info {
    background: #e8f0fe;
    border-color: #1a5276;
    color: #0c2c41;
}

/* Строка пары «соотнесение»: слева пункт, справа выбор */
.match-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 0.4rem 0;
    flex-wrap: wrap;
}

.match-row label {
    min-width: 12rem;
    font-weight: bold;
}

/* Таймер прохождения теста */
.test-timer {
    position: sticky;
    top: 0;
    background: #1a5276;
    color: #fff;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-weight: bold;
    font-size: 1.1rem;
    z-index: 10;
}

.test-timer.test-timer-warning {
    background: #a00000;
}

/* Уважаем выбор пользователя «уменьшить анимацию» */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
