:root {
    --primary-color: #3a86ff;
    --secondary-color: #ff006e;
    --accent-color: #8338ec;
    --light-color: #f8f9fa;
    --dark-color: #212529;
    --success-color: #38b000;
    --warning-color: #ffbe0b;
    --error-color: #d90429;
    --piano-white: #fff;
    --piano-black: #000;
    --transition-speed: 0.3s;
    
    /* New color variables for futuristic theme */
    --neon-blue: #4dabf5;
    --neon-purple: #8338ec;
    --neon-pink: #ff006e;
    --grid-color: rgba(73, 80, 246, 0.15);
    --grid-line: rgba(73, 80, 246, 0.3);
    --piano-roll-bg: #161b22;
    --piano-roll-note: #4dabf5;
    --piano-roll-highlight: #ff006e;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    background: linear-gradient(135deg, #0a0e17 0%, #1c1f2e 100%);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    color: var(--light-color);
    overflow-x: hidden;
}

.container {
    padding: 0rem 1rem;
    flex: 1;
}

header {
    text-align: center;
    margin-bottom: 2rem;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    background: linear-gradient(to right, var(--primary-color), var(--accent-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: fadeIn 1s ease-in-out;
}

header p {
    font-size: 1.1rem;
    opacity: 0.8;
}

.game-container {
    border-radius: 1rem;
    padding: 2rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    margin-bottom: 2rem;
    box-sizing: border-box;
    max-width: 100vw;
}

.progress-container {
    margin-bottom: 2rem;
}

.progress-bar {
    height: 8px;
    background-color: #ddd;
    border-radius: 4px;
    margin-bottom: 1rem;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(to right, var(--primary-color), var(--accent-color));
    width: 0%;
    transition: width 0.5s ease-in-out;
}

.note-indicators {
    display: flex;
    justify-content: space-evenly;
    flex-wrap: wrap;
    gap: 10px;
}

.note-indicator {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background-color: #ddd;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    transition: all 0.3s ease;
    cursor: pointer;
}

.note-indicator.correct {
    background-color: var(--success-color);
    color: white;
    transform: scale(1.1);
}

.piano-container {
    overflow-x: auto;
    padding: 1rem 0;
}

/* Piano key layout fixes */
.piano {
    display: flex;
    position: relative;
    min-height: 150px;
    background: #ccc;
    border-top: 4px solid #999;
    border-bottom: 4px solid #999;
    overflow-x: auto;
    /* Prevent any gaps between keys */
    font-size: 0;
    letter-spacing: 0;
    word-spacing: 0;
}

.white-key {
    position: relative;
    width: 40px;
    height: 150px;
    background: #fff;
    border: 1px solid #888;
    box-sizing: border-box;
    display: inline-block;
    margin: 0;
    padding: 0;
    vertical-align: top;
    z-index: 1;
    transition: all 0.2s ease;
}

.white-key:active, .white-key.active {
    background: linear-gradient(to bottom, #e0e0e0 0%, #d0d0d0 100%);
    box-shadow: inset 0 5px 10px rgba(0,0,0,0.1);
}

/* Fix black key positioning to ensure proper spacing */
.black-key {
    position: absolute;
    width: 20px;
    height: 90px;
    background: linear-gradient(to bottom, #333 0%, #000 100%);
    border-radius: 0 0 3px 3px;
    top: 0;
    z-index: 10; /* Ensure black keys appear above white keys */
    box-shadow: 0 3px 5px rgba(0,0,0,0.4);
    transition: all 0.2s ease;
    box-sizing: border-box;
    border-bottom: 1px solid #000;
}

.white-key:hover, .white-key.active {
    background: linear-gradient(to bottom, #f8f8f8 0%, #e8e8e8 100%);
}

.black-key:hover, .black-key.active {
    background: linear-gradient(to bottom, #444 0%, #222 100%);
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.6);
}

.white-key.highlight {
    background: linear-gradient(to bottom, #bbdefb 0%, #90caf9 100%);
    animation: key-pulse 2s infinite;
}

.black-key.highlight {
    background: linear-gradient(to bottom, #555 0%, #333 100%);
    animation: key-pulse 2s infinite;
}

.key-label {
    position: absolute;
    bottom: 5px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 10px;
    color: #444;
    font-family: monospace;
}

.black-key .key-label {
    color: #fff;
    bottom: -18px;
    font-size: 9px;
}

/* Last white key needs right border */
.white-key:last-child {
    border-right: 1px solid #ccc;
}

.realistic-white-key {
    background: linear-gradient(to bottom, #fff 0%, #f5f5f5 100%);
    box-shadow: 0 5px 10px rgba(0,0,0,0.2);
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
    border-bottom: 2px solid #bbb;
}

.white-key:active, .white-key.active {
    background: linear-gradient(to bottom, #e0e0e0 0%, #d0d0d0 100%);
    transform: translateY(2px);
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.black-key {
    width: 26px;
    height: 90px;
    background: linear-gradient(to bottom, #333 0%, #000 100%);
    border-radius: 0 0 3px 3px;
    position: absolute;
    z-index: 2;
    /* Fix the black key positioning to be exactly between white keys */
    box-shadow: 0 3px 5px rgba(0,0,0,0.4);
    transition: all 0.2s ease;
    box-sizing: border-box;
    border-bottom: 1px solid #000;
}

/* Fix the positioning for specific black keys */
.black-key[data-note$="#0"],
.black-key[data-note$="#1"],
.black-key[data-note$="#2"],
.black-key[data-note$="#3"],
.black-key[data-note$="#4"],
.black-key[data-note$="#5"],
.black-key[data-note$="#6"],
.black-key[data-note$="#7"] {
    left: auto;
    right: auto;
}

.white-key:hover, .white-key.active {
    background: linear-gradient(to bottom, #e8f0ff 0%, #d8e0f0 100%);
    box-shadow: 0 0 15px rgba(77, 171, 245, 0.5);
}

.black-key:hover, .black-key.active {
    background: linear-gradient(to bottom, #444 0%, #222 100%);
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.6);
}

.white-key.highlight {
    background: linear-gradient(to bottom, #bbdefb 0%, #90caf9 100%);
    animation: key-pulse 2s infinite;
}

.black-key.highlight {
    background: linear-gradient(to bottom, #555 0%, #333 100%);
    animation: key-pulse 2s infinite;
}

@keyframes key-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(77, 171, 245, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(77, 171, 245, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(77, 171, 245, 0);
    }
}

.key-label {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 12px;
    font-weight: bold;
    color: #666;
}

.black-key .key-label {
    color: white;
    bottom: 5px;
}

/* Hide key labels by default */
.key-label.hidden-label {
    opacity: 0;
    visibility: hidden;
}

/* Show labels only when explicitly requested */
.key:hover .key-label.hidden-label {
    opacity: 0.7;
    visibility: visible;
    transition: opacity 0.3s;
}

/* Floating Note Animation - Overlay version */
.floating-note {
    position: fixed;
    display: flex;
    flex-direction: column;
    align-items: center;
    pointer-events: none;
    z-index: 9999; /* Ensure it appears above everything */
    animation: float-up 2s ease-out forwards;
    transform-origin: center bottom;
    /* Center horizontally */
    transform: translateX(-50%);
}

.note-symbol {
    font-size: 24px;
    color: var(--neon-blue);
    text-shadow: 0 0 10px rgba(77, 171, 245, 0.8);
    filter: drop-shadow(0 0 5px var(--neon-blue));
}

.note-text {
    font-size: 14px;
    font-weight: bold;
    color: var(--neon-pink);
    background: rgba(10, 14, 23, 0.8);
    padding: 2px 6px;
    border-radius: 10px;
    margin-top: 2px;
    border: 1px solid rgba(255, 0, 110, 0.4);
    text-shadow: 0 0 5px rgba(255, 0, 110, 0.5);
}

@keyframes float-up {
    0% {
        transform: translateY(0) translateX(-50%) scale(0.8) rotate(-5deg);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    100% {
        transform: translateY(-100px) translateX(-50%) scale(1.2) rotate(5deg);
        opacity: 0;
    }
}

/* Adjust the animations for left/right variations */
@keyframes float-up-left {
    0% {
        transform: translateY(0) translateX(-50%) scale(0.8) rotate(-5deg);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    100% {
        transform: translateY(-120px) translateX(-80px) scale(1.2) rotate(-15deg);
        opacity: 0;
    }
}

@keyframes float-up-right {
    0% {
        transform: translateY(0) translateX(-50%) scale(0.8) rotate(5deg);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    100% {
        transform: translateY(-120px) translateX(-20px) scale(1.2) rotate(15deg);
        opacity: 0;
    }
}

/* Add more diverse animation patterns for visual interest */
.floating-note:nth-child(odd) {
    animation-name: float-up-left;
}

.floating-note:nth-child(even) {
    animation-name: float-up-right;
}

/* Add multiple note symbols for visual variety */
.note-symbol::before {
    content: '';
    position: absolute;
    font-size: 18px;
    color: var(--secondary-color);
    opacity: 0.7;
    animation: float-around 2s ease-out infinite;
}

.floating-note:nth-child(3n)::after {
    content: '♪';
    position: absolute;
    top: -10px;
    right: -10px;
    font-size: 16px;
    color: var(--accent-color);
    animation: float-around 1.5s ease-out infinite alternate;
}

.floating-note:nth-child(3n+1)::after {
    content: '♫';
    position: absolute;
    top: -5px;
    left: -10px;
    font-size: 14px;
    color: var(--secondary-color);
    animation: float-around 1.8s ease-out infinite alternate;
}

@keyframes float-around {
    0% { transform: translateX(0) translateY(0); }
    50% { transform: translateX(5px) translateY(-5px); }
    100% { transform: translateX(-5px) translateY(-8px); }
}

.controls {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 2rem;
}

button {
    padding: 0.5rem .5rem;
    border: none;
    border-radius: 5px;
    font-family: inherit;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

#play-melody {
    background-color: var(--primary-color);
    color: white;
}

#play-melody:hover:not([disabled]) {
    background-color: #2a75ff;
    transform: translateY(-2px);
}

#play-melody:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

#restart {
    background-color: var(--light-color);
    color: var(--dark-color);
}

#restart:hover {
    background-color: #e9ecef;
    transform: translateY(-2px);
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 102;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    animation: fadeIn 0.3s;
    backdrop-filter: blur(5px);
}

.modal-content {
    background: #ffffff;
    color: #000;
    margin: 10% auto;
    padding: 1.5rem;
    border-radius: 10px;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.3);
    max-width: 600px;
    width: 90%;
    animation: slideIn 0.4s;
    position: relative;
    border: 1px solid rgba(0, 0, 0, 0.2);
}

.modal-content img {
    max-width: 100%;
    display: block;
    margin: 0 auto 1rem;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(73, 80, 246, 0.4);
}

.close {
    font-size: 1.8rem;
    cursor: pointer;
    color: #aaa;
    transition: color 0.3s;
}

.close:hover {
    color: var(--dark-color);
}

#question-text {
    font-size: 1.2rem;
    margin-bottom: 1.5rem;
}

.options-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.option {
    padding: 1rem;
    border: 2px solid #ddd;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;
}

.option:hover {
    border-color: var(--primary-color);
    background-color: rgba(58, 134, 255, 0.1);
}

.option.selected {
    border-color: var(--primary-color);
    background-color: rgba(58, 134, 255, 0.2);
}

.option.correct {
    border-color: var(--success-color);
    background-color: rgba(56, 176, 0, 0.2);
    animation: correctAnswer 0.5s;
}

.option.incorrect {
    border-color: var(--error-color);
    background-color: rgba(217, 4, 41, 0.2);
    animation: incorrectAnswer 0.5s;
}

@keyframes correctAnswer {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

@keyframes incorrectAnswer {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

#play-final-melody, #new-game {
    width: 100%;
    margin-top: 1rem;
    padding: 1rem;
}

#play-final-melody {
    background-color: var(--primary-color);
    color: white;
    margin-bottom: 0.5rem;
}

#new-game {
    background-color: var(--light-color);
    color: var(--dark-color);
}

.fireworks {
    height: 100px;
    background: url('https://media.giphy.com/media/26tOZ42Mg6pbTUPHW/giphy.gif') center/contain no-repeat;
    margin: 1rem 0;
}

footer {
    text-align: center;
    padding: 1rem;
    background-color: rgba(255, 255, 255, 0.7);
    margin-top: auto;
}

/* Updated footer styles - positioned at bottom with lower z-index */
.footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 30; /* Lower than piano keyboard (50) */
    text-align: center;
    padding: 1rem;
    background-color: rgba(10, 14, 23, 0.9);
    backdrop-filter: blur(5px);
    border-top: 1px solid rgba(73, 80, 246, 0.3);
}

.footer p {
    color: var(--light-color);
    opacity: 0.8;
    margin: 0.5rem 0;
}

.footer a {
    color: var(--neon-blue);
    text-decoration: none;
}

.footer a:hover {
    text-decoration: underline;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from { transform: translateY(-30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* Logo Styling - Updated */
.logo-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 1rem;
    gap: 2rem;
}

.game-logo, .quizzman-logo {
    position: relative;
    transition: all 0.4s ease;
}

.game-logo {
    max-width: 120px; /* Same or smaller than QuizzMan logo */
    transform-origin: center;
    animation: float 6s ease-in-out infinite;
}

.quizzman-logo {
    max-width: 150px;
    animation: pulse 3s ease-in-out infinite;
}

.game-logo img, .quizzman-logo img {
    max-width: 100%;
    height: auto;
    filter: drop-shadow(0 5px 15px rgba(0, 0, 0, 0.2));
    transition: all 0.3s ease;
}

.game-logo:hover, .quizzman-logo:hover {
    transform: translateY(-5px) scale(1.03);
}

.game-logo:hover img, .quizzman-logo:hover img {
    filter: drop-shadow(0 8px 25px rgba(58, 134, 255, 0.4));
}

.game-logo::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 10%;
    width: 80%;
    height: 10px;
    background: radial-gradient(ellipse at center, rgba(0,0,0,0.2) 0%, rgba(0,0,0,0) 70%);
    opacity: 0.5;
    border-radius: 50%;
    animation: shadow 6s ease-in-out infinite;
}

/* Logo Animations */
@keyframes float {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    25% { transform: translateY(-10px) rotate(1deg); }
    50% { transform: translateY(0) rotate(0deg); }
    75% { transform: translateY(-5px) rotate(-1deg); }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.05); opacity: 0.9; }
}

@keyframes shadow {
    0%, 100% { transform: scale(1); opacity: 0.5; }
    50% { transform: scale(1.1); opacity: 0.3; }
}

/* Add glow effect on hover for both logos */
.game-logo::before, .quizzman-logo::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at center, var(--primary-color) 0%, transparent 70%);
    opacity: 0;
    z-index: -1;
    transition: opacity 0.3s ease;
    border-radius: 50%;
}

.game-logo:hover::before, .quizzman-logo:hover::before {
    opacity: 0.3;
    animation: glow 2s infinite alternate;
}

@keyframes glow {
    from { opacity: 0.1; transform: scale(0.9); }
    to { opacity: 0.3; transform: scale(1.1); }
}

/* Responsive adjustments for logos */
@media (max-width: 768px) {
    .logo-container {
        gap: 1rem;
    }
    
    .game-logo {
        max-width: 100px;
    }
    
    .quizzman-logo {
        max-width: 120px;
    }
}

/* Instrument Selector Styles */
.instrument-selector {
    background: rgba(22, 27, 34, 0.8);
    border-radius: 8px;
    border: 1px solid rgba(73, 80, 246, 0.4);
    box-shadow: 0 0 15px rgba(73, 80, 246, 0.2);
    position: relative;
    overflow: hidden;
}

.instrument-selector h3 {
    color: var(--light-color);
    margin-bottom: 1rem;
    font-size: 1rem;
    text-align: center;
}

.instrument-options {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.instrument {
    width: 80px;
    padding: 0.8rem;
    border-radius: 8px;
    background: rgba(30, 34, 43, 0.5);
    border: 1px solid rgba(73, 80, 246, 0.2);
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.instrument.active {
    background: rgba(73, 80, 246, 0.2);
    border-color: rgba(73, 80, 246, 0.6);
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(73, 80, 246, 0.3);
}

.instrument:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.15);
}

.instrument img {
    width: 50px;
    height: 50px;
    margin-bottom: 0.5rem;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.instrument span {
    display: block;
    font-weight: 600;
    font-size: 0.9rem;
}

/* Responsive adjustments for logos */
@media (max-width: 768px) {
    .logo-container {
        gap: 1rem;
    }
    
    .game-logo {
        max-width: 100px;
    }
    
    .quizzman-logo {
        max-width: 120px;
    }
    
    .instrument {
        width: 80px;
        padding: 0.8rem;
    }
    
    .instrument img {
        width: 40px;
        height: 40px;
    }
}

@media (max-width: 480px) {
    .logo-container {
        flex-direction: row; /* Keep horizontal layout */
        gap: 0.5rem;
    }
    
    .game-logo {
        max-width: 80px;
    }
    
    .quizzman-logo {
        max-width: 100px;
    }
    
    .instrument-options {
        gap: 1rem;
    }
    
    .instrument {
        width: 70px;
        padding: 0.6rem;
    }
    
    .instrument img {
        width: 35px;
        height: 35px;
    }
}

/* Responsive Styles */
@media (max-width: 768px) {
    .piano {
        justify-content: flex-start;
    }
    
    .white-key {
        width: 35px;
    }
    
    .black-key {
        width: 20px;
    }
    
    .modal-content {
        margin: 20% auto;
        width: 95%;
    }
    
    .options-container {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 2rem;
    }
    
    .white-key {
        width: 30px;
    }
    
    .black-key {
        width: 18px;
        height: 100px;
    }
    
    .key-label {
        font-size: 10px;
    }
}

/* Guitar Neck Styles */
.guitar-neck {
    position: relative;
    background-color: #8B4513;
    border-radius: 5px;
    margin: 20px auto;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
    overflow-x: auto;
}

.fret {
    position: absolute;
    width: 2px;
    background-color: #C0C0C0;
    top: 0;
    bottom: 0;
}

.string {
    position: absolute;
    height: 2px;
    background: linear-gradient(to right, #D3D3D3, #FFFFFF);
    left: 0;
}

.fret-marker {
    position: absolute;
    width: 10px;
    height: 10px;
    background-color: #FFFFFF;
    border-radius: 50%;
    top: 50%;
    transform: translateY(-50%);
}

.double-marker:after {
    content: '';
    position: absolute;
    width: 10px;
    height: 10px;
    background-color: #FFFFFF;
    border-radius: 50%;
    top: 30px;
}

.note-marker {
    position: absolute;
    width: 20px;
    height: 20px;
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 8px;
    color: #FFF;
    cursor: pointer;
    z-index: 10;
}

.note-marker:hover {
    background-color: rgba(255, 255, 255, 0.6);
    color: #000;
}

.note-marker.active {
    background-color: #FFD700;
    color: #000;
    box-shadow: 0 0 10px #FFD700;
}

.note-marker.highlight {
    background-color: #FF6347;
    box-shadow: 0 0 15px #FF6347;
    animation: pulse 2s infinite;
}

.string-label {
    position: absolute;
    color: #FFF;
    font-size: 12px;
    font-weight: bold;
}

/* Song List Panel Styles */
.song-list-panel {
    display: none; /* Hide completely */
}

.song-list-panel h3,
.secret-melody-panel h3 {
    color: var(--light-color);
    border-bottom: 1px solid rgba(73, 80, 246, 0.4);
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
}

.song-filter {
    display: flex;
    margin-bottom: 15px;
    gap: 10px;
}

.song-filter input,
.song-filter select {
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.song-filter input {
    flex: 1;
}

.songs-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 15px;
}

.song-item {
    background: white;
    border-radius: 6px;
    padding: 12px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.song-item:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}

.song-item.active {
    border-left: 4px solid #4caf50;
    background-color: #f1f8e9;
}

.song-title {
    font-weight: bold;
    font-size: 16px;
    margin-bottom: 5px;
    color: #333;
}

.song-difficulty {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 12px;
    margin-bottom: 8px;
}

.song-difficulty.beginner {
    background-color: #e8f5e9;
    color: #2e7d32;
}

.song-difficulty.intermediate {
    background-color: #fff3e0;
    color: #ef6c00;
}

.song-difficulty.advanced {
    background-color: #ffebee;
    color: #c62828;
}

.song-tags {
    margin-bottom: 8px;
}

.tag {
    display: inline-block;
    background-color: #eceff1;
    color: #546e7a;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 11px;
    margin-right: 5px;
}

.song-description {
    font-size: 13px;
    color: #666;
    line-height: 1.4;
}

.note-indicator .retry-count {
    position: absolute;
    top: -5px;
    right: -5px;
    background-color: #ff5722;
    color: white;
    border-radius: 50%;
    width: 16px;
    height: 16px;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-notice {
    background-color: rgba(0,0,0,0.8);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.auth-message {
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    text-align: center;
    max-width: 400px;
}

.auth-message p {
    margin-bottom: 15px;
    font-size: 16px;
}

#login-button {
    background-color: #4285f4;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s;
}

#login-button:hover {
    background-color: #3367d6;
}

.shake {
    animation: shake 0.5s cubic-bezier(.36,.07,.19,.97) both;
}

@keyframes shake {
    10%, 90% { transform: translate3d(-1px, 0, 0); }
    20%, 80% { transform: translate3d(2px, 0, 0); }
    30%, 50%, 70% { transform: translate3d(-3px, 0, 0); }
    40%, 60% { transform: translate3d(3px, 0, 0); }
}

/* Responsive adjustments for guitar */
@media (max-width: 992px) {
    .note-marker {
        width: 16px;
        height: 16px;
        font-size: 6px;
    }
    
    .string-label {
        font-size: 10px;
    }
}

@media (max-width: 576px) {
    .note-marker {
        width: 14px;
        height: 14px;
        font-size: 5px;
    }
    
    .string-label {
        font-size: 8px;
        left: -20px !important;
    }
}

/* Responsive adjustments for song list */
@media (max-width: 768px) {
    .songs-container {
        grid-template-columns: 1fr;
    }
    
    .song-filter {
        flex-direction: column;
    }
}

/* Saxophone UI Styles */
.saxophone-container {
    display: none;
    position: relative;
    width: 100%;
    height: 300px;
    margin: 20px auto;
    overflow: hidden;
    perspective: 800px;
}

.saxophone {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.saxophone-body {
    position: relative;
    width: 80px;
    height: 250px;
    background: linear-gradient(45deg, #d4af37, #f9d754, #d4af37);
    border-radius: 15px 15px 100px 15px;
    box-shadow: 0 10px 20px rgba(0,0,0,0.3);
    transform: rotate(-15deg);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 10px;
    z-index: 1;
}

.saxophone-keys {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
    padding: 20px 0;
}

.sax-key {
    width: 22px;
    height: 22px;
    background-color: #333;
    border-radius: 50%;
    border: 2px solid #777;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.sax-key:hover, .sax-key.active {
    background-color: #555;
    box-shadow: 0 0 10px rgba(255,215,0,0.6);
}

.sax-key.highlight {
    background-color: #f44336;
    box-shadow: 0 0 15px rgba(244,67,54,0.8);
    animation: pulse 2s infinite;
}

.sax-key::after {
    content: attr(data-note);
    position: absolute;
    bottom: -20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 10px;
    color: #fff;
    background-color: rgba(0,0,0,0.7);
    padding: 2px 4px;
    border-radius: 3px;
    opacity: 0;
    transition: opacity 0.2s;
}

.sax-key:hover::after {
    opacity: 1;
}

.saxophone-mouthpiece {
    position: absolute;
    top: -30px;
    left: 50%;
    transform: translateX(-50%) rotate(15deg);
    width: 18px;
    height: 40px;
    background-color: #000;
    border-radius: 5px 5px 0 0;
}

.saxophone-bell {
    position: absolute;
    bottom: -20px;
    right: -30px;
    width: 70px;
    height: 70px;
    background: linear-gradient(45deg, #d4af37, #f9d754);
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
    box-shadow: inset 0 0 20px rgba(0,0,0,0.3);
}

/* Responsive adjustments for saxophone */
@media (max-width: 768px) {
    .saxophone-body {
        width: 60px;
        height: 200px;
    }
    
    .saxophone-keys {
        gap: 10px;
    }
    
    .sax-key {
        width: 18px;
        height: 18px;
    }
    
    .saxophone-bell {
        width: 50px;
        height: 50px;
    }
}

@media (max-width: 480px) {
    .saxophone-body {
        width: 50px;
        height: 180px;
    }
    
    .sax-key {
        width: 16px;
        height: 16px;
    }
    
    .saxophone-bell {
        width: 40px;
        height: 40px;
        right: -20px;
    }
}

/* Fixed bottom keyboard styling */
.fixed-bottom-keyboard {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    background: rgba(10, 14, 23, 0.9);
    box-shadow: 0 -5px 15px rgba(0, 0, 0, 0.3);
    z-index: 50;
    padding: 10px 0;
    overflow-x: auto;
    white-space: nowrap;
    border-top: 1px solid rgba(73, 80, 246, 0.4);
    backdrop-filter: blur(10px);
}

/* Note playground styles */
.note-playground {
    position: relative;
    margin: 30px auto;
    background: rgba(248, 249, 250, 0.8);
    border-radius: 10px;
    padding: 30px 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    min-height: 150px;
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: center;
    justify-content: center;
}

.note-checkpoint {
    position: relative;
    height: 80px;
    min-width: 80px;
    border-radius: 10px;
    border: 1px solid #d0dfff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    overflow: hidden;
}

.note-checkpoint:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.note-checkpoint.current {
    background: linear-gradient(135deg, #ffe792, #ffc857);
    border-color: var(--primary-color);
    box-shadow: 0 0 15px rgba(58, 134, 255, 0.3);
    animation: pulse 2s infinite;
}

.note-checkpoint.completed {
    border-color: var(--success-color);
}

/* Updated checkpoint note styles with alternating orientations */
.piano-roll-grid {
    display: flex;
    flex-direction: column-reverse; /* Stack from bottom to top */
    justify-content: flex-start;
    align-items: flex-start;
    padding: 20px;
    gap: 15px;
}

/* Ensure checkpoint notes are clearly visible on the grid */
.piano-roll-note.checkpoint-note {
    position: absolute;
    background: linear-gradient(to bottom, #ff3b30, #ff5e57) !important;
    border-radius: 3px;
    box-shadow: 0 0 10px rgba(255, 59, 48, 0.7);
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 100 !important; /* Higher z-index to ensure visibility */
    opacity: 1 !important;
    height: 24px !important;
    box-sizing: border-box;
    border: 1px solid rgba(255, 255, 255, 0.3);
    pointer-events: auto;
}

.piano-roll-note.checkpoint-note:hover {
    filter: brightness(1.3);
    box-shadow: 0 0 15px rgba(255, 59, 48, 0.9);
    transform: translateY(-2px);
}

/* Improve checkpoint note label visibility */
.checkpoint-note-label {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    transform: translateY(-50%);
    font-weight: bold;
    font-size: 12px;
    color: white !important;
    text-align: center;
    text-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0 5px;
    z-index: 101;
}

.note-checkpoint {
    position: relative;
    width: auto;
    min-width: 80px;
    height: 50px;
    border-radius: 6px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 0 10px rgba(255, 0, 0, 0.5);
}

.note-checkpoint:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 15px rgba(255, 0, 0, 0.7);
}

.note-checkpoint:nth-child(odd) {
    align-self: flex-start;
    transform-origin: left center;
}

.note-checkpoint:nth-child(even) {
    align-self: flex-end;
    transform-origin: right center;
}

.checkpoint-note {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    transform: translateY(-50%);
    font-weight: bold;
    font-size: 16px;
    color: white;
    text-align: center;
    text-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
}

.note-checkpoint:nth-child(odd) .checkpoint-note {
    transform: translateY(-50%) rotate(-5deg);
}

.note-checkpoint:nth-child(even) .checkpoint-note {
    transform: translateY(-50%) rotate(5deg);
}


.note-checkpoint.completed {
    opacity: 0.8;
}

@keyframes pulse-checkpoint {
    0% {
        box-shadow: 0 0 10px rgba(255, 59, 48, 0.7);
    }
    50% {
        box-shadow: 0 0 20px rgba(255, 59, 48, 0.9);
    }
    100% {
        box-shadow: 0 0 10px rgba(255, 59, 48, 0.7);
    }
}

/* Magic smoke for the question dialog */
.modal-content {
    animation: none; /* Overridden when needed */
    position: relative;
}

/* Custom animation for the modal from checkpoint */
@keyframes magic-appear {
    0% { 
        opacity: 0;
        transform: scale(0) rotate(-10deg);
        filter: blur(10px);
    }
    60% {
        opacity: 0.8;
        transform: scale(1.1) rotate(5deg);
        filter: blur(3px);
    }
    100% { 
        opacity: 1;
        transform: scale(1) rotate(0);
        filter: blur(0);
    }
}

/* Progress track */
.progress-track {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 5px;
    background: #eee;
    z-index: 1;
}

.progress-track::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 0;
    background: linear-gradient(to right, var(--primary-color), var(--accent-color));
    transition: width 0.5s ease-in-out;
}

/* Update the progress bar */
.note-playground.progress-updated .progress-track::after {
    width: var(--progress-percentage);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .note-checkpoint {
        height: 70px;
        min-width: 70px;
    }
    
    .checkpoint-note {
        font-size: 16px;
    }
    
    .magic-lamp {
        font-size: 18px;
    }
}

@media (max-width: 480px) {
    .note-checkpoint {
        height: 60px;
        min-width: 60px;
    }
    
    .checkpoint-note {
        font-size: 14px;
    }
    
    .magic-lamp {
        font-size: 16px;
    }
}

/* Fixed header styles */
.game-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: linear-gradient(90deg, rgba(22,27,34,0.95) 0%, rgba(28,31,46,0.95) 100%);
    padding: 1rem;
    z-index: 100;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    border-bottom: 1px solid rgba(73, 80, 246, 0.3);
}

.game-header h1 {
    font-size: 1.8rem;
    background: linear-gradient(to right, var(--neon-blue), var(--neon-purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-align: center;
    margin: 0;
    text-shadow: 0 0 10px rgba(77, 171, 245, 0.5);
}

.game-header p {
    text-align: center;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
    margin: 0.2rem 0 0;
}

/* Quiz question display area */
.quiz-question-display {
    background: rgba(22, 27, 34, 0.8);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    border: 1px solid rgba(73, 80, 246, 0.4);
    box-shadow: 0 0 15px rgba(73, 80, 246, 0.2);
    position: relative;
    overflow: hidden;
}

.quiz-question-display::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(to right, var(--neon-blue), var(--neon-purple));
    box-shadow: 0 0 10px rgba(77, 171, 245, 0.7);
}

.quiz-question-display h3 {
    color: var(--light-color);
    margin-bottom: 0.5rem;
    font-size: 1.2rem;
}

.quiz-question-display p {
    color: rgba(255, 255, 255, 0.8);
    font-size: 1rem;
}

/* Piano roll container */
.piano-roll-container {
    position: relative;
    margin-bottom: 1rem;
    border-radius: 8px;
    overflow: hidden;
    background-color: var(--piano-roll-bg);
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(73, 80, 246, 0.4);
    height: 400px;
    display: flex;
}

/* Piano roll grid */
.piano-roll-grid {
    flex: 1;
    position: relative;
    overflow: auto;
    background-size: 40px 24px; /* Match beatWidth and noteHeight from config */
    background-image: 
        linear-gradient(to right, var(--grid-line) 1px, transparent 1px),
        linear-gradient(to bottom, var(--grid-line) 1px, transparent 1px);
    background-color: var(--piano-roll-bg);
    padding: 10px;
}

.piano-roll-grid::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    pointer-events: none;
    background: radial-gradient(circle at center, transparent 30%, var(--piano-roll-bg) 100%);
    opacity: 0.4;
}

/* Piano roll vertical keyboard */
.piano-roll-keyboard {
    width: 80px;
    background: #0a0e17;
    border-right: 1px solid rgba(73, 80, 246, 0.4);
    overflow-y: auto;
    flex-shrink: 0;
}

.piano-roll-white-key {
    height: 24px;
    background: linear-gradient(to right, #222, #333);
    border-bottom: 1px solid #111;
    color: rgba(255, 255, 255, 0.7);
    font-size: 10px;
    display: flex;
    align-items: center;
    padding-left: 5px;
    position: relative;
}

.piano-roll-black-key {
    height: 24px;
    background: linear-gradient(to right, #111, #222);
    border-bottom: 1px solid #000;
    color: rgba(255, 255, 255, 0.5);
    font-size: 10px;
    display: flex;
    align-items: center;
    padding-left: 5px;
    position: relative;
}

/* Piano roll notes - updated for vertical orientation */
.piano-roll-note {
    position: absolute;
    background: linear-gradient(to bottom, var(--piano-roll-note), rgba(77, 171, 245, 0.7));
    border-radius: 3px;
    width: 24px; /* Fixed width based on note height */
    box-shadow: 0 0 10px rgba(77, 171, 245, 0.5);
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 5;
}

/* Checkpoint notes styling - solid red blocks - vertical orientation */
.piano-roll-note.checkpoint-note {
    position: absolute;
    background: linear-gradient(to bottom, #ff3b30, #ff5e57);
    border-radius: 3px;
    box-shadow: 0 0 10px rgba(255, 59, 48, 0.7);
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 6; /* Higher than regular notes */
    opacity: 0.9 !important;
    height: 24px !important;
    box-sizing: border-box;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.piano-roll-note.checkpoint-note:hover {
    filter: brightness(1.3);
    box-shadow: 0 0 15px rgba(255, 59, 48, 0.9);
    transform: translateY(-2px);
}

.checkpoint-note-label {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    transform: translateY(-50%);
    font-weight: bold;
    font-size: 12px;
    color: white;
    text-align: center;
    text-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0 5px;
}

.piano-roll-note:hover {
    filter: brightness(1.2);
    box-shadow: 0 0 15px rgba(77, 171, 245, 0.8);
}

.piano-roll-note.playing {
    background: linear-gradient(to right, var(--piano-roll-highlight), rgba(255, 0, 110, 0.7));
    box-shadow: 0 0 15px rgba(255, 0, 110, 0.8);
}

/* Timeline */
.piano-roll-timeline {
    height: 30px;
    background: #0a0e17;
    border-bottom: 1px solid rgba(73, 80, 246, 0.4);
    position: relative;
    display: flex;
    align-items: center;
}

.timeline-marker {
    position: absolute;
    width: 1px;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.3);
    font-size: 10px;
    color: rgba(255, 255, 255, 0.6);
}

.timeline-marker span {
    position: absolute;
    top: 5px;
    transform: translateX(-50%);
}

/* Playhead */
.piano-roll-playhead {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background-color: var(--neon-pink);
    box-shadow: 0 0 10px var(--neon-pink);
    z-index: 10;
    pointer-events: none;
}


.panel-toggle {
    position: absolute;
    right: -40px;
    top: 20px;
    width: 40px;
    height: 40px;
    background: rgba(10, 14, 23, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    border-radius: 0 5px 5px 0;
    border: 1px solid rgba(73, 80, 246, 0.4);
    border-left: none;
    color: var(--light-color);
    font-size: 1.2rem;
}

.panel-toggle:hover {
    background: rgba(20, 24, 33, 0.9);
}

.secret-melody-panel h3 {
    color: var(--light-color);
    border-bottom: 1px solid rgba(73, 80, 246, 0.4);
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
}

.melody-item {
    background: rgba(30, 34, 43, 0.5);
    border-radius: 5px;
    padding: 0.8rem;
    margin-bottom: 0.8rem;
    border: 1px solid rgba(73, 80, 246, 0.2);
    transition: all 0.2s ease;
}

.melody-item:hover {
    background: rgba(40, 44, 53, 0.5);
    border-color: rgba(73, 80, 246, 0.4);
    transform: translateY(-2px);
}

.melody-title {
    font-weight: bold;
    margin-bottom: 0.3rem;
    color: var(--light-color);
}

.melody-difficulty {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.7rem;
    margin-bottom: 0.5rem;
}

.melody-difficulty.easy {
    background-color: rgba(56, 176, 0, 0.2);
    color: var(--success-color);
    border: 1px solid rgba(56, 176, 0, 0.3);
}

.melody-difficulty.medium {
    background-color: rgba(255, 190, 11, 0.2);
    color: var(--warning-color);
    border: 1px solid rgba(255, 190, 11, 0.3);
}

.melody-difficulty.hard {
    background-color: rgba(255, 0, 110, 0.2);
    color: var(--neon-pink);
    border: 1px solid rgba(255, 0, 110, 0.3);
}

.melody-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.melody-tag {
    background: rgba(73, 80, 246, 0.2);
    color: var(--neon-blue);
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.7rem;
    border: 1px solid rgba(73, 80, 246, 0.3);
}

/* Code input box - move to left, below sidebar */
.code-input-container {
    position: fixed;
    bottom: 20px;
    left: 20px;
    width: 300px;
    background: rgba(10, 14, 23, 0.9);
    backdrop-filter: blur(10px);
    border-radius: 10px;
    padding: 1rem;
    border: 1px solid rgba(73, 80, 246, 0.4);
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    z-index: 90;
    transition: all 0.3s ease;
}

.code-input-container.hidden {
    transform: translateY(calc(100% + 20px));
    opacity: 0;
    pointer-events: none;
}

.code-input-container h4 {
    color: var(--light-color);
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

.code-input-field {
    width: 100%;
    background: rgba(30, 34, 43, 0.5);
    border: 1px solid rgba(73, 80, 246, 0.3);
    border-radius: 5px;
    padding: 0.6rem 0.8rem;
    color: var(--light-color);
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    transition: all 0.2s;
}

.code-input-field:focus {
    outline: none;
    border-color: var(--neon-blue);
    box-shadow: 0 0 10px rgba(77, 171, 245, 0.3);
}

.code-submit-btn {
    width: 100%;
    background: linear-gradient(to right, var(--neon-blue), var(--neon-purple));
    border: none;
    border-radius: 5px;
    padding: 0.6rem;
    color: var(--light-color);
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
}

.code-submit-btn:hover {
    box-shadow: 0 0 15px rgba(77, 171, 245, 0.5);
    transform: translateY(-2px);
}

.code-toggle {
    position: absolute;
    top: -40px;
    right: 0;
    padding: 0.5rem 1rem;
    background: rgba(10, 14, 23, 0.9);
    border-radius: 5px 5px 0 0;
    border: 1px solid rgba(73, 80, 246, 0.4);
    border-bottom: none;
    color: var(--light-color);
    cursor: pointer;
    font-size: 0.8rem;
}

.code-toggle:hover {
    background: rgba(20, 24, 33, 0.9);
}

/* Left-aligned piano for larger screens */
@media (min-width: 992px) {
    .piano-roll-container {
        height: 500px;
        display: flex;
        flex-direction: row;
    }
    
    .piano-roll-keyboard {
        width: 80px;
        height: 100%;
        border-right: 1px solid rgba(73, 80, 246, 0.4);
        border-bottom: none;
        overflow-y: auto;
        overflow-x: hidden;
    }
    
    .piano-roll-grid {
        height: 100%;
    }
}

/* Bottom-aligned piano for smaller screens */
@media (max-width: 991px) {
    .piano-roll-container {
        height: 400px;
        display: flex;
        flex-direction: column-reverse;
    }
    
    .piano-roll-keyboard {
        width: 100%;
        height: 80px;
        border-top: 1px solid rgba(73, 80, 246, 0.4);
        border-right: none;
        overflow-x: auto;
        overflow-y: hidden;
        display: flex;
    }
    
    .piano-roll-white-key, .piano-roll-black-key {
        height: 100%;
        width: 30px;
        flex-shrink: 0;
        border-right: 1px solid #111;
        border-bottom: none;
    }
    
    .piano-roll-grid {
        height: calc(100% - 80px);
    }
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .game-header h1 {
        font-size: 1.5rem;
    }
    
    .game-header p {
        font-size: 0.8rem;
    }
    
    .piano-roll-container {
        height: 300px;
    }
    
    .secret-melody-panel {
        width: 80%;
        left: -80%;
        right: auto;
    }
    
    .code-input-container {
        width: 250px;
        left: 10px;
        right: auto;
        bottom: 10px;
    }
    
    .white-key {
        width: 30px;
        height: 120px;
    }
    
    .black-key {
        width: 20px;
        height: 75px;
    }
    
    .code-toggle {
        padding: 0.4rem 0.8rem;
        font-size: 0.7rem;
    }
}

@media (max-width: 480px) {
    .piano-roll-container {
        height: 250px;
    }
    
    .piano-roll-keyboard {
        height: 60px;
    }
    
    .piano-roll-grid {
        height: calc(100% - 60px);
    }
    
    .piano-roll-white-key, .piano-roll-black-key {
        width: 25px;
    }
    
    .white-key {
        width: 25px;
        height: 100px;
    }
    
    .black-key {
        width: 16px;
        height: 65px;
    }
    
    .code-input-container {
        width: calc(100% - 20px);
    }
    
    .melody-item {
        padding: 0.6rem;
    }
}

/* Mobile Toggle Button Styles */
.mobile-toggle-btn {
    position: fixed;
    right: 20px;
    top: 80px;
    width: 50px;
    height: 50px;
    background: rgba(10, 14, 23, 0.9);
    border: 1px solid rgba(73, 80, 246, 0.4);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    z-index: 101;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.5);
    transition: all 0.3s ease;
}

.mobile-toggle-btn:hover {
    background: rgba(20, 24, 33, 0.9);
    transform: scale(1.05);
}

.mobile-toggle-btn i {
    color: var(--light-color);
    transition: transform 0.3s ease;
}

/* Add pulse animation to the button when panel is closed */
.mobile-toggle-btn.pulse {
    animation: pulse-button 2s infinite;
}

@keyframes pulse-button {
    0% {
        box-shadow: 0 0 0 0 rgba(73, 80, 246, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(73, 80, 246, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(73, 80, 246, 0);
    }
}

/* Updated Secret Melody Panel styling for better mobile experience */
.secret-melody-panel {
    position: fixed;
    right: -320px;
    top: 80px;
    bottom: 0;
    width: 320px;
    background: rgba(10, 14, 23, 0.95);
    backdrop-filter: blur(10px);
    z-index: 90;
    transition: right 0.3s ease;
    border-left: 1px solid rgba(73, 80, 246, 0.4);
    overflow-y: auto;
    padding: 1rem;
    box-shadow: -5px 0 20px rgba(0, 0, 0, 0.5);
}

.secret-melody-panel.open {
    right: 0;
    left: auto;
}

/* Improved user avatar container */
.user-avatar-container {
    position: absolute;
    top: 10px;
    right: 20px;
    display: flex;
    align-items: center;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid var(--neon-blue);
    box-shadow: 0 0 10px rgba(77, 171, 245, 0.5);
    transition: all 0.3s ease;
}

.user-avatar:hover {
    transform: scale(1.1);
    box-shadow: 0 0 15px rgba(77, 171, 245, 0.8);
}

/* User info form styles */
.user-info-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.form-group label {
    font-size: 14px;
    color: var(--light-color);
}

.form-group input {
    padding: 10px;
    border-radius: 5px;
    border: 1px solid rgba(73, 80, 246, 0.4);
    background: rgba(30, 34, 43, 0.5);
    color: var(--light-color);
}

#submit-user-info, #skip-user-info {
    padding: 10px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
}

#submit-user-info {
    background: var(--neon-blue);
    color: white;
}

#skip-user-info {
    background: rgba(255, 255, 255, 0.1);
    color: var(--light-color);
}

#submit-user-info:hover {
    background: var(--primary-color);
    transform: translateY(-2px);
}

#skip-user-info:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Mobile responsiveness for secret melody panel and toggle */
@media (max-width: 768px) {
    .secret-melody-panel {
        width: 80%;
        left: -80%;
    }
    
    .mobile-toggle-btn {
        width: 45px;
        height: 45px;
        top: 70px;
    }
    
    .mobile-toggle-btn i {
        font-size: 22px;
    }
    
    .user-avatar {
        width: 35px;
        height: 35px;
    }
}

@media (max-width: 480px) {
    .secret-melody-panel {
        width: 90%;
        left: -90%;
    }
    
    .mobile-toggle-btn {
        width: 40px;
        height: 40px;
        top: 65px;
        right: 15px;
    }
    
    .mobile-toggle-btn i {
        font-size: 20px;
    }
}

/* Improved floating note animations with note symbols */
.floating-note {
    position: fixed;
    display: flex;
    flex-direction: column;
    align-items: center;
    pointer-events: none;
    z-index: 9999;
    animation: float-up 2s ease-out forwards;
    transform-origin: center bottom;
    transform: translateX(-50%);
}

.note-symbol {
    font-size: 28px;
    color: var(--neon-blue);
    text-shadow: 0 0 10px rgba(77, 171, 245, 0.8);
    filter: drop-shadow(0 0 5px var(--neon-blue));
}

/* Different note symbols based on musical notation */
.note-symbol.eighth {
    font-size: 24px;
}

.note-symbol.quarter {
    font-size: 26px;
}

.note-symbol.half {
    font-size: 28px;
}

.note-symbol.whole {
    font-size: 30px;
}

/* Fix for the piano-roll-note checkpoint styles */
.piano-roll-note.checkpoint-note {
    background: linear-gradient(to bottom, #ff3b30, #ff5e57);
    box-shadow: 0 0 10px rgba(255, 59, 48, 0.7);
    opacity: 0.9 !important;
    width: auto !important;
    height: 24px !important;
    box-sizing: border-box;
}

.open-string-marker{
    position:absolute;
    width:12px;height:12px;border-radius:50%;
    background:#555;cursor:pointer;
}


.blink {
  animation: blink-glow 1s infinite;
}

@keyframes blink-glow {
  0% {
    box-shadow: 0 0 6px #fff, 0 0 12px #ffd700, 0 0 18px #fff5cc;
  }
  50% {
    box-shadow: 0 0 12px #fff, 0 0 24px #ffd700, 0 0 36px #fffacd;
  }
  100% {
    box-shadow: 0 0 6px #fff, 0 0 12px #ffd700, 0 0 18px #fff5cc;
  }
}


/* Secret Melody Card Styles */
.melody-card {
    background: rgba(30, 34, 43, 0.6);
    border-radius: 6px;
    padding: 0.8rem;
    margin-bottom: 0.8rem;
    border: 1px solid rgba(73, 80, 246, 0.3);
    transition: all 0.3s ease;
    cursor: pointer;
}

.melody-card.locked {
    opacity: 0.5;
    cursor: not-allowed;
}

.melody-card:hover:not(.locked) {
    transform: translateY(-2px);
    background: rgba(40, 44, 53, 0.6);
    border-color: rgba(73, 80, 246, 0.5);
}

.melody-card .melody-title {
    font-weight: bold;
    font-size: 1rem;
    color: var(--light-color);
    margin-bottom: 0.2rem;
}

.melody-card .melody-author {
    font-size: 0.8rem;
    color: rgba(255,255,255,0.7);
    margin-bottom: 0.2rem;
}

.melody-card .melody-meta {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.6);
}
.piano-roll-container{
    position: relative;
    overflow: auto;          /* cuộn cả ngang + dọc */
    max-height: 360px;       /* CHỐT chiều cao khung grid */
    /* nếu muốn luôn có khung vuông: */
    /* height: 360px; */
  }
  
  .piano-roll-grid{
    position: relative;      /* đảm bảo getBoundingClientRect chuẩn */
    /* width đã set bằng JS rồi */
  }