        :root {
            --nox-bg: #030407;
            --nox-primary: #a8b3c3;
            --nox-glow: #d4e1f7;
            --dies-primary: #b48d4b;
            --dies-glow: #ffe8a9;
            --dies-text: #4E443A;
            --danger: #b33a3a; 
            --success: #6c8a3e; 
            --long-note-color: #6A5ACD;
    		--long-note-glow: #BA55D3;

            --font-title: 'Cinzel', serif;
            --font-body: 'Lora', serif;
        }

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

        @keyframes fadeIn {
            from { opacity: 0; transform: translateY(10px); }
            to { opacity: 1; transform: translateY(0); }
        }

        @keyframes card-deal {
            from { opacity: 0; transform: translateY(20px) scale(0.95); }
            to { opacity: 1; transform: translateY(0) scale(1); }
        }

        @keyframes flash-red {
            0%, 100% { color: var(--nox-glow); text-shadow: none; }
            50% { color: var(--danger); text-shadow: 0 0 10px var(--danger); }
        }

        @keyframes flash-gold {
            0%, 100% { color: var(--dies-glow); text-shadow: none; }
            50% { color: var(--dies-glow); text-shadow: 0 0 10px var(--dies-glow); }
        }

        body, html {
            margin: 0; padding: 0; width: 100%; height: 100%;
            background: radial-gradient(ellipse at center, #1b2735 0%, #090a0f 100%);
            color: var(--nox-primary);
            font-family: var(--font-body);
            display: flex;
            justify-content: center;
            align-items: center;
            overflow: hidden;
        }

        #main-container {
            position: relative;
            width: 100vw; height: 100vh;
            display: flex;
            justify-content: center;
            align-items: center;
        }

        #backgroundCanvas {
            position: absolute;
            top: 0; left: 0;
            z-index: 0;
        }
        
        #game-container {
            position: relative;
            z-index: 1;
            display: flex;
            flex-direction: column;
            align-items: center;
            text-align: center;
            width: 502px;
            max-width: 95%;
            border: 1px solid rgba(var(--dies-primary-rgb), 0.3);
            box-shadow: inset 0 0 15px rgba(0,0,0,0.5), 0 0 30px rgba(0,0,0,0.4);
            border-radius: 8px;
            overflow: hidden;
            opacity: 0;
            transition: opacity 0.5s ease-in-out;
            animation: pulseGlow 8s infinite alternate;
        }

        .menu {
            position: absolute;
            z-index: 100;
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            background: radial-gradient(ellipse at center, rgba(27, 39, 53, 0.6) 0%, rgba(9, 10, 15, 0.9) 100%), url(https://www.transparenttextures.com/patterns/stardust.png);
            border: 1px solid var(--dies-primary);
            box-shadow: 0 0 30px rgba(0,0,0,0.5); 
            border-radius: 8px;
            padding: 40px; 
            text-align: center;
            opacity: 1;
            transition: opacity 0.5s ease-in-out, transform 0.5s ease-in-out;
            width: 90%;
            max-width: 600px; 
            color: var(--nox-primary); 
            backdrop-filter: blur(5px);
        }

        .menu h1 {
            font-family: var(--font-title);
            font-size: 3em; 
            color: var(--dies-glow); 
            text-shadow: 0 0 15px rgba(255, 232, 169, 0.8), 0 0 25px rgba(255, 232, 169, 0.5);
            margin-bottom: 40px;
        }
        .menu h2 {
            font-family: var(--font-title);
            color: var(--dies-glow);
            margin-top: 0;
            text-align: center;
            font-size: 2em;
            text-shadow: 0 0 8px rgba(255, 232, 169, 0.5);
        }

        .menu-button, #start-button, #close-rules-button, #back-to-main-from-songlist-button {
            display: flex;
            align-items: center;
            justify-content: center;
            height: 45px; 
            background: transparent;
            border: 1px solid var(--dies-primary); 
            color: var(--dies-primary);
            font-family: var(--font-title);
            font-size: 1.1em;
            letter-spacing: 1px;
            padding: 0 30px;
            margin: 10px 0;
            transition: all 0.3s ease;
            cursor: pointer;
            text-transform: uppercase;
            width: 280px;
            box-sizing: border-box;
            clip-path: polygon(8px 0%, 100% 0%, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0% 100%, 0% 8px);
        }

        .menu-button:hover, #start-button:hover:not(:disabled), #close-rules-button:hover, #back-to-main-from-songlist-button:hover {
            background-color: rgba(var(--dies-primary-rgb), 0.1);
            color: var(--dies-glow);
            text-shadow: 0 0 10px var(--dies-glow);
            border-color: var(--dies-glow);
            transform: translateY(-3px) scale(1.02);
        }

        #start-button:disabled {
            opacity: 0.4;
            cursor: not-allowed;
            border-color: rgba(var(--dies-primary-rgb), 0.4);
            color: rgba(var(--nox-primary-rgb), 0.4);
            text-shadow: none;
            transform: none;
        }

        .secondary-button {
            background: none;
            border: none;
            color: var(--dies-primary);
            font-family: var(--font-body);
            font-size: 0.9em;
            cursor: pointer;
            text-decoration: underline;
            padding: 5px;
            margin-top: -10px;
            margin-bottom: 15px;
            opacity: 0.8;
            transition: opacity 0.3s, color 0.3s;
        }
        .secondary-button:hover {
            opacity: 1;
            color: var(--dies-glow);
            text-shadow: 0 0 5px var(--dies-glow);
        }
        
#player-name {
    width: 280px; 
    height: 45px; 
    padding: 0 15px; 
    margin: 25px 0;
    background-color: rgba(9, 10, 15, 0.7);
    border: 1px solid var(--dies-primary);
    border-radius: 8px; 
    color: var(--nox-glow);
    font-family: var(--font-body);
    font-size: 1.1em;
    text-align: center;
    box-sizing: border-box;
    transition: all 0.3s ease; 
}

#player-name::placeholder { 
    color: rgba(var(--nox-primary-rgb), 0.6); 
    font-family: var(--font-body);
}

#player-name:focus { 
    outline: none; 
    border-color: var(--dies-glow); 
    box-shadow: 0 0 10px rgba(var(--dies-glow-rgb), 0.5); 
    background-color: rgba(9, 10, 15, 0.9); 
    }

@media (max-width: 600px) {
    #player-name {
        width: 200px;
        height: 40px;
        font-size: 1em;
    }
}
        
.rules-content {
    padding: 30px 40px; 
    text-align: justify;
    max-height: 60vh;
    overflow-y: auto;
    line-height: 1.7;
    color: var(--nox-primary);
    font-size: 1em;
    margin-bottom: 25px; 
    border: 1px solid rgba(var(--nox-primary-rgb), 0.2);
    border-radius: 5px;
    background-color: rgba(0,0,0,0.1);
}

.rule-section-title {
    font-family: var(--font-title);
    font-size: 1.5em;
    color: var(--dies-glow);
    text-shadow: 0 0 10px rgba(255, 232, 169, 0.6);
    text-align: center;

    margin-top: 0.8em; 
    margin-bottom: 0.8em;
}

.rule-section-title:first-child {
    margin-top: 0;
}

.rules-content p {
    margin-bottom: 0.8em; 
    text-align: justify;
}

.rule-list {
    list-style: none;
    padding-left: 0;
    margin-bottom: 0.8em; 
}

.rule-list li {
    margin-bottom: 0.5em; 
    text-indent: -1em;
    padding-left: 1em;
}

.rule-list li::before {
    content: "• ";
    color: var(--dies-primary);
    font-weight: bold;
    display: inline-block;
    width: 1em;
    margin-right: 0.2em;
}

.rules-content strong {
    color: var(--nox-glow);
    font-family: var(--font-body);
    font-weight: bold;
    text-shadow: 0 0 5px rgba(212, 225, 247, 0.3);
}

.rules-content .miss-text {
    color: var(--danger);
    text-shadow: 0 0 5px var(--danger);
}

.rules-content hr {
    border: none;
    border-top: 1px dashed rgba(var(--dies-primary-rgb), 0.3);
    margin: 1.5em auto; 
    width: 60%;
}

#close-rules-button {
    margin-top: 30px;
    width: 250px;
    font-size: 1.1em;
}

#custom-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 200;
    max-width: 400px;
    padding: 30px;
}
#custom-modal #modal-title {
    margin-bottom: 20px;
}
#custom-modal #modal-message {
    margin-bottom: 30px;
    color: var(--nox-primary);
    font-size: 1.1em;
}
#custom-modal #modal-close-button {
    width: 150px;
}

@media (max-width: 600px) {
    .rules-content {
        padding: 20px 25px;
        max-height: 70vh;
        font-size: 0.9em;
        line-height: 1.6;
    }
    .rule-section-title {
        font-size: 1.3em;
        margin-top: 0.8em; 
        margin-bottom: 0.5em;
    }
    .rules-content p {
        margin-bottom: 0.6em; 
    }
    .rule-list li {
        margin-bottom: 0.4em;
    }
    .rules-content hr {
        margin: 1.2em auto; 
        width: 70%;
    }
    #close-rules-button {
        width: 180px;
        font-size: 1em;
    }
}
        #song-list {
            width: 100%;
            max-height: 50vh;
            overflow-y: auto;
            margin: 20px 0;
            border-top: 1px solid rgba(var(--dies-primary-rgb), 0.3);
            border-bottom: 1px solid rgba(var(--dies-primary-rgb), 0.3);
        }
        .song-item {
            padding: 15px 20px;
            cursor: pointer;
            border-bottom: 1px solid rgba(var(--dies-primary-rgb), 0.1);
            transition: background-color 0.3s;
            display: flex;
            justify-content: space-between;
            align-items: center;
            font-family: var(--font-body); 
        }
        .song-item:hover {
            background-color: rgba(var(--dies-primary-rgb), 0.05); 
        }
        .song-item.selected {
            background-color: rgba(var(--dies-primary-rgb), 0.15); 
            box-shadow: inset 3px 0 0 0 var(--dies-primary);
        }
        .song-title {
            font-size: 1.1em;
            color: var(--nox-primary);
        }
        .difficulty-stars {
            font-size: 1.2em;
            color: var(--dies-glow); 
            letter-spacing: 2px;
        }
        .difficulty-stars .inactive {
            opacity: 0.3;
        }

        .results-grid {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 10px 40px;
            margin: 25px 0;
            text-align: left;
            width: 80%;
            max-width: 300px;
            font-family: var(--font-body);
        }
        .results-grid p {
            margin: 0;
            font-size: 1.1em;
            color: var(--nox-primary);
        }
        .results-grid .value {
            text-align: right;
            color: var(--dies-glow); 
            font-weight: bold;
            font-family: var(--font-title); 
        }

        #status-text {
            margin-top: 15px;
            font-size: 0.9em;
            color: var(--nox-glow); 
            height: 20px;
            font-family: var(--font-body);
            text-shadow: 0 0 5px rgba(212, 225, 247, 0.3);
        }
        
        canvas#gameCanvas {
            background-color: transparent;
            border: 1px solid var(--dies-primary); 
            width: 100%;
            border-radius: 8px; 
            box-shadow: inset 0 0 10px rgba(0,0,0,0.5); 
        }

        @keyframes pulseGlow {
            from { box-shadow: 0 0 15px -5px rgba(180, 141, 75, 0.3); } 
            to { box-shadow: 0 0 35px 0px rgba(180, 141, 75, 0.5); }
        }

        .hidden {
            opacity: 0 !important;
            pointer-events: none !important;
            transform: scale(0.95);
        }
        .visible {
            opacity: 1 !important;
            pointer-events: auto !important;
            transform: scale(1);
        }

        #song-title-display {
            position: absolute;
            top: 20px;
            width: 100%;
            text-align: center;
            font-family: var(--font-title);
            font-size: 1.8em; 
            color: var(--dies-glow); 
            text-shadow: 0 0 15px var(--dies-glow), 0 0 25px rgba(255, 232, 169, 0.5);
            opacity: 0;
            transition: opacity 0.5s ease-in-out;
            z-index: 5;
            pointer-events: none;
        }
        
.highscore-song-title {
    font-family: var(--font-title);
    font-size: 1.8em; 
    color: var(--dies-glow);
    text-shadow: 0 0 10px rgba(255, 232, 169, 0.6);
    text-align: left; 
    margin-top: 1.5em; 
    margin-bottom: 0.5em; 
    width: 100%; 
    padding-left: 15px;
    box-sizing: border-box;
}
.highscore-song-title:first-of-type {
    margin-top: 0; 
}

.highscore-list {
    list-style: decimal; 
    list-style-position: inside; 
    padding-left: 25px; 
    margin-bottom: 1.5em; 
    width: 100%; 
    box-sizing: border-box;
    text-align: left; 
}
.highscore-list li {
    margin-bottom: 0.3em; 
    color: var(--nox-primary);
    font-size: 1em;
    padding: 5px 0; 
    border-bottom: 1px dotted rgba(var(--nox-primary-rgb), 0.1); 
}
.highscore-list li:last-child {
    border-bottom: none; 
}

.highscore-list .player-name {
    font-weight: normal; 
    color: var(--nox-glow);
}
.highscore-list .player-score {
    float: right;
    font-family: var(--font-title); 
    color: var(--dies-glow); 
    font-weight: bold;
}

@media (max-width: 600px) {
    .highscore-song-title {
        font-size: 1.5em;
        padding-left: 10px;
    }
    .highscore-list {
        padding-left: 20px;
    }
    .highscore-list li {
        font-size: 0.9em;
    }
}

        @media (max-width: 600px) {
            .menu h1 { font-size: 2.2em; margin-bottom: 25px; }
            .menu-button, #start-button, #close-rules-button, #back-to-main-from-songlist-button {
                width: 200px;
                height: 40px;
                font-size: 1em;
                padding: 0 20px;
            }
            .song-title { font-size: 0.9em; }
            .difficulty-stars { font-size: 1em; }
            .rules-content { padding-right: 5px; }
            .menu { padding: 25px 15px; }
        }
        
        .updates-content {
    padding: 30px 40px;
    text-align: justify;
    max-height: 60vh;
    overflow-y: auto;
    line-height: 1.7;
    color: var(--nox-primary);
    font-size: 1em;
    margin-bottom: 25px;
    border: 1px solid rgba(var(--nox-primary-rgb), 0.2);
    border-radius: 5px;
    background-color: rgba(0,0,0,0.1);
}

.update-section-title {
    font-family: var(--font-title);
    font-size: 1.5em;
    color: var(--dies-glow);
    text-shadow: 0 0 10px rgba(255, 232, 169, 0.6);
    text-align: center;
    margin-top: 0.8em;
    margin-bottom: 0.8em;
}

.update-section-title:first-child {
    margin-top: 0;
}

.updates-content p, .updates-content ul, .updates-content li {
    margin-bottom: 0.8em;
    text-align: justify;
}

.updates-content ul {
    list-style: none;
    padding-left: 0;
    margin-bottom: 0.8em;
}

.updates-content li {
    margin-bottom: 0.5em;
    text-indent: -1em;
    padding-left: 1em;
}

.updates-content li::before {
    content: "• ";
    color: var(--dies-primary);
    font-weight: bold;
    display: inline-block;
    width: 1em;
    margin-right: 0.2em;
}

.updates-content strong {
    color: var(--nox-glow);
    font-family: var(--font-body);
    font-weight: bold;
    text-shadow: 0 0 5px rgba(212, 225, 247, 0.3);
}

.updates-content hr {
    border: none;
    border-top: 1px dashed rgba(var(--dies-primary-rgb), 0.3);
    margin: 1.5em auto;
    width: 60%;
}

#close-updates-button {
    margin-top: 30px;
    width: 250px;
    font-size: 1.1em;
}

@media (max-width: 600px) {
    .updates-content {
        padding: 20px 25px;
        max-height: 70vh;
        font-size: 0.9em;
        line-height: 1.6;
    }
    .update-section-title {
        font-size: 1.3em;
        margin-top: 0.8em;
        margin-bottom: 0.5em;
    }
    .updates-content p, .updates-content ul, .updates-content li {
        margin-bottom: 0.6em;
    }
    .updates-content hr {
        margin: 1.2em auto;
        width: 70%;
    }
    #close-updates-button {
        width: 180px;
        font-size: 1em;
    }
}