:root {
        /* New Color Palette - More refined and vibrant */
        --primary-bg: #0a0a0a; /* Even darker background */
        --secondary-bg: #1a1a1a; /* Darker for containers */
        --accent-color: #7b2cbf; /* Deeper Blue Violet */
        --accent-light: #9d4edd; /* Brighter Blue Violet */
        --text-color-light: #f0f0f0; /* Brighter light text */
        --text-color-dark: #b0b0b0; /* Slightly lighter dark text */
        --border-color: #2a2a2a; /* Darker, more subtle border */
        --button-bg: var(--accent-color);
        --button-hover-bg: var(--accent-light);
        --input-bg: #222222;
        --input-border: #3a3a3a;
        --navbar-bg: rgba(26, 26, 26, 0.8); /* Semi-transparent for frosted glass effect */
        --overlay-bg: rgba(0, 0, 0, 0.85); /* Darker for overlays */

        /* Playfield Scale Variable */
        --playfield-scale: 1.3; /* Adjust this value to change overall playfield size */

        /* Note Colors (can be customized further) */
        --note-color-1: #00c0ff; /* Brighter Deep Sky Blue */
        --note-color-2: #ff5cb4; /* Brighter Hot Pink */
        --note-color-3: #8aff8a; /* Light Green */
        --note-color-4: #ffcc00; /* Gold */

        /* Judgment Colors */
        --judgment-max: #ffe033; /* Brighter Yellow */
        --judgment-300: #4caf50; /* Green */
        --judgment-100: #2196f3; /* Blue */
        --judgment-50: #ff9800; /* Orange */
        --judgment-miss: #f44336; /* Red */

        /* Game Area Dimensions - scaled by --playfield-scale */
        --lane-width: calc(80px * var(--playfield-scale));
        --note-size: calc(70px * var(--playfield-scale));
        --game-area-height: calc(600px * var(--playfield-scale));
        --key-button-size: calc(70px * var(--playfield-scale));
        --judgment-offset: calc(50px * var(--playfield-scale)); /* Distance from bottom of game area to receptor center */

        /* Compactness adjustments */
        --menu-section-padding: 15px;
        --menu-section-margin-bottom: 15px;
        --menu-button-margin-top: 20px;
        --instruction-margin-top: 20px;
    }

    body {
        margin: 0;
        font-family: 'Inter', sans-serif; /* Modern font */
        background-color: var(--primary-bg);
        color: var(--text-color-light);
        display: flex;
        justify-content: center;
        align-items: center;
        height: 100vh; /* Changed from min-height */
        overflow: hidden; /* Ensure no body scrolling */
        user-select: none;
        position: relative;
        font-size: 16px;
    }

    /* This is the container for the main game, NOT the start screen */
    .game-container {
        background-color: var(--secondary-bg);
        border-radius: 20px;
        box-shadow: 0 15px 40px rgba(0, 0, 0, 0.6);
        padding: 25px;
        text-align: center;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        position: relative;
        overflow: hidden;
        border: 1px solid var(--border-color);
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        height: 100%;
        max-height: 100%;
    }

    /* Generic hidden class - This is the key to the fix */
    .hidden {
        display: none !important;
    }

    /* --- Animations --- */
    .anim-fade-in {
        animation: fadeInAnimation 0.4s ease-out forwards;
    }

    @keyframes fadeInAnimation {
        from { opacity: 0; }
        to { opacity: 1; }
    }

    /* Screen containers */
    .menu-screen, .game-screen, .results-screen {
        flex-grow: 1;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        position: absolute;
        width: 100%;
        height: 100%;
        top: 0;
        left: 0;
        box-sizing: border-box;
        z-index: 1;
    }

    /* Start Screen - now a fullscreen overlay */
    .start-screen {
        position: absolute;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        z-index: 10;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        background-color: var(--primary-bg);
        overflow: hidden;
    }

    .particle-background {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: 
            radial-gradient(circle at 20% 30%, rgba(157, 78, 221, 0.15) 0%, transparent 40%),
            radial-gradient(circle at 80% 70%, rgba(0, 192, 255, 0.15) 0%, transparent 40%),
            radial-gradient(circle at 50% 10%, rgba(255, 92, 180, 0.1) 0%, transparent 30%),
            radial-gradient(circle at 10% 90%, rgba(138, 43, 226, 0.2) 0%, transparent 50%),
            radial-gradient(circle at 90% 10%, rgba(157, 78, 221, 0.1) 0%, transparent 40%),
            radial-gradient(circle at 30% 80%, rgba(0, 192, 255, 0.1) 0%, transparent 35%);
        background-size: 400% 400%;
        animation: moveParticles 25s infinite linear;
        filter: blur(10px);
        z-index: -1;
    }

    @keyframes moveParticles {
        0% { background-position: 0% 50%; }
        50% { background-position: 100% 50%; }
        100% { background-position: 0% 50%; }
    }

    .file-input-circle-wrapper {
        position: relative;
        width: 200px;
        height: 200px;
        perspective: 1000px; /* For 3D rotation */
    }

    .file-input-circle-label {
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        width: 100%;
        height: 100%;
        border-radius: 50%;
        background-color: var(--accent-color);
        box-shadow: 0 0 30px var(--accent-light), inset 0 0 15px var(--accent-light);
        cursor: pointer;
        transition: all 0.3s ease;
        position: relative;
        overflow: hidden;
        animation: float 3s infinite alternate ease-in-out; /* Changed to float */
        border: 3px solid var(--accent-light);
    }

    .file-input-circle-label:hover {
        transform: scale(1.05);
        box-shadow: 0 0 40px var(--accent-light), inset 0 0 20px var(--accent-light);
    }

    .file-input-circle-label .circle-image {
        width: 100%;
        height: 100%;
        object-fit: cover;
        border-radius: 50%;
        position: absolute;
        top: 0;
        left: 0;
        transition: opacity 0.3s ease;
        opacity: 1;    
    }

    .file-input-circle-label:hover .circle-image {
        opacity: 0.5;
    }

    .file-input-circle-label .circle-text {
        position: relative;
        z-index: 1;
        font-size: 1.5em;
        font-weight: 600;
        color: var(--text-color-light);
        text-shadow: 0 0 5px rgba(0,0,0,0.5);
    }

    .start-instructions {
        position: absolute;
        bottom: 25%;
        left: 50%;
        transform: translateX(-50%);
        width: 90%;
        font-size: 0.9em;
        color: var(--text-color-dark);
        text-align: center;
    }

    @keyframes float {
        0% { transform: translateY(0px); }
        50% { transform: translateY(-10px); }
        100% { transform: translateY(0px); }
    }

    /* Menu Screen (Map Overview) */
    .menu-screen {
        justify-content: flex-start; /* Align content to top */
        padding-bottom: 100px; /* Make space for navbar */
    }

    .map-background-overlay {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background-size: cover;
        background-position: center;
        filter: blur(15px); /* Strong blur */
        opacity: 0.2; /* Subtle background */
        z-index: -1;
        transition: background-image 0.5s ease-in-out;
    }

    .menu-header {
        width: 100%;
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding-bottom: 20px;
    }

    .menu-back-button, .menu-customize-button {
        padding: 8px 15px;
        font-size: 0.9em;
        border-radius: 6px;
        background-color: #3a3a3a;
        color: var(--text-color-light);
        border: 1px solid #555;
        cursor: pointer;
        transition: all 0.2s ease;
    }

    .menu-back-button:hover, .menu-customize-button:hover {
        background-color: #555;
        transform: translateY(-2px);
    }


    .menu-content {
        flex-grow: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        width: 100%;
        padding-top: 20px;
    }

    .map-title {
        font-size: 2.2em;
        color: var(--text-color-light);
        margin-bottom: 25px;
        text-shadow: 0 0 10px rgba(0,0,0,0.5);
    }

    .difficulty-list-container {
        display: flex;
        flex-direction: column;
        gap: 10px;
        width: 90%;
        max-width: 400px;
        background-color: rgba(0, 0, 0, 0.4); /* Semi-transparent background for list */
        border-radius: 12px;
        padding: 15px;
        border: 1px solid rgba(255, 255, 255, 0.1);
        box-shadow: inset 0 0 10px rgba(0,0,0,0.5);
        max-height: calc(100vh - 300px); /* Adjust based on screen height and other elements */
        overflow-y: auto; /* Allow scrolling if many difficulties, but try to avoid */
        -ms-overflow-style: none;  /* IE and Edge */
        scrollbar-width: none;  /* Firefox */
    }

    .difficulty-list-container::-webkit-scrollbar {
        display: none; /* Chrome, Safari, Opera */
    }

    .difficulty-item {
        padding: 12px 20px;
        background-color: rgba(42, 42, 42, 0.7);
        border-radius: 8px;
        cursor: pointer;
        transition: all 0.2s ease-in-out;
        font-size: 1.1em;
        font-weight: 400;
        color: var(--text-color-light);
        border: 1px solid transparent;
        text-align: left;
    }

    .difficulty-item:hover {
        background-color: var(--accent-color);
        transform: translateY(-3px);
        box-shadow: 0 5px 15px rgba(138, 43, 226, 0.4);
        border-color: var(--accent-light);
    }

    .difficulty-item.active {
        background-color: var(--accent-light);
        color: var(--primary-bg);
        font-weight: 600;
        border-color: var(--text-color-light);
        box-shadow: 0 0 20px var(--accent-light);
        transform: scale(1.02);
    }

    /* Navbar */
    .navbar {
        position: absolute;
        bottom: 0;
        left: 0;
        width: 100%;
        background-color: var(--navbar-bg);
        backdrop-filter: blur(10px); /* Frosted glass effect */
        border-top: 1px solid var(--border-color);
        padding: 15px 25px;
        display: flex;
        justify-content: space-around;
        align-items: center;
        gap: 15px;
        box-sizing: border-box;
        border-radius: 0 0 20px 20px; /* Match container border radius */
        z-index: 20;
    }

    .navbar-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 5px;
        flex-grow: 1;
        min-width: 80px;
    }

    .navbar-label {
        font-size: 0.85em;
        color: var(--text-color-dark);
        white-space: nowrap;
    }

    .navbar-slider {
        width: 100%;
        -webkit-appearance: none;
        height: 6px;
        background: var(--input-bg);
        border-radius: 3px;
        outline: none;
        opacity: 0.7;
        transition: opacity .2s;
    }

    .navbar-slider:hover {
        opacity: 1;
    }

    .navbar-slider::-webkit-slider-thumb {
        -webkit-appearance: none;
        appearance: none;
        width: 16px;
        height: 16px;
        border-radius: 50%;
        background: var(--accent-color);
        cursor: pointer;
        box-shadow: 0 0 5px var(--accent-light);
    }

    .navbar-slider::-moz-range-thumb {
        width: 16px;
        height: 16px;
        border-radius: 50%;
        background: var(--accent-color);
        cursor: pointer;
        box-shadow: 0 0 5px var(--accent-light);
    }

    .navbar-value {
        font-size: 0.9em;
        color: var(--text-color-light);
        font-weight: 600;
        cursor: pointer; /* Make it clear it's clickable */
    }

    .navbar-value-input {
        width: 100%;
        background-color: var(--input-bg);
        border: 1px solid var(--input-border);
        border-radius: 5px;
        color: var(--text-color-light);
        font-size: 0.9em;
        font-weight: 600;
        text-align: center;
        padding: 2px 0;
        box-sizing: border-box;
    }


    .navbar-checkbox {
        -webkit-appearance: none;
        appearance: none;
        width: 20px;
        height: 20px;
        border: 2px solid var(--input-border);
        border-radius: 5px;
        background-color: var(--input-bg);
        cursor: pointer;
        position: relative;
        transition: all 0.2s ease;
    }

    .navbar-checkbox:checked {
        background-color: var(--accent-color);
        border-color: var(--accent-light);
    }

    .navbar-checkbox:checked::after {
        content: '✔';
        font-size: 14px;
        color: var(--text-color-light);
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
    }

    .navbar-button {
        padding: 10px 15px;
        background-color: var(--button-bg);
        color: var(--text-color-light);
        border: none;
        border-radius: 8px;
        cursor: pointer;
        font-size: 0.9em;
        font-weight: 600;
        transition: all 0.2s ease;
        white-space: nowrap;
    }

    .navbar-button:hover {
        background-color: var(--button-hover-bg);
        transform: translateY(-2px);
        box-shadow: 0 5px 15px rgba(138, 43, 226, 0.4);
    }

    .navbar-button:disabled {
        background-color: #3a3a3a;
        color: #777;
        cursor: not-allowed;
        transform: none;
        box-shadow: none;
    }

    .primary-button {
        background-color: var(--accent-color);
        box-shadow: 0 0 15px rgba(138, 43, 226, 0.6);
    }

    .primary-button:hover {
        background-color: var(--accent-light);
        box-shadow: 0 0 25px rgba(138, 43, 226, 0.8);
    }

    /* Keybinds & Customize Overlay Animations */
    .keybinds-overlay, .customize-overlay {
        background-color: var(--overlay-bg);
        backdrop-filter: blur(8px);
        justify-content: center;
        align-items: center;
        z-index: 30;
        position: absolute;
        width: 100%;
        height: 100%;
        top: 0;
        left: 0;
        box-sizing: border-box;
        display: flex;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease, visibility 0s linear 0.3s;
    }

    .keybinds-overlay.visible, .customize-overlay.visible {
        opacity: 1;
        visibility: visible;
        transition: opacity 0.3s ease, visibility 0s linear 0s;
    }

    .overlay-content {
        background-color: var(--secondary-bg);
        border-radius: 15px;
        padding: 30px;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7);
        width: 90%;
        max-width: 450px;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 20px;
        border: 1px solid var(--border-color);
        transform: scale(0.95) translateY(10px);
        opacity: 0;
        transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1), opacity 0.3s ease;
    }

    .keybinds-overlay.visible .overlay-content, .customize-overlay.visible .overlay-content {
        transform: scale(1) translateY(0);
        opacity: 1;
    }

    .overlay-title {
        font-size: 1.8em;
        color: var(--accent-light);
        margin-bottom: 10px;
    }

    .keybind-grid, .color-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
        width: 100%;
    }

    .keybind-item, .color-item {
        display: flex;
        justify-content: space-between;
        align-items: center;
        background-color: var(--input-bg);
        padding: 10px 15px;
        border-radius: 8px;
        border: 1px solid var(--input-border);
    }

    .keybind-label, .color-label {
        font-size: 1em;
        color: var(--text-color-light);
    }

    .keybind-button {
        padding: 8px 15px;
        background-color: #3a3a3a;
        color: var(--text-color-light);
        border: 1px solid #555;
        border-radius: 6px;
        cursor: pointer;
        font-size: 0.9em;
        font-weight: 600;
        transition: all 0.2s ease;
        min-width: 60px;
        text-align: center;
    }

    .keybind-button:hover {
        background-color: #555;
        border-color: var(--accent-color);
    }

    .keybind-button.listening {
        background-color: var(--accent-color);
        border-color: var(--accent-light);
        color: var(--primary-bg);
        animation: pulse-keybind 1s infinite alternate;
    }

    @keyframes pulse-keybind {
        0% { transform: scale(1); }
        100% { transform: scale(1.05); }
    }

    .overlay-close-button {
        padding: 10px 20px;
        background-color: #555;
        color: var(--text-color-light);
        border: none;
        border-radius: 8px;
        cursor: pointer;
        font-size: 1em;
        font-weight: 600;
        transition: all 0.2s ease;
        margin-top: 10px;
    }

    .overlay-close-button:hover {
        background-color: #777;
        transform: translateY(-2px);
    }

    /* Customize Overlay */
    .color-input {
        -webkit-appearance: none;
        -moz-appearance: none;
        appearance: none;
        width: 40px;
        height: 25px;
        border: none;
        background: none;
        cursor: pointer;
        padding: 0;
        border-radius: 4px;
        overflow: hidden;
    }

    .color-input::-webkit-color-swatch-wrapper {
        padding: 0;
    }

    .color-input::-webkit-color-swatch {
        border: 1px solid var(--input-border);
        border-radius: 4px;
    }

    .color-input::-moz-color-swatch-wrapper {
        padding: 0;
    }

    .color-input::-moz-color-swatch {
        border: 1px solid var(--input-border);
        border-radius: 4px;
    }


    /* Game Screen */
    .game-screen {
        display: flex;
        flex-direction: column;
        align-items: center;
        width: 100%;
        position: relative;
        padding-top: 15px;
    }

    .game-header {
        width: 100%;
        display: flex;
        justify-content: flex-start;
        padding-bottom: 10px;
    }

    .game-back-button {
        padding: 8px 15px;
        font-size: 0.9em;
        border-radius: 6px;
        background-color: #3a3a3a;
        color: var(--text-color-light);
        border: 1px solid #555;
        cursor: pointer;
        transition: all 0.2s ease;
    }

    .game-back-button:hover {
        background-color: #555;
        transform: translateY(-2px);
    }

    .game-area {
        position: relative;
        width: calc(var(--lane-width) * 4);
        height: var(--game-area-height);
        background-color: #000000;
        border-radius: 15px;
        overflow: hidden; /* Ensures notes disappear when they fall out */
        border: 2px solid var(--border-color);
        display: flex;
        justify-content: space-around;
        box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.8);
    }

    /* Note Columns */
    .note-column {
        position: relative;
        width: var(--lane-width); /* Set lane width */
        height: 100%;
        overflow: hidden;
        border-right: 1px solid rgba(255, 255, 255, 0.05); /* Subtle lane separator */
    }
    .note-column:last-child {
        border-right: none; /* No border on the last lane */
    }

    /* Notes */
    .note {
        position: absolute;
        width: var(--note-size);
        height: var(--note-size);
        border-radius: 50%;
        z-index: 2; /* Ensure notes are above other elements if needed */
        /* Removed transition for background-color, as notes should just fall off */
    }

    /* New class for notes that have been hit or missed - makes them instantly invisible */
    .note.hit-or-missed {
        opacity: 0;
        transition: none; /* No transition for instant disappearance */
    }

    /* Lane-specific note colors and shadows */
    .note.note-column-0 {
        background-color: var(--note-color-1);
        box-shadow: 0 0 15px var(--note-color-1); /* Glow effect */
    }

    .note.note-column-1 {
        background-color: var(--note-color-2);
        box-shadow: 0 0 15px var(--note-color-2); /* Glow effect */
    }

    .note.note-column-2 {
        background-color: var(--note-color-3);
        box-shadow: 0 0 15px var(--note-color-3); /* Glow effect */
    }

    .note.note-column-3 {
        background-color: var(--note-color-4);
        box-shadow: 0 0 15px var(--note-color-4); /* Glow effect */
    }


    /* Accuracy and Combo Overlays */
    .accuracy-display-overlay {
        position: absolute;
        top: 5%;
        left: 50%;
        transform: translateX(-50%);
        font-size: 1.6em;
        font-weight: 800;
        color: var(--text-color-light);
        text-shadow: 0 0 10px rgba(0,0,0,0.8);
        z-index: 10;
    }

    .combo-display-overlay {
        position: absolute;
        top: 45%;
        left: 50%;
        transform: translateX(-50%);
        font-size: 3.5em;
        font-weight: 800;
        color: var(--text-color-light);
        text-shadow: 0 0 15px rgba(0,0,0,0.8);
        z-index: 10;
    }

    .key-display {
        position: absolute;
        bottom: var(--judgment-offset);
        left: 0;
        width: 100%;
        display: flex;
        justify-content: space-around;
        padding-bottom: 0px;
    }

    .key-button {
        width: var(--key-button-size);
        height: var(--key-button-size);
        border-radius: 50%;
        border: 2px solid var(--border-color);
        box-shadow: 0 0 8px rgba(255, 255, 255, 0.15);
        background-color: rgba(255, 255, 255, 0.05); /* Subtle fill */
        transition: background-color 0.1s ease, box-shadow 0.1s ease;
    }

    .key-button.active {
        background-color: rgba(138, 43, 226, 0.4);
        box-shadow: 0 0 25px var(--accent-color), inset 0 0 12px var(--accent-color);
    }

    /* Judgment Text */
    .judgment-text {
        position: absolute;
        top: calc(45% + 3.5em + 10px); /* Below combo, adjusted for font size */
        left: 50%;
        transform: translateX(-50%);
        font-size: 2em;
        font-weight: 700;
        opacity: 1;
        transition: opacity 0.4s ease-out, transform 0.4s ease-out;
        z-index: 11;
        pointer-events: none;
    }

    .judgment-max { color: var(--judgment-max); text-shadow: 0 0 10px var(--judgment-max); }
    .judgment-300 { color: var(--judgment-300); text-shadow: 0 0 10px var(--judgment-300); }
    .judgment-100 { color: var(--judgment-100); text-shadow: 0 0 10px var(--judgment-100); }
    .judgment-50 { color: var(--judgment-50); text-shadow: 0 0 10px var(--judgment-50); }
    .judgment-miss { color: var(--judgment-miss); text-shadow: 0 0 10px var(--judgment-miss); }

    /* Song Progress Bar */
    .song-progress-bar {
        width: calc(var(--lane-width) * 4);
        height: 10px;
        margin-top: 15px;
        background-color: #3a3a3a;
        border-radius: 5px;
        overflow: hidden;
        border: 1px solid var(--border-color);
    }

    .progress-fill {
        height: 100%;
        width: 0%;
        background-color: var(--accent-color);
        border-radius: 5px;
        transition: width 0.1s linear;
    }

    /* Results Screen */
    .results-screen {
        padding: 20px 10px;
    }

    .results-title {
        font-size: 2.5em;
        margin-bottom: 25px;
        color: var(--accent-light);
    }

    .results-summary p {
        font-size: 1.1em;
        margin: 8px 0;
        color: var(--text-color-light);
    }

    .rank-display {
        font-size: 2.2em;
        margin-top: 20px;
        font-weight: 800;
        color: var(--judgment-max); /* Default rank color */
    }

    .judgment-counts {
        margin-top: 25px;
        padding: 15px;
        border-radius: 12px;
        background-color: rgba(0, 0, 0, 0.4);
        border: 1px solid var(--border-color);
        box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.3);
    }

    .judgment-counts h3 {
        font-size: 1.3em;
        margin-bottom: 15px;
        padding-bottom: 8px;
        border-bottom: 1px solid var(--border-color);
        color: var(--text-color-light);
    }

    .judgment-counts p {
        font-size: 1.1em;
        margin: 6px 0;
        padding: 0 15px;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .judgment-counts p span {
        font-weight: 600;
        color: var(--text-color-light);
    }

    .results-buttons {
        display: flex;
        justify-content: center;
        gap: 20px;
        margin-top: 25px;
    }

    .results-buttons .results-button {
        padding: 10px 20px;
        font-size: 1em;
        border-radius: 8px;
        background-color: var(--button-bg);
        color: var(--text-color-light);
        border: none;
        cursor: pointer;
        font-weight: 600;
        transition: all 0.2s ease;
    }

    .results-buttons .results-button:hover {
        background-color: var(--button-hover-bg);
        transform: translateY(-2px);
        box-shadow: 0 5px 15px rgba(138, 43, 226, 0.4);
    }


    /* Responsive adjustments */
    @media (max-width: 768px) {
        .game-container {
            padding: 15px;
            border-radius: 15px;
            max-width: 98%;
            height: 98vh;
        }

        .file-input-circle-wrapper {
            width: 160px;
            height: 160px;
        }

        .file-input-circle-label .circle-text {
            font-size: 1.3em;
        }

        .start-instructions {
            font-size: 0.8em;
        }

        .menu-screen {
            padding-bottom: 90px;
        }

        .menu-header {
            padding-bottom: 15px;
        }

        .menu-back-button, .menu-customize-button {
            padding: 7px 12px;
            font-size: 0.8em;
        }

        .map-title {
            font-size: 2em;
            margin-bottom: 20px;
        }

        .difficulty-list-container {
            padding: 10px;
            gap: 8px;
            max-height: calc(100vh - 250px);
        }

        .difficulty-item {
            padding: 10px 15px;
            font-size: 1em;
        }

        .navbar {
            padding: 10px 15px;
            gap: 10px;
        }

        .navbar-label {
            font-size: 0.75em;
        }

        .navbar-slider {
            height: 5px;
        }

        .navbar-slider::-webkit-slider-thumb {
            width: 14px;
            height: 14px;
        }

        .navbar-slider::-moz-range-thumb {
            width: 14px;
            height: 14px;
        }

        .navbar-value, .navbar-value-input {
            font-size: 0.8em;
        }

        .navbar-checkbox {
            width: 18px;
            height: 18px;
        }

        .navbar-checkbox:checked::after {
            font-size: 12px;
        }

        .navbar-button {
            padding: 8px 12px;
            font-size: 0.8em;
        }

        .keybinds-overlay, .customize-overlay {
            transform: scale(0.98);
        }

        .overlay-content {
            padding: 20px;
            max-width: 350px;
        }

        .overlay-title {
            font-size: 1.6em;
        }

        .keybind-grid, .color-grid {
            gap: 10px;
        }

        .keybind-item, .color-item {
            padding: 8px 12px;
        }

        .keybind-label, .color-label {
            font-size: 0.9em;
        }

        .keybind-button {
            padding: 6px 12px;
            font-size: 0.8em;
            min-width: 50px;
        }

        .overlay-close-button {
            padding: 8px 15px;
            font-size: 0.9em;
        }

        /* Scaled dimensions for smaller screens */
        :root {
            --lane-width: calc(60px * var(--playfield-scale));
            --note-size: calc(55px * var(--playfield-scale));
            --game-area-height: calc(450px * var(--playfield-scale));
            --key-button-size: calc(55px * var(--playfield-scale));
            --judgment-offset: calc(40px * var(--playfield-scale));
        }

        .combo-display-overlay {
            font-size: 3em;
        }

        .accuracy-display-overlay {
            font-size: 1.4em;
        }

        .judgment-text {
            font-size: 1.8em;
        }

        .song-progress-bar {
            margin-top: 12px;
            height: 8px;
        }

        .results-title {
            font-size: 2.2em;
        }

        .results-summary p {
            font-size: 1em;
        }

        .rank-display {
            font-size: 2em;
        }

        .judgment-counts h3 {
            font-size: 1.2em;
        }

        .judgment-counts p {
            font-size: 0.9em;
            padding: 0 10px;
        }

        .results-buttons {
            gap: 12px;
        }

        .results-buttons .results-button {
            padding: 8px 15px;
            font-size: 0.9em;
        }
    }

    @media (max-width: 480px) {
        .game-container {
            padding: 10px;
            border-radius: 10px;
            height: 99vh;
        }

        .file-input-circle-wrapper {
            width: 140px;
            height: 140px;
        }

        .file-input-circle-label .circle-text {
            font-size: 1.1em;
        }

        .start-instructions {
            font-size: 0.7em;
        }

        .menu-screen {
            padding-bottom: 80px;
        }

        .menu-header {
            padding-bottom: 10px;
        }

        .menu-back-button, .menu-customize-button {
            padding: 6px 10px;
            font-size: 0.75em;
        }

        .map-title {
            font-size: 1.8em;
            margin-bottom: 15px;
        }

        .difficulty-list-container {
            padding: 8px;
            gap: 6px;
            max-width: 300px;
            max-height: calc(100vh - 200px);
        }

        .difficulty-item {
            padding: 8px 12px;
            font-size: 0.9em;
        }

        .navbar {
            padding: 8px 10px;
            gap: 8px;
        }

        .navbar-label {
            font-size: 0.7em;
        }

        .navbar-slider {
            height: 4px;
        }

        .navbar-slider::-webkit-slider-thumb {
            width: 12px;
            height: 12px;
        }

        .navbar-slider::-moz-range-thumb {
            width: 12px;
            height: 12px;
        }

        .navbar-value, .navbar-value-input {
            font-size: 0.75em;
        }

        .navbar-checkbox {
            width: 16px;
            height: 16px;
        }

        .navbar-checkbox:checked::after {
            font-size: 10px;
        }

        .navbar-button {
            padding: 6px 10px;
            font-size: 0.75em;
        }

        .overlay-content {
            padding: 15px;
            max-width: 300px;
        }

        .overlay-title {
            font-size: 1.4em;
        }

        .keybind-grid, .color-grid {
            gap: 8px;
        }

        .keybind-item, .color-item {
            padding: 6px 10px;
        }

        .keybind-label, .color-label {
            font-size: 0.8em;
        }

        .keybind-button {
            padding: 5px 10px;
            font-size: 0.75em;
            min-width: 45px;
        }

        .overlay-close-button {
            padding: 6px 12px;
            font-size: 0.8em;
        }

        /* Scaled dimensions for smaller screens */
        :root {
            --lane-width: calc(50px * var(--playfield-scale));
            --note-size: calc(45px * var(--playfield-scale));
            --game-area-height: calc(350px * var(--playfield-scale));
            --key-button-size: calc(45px * var(--playfield-scale));
            --judgment-offset: calc(30px * var(--playfield-scale));
        }

        .combo-display-overlay {
            font-size: 2.5em;
        }

        .accuracy-display-overlay {
            font-size: 1.2em;
        }

        .judgment-text {
            font-size: 1.6em;
        }

        .song-progress-bar {
            margin-top: 10px;
            height: 6px;
        }

        .results-title {
            font-size: 1.8em;
        }

        .results-summary p {
            font-size: 0.9em;
        }

        .rank-display {
            font-size: 1.8em;
        }

        .judgment-counts h3 {
            font-size: 1em;
        }

        .judgment-counts p {
            font-size: 0.8em;
            padding: 0 8px;
        }

        .results-buttons {
            gap: 10px;
        }

        .results-buttons .results-button {
            padding: 6px 12px;
            font-size: 0.8em;
        }
    }
