body {
    background-color: #1a1a1a;
    background-image: radial-gradient(circle at center, #2d1e1b 0%, #000000 100%);
    height: 100vh;
    overflow: hidden;
    color: #e0e0e0;
    user-select: none;
    -webkit-user-select: none;
    font-family: 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    margin: 0;
}

#rotate-prompt {
    display: none;
    position: fixed;
    top: 15%; 
    left: 50%;
    transform: translateX(-50%);
    width: auto;
    max-width: 90%;
    background: rgba(20, 20, 20, 0.9);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 50px;
    padding: 10px 20px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    pointer-events: none; 
    z-index: 9999;
    align-items: center;
    justify-content: center;
    flex-direction: row;
    gap: 15px;
}

#rotate-prompt .rotate-content {
    display: flex;
    align-items: center;
}

.bi-phone-landscape {
    animation: rotate-icon 2s infinite ease-in-out;
    font-size: 1.5rem;
    color: #ffc107;
    margin-right: 10px;
}

#rotate-prompt h4 {
    font-size: 0.9rem;
    margin: 0;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
}

#rotate-prompt p, #rotate-prompt .d-inline-block {
    display: none;
}

@keyframes rotate-icon {
    0% { transform: rotate(-90deg); opacity: 0.5; }
    50% { transform: rotate(0deg); opacity: 1; }
    100% { transform: rotate(-90deg); opacity: 0.5; }
}

.loader-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: #111;
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    color: #ffc107;
}

.spacing-2 { letter-spacing: 2px; }

#main-container {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100vh;
    box-sizing: border-box;
    padding-bottom: 100px; 
    padding-top: 20px;
    padding-left: 20px;
    padding-right: 20px;
    transition: all 0.3s ease;
}

.kalimba-body {
    position: relative;
    width: 100%;
    max-width: 900px;
    height: calc(100vh - 140px);
    max-height: 800px; 
    min-height: 300px;
    background: linear-gradient(180deg, #8d6e63 0%, #5d4037 35%, #3e2723 100%);
    border-radius: 40px 40px 60px 60px;
    box-shadow: 
        0 30px 60px rgba(0,0,0,0.8), 
        inset 0 0 0 2px rgba(255,255,255,0.05),
        inset 0 0 100px rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    overflow: hidden;
    transition: height 0.3s ease;
}

.sound-hole {
    position: absolute;
    top: 55%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 180px;
    height: 180px;
    background: #0f0806;
    border-radius: 50%;
    box-shadow: 
        inset 4px 4px 25px rgba(0,0,0,0.9),
        0 1px 2px rgba(255,255,255,0.05);
    z-index: 1;
    display: flex;
    justify-content: center;
    align-items: center;
}
.sound-hole::after {
    content: "PlayKalimba.com";
    color: rgba(255,255,255,0.08);
    font-weight: 700;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.bridge {
    position: absolute;
    top: 60px;
    width: 100%;
    height: 25px;
    background: linear-gradient(90deg, #2c3e50 0%, #95a5a6 20%, #ecf0f1 50%, #95a5a6 80%, #2c3e50 100%);
    z-index: 5;
    box-shadow: 0 5px 15px rgba(0,0,0,0.7);
    border-top: 1px solid rgba(255,255,255,0.2);
    border-bottom: 1px solid rgba(0,0,0,0.5);
}

.kalimba-container {
    position: relative;
    z-index: 10;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: 70px;
    gap: 3px;
    width: 100%;
    height: 100%;
    padding-left: 50px;
    padding-right: 50px;
    padding-bottom: 20px;
    box-sizing: border-box;
}

.key-zone {
    display: flex;
    justify-content: center;
    cursor: pointer;
    touch-action: none;
    flex: 1 1 0; 
    max-width: 50px;
    transition: transform 0.05s ease-out; 
}

.key {
    width: 100%;
    height: 100%;
    background: linear-gradient(to right, #cfd8dc 0%, #eceff1 35%, #ffffff 50%, #eceff1 65%, #b0bec5 100%);
    border-radius: 0 0 8px 8px;
    box-shadow: 
        3px 8px 10px rgba(0,0,0,0.5),
        inset 0 -15px 20px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    padding-bottom: 12px;
    color: #263238;
    position: relative;
    border-bottom: 3px solid #78909c;
}

.key-click .key {
    background: linear-gradient(to right, #b0bec5 0%, #cfd8dc 100%);
    transform: translateY(4px) scale(0.98);
    box-shadow: 1px 2px 4px rgba(0,0,0,0.4);
    border-bottom: 1px solid #546e7a;
}

.note-number {
    font-size: 1.1rem;
    font-weight: 900;
    line-height: 1;
    text-align: center;
    white-space: pre-wrap;
    color: #37474f;
}

.note-letter {
    font-size: 0.75rem;
    opacity: 0.8;
    font-weight: 700;
    margin-top: 2px;
}

.note-keyboard-key {
    position: absolute;
    top: 55%;
    font-size: 0.65rem;
    color: #fff;
    background: #d84315;
    padding: 1px 5px;
    border-radius: 4px;
    opacity: 0.7;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    pointer-events: none;
}

.floating-nav {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(20, 20, 20, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 12px 25px;
    border-radius: 50px;
    z-index: 100;
    display: flex;
    gap: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    border: 1px solid rgba(255,255,255,0.1);
    transition: all 0.3s ease;
}

.floating-nav button {
    color: #ccc;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(255,255,255,0.05);
    transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
    font-size: 1.2rem;
    cursor: pointer;
}

.floating-nav button:hover {
    background: rgba(255,255,255,0.2);
    transform: translateY(-3px);
    color: white;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

.floating-nav button:active { transform: translateY(0); }
.floating-nav button:disabled { opacity: 0.3; pointer-events: none; }

.glass-modal {
    background: rgba(30, 30, 30, 0.95);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 20px;
    color: #eee;
    box-shadow: 0 20px 50px rgba(0,0,0,0.8);
}
.modal-header { border-bottom: 1px solid rgba(255,255,255,0.1); }
.form-label { color: #aaa; font-weight: 600; font-size: 0.9rem; text-transform: uppercase; letter-spacing: 1px; }
.custom-range::-webkit-slider-thumb { background: #ffc107; cursor: pointer; }

.vertical-range {
    writing-mode: vertical-lr; 
    direction: rtl; 
    appearance: none;
    width: 20px;
    height: 80px;
    background: rgba(255,255,255,0.1);
    border-radius: 10px;
    cursor: pointer;
}
.vertical-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #ffc107;
    margin-right: 2px; 
}

@media (max-width: 768px) and (orientation: portrait) {
    #rotate-prompt { display: flex; }
    
    #main-container {
        padding-left: 5px;
        padding-right: 5px;
    }
    
    .kalimba-body {
        width: 98%;
    }

    .kalimba-container {
        padding-left: 10px;
        padding-right: 10px;
        padding-bottom: 40px; 
    }

    .note-keyboard-key { display: none !important; }
}

@media (max-height: 500px) and (orientation: landscape) {
    #main-container {
        padding-bottom: 20px; 
        padding-right: 100px; 
    }
    .kalimba-body {
        height: 90vh; 
        max-height: none;
    }
    .floating-nav {
        bottom: auto; 
        left: auto;   
        right: 20px;  
        top: 50%;     
        transform: translateY(-50%); 
        flex-direction: column; 
        padding: 15px 10px;
        border-radius: 30px;
        gap: 15px;
    }
    .kalimba-container {
        padding-top: 40px; 
        padding-bottom: 30px;
    }
    .bridge { top: 35px; } 
    .sound-hole { 
        width: 140px; height: 140px;
    }

    .note-keyboard-key { display: none !important; }
}

@media (max-width: 600px) and (orientation: portrait) {
    .note-keyboard-key { display: none !important; }
    #main-container { padding-bottom: 90px; } 
    .kalimba-body { height: calc(100vh - 130px); }
}