:root {
    --primary-color: #5c6bc0;
    --secondary-color: #7986cb;
    --background-color: #f5f7fa;
    --white-key-color: #ffffff;
    --black-key-color: #333333;
    --active-color: #3f51b5;
    --control-bg: rgba(255, 255, 255, 0.9);
    --shadow-color: rgba(0, 0, 0, 0.2);
    --panel-bg: rgba(255, 255, 255, 0.85);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    transition: background 0.5s ease;
    overflow-x: hidden;
}

#background-effect {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    z-index: -1;
    transition: background 0.8s ease;
}

#container {
    background-color: var(--panel-bg);
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 8px 30px var(--shadow-color);
    width: 95%;
    max-width: 1000px;
    margin: 20px 0;
}

.header {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 20px;
}

h1 {
    color: var(--primary-color);
    margin-bottom: 20px;
    text-align: center;
}

.controls {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
    margin-bottom: 15px;
}

.control-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.toggle-btn {
    background-color: var(--control-bg);
    border: 2px solid var(--primary-color);
    border-radius: 50px;
    padding: 8px 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
}

.toggle-btn:hover {
    background-color: #e8eaf6;
}

.toggle-btn.active {
    background-color: var(--primary-color);
    color: white;
}

.content {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.instruction {
    margin-bottom: 20px;
    text-align: center;
    color: #555;
}

#keyboard {
    display: flex;
    justify-content: center;
    position: relative;
    height: 200px;
    margin: 20px 0;
    user-select: none;
}

.key {
    border: 1px solid #ccc;
    border-radius: 0 0 5px 5px;
    text-align: center;
    box-sizing: border-box;
    cursor: pointer;
    position: relative;
    transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.key span {
    position: absolute;
    bottom: 10px;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 12px;
    color: #888;
}

.white {
    background-color: var(--white-key-color);
    width: 40px;
    height: 200px;
    z-index: 1;
}

.black {
    background-color: var(--black-key-color);
    width: 30px;
    height: 120px;
    margin-left: -15px;
    margin-right: -15px;
    z-index: 2;
}

.black span {
    color: #ccc;
}

.key.active {
    transform: translateY(3px);
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.3);
}

#keyboard-map {
    margin: 15px 0;
    text-align: center;
    font-size: 14px;
    background-color: rgba(255, 255, 255, 0.7);
    padding: 10px;
    border-radius: 8px;
}

#keyboard-map h3 {
    margin-bottom: 5px;
    color: var(--primary-color);
}

#info-panel {
    margin-top: 20px;
    padding: 20px;
    background-color: rgba(255, 255, 255, 0.7);
    border-radius: 10px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

#active-notes {
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 15px;
    min-height: 30px;
    text-align: center;
    color: var(--primary-color);
}

#therapy-info {
    padding: 15px;
    background-color: rgba(255, 255, 255, 0.6);
    border-radius: 8px;
}

#therapy-info h3 {
    color: var(--primary-color);
    margin-bottom: 10px;
}

/* Language specific rules */
.lang-uk, .lang-en {
    display: none;
}

body.lang-uk .lang-uk {
    display: block;
}

body.lang-uk .lang-en {
    display: none;
}

body.lang-en .lang-en {
    display: block;
}

body.lang-en .lang-uk {
    display: none;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .controls {
        flex-direction: row;
        justify-content: center;
    }
    
    #keyboard {
        transform: scale(0.8);
        margin: 0 -40px;
    }
    
    #info-panel {
        padding: 15px 10px;
    }
}

@media (max-width: 480px) {
    #container {
        padding: 15px 10px;
    }
    
    h1 {
        font-size: 24px;
    }
    
    #keyboard {
        transform: scale(0.6);
        margin: 0 -80px;
    }
    
    .controls {
        gap: 8px;
    }
    
    .toggle-btn {
        padding: 6px 10px;
    }
}

/* For extra small screens */
@media (max-width: 360px) {
    #keyboard {
        transform: scale(0.45);
        margin: 0 -110px;
    }
    
    h1 {
        font-size: 20px;
    }
}