/* ===== Страница тренажёра ===== */
.trainer-page {
    max-width: 1200px;
}

.trainer-title {
    font-size: 1.5em;
    margin: 0 0 4px;
    color: #2e7d32;
    text-align: center;
}

.trainer-subtitle {
    color: var(--muted, #888);
    font-size: 0.9em;
    margin: 0 0 8px;
    text-align: center;
}

.audio-status {
    text-align: center;
    font-size: 12px;
    color: #4caf50;
    padding: 4px;
    margin-bottom: 16px;
}
.audio-status.loading { color: #ff9800; }
.audio-status.error { color: #ef5350; }

/* ===== Режимы ===== */
.trainer-controls {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
    margin-bottom: 18px;
}

.mode-btn {
    padding: 10px 18px;
    border: 2px solid #d0d5dd;
    background: #fff;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: 600;
    color: #555;
    transition: all .15s;
    font-family: inherit;
}

.mode-btn:hover {
    border-color: var(--accent, #4a6cf7);
    color: var(--accent, #4a6cf7);
}

.mode-btn.active {
    background: var(--accent, #4a6cf7);
    border-color: var(--accent, #4a6cf7);
    color: #fff;
    box-shadow: 0 4px 12px rgba(74, 108, 247, .3);
}

.mode-btn.sound-toggle {
    border-color: #4caf50;
    color: #2e7d32;
}
.mode-btn.sound-toggle.active {
    background: #4caf50;
    border-color: #4caf50;
    color: #fff;
}

/* ===== Статус викторины ===== */
.quiz-status {
    background: #fff;
    border-radius: 14px;
    padding: 16px 22px;
    box-shadow: var(--shadow, 0 4px 16px rgba(0,0,0,.06));
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 18px;
    border: 2px solid transparent;
    transition: background .2s;
}

.quiz-status.correct {
    background: #e8f5e9;
    border-color: #a5d6a7;
}

.quiz-status.wrong {
    background: #ffebee;
    border-color: #ef9a9a;
}

.quiz-task {
    font-size: 1.05em;
    flex: 1;
}

.quiz-task strong {
    color: var(--accent, #4a6cf7);
    font-size: 1.2em;
    margin-left: 6px;
}

.quiz-status.correct .quiz-task strong { color: #2e7d32; }
.quiz-status.wrong .quiz-task strong { color: #c62828; }

.quiz-score {
    display: flex;
    gap: 16px;
    font-weight: 700;
}

.score-correct { color: #2e7d32; }
.score-wrong { color: #c62828; }

.quiz-message {
    font-weight: 700;
    min-width: 160px;
    text-align: right;
}

.quiz-status.correct .quiz-message { color: #2e7d32; }
.quiz-status.wrong .quiz-message { color: #ef5350; }

/* ===== Основная зона ===== */
.trainer-main {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    margin-bottom: 18px;
}

/* ===== Клавиатура ===== */
.keyboard-wrap {
    background: #fff;
    border-radius: 14px;
    padding: 18px 22px 24px;
    box-shadow: var(--shadow, 0 4px 16px rgba(0,0,0,.06));
}

.direction {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: #aaa;
    margin-bottom: 12px;
    width: 240px;
    font-weight: 600;
}

.rows {
    display: flex;
    gap: 24px;
    align-items: flex-start;
}

.row {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.row-shift-2 { margin-top: -28px; }
.row-shift-1 { margin-top: -56px; }

.row-label {
    font-size: 12px;
    font-weight: 700;
    color: #888;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: .5px;
}

.key {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 2px solid #c0c4cc;
    background: radial-gradient(circle at 30% 30%, #ffffff, #ececf2);
    color: #333;
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    user-select: none;
    transition: all .15s;
    padding: 0;
    font-family: inherit;
    box-shadow: inset 0 2px 4px rgba(0,0,0,.05),
                0 2px 4px rgba(0,0,0,.08);
}

.key:hover {
    background: radial-gradient(circle at 30% 30%, #eef2ff, #dde4ff);
    border-color: var(--accent, #4a6cf7);
    transform: scale(1.08);
}

.key.black {
    background: radial-gradient(circle at 30% 30%, #4a4a4a, #111111);
    color: #fff;
    border-color: #000;
    box-shadow: inset 0 2px 4px rgba(255,255,255,.15),
                0 2px 6px rgba(0,0,0,.35);
}

.key.black:hover {
    background: radial-gradient(circle at 30% 30%, #5a5a5a, #222222);
}

.key.active {
    background: var(--accent, #4a6cf7) !important;
    color: #fff !important;
    border-color: var(--accent, #4a6cf7) !important;
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(74, 108, 247, .4) !important;
}

.key.correct {
    background: #4caf50 !important;
    color: #fff !important;
    border-color: #2e7d32 !important;
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(76, 175, 80, .4) !important;
}

.key.wrong {
    background: #ef5350 !important;
    color: #fff !important;
    border-color: #c62828 !important;
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(239, 83, 80, .4) !important;
}

.key.highlighted {
    background: var(--accent, #4a6cf7) !important;
    color: #fff !important;
    border-color: var(--accent, #4a6cf7) !important;
    transform: scale(1.1);
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 4px 12px rgba(74, 108, 247, .4); }
    50%      { box-shadow: 0 4px 22px rgba(74, 108, 247, .9); }
}

/* ===== Нотный стан ===== */
.staff-wrap {
    background: #fff;
    border-radius: 14px;
    padding: 18px;
    box-shadow: var(--shadow, 0 4px 16px rgba(0,0,0,.06));
    flex: 1;
    min-width: 380px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.staff-title {
    font-size: 12px;
    font-weight: 700;
    color: #888;
    text-transform: uppercase;
    letter-spacing: .5px;
    margin-bottom: 12px;
}

#note-staff {
    width: 100%;
    min-height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.interactive-staff {
    width: 100%;
    min-height: 240px;
}

.staff-line {
    stroke: #999;
    stroke-width: 1;
}

.staff-clef {
    font-size: 56px;
    fill: #333;
    font-family: serif;
}

.staff-hit {
    cursor: pointer;
    transition: fill .15s;
}

.staff-hit.note-zone { fill: transparent; }
.staff-hit.note-zone:hover { fill: rgba(74, 108, 247, 0.18); }

.staff-hit.sharp-zone { fill: transparent; }
.staff-hit.sharp-zone:hover { fill: rgba(255, 152, 0, 0.25); }

.sharp-hint {
    font-size: 13px;
    fill: #ff9800;
    opacity: 0.35;
    pointer-events: none;
    text-anchor: middle;
    font-weight: 700;
}

.staff-note { fill: var(--accent, #4a6cf7); transition: fill .15s; pointer-events: none; }
.staff-note.active { fill: var(--accent, #4a6cf7); }
.staff-note.correct { fill: #4caf50; }
.staff-note.wrong { fill: #ef5350; }

.staff-stem {
    stroke: var(--accent, #4a6cf7);
    stroke-width: 1.6;
    transition: stroke .15s;
    pointer-events: none;
}
.staff-stem.active { stroke: var(--accent, #4a6cf7); }
.staff-stem.correct { stroke: #4caf50; }
.staff-stem.wrong { stroke: #ef5350; }

.staff-note-label {
    font-size: 12px;
    fill: var(--accent, #4a6cf7);
    text-anchor: middle;
    font-weight: 700;
    pointer-events: none;
}
.staff-note-label.active { fill: var(--accent, #4a6cf7); }
.staff-note-label.correct { fill: #4caf50; }
.staff-note-label.wrong { fill: #ef5350; }

.staff-sharp {
    font-size: 22px;
    fill: var(--accent, #4a6cf7);
    font-weight: 700;
    pointer-events: none;
}
.staff-sharp.correct { fill: #4caf50; }
.staff-sharp.wrong { fill: #ef5350; }

.ghost-note { opacity: 0.4; pointer-events: none; }
.ghost-note-el { fill: var(--accent, #4a6cf7); }
.ghost-stem { stroke: var(--accent, #4a6cf7); stroke-width: 1.6; }
.ghost-sharp { font-size: 22px; fill: #ff9800; font-weight: 700; }
.ghost-label {
    font-size: 11px;
    fill: var(--accent, #4a6cf7);
    text-anchor: middle;
    font-weight: 700;
}

/* ===== Подсказка ===== */
.trainer-hint {
    text-align: center;
    color: var(--muted, #888);
    font-size: 0.9em;
    padding: 14px 20px;
    background: #f8f9fc;
    border-radius: 10px;
}

.trainer-hint strong { color: var(--accent, #4a6cf7); }

/* ===== Адаптив ===== */
@media (max-width: 900px) {
    .trainer-main {
        flex-direction: column;
        align-items: center;
    }
    .keyboard-wrap {
        align-self: center;
    }
    .staff-wrap {
        min-width: auto;
        width: 100%;
    }
    .quiz-status {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    .quiz-message {
        text-align: left;
        min-width: auto;
    }
}