/* TestHub — тест на цветовосприятие. Квадратное поле CSS Grid, тёмная сцена. */
.cv-app {
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: #fff;
    box-shadow: var(--shadow);
    overflow: hidden;
}

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

.cv-start__icon {
    display: inline-grid;
    place-items: center;
    width: 64px;
    height: 64px;
    margin-bottom: 16px;
    border-radius: 20px;
    background: #ccfbf1;
    color: #0f766e;
    font-size: 1.1rem;
    font-weight: 800;
}

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

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

.cv-start .btn {
    margin-top: 10px;
}

.cv-shell[hidden],
.cv-foot [hidden] {
    display: none;
}

.cv-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;
}

.cv-hud__level {
    min-width: 118px;
}

.cv-hud__time {
    min-width: 58px;
    text-align: right;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

.cv-lives {
    color: #e11d48;
    font-size: 1.08rem;
    letter-spacing: .12em;
    line-height: 1;
}

.cv-lives.is-low {
    animation: cv-heart 1s ease-in-out infinite;
}

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

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

.cv-stage {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(12px, 3vw, 26px);
    background:
        radial-gradient(circle at 50% 0%, rgba(13, 148, 136, .22), transparent 62%),
        #0b1220;
}

.cv-grid {
    --cv-cols: 2;
    display: grid;
    grid-template-columns: repeat(var(--cv-cols), minmax(0, 1fr));
    grid-auto-rows: 1fr;
    gap: clamp(4px, 1vw, 10px);
    width: 100%;
    max-width: 520px;
    aspect-ratio: 1 / 1;
    touch-action: manipulation;
}

.cv-grid[data-size="6"],
.cv-grid[data-size="7"] {
    gap: clamp(3px, .7vw, 7px);
}

.cv-grid[data-size="8"] {
    gap: clamp(3px, .55vw, 6px);
}

.cv-tile {
    display: block;
    width: 100%;
    height: 100%;
    min-width: 0;
    padding: 0;
    border: 0;
    border-radius: clamp(3px, .8vw, 8px);
    background: #64748b;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .05);
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
    transition: transform .08s linear, box-shadow .12s linear, filter .12s linear;
}

.cv-tile:hover {
    filter: brightness(1.04);
}

.cv-tile:active {
    transform: scale(.97);
}

.cv-tile:focus-visible {
    outline: 3px solid #ffffff;
    outline-offset: 2px;
    z-index: 4;
}

.cv-tile.is-correct {
    box-shadow: 0 0 0 3px #ffffff, 0 0 0 6px #22c55e;
    z-index: 2;
}

.cv-tile.is-wrong {
    box-shadow: inset 0 0 0 4px #ef4444;
    filter: brightness(.72);
    z-index: 2;
}

.cv-tile.is-target {
    box-shadow: 0 0 0 3px #ffffff, 0 0 0 6px #22c55e;
    z-index: 3;
    animation: cv-pulse .5s ease;
}

.cv-grid.is-finished {
    pointer-events: none;
}

.cv-grid.is-finished .cv-tile {
    opacity: .92;
}

.cv-feedback {
    min-height: 1.4em;
    margin: 0;
    padding: 12px clamp(16px, 3vw, 24px) 0;
    color: var(--muted);
    font-size: .9rem;
    font-weight: 800;
    text-align: center;
}

.cv-feedback.is-good {
    color: #047857;
}

.cv-feedback.is-bad {
    color: #b91c1c;
}

.cv-hint {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: .78rem;
    font-weight: 600;
    text-align: center;
}

.cv-foot {
    display: flex;
    justify-content: center;
    padding: 12px clamp(16px, 3vw, 26px) 16px;
}

.cv-error {
    margin: 0;
    padding: 0 20px 18px;
    color: #b91c1c;
    font-size: .9rem;
    font-weight: 700;
    text-align: center;
}

@keyframes cv-pulse {
    0%   { box-shadow: 0 0 0 0 rgba(34, 197, 94, .9); }
    70%  { box-shadow: 0 0 0 12px rgba(34, 197, 94, 0); }
    100% { box-shadow: 0 0 0 3px #ffffff, 0 0 0 6px #22c55e; }
}

@keyframes cv-heart {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(1.12); }
}

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

    .cv-hud__level {
        min-width: 96px;
    }

    .cv-hud__time {
        min-width: 48px;
    }

    .cv-lives {
        font-size: .98rem;
        letter-spacing: .08em;
    }

    .cv-stage {
        padding: 10px;
    }

    .cv-grid {
        gap: 4px;
    }

    .cv-grid[data-size="6"],
    .cv-grid[data-size="7"],
    .cv-grid[data-size="8"] {
        gap: 3px;
    }

    .cv-tile {
        border-radius: 4px;
    }
}

@media (max-width: 380px) {
    .cv-hud__time {
        display: none;
    }

    .cv-hud__level {
        min-width: 84px;
        font-size: .76rem;
    }

    .cv-grid {
        gap: 3px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .cv-tile,
    .cv-progress > span {
        transition: none;
    }

    .cv-lives.is-low,
    .cv-tile.is-target {
        animation: none;
    }
}
