/* Онлайн-тренажеры (/trenazhery/*): демо-версии упражнений с занятий. Сначала телефон, потом компьютер */

.tr-page {
    --tr-blue: #0047FF;
    --tr-blue-dark: #0036C4;
    --tr-blue-soft: #EEF2FF;
    --tr-blue-line: #DCE3FF;
    --tr-yellow: #F2A904;
    --tr-yellow-soft: #FFF5DA;
    --tr-pink: #FF4F8B;
    --tr-purple: #7C4DFF;
    --tr-green: #16A34A;
    --tr-red: #E5484D;
    --tr-text: #353339;
    --tr-muted: #625B71;
    background: #F9F9F9;
    color: var(--tr-text);
    font-family: Roboto, Arial, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    padding-bottom: 32px;
    overflow-x: hidden;
}
.tr-page h1,
.tr-page h2 {
    text-transform: none;
    text-align: left;
    color: var(--tr-text);
    font-weight: 700;
}
.tr-page h2 {
    font-size: 26px;
    line-height: 1.25;
    margin: 0 0 20px;
}
.tr-page p {
    margin: 0;
}
.tr-page [hidden] {
    display: none !important;
}
.tr-page button {
    font-family: inherit;
    -webkit-tap-highlight-color: transparent;
}

/* ---------- кнопки */

.tr-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 52px;
    padding: 12px 28px;
    border: 0;
    border-radius: 100px;
    background: var(--tr-blue);
    color: #FFF;
    font-size: 17px;
    font-weight: 700;
    cursor: pointer;
    transition: transform .1s ease, background .15s ease;
}
.tr-btn:hover {
    background: var(--tr-blue-dark);
    color: #FFF;
}
.tr-btn:active {
    transform: scale(.97);
}
.tr-btn-wide {
    display: flex;
    width: 100%;
    margin-top: 8px;
}
.tr-btn-yellow {
    background: var(--tr-yellow);
    color: var(--tr-text);
}
.tr-btn-yellow:hover {
    background: #DB9900;
    color: var(--tr-text);
}
.tr-btn-small {
    min-height: 40px;
    padding: 6px 16px;
    border: 2px solid var(--tr-blue-line);
    border-radius: 100px;
    background: #FFF;
    color: var(--tr-blue);
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
}
.tr-btn-small:hover {
    border-color: var(--tr-blue);
}

/* ---------- шапка: жёлтая полоса и белая карточка, как у страниц курсов */

.tr-hero {
    background: var(--tr-yellow);
    padding: 20px 0 92px;
}
.tr-page-flash-anzan .tr-hero {
    background: var(--tr-blue);
}
.tr-page-multiplication .tr-hero {
    background: var(--tr-purple);
}
.tr-hero-card {
    display: flex;
    align-items: center;
    gap: 24px;
    background: #FFF;
    border-radius: 32px;
    padding: 24px 20px;
    box-shadow: 0 4px 32px rgba(0, 0, 0, .16);
}
.tr-hero-text {
    flex: 1;
}
.tr-badge {
    display: inline-block;
    padding: 4px 14px;
    border-radius: 100px;
    background: var(--tr-yellow-soft);
    color: #9A6400;
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 10px;
}
.tr-hero h1 {
    font-size: 28px;
    line-height: 1.2;
    margin: 0 0 10px;
}
.tr-hero p {
    color: var(--tr-muted);
    font-size: 16px;
}
.tr-hero-image {
    display: none;
}

/* ---------- карточка игры */

.tr-game {
    position: relative;
    margin-top: -72px;
    background: #FFF;
    border-radius: 32px;
    padding: 16px;
    box-shadow: 0 10px 32px rgba(0, 0, 0, .12);
    overflow: hidden;
}
.tr-tabs {
    display: flex;
    gap: 4px;
    padding: 4px;
    margin-bottom: 14px;
    border-radius: 100px;
    background: var(--tr-blue-soft);
}
.tr-tab {
    flex: 1;
    min-height: 44px;
    padding: 6px 8px;
    border: 0;
    border-radius: 100px;
    background: transparent;
    color: var(--tr-blue);
    font-size: 14px;
    font-weight: 700;
    line-height: 1.15;
    cursor: pointer;
}
.tr-tab.is-active {
    background: var(--tr-blue);
    color: #FFF;
    box-shadow: 0 4px 12px rgba(0, 71, 255, .3);
}
.tr-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
}
.tr-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 44px;
    padding: 8px 16px;
    border: 2px solid var(--tr-blue-line);
    border-radius: 100px;
    background: #FFF;
    color: var(--tr-blue);
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
}
.tr-chip:focus {
    outline: none;
}
.tr-chip:focus-visible {
    outline: 3px solid var(--tr-pink);
    outline-offset: 2px;
}
.tr-chip.is-active {
    border-color: var(--tr-blue);
    background: var(--tr-blue);
    color: #FFF;
}
.tr-chip.is-locked {
    border-style: dashed;
    border-color: #D5D2DC;
    background: #F4F3F7;
    color: #8C8796;
}
/* 4 уровня «Приклади» абакуса - сеткой 2 × 2, а не по одному в строку на телефоне */
.tr-chips-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}
.tr-chips-grid .tr-chip {
    justify-content: center;
    padding: 6px 4px;
    font-size: 13px;
    line-height: 1.2;
    text-align: center;
}
.tr-chip-square {
    min-width: 64px;
    justify-content: center;
    font-size: 18px;
}
.tr-lock-svg {
    width: 14px;
    height: 14px;
    flex: 0 0 14px;
    fill: currentColor;
}
.tr-setting {
    margin-bottom: 4px;
}
.tr-setting-label {
    font-size: 14px;
    font-weight: 700;
    color: var(--tr-muted);
    text-transform: uppercase;
    letter-spacing: .04em;
    margin-bottom: 8px;
}
.tr-hint {
    text-align: center;
    color: var(--tr-muted);
    font-size: 15px;
    margin: 0 0 10px !important;
}

/* подсказка с формулами брата */
.tr-formula {
    margin: -4px 0 14px !important;
    padding: 10px 14px;
    border-radius: 16px;
    background: var(--tr-yellow-soft);
    color: var(--tr-text);
    font-size: 15px;
    line-height: 1.45;
}

/* задание, прогресс, отклик */
.tr-progress {
    height: 10px;
    border-radius: 10px;
    background: var(--tr-blue-soft);
    overflow: hidden;
    margin-bottom: 12px;
}
.tr-progress i {
    display: block;
    height: 100%;
    width: 0;
    border-radius: 10px;
    background: linear-gradient(90deg, var(--tr-blue), var(--tr-pink));
    transition: width .3s ease;
}
.tr-task-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.tr-task-text {
    font-size: 34px;
    line-height: 1.15;
    font-weight: 800;
    color: var(--tr-blue);
    font-variant-numeric: tabular-nums;
}
.tr-feedback {
    min-height: 26px;
    margin: 6px 0;
    font-size: 17px;
    font-weight: 700;
    text-align: center;
}
.tr-feedback.is-correct {
    color: var(--tr-green);
}
.tr-feedback.is-wrong {
    color: var(--tr-red);
}

/* ---------- абакус: 5 спиц, верхняя косточка - 5, нижние - по 1 */

.abacus {
    --bead-h: 30px;
    display: flex;
    justify-content: center;
    margin: 4px 0 10px;
}
.abacus-frame {
    /* ширина - от карточки, а не от экрана: на iPhone расчёт от 100vw выходил шире карточки */
    display: flex;
    box-sizing: border-box;
    width: 100%;
    max-width: 440px;
    padding: 10px 6px 0;
    border: 3px solid var(--tr-blue-line);
    border-radius: 24px;
    background: #F7F9FF;
}
.abacus-rod {
    position: relative;
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.abacus-rod::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 24px;
    left: 50%;
    width: 4px;
    margin-left: -2px;
    border-radius: 2px;
    background: #C9D3F0;
}
.abacus-upper,
.abacus-lower {
    position: relative;
    box-sizing: content-box;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.abacus-upper {
    height: calc(var(--bead-h) * 2);
}
.abacus-lower {
    height: calc(var(--bead-h) * 4);
    padding-top: var(--bead-h);
    border-top: 8px solid var(--tr-blue);
}
.abacus-rod:first-child .abacus-lower {
    border-top-left-radius: 4px;
}
.abacus-bead {
    position: relative;
    z-index: 1;
    width: calc(100% - 8px);
    max-width: 76px;
    height: var(--bead-h);
    flex: 0 0 var(--bead-h);
    padding: 0;
    border: 0;
    border-radius: 50% / 50%;
    background: radial-gradient(ellipse at 50% 30%, #FFE08A 0%, #F2A904 55%, #C98500 100%);
    box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .15);
    cursor: pointer;
    transition: transform .14s ease;
    touch-action: manipulation;
}
.abacus-bead.is-active {
    background: radial-gradient(ellipse at 50% 30%, #8FB0FF 0%, #0047FF 58%, #0030B0 100%);
}
.abacus-bead-upper.is-active {
    transform: translateY(var(--bead-h));
}
.abacus-bead-lower.is-active {
    transform: translateY(calc(var(--bead-h) * -1));
}
.abacus-bead:focus-visible {
    outline: 3px solid var(--tr-pink);
    outline-offset: 1px;
}
.abacus-place {
    display: block;
    height: 24px;
    line-height: 24px;
    font-size: 11px;
    color: var(--tr-muted);
    white-space: nowrap;
}
.tr-abacus-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 10px 16px;
    margin-bottom: 8px;
}
.tr-abacus-value {
    width: 100%;
    text-align: center;
    font-size: 44px;
    line-height: 1;
    font-weight: 800;
    color: var(--tr-blue);
    font-variant-numeric: tabular-nums;
}
.is-value-hidden .tr-abacus-value {
    visibility: hidden;
}

/* переключатель */
.tr-switch {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    font-size: 15px;
    font-weight: 400;
    cursor: pointer;
}
.tr-switch input {
    position: absolute;
    opacity: 0;
}
.tr-switch span {
    position: relative;
    width: 44px;
    height: 26px;
    border-radius: 26px;
    background: #D5D2DC;
    transition: background .15s;
}
.tr-switch span::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #FFF;
    transition: transform .15s;
}
.tr-switch input:checked + span {
    background: var(--tr-blue);
}
.tr-switch input:checked + span::after {
    transform: translateX(18px);
}
.tr-switch input:focus-visible + span {
    outline: 3px solid var(--tr-pink);
}

.tr-play-actions {
    display: flex;
    justify-content: center;
    padding-top: 16px;
}

/* ---------- область игры фиксированной высоты: экраны (настройки, игра, ответ, результат) сменяют друг друга
   внутри неё, и низ страницы не прыгает. Высоты подобраны по самому высокому экрану */
.tr-stage {
    --stage-h: 0px;
    display: flex;
    flex-direction: column;
    min-height: var(--stage-h);
}
.tr-stage > * {
    flex: 1 0 auto;
    display: flex;
    flex-direction: column;
}
.tr-stage [data-start],
.tr-stage .tr-play-actions {
    margin-top: auto;
}
.tr-stage .tr-result {
    justify-content: center;
}
/* после проверки клавиатура скрыта - итог по центру области, «До налаштувань» сразу под ним */
.tr-answer.is-checked {
    justify-content: center;
}
.tr-answer.is-checked .tr-play-actions {
    margin-top: 0;
}
.tr-flash .tr-flash-screen {
    flex: 1 0 auto;
}
.tr-stage-flash {
    --stage-h: 470px;
}
.tr-stage-mult {
    --stage-h: 380px;
}
/* место под строку задания абакуса: подсказка свободного режима ниже ростом, без запаса абакус прыгал бы */
.tr-abacus-top {
    min-height: 96px;
}
@media (min-width: 768px) {
    .tr-abacus-top {
        min-height: 104px;
    }
}
.tr-abacus-area {
    position: relative;
}
.tr-abacus-area .tr-result {
    position: absolute;
    inset: -4px 0 0;
    z-index: 4;
    display: flex;
    flex-direction: column;
    justify-content: center;
    border-radius: 24px;
    background: rgba(255, 255, 255, .96);
}
.tr-abacus-area .tr-result[hidden] {
    display: none !important;
}

/* ---------- флеш-анзан */

.tr-flash-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 240px;
    border-radius: 24px;
    background: linear-gradient(135deg, var(--tr-blue) 0%, var(--tr-purple) 100%);
}
.tr-flash-number {
    font-size: 120px;
    line-height: 1;
    font-weight: 800;
    color: #FFF;
    font-variant-numeric: tabular-nums;
}
.tr-flash-number.is-minus {
    color: #FFD15C;
}
.tr-flash-number.is-countdown {
    font-size: 64px;
    opacity: .6;
}
.tr-answer {
    text-align: center;
}
.tr-answer-label {
    font-size: 14px;
    font-weight: 700;
    color: var(--tr-muted);
    text-transform: uppercase;
    letter-spacing: .04em;
}
.tr-answer-display {
    min-height: 64px;
    margin: 6px auto 0;
    max-width: 240px;
    border-bottom: 4px solid var(--tr-blue);
    font-size: 52px;
    line-height: 60px;
    font-weight: 800;
    color: var(--tr-blue);
    font-variant-numeric: tabular-nums;
}
.tr-sequence {
    color: var(--tr-muted);
    font-size: 15px;
    margin-bottom: 8px;
    word-break: break-word;
}
.tr-keypad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    max-width: 360px;
    margin: 8px auto 0;
}
.tr-key {
    min-height: 60px;
    border: 0;
    border-radius: 18px;
    background: var(--tr-blue-soft);
    color: var(--tr-text);
    font-size: 28px;
    font-weight: 700;
    cursor: pointer;
    touch-action: manipulation;
}
.tr-key:active {
    transform: scale(.96);
}
.tr-key-muted {
    color: var(--tr-muted);
}
.tr-key-ok {
    background: var(--tr-blue);
    color: #FFF;
}

/* ---------- таблица умножения */

.tr-mt-question {
    text-align: center;
    font-size: 52px;
    line-height: 1.1;
    font-weight: 800;
    color: var(--tr-text);
    margin: 16px 0 20px;
    font-variant-numeric: tabular-nums;
}
.tr-tiles {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.tr-tile {
    min-height: 76px;
    border: 3px solid var(--tr-blue-line);
    border-radius: 22px;
    background: #FFF;
    color: var(--tr-blue);
    font-size: 32px;
    font-weight: 800;
    cursor: pointer;
    touch-action: manipulation;
    transition: transform .1s ease;
}
.tr-tile:active {
    transform: scale(.97);
}
.tr-tile.is-correct {
    border-color: var(--tr-green);
    background: var(--tr-green);
    color: #FFF;
}
.tr-tile.is-wrong {
    border-color: var(--tr-red);
    background: var(--tr-red);
    color: #FFF;
}

/* ---------- результат, звёзды, конфетти */

.tr-result {
    text-align: center;
    padding: 8px 0 12px;
}
.tr-stars {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-bottom: 8px;
}
.tr-star {
    width: 56px;
    height: 56px;
    fill: #E3E1E8;
    animation: tr-pop .45s ease both;
}
.tr-star.is-on {
    fill: var(--tr-yellow);
}
.tr-stars .tr-star:nth-child(2) {
    width: 68px;
    height: 68px;
    margin-top: -8px;
}
.tr-result-praise {
    font-size: 26px;
    font-weight: 800;
}
.tr-result-text {
    color: var(--tr-muted);
    margin-bottom: 14px;
}
.tr-result-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.tr-confetti {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 5;
}
.tr-confetti i {
    position: absolute;
    top: -12px;
    width: 9px;
    height: 14px;
    border-radius: 2px;
    animation: tr-fall linear forwards;
}
@keyframes tr-fall {
    to {
        top: 105%;
        transform: rotate(540deg);
    }
}
@keyframes tr-pop {
    0% { transform: scale(0); }
    70% { transform: scale(1.2); }
    100% { transform: scale(1); }
}
@keyframes tr-shake {
    25% { transform: translateX(-6px); }
    75% { transform: translateX(6px); }
}
.tr-shake {
    animation: tr-shake .25s ease 2;
}

/* ---------- демо: замок и плашка */

.tr-lock-hint {
    position: relative;
    margin-top: 12px;
    padding: 16px 16px 16px;
    border: 2px solid var(--tr-yellow);
    border-radius: 20px;
    background: var(--tr-yellow-soft);
}
.tr-lock-hint-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 17px;
    font-weight: 800;
    padding-right: 28px;
    margin-bottom: 6px;
}
.tr-lock-hint-title .tr-lock-svg {
    width: 20px;
    height: 20px;
    flex-basis: 20px;
    fill: #C98500;
}
.tr-lock-hint p {
    color: var(--tr-muted);
    font-size: 15px;
    margin-bottom: 12px;
}
.tr-lock-hint .tr-btn {
    width: 100%;
}
.tr-lock-close {
    position: absolute;
    top: 8px;
    right: 10px;
    width: 32px;
    height: 32px;
    border: 0;
    background: transparent;
    font-size: 26px;
    line-height: 1;
    color: var(--tr-muted);
    cursor: pointer;
}
.tr-demo {
    margin-top: 12px;
    padding: 12px 16px;
    border-radius: 16px;
    background: var(--tr-blue-soft);
    color: var(--tr-muted);
    font-size: 14px;
    line-height: 1.45;
}
.tr-demo strong {
    color: var(--tr-blue);
}

/* ---------- «Як грати»: нумерованные карточки на жёлтом, как «Наші заняття» на страницах курсов */

.tr-steps-section {
    background: var(--tr-yellow);
    margin-top: 40px;
    padding: 36px 0;
}
.tr-steps-section h2 {
    color: #FFF;
}
.tr-steps {
    display: grid;
    gap: 16px;
}
.tr-step {
    background: #FFF;
    border-radius: 32px;
    padding: 24px;
}
.tr-step-number {
    font-size: 48px;
    line-height: 1;
    font-weight: 800;
    color: var(--tr-blue);
    margin-bottom: 12px;
}
.tr-step-title {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 6px;
}
.tr-step p {
    color: var(--tr-muted);
}

/* ---------- «Що розвиває» */

.tr-benefits {
    padding: 40px 0 8px;
}
.tr-benefits-list {
    display: grid;
    gap: 16px;
}
.tr-benefit {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    background: #FFF;
    border: 1px solid #EBEBEB;
    border-radius: 32px;
    padding: 24px;
    box-shadow: 0 10px 25px rgba(104, 104, 104, .08);
}
.tr-benefit img {
    width: 64px;
    height: 64px;
    object-fit: contain;
    margin-bottom: 12px;
}
.tr-benefit-title {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 6px;
}
.tr-benefit p {
    color: var(--tr-muted);
}

/* ---------- запись, FAQ, другие тренажеры */

.tr-page .free-lesson-sign-up {
    margin: 40px 0;
}
.tr-page .widgets-faq {
    margin: 40px 0;
}
.tr-page .widgets-faq > .title {
    font-size: 26px;
    font-weight: 700;
    line-height: 1.25;
}
.tr-others {
    padding: 8px 0 16px;
}
.tr-cards {
    display: grid;
    gap: 16px;
}
.tr-card {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 24px;
    border-radius: 32px;
    background: var(--tr-yellow);
    color: var(--tr-text);
    text-decoration: none;
    box-shadow: 0 12px 32px rgba(0, 0, 0, .18);
    transition: transform .15s ease, box-shadow .15s ease;
}
/* Карточки на /trenazhery/ стоят на жёлтой полосе шапки - белая обводка, чтобы не сливались с фоном */
.tr-cards-index .tr-card {
    border: 4px solid #FFF;
}
.tr-card:hover {
    box-shadow: 0 16px 40px rgba(0, 0, 0, .24);
    color: var(--tr-text);
    text-decoration: none;
    transform: translateY(-3px);
}
.tr-card-flash,
.tr-card-mult {
    color: #FFF;
}
.tr-card-flash {
    background: var(--tr-blue);
}
.tr-card-mult {
    background: var(--tr-purple);
}
.tr-card-flash:hover,
.tr-card-mult:hover {
    color: #FFF;
}
.tr-card img {
    width: 100%;
    max-height: 180px;
    object-fit: contain;
    margin-bottom: 8px;
}
.tr-card-title {
    font-size: 24px;
    font-weight: 800;
}
.tr-card-text {
    opacity: .9;
}
.tr-card-link {
    align-self: flex-start;
    margin-top: 8px;
    padding: 10px 22px;
    border-radius: 100px;
    background: #FFF;
    color: var(--tr-blue);
    font-weight: 700;
}
.tr-cards-index {
    margin-top: -72px;
    position: relative;
}
.tr-index-text {
    max-width: 820px;
    margin: 24px 0 0 !important;
    color: var(--tr-muted);
}

/* ---------- компьютер */

@media (min-width: 768px) {
    .tr-page h2 {
        font-size: 32px;
    }
    .tr-hero {
        padding: 32px 0 112px;
    }
    .tr-hero-card {
        padding: 32px 40px;
        border-radius: 40px;
    }
    .tr-hero h1 {
        font-size: 40px;
    }
    .tr-hero p {
        font-size: 18px;
    }
    .tr-hero-image {
        display: block;
        width: 34%;
        max-width: 360px;
        height: auto;
    }
    .tr-game {
        max-width: 760px;
        margin: -88px auto 0;
        padding: 28px;
        border-radius: 40px;
    }
    .tr-tab {
        font-size: 16px;
    }
    .abacus {
        --bead-h: 34px;
    }
    .tr-chips-grid {
        display: flex;
    }
    .tr-chips-grid .tr-chip {
        padding: 8px 16px;
        font-size: 15px;
    }
    .abacus-place {
        font-size: 12px;
    }
    .tr-task-text {
        font-size: 42px;
    }
    .tr-flash-screen {
        min-height: 300px;
    }
    .tr-flash-number {
        font-size: 160px;
    }
    .tr-result-buttons {
        flex-direction: row;
        justify-content: center;
    }
    .tr-steps,
    .tr-benefits-list,
    .tr-cards {
        grid-template-columns: repeat(3, 1fr);
    }
    .tr-others .tr-cards {
        grid-template-columns: repeat(2, 1fr);
    }
    .tr-cards-index {
        margin-top: -88px;
    }
}
