/* Клавиатурный тренажёр */
.trainer-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    padding: 1rem;
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
}

/* Выбор текста */
.select-label {
    color: #691c3a;
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.dark-theme .select-label {
    color: #e0c9ff;
}

.select-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    justify-content: center;
}

.select-btn {
    padding: 0.6rem 1.2rem;
    border-radius: 30px;
    border: 2px solid #ffb7c5;
    background: rgba(255, 255, 255, 0.7);
    color: #691c3a;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.9rem;
    backdrop-filter: blur(5px);
}

.dark-theme .select-btn {
    border-color: #6b4f9c;
    background: rgba(30, 20, 50, 0.7);
    color: #e0c9ff;
}

.select-btn:hover {
    background: #ffd0d9;
    transform: translateY(-2px);
}

.dark-theme .select-btn:hover {
    background: #5a3f8a;
}

.select-btn.active {
    background: #ffb7c5;
    color: #fff;
    box-shadow: 0 0 10px #ffb7c5;
}

.dark-theme .select-btn.active {
    background: #6b4f9c;
    border-color: #9d7ad9;
    box-shadow: 0 0 10px #9d7ad9;
}

/* Текст для набора */
.target-text {
    width: 100%;
    max-width: 800px;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 1.5rem;
    font-size: 1.3rem;
    line-height: 1.8;
    letter-spacing: 1px;
    color: #333;
    border: 1px solid #ffd9e2;
    min-height: 120px;
    font-family: 'Courier New', monospace;
    white-space: pre-wrap;
    word-break: break-word;
}

.dark-theme .target-text {
    background: rgba(20, 15, 35, 0.7);
    border-color: #5a4a8a;
    color: #e0d9f0;
}

.target-text .char {
    color: #999;
    transition: color 0.1s;
}

.dark-theme .target-text .char {
    color: #6a6a8a;
}

.target-text .char.correct-char {
    color: #4caf50;
    font-weight: bold;
}

.target-text .char.error-char {
    background: #ffcdd2;
    color: #c62828;
    font-weight: bold;
    border-radius: 2px;
}

.dark-theme .target-text .char.error-char {
    background: rgba(244, 67, 54, 0.3);
    color: #ff5252;
}

.target-text .char.current-char {
    background: #ffb7c5;
    color: #fff;
    border-radius: 3px;
    animation: pulse 0.8s infinite;
}

.dark-theme .target-text .char.current-char {
    background: #9d7ad9;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* Скрытое поле ввода */
.hidden-input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

/* Клавиатура */
.keyboard {
    width: 100%;
    max-width: 800px;
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 1rem;
    border: 1px solid #ffd9e2;
    display: flex;
    flex-direction: column;
    gap: 6px;
    user-select: none;
}

.dark-theme .keyboard {
    background: rgba(20, 15, 35, 0.5);
    border-color: #5a4a8a;
}

.keyboard-row {
    display: flex;
    justify-content: center;
    gap: 4px;
}

.key {
    min-width: 36px;
    height: 40px;
    background: rgba(255, 255, 255, 0.8);
    border: 2px solid #ffd9e2;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #691c3a;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.1s;
    padding: 0 4px;
}

.dark-theme .key {
    background: rgba(30, 20, 50, 0.8);
    border-color: #5a4a8a;
    color: #e0c9ff;
}

.key.wide {
    min-width: 60px;
}

.key.xwide {
    min-width: 80px;
}

.key.xxwide {
    min-width: 120px;
}

.key.space-key {
    min-width: 300px;
}

.key.highlight {
    background: #ffb7c5;
    color: #fff;
    border-color: #ff7a9e;
    transform: translateY(2px);
    box-shadow: 0 0 10px rgba(255, 183, 197, 0.5);
}

.dark-theme .key.highlight {
    background: #9d7ad9;
    border-color: #c49bff;
    box-shadow: 0 0 10px rgba(157, 122, 217, 0.5);
}

.key.next-highlight {
    background: #ffe0e9;
    border-color: #ffb7c5;
    box-shadow: 0 0 8px rgba(255, 183, 197, 0.3);
}

.dark-theme .key.next-highlight {
    background: rgba(157, 122, 217, 0.25);
    border-color: #9d7ad9;
    box-shadow: 0 0 8px rgba(157, 122, 217, 0.2);
}

/* Результат */
.result-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 3000;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(3px);
}

.result-overlay.visible {
    display: flex;
}

.result-card {
    background: rgba(255, 250, 250, 0.95);
    backdrop-filter: blur(15px);
    border-radius: 40px;
    padding: 3rem;
    border: 2px solid #ffb7c5;
    text-align: center;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 20px 40px rgba(140, 70, 90, 0.3);
    animation: fadeIn 0.4s;
}

.dark-theme .result-card {
    background: rgba(20, 15, 35, 0.95);
    border-color: #6b4f9c;
    box-shadow: 0 20px 40px rgba(0,0,0,0.7);
}

.result-emoji {
    font-size: 5rem;
    margin-bottom: 1rem;
}

.result-title {
    font-size: 2rem;
    color: #691c3a;
    margin-bottom: 1rem;
}

.dark-theme .result-title {
    color: #e0c9ff;
}

.result-details {
    font-size: 1.1rem;
    color: #a13d5f;
    margin-bottom: 1rem;
}

.dark-theme .result-details {
    color: #b79ad9;
}

.result-stats {
    font-size: 0.9rem;
    color: #888;
    margin-bottom: 2rem;
}

.result-btn {
    padding: 0.8rem 2.5rem;
    border-radius: 40px;
    border: none;
    background: #ffb7c5;
    color: #fff;
    font-weight: 600;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.2s;
}

.dark-theme .result-btn {
    background: #6b4f9c;
}

.result-btn:hover {
    background: #ff9aae;
    transform: translateY(-2px);
}

.dark-theme .result-btn:hover {
    background: #9d7ad9;
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}
