body {
    margin: 0;
    padding: 0;
    overflow: hidden;
    background-color: #000;
    font-family: 'Inter', sans-serif;
    user-select: none;
    width: 100vw;
    height: 100%;
    position: fixed;
}

canvas {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 0;
}

#ui-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.hud-top-left {
    position: absolute;
    top: 20px;
    left: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.score-container {
    background: rgba(0, 0, 0, 0.5);
    padding: 15px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    gap: 10px;
    position: relative;
}

.trophy-icon {
    font-size: 2em;
    filter: drop-shadow(0 2px 4px rgba(255, 215, 0, 0.5));
}

.share-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.4);
    color: white;
    padding: 4px 10px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.75em;
    transition: all 0.3s ease;
    pointer-events: auto;
    display: inline-block;
    margin-left: 10px;
}

.share-btn:hover {
    background: rgba(255, 255, 255, 0.4);
    transform: scale(1.05);
}

.score-label {
    font-size: 0.8em;
    text-transform: uppercase;
    opacity: 0.8;
    margin-bottom: 5px;
}

#score-value {
    font-size: 2em;
    font-weight: bold;
    font-family: monospace;
}

#mushroom-count {
    font-size: 2em;
    font-weight: bold;
    font-family: monospace;
    color: #8A2BE2;
}

#use-mushrooms-btn:hover {
    background-color: #9932CC !important;
    transform: scale(1.05);
    box-shadow: 0 0 10px rgba(138, 43, 226, 0.5);
}

.progress-container {
    background: rgba(0, 0, 0, 0.5);
    padding: 10px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    backdrop-filter: blur(5px);
    width: 200px;
}

.progress-label {
    font-size: 0.8em;
    margin-bottom: 5px;
    opacity: 0.8;
    color: white;
}

.progress-bar-bg {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
}

#progress-bar-fill {
    height: 100%;
    background: #44aa00;
    transition: width 0.3s ease;
}

#achievements-list {
    display: flex;
    flex-direction: column;
    gap: 5px;
    max-height: 300px;
    overflow-y: auto;
    padding-right: 5px;
    pointer-events: none;
    /* Custom Scrollbar */
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
}

/* Enable scrolling when paused (pointer unlocked) */
body:not(.pointer-locked) #achievements-list {
    pointer-events: auto;
}

.achievement-item {
    background: rgba(0, 0, 0, 0.7);
    border: 2px solid rgba(255, 215, 0, 0.8);
    color: white;
    padding: 8px 12px;
    border-radius: 5px;
    font-size: 0.9em;
    display: flex;
    align-items: center;
    gap: 8px;
    animation: slideIn 0.5s ease-out;
    backdrop-filter: blur(5px);
    box-shadow: 0 2px 8px rgba(255, 215, 0, 0.3);
}

.achievement-icon {
    font-size: 1.5em;
}

.achievement-text {
    display: flex;
    flex-direction: column;
}

.achievement-name {
    font-weight: bold;
}

.achievement-desc {
    font-size: 0.8em;
    opacity: 0.8;
}

.achievement-item.special {
    background: linear-gradient(135deg, rgba(138, 43, 226, 0.8), rgba(75, 0, 130, 0.8));
    border: 2px solid rgba(186, 85, 211, 0.9);
    box-shadow: 0 2px 12px rgba(138, 43, 226, 0.5);
}

.achievement-item.marathon {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.9), rgba(255, 140, 0, 0.9));
    border: 2px solid rgba(255, 215, 0, 1);
    box-shadow: 0 2px 12px rgba(255, 215, 0, 0.6);
    font-weight: bold;
}

@keyframes slideIn {
    from {
        transform: translateX(-20px);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Audio controls removed */
button {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.4);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    backdrop-filter: blur(5px);
    transition: all 0.3s ease;
    pointer-events: auto; /* Enable touch interaction on mobile */
}

button:hover {
    background: rgba(255, 255, 255, 0.4);
    transform: translateY(-2px);
}

#instructions {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: white;
    font-size: 1.2em;
    pointer-events: none;
    transition: opacity 0.5s;
    background: rgba(0, 0, 0, 0.6);
    padding: 30px 40px;
    border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(10px);
    z-index: 2000;
}

/* Responsive Text Visibility */
.mobile-text {
    display: none;
}

.desktop-text {
    display: inline;
}

@media (max-width: 1024px) and (hover: none) {
    .mobile-text {
        display: inline;
    }

    .desktop-text {
        display: none;
    }

    /* Hide desktop-only paragraphs completely */
    p.desktop-text {
        display: none;
    }

    p.mobile-text {
        display: block;
    }
}

#instructions h2 {
    margin: 0 0 20px 0;
    font-size: 2.2em;
    font-weight: 600;
    letter-spacing: 3px;
    text-transform: none;
    opacity: 1;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.hand-cursor {
    position: absolute;
    font-size: 100px;
    pointer-events: none;
    user-select: none;
    transform: translate(-50%, -50%);
    opacity: 0;
    transition: opacity 0.1s, transform 0.1s;
    filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.5));
}

#hand-left {
    left: 30%;
    bottom: 0;
    transform: translate(-50%, 100%) rotate(-20deg);
}

#hand-right {
    right: 30%;
    bottom: 0;
    transform: translate(50%, 100%) rotate(20deg) scaleX(-1);
}

#hand-left.active,
#hand-right.active {
    opacity: 1;
    transform: translate(-50%, -50%) rotate(0deg);
    /* Center on cursor */
    z-index: 100;
}

#hand-right.active {
    transform: translate(-50%, -50%) rotate(0deg) scaleX(-1);
}

#crosshair {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: rgba(255, 255, 255, 0.5);
    font-size: 20px;
    pointer-events: none;
}

#custom-cursor {
    display: none;
}

/* Virtual Joystick */
#joystick-container {
    position: absolute;
    bottom: 30px;
    left: 30px;
    width: 120px;
    height: 120px;
    pointer-events: auto;
    opacity: 0.7;
    display: none;
    z-index: 100;
}

#joystick-base {
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.3), rgba(255, 255, 255, 0.1));
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    position: relative;
    backdrop-filter: blur(5px);
}

.joystick-arrow {
    position: absolute;
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 12px solid rgba(255, 255, 255, 0.5);
    pointer-events: none;
}

.arrow-up {
    top: 5px;
    left: 50%;
    transform: translateX(-50%);
}

.arrow-down {
    bottom: 5px;
    left: 50%;
    transform: translateX(-50%) rotate(180deg);
}

.arrow-left {
    left: 5px;
    top: 50%;
    transform: translateY(-50%) rotate(-90deg);
}

.arrow-right {
    right: 5px;
    top: 50%;
    transform: translateY(-50%) rotate(90deg);
}

#joystick-knob {
    width: 50px;
    height: 50px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.8), rgba(255, 255, 255, 0.4));
    border: 2px solid rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    transition: all 0.1s ease-out;
}

/* Old Touch Instructions Removed */

/* Mobile Pause Button */
#mobile-pause-btn {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 50px;
    height: 50px;
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    color: white;
    font-size: 24px;
    display: none;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
    cursor: pointer;
    backdrop-filter: blur(5px);
    transition: all 0.3s ease;
    z-index: 1000;
}

#mobile-pause-btn:active {
    background: rgba(255, 255, 255, 0.3);
    transform: translateX(-50%) scale(0.95);
}

@media (max-width: 768px) {
    h1 {
        font-size: 0.8rem;
        top: 10px;
        right: 10px;
    }

    .hud-top-left {
        top: 10px;
        left: 10px;
        gap: 8px;
    }

    .score-container {
        padding: 10px;
    }

    #score-value {
        font-size: 1.5em;
    }

    .progress-container {
        width: 150px;
        padding: 8px;
    }

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

    .achievement-item {
        font-size: 0.8em;
        padding: 6px 10px;
    }

    #footer-links {
        font-size: 10px !important;
        bottom: 5px !important;
        left: 5px !important;
    }

    #footer-links a {
        margin-right: 5px !important;
        padding: 3px 6px !important;
    }

    #instructions {
        padding: 20px 30px;
        font-size: 1em;
    }

    #instructions h2 {
        font-size: 1.8em;
        margin: 0 0 15px 0;
    }

    #instructions p {
        margin: 8px 0;
    }

    #joystick-container {
        bottom: 20px;
        left: 20px;
        width: 100px;
        height: 100px;
    }

    #joystick-knob {
        width: 40px;
        height: 40px;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 0.7rem;
    }

    .score-container {
        padding: 8px;
    }

    #score-value {
        font-size: 1.2em;
    }

    .progress-container {
        width: 120px;
    }

    #achievements-list {
        max-height: 200px;
    }

    #joystick-container {
        width: 90px;
        height: 90px;
        bottom: 15px;
        left: 15px;
    }

    #joystick-knob {
        width: 35px;
        height: 35px;
    }

    #mobile-pause-btn {
        width: 40px;
        height: 40px;
        font-size: 20px;
        top: 15px;
    }
}

/* Instructions Panel Updates - Merged into main block above */

.intro-text {
    font-size: 0.9em;
    font-style: italic;
    margin-bottom: 20px;
    line-height: 1.4;
    opacity: 0.9;
}

.signature {
    text-align: right;
    margin-top: 5px;
    font-weight: bold;
    opacity: 0.8;
}

.separator {
    border: 0;
    height: 1px;
    background-image: linear-gradient(to right, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0));
    margin: 20px 0;
}

.controls-list p {
    margin: 8px 0;
}

#tip-container {
    position: absolute;
    bottom: 20%;
    width: 100%;
    text-align: center;
    pointer-events: none;
    z-index: 1500;
}

#tip-text {
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    padding: 10px 20px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    font-size: 1.1em;
    backdrop-filter: blur(5px);
    opacity: 0;
    transition: opacity 1s ease-in-out;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
}

#tip-text.visible {
    opacity: 1;
}