body {
    font-family: 'Arial', sans-serif;
    text-align: center;
    background-color: #f5f5f5;
    margin: 0;
    height: 100vh;
    overflow: hidden;
}

.container {
    position: relative;
    width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

h1 {
    font-size: 2.5rem;
    color: #d32f2f;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
    margin-top: 30px;
    position: relative;
    z-index: 5;
    padding: 0 15px; /* Add padding for readability on small screens */
}

#foot {
    position: absolute;
    width: 150px;
    cursor: pointer;
    transition: transform 0.1s;
    z-index: 10;
}

/* Sound toggle styling */
.sound-toggle {
    position: fixed;
    top: 15px;
    left: 15px;
    width: 40px;
    height: 40px;
    background-color: rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    z-index: 100;
    transition: transform 0.2s;
}

.sound-toggle:hover {
    transform: scale(1.1);
}

.sound-toggle img {
    width: 24px;
    height: 24px;
    position: absolute;
    opacity: 0;
    transition: opacity 0.2s;
    color: #333;
}

.sound-toggle img.active {
    opacity: 1;
}

/* Score + leaderboard HUD (top-right) */
.hud {
    position: fixed;
    top: 15px;
    right: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 100;
}

.score-pill {
    display: flex;
    align-items: center;
    gap: 6px;
    height: 40px;
    padding: 0 14px;
    background-color: rgba(255, 255, 255, 0.8);
    border-radius: 20px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    font-weight: bold;
    color: #d32f2f;
    font-size: 1.1rem;
    user-select: none;
    cursor: default;
}

.score-pill .score-foot { font-size: 1.1rem; }

.lb-open {
    width: 40px;
    height: 40px;
    border: none;
    background-color: rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    font-size: 20px;
    line-height: 1;
    transition: transform 0.2s;
}

.lb-open:hover { transform: scale(1.1); }

/* Leaderboard modal */
.lb-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 200;
    padding: 20px;
    animation: lbFade 0.2s ease;
}

.lb-overlay[hidden] { display: none; }

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

.lb-modal {
    position: relative;
    background-color: #fff;
    width: 100%;
    max-width: 360px;
    max-height: 85vh;
    overflow-y: auto;
    border-radius: 16px;
    padding: 24px 22px 22px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
    text-align: center;
    animation: lbPop 0.2s ease;
}

@keyframes lbPop {
    from { transform: scale(0.9); opacity: 0; }
    to   { transform: scale(1); opacity: 1; }
}

.lb-close {
    position: absolute;
    top: 10px;
    right: 14px;
    border: none;
    background: none;
    font-size: 28px;
    line-height: 1;
    color: #bbb;
    cursor: pointer;
    transition: color 0.2s;
}

.lb-close:hover { color: #d32f2f; }

.lb-title {
    font-size: 1.6rem;
    color: #d32f2f;
    margin: 0 0 16px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.15);
}

.lb-sub {
    margin: 0 0 16px;
    color: #888;
    font-size: 0.9rem;
}

.lb-list {
    list-style: none;
    margin: 0 0 18px;
    padding: 0;
    text-align: left;
}

.lb-list .lb-row {
    display: flex;
    align-items: center;
    padding: 9px 12px;
    border-radius: 10px;
    margin-bottom: 4px;
    background-color: #f7f7f7;
}

.lb-list .lb-row.lb-first {
    background-color: #fdeaea;
    box-shadow: inset 0 0 0 1px #f3c6c6;
}

.lb-rank {
    width: 26px;
    font-weight: bold;
    color: #d32f2f;
    flex-shrink: 0;
}

.lb-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 0 8px;
    color: #333;
}

.lb-score {
    font-weight: bold;
    color: #333;
    flex-shrink: 0;
}

.lb-note, .lb-error, .lb-empty {
    text-align: center;
    color: #999;
    padding: 14px 0;
    list-style: none;
}

.lb-submit { border-top: 1px solid #eee; padding-top: 14px; }

.lb-your { margin: 0 0 10px; color: #555; font-size: 0.95rem; }
.lb-your strong { color: #d32f2f; font-size: 1.15rem; }

.lb-form { display: flex; gap: 8px; }

.lb-form input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 10px;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
}

.lb-form input:focus { border-color: #d32f2f; }

.lb-form button {
    padding: 10px 18px;
    border: none;
    border-radius: 10px;
    background-color: #d32f2f;
    color: #fff;
    font-weight: bold;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
}

.lb-form button:hover { background-color: #b71c1c; }
.lb-form button:active { transform: scale(0.96); }
.lb-form button:disabled { background-color: #e59a9a; cursor: default; }

.lb-msg { margin: 10px 0 0; min-height: 18px; font-size: 0.9rem; color: #d32f2f; }

/* Footer */
.site-footer {
    position: fixed;
    bottom: 8px;
    left: 0;
    width: 100%;
    text-align: center;
    font-size: 11px;
    color: #bbb;
    z-index: 1;
    letter-spacing: 0.5px;
}

.site-footer a {
    color: #bbb;
    text-decoration: none;
    transition: color 0.2s;
}

.site-footer a:hover {
    color: #888;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    h1 {
        font-size: 1.8rem;
        margin-top: 20px;
        background-color: rgba(255, 255, 255, 0.7); /* Add semi-transparent background */
        padding: 10px 15px;
        border-radius: 10px;
        margin-bottom: 20px; /* Add some space below the text */
    }
    
    #foot {
        width: 120px;
    }
    
    .sound-toggle {
        width: 36px;
        height: 36px;
        top: 10px;
        left: 10px;
    }
    
    .sound-toggle img {
        width: 20px;
        height: 20px;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 1.5rem;
        margin-top: 15px;
        padding: 8px 12px;
        background-color: rgba(255, 255, 255, 0.8); /* Slightly more opaque for better visibility */
    }
    
    #foot {
        width: 100px;
    }
    
    .sound-toggle {
        width: 32px;
        height: 32px;
        top: 8px;
        left: 8px;
    }

    .sound-toggle img {
        width: 18px;
        height: 18px;
    }

    .hud { top: 8px; right: 8px; gap: 6px; }
    .score-pill { height: 32px; padding: 0 10px; font-size: 0.95rem; }
    .lb-open { width: 32px; height: 32px; font-size: 16px; }
}
