/* ============================================================
   «Делилка» — современный дизайн (космическая тема, 2026)
   Стеклянные карточки, градиенты, парящие цифры, анимации,
   доступность (фокус, reduced-motion).
   ============================================================ */

/* Рукописный детский шрифт Neucha — хранится локально в проекте */
@font-face {
    font-family: 'Neucha';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url("../fonts/neucha-cyrillic-400-normal.72b39e70660a.woff2") format('woff2');
    unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
    font-family: 'Neucha';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url("../fonts/neucha-latin-400-normal.7ee76905723e.woff2") format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ===== Базовое ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    font-family: 'Segoe UI', system-ui, -apple-system, 'Roboto', sans-serif;
    min-height: 100vh;
    color: #e8ecff;
    background: radial-gradient(120% 120% at 15% 0%, #352a6e 0%, #221a4d 45%, #120d2e 100%);
    overflow-x: hidden;
}

/* цветные «туманности» на фоне космоса */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background:
        radial-gradient(40% 30% at 82% 12%, rgba(255, 94, 190, 0.14), transparent 70%),
        radial-gradient(45% 35% at 10% 85%, rgba(94, 130, 255, 0.16), transparent 70%),
        radial-gradient(35% 30% at 55% 45%, rgba(255, 196, 0, 0.06), transparent 70%);
}

/* ===== Парящие цифры на фоне (из ТЗ: «синий космос, парят белые цифры») ===== */
#bg-digits {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}
.bg-digit {
    position: absolute;
    bottom: -70px;
    color: rgba(255, 255, 255, 0.13);
    font-weight: 700;
    line-height: 1;
    animation-name: floatUp;
    animation-timing-function: linear;
    animation-iteration-count: infinite;
    user-select: none;
}
@keyframes floatUp {
    0%   { transform: translateY(0) rotate(0deg); opacity: 0; }
    8%   { opacity: 1; }
    85%  { opacity: 1; }
    100% { transform: translateY(-115vh) rotate(24deg); opacity: 0; }
}

/* мерцающие звёздочки */
.bg-star {
    position: absolute;
    color: rgba(255, 255, 255, 0.6);
    line-height: 1;
    animation: twinkle 3.5s ease-in-out infinite;
    user-select: none;
}
@keyframes twinkle {
    0%, 100% { opacity: 0.15; transform: scale(0.8); }
    50%      { opacity: 0.95; transform: scale(1.15); }
}

/* ===== Экраны ===== */
.screen {
    display: none;
    position: relative;
    z-index: 1;
    width: 100%;
    min-height: 100vh;
    padding: 18px 14px;
}
.screen.visible {
    display: flex;
    animation: screenIn 0.4s ease;
}
@keyframes screenIn {
    from { opacity: 0; transform: scale(0.96) translateY(8px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

/* Стеклянная карточка — центр экрана, скроллится при нехватке места */
.inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 460px;
    margin: auto;
    padding: 24px 16px 28px;
}

/* ===== Главный экран ===== */
.mascot {
    font-size: 3.2rem;
    line-height: 1;
    margin-bottom: 6px;
    animation: bounce 2.6s ease-in-out infinite;
    filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.25));
}
@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-8px); }
}
.title {
    font-family: 'Neucha', 'Comic Sans MS', 'Chalkboard SE', cursive, sans-serif;
    font-size: 3.9rem;
    font-weight: 900;
    color: #ffb98c;
    text-shadow: 0 0 24px rgba(255, 150, 100, 0.45);
    letter-spacing: 2px;
    margin-bottom: 6px;
}
/* главный экран: кнопки раздвинуты и одинаковой ширины */
#home-screen .inner { gap: 32px; }
#home-screen .btn { width: 250px; }
/* футер на главном экране (внизу) */
#home-screen { flex-direction: column; }
.home-footer {
    margin-top: auto;
    text-align: center;
    padding: 16px 14px;
}
.home-footer .home-link { margin-top: 0; }
.credit {
    color: #8f8ab5;
    font-size: 0.85rem;
    margin-top: 10px;
}

/* ===== Экран регистрации для отчётов ===== */
.register-hint {
    color: #c3ceff;
    font-size: 0.95rem;
    text-align: center;
    margin-bottom: 14px;
    line-height: 1.5;
}
.register-input {
    width: 100%;
    max-width: 300px;
    padding: 12px 16px;
    font-size: 1.05rem;
    color: #1a237e;
    background: #ffffff;
    border: 3px solid #3f51b5;
    border-radius: 14px;
    margin-bottom: 12px;
    outline: none;
}
.register-input:focus { border-color: #ffd600; }
/* согласие на обработку персональных данных (152-ФЗ) */
.consent-row {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    width: 100%;
    max-width: 300px;
    margin: 0 auto 12px;
    color: #c3ceff;
    font-size: 0.82rem;
    line-height: 1.45;
    text-align: left;
    cursor: pointer;
}
.consent-row input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin: 1px 0 0;
    flex-shrink: 0;
    accent-color: #ffd600;
    cursor: pointer;
}
.consent-row a { color: #ffe08a; }
/* выбор иконки ребёнка (эмодзи — не персональные данные) */
.icon-hint {
    color: #c3ceff;
    font-size: 0.9rem;
    text-align: center;
    margin: 0 0 8px;
}
.icon-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    max-width: 320px;
    width: 100%;
    margin: 0 auto 12px;
}
.icon-opt {
    width: 46px;
    height: 46px;
    font-size: 1.5rem;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.12);
    border: 2px solid rgba(255, 255, 255, 0.25);
    border-radius: 12px;
    cursor: pointer;
    padding: 0;
}
.icon-opt:hover { background: rgba(255, 255, 255, 0.22); }
.icon-opt.selected {
    background: #ffd600;
    border-color: #ffffff;
    box-shadow: 0 0 0 3px rgba(255, 214, 0, 0.45);
}
.icon-opt.taken {
    opacity: 0.3;
    cursor: not-allowed;
    filter: grayscale(0.5);
}
.icon-opt.taken:hover { background: rgba(255, 255, 255, 0.12); }
.register-msg {
    min-height: 1.3em;
    color: #8bc34a;
    font-weight: 800;
    font-size: 0.95rem;
    margin-bottom: 8px;
}
.register-msg.error { color: #e53935; }
#register-screen .inner { gap: 0; }
/* список детей под одним e-mail (переключатель ребёнка) */
.register-children {
    width: 100%;
    max-width: 300px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin-bottom: 12px;
}
.register-children[hidden] { display: none; }
.child-btn {
    padding: 8px 16px;
    font-size: 1rem;
    font-weight: 800;
    color: #1a237e;
    background: linear-gradient(145deg, rgba(255, 217, 189, 0.9), rgba(255, 179, 148, 0.9));
    border: none;
    border-radius: 999px;
    cursor: pointer;
}
.child-btn.active { background: #ffd600; box-shadow: 0 0 0 3px #ffffff; }
.child-wrap {
    display: inline-flex;
    align-items: center;
    gap: 2px;
}
.child-del {
    border: none;
    background: transparent;
    color: #e53935;
    font-size: 0.9rem;
    font-weight: 900;
    cursor: pointer;
    padding: 2px 5px;
    border-radius: 8px;
}
.child-del.confirm {
    color: #ffffff;
    background: #e53935;
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 0.8rem;
}
.tg-link {
    display: inline-block;
    /* заметный отступ от предыдущей строки (пустая строка) */
    margin-top: 28px;
    color: #ffe08a;
    font-weight: 700;
    text-decoration: none;
    border-bottom: 2px solid rgba(255, 224, 138, 0.5);
    font-size: 0.95rem;
    text-align: center;
    max-width: 100%;
}
.tg-link:hover { color: #ffffff; }

/* ===== Экраны выбора: режим / порядок ===== */
.screen-title {
    font-family: 'Neucha', 'Comic Sans MS', 'Chalkboard SE', cursive, sans-serif;
    font-size: 2.6rem;
    font-weight: 900;
    color: #ffb98c;
    text-shadow: 0 0 20px rgba(255, 150, 100, 0.4);
    margin-bottom: 18px;
    text-align: center;
}
#mode-screen .inner, #order-screen .inner { gap: 18px; }
.btn.wide { width: 280px; }

/* маленькая подпись раздела над заголовком экрана выбора */
.screen-caption {
    color: #c3ceff;
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 1px;
    margin-bottom: 4px;
}

/* ===== Сетка столбиков 3×3 ===== */
.column-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    width: 100%;
    max-width: 300px;
    margin-bottom: 14px;
}
.col-btn {
    height: 84px;
    font-size: 2.2rem;
    font-weight: 900;
    font-family: 'Arial Black', Arial, sans-serif;
    color: #1a237e;
    background: linear-gradient(145deg, rgba(255, 217, 189, 0.9), rgba(255, 179, 148, 0.9));
    border: none;
    border-radius: 20px;
    cursor: pointer;
    box-shadow: 0 6px 14px rgba(63, 81, 181, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.6);
    transition: transform 0.1s ease, box-shadow 0.1s ease;
}
.col-btn:hover { transform: translateY(-2px); }
.col-btn:active { transform: translateY(0) scale(0.96); }
.col-btn:focus-visible { outline: 3px solid #ffd600; outline-offset: 3px; }
/* степень изученности столбика: зелёный — выучен, жёлтый — начат, красный — не начат */
.col-btn.col-green {
    background: linear-gradient(145deg, rgba(139, 195, 74, 0.95), rgba(104, 159, 56, 0.95));
    color: #ffffff;
}
.col-btn.col-yellow {
    background: linear-gradient(145deg, rgba(255, 214, 0, 0.95), rgba(249, 168, 37, 0.95));
}
.col-btn.col-red {
    background: linear-gradient(145deg, rgba(229, 115, 115, 0.95), rgba(198, 40, 40, 0.95));
    color: #ffffff;
}
.col-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    margin-bottom: 14px;
    color: #c3ceff;
    font-size: 0.85rem;
}
.col-legend-item { display: inline-flex; align-items: center; gap: 5px; }
.legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
}
.legend-dot.green { background: #8bc34a; }
.legend-dot.yellow { background: #ffd600; }
.legend-dot.red { background: #e53935; }

/* подпись режима на экране опроса */
.exam-mode-label {
    display: block;
    color: #ffe08a;
    font-size: 1.1rem;
    font-weight: 800;
    margin-bottom: 8px;
    text-align: center;
}

/* предупреждение: сервер обучения недоступен */
.learn-warning {
    width: 100%;
    max-width: 420px;
    margin-bottom: 10px;
    padding: 8px 14px;
    background: rgba(255, 196, 0, 0.14);
    border: 2px solid rgba(255, 214, 0, 0.7);
    border-radius: 12px;
    color: #ffe08a;
    font-size: 0.9rem;
    font-weight: 700;
    text-align: center;
}
.learn-warning[hidden] { display: none; }

/* подвал экрана опроса: «Назад» + «На главную» */
.exam-footer {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 14px;
    margin-top: 20px;
}
.exam-footer .home-link { margin-top: 0; }

/* ===== Блок-подсказка при неверном ответе (режим обучения) ===== */
.hint-box {
    width: 100%;
    max-width: 420px;
    height: 340px;
    overflow: hidden;
    background: #f5e9cf;
    border: 3px solid #e8cf9e;
    border-radius: 20px;
    padding: 14px 16px;
    margin-bottom: 26px;
    box-sizing: border-box;
    color: #4a3b22;
    font-size: 1.25rem;
    line-height: 1.45;
    font-weight: 700;
}
.hint-box[hidden] { display: none; }
.hint-box { text-align: left; }
/* аккуратный перенос: вторая строка с отступом */
.hint-line {
    padding: 2px 0 2px 1.2em;
    text-indent: -1.2em;
}
/* отступ после строки перестановки множителей (первой) */
.hint-line:first-child { margin-bottom: 10px; }
/* строка-ядро (текущий множитель): зелёным вместо жирного */
.hint-strong { color: #2e8b57; }
/* отступ перед строкой связи с предыдущим множителем */
.hint-sep { margin-top: 12px; }
/* яблоки: один горизонтальный ряд (с переносом), влезает больше;
   заметный отступ от строк примера */
.apple-grid {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 5px;
    margin-top: 20px;
}
.apple { font-size: 22px; line-height: 1; }

/* ===== Кнопки-ответы (столбики режима обучения) ===== */
.answer-options {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    width: 100%;
    max-width: 420px;
    margin-top: 12px;
}
.answer-options[hidden] { display: none; }
.ans-opt {
    height: 56px;
    font-size: 1.5rem;
    font-weight: 900;
    font-family: 'Arial Black', Arial, sans-serif;
    color: #1a237e;
    background: linear-gradient(145deg, rgba(255, 217, 189, 0.9), rgba(255, 179, 148, 0.9));
    border: none;
    border-radius: 16px;
    cursor: pointer;
    box-shadow: 0 5px 12px rgba(63, 81, 181, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.6);
    transition: transform 0.1s ease, box-shadow 0.1s ease;
}
.ans-opt:hover { transform: translateY(-2px); }
.ans-opt:active { transform: translateY(0) scale(0.96); }
.ans-opt.selected {
    background: linear-gradient(145deg, #ffd600, #ffb300);
    color: #1a237e;
    box-shadow: 0 0 0 3px #ffffff, 0 5px 12px rgba(255, 196, 0, 0.4);
}

/* звёзды на главном экране — как внутри опроса */
.home-stars {
    margin-bottom: 4px;
}

/* ===== Модалка подтверждения выхода ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(10, 6, 30, 0.65);
}
.modal-overlay[hidden] { display: none; }
.modal-box {
    width: 100%;
    max-width: 320px;
    padding: 26px 22px;
    background: linear-gradient(160deg, #3b2f74, #241b52);
    border: 2px solid rgba(255, 255, 255, 0.25);
    border-radius: 24px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
    text-align: center;
}
.modal-text {
    font-family: 'Neucha', 'Comic Sans MS', 'Chalkboard SE', cursive, sans-serif;
    font-size: 1.7rem;
    font-weight: 900;
    color: #ffffff;
    margin-bottom: 18px;
}
.modal-actions { display: flex; flex-direction: column; gap: 12px; }
.modal-actions .btn { width: 100%; }
.btn-ghost {
    background: rgba(255, 255, 255, 0.16);
    border: 3px solid rgba(255, 255, 255, 0.45);
    box-shadow: none;
}
.btn-ghost:hover { background: rgba(255, 255, 255, 0.26); }

/* ===== Кнопки ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    text-decoration: none;
    border: none;
    border-radius: 999px;
    padding: 16px 40px;
    font-size: 1.25rem;
    font-weight: 800;
    color: #fff;
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}
/* Якоря-кнопки (навигация по hash): гарантированное центрирование текста */
a.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}
.btn:focus-visible {
    outline: 3px solid #ffd600;
    outline-offset: 3px;
}
.btn-disabled {
    background: linear-gradient(135deg, rgba(185, 185, 199, 0.75), rgba(154, 154, 171, 0.75));
    opacity: 0.6;
    cursor: not-allowed;
    box-shadow: none;
}
.btn-primary {
    background: linear-gradient(135deg, rgba(111, 90, 232, 0.92), rgba(63, 81, 181, 0.92));
    box-shadow: 0 10px 26px rgba(111, 90, 232, 0.5);
    color: #ffe08a;
    border: 2px solid #ffffff;
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 14px 32px rgba(111, 90, 232, 0.6); }
.btn-primary:active { transform: translateY(0) scale(0.97); }

/* жёлтая кнопка «Ответить» — белая рамка, тёмный текст */
.btn-answer {
    background: linear-gradient(135deg, #ffd600, #ffb300);
    border: 4px solid #ffffff;
    color: #1a237e;
    width: 195px;
    height: 62px;
    font-size: 1.35rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 24px rgba(255, 196, 0, 0.35), 0 0 20px rgba(255, 214, 0, 0.25);
}
.btn-answer:hover { transform: translateY(-2px); }
.btn-answer:active { transform: translateY(0) scale(0.97); }

/* ===== Шапка экзамена ===== */
.title-text {
    font-family: 'Neucha', 'Comic Sans MS', 'Chalkboard SE', cursive, sans-serif;
    font-size: 3.1rem;
    font-weight: 900;
    color: #ffb98c;
    line-height: 1.15;
    margin-bottom: 6px;
    letter-spacing: 2px;
    text-shadow: 0 0 20px rgba(255, 150, 100, 0.4);
}
.star-display {
    display: block;
    font-size: 1.9rem;
    white-space: nowrap;
    margin-bottom: 10px;
    color: #ffe08a;
}
.star-display .star-ico {
    width: 26px;
    height: 26px;
    fill: #ffd600;
    filter: drop-shadow(0 0 10px rgba(255, 214, 0, 0.85));
    vertical-align: -4px;
}
.star-display .star-num {
    color: #ffe08a;
    font-weight: 900;
}

/* статус-бар на всю ширину */
.progress-row {
    display: flex;
    align-items: center;
    width: 100%;
    margin-bottom: 14px;
}
.progress-bar-wrap {
    flex: 1;
    height: 22px;
    background: #f0ecff;
    border: 3px solid #e2bf22;
    border-radius: 14px;
    overflow: hidden;
    position: relative;
}
#progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #8bc34a, #43a047);
    border-radius: 12px;
    transition: width 0.35s ease;
    position: relative;
    overflow: hidden;
}
/* блик на полосе прогресса */
#progress-bar::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.45), transparent);
    transform: translateX(-100%);
    animation: shine 2.4s ease-in-out infinite;
}
@keyframes shine {
    0% { transform: translateX(-100%); }
    60%, 100% { transform: translateX(100%); }
}

.counter { color: #c3ceff; margin-bottom: 18px; font-size: 0.95rem; }

/* ===== Общая подложка: пример + клавиатура одним блоком ===== */
.work-panel {
    width: 100%;
    max-width: 420px;
    padding: 14px 12px 10px;
    margin-bottom: 26px;
    background: rgba(255, 255, 255, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 24px;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

/* ===== Пример и поле ответа ===== */
#question-row {
    position: relative;
    margin-bottom: 8px;
    width: 100%;
    min-height: 130px;
    display: flex;
    align-items: center;
    justify-content: center;
}
#expr-box { display: flex; align-items: center; }

.dcell, .answer-cell {
    font-family: 'Arial Black', Arial, sans-serif;
    font-size: 3rem;
    font-weight: 900;
    text-align: center;
    color: #1a237e;
    background: #ffffff;
    border: 4px solid #3f51b5;
    border-radius: 18px;
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 18px rgba(26, 35, 126, 0.18);
}
.sym {
    font-family: Arial, sans-serif;
    font-size: 3rem;
    font-weight: bold;
    color: #dfe6ff;
    margin: 0 8px;
}
.sym.eq { margin-left: 4px; margin-right: 12px; }
.answer-cell { padding: 0; line-height: 1; }

#fb-box {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 5rem;
    font-weight: 900;
}
.feedback-mark { display: inline-block; animation: popIn 0.3s ease; }
@keyframes popIn {
    0% { transform: scale(0.4); opacity: 0; }
    70% { transform: scale(1.15); }
    100% { transform: scale(1); opacity: 1; }
}

/* ===== Цифровая клавиатура ===== */
#numpad {
    width: 100%;
}
.nrow { display: flex; gap: 10px; justify-content: center; margin-bottom: 10px; }
.nbtn, .bbtn {
    flex: 1 1 0;
    min-width: 0;
    max-width: 64px;
    height: 56px;
    font-size: 1.6rem;
    font-weight: 800;
    border: none;
    border-radius: 16px;
    cursor: pointer;
    transition: transform 0.1s ease, box-shadow 0.1s ease;
}
.nbtn:active, .bbtn:active { transform: translateY(1px) scale(0.96); }
.nbtn {
    color: #1a237e;
    background: linear-gradient(145deg, rgba(255, 217, 189, 0.85), rgba(255, 179, 148, 0.85));
    box-shadow: 0 5px 12px rgba(63, 81, 181, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.6);
}
.nbtn:hover { transform: translateY(-2px); }
.bbtn {
    color: #964609;
    background: linear-gradient(145deg, rgba(241, 241, 246, 0.85), rgba(215, 217, 224, 0.85));
    box-shadow: 0 5px 12px rgba(63, 81, 181, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}
.bbtn:hover { transform: translateY(-2px); }
.bbtn .bbtn-ico {
    width: 27px;
    height: 27px;
    fill: none;
    stroke: #964609;
    stroke-width: 3.2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* ===== Ссылка «На главную» ===== */
.home-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 10px 30px;
    margin-top: 20px;
    color: #3f51b5;
    background: rgba(255, 255, 255, 0.7);
    border: 3px solid #3f51b5;
    border-radius: 999px;
    font-size: 1.05rem;
    font-weight: 800;
    text-decoration: none;
    box-shadow: 0 6px 16px rgba(63, 81, 181, 0.25);
    transition: background 0.15s ease, transform 0.12s ease;
}
.home-link:hover { background: #eef1ff; transform: translateY(-2px); }
.home-link:active { transform: translateY(0) scale(0.97); }
.home-link:focus-visible { outline: 3px solid #ffd600; outline-offset: 3px; }
.home-link.big { margin-top: 10px; }

/* ===== Экран результата ===== */
.result-emoji {
    font-size: 4.2rem;
    line-height: 1.2;
    animation: popIn 0.5s ease;
}
#result-screen h1 { font-size: 2rem; color: #ffb98c; font-family: 'Neucha', cursive; font-weight: 900; text-shadow: 0 0 20px rgba(255, 150, 100, 0.4); }
#result-score { font-size: 1.35rem; margin-top: 8px; color: #e8ecff; }
#result-message { font-size: 1.15rem; margin-top: 4px; color: #ffffff; }
.result-stars {
    font-size: 1.3rem;
    font-weight: 900;
    color: #ffe08a;
    margin-top: 8px;
}
.result-details {
    color: #c3ceff;
    font-size: 0.92rem;
    line-height: 1.7;
    text-align: center;
    margin-top: 8px;
}

/* ===== Конфетти при победе ===== */
.confetti {
    position: fixed;
    top: -16px;
    z-index: 99;
    border-radius: 3px;
    pointer-events: none;
    animation-name: confettiFall;
    animation-timing-function: linear;
    animation-fill-mode: forwards;
}
@keyframes confettiFall {
    to { transform: translateY(112vh) rotate(720deg); opacity: 0.5; }
}

/* ===== Цвета обратной связи ===== */
.answer-correct { color: #2e8b57; }
.answer-wrong { color: #e53935; }
.wrong-answer-num { color: #c9d4ff !important; font-size: 1.2rem !important; }

/* ===== Небольшие экраны (смартфоны) ===== */
@media (max-width: 480px) {
    .inner { padding: 18px 12px 22px; }
    .title { font-size: 3.1rem; }
    .title-text { font-size: 2.5rem; }
    .screen-title { font-size: 2.1rem; }
    .btn.wide { width: 240px; }
    .column-grid { max-width: 250px; gap: 10px; }
    .col-btn { height: 64px; font-size: 1.8rem; }
    .ans-opt { height: 48px; font-size: 1.25rem; }
    .hint-box { height: 320px; font-size: 1.1rem; }
    .apple { font-size: 20px; }
    .dcell, .answer-cell { width: 60px; height: 60px; font-size: 2.2rem; border-width: 3px; }
    .sym { font-size: 2.2rem; margin: 0 5px; }
    .nbtn, .bbtn { height: 48px; font-size: 1.3rem; }
    .home-stats { gap: 12px; font-size: 0.9rem; }
    .btn-primary { font-size: 1.15rem; padding: 14px 30px; }
    .btn-answer { font-size: 1.2rem; width: 170px; height: 54px; }
    #numpad { max-width: 360px; }
    .result-emoji { font-size: 3.4rem; }
}

/* ===== Доступность: отключаем анимации по запросу ===== */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.001s !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001s !important;
    }
}
