/* ===== Buttons ===== */
.btn {
    border: none;
    border-radius: var(--radius-round);
    padding: 0.8rem 1.8rem;
    font-size: 1.1rem;
    font-family: var(--font-family);
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.1s, background 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}
.btn:active { transform: scale(0.95); }
.btn-primary { background: var(--color-accent); color: white; }
.btn-primary:hover { box-shadow: 0 4px 15px rgba(233,69,96,0.4); }
.btn-secondary { background: var(--color-bg-surface); color: var(--color-text); }
.btn-ghost { background: transparent; color: var(--color-text-dim); text-decoration: underline; }
.btn-icon {
    width: 44px; height: 44px;
    border-radius: 50%;
    padding: 0;
    justify-content: center;
    background: var(--color-bg-surface);
    color: var(--color-text);
    font-size: 1.2rem;
}
.btn-toggle-hands {
    position: relative;
}
.btn-toggle-hands.active {
    background: var(--color-accent);
}

/* ===== Game Header ===== */
.game-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.6rem 1.5rem;
    background: var(--color-bg-card);
    border-bottom: 1px solid rgba(0,0,0,0.08);
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.lesson-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--color-text);
    flex-shrink: 0;
}
.stats-bar {
    flex: 1;
    display: flex;
    justify-content: flex-end;
    gap: 1.5rem;
}
.stat {
    font-size: 0.95rem;
    color: var(--color-text-dim);
    font-weight: 600;
}

/* ===== Typing Area ===== */
#game-view {
    overflow-y: auto;
    overflow-x: hidden;
}
#game-view .game-header, #game-view .finger-guide, #game-view .keyboard-wrapper {
    flex-shrink: 0;
}
#game-view .typing-area {
    flex: 0 0 clamp(200px, 22vh, 230px);
}
#game-view .keyboard-wrapper {
    margin-bottom: 280px;
}
.typing-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 1rem 2rem;
    min-height: 0;
}
.typing-prompt {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 2px;
    max-width: 900px;
    min-height: 80px;
}
.typing-char {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 42px;
    height: 56px;
    font-size: 2rem;
    font-weight: 600;
    font-family: var(--font-mono);
    border-radius: 6px;
    background: var(--color-bg-card);
    color: var(--color-text-dim);
    transition: all 0.15s;
    text-transform: none;
}
.typing-char.current {
    color: var(--color-accent);
    background: var(--color-accent-soft);
    border: 2px solid var(--color-accent);
    animation: cursorBlink 1s infinite;
    transform: scale(1.15);
    z-index: 2;
}
.typing-char.correct {
    color: var(--color-success);
    background: rgba(74,222,128,0.1);
}
.typing-char.wrong {
    color: var(--color-error);
    background: rgba(249,115,22,0.15);
    animation: shakeChar 0.3s;
}
.typing-char.space-char {
    width: 30px;
    background: transparent;
    color: transparent;
}
.typing-char.space-char.current {
    background: rgba(233,69,96,0.15);
    border: 2px solid var(--color-accent);
    color: transparent;
}
.typing-char.space-char.correct {
    background: rgba(74,222,128,0.05);
}

.typing-progress-bar {
    width: 100%;
    max-width: 900px;
    height: 6px;
    background: rgba(0,0,0,0.06);
    border-radius: 3px;
    margin-top: 1rem;
    overflow: hidden;
}
.typing-progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--color-accent), #f472b6);
    transition: width 0.2s;
    border-radius: 3px;
}

/* Keyboard wrapper: keyboard + remaining side by side */
.keyboard-wrapper {
    display: flex;
    align-items: center;
}
.keyboard-wrapper .keyboard-container {
    flex: 1;
}

/* Remaining characters counter — right of keyboard */
.typing-remaining {
    width: 120px;
    text-align: center;
    font-size: 0.9rem;
    color: var(--color-text-dim);
    font-weight: 600;
    line-height: 1.4;
    padding: 0.5rem;
    flex-shrink: 0;
}
.typing-progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--color-accent), #f472b6);
    transition: width 0.2s;
    border-radius: 3px;
}

/* ===== Modals ===== */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(0,0,0,0.6);
    z-index: 99;
    backdrop-filter: blur(4px);
}
.modal-overlay.hidden { display: none; }
.modal {
    position: fixed;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%) scale(1);
    background: var(--color-bg-card);
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
    z-index: 100;
    text-align: center;
    transition: transform 0.3s cubic-bezier(0.175,0.885,0.32,1.275), opacity 0.3s;
}
.modal.hidden {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.85);
    pointer-events: none;
}
.modal h2 {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: var(--color-text);
}
.modal-actions {
    display: flex;
    justify-content: center;
    gap: 0.8rem;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}
.result-stats {
    font-size: 1.1rem;
    color: var(--color-text);
    margin-bottom: 1rem;
    line-height: 2;
}
.next-lesson-hint {
    margin-top: 1rem;
    font-size: 0.85rem;
    color: var(--color-text-dim);
}
.next-lesson-hint kbd {
    display: inline-block;
    padding: 0.15rem 0.4rem;
    margin-inline: 0.15rem;
    border: 1px solid rgba(0,0,0,0.15);
    border-bottom-width: 2px;
    border-radius: 5px;
    background: var(--color-bg-surface);
    font-family: inherit;
}
.stars-rating {
    font-size: 2.5rem;
    margin: 0.5rem 0;
}
.break-character {
    font-size: 4rem;
    margin: 1rem 0;
}
