/* --- Basic Setup --- */
*, *::before, *::after {
    box-sizing: border-box;
}

:root {
    /* Define key widths as variables */
    --white-key-width: calc(100% / 29);
    --black-key-width: 2.5%; /* You can adjust this % */
    --black-key-offset: calc(var(--black-key-width) / 2);
}



/* --- Main Piano Container (Soft, Rounded Frame) --- */
.piano-container {
    width: 100%;
    max-width: 1000px;
    
    /* --- ADD THESE LINES TO CENTER IT --- */
    margin-left: auto;
    margin-right: auto;
    margin-top: 30px; /* This matches the spacing of your other sections */
    /* --- END OF ADDITIONS --- */

    background: #4a4a4a;
    border-radius: 18px;
    padding: 15px;
    border: none;
    /* ...rest of your styles... */
}

.controls-wrapper {
    display: flex;
    flex-direction: column;
    gap: 20px;
    background-color: #383838;
    background-image: linear-gradient(90deg, rgba(255,255,255,0.02) 0%, rgba(0,0,0,0.04) 50%, rgba(255,255,255,0.02) 100%);
    padding: 15px;
    border-radius: 10px;
    
    box-shadow: 
        inset 3px 3px 5px rgba(0, 0, 0, 0.7), 
        inset -2px -2px 4px rgba(255, 255, 255, 0.1); 
    /* Add transition for smooth theme changes */
    transition: background-color 0.5s ease;
}

/* --- Control Panels (Cleaned up) --- */
.controls-row-1,
.controls-row-2 { 
    display: grid;
    gap: 10px;
    grid-template-columns: 1fr 1fr; /* 2 equal columns */
}

/* This is the container for *all* buttons below the divider */
.controls-bottom {
    display: grid;
    gap: 10px; /* Gap between the two rows */
    grid-template-columns: 1fr; /* Stacks the rows vertically */
    position: relative;
    padding-top: 0px;  /* 15px space + 12px line */
}



/* --- Button Group Styles --- */
.button-group {
    display: grid;
    gap: 10px; 
    position: relative;
    /* Border box */
    border: 1px solid #555;
    border-radius: 6px;
    padding: 8px;
    transition: border-color 0.5s ease;
}
.playback-group,
.recording-group {
    gap: 5px; /* Tighter gap for symbol buttons */
    padding-top: 1.8em; /* Make space for the label */
}

/* Removes border/padding from lower groups */
.button-group.no-border {
    border: none;
    padding: 0;
}

/* Group Labels */
.playback-group::before,
.recording-group::before {
    content: 'Playback';
    position: absolute;
    top: 8px; /* Positioned inside the new padding */
    left: 0;
    width: 100%;
    text-align: center;
    font-size: 11px;
    font-weight: 600;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: color 0.5s ease;
}
.recording-group::before {
    content: 'Recording';
}

/* Specific grid layouts for button groups */
.playback-group { grid-template-columns: repeat(4, 1fr); }
.other-group-1 { 
    /* UPDATED: Sized for the 3-digit text box */
    grid-template-columns: 1fr auto 1fr; 
    align-items: center; /* Vertically align items in this row */
} 
/* Updated to 4 columns for the new button */
.other-group-2 { grid-template-columns: repeat(5, 1fr); } 
.recording-group { grid-template-columns: repeat(4, 1fr); }


/* --- "Floating" Text Buttons --- */
.btn, .checkbox-label {
    background: transparent;
    border: none;
    box-shadow: none;
    color: #b0b0b0;
    padding: 8px 10px;
    font-size: 14px;
    cursor: pointer;
    text-align: center;
    transition: all 0.1s ease;
    border-radius: 5px;
}

.btn:hover {
    color: #f0f0f0;
    text-shadow: 0 0 5px rgba(255, 255, 255, 0.5);
}

.btn:active {
    color: #999999;
    transform: translateY(1px);
    text-shadow: none;
}

/* --- Symbol Button Style --- */
.btn.btn-symbol {
    font-size: 24px; 
    padding-top: 6px;    
    padding-bottom: 6px;
    line-height: 1; 
}


/* Primary "Play" button (Text only) */
.btn.play-btn {
    color: #00e0e0;
    font-weight: 600;
    text-shadow: 0 0 8px rgba(0, 255, 255, 0.6);
}

.btn.play-btn:hover {
    color: #66ffff;
    text-shadow: 0 0 12px rgba(0, 255, 255, 0.8);
}

.btn.play-btn:active {
    color: #00a0a0;
    transform: translateY(1px);
    text-shadow: 0 0 5px rgba(0, 255, 255, 0.4);
}

/* --- "Sunken" Text Input --- */
.text-input {
    background: #c0c0c0;
    color: #444;
    font-weight: 500;
    border: none;
    border-radius: 5px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3), inset 0 0 1px rgba(0,0,0,0.2);
    text-align: center;
    padding: 7px 10px;
    transition: background 0.1s ease;
    width: 70px; /* UPDATED: Set fixed width */
}
.text-input:hover {
    background: #d0d0d0;
    color: #333;
}
.text-input:active {
    transform: none;
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.5);
}

/* --- Styles for the new large text box --- */
.song-textarea {
    display: block;
    width: 100%;
    min-height: 102px;
    background: #c0c0c0;
    flex-grow: 0;
    color: #444;
    font-weight: 500;
    border: none;
    border-radius: 5px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3), inset 0 0 1px rgba(0,0,0,0.2);
    padding: 10px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 14px;
    resize: vertical; 
    transition: background 0.1s ease;
}
.song-textarea:hover {
    background: #d0d0d0;
    color: #333;
}
.song-textarea:active {
    transform: none;
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.5);
}
.song-textarea::placeholder {
    color: #666;
    font-weight: 400;
}

/* --- NEW: Wrapper for textarea and song title --- */
.textarea-wrapper {
    display: flex;
    flex-direction: column;
    min-height: 0; /* Fix for flex overflow in fullscreen */
}

/* --- NEW: Style for song title div --- */
#songtitle {
    color: #ccc; 
    text-align: center; 
    font-weight: 600;
    margin-top: 8px; /* Replaces the large 20px gap + 10px margin */
    flex-shrink: 0;
}


/* --- Custom Checkboxes --- */
.checkbox-label {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    padding: 8px 0;
}
.checkbox-label:active {
    transform: none;
}

.checkbox-label input {
    display: none;
}

.checkbox-label .custom-box {
    width: 16px;
    height: 16px;
    background: #282828;
    border: none;
    border-radius: 4px;
    margin-right: 8px;
    display: inline-block;
    transition: all 0.1s ease;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.8), inset 0 0 2px rgba(0,0,0,0.3);
}

.checkbox-label input:checked + .custom-box {
    background-color: #404040;
    color: #a0a0a0;
    text-align: center;
    font-weight: bold;
    line-height: 15px;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.6), 0 0 5px rgba(0,255,255,0.3);
}
.checkbox-label input:checked + .custom-box::after {
    content: '✓';
}


.keyboard-base {
    position: relative;
    padding: 15px;
    background: linear-gradient(90deg, #7a4a3a 0%, #9b6b5a 25%, #8a5a4a 50%, #9b6b5a 75%, #7a4a3a 100%);
    box-shadow: 
        inset 3px 3px 5px rgba(0, 0, 0, 0.7),
        inset -2px -2px 4px rgba(255, 255, 255, 0.1);
    
    margin-top: 15px;
    border-radius: 10px;
    /* Add transition for smooth theme changes */
    transition: background 0.5s ease;
}

/* Shadow overlay */
.keyboard-base::before {
    content: '';
    position: absolute;
    top: 15px;
    left: 15px;
    right: 15px;
    height: 12px;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.5) 0%, transparent 100%);
    z-index: 3;
    pointer-events: none;
    border-top-left-radius: 10px;
    border-top-right-radius: 10px;
    transition: background 0.5s ease;
}

.keys {
    display: flex;
    position: relative;
    height: 200px;
    border-top-left-radius: 10px;
    border-top-right-radius: 10px;
    background-color: #333; 
    transition: background-color 0.5s ease;
}

/* --- White Keys (More Realistic) --- */
.key.white {
    height: 100%;
    width: var(--white-key-width); 
    flex-grow: 1; 
    flex-basis: 0;
    
    background: linear-gradient(to bottom, #f9f9f9 0%, #ffffff 100%);
    border: none;
    border-radius: 0 0 6px 6px; 
    
    box-shadow: 
        0 3px 5px rgba(0, 0, 0, 0.15), 
        inset 0 2px 1px #fff, 
        0 8px 6px -2px rgba(0, 0, 0, 0.3), 
        inset 1px 0 1px rgba(0,0,0,0.1),  
        inset -1px 0 1px rgba(0,0,0,0.1); 
    
    margin: 0 0.5px; 
    
    display: flex;
    justify-content: center;
    align-items: flex-end;
    padding-bottom: 12px;
    font-size: 14px;
    font-weight: 500;
    color: #444;
    transition: all 0.1s ease-out;
    z-index: 1;
}

/* --- Black Keys (More Realistic) --- */
.key.black {
    position: absolute;
    top: 0px; 
    width: var(--black-key-width); 
    height: 125px;
    box-sizing: border-box; 
    
    background: #222;
    
    border: none; 
    border-top: 1px solid #444; 
    border-bottom: 4px solid #111; 
    border-radius: 0 0 6px 6px;
    
    box-shadow: 0 4px 4px rgba(0, 0, 0, 0.3);
    z-index: 2;

    display: flex;
    justify-content: center;
    align-items: flex-end;
    padding-bottom: 10px;
    font-size: 14px;
    font-weight: 500;
    color: #f0f0f0; 
    transition: all 0.1s ease-out;
}

/* --- All Black Key Positions (Unchanged) --- */
.key.black[data-key="1"] { left: calc(var(--white-key-width) * 1 - var(--black-key-offset)); }
.key.black[data-key="2"] { left: calc(var(--white-key-width) * 2 - var(--black-key-offset)); }
.key.black[data-key="3"] { left: calc(var(--white-key-width) * 3 - var(--black-key-offset)); }
.key.black[data-key="4"] { left: calc(var(--white-key-width) * 5 - var(--black-key-offset)); }
.key.black[data-key="5"] { left: calc(var(--white-key-width) * 6 - var(--black-key-offset)); }
.key.black[data-key="6"] { left: calc(var(--white-key-width) * 8 - var(--black-key-offset)); }
.key.black[data-key="7"] { left: calc(var(--white-key-width) * 9 - var(--black-key-offset)); }
.key.black[data-key="8"] { left: calc(var(--white-key-width) * 10 - var(--black-key-offset)); }
.key.black[data-key="9"] { left: calc(var(--white-key-width) * 12 - var(--black-key-offset)); }
.key.black[data-key="0"] { left: calc(var(--white-key-width) * 13 - var(--black-key-offset)); }
.key.black[data-key="!"] { left: calc(var(--white-key-width) * 15 - var(--black-key-offset)); }
.key.black[data-key="@"] { left: calc(var(--white-key-width) * 16 - var(--black-key-offset)); }
.key.black[data-key="#"] { left: calc(var(--white-key-width) * 18 - var(--black-key-offset)); }
.key.black[data-key="$"] { left: calc(var(--white-key-width) * 19 - var(--black-key-offset)); }
.key.black[data-key="%"] { left: calc(var(--white-key-width) * 20 - var(--black-key-offset)); }
.key.black[data-key="^"] { left: calc(var(--white-key-width) * 22 - var(--black-key-offset)); }
.key.black[data-key="&"] { left: calc(var(--white-key-width) * 23 - var(--black-key-offset)); }
.key.black[data-key="*"] { left: calc(var(--white-key-width) * 25 - var(--black-key-offset)); }
.key.black[data-key="("] { left: calc(var(--white-key-width) * 26 - var(--black-key-offset)); }
.key.black[data-key=")"] { left: calc(var(--white-key-width) * 27 - var(--black-key-offset)); }


/* --- Active/Glow State --- */
/* Removed z-index: 10 to fix layering bug */
.key.active {

}

/* Replaced blue glow with a subtle "pressed" inset shadow */
.key.white.active {
    background: #f0f0f0; 
    transform: translateY(1px); 
    box-shadow: 
        inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

.key.black.active {
    background: #111; 
    transform: translateY(1px); 
    box-shadow: 
        inset 0 2px 4px rgba(0, 0, 0, 0.5);
}

/* --- Fix for keyboard edge corners --- */
.key.white[data-key="z"] {
    border-radius: 10px 0 6px 6px;
}

.key.white[data-key="p"] {
    border-radius: 0 10px 6px 6px;
}

/* --- Black Key 3D Perspective --- */
.key.black[data-key="1"] { border-right: 6px solid #3a3a3a; }
.key.black[data-key="2"] { border-right: 5px solid #3a3a3a; }
.key.black[data-key="3"] { border-right: 5px solid #3a3a3a; }
.key.black[data-key="4"] { border-right: 4px solid #3a3a3a; }
.key.black[data-key="5"] { border-right: 4px solid #3a3a3a; }
.key.black[data-key="6"] { border-right: 3px solid #3a3a3a; }
.key.black[data-key="7"] { border-right: 2px solid #3a3a3a; }
.key.black[data-key="8"] { border-right: 2px solid #3a3a3a; }
.key.black[data-key="9"] { border-right: 1px solid #3a3a3a; }
.key.black[data-key="@"] { border-left: 1px solid #3a3a3a; }
.key.black[data-key="#"] { border-left: 2px solid #3a3a3a; }
.key.black[data-key="$"] { border-left: 2px solid #3a3a3a; }
.key.black[data-key="%"] { border-left: 3px solid #3a3a3a; }
.key.black[data-key="^"] { border-left: 4px solid #3a3a3a; }
.key.black[data-key="&"] { border-left: 4px solid #3a3a3a; }
.key.black[data-key="*"] { border-left: 5px solid #3a3a3a; }
.key.black[data-key="("] { border-left: 5px solid #3a3a3a; }
.key.black[data-key=")"] { border-left: 6px solid #3a3a3a; }


/*
================================================================================
|                                                                              |
|                             PIANO THEME SKINS                                |
|                                                                              |
================================================================================
*/

/* --- THEME 1: SYNTHWAVE --- */
.theme-synthwave body {
    background: #1a0229;
    background-image: linear-gradient(to bottom, #1a0229 0%, #3a0b4a 100%);
}
.theme-synthwave .piano-container {
    background: #220531;
    box-shadow: 
        0 10px 20px rgba(0, 0, 0, 0.4),
        0 4px 8px rgba(0, 0, 0, 0.3),
        inset 0 0 15px rgba(255, 0, 150, 0.3),
        0 0 20px rgba(255, 0, 150, 0.2);
}
.theme-synthwave .controls-wrapper {
    background-color: #1a0229;
}
.theme-synthwave .controls-bottom::before {
    background: #11001a;
}
.theme-synthwave .btn, .theme-synthwave .checkbox-label { color: #ff0096; }
.theme-synthwave .btn:hover { color: #ff80d0; text-shadow: 0 0 8px #ff0096; }
.theme-synthwave .btn.play-btn { color: #00e0e0; text-shadow: 0 0 8px #00e0e0; }
.theme-synthwave .text-input, .theme-synthwave .song-textarea { background: #3a0b4a; color: #ff80d0; }
.theme-synthwave .checkbox-label input:checked + .custom-box { box-shadow: 0 0 5px #ff0096; }
.theme-synthwave .keyboard-base {
    background: linear-gradient(90deg, #11001a 0%, #220033 50%, #11001a 100%);
}
.theme-synthwave .key.white {
    background: linear-gradient(to bottom, #e0e0e0 0%, #ffffff 100%);
    color: #444;
}
.theme-synthwave .key.black {
    background: #111;
    color: #f0f0f0;
}
.theme-synthwave .key.white.active {
    box-shadow: inset 0 0 10px #ff0096, 0 0 10px #ff0096;
}
.theme-synthwave .key.black.active {
    box-shadow: inset 0 0 10px #00e0e0, 0 0 10px #00e0e0;
}

/* --- THEME 2: CLASSIC WOOD --- */
.theme-classic-wood body {
    background: #6b4a3a;
    background-image: radial-gradient(ellipse at center, #8a6a5a 0%, #5a3a2a 100%);
}
.theme-classic-wood .piano-container {
    background: #c0a080;
    box-shadow: 
        0 10px 20px rgba(0, 0, 0, 0.3),
        inset 0 8px 3px rgba(255, 255, 255, 0.3),
        inset 0 -8px 3px rgba(0, 0, 0, 0.3);
}
.theme-classic-wood .controls-wrapper {
    background-color: #5a3a2a;
}
.theme-classic-wood .controls-bottom::before {
    background: #4a2a1a;
}
.theme-classic-wood .btn, .theme-classic-wood .checkbox-label { color: #f0e0d0; }
.theme-classic-wood .btn:hover { color: #ffffff; }
.theme-classic-wood .btn.play-btn { color: #fff0a0; text-shadow: 0 0 8px #fff0a0; }
.theme-classic-wood .text-input, .theme-classic-wood .song-textarea { background: #d0b090; color: #4a2a1a; }
.theme-classic-wood .checkbox-label input:checked + .custom-box { box-shadow: 0 0 5px #fff0a0; }
.theme-classic-wood .keyboard-base {
    background: linear-gradient(90deg, #8b5a3a 0%, #a07050 50%, #8b5a3a 100%);
}
.theme-classic-wood .key.white {
    background: linear-gradient(to bottom, #f5f5f0 0%, #e0e0d5 100%);
    color: #555;
}
.theme-classic-wood .key.black {
    background: #3a2a1a;
    border-bottom: 4px solid #2a1a0a;
    color: #f0e0d0;
}
.theme-classic-wood .key.white.active {
    background: #e0e0d5;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}
.theme-classic-wood .key.black.active {
    background: #2a1a0a;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.5);
}

/* --- THEME 3: ARCTIC --- */
.theme-arctic body {
    background: #e0f0ff;
    background-image: radial-gradient(ellipse at center, #ffffff 0%, #d0e0f0 100%);
}
.theme-arctic .piano-container {
    background: #f0f8ff;
    box-shadow: 
        0 10px 20px rgba(0, 0, 0, 0.1),
        inset 0 8px 3px rgba(255, 255, 255, 0.5),
        inset 0 -8px 3px rgba(0, 0, 0, 0.1);
}
.theme-arctic .controls-wrapper {
    background-color: #d8e8f8;
}
.theme-arctic .controls-bottom::before {
    background: #b0c0d0;
}
.theme-arctic .btn, .theme-arctic .checkbox-label { color: #3a5a7a; }
.theme-arctic .btn:hover { color: #000; }
.theme-arctic .btn.play-btn { color: #0070c0; text-shadow: 0 0 8px #0070c0; }
.theme-arctic .text-input, .theme-arctic .song-textarea { background: #f0f8ff; color: #3a5a7a; }
.theme-arctic .checkbox-label input:checked + .custom-box { box-shadow: 0 0 5px #0070c0; }
.theme-arctic .keyboard-base {
    background: linear-gradient(90deg, #c0d0e0 0%, #e0f0ff 50%, #c0d0e0 100%);
}
.theme-arctic .key.white {
    background: linear-gradient(to bottom, #ffffff 0%, #f0f8ff 100%);
    color: #444;
}
.theme-arctic .key.black {
    background: #5a7a9a;
    border-bottom: 4px solid #3a5a7a;
    color: #f0f8ff;
}
.theme-arctic .key.white.active {
    background: #e0f0ff;
    box-shadow: inset 0 0 10px #00a0ff, 0 0 10px #00a0ff;
}
.theme-arctic .key.black.active {
    background: #3a5a7a;
    box-shadow: inset 0 0 10px #00a0ff, 0 0 10px #00a0ff;
}

/* --- THEME 4: ROSE GOLD --- */
.theme-rose-gold body {
    background: #fbeae5;
}
.theme-rose-gold .piano-container {
    background: #f5e0d9;
    box-shadow: 
        0 10px 20px rgba(80, 50, 50, 0.2),
        inset 0 8px 3px rgba(255, 255, 255, 0.5),
        inset 0 -8px 3px rgba(80, 50, 50, 0.2);
}
.theme-rose-gold .controls-wrapper {
    background-color: #e6cec7;
}
.theme-rose-gold .controls-bottom::before {
    background: #d1b7ae;
}
.theme-rose-gold .btn, .theme-rose-gold .checkbox-label { color: #8c5a4a; }
.theme-rose-gold .btn:hover { color: #5c3a2a; }
.theme-rose-gold .btn.play-btn { color: #c06040; text-shadow: 0 0 8px #c06040; }
.theme-rose-gold .text-input, .theme-rose-gold .song-textarea { background: #fbeae5; color: #8c5a4a; }
.theme-rose-gold .checkbox-label input:checked + .custom-box { box-shadow: 0 0 5px #c06040; }
.theme-rose-gold .keyboard-base {
    background: linear-gradient(90deg, #b76e79 0%, #e6a0aA 50%, #b76e79 100%);
}
.theme-rose-gold .key.white {
    background: linear-gradient(to bottom, #ffffff 0%, #fff8f5 100%);
    color: #8c5a4a;
}
.theme-rose-gold .key.black {
    background: #5c3a2a;
    border-bottom: 4px solid #3c1a0a;
    color: #f5e0d9;
}
.theme-rose-gold .key.white.active {
    background: #fff0e8;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}
.theme-rose-gold .key.black.active {
    background: #3c1a0a;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.4);
}

/* --- THEME 5: FOREST --- */
.theme-forest body {
    background: #2a3a2a;
    background-image: radial-gradient(ellipse at center, #4a6a4a 0%, #1a2a1a 100%);
}
.theme-forest .piano-container {
    background: #3a5a3a;
    box-shadow: 
        0 10px 20px rgba(0, 0, 0, 0.4),
        inset 0 8px 3px rgba(255, 255, 255, 0.1),
        inset 0 -8px 3px rgba(0, 0, 0, 0.4);
}
.theme-forest .controls-wrapper {
    background-color: #2a4a2a;
}
.theme-forest .controls-bottom::before {
    background: #1a3a1a;
}
.theme-forest .btn, .theme-forest .checkbox-label { color: #a0d0a0; }
.theme-forest .btn:hover { color: #f0fff0; }
.theme-forest .btn.play-btn { color: #a0ffa0; text-shadow: 0 0 8px #a0ffa0; }
.theme-forest .text-input, .theme-forest .song-textarea { background: #5a7a5a; color: #f0fff0; }
.theme-forest .checkbox-label input:checked + .custom-box { box-shadow: 0 0 5px #a0ffa0; }
.theme-forest .keyboard-base {
    background: linear-gradient(90deg, #4a3a2a 0%, #6a5a4a 50%, #4a3a2a 100%);
}
.theme-forest .key.white {
    background: linear-gradient(to bottom, #f0f5f0 0%, #d5e0d5 100%);
    color: #3a5a3a;
}
.theme-forest .key.black {
    background: #2a4a2a;
    border-bottom: 4px solid #1a3a1a;
    color: #a0d0a0;
}
.theme-forest .key.white.active {
    background: #d5e0d5;
    box-shadow: inset 0 0 10px #70c070, 0 0 10px #70c070;
}
.theme-forest .key.black.active {
    background: #1a3a1a;
    box-shadow: inset 0 0 10px #a0ffa0, 0 0 10px #a0ffa0;
}

/* --- THEME 6: VOLCANIC --- */
.theme-volcanic body {
    background: #111;
    background-image: radial-gradient(ellipse at center, #331100 0%, #110000 100%);
}
.theme-volcanic .piano-container {
    background: #222;
    box-shadow: 
        0 10px 20px rgba(0, 0, 0, 0.5),
        inset 0 0 15px rgba(255, 50, 0, 0.3),
        0 0 20px rgba(255, 50, 0, 0.2);
}
.theme-volcanic .controls-wrapper {
    background-color: #1a1a1a;
}
.theme-volcanic .controls-bottom::before {
    background: #000;
}
.theme-volcanic .btn, .theme-volcanic .checkbox-label { color: #ff4000; }
.theme-volcanic .btn:hover { color: #ff8040; text-shadow: 0 0 8px #ff4000; }
.theme-volcanic .btn.play-btn { color: #ffff00; text-shadow: 0 0 8px #ffff00; }
.theme-volcanic .text-input, .theme-volcanic .song-textarea { background: #333; color: #ff8040; }
.theme-volcanic .checkbox-label input:checked + .custom-box { box-shadow: 0 0 5px #ff4000; }
.theme-volcanic .keyboard-base {
    background: linear-gradient(90deg, #3a2a1a 0%, #5a3a2a 50%, #3a2a1a 100%);
}
.theme-volcanic .key.white {
    background: linear-gradient(to bottom, #d0d0d0 0%, #b0b0b0 100%);
    color: #222;
}
.theme-volcanic .key.black {
    background: #111;
    border-bottom: 4px solid #000;
    color: #f0f0f0;
}
.theme-volcanic .key.white.active {
    background: #f0f0f0;
    box-shadow: inset 0 0 10px #ff4000, 0 0 10px #ff4000;
}
.theme-volcanic .key.black.active {
    background: #000;
    box-shadow: inset 0 0 10px #ffff00, 0 0 10px #ffff00;
}

/* --- THEME 7: VINTAGE --- */
.theme-vintage body {
    background: #f5f0e5;
    background-image: radial-gradient(ellipse at center, #f5f0e5 0%, #e0d5c0 100%);
}
.theme-vintage .piano-container {
    background: #d4c0a1;
    box-shadow: 
        0 10px 20px rgba(50, 40, 30, 0.3),
        inset 0 8px 3px rgba(255, 255, 255, 0.3),
        inset 0 -8px 3px rgba(50, 40, 30, 0.3);
}
.theme-vintage .controls-wrapper {
    background-color: #7d6b50;
}
.theme-vintage .controls-bottom::before {
    background: #5a4b3a;
}
.theme-vintage .btn, .theme-vintage .checkbox-label { color: #f5f0e5; }
.theme-vintage .btn:hover { color: #ffffff; }
.theme-vintage .btn.play-btn { color: #f0b080; text-shadow: 0 0 8px #f0b080; }
.theme-vintage .text-input, .theme-vintage .song-textarea { background: #e0d5c0; color: #5a4b3a; }
.theme-vintage .checkbox-label input:checked + .custom-box { box-shadow: 0 0 5px #f0b080; }
.theme-vintage .keyboard-base {
    background: linear-gradient(90deg, #8b6a4a 0%, #a08060 50%, #8b6a4a 100%);
}
.theme-vintage .key.white {
    background: linear-gradient(to bottom, #f8f4e8 0%, #e8e0d0 100%);
    color: #5a4b3a;
}
.theme-vintage .key.black {
    background: #4a3b2a;
    border-bottom: 4px solid #3a2b1a;
    color: #e8e0d0;
}
.theme-vintage .key.white.active {
    background: #e8e0d0;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}
.theme-vintage .key.black.active {
    background: #3a2b1a;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.5);
}

/* --- THEME 8: OCEAN --- */
.theme-ocean body {
    background: #002040;
    background-image: radial-gradient(ellipse at center, #004060 0%, #001020 100%);
}
.theme-ocean .piano-container {
    background: #003050;
    box-shadow: 
        0 10px 20px rgba(0, 0, 0, 0.4),
        inset 0 8px 3px rgba(255, 255, 255, 0.1),
        inset 0 -8px 3px rgba(0, 0, 0, 0.4);
}
.theme-ocean .controls-wrapper {
    background-color: #002030;
}
.theme-ocean .controls-bottom::before {
    background: #001018;
}
.theme-ocean .btn, .theme-ocean .checkbox-label { color: #a0d0ff; }
.theme-ocean .btn:hover { color: #f0f8ff; }
.theme-ocean .btn.play-btn { color: #40f0d0; text-shadow: 0 0 8px #40f0d0; }
.theme-ocean .text-input, .theme-ocean .song-textarea { background: #004060; color: #f0f8ff; }
.theme-ocean .checkbox-label input:checked + .custom-box { box-shadow: 0 0 5px #40f0d0; }
.theme-ocean .keyboard-base {
    background: linear-gradient(90deg, #005070 0%, #007090 50%, #005070 100%);
}
.theme-ocean .key.white {
    background: linear-gradient(to bottom, #f0f8ff 0%, #d0e0f0 100%);
    color: #003050;
}
.theme-ocean .key.black {
    background: #002030;
    border-bottom: 4px solid #001018;
    color: #a0d0ff;
}
.theme-ocean .key.white.active {
    background: #d0e0f0;
    box-shadow: inset 0 0 10px #40f0d0, 0 0 10px #40f0d0;
}
.theme-ocean .key.black.active {
    background: #001018;
    box-shadow: inset 0 0 10px #a0d0ff, 0 0 10px #a0d0ff;
}

/* --- THEME 9: BUBBLEGUM --- */
.theme-bubblegum body {
    background: #ffd0f0;
    background-image: radial-gradient(ellipse at center, #fff0f8 0%, #ffd0f0 100%);
}
.theme-bubblegum .piano-container {
    background: #ffc0e0;
    box-shadow: 
        0 10px 20px rgba(100, 50, 80, 0.2),
        inset 0 8px 3px rgba(255, 255, 255, 0.5),
        inset 0 -8px 3px rgba(100, 50, 80, 0.2);
}
.theme-bubblegum .controls-wrapper {
    background-color: #f0a0d0;
}
.theme-bubblegum .controls-bottom::before {
    background: #e080c0;
}
.theme-bubblegum .btn, .theme-bubblegum .checkbox-label { color: #a04080; }
.theme-bubblegum .btn:hover { color: #701050; }
.theme-bubblegum .btn.play-btn { color: #80f0ff; text-shadow: 0 0 8px #80f0ff; }
.theme-bubblegum .text-input, .theme-bubblegum .song-textarea { background: #ffe0f0; color: #a04080; }
.theme-bubblegum .checkbox-label input:checked + .custom-box { box-shadow: 0 0 5px #80f0ff; }
.theme-bubblegum .keyboard-base {
    background: linear-gradient(90deg, #c0e0ff 0%, #d0f0ff 50%, #c0e0ff 100%);
}
.theme-bubblegum .key.white {
    background: linear-gradient(to bottom, #ffffff 0%, #f0f8ff 100%);
    color: #a04080;
}
.theme-bubblegum .key.black {
    background: #ff80c0;
    border-bottom: 4px solid #e060a0;
    color: #fff0f8;
}
.theme-bubblegum .key.white.active {
    background: #f0f8ff;
    box-shadow: inset 0 0 10px #ff80c0, 0 0 10px #ff80c0;
}
.theme-bubblegum .key.black.active {
    background: #e060a0;
    box-shadow: inset 0 0 10px #80f0ff, 0 0 10px #80f0ff;
}


.speed-control-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px; /* Adds a little space between the buttons and input */
}

/* Styles for the new + and - buttons */
.btn.speed-btn {
  width: 28px;   /* Make them small */
  height: 28px;
  border-radius: 50%; /* Make them round */
  padding: 0;      /* Remove default padding */
  font-weight: 600;
  font-size: 20px;
  line-height: 1;  /* Helps center the +/i text vertically */
  
  /* Adds a subtle background so they look like buttons */
  background-color: rgba(0,0,0,0.1);
  border: 1px solid rgba(255,255,255,0.05);
}

.btn.speed-btn:hover {
  background-color: rgba(0,0,0,0.2);
  text-shadow: 0 0 5px rgba(255, 255, 255, 0.5); /* Keep the glow effect */
}

.btn.speed-btn:active {
   background-color: rgba(0,0,0,0.3);
   transform: translateY(1px);
}

/* We need to make the text input a bit smaller to fit */
.speed-control-wrapper .text-input {
  width: 55px; /* Original was 70px */
}


/* --- Fullscreen Button Icon Toggle --- */

/* Show the 'expand' icon by default and hide 'compress' */
#fullscreen-btn .fa-expand {
  display: inline-block;
}
#fullscreen-btn .fa-compress {
  display: none;
}

/* When in fullscreen, hide 'expand' and show 'compress' */
#fullscreen-btn.is-fullscreen .fa-expand {
  display: none;
}
#fullscreen-btn.is-fullscreen .fa-compress {
  display: inline-block;
}




/* --- Fullscreen Layout Adjustments --- */

/* This rule applies ONLY when the piano is in fullscreen */
.piano-container:fullscreen {
  display: flex;
  flex-direction: column;
  height: 100vh; /* Use 100% of the viewport height */
  width: 100vw;
  padding: 15px;
  box-sizing: border-box;
  background: #4a4a4a; /* Re-set background for fullscreen */
}

/* Make the top control wrapper (which contains the text area)
   grow to fill all available vertical space */
.piano-container:fullscreen .controls-wrapper {
  flex-grow: 1;
  min-height: 0; /* Fix for flex item overflow */
  display: flex;
  flex-direction: column;
}

/* --- NEW: Make the new wrapper grow in fullscreen --- */
.piano-container:fullscreen .textarea-wrapper {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}


/* Make the song textarea itself expand to fill the
   new space inside the control wrapper */
.piano-container:fullscreen .song-textarea {
  flex-grow: 1;
  min-height: 100px; /* Give it a reasonable minimum */
  resize: none; /* Disable manual resize in fullscreen */
}

/* Ensure the keyboard base does NOT grow and
   gets pushed to the bottom */
.piano-container:fullscreen .keyboard-base {
  flex-grow: 0;
  flex-shrink: 0;
}


/* --- Add this new rule for the recording button --- */

.btn#record.is-recording {
    color: #ff4040; /* Makes the '⏺' symbol red */
    
    /* Adds a red glow */
    text-shadow: 0 0 8px rgba(255, 0, 0, 0.7);
    
    /* You can even add a subtle pulse animation */
    animation: pulse-red 1.5s infinite;
}

@keyframes pulse-red {
  0% {
    opacity: 1;
    box-shadow: 0 0 8px rgba(255, 0, 0, 0.5);
  }
  50% {
    opacity: 0.7;
    box-shadow: 0 0 12px rgba(255, 0, 0, 0.8);
  }
  100% {
    opacity: 1;
    box-shadow: 0 0 8px rgba(255, 0, 0, 0.5);
  }
}