/* TestHub — тест на музыкальный слух.
   Тёмная «аудиосцена», HUD, волна, две крупные pitch-кнопки и круглая
   кнопка тапа. Всё адаптивно, без горизонтального скролла. */

.me-app {
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: #fff;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.me-start {
    padding: clamp(18px, 3vw, 28px);
    text-align: center;
}

.me-start__icon {
    display: inline-grid;
    place-items: center;
    width: 64px;
    height: 64px;
    margin-bottom: 16px;
    border-radius: 20px;
    background: #d1fae5;
    color: #047857;
    font-size: 1.1rem;
    font-weight: 800;
    letter-spacing: .02em;
}

.me-start h2 {
    margin-bottom: .35em;
}

.me-start p {
    max-width: 56ch;
    margin-left: auto;
    margin-right: auto;
    color: var(--muted);
}

.me-start__actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-top: 12px;
}

.me-check {
    min-height: 1.3em;
    margin: 10px 0 0;
    color: #047857;
    font-size: .86rem;
    font-weight: 700;
}

.me-shell[hidden],
.me-pitch[hidden],
.me-rhythm[hidden],
.me-foot [hidden],
.me-error[hidden] {
    display: none;
}

/* ---------- HUD ---------- */

.me-hud {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 14px clamp(14px, 3vw, 24px);
    border-bottom: 1px solid var(--line);
    background: var(--surface-soft);
    font-size: .88rem;
    font-weight: 800;
    color: #0f172a;
}

.me-hud__stage {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.me-hud__round {
    flex: 0 0 auto;
    color: #0f766e;
    font-variant-numeric: tabular-nums;
}

.me-hud__replay {
    flex: 0 0 auto;
    min-width: 96px;
    text-align: right;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

.me-progress {
    height: 6px;
    background: #e2e8f0;
    overflow: hidden;
}

.me-progress > span {
    display: block;
    width: 0;
    height: 100%;
    background: linear-gradient(90deg, #0d9488, #34d399);
    transition: width .25s ease;
}

/* ---------- Сцена ---------- */

.me-stage {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: clamp(18px, 4vw, 34px) clamp(14px, 3vw, 26px) clamp(16px, 3vw, 26px);
    background:
        radial-gradient(circle at 50% 0%, rgba(16, 185, 129, .22), transparent 62%),
        radial-gradient(circle at 50% 100%, rgba(13, 148, 136, .18), transparent 58%),
        #0b1220;
    color: #e2e8f0;
}

.me-wave {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    height: 62px;
    margin-bottom: 2px;
}

.me-wave span {
    display: block;
    width: 5px;
    height: 10px;
    border-radius: 999px;
    background: linear-gradient(180deg, #6ee7b7, #0d9488);
    opacity: .45;
    transition: height .12s linear, opacity .2s linear;
}

.me-wave.is-playing span {
    opacity: 1;
    animation: me-wave 900ms ease-in-out infinite;
}

.me-wave.is-playing span:nth-child(2) { animation-delay: 70ms; }
.me-wave.is-playing span:nth-child(3) { animation-delay: 140ms; }
.me-wave.is-playing span:nth-child(4) { animation-delay: 210ms; }
.me-wave.is-playing span:nth-child(5) { animation-delay: 280ms; }
.me-wave.is-playing span:nth-child(6) { animation-delay: 210ms; }
.me-wave.is-playing span:nth-child(7) { animation-delay: 140ms; }
.me-wave.is-playing span:nth-child(8) { animation-delay: 70ms; }
.me-wave.is-playing span:nth-child(9) { animation-delay: 0ms; }

.me-status {
    margin: 0;
    color: #f8fafc;
    font-size: clamp(1.02rem, 2.2vw, 1.24rem);
    font-weight: 800;
    text-align: center;
}

.me-sub {
    min-height: 1.3em;
    margin: 0;
    color: #94a3b8;
    font-size: .88rem;
    font-weight: 600;
    text-align: center;
}

/* ---------- Кнопки высоты тона ---------- */

.me-pitch {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: clamp(10px, 2vw, 16px);
    width: 100%;
    max-width: 560px;
    margin-top: 8px;
}

.me-answer {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: clamp(104px, 22vw, 132px);
    padding: 14px 12px;
    border: 1px solid rgba(148, 163, 184, .28);
    border-radius: 18px;
    background: rgba(30, 41, 59, .82);
    color: #e2e8f0;
    font: inherit;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
    transition: transform .08s linear, background .14s linear, border-color .14s linear, box-shadow .14s linear;
}

.me-answer:hover {
    background: rgba(51, 65, 85, .92);
}

.me-answer:active {
    transform: scale(.97);
}

.me-answer:focus-visible {
    outline: 3px solid #6ee7b7;
    outline-offset: 3px;
}

.me-answer__arrow {
    font-size: 1.9rem;
    line-height: 1;
    color: #6ee7b7;
}

.me-answer--down .me-answer__arrow {
    color: #7dd3fc;
}

.me-answer__text {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    font-size: .88rem;
    font-weight: 600;
    color: #cbd5e1;
    text-align: center;
}

.me-answer__text strong {
    font-size: clamp(.98rem, 2vw, 1.08rem);
    font-weight: 800;
    letter-spacing: .04em;
    color: #f8fafc;
}

/* ---------- Ритм ---------- */

.me-rhythm {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
}

.me-rhythm__count {
    margin: 0;
    color: #94a3b8;
    font-size: .88rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.me-tap {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    width: clamp(148px, 42vw, 186px);
    height: clamp(148px, 42vw, 186px);
    padding: 0;
    border: 0;
    border-radius: 50%;
    background:
        radial-gradient(circle at 35% 28%, rgba(255, 255, 255, .28), transparent 55%),
        linear-gradient(160deg, #10b981, #0f766e);
    box-shadow: 0 18px 44px -18px rgba(16, 185, 129, .9), inset 0 0 0 1px rgba(255, 255, 255, .18);
    color: #ffffff;
    font: inherit;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
    transition: transform .07s linear, box-shadow .14s linear, filter .14s linear;
}

.me-tap:hover {
    filter: brightness(1.05);
}

.me-tap:active,
.me-tap.is-hit {
    transform: scale(.94);
    box-shadow: 0 10px 28px -14px rgba(16, 185, 129, .8), inset 0 0 0 1px rgba(255, 255, 255, .22);
}

.me-tap:disabled {
    cursor: default;
    filter: saturate(.4) brightness(.8);
}

.me-tap:focus-visible {
    outline: 3px solid #ffffff;
    outline-offset: 4px;
}

.me-tap__label {
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: .01em;
}

.me-tap__hint {
    font-size: .72rem;
    font-weight: 700;
    opacity: .82;
}

.me-dots {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    min-height: 10px;
}

.me-dot {
    display: block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(148, 163, 184, .38);
    transition: transform .1s linear, background .1s linear;
}

.me-dot.is-on {
    background: #34d399;
    transform: scale(1.18);
}

/* ---------- Обратная связь и управление ---------- */

.me-feedback {
    min-height: 1.4em;
    margin: 6px 0 0;
    color: #94a3b8;
    font-size: .9rem;
    font-weight: 700;
    text-align: center;
}

.me-feedback.is-good {
    color: #6ee7b7;
}

.me-feedback.is-bad {
    color: #fca5a5;
}

.me-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 10px 16px;
    padding: 12px clamp(14px, 3vw, 24px) 14px;
    border-top: 1px solid var(--line);
    background: var(--surface-soft);
}

.me-replay-note {
    color: var(--muted);
    font-size: .82rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.me-foot {
    display: flex;
    justify-content: center;
    padding: 0 16px 14px;
    background: var(--surface-soft);
}

.me-error {
    margin: 0;
    padding: 0 20px 18px;
    background: var(--surface-soft);
    color: #b91c1c;
    font-size: .9rem;
    font-weight: 700;
    text-align: center;
}

/* ---------- Анимации ---------- */

@keyframes me-wave {
    0%, 100% { height: 10px; }
    50%      { height: 42px; }
}

/* ---------- Адаптив ---------- */

@media (max-width: 620px) {
    .me-hud {
        gap: 6px;
        padding: 12px 12px;
        font-size: .78rem;
    }

    .me-hud__replay {
        min-width: 76px;
    }

    .me-stage {
        padding: 16px 12px 18px;
    }

    .me-wave {
        height: 48px;
    }

    .me-wave.is-playing span {
        animation-duration: 800ms;
    }

    .me-pitch {
        gap: 9px;
    }

    .me-answer {
        min-height: 96px;
        padding: 10px 8px;
        border-radius: 14px;
    }

    .me-answer__arrow {
        font-size: 1.5rem;
    }

    .me-answer__text {
        font-size: .8rem;
    }

    .me-controls {
        padding: 10px 12px 12px;
    }
}

@media (max-width: 400px) {
    .me-hud__stage {
        font-size: .74rem;
    }

    .me-hud__replay {
        display: none;
    }

    .me-answer {
        min-height: 88px;
    }

    .me-answer__text {
        font-size: .74rem;
    }

    .me-answer__text strong {
        font-size: .92rem;
    }

    .me-tap {
        width: 136px;
        height: 136px;
    }

    .me-tap__label {
        font-size: .9rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .me-wave.is-playing span {
        animation: none;
        height: 26px;
    }

    .me-progress > span,
    .me-answer,
    .me-tap,
    .me-dot {
        transition: none;
    }
}
