/* Улучшения оформления: подключается после custom.css и стилей страницы */

:root {
    --radius: 14px;
    --radius-sm: 10px;
    --ease: cubic-bezier(0.22, 0.7, 0.3, 1);
    --ring: 0 0 0 3px rgba(74, 134, 232, 0.35);
}

/* Типографика */
body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    line-height: 1.65;
    text-rendering: optimizeLegibility;
}

.title {
    letter-spacing: -0.01em;
    line-height: 1.2;
}

.title.is-1 {
    font-size: clamp(1.6rem, 4vw, 2.6rem);
    font-weight: 700;
}

.subtitle {
    line-height: 1.55;
}

.content p,
.content li {
    line-height: 1.7;
}

::selection {
    background: var(--primary);
    color: #fff;
}

/* Доступность: заметный фокус с клавиатуры */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
.button:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    box-shadow: var(--ring);
}

/* Кнопки */
.button {
    border-radius: var(--radius-sm);
    font-weight: 600;
    transition: background-color 0.2s var(--ease), border-color 0.2s var(--ease),
        color 0.2s var(--ease), transform 0.12s var(--ease), box-shadow 0.2s var(--ease);
}

.button:active {
    transform: translateY(1px);
}

.button.is-primary {
    box-shadow: 0 2px 10px rgba(26, 62, 114, 0.25);
}

.button.is-primary:hover {
    box-shadow: 0 4px 16px rgba(26, 62, 114, 0.35);
}

/* Карточки и боксы */
.card,
.box {
    border-radius: var(--radius);
}

.card-header {
    border-radius: var(--radius) var(--radius) 0 0;
}

.card-header-title {
    font-weight: 700;
}

.card-footer {
    border-radius: 0 0 var(--radius) var(--radius);
}

.card-image img {
    border-radius: var(--radius) var(--radius) 0 0;
}

/* Плавные ховеры только там, где это уместно */
.mode-card,
.ticket-card,
.profession-item,
.answer-option,
.answer-item {
    transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease),
        border-color 0.25s var(--ease), background-color 0.25s var(--ease);
}

.mode-card:hover,
.ticket-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.16);
}

/* Карточки режимов: аккуратные заголовки и равные высоты */
.mode-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: visible;
}

.mode-card .card-header {
    align-items: center;
    min-height: 4rem;
}

.mode-card .card-header-title {
    padding: 0.5rem 0.5rem;
    justify-content: center;
}

.mode-card .card-header-title .title {
    font-size: 1rem;
    line-height: 1.25;
    overflow-wrap: anywhere;
    hyphens: auto;
    text-align: center;
    margin-bottom: 0;
}

.mode-card .card-content {
    padding: 1rem;
    font-size: 0.95rem;
    flex: 1;
}

.mode-card .card-content p {
    font-size: 0.95rem;
    line-height: 1.5;
}

.mode-card .button {
    font-size: 0.9rem;
    white-space: normal;
    height: auto;
    padding: 0.6rem 0.75rem;
    line-height: 1.3;
}

@media screen and (max-width: 768px) {
    .mode-card {
        height: auto;
    }

    .mode-card .card-header {
        min-height: 3.25rem;
    }

    .mode-card .card-header-title .title {
        font-size: 0.95rem;
    }

    .mode-card .card-content {
        padding: 0.85rem;
        font-size: 0.9rem;
    }

    .mode-card .card-content p {
        font-size: 0.9rem;
    }

    .mode-card .button {
        font-size: 0.85rem;
    }
}

.profession-item:hover {
    background: var(--primary);
}

/* Вкладки */
.tabs ul {
    border-bottom-color: var(--border);
}

.tabs li a {
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    transition: background-color 0.2s var(--ease), color 0.2s var(--ease);
}

.tabs li.is-active a {
    box-shadow: 0 -2px 0 var(--primary) inset;
}

/* Таблицы */
.table-container {
    border-radius: var(--radius);
    overflow: hidden;
}

.table thead th {
    border-bottom-width: 2px;
    font-size: 0.875rem;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.table tbody tr {
    transition: background-color 0.2s var(--ease);
}

/* Варианты ответов в тестах и подготовке */
.answer-option,
.answer-item {
    border-radius: var(--radius-sm);
}

.answer-option:hover,
.answer-item:hover {
    border-color: var(--primary);
}

.answer-option:has(input:checked),
.answer-item:has(input:checked) {
    border-color: var(--primary);
    background: var(--primary-light);
    box-shadow: 0 0 0 1px var(--primary) inset;
}

.answer-item.has-background-success-light {
    border-left: 4px solid var(--success);
}

/* Подготовка/билет: подсветка верного/неверного ответа (жёсткие цвета, чтобы Bulma-классы не терялись) */
.answer-option.has-background-success-light,
.answer-item.has-background-success-light {
    background: #d4edda !important;
    border-color: #28a745 !important;
}

.answer-option.has-background-danger-light,
.answer-item.has-background-danger-light {
    background: #f8d7da !important;
    border-color: #dc3545 !important;
}

[data-theme="dark"] .answer-option.has-background-success-light,
[data-theme="dark"] .answer-item.has-background-success-light {
    background: #173b26 !important;
    border-color: #34c759 !important;
}

[data-theme="dark"] .answer-option.has-background-danger-light,
[data-theme="dark"] .answer-item.has-background-danger-light {
    background: #41211f !important;
    border-color: #ff453a !important;
}

.answer-option.has-border-success,
.answer-item.has-border-success {
    border-color: #28a745 !important;
}

.answer-option.has-border-danger,
.answer-item.has-border-danger {
    border-color: #dc3545 !important;
}

.answer-text {
    line-height: 1.55;
}

/* Прогресс и таймер */
.progress {
    border-radius: 999px;
    height: 12px;
}

.progress::-webkit-progress-bar {
    border-radius: 999px;
}

.progress::-webkit-progress-value {
    border-radius: 999px;
    transition: width 0.3s var(--ease);
}

.progress::-moz-progress-bar {
    border-radius: 999px;
}

.timer-container {
    font-variant-numeric: tabular-nums;
}

/* Уведомления */
.notification {
    border-radius: var(--radius-sm);
}

/* Шапка: аккуратная тень и липкое поведение */
.header-section {
    position: sticky;
    top: 0;
    z-index: 40;
    box-shadow: 0 2px 18px rgba(0, 0, 0, 0.18);
}

/* Подвал */
.footer-section .footer-links a {
    display: inline-block;
    transition: color 0.2s var(--ease), transform 0.2s var(--ease);
}

.footer-section .footer-links a:hover {
    transform: translateX(4px);
}

/* Мелкие детали */
code {
    border-radius: 6px;
    padding: 0.1rem 0.35rem;
    background: rgba(127, 127, 127, 0.15);
}

img {
    max-width: 100%;
    height: auto;
}

/* Скроллбар */
* {
    scrollbar-width: thin;
    scrollbar-color: rgba(127, 127, 127, 0.5) transparent;
}

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-thumb {
    background: rgba(127, 127, 127, 0.45);
    border-radius: 999px;
    border: 3px solid transparent;
    background-clip: content-box;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(127, 127, 127, 0.7);
    background-clip: content-box;
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        transition-duration: 0.001ms !important;
        animation-duration: 0.001ms !important;
    }
}

@media screen and (max-width: 768px) {
    .section {
        padding: 1.25rem 1rem;
    }

    .title.is-1 {
        font-size: clamp(1.35rem, 6vw, 1.75rem);
    }

    .card,
    .box {
        border-radius: 12px;
    }

    .mode-card:hover,
    .ticket-card:hover {
        transform: none;
    }
}

/* ==========================================================
   Тема: палитра, ритм, современные детали
   ========================================================== */

:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-focus: #1e40af;
    --primary-light: rgba(37, 99, 235, 0.1);
    --secondary: #64748b;
    --success: #16a34a;
    --danger: #dc2626;
    --warning: #d97706;
    --background: #f5f7fb;
    --surface: #ffffff;
    --text: #0f172a;
    --text-light: #5b6b84;
    --border: #e5ebf4;
    --shadow: rgba(15, 23, 42, 0.08);
    --shadow-hover: rgba(15, 23, 42, 0.16);
    --radius: 16px;
    --radius-sm: 12px;
    --gutter: clamp(1rem, 3.2vw, 2.5rem);
}

[data-theme="dark"] {
    --primary: #6b9cff;
    --primary-hover: #8ab2ff;
    --primary-focus: #8ab2ff;
    --primary-light: rgba(107, 156, 255, 0.14);
    --secondary: #94a3b8;
    --success: #34d399;
    --danger: #f87171;
    --warning: #fbbf24;
    --background: #0b1017;
    --surface: #141b26;
    --text: #e9eef7;
    --text-light: #98a6bb;
    --border: #223047;
    --shadow: rgba(0, 0, 0, 0.45);
    --shadow-hover: rgba(0, 0, 0, 0.6);
}

body {
    background-image:
        radial-gradient(900px 500px at 50% -10%, var(--primary-light), transparent 70%);
    background-repeat: no-repeat;
}

/* Шапка: стекло вместо глухого чёрного */
.header-section {
    background: rgba(9, 14, 24, 0.86) !important;
    -webkit-backdrop-filter: saturate(140%) blur(14px);
    backdrop-filter: saturate(140%) blur(14px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04), 0 12px 30px rgba(0, 0, 0, 0.28) !important;
}

[data-theme="light"] .header-section {
    background: rgba(12, 20, 38, 0.92) !important;
}

.header-section .navbar-item,
.header-section .navbar-link {
    border-radius: 10px;
    transition: background-color 0.2s var(--ease), color 0.2s var(--ease);
}

.btn-ticket {
    background: linear-gradient(180deg, var(--primary), var(--primary-hover)) !important;
    border-radius: 999px !important;
    padding: 0.55rem 1.1rem !important;
    box-shadow: 0 6px 18px rgba(37, 99, 235, 0.35);
    transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
    color: #ffffff !important;
}

.btn-ticket span,
.header-section .btn-ticket span {
    color: #ffffff !important;
    font-size: 0.95rem !important;
    font-weight: 600;
    margin: 0 !important;
}

.btn-ticket:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 24px rgba(37, 99, 235, 0.45);
}

.theme-option {
    border-radius: 999px !important;
}

/* Подвал: глубокий тёмный, тонкая граница */
.footer-section {
    background: #080d16 !important;
    border-top: 1px solid rgba(255, 255, 255, 0.08) !important;
}

.footer-section .title.is-5 {
    color: var(--primary) !important;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    font-size: 0.85rem !important;
}

.footer-section .footer-links a {
    color: rgba(233, 238, 247, 0.78) !important;
    font-size: 0.95rem;
}

.footer-section .footer-links a:hover {
    color: #ffffff !important;
}

.footer-bottom {
    border-top: 1px solid rgba(255, 255, 255, 0.08) !important;
}

/* Отступы по бокам для всех контейнеров */
.header-section .container.is-fluid,
.main-section .container.is-fluid,
.footer-section .container.is-fluid {
    padding-left: var(--gutter) !important;
    padding-right: var(--gutter) !important;
}

.main-section {
    padding: clamp(1.25rem, 2.6vw, 2.25rem) 0;
}

.section {
    padding: clamp(1rem, 2.2vw, 1.75rem) 0;
}

/* Поверхности и тени */
.box,
.card {
    background: var(--surface) !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--radius) !important;
    box-shadow: 0 1px 2px var(--shadow), 0 12px 28px -18px var(--shadow-hover) !important;
}

.box {
    padding: 1.35rem 1.5rem;
}

.card-content {
    padding: 1.25rem;
}

.notification {
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

/* Кнопки: мягче и современнее */
.button {
    border-radius: var(--radius-sm) !important;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.button.is-primary {
    background: linear-gradient(180deg, var(--primary), var(--primary-hover)) !important;
    border-color: transparent !important;
    box-shadow: 0 6px 18px -6px rgba(37, 99, 235, 0.55) !important;
}

.button.is-primary:hover {
    background: linear-gradient(180deg, var(--primary-hover), var(--primary-focus)) !important;
}

.button.is-link,
.button.is-info {
    border-radius: var(--radius-sm) !important;
}

/* Вкладки: пилюли */
.tabs ul {
    border-bottom: none !important;
    gap: 0.4rem;
    flex-wrap: wrap;
    justify-content: center;
}

.tabs li a {
    border: 1px solid var(--border) !important;
    border-radius: 999px !important;
    padding: 0.55rem 1.1rem !important;
    background: var(--surface);
    color: var(--text-light) !important;
}

.tabs li a:hover {
    border-color: var(--primary) !important;
    color: var(--text) !important;
}

.tabs li.is-active a {
    background: var(--primary) !important;
    border-color: var(--primary) !important;
    color: #ffffff !important;
    box-shadow: 0 6px 18px -8px rgba(37, 99, 235, 0.8) !important;
}

/* Таблицы */
.table {
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--surface);
}

.table thead th {
    background: var(--surface) !important;
    color: var(--text-light) !important;
    border-bottom: 1px solid var(--border) !important;
}

.table tbody tr:not(.test-row):hover {
    background: var(--primary-light) !important;
}

/* Ссылки и текст */
a {
    color: var(--primary);
}

a:hover,
a:active,
a:focus,
a:focus-visible,
button:hover,
button:active {
    text-decoration: none !important;
}

.has-text-grey {
    color: var(--text-light) !important;
}

strong {
    font-weight: 650;
}

@media screen and (max-width: 768px) {
    :root {
        --gutter: 1rem;
    }

    .box {
        padding: 1rem;
    }

    .card-content {
        padding: 1rem;
    }

    .tabs li a {
        padding: 0.45rem 0.85rem !important;
        font-size: 0.9rem;
    }
}

/* Телефоны: карточки режимов в одну колонку */
@media screen and (max-width: 480px) {
    .tab-pane .columns.is-multiline > .column {
        flex: none;
        width: 100% !important;
        padding: 0.35rem 0;
    }

    .tabs ul {
        gap: 0.35rem;
    }

    .tabs li a {
        padding: 0.4rem 0.8rem !important;
        font-size: 0.85rem;
    }

    .title.is-1 {
        font-size: 1.3rem;
    }

    .footer-section .title.is-5 {
        font-size: 0.8rem !important;
    }
}

/* Телефоны: сетка карточек в одну колонку (перекрываем grid из test_modes.css) */
@media screen and (max-width: 600px) {
    .tab-pane .columns.is-multiline {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 0.75rem;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    .tab-pane .columns.is-multiline > .column {
        width: auto !important;
        max-width: none !important;
        padding: 0 !important;
    }
}

/* Меню: видимые пункты в обеих темах и без вылета за экран */
.menu-dropdown {
    position: relative;
}

.menu-dropdown .navbar-dropdown {
    left: auto !important;
    right: 0 !important;
    min-width: 240px;
    max-width: calc(100vw - 2rem);
    padding: 0.4rem;
    background: var(--surface) !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--radius-sm) !important;
    box-shadow: 0 24px 48px -24px rgba(2, 6, 23, 0.45), 0 2px 8px rgba(2, 6, 23, 0.12) !important;
}

.menu-dropdown .navbar-dropdown .navbar-item {
    color: var(--text) !important;
    border-radius: 8px;
    padding: 0.6rem 0.75rem;
    white-space: normal;
    font-weight: 500;
}

.menu-dropdown .navbar-dropdown .navbar-item:hover,
.menu-dropdown .navbar-dropdown .navbar-item:focus {
    background: var(--primary-light) !important;
    color: var(--primary) !important;
}

.mobile-menu-dropdown {
    right: 0.75rem !important;
    left: auto !important;
    max-width: calc(100vw - 1.5rem);
    padding: 0.4rem;
    background: var(--surface) !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--radius-sm) !important;
    box-shadow: 0 24px 48px -24px rgba(2, 6, 23, 0.45) !important;
}

.mobile-menu-dropdown .navbar-item {
    color: var(--text) !important;
    border-radius: 8px;
}

.mobile-menu-dropdown .navbar-item:hover {
    background: var(--primary-light) !important;
    color: var(--primary) !important;
}

/* Подвал: компактный и прижат к низу окна */
body {
    min-height: 100vh;
    min-height: 100dvh;
}

.main-section {
    flex: 1 0 auto;
}

.footer-section {
    margin-top: auto;
    padding: 1.5rem 0 0.75rem !important;
}

.footer-section .columns {
    margin-bottom: 0.5rem !important;
}

.footer-section .title.is-5 {
    margin-bottom: 0.4rem !important;
}

.footer-section .footer-links li {
    margin-bottom: 0.2rem;
}

.footer-section .footer-links a {
    font-size: 0.9rem;
    padding: 0.1rem 0;
}

.footer-bottom {
    padding-top: 0.75rem !important;
    margin-top: 0.75rem !important;
}

.footer-bottom .copyright {
    font-size: 0.8rem;
}

@media screen and (max-width: 768px) {
    .footer-section {
        padding: 0.85rem 0 0.5rem !important;
    }

    .footer-section .column.is-4 {
        padding: 0.25rem 1rem !important;
        margin-bottom: 0.25rem !important;
    }

    .footer-section .title.is-5 {
        font-size: 0.8rem !important;
        margin-bottom: 0.2rem !important;
    }

    .footer-section .footer-links a {
        font-size: 0.85rem;
    }

    .footer-bottom {
        padding-top: 0.5rem !important;
        margin-top: 0.5rem !important;
    }
}

/* ==========================================================
   Подвал: компактный; на десктопе прижат к низу экрана
   ========================================================== */

.footer-section {
    padding: 1rem 0 0.75rem !important;
}

.footer-section .columns {
    margin-top: -0.25rem !important;
    margin-bottom: 0 !important;
}

.footer-section .column.is-4 {
    padding: 0.25rem 1rem;
}

.footer-section .title.is-5 {
    font-size: 0.72rem !important;
    margin-bottom: 0.35rem !important;
    letter-spacing: 0.06em;
}

.footer-section .footer-links li {
    margin-bottom: 0.15rem;
}

.footer-section .footer-links a {
    font-size: 0.85rem;
}

.footer-bottom {
    padding-top: 0.5rem !important;
    margin-top: 0.5rem !important;
}

.footer-bottom .copyright,
.footer-bottom .footer-links a {
    font-size: 0.78rem;
}

/* Десктоп: подвал всегда внизу окна */
@media screen and (min-width: 1024px) {
    body {
        padding-bottom: 132px;
    }

    .footer-section {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 30;
        box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.35);
    }

    .footer-section .columns {
        align-items: flex-start;
    }

    .cookie {
        bottom: 148px;
    }
}

/* Мобильные: подвал в потоке, максимально компактный */
@media screen and (max-width: 1023px) {
    .footer-section {
        position: static !important;
        padding: 0.75rem 0 0.5rem !important;
        box-shadow: none;
    }

    .footer-section .columns {
        margin-top: 0 !important;
        margin-bottom: 0 !important;
    }

    .footer-section .column.is-4 {
        padding: 0.35rem 0.5rem;
        margin-bottom: 0.25rem !important;
    }

    .footer-section .title.is-5 {
        font-size: 0.72rem !important;
        margin-bottom: 0.25rem !important;
    }

    .footer-section .footer-links a {
        font-size: 0.8rem;
        line-height: 1.35;
    }

    .footer-bottom {
        padding-top: 0.5rem !important;
        margin-top: 0.25rem !important;
    }

    .footer-bottom .level {
        gap: 0.25rem;
    }
}

/* Ещё компактнее: подвал в одну строку на десктопе и плотный на телефоне */
@media screen and (min-width: 1024px) {
    body {
        padding-bottom: 96px;
    }

    .footer-section {
        padding: 0.5rem 0 0.35rem !important;
    }

    .footer-section .columns {
        margin: 0 !important;
        align-items: center;
    }

    .footer-section .column.is-4 {
        padding: 0.1rem 0.75rem;
    }

    .footer-section .title.is-5 {
        font-size: 0.68rem !important;
        margin-bottom: 0.15rem !important;
    }

    .footer-section .footer-links {
        margin: 0;
    }

    .footer-section .footer-links li {
        display: inline-block;
        margin: 0 0.75rem 0 0;
    }

    .footer-section .footer-links a {
        font-size: 0.8rem;
    }

    .footer-bottom {
        margin-top: 0.3rem !important;
        padding-top: 0.3rem !important;
    }

    .footer-bottom .copyright,
    .footer-bottom .footer-links a {
        font-size: 0.72rem;
    }

    .cookie {
        bottom: 108px;
    }
}

@media screen and (max-width: 1023px) {
    .footer-section {
        padding: 0.5rem 0 0.4rem !important;
    }

    .footer-section .column.is-4 {
        padding: 0.2rem 0.25rem;
        margin-bottom: 0.1rem !important;
    }

    .footer-section .title.is-5 {
        font-size: 0.65rem !important;
        margin-bottom: 0.15rem !important;
    }

    .footer-section .footer-links li {
        margin-bottom: 0.05rem;
    }

    .footer-section .footer-links a {
        font-size: 0.75rem;
        line-height: 1.3;
    }

    .footer-bottom {
        padding-top: 0.3rem !important;
        margin-top: 0.2rem !important;
    }

    .footer-bottom .copyright,
    .footer-bottom .footer-links a {
        font-size: 0.7rem;
    }
}

/* Финальная подгонка подвала */
@media screen and (min-width: 1024px) {
    body {
        padding-bottom: 140px !important;
    }

    .footer-section .title.is-5 {
        font-size: 0.66rem !important;
    }

    .footer-section .footer-links a {
        font-size: 0.78rem;
    }
}

@media screen and (max-width: 1023px) {
    .footer-section {
        padding: 0.4rem 0 0.3rem !important;
    }

    .footer-section .columns {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.2rem 0.75rem;
        margin: 0 !important;
    }

    .footer-section .column.is-4 {
        padding: 0 !important;
        margin: 0 !important;
    }

    .footer-section .column.is-4:last-child {
        grid-column: 1 / -1;
    }

    .footer-section .title.is-5 {
        font-size: 0.62rem !important;
        margin-bottom: 0.1rem !important;
        letter-spacing: 0.04em;
    }

    .footer-section .footer-links a {
        font-size: 0.72rem;
        line-height: 1.25;
    }

    .footer-section .footer-links li {
        margin-bottom: 0 !important;
    }

    .footer-bottom {
        padding-top: 0.25rem !important;
        margin-top: 0.2rem !important;
    }

    .footer-bottom .copyright,
    .footer-bottom .footer-links a {
        font-size: 0.68rem;
    }
}

/* Подвал скроллится вместе с контентом на всех экранах */
body {
    padding-bottom: 0 !important;
}

.footer-section {
    position: static !important;
    left: auto;
    right: auto;
    bottom: auto;
    box-shadow: none !important;
}

.cookie {
    bottom: 16px;
}

/* Цвет подвала как у шапки */
.footer-section {
    background: rgba(9, 14, 24, 0.92) !important;
    border-top: 1px solid rgba(255, 255, 255, 0.08) !important;
}

[data-theme="light"] .footer-section {
    background: rgba(12, 20, 38, 0.94) !important;
}

/* Подвал повыше: возвращаем воздух и читаемый размер */
.footer-section {
    padding: 0.9rem 0 0.7rem !important;
}

.footer-section .title.is-5 {
    font-size: 0.74rem !important;
    margin-bottom: 0.35rem !important;
}

.footer-section .footer-links li {
    margin-bottom: 0.1rem !important;
}

.footer-section .footer-links a {
    font-size: 0.86rem;
}

.footer-bottom {
    margin-top: 0.55rem !important;
    padding-top: 0.55rem !important;
}

.footer-bottom .copyright,
.footer-bottom .footer-links a {
    font-size: 0.78rem;
}

@media screen and (max-width: 1023px) {
    .footer-section {
        padding: 0.7rem 0 0.5rem !important;
    }

    .footer-section .columns {
        gap: 0.35rem 0.8rem;
    }

    .footer-section .title.is-5 {
        font-size: 0.7rem !important;
        margin-bottom: 0.25rem !important;
    }

    .footer-section .footer-links a {
        font-size: 0.8rem;
        line-height: 1.35;
    }

    .footer-bottom {
        margin-top: 0.45rem !important;
        padding-top: 0.4rem !important;
    }

    .footer-bottom .copyright,
    .footer-bottom .footer-links a {
        font-size: 0.72rem;
    }
}

/* Подвал: ссылки столбиком, отступы между текстами меньше */
.footer-section {
    padding: 0.8rem 0 0.6rem !important;
}

.footer-section .footer-links {
    margin: 0 !important;
}

.footer-section .footer-links li {
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
}

.footer-section .footer-links a {
    display: inline-block;
    font-size: 0.84rem;
    line-height: 1.25;
    padding: 0;
}

.footer-section .title.is-5 {
    font-size: 0.72rem !important;
    margin-bottom: 0.2rem !important;
}

.footer-section .column.is-4 {
    padding: 0.15rem 0.75rem;
}

.footer-bottom {
    margin-top: 0.4rem !important;
    padding-top: 0.35rem !important;
}

@media screen and (max-width: 1023px) {
    .footer-section .columns {
        display: block !important;
    }

    .footer-section .column.is-4 {
        width: 100% !important;
        padding: 0.15rem 0 !important;
        margin: 0 0 0.35rem !important;
    }

    .footer-section .footer-links a {
        font-size: 0.8rem;
        line-height: 1.25;
    }

    .footer-section .title.is-5 {
        font-size: 0.68rem !important;
        margin-bottom: 0.15rem !important;
    }

    .footer-bottom {
        margin-top: 0.3rem !important;
        padding-top: 0.25rem !important;
    }
}

/* Плотнее строки в столбике подвала */
.footer-section .footer-links li {
    line-height: 1.3 !important;
    min-height: 0 !important;
}

.footer-section .footer-links a {
    line-height: 1.3 !important;
    padding: 0 !important;
}

.footer-section .footer-links {
    line-height: 1.3 !important;
}

/* Ховер строки теста: синий фон, белый текст (иначе в светлой теме текст пропадает) */
.table tbody tr.test-row:hover,
.table tbody tr.test-row:focus-within {
    background-color: var(--primary) !important;
    background-image: none !important;
}

.table tbody tr.test-row:hover > td,
.table tbody tr.test-row:focus-within > td,
.table tbody tr.test-row:hover .test-name,
.table tbody tr.test-row:hover .has-text-weight-semibold {
    color: #ffffff !important;
}

.table tbody tr.test-row:hover .tag {
    background-color: #ffffff !important;
    color: var(--primary) !important;
}

.table tbody tr.test-row:hover .icon {
    color: #ffffff !important;
}

/* Согласуем служебные цвета Bulma с палитрой сайта */
:root {
    --bulma-primary-h: 221deg;
    --bulma-primary-s: 83%;
    --bulma-primary-l: 53%;
    --bulma-link-h: 221deg;
    --bulma-link-s: 83%;
    --bulma-link-l: 53%;
}

[data-theme="dark"] {
    --bulma-primary-h: 215deg;
    --bulma-primary-s: 100%;
    --bulma-primary-l: 71%;
    --bulma-link-h: 215deg;
    --bulma-link-s: 100%;
    --bulma-link-l: 71%;
}

/* Строка теста: подсветка целиком на CSS, без инлайн-стилей */
.test-row {
    cursor: pointer;
    transition: background-color 0.25s var(--ease), transform 0.25s var(--ease);
    background-color: transparent;
}

.test-row:hover {
    background-color: var(--primary) !important;
    transform: translateX(4px);
}

.test-row:hover > td,
.test-row:hover .test-name,
.test-row:hover .has-text-weight-semibold {
    color: #ffffff !important;
}

.test-row:hover .tag {
    background-color: #ffffff !important;
    border-color: #ffffff !important;
    color: var(--primary) !important;
}

.test-row:hover .icon {
    color: #ffffff !important;
}

/* Тёмная тема: для ховера берём глубокий синий, иначе белый текст на светлом акценте нечитаем */
[data-theme="dark"] .test-row:hover,
[data-theme="dark"] .profession-item:hover {
    background-color: #24406e !important;
}

[data-theme="dark"] .profession-item:hover .has-text-primary,
[data-theme="dark"] .profession-item:hover span:not(.icon) {
    color: #ffffff !important;
}

/* Клик и фокус: те же читаемые цвета, что и на наведении */
* {
    -webkit-tap-highlight-color: transparent;
}

.profession-item:active,
.profession-item:focus,
.profession-item:focus-visible {
    background-color: var(--primary) !important;
}

.profession-item:active span:not(.icon),
.profession-item:focus span:not(.icon),
.profession-item:focus-visible span:not(.icon),
.profession-item:active .icon,
.profession-item:focus .icon,
.profession-item:focus-visible .icon {
    color: #ffffff !important;
}

.profession-item:active .has-text-grey,
.profession-item:focus .has-text-grey,
.profession-item:focus-visible .has-text-grey {
    color: rgba(255, 255, 255, 0.85) !important;
}

.test-row:active,
.test-row:focus,
.test-row:focus-visible,
.test-row:focus-within {
    background-color: var(--primary) !important;
}

.test-row:active > td,
.test-row:focus > td,
.test-row:focus-visible > td,
.test-row:focus-within > td,
.test-row:active .test-name,
.test-row:focus .test-name,
.test-row:active .has-text-weight-semibold,
.test-row:focus .has-text-weight-semibold {
    color: #ffffff !important;
}

.test-row:active .tag,
.test-row:focus .tag,
.test-row:focus-visible .tag {
    background-color: #ffffff !important;
    border-color: #ffffff !important;
    color: var(--primary) !important;
}

.test-row:active .icon,
.test-row:focus .icon,
.test-row:focus-visible .icon {
    color: #ffffff !important;
}

[data-theme="dark"] .profession-item:active,
[data-theme="dark"] .profession-item:focus,
[data-theme="dark"] .profession-item:focus-visible,
[data-theme="dark"] .test-row:active,
[data-theme="dark"] .test-row:focus,
[data-theme="dark"] .test-row:focus-visible,
[data-theme="dark"] .test-row:focus-within {
    background-color: #24406e !important;
}

/* Светлая тема: акцент темнее (тёмную оставляем как есть) */
:root {
    --primary: #1e40af;
    --primary-hover: #1e3a8a;
    --primary-focus: #172554;
    --primary-light: rgba(30, 64, 175, 0.10);
    --bulma-primary-h: 224deg;
    --bulma-primary-s: 64%;
    --bulma-primary-l: 40%;
    --bulma-link-h: 224deg;
    --bulma-link-s: 64%;
    --bulma-link-l: 40%;
}

[data-theme="dark"] {
    --primary: #6b9cff;
    --primary-hover: #8ab2ff;
    --primary-focus: #8ab2ff;
    --primary-light: rgba(107, 156, 255, 0.14);
    --bulma-primary-h: 215deg;
    --bulma-primary-s: 100%;
    --bulma-primary-l: 71%;
    --bulma-link-h: 215deg;
    --bulma-link-s: 100%;
    --bulma-link-l: 71%;
}

/* Вкладки: состояние после клика не должно терять цвета */
.tabs ul {
    border-bottom: none !important;
}

.tabs li a,
.tabs li a:hover,
.tabs li a:focus,
.tabs li a:active {
    background: var(--surface) !important;
    border: 1px solid var(--border) !important;
    border-radius: 999px !important;
    color: var(--text-light) !important;
}

.tabs li a:hover {
    border-color: var(--primary) !important;
    color: var(--text) !important;
}

.tabs li.is-active a,
.tabs li.is-active a:hover,
.tabs li.is-active a:focus,
.tabs li.is-active a:active,
.tabs li.is-active a:visited {
    background: var(--primary) !important;
    border-color: var(--primary) !important;
    color: #ffffff !important;
    box-shadow: 0 6px 18px -8px rgba(30, 64, 175, 0.7) !important;
}

[data-theme="dark"] .tabs li.is-active a,
[data-theme="dark"] .tabs li.is-active a:hover,
[data-theme="dark"] .tabs li.is-active a:focus,
[data-theme="dark"] .tabs li.is-active a:active {
    background: #24406e !important;
    border-color: #24406e !important;
    color: #ffffff !important;
    box-shadow: none !important;
}

/* Кнопки: нажатие не должно менять читаемость */
.button:active,
.button.is-active,
.button.is-primary:active {
    transform: translateY(1px);
}

/* Bulma-переменные вкладок: активная вкладка всегда контрастная */
:root {
    --bulma-tabs-link-color: var(--text-light);
    --bulma-tabs-link-active-color: #ffffff;
    --bulma-tabs-boxed-link-active-background-color: var(--primary);
    --bulma-tabs-boxed-link-active-border-color: var(--primary);
    --bulma-tabs-boxed-link-active-color: #ffffff;
    --bulma-tabs-boxed-link-hover-background-color: var(--primary-light);
    --bulma-tabs-toggle-link-active-background-color: var(--primary);
    --bulma-tabs-toggle-link-active-color: #ffffff;
}

[data-theme="dark"] {
    --bulma-tabs-boxed-link-active-background-color: #24406e;
    --bulma-tabs-boxed-link-active-border-color: #24406e;
    --bulma-tabs-toggle-link-active-background-color: #24406e;
}

/* Билет: варианты ответов блочными, чтобы не наезжали на вопрос */
#answer-container .answer-option,
#answers-container .answer-option,
.answer-option {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    box-sizing: border-box;
    margin-bottom: 0.75rem;
}

/* Билет: выравнивание текста в alert-блоке по левому краю (убирает сдвиг от иконки) */
.alert-content {
    text-align: left !important;
}

.alert-content .alert-title,
.alert-content p {
    text-align: left !important;
}

/* Билет: блок «Билет №…» по центру — иконка сверху, текст под ней */
.alert-content {
    flex-direction: column !important;
    align-items: center !important;
    text-align: center !important;
    gap: 0.5rem !important;
}

.alert-content .alert-title,
.alert-content p {
    text-align: center !important;
}

/* Ховер карточки профессии: только фон, текст не меняем (иначе белый на светлом не читается) */
.profession-item:hover {
    background: var(--primary-light) !important;
    transform: translateX(5px);
}

.profession-item:hover span:not(.icon),
.profession-item:hover .has-text-grey,
.profession-item:hover .has-text-primary,
.profession-item:hover .is-size-5 {
    color: var(--text) !important;
}

.profession-item:hover .has-text-primary {
    color: var(--primary) !important;
}

.profession-item:hover .icon {
    color: var(--primary) !important;
    transform: translateX(3px);
}

[data-theme="dark"] .profession-item:hover {
    background: var(--primary-light) !important;
}

[data-theme="dark"] .profession-item:hover span:not(.icon),
[data-theme="dark"] .profession-item:hover .has-text-grey {
    color: var(--text) !important;
}

/* Категория: при наведении меняем только фон, текст остаётся читаемым */
.profession-item:hover,
[data-theme="dark"] .profession-item:hover {
    background: var(--primary-light) !important;
}

.profession-item:hover span:not(.icon),
.profession-item:hover .has-text-grey,
.profession-item:hover .icon,
[data-theme="dark"] .profession-item:hover span:not(.icon),
[data-theme="dark"] .profession-item:hover .has-text-grey,
[data-theme="dark"] .profession-item:hover .icon {
    color: var(--text) !important;
}

.profession-item:hover .has-text-primary,
[data-theme="dark"] .profession-item:hover .has-text-primary {
    color: var(--primary) !important;
}

.profession-item:hover .has-text-grey,
[data-theme="dark"] .profession-item:hover .has-text-grey {
    color: var(--text-light) !important;
}

/* === Единый вид блоков ответов во всех режимах (экзамен, подготовка, билет, вопросы) === */
.answers,
.answers-container,
#answers-container {
    display: flex !important;
    flex-direction: column !important;
    gap: 12px !important;
    margin: 16px 0 0 !important;
}

.answer-option,
.answer-item {
    display: flex !important;
    align-items: flex-start !important;
    gap: 8px !important;
    width: 100% !important;
    box-sizing: border-box !important;
    padding: 12px 16px !important;
    margin: 0 !important;
    border: 2px solid var(--border) !important;
    border-radius: 12px !important;
    background-color: var(--surface);
}

.answer-option > .checkbox,
.answer-option > label,
.answer-item > .checkbox,
.answer-item > label {
    display: flex !important;
    align-items: flex-start !important;
    gap: 8px !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
}

.answer-option input,
.answer-item input {
    position: static !important;
    opacity: 1 !important;
    margin: 4px 0 0 0 !important;
    flex-shrink: 0 !important;
}

.answer-option .answer-text,
.answer-item .answer-text {
    font-size: 1rem !important;
    line-height: 1.5 !important;
    text-indent: 0 !important;
    margin: 0 !important;
}

/* Подготовка: карточка прогресса — счётчик в одну строку, по центру по вертикали */
.progress-card .is-flex {
    min-width: 0;
}

#progress-text {
    white-space: nowrap !important;
    flex-shrink: 0 !important;
    margin: 0 !important;
    line-height: 1.2 !important;
    align-self: center !important;
}

.progress-card #progress-bar,
.progress-card .progress {
    min-width: 0 !important;
}

/* Подготовка: убираем нижний отступ у полосы прогресса (Bulma .progress), из-за него счётчик съезжал вниз */
.progress-card #progress-bar,
.progress-card .progress {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
}

/* Полоса прогресса: видимый трек и заливка во всех режимах (подготовка перекрывала фон белым) */
.progress,
.progress.is-primary {
    background-color: var(--border) !important;
}

.progress::-webkit-progress-bar,
.progress.is-primary::-webkit-progress-bar {
    background-color: var(--border) !important;
}

.progress::-webkit-progress-value,
.progress.is-primary::-webkit-progress-value {
    background: linear-gradient(135deg, var(--primary), #2c5282) !important;
}

.progress::-moz-progress-bar,
.progress.is-primary::-moz-progress-bar {
    background: linear-gradient(135deg, var(--primary), #2c5282) !important;
}

/* Клик/фокус по строке профессии/категории: без синей заливки, только мягкая подсветка */
.profession-item:active,
.profession-item:focus,
.profession-item:focus-visible,
[data-theme="dark"] .profession-item:active,
[data-theme="dark"] .profession-item:focus,
[data-theme="dark"] .profession-item:focus-visible {
    background-color: var(--primary-light) !important;
}

.profession-item:active span:not(.icon),
.profession-item:focus span:not(.icon),
.profession-item:focus-visible span:not(.icon),
[data-theme="dark"] .profession-item:active span:not(.icon),
[data-theme="dark"] .profession-item:focus span:not(.icon),
[data-theme="dark"] .profession-item:focus-visible span:not(.icon) {
    color: var(--primary) !important;
}

.profession-item:active .icon,
.profession-item:focus .icon,
.profession-item:focus-visible .icon,
[data-theme="dark"] .profession-item:active .icon,
[data-theme="dark"] .profession-item:focus .icon,
[data-theme="dark"] .profession-item:focus-visible .icon {
    color: var(--primary) !important;
}

.profession-item:active .has-text-grey,
.profession-item:focus .has-text-grey,
.profession-item:focus-visible .has-text-grey,
[data-theme="dark"] .profession-item:active .has-text-grey,
[data-theme="dark"] .profession-item:focus .has-text-grey,
[data-theme="dark"] .profession-item:focus-visible .has-text-grey {
    color: var(--text-light) !important;
}

/* Без синей обводки у строки профессии/категории после клика */
.profession-item:focus-visible,
.profession-item:focus {
    outline: none !important;
    box-shadow: none !important;
}

/* Страница профессии: клик/фокус по строке теста — без насыщенной синей заливки */
.table tbody tr.test-row:active,
.table tbody tr.test-row:focus,
.table tbody tr.test-row:focus-visible,
.table tbody tr.test-row:focus-within {
    background-color: var(--primary-light) !important;
    background-image: none !important;
}

.table tbody tr.test-row:active > td,
.table tbody tr.test-row:focus > td,
.table tbody tr.test-row:focus-visible > td,
.table tbody tr.test-row:focus-within > td,
.table tbody tr.test-row:active .test-name,
.table tbody tr.test-row:focus .test-name,
.table tbody tr.test-row:focus-visible .test-name,
.table tbody tr.test-row:active .has-text-weight-semibold,
.table tbody tr.test-row:focus .has-text-weight-semibold,
.table tbody tr.test-row:focus-visible .has-text-weight-semibold {
    color: var(--text) !important;
}

.table tbody tr.test-row:active .tag,
.table tbody tr.test-row:focus .tag,
.table tbody tr.test-row:focus-visible .tag,
.table tbody tr.test-row:focus-within .tag {
    background-color: hsl(var(--bulma-info-h), var(--bulma-info-s), var(--bulma-info-l)) !important;
    border-color: transparent !important;
    color: #ffffff !important;
}

.table tbody tr.test-row:active .icon,
.table tbody tr.test-row:focus .icon,
.table tbody tr.test-row:focus-visible .icon,
.table tbody tr.test-row:focus-within .icon {
    color: var(--primary) !important;
}

.table tbody tr.test-row:focus,
.table tbody tr.test-row:focus-visible {
    outline: none !important;
}

/* Строки тестов на странице профессии: мягкая подсветка, как у списков категорий (без синей заливки) */
.table tbody tr.test-row:hover,
.table tbody tr.test-row:focus-within,
[data-theme="dark"] .table tbody tr.test-row:hover,
[data-theme="dark"] .table tbody tr.test-row:focus-within {
    background-color: var(--primary-light) !important;
    background-image: none !important;
}

.table tbody tr.test-row:hover > td,
.table tbody tr.test-row:hover .test-name,
.table tbody tr.test-row:hover .has-text-weight-semibold,
[data-theme="dark"] .table tbody tr.test-row:hover > td,
[data-theme="dark"] .table tbody tr.test-row:hover .test-name,
[data-theme="dark"] .table tbody tr.test-row:hover .has-text-weight-semibold {
    color: var(--text) !important;
}

.table tbody tr.test-row:hover .icon,
[data-theme="dark"] .table tbody tr.test-row:hover .icon {
    color: var(--primary) !important;
}

.table tbody tr.test-row:hover .tag,
[data-theme="dark"] .table tbody tr.test-row:hover .tag {
    background-color: hsl(var(--bulma-info-h), var(--bulma-info-s), var(--bulma-info-l)) !important;
    border-color: transparent !important;
    color: #ffffff !important;
}

/* === Страница «Купить билеты» === */
.buy-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.25rem;
}

.buy-card-col {
    display: flex;
}

.buy-empty {
    grid-column: 1 / -1;
}

.buy-grid .ticket-card {
    display: flex !important;
    flex-direction: column !important;
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    padding: 1.5rem;
}

.buy-grid .ticket-card .card-content {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    padding: 0;
}

.buy-grid .ticket-card .ticket-footer {
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.buy-grid .ticket-card .tag {
    display: inline-flex !important;
    width: auto !important;
}

.buy-grid .ticket-price .title {
    font-size: 1.5rem !important;
    margin-bottom: 0 !important;
}

/* Блок «Что вы получаете при покупке» */
.buy-benefits {
    background: var(--primary-light) !important;
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text);
}

.buy-benefit {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    text-align: left;
    color: var(--text);
}

.buy-benefit .icon {
    flex-shrink: 0;
}

.buy-benefits .columns {
    gap: 0 !important;
}

.buy-benefits-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem 1.5rem;
}

@media screen and (max-width: 900px) {
    .buy-grid,
    .buy-benefits-list {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* Нечётное число карточек: последняя — по центру */
.buy-grid > .buy-card-col:last-child:nth-child(odd) {
    grid-column: 1 / -1;
    justify-self: center;
    width: calc(50% - 10px);
}

@media screen and (max-width: 900px) {
    .buy-grid > .buy-card-col:last-child:nth-child(odd) {
        width: 100%;
    }
}

/* === Страница оплаты === */
.pay-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
    gap: 1.25rem;
    align-items: start;
}

.pay-summary .card-content,
.pay-checkout .card-content {
    padding: 1.5rem;
}

.pay-facts {
    display: grid;
    gap: 0.25rem;
    margin: 0 0 1.25rem;
}

.pay-fact {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
    padding: 0.55rem 0;
    border-bottom: 1px dashed var(--border);
    font-size: 0.95rem;
    color: var(--text-light);
}

.pay-fact:last-child {
    border-bottom: none;
}

.pay-fact strong {
    color: var(--text);
    text-align: right;
}

.pay-price {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
    line-height: 1.2;
}

.pay-checkout .payment-form {
    margin: 0 0 1rem;
}

.pay-checkout .help-text {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-top: 0.35rem;
}

.pay-checkout .security-info {
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 0.75rem;
    margin-top: 1.25rem;
    padding: 0.9rem 1rem;
    background: var(--primary-light);
    border-radius: 10px;
}

.pay-checkout .security-info p {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text);
}

.pay-text ul {
    margin-left: 1.1rem;
}

.pay-text li {
    margin-bottom: 0.5rem;
}

@media screen and (max-width: 900px) {
    .pay-layout {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* Билет: подсветка после ответа должна перекрывать состояние выбранного варианта */.answer-option.answer-correct,
.answer-option.correct {
    background: #d4edda !important;
    border-color: #28a745 !important;
    color: #1f2933;
}

.answer-option.answer-incorrect,
.answer-option.incorrect {
    background: #f8d7da !important;
    border-color: #dc3545 !important;
    color: #1f2933;
}

[data-theme="dark"] .answer-option.answer-correct,
[data-theme="dark"] .answer-option.correct {
    background: #173b26 !important;
    border-color: #34c759 !important;
    color: #fff;
}

[data-theme="dark"] .answer-option.answer-incorrect,
[data-theme="dark"] .answer-option.incorrect {
    background: #41211f !important;
    border-color: #ff453a !important;
    color: #fff;
}

/* Карточки покупки: длинное описание теста обрезаем до трёх строк */
.buy-card-col .card-content > p.has-text-grey {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
