/* Dino-Piano Game Styles */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: #f7f7f7;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

#game-area {
    width: 100%;
    height: calc(100% - 240px);
    min-height: 200px;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

/* Wrapper that contains the canvas and HUD - sized to match canvas */
#game-world-container {
    position: relative;
    max-width: 800px;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

#game-canvas {
    background-color: #f7f7f7;
    display: block;
    max-width: 100%;
    max-height: 100%;
}

/* Score and Lives display (HUD) - positioned relative to game-world-container */
#game-hud {
    position: absolute;
    top: 8px;
    left: 8px;
    right: 50px; /* Leave room for pause button */
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #535353;
    font-size: 16px;
    font-weight: 600;
    pointer-events: none;
    z-index: 100;
}

#score-display {
    background: rgba(255, 255, 255, 0.8);
    padding: 6px 12px;
    border-radius: 6px;
    border: 1px solid #ccc;
}

#lives-display {
    background: rgba(255, 255, 255, 0.8);
    padding: 6px 12px;
    border-radius: 6px;
    border: 1px solid #ccc;
}

.heart {
    color: #ff4757;
    margin-left: 4px;
    font-size: 20px;
}

.heart.lost {
    color: #444;
}

/* Game state overlays */
.game-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(180deg, #1a1a2e 0%, #16162a 50%, #0f0f1a 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: #fff;
    z-index: 200;
    padding: 20px;
    overflow-y: auto;
}

/* Inner panel with rounded corners */
.game-overlay-inner {
    background: linear-gradient(145deg, rgba(20, 20, 45, 0.97) 0%, rgba(30, 25, 55, 0.97) 50%, rgba(20, 20, 45, 0.97) 100%);
    border-radius: 24px;
    padding: 36px 44px;
    max-width: 550px;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-shadow:
        0 25px 80px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(255, 255, 255, 0.05),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    position: relative;
    overflow: visible;
}

/* Subtle shimmer effect on the panel */
.game-overlay-inner::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(ellipse at 30% 0%, rgba(139, 92, 246, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 70% 100%, rgba(99, 102, 241, 0.1) 0%, transparent 50%);
    pointer-events: none;
    border-radius: 24px;
}

/* Wider panel for screens with more content */
.game-overlay-inner.game-overlay-wide {
    max-width: 600px;
    padding: 28px 35px;
}

/* Mobile responsive inner panel */
@media (max-width: 600px) {
    .game-overlay-inner {
        padding: 24px 20px;
        margin: 10px;
        border-radius: 20px;
        max-height: calc(100vh - 260px);
    }

    .game-overlay-inner.game-overlay-wide {
        max-width: 100%;
        padding: 20px 16px;
    }
}

/* Smaller screens - more compact */
@media (max-height: 700px) {
    .game-overlay-inner {
        padding: 24px 30px;
        max-height: calc(100vh - 260px);
    }

    .game-overlay-inner.game-overlay-wide {
        padding: 20px 25px;
    }
}

/* Subtle animated background for the overlay area behind the panel */
.game-overlay::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        linear-gradient(180deg, rgba(15, 15, 35, 0.3) 0%, rgba(10, 10, 25, 0.5) 100%),
        radial-gradient(circle at 20% 20%, rgba(99, 102, 241, 0.06) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(168, 85, 247, 0.06) 0%, transparent 50%);
    pointer-events: none;
}

.game-overlay.hidden {
    display: none;
}

.game-overlay h1 {
    font-size: 48px;
    font-weight: 800;
    margin-bottom: 12px;
    letter-spacing: -1px;
    background: linear-gradient(135deg, #c4b5fd 0%, #a78bfa 30%, #818cf8 60%, #6366f1 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    position: relative;
    z-index: 1;
    filter: drop-shadow(0 4px 20px rgba(139, 92, 246, 0.3));
}

.game-overlay h2 {
    font-size: 18px;
    font-weight: 600;
    margin: 28px 0 16px 0;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    letter-spacing: 3px;
    position: relative;
    z-index: 1;
}

.game-overlay p {
    font-size: 15px;
    font-weight: 400;
    margin-bottom: 12px;
    color: rgba(255, 255, 255, 0.65);
    text-align: center;
    position: relative;
    z-index: 1;
    line-height: 1.5;
}

.game-overlay p.instruction {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.4);
    margin-top: 10px;
}

/* Buttons */
.game-button {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: #fff;
    border: none;
    padding: 16px 40px;
    font-family: 'Inter', sans-serif;
    font-size: 16px;
    font-weight: 600;
    border-radius: 14px;
    cursor: pointer;
    margin: 8px;
    transition: all 0.2s ease;
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    min-width: 200px;
    position: relative;
    z-index: 1;
    letter-spacing: 0.3px;
}

.game-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 30px rgba(99, 102, 241, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.game-button:active {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

.game-button.secondary {
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.game-button.secondary:hover {
    background: rgba(255, 255, 255, 0.12);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

/* Difficulty selector */
.difficulty-selector {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin: 20px 0;
    flex-wrap: wrap;
}

.diff-btn {
    padding: 12px 18px;
    border: 2px solid rgba(251, 191, 36, 0.6);
    border-radius: 12px;
    background: rgba(251, 191, 36, 0.08);
    color: rgba(255, 255, 255, 0.9);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s ease;
    font-family: 'Inter', sans-serif;
    backdrop-filter: blur(4px);
}

.diff-btn:hover {
    background: rgba(251, 191, 36, 0.2);
    border-color: rgba(251, 191, 36, 0.8);
    transform: translateY(-2px);
}

.diff-btn.selected {
    background: linear-gradient(135deg, #f59e0b 0%, #fbbf24 100%);
    border-color: #fbbf24;
    color: #1a1a2e;
    font-weight: 600;
    box-shadow: 0 4px 20px rgba(251, 191, 36, 0.4);
}

/* Song selection buttons */
#song-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 10px;
    max-width: 380px;
    width: 100%;
    position: relative;
    z-index: 1;
}

.song-button {
    background: rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    text-align: left;
    padding: 20px 24px;
    border-radius: 16px;
}

.song-button:hover {
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.15);
}

.song-button .song-title {
    display: block;
    font-size: 17px;
    font-weight: 600;
    margin-bottom: 6px;
    color: #fff;
}

.song-button .song-difficulty {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.5);
}

/* Promotional link */
.promo-link {
    display: block;
    margin-top: 20px;
    padding: 12px 18px;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.25s ease;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.promo-link:hover {
    color: #c4b5fd;
    background: rgba(167, 139, 250, 0.12);
    border-color: rgba(167, 139, 250, 0.3);
    transform: translateY(-1px);
}

/* Stats display */
.stat {
    font-size: 15px;
    margin: 10px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: rgba(255, 255, 255, 0.7);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

.stat .value {
    color: #a78bfa;
    font-weight: 700;
    font-size: 18px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

#game-over-stats,
#complete-stats {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 20px 28px;
    border-radius: 14px;
    margin: 20px 0;
    border: 1px solid rgba(255, 255, 255, 0.08);
    min-width: 260px;
    position: relative;
    z-index: 1;
}

#complete-stats h2 {
    margin-top: 0;
    color: #a78bfa;
    font-size: 20px;
    text-align: center;
    margin-bottom: 16px;
}

/* Pause button - positioned inside game-world-container, near lives display */
.pause-button {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(83, 83, 83, 0.8);
    color: #fff;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 16px;
    cursor: pointer;
    z-index: 150;
    transition: background 0.2s;
    pointer-events: auto;
}

.pause-button:hover {
    background: rgba(83, 83, 83, 1);
}

/* Pause screen specific */
#pause-screen h1 {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Game over screen specific */
#game-over-screen {
    justify-content: flex-start;
    padding-top: 30px;
    padding-bottom: 30px;
}

#game-over-screen h1 {
    background: linear-gradient(135deg, #f87171 0%, #ef4444 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    flex-shrink: 0;
}

/* Song complete screen specific */
#song-complete-screen h1 {
    background: linear-gradient(135deg, #4ade80 0%, #22c55e 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Responsive adjustments */
@media (max-height: 600px) {
    .game-overlay h1 {
        font-size: 36px;
    }

    .game-overlay h2 {
        font-size: 22px;
    }

    .game-button {
        padding: 12px 30px;
        font-size: 16px;
    }

    .stat {
        font-size: 16px;
        margin: 6px 0;
    }

    .stat .value {
        font-size: 20px;
    }
}

@media (max-width: 500px) {
    .game-overlay h1 {
        font-size: 32px;
    }

    .game-button {
        min-width: 160px;
        padding: 12px 20px;
    }

    #game-hud {
        font-size: 14px;
    }
}

/* Screen shake animation for misses */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-4px); }
    20%, 40%, 60%, 80% { transform: translateX(4px); }
}

/* Pulse animation for combo */
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* Song title animation */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#song-list .song-button {
    opacity: 0;
    animation: slideIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

#song-list .song-button:nth-child(1) { animation-delay: 0.05s; }
#song-list .song-button:nth-child(2) { animation-delay: 0.1s; }
#song-list .song-button:nth-child(3) { animation-delay: 0.15s; }
#song-list .song-button:nth-child(4) { animation-delay: 0.2s; }
#song-list .song-button:nth-child(5) { animation-delay: 0.25s; }

/* Combo indicator style */
.combo-indicator {
    position: absolute;
    font-size: 24px;
    font-weight: bold;
    color: #fbbf24;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    animation: comboPopup 0.5s ease-out forwards;
    pointer-events: none;
    z-index: 150;
}

@keyframes comboPopup {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateY(-40px) scale(1.5);
    }
}

/* Mobile landscape adjustments */
@media (max-height: 500px) {
    #game-area {
        height: calc(100% - 180px);
        min-height: 150px;
    }
}

/* Settings Button */
#settings-btn {
    position: fixed;
    top: 12px;
    right: 12px;
    background: rgba(83, 83, 83, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: #535353;
    border: 1px solid rgba(83, 83, 83, 0.2);
    width: 44px;
    height: 44px;
    border-radius: 12px;
    font-size: 20px;
    cursor: pointer;
    z-index: 1000;
    transition: all 0.2s ease;
}

#settings-btn:hover {
    background: rgba(83, 83, 83, 0.2);
    color: #333;
    transform: rotate(30deg);
    border-color: rgba(83, 83, 83, 0.3);
}

/* Settings Modal */
#settings-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s, visibility 0.25s;
}

#settings-modal.visible {
    opacity: 1;
    visibility: visible;
}

.settings-panel {
    background: linear-gradient(135deg, rgba(25, 25, 45, 0.95) 0%, rgba(30, 30, 55, 0.95) 100%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    padding: 32px;
    max-width: 380px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    transform: translateY(-20px) scale(0.95);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

#settings-modal.visible .settings-panel {
    transform: translateY(0) scale(1);
}

.settings-panel h2 {
    color: #fff;
    margin: 0 0 28px 0;
    font-size: 22px;
    font-weight: 700;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.settings-section {
    margin-bottom: 28px;
}

.settings-section h3 {
    color: rgba(255, 255, 255, 0.4);
    font-size: 11px;
    font-weight: 600;
    margin: 0 0 14px 0;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.settings-option {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    margin: 8px 0;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s;
}

.settings-option:hover {
    background: rgba(255, 255, 255, 0.1);
}

.settings-option input[type="radio"] {
    display: none;
}

.settings-option .radio-indicator {
    width: 20px;
    height: 20px;
    border: 2px solid #4ade80;
    border-radius: 50%;
    margin-right: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.settings-option input[type="radio"]:checked + .radio-indicator {
    background: #4ade80;
}

.settings-option input[type="radio"]:checked + .radio-indicator::after {
    content: '';
    width: 8px;
    height: 8px;
    background: #1a1a2e;
    border-radius: 50%;
}

.settings-option .option-label {
    color: #fff;
    font-size: 16px;
}

.settings-option .option-example {
    color: #888;
    font-size: 12px;
    margin-left: auto;
}

/* Toggle Switch */
.toggle-switch-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 14px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 12px;
}

.toggle-label {
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
    font-weight: 500;
    min-width: 70px;
    transition: color 0.2s;
}

.toggle-label:first-child {
    text-align: right;
}

.toggle-label:last-child {
    text-align: left;
}

/* Highlight active label */
.toggle-switch-container:has(input:not(:checked)) .toggle-label:first-child {
    color: #a78bfa;
}

.toggle-switch-container:has(input:checked) .toggle-label:last-child {
    color: #a78bfa;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 52px;
    height: 28px;
    flex-shrink: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.15);
    transition: 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    border-radius: 30px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.toggle-switch input:checked + .toggle-slider {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(24px);
}

/* Toggle option row (for show labels) */
.settings-toggle-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    margin: 8px 0;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 12px;
    transition: background 0.15s;
}

.settings-toggle-option:hover {
    background: rgba(255, 255, 255, 0.06);
}

.settings-toggle-option .option-label {
    color: rgba(255, 255, 255, 0.85);
    font-size: 15px;
    font-weight: 500;
}

.settings-note {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
    font-style: italic;
    margin-top: 12px;
    text-align: center;
    line-height: 1.4;
}

.settings-close-btn {
    display: block;
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: #fff;
    border: none;
    border-radius: 14px;
    font-family: 'Inter', sans-serif;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 24px;
    transition: all 0.2s ease;
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.35);
}

.settings-close-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(99, 102, 241, 0.5);
}

/* Settings responsive */
@media (max-height: 500px) {
    .settings-panel {
        padding: 20px;
        max-height: 90vh;
    }

    .settings-panel h2 {
        font-size: 20px;
        margin-bottom: 15px;
    }

    .settings-option {
        padding: 10px 12px;
    }
}

/* ========================================
   ENDLESS MODE STYLES
   ======================================== */

/* Endless mode button - prominent on menu */
.endless-button {
    background: linear-gradient(135deg, #10b981 0%, #34d399 50%, #10b981 100%);
    box-shadow:
        0 4px 20px rgba(16, 185, 129, 0.4),
        0 0 40px rgba(52, 211, 153, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    font-size: 20px;
    font-weight: 700;
    padding: 20px 50px;
    margin-bottom: 16px;
    position: relative;
    z-index: 1;
    letter-spacing: 1px;
    text-transform: uppercase;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.endless-button:hover {
    background: linear-gradient(135deg, #34d399 0%, #6ee7b7 50%, #34d399 100%);
    box-shadow:
        0 8px 30px rgba(16, 185, 129, 0.5),
        0 0 60px rgba(52, 211, 153, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.25);
    transform: translateY(-3px) scale(1.02);
}

/* Level display in HUD */
#level-display {
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid #22c55e;
    padding: 6px 12px;
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
}

#level-display .level-number {
    font-size: 14px;
    font-weight: 700;
    color: #16a34a;
}

#level-display .level-title {
    font-size: 14px;
    font-weight: 600;
    color: #f59e0b;
    max-width: 140px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Level complete banner - toast notification at top */
.level-complete-banner {
    position: absolute;
    top: 60px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 300;
    pointer-events: none;
}

.level-complete-banner.hidden {
    display: none;
}

.level-complete-banner .banner-content {
    background: linear-gradient(135deg, rgba(74, 222, 128, 0.95) 0%, rgba(34, 197, 94, 0.95) 100%);
    padding: 16px 32px;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(74, 222, 128, 0.4), 0 4px 16px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    animation: bannerSlideIn 0.4s ease-out, bannerSlideOut 0.4s ease-in 2s forwards;
}

.level-complete-banner #level-complete-title {
    font-size: 24px;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.level-complete-banner #level-complete-message {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.9);
}

@keyframes bannerSlideIn {
    0% {
        opacity: 0;
        transform: translateY(-20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes bannerSlideOut {
    0% {
        opacity: 1;
        transform: translateY(0);
    }
    100% {
        opacity: 0;
        transform: translateY(-20px);
    }
}

/* Persistent keyboard hint above piano - desktop only */
.piano-keyboard-hint {
    display: none; /* Hidden by default, shown on desktop */
    position: fixed;
    bottom: 250px; /* Just above the piano keyboard */
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    padding: 12px 24px;
    font-size: 15px;
    font-weight: 600;
    color: #1a1a2e;
    letter-spacing: 0.3px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.97) 0%, rgba(245, 245, 255, 0.97) 100%);
    border: 1px solid rgba(99, 102, 241, 0.15);
    border-radius: 14px;
    z-index: 100;
    white-space: nowrap;
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.12),
        0 0 0 1px rgba(255, 255, 255, 0.8),
        inset 0 1px 0 rgba(255, 255, 255, 1);
}

/* Tip icon with tooltip */
.tip-icon {
    position: relative;
    margin-left: 10px;
    cursor: pointer;
    font-size: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: rgba(255, 200, 50, 0.2);
    border-radius: 50%;
    border: 2px solid rgba(255, 180, 0, 0.5);
    transition: all 0.2s ease;
    animation: pulse-glow 2s ease-in-out infinite;
}

.tip-icon:hover {
    background: rgba(255, 200, 50, 0.4);
    border-color: rgba(255, 180, 0, 0.8);
    transform: scale(1.1);
}

/* Stop animation after user has seen the tip */
.tip-icon.seen {
    animation: none;
    box-shadow: 0 0 4px rgba(255, 200, 50, 0.4);
    transform: scale(1);
    background: rgba(255, 200, 50, 0.2);
}

@keyframes pulse-glow {
    0%, 100% {
        box-shadow: 0 0 4px rgba(255, 200, 50, 0.4);
        transform: scale(1);
        background: rgba(255, 200, 50, 0.2);
    }
    50% {
        box-shadow: 0 0 20px rgba(255, 180, 0, 0.9), 0 0 30px rgba(255, 150, 0, 0.5);
        transform: scale(1.15);
        background: rgba(255, 200, 50, 0.5);
    }
}

.tip-tooltip {
    visibility: hidden;
    opacity: 0;
    position: absolute;
    bottom: 130%;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 400;
    white-space: nowrap;
    z-index: 200;
    transition: opacity 0.2s, visibility 0.2s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* Tooltip arrow */
.tip-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: #333;
}

/* Show tooltip on hover and focus */
.tip-icon:hover .tip-tooltip,
.tip-icon:focus .tip-tooltip {
    visibility: visible;
    opacity: 1;
}

/* Show only on desktop (devices with hover capability) */
@media (hover: hover) and (pointer: fine) {
    .piano-keyboard-hint {
        display: block;
    }
}

/* Keyboard hint banner - desktop only (fade out version) */
.keyboard-hint {
    position: fixed;
    bottom: 160px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 250;
    pointer-events: none;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.95) 0%, rgba(139, 92, 246, 0.95) 100%);
    padding: 12px 24px;
    border-radius: 12px;
    box-shadow: 0 6px 24px rgba(99, 102, 241, 0.4), 0 2px 8px rgba(0, 0, 0, 0.3);
    font-size: 15px;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    animation: hintFadeIn 0.4s ease-out, hintFadeOut 0.5s ease-in 4.5s forwards;
}

.keyboard-hint.hidden {
    display: none;
}

@keyframes hintFadeIn {
    0% { opacity: 0; transform: translateX(-50%) translateY(10px); }
    100% { opacity: 1; transform: translateX(-50%) translateY(0); }
}

@keyframes hintFadeOut {
    0% { opacity: 1; transform: translateX(-50%) translateY(0); }
    100% { opacity: 0; transform: translateX(-50%) translateY(10px); }
}

/* All complete screen */
#all-complete-screen h1 {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

#all-complete-stats {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 24px 32px;
    border-radius: 16px;
    margin: 24px 0;
    border: 1px solid rgba(255, 255, 255, 0.08);
    min-width: 280px;
    position: relative;
    z-index: 1;
}

/* Checkpoint indicator animation (pulsing border) */
@keyframes checkpointPulse {
    0%, 100% {
        border-color: rgba(74, 222, 128, 0.3);
        box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.4);
    }
    50% {
        border-color: rgba(74, 222, 128, 0.6);
        box-shadow: 0 0 20px 4px rgba(74, 222, 128, 0.3);
    }
}

#level-display.checkpoint-reached {
    animation: checkpointPulse 1s ease-in-out 3;
}

/* Settings - Endless Mode section */
.settings-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    margin: 8px 0;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 12px;
}

.settings-row .option-label {
    color: rgba(255, 255, 255, 0.85);
    font-size: 15px;
    font-weight: 500;
}

.settings-select {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.15);
    padding: 8px 12px;
    border-radius: 8px;
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    cursor: pointer;
    min-width: 120px;
}

.settings-select:hover {
    background: rgba(255, 255, 255, 0.15);
}

.settings-select option {
    background: #1a1a2e;
    color: #fff;
}

.settings-action-btn {
    display: block;
    width: 100%;
    padding: 14px;
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #f87171;
    border-radius: 12px;
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    margin-top: 12px;
    transition: all 0.2s ease;
}

.settings-action-btn:hover {
    background: rgba(239, 68, 68, 0.25);
    border-color: rgba(239, 68, 68, 0.5);
}

/* ========================================
   LIFE-LOST REASON BANNER
   ======================================== */

.life-lost-banner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 250;
    pointer-events: none;
    background: rgba(239, 68, 68, 0.9);
    color: #fff;
    padding: 12px 32px;
    border-radius: 12px;
    font-family: 'Inter', sans-serif;
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 24px rgba(239, 68, 68, 0.5), 0 0 0 2px rgba(255, 255, 255, 0.15);
    animation: lifeLostIn 0.3s ease-out, lifeLostOut 0.4s ease-in 1s forwards;
}

.life-lost-banner.hidden {
    display: none;
}

@keyframes lifeLostIn {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.7);
    }
    100% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

@keyframes lifeLostOut {
    0% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.8) translateY(-10px);
    }
}

/* New note introduction banner (celebratory) */
.new-note-banner {
    position: absolute;
    top: 30%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 250;
    pointer-events: none;
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.95) 0%, rgba(16, 185, 129, 0.95) 100%);
    color: #fff;
    padding: 16px 40px;
    border-radius: 16px;
    font-family: 'Inter', sans-serif;
    font-size: 26px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    box-shadow: 0 6px 30px rgba(34, 197, 94, 0.5), 0 0 0 3px rgba(255, 255, 255, 0.2);
    animation: newNoteIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), newNoteOut 0.5s ease-in 2s forwards;
}

.new-note-banner.hidden {
    display: none;
}

@keyframes newNoteIn {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.5) rotate(-5deg);
    }
    100% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1) rotate(0deg);
    }
}

@keyframes newNoteOut {
    0% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(1.1) translateY(-20px);
    }
}

/* ========================================
   GAME OVER TRANSITION
   ======================================== */

.game-over-transition {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, 0.6);
    z-index: 250;
    animation: gameOverBgFade 0.5s ease-out;
}

.game-over-transition.hidden {
    display: none;
}

.game-over-text {
    font-family: 'Inter', sans-serif;
    font-size: 72px;
    font-weight: 800;
    letter-spacing: 4px;
    color: #fff;
    text-shadow:
        0 0 20px rgba(239, 68, 68, 0.8),
        0 0 60px rgba(239, 68, 68, 0.5),
        0 4px 8px rgba(0, 0, 0, 0.5);
    background: linear-gradient(135deg, #f87171 0%, #ef4444 50%, #dc2626 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gameOverTextIn 0.6s cubic-bezier(0.16, 1, 0.3, 1);
    filter: drop-shadow(0 4px 12px rgba(239, 68, 68, 0.6));
}

@keyframes gameOverBgFade {
    0% {
        background: rgba(0, 0, 0, 0);
    }
    100% {
        background: rgba(0, 0, 0, 0.6);
    }
}

@keyframes gameOverTextIn {
    0% {
        opacity: 0;
        transform: scale(2.5);
    }
    60% {
        opacity: 1;
        transform: scale(0.95);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

@media (max-width: 500px) {
    .game-over-text {
        font-size: 48px;
        letter-spacing: 2px;
    }

    .life-lost-banner {
        font-size: 18px;
        padding: 10px 24px;
    }
}

/* ========================================
   HIGH SCORE UI STYLES
   ======================================== */

/* Big score display */
.stat.big-score {
    font-size: 20px;
    margin-bottom: 16px;
}

.stat.big-score .value {
    font-size: 28px;
    color: #fbbf24;
}

/* High score section */
.high-score-section {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 20px 24px;
    border-radius: 16px;
    margin: 16px 0;
    border: 1px solid rgba(255, 255, 255, 0.08);
    min-width: 320px;
    position: relative;
    z-index: 1;
}

.high-score-section.hidden {
    display: none;
}

.high-score-prompt {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 16px;
}

.trophy-icon {
    font-size: 24px;
}

.high-score-text {
    font-size: 16px;
    font-weight: 600;
    color: #fbbf24;
}

.name-input-row {
    display: flex;
    gap: 10px;
    align-items: center;
}

#player-name-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    padding: 12px 16px;
    font-family: 'Inter', sans-serif;
    font-size: 15px;
    color: #fff;
    outline: none;
    transition: border-color 0.2s, background 0.2s;
}

#player-name-input:focus {
    border-color: rgba(167, 139, 250, 0.6);
    background: rgba(255, 255, 255, 0.15);
}

#player-name-input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.submit-btn {
    padding: 12px 20px;
    min-width: auto;
    font-size: 14px;
}

.submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.submit-status {
    margin-top: 12px;
    font-size: 14px;
    text-align: center;
    min-height: 20px;
}

.submit-status.success {
    color: #4ade80;
}

.submit-status.error {
    color: #f87171;
}

.rank-result {
    display: block;
    font-weight: 600;
}

/* Prominent rank display after submission */
.rank-result-container {
    background: linear-gradient(135deg, rgba(74, 222, 128, 0.15) 0%, rgba(34, 197, 94, 0.1) 100%);
    border: 1px solid rgba(74, 222, 128, 0.3);
    border-radius: 12px;
    padding: 16px;
    margin-top: 8px;
}

.rank-header {
    font-size: 18px;
    font-weight: 700;
    color: #4ade80;
    text-align: center;
    margin-bottom: 12px;
}

.rank-details {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.rank-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
}

.rank-label {
    font-size: 15px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.85);
}

.rank-value {
    font-size: 20px;
    font-weight: 700;
    color: #fbbf24;
}

/* Record type styling */
.rank-result-container.world-record {
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.2) 0%, rgba(245, 158, 11, 0.15) 100%);
    border-color: rgba(251, 191, 36, 0.5);
    animation: recordPulse 1s ease-in-out 3;
}

.rank-result-container.world-record .rank-header {
    color: #fbbf24;
    font-size: 20px;
}

.rank-result-container.country-record {
    background: linear-gradient(135deg, rgba(167, 139, 250, 0.2) 0%, rgba(139, 92, 246, 0.15) 100%);
    border-color: rgba(167, 139, 250, 0.5);
}

.rank-result-container.country-record .rank-header {
    color: #a78bfa;
    font-size: 18px;
}

.rank-result-container.city-record {
    background: linear-gradient(135deg, rgba(96, 165, 250, 0.2) 0%, rgba(59, 130, 246, 0.15) 100%);
    border-color: rgba(96, 165, 250, 0.5);
}

.rank-result-container.city-record .rank-header {
    color: #60a5fa;
    font-size: 18px;
}

@keyframes recordPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

/* Leaderboard section */
.leaderboard-section {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 14px;
    margin: 16px 0;
    border: 1px solid rgba(255, 255, 255, 0.08);
    min-width: 320px;
    max-width: 400px;
    position: relative;
    z-index: 1;
    flex-shrink: 0;
}

.leaderboard-section.hidden {
    display: none;
}

/* Leaderboard tabs */
.leaderboard-tabs {
    display: flex;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.tab-btn {
    flex: 1;
    background: transparent;
    border: none;
    padding: 12px 8px;
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.tab-btn:hover {
    color: rgba(255, 255, 255, 0.8);
    background: rgba(255, 255, 255, 0.05);
}

.tab-btn.active {
    color: #a78bfa;
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 20%;
    right: 20%;
    height: 2px;
    background: linear-gradient(90deg, #6366f1, #a78bfa);
    border-radius: 2px 2px 0 0;
}

/* Leaderboard content */
.leaderboard-content {
    padding: 12px 14px;
    min-height: 100px;
    max-height: 180px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.2) transparent;
}

.leaderboard-scope {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.4);
    text-align: center;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.leaderboard-loading,
.leaderboard-error,
.leaderboard-empty {
    text-align: center;
    padding: 24px;
    color: rgba(255, 255, 255, 0.5);
    font-size: 14px;
}

.leaderboard-error {
    color: #f87171;
}

/* Location unavailable message */
.leaderboard-unavailable {
    text-align: center;
    padding: 32px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.unavailable-icon {
    font-size: 32px;
    opacity: 0.6;
}

.unavailable-text {
    font-size: 15px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.7);
}

.unavailable-hint {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.4);
    max-width: 200px;
}

/* Leaderboard entries */
.leaderboard-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-height: 50px;
}

.leaderboard-entry {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 10px;
    gap: 10px;
    transition: background 0.15s;
}

.leaderboard-entry:hover {
    background: rgba(255, 255, 255, 0.06);
}

.leaderboard-entry.current-player {
    background: rgba(167, 139, 250, 0.15);
    border: 1px solid rgba(167, 139, 250, 0.3);
}

.leaderboard-entry.your-rank {
    margin-top: 8px;
    border-top: 1px dashed rgba(255, 255, 255, 0.1);
    padding-top: 14px;
}

.entry-rank {
    font-size: 14px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.6);
    min-width: 28px;
    text-align: center;
}

.leaderboard-entry.rank-1 .entry-rank {
    color: #fbbf24;
    font-size: 16px;
}

.leaderboard-entry.rank-2 .entry-rank {
    color: #d1d5db;
}

.leaderboard-entry.rank-3 .entry-rank {
    color: #cd7f32;
}

.entry-name {
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.entry-location {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.4);
    flex-shrink: 0;
}

.entry-score {
    font-size: 14px;
    font-weight: 700;
    color: #a78bfa;
    min-width: 60px;
    text-align: right;
}

/* Game over buttons container */
.game-over-buttons {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    margin-top: 16px;
}

/* ========================================
   GAME OVER SCREEN - Compact styles
   ======================================== */

#game-over-screen .game-overlay-inner {
    padding: 20px 28px;
    max-height: calc(100vh - 270px);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.2) transparent;
}

#game-over-screen h1 {
    font-size: 36px;
    margin-bottom: 6px;
}

#game-over-screen #game-over-stats {
    padding: 12px 20px;
    margin: 8px 0;
}

#game-over-screen .stat {
    font-size: 13px;
    margin: 5px 0;
}

#game-over-screen .stat .value {
    font-size: 15px;
}

#game-over-screen .game-button {
    padding: 11px 28px;
    font-size: 14px;
    min-width: 150px;
    margin: 3px;
}

#game-over-screen .game-over-buttons {
    margin-top: 8px;
    gap: 0;
}

#game-over-screen .promo-link {
    margin-top: 8px;
    margin-bottom: 8px;
    padding: 6px 12px;
    font-size: 11px;
}

/* Leaderboard at bottom - has its own scroll */
#game-over-screen .leaderboard-section {
    margin: 6px 0 0 0;
    min-width: 280px;
    max-width: 340px;
    width: 100%;
}

#game-over-screen .leaderboard-content {
    max-height: 120px;
    padding: 8px 10px;
    overflow-y: auto;
}

#game-over-screen .tab-btn {
    padding: 8px 4px;
    font-size: 11px;
}

#game-over-screen .leaderboard-entry {
    padding: 5px 8px;
}

#game-over-screen .leaderboard-scope {
    font-size: 9px;
    margin-bottom: 6px;
}

#game-over-screen .entry-rank,
#game-over-screen .entry-name,
#game-over-screen .entry-score {
    font-size: 12px;
}

/* ========================================
   MENU LEADERBOARD SCREEN
   ======================================== */

.menu-leaderboard-section {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 16px;
    margin: 24px 0;
    border: 1px solid rgba(255, 255, 255, 0.08);
    min-width: 340px;
    max-width: 420px;
    width: 90%;
    position: relative;
    z-index: 1;
    overflow: hidden;
}

.menu-leaderboard-tabs {
    display: flex;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.menu-tab-btn {
    flex: 1;
    background: transparent;
    border: none;
    padding: 14px 8px;
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.menu-tab-btn:hover {
    color: rgba(255, 255, 255, 0.8);
    background: rgba(255, 255, 255, 0.05);
}

.menu-tab-btn.active {
    color: #fbbf24;
}

.menu-tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 15%;
    right: 15%;
    height: 3px;
    background: linear-gradient(90deg, #fbbf24, #f59e0b);
    border-radius: 3px 3px 0 0;
}

.menu-leaderboard-content {
    padding: 20px;
    max-height: 350px;
    overflow-y: auto;
}

/* Responsive adjustments for high score UI */
@media (max-width: 400px) {
    .high-score-section,
    .leaderboard-section {
        min-width: 280px;
    }

    .name-input-row {
        flex-direction: column;
    }

    .submit-btn {
        width: 100%;
    }

    .tab-btn {
        font-size: 11px;
        padding: 10px 4px;
    }

    .entry-location {
        display: none;
    }
}
