* { 
    user-select:none; 
    -webkit-user-select:none; 
}

body {
    background: black;
    color: #333;
    font-family: system-ui;
    margin: 0;
    padding: 0;
}

.modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.85);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

#page {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    margin-top: 0px;
}


.modal-content {
    background: #f9f9f9;
    padding: 20px 25px;
    border-radius: 10px;
    width: 90%;
    max-width: 500px;
    position: relative;
    border: 2px solid #ddd;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-content h3 {
    margin-top: 0;
    color: #333;
}

.modal-close {
    position: absolute;
    top: 8px;
    right: 10px;
    background: none;
    border: none;
    font-size: 1.6rem;
    cursor: pointer;
    color: #555;
}

.modal-close:hover { 
    color: #000; 
}

#usernameInput {
    width: 100%;
    padding: 10px;
    font-size: 1.1rem;
    border: 2px solid #ddd;
    border-radius: 5px;
    margin: 15px 0;
    box-sizing: border-box;
}

#claimBtn {
    width: 100%;
    padding: 12px;
    font-size: 1.1rem;
    background: #4caf50;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
}

#claimBtn:hover { 
    background: #45a049; 
}

#claimBtn:disabled { 
    background: #ccc; 
    cursor: not-allowed; 
}

#usernameError {
    color: #f44336;
    font-size: 0.9rem;
    margin: 10px 0;
    display: none;
}

#container { 
    position:relative; 
    display:inline-block; 
    touch-action:none; 
}

#difficultySelector { 
    margin: 6px 0 2px 0; 
}

#difficultySelector button {
    padding: 5px 20px;
    margin: 0 5px;
    font-size: 1rem;
    border: 2px solid #ddd;
    background: white;
    cursor: pointer;
    border-radius: 2px;
    transition: all 0.2s;
}

#difficultySelector button:hover { 
    background: #f0f0f0; 
}

#difficultySelector button.active {
    background: #4caf50;
    color: white;
    border-color: #4caf50;
}

#userInfo {
    color: white;
    font-size: 1.1rem;
    margin: 8px 0;
    font-weight: bold;
}

#maze { 
    display:block; 
    pointer-events:none; 
}

#coins {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 1.4rem;
    font-weight: bold;
    color: orange;
    margin: 10px 0;
    justify-content: center;
}

.coin-icon {
    width: 47px;
    height: 47px;
    image-rendering: pixelated;
}

#powerupStatus {
    font-size:1.1rem;
    min-height:18px;
    margin:2px 0;
    color: white;
}


.icon img {
    width: 100%;
    height: 100%;
    image-rendering: pixelated;
}

.icon {
    position: absolute;
    width: 48px;
    height: 48px;
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.icon.collected {
    animation: collectIcon 0.3s ease-out forwards;
}

@keyframes collectIcon {
    0% { transform: translate(-50%, -50%) scale(1) rotate(0deg); opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(2) rotate(360deg); opacity: 0; }
}

.icon.magnet-pull {
    animation: magnetPull 0.3s ease-in forwards;
}

@keyframes magnetPull {
    0% { transform: scale(1); }
    100% { transform: scale(0.5) translateY(-20px); opacity: 0; }
}




.icon.magnet-pull {
    animation: magnetPull 0.3s ease-out;
}

@keyframes magnetPull {
    0% { transform: translate(-50%,-50%) scale(1); }
    50% { transform: translate(-50%,-50%) scale(1.3); }
    100% { transform: translate(-50%,-50%) scale(0); }
}

#milestoneDisplay {
    font-size: 1.3rem;
    font-weight: bold;
    color: limegreen;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.6s ease;
}

#header {
    display: flex;
    align-items: center;
    gap: 20px;
    width: 100%;
    margin-bottom: 10px;
}

#timerRow {
    display: flex;
    align-items: center;
    justify-content: center; /* REQUIRED */
    gap: 14px;
    margin-top: 0px;
    margin: 6px 0;
}


#timer {
    font-size: 1.4rem;
    font-weight: bold;
    color: #e91e63;
    min-height: 1.4rem;
    white-space: nowrap;
}

#timer.warning { 
    animation: flash 0.8s infinite; 
}

@keyframes flash {
    0%,100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.leaderboard-table {
    width: 100%;
    border-collapse: collapse;
    margin: 15px 0;
    font-size: 0.9rem;
}

.leaderboard-table th {
    background: #f0f0f0;
    padding: 8px;
    text-align: left;
    border-bottom: 2px solid #ddd;
    font-weight: bold;
}

.leaderboard-table td {
    padding: 8px;
    border-bottom: 1px solid #eee;
}

.leaderboard-table tr:hover {
    background: #f9f9f9;
}

.leaderboard-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.leaderboard-tab {
    padding: 8px 16px;
    background: #f0f0f0;
    border: none;
    cursor: pointer;
    border-radius: 5px;
    font-size: 0.9rem;
}

.leaderboard-tab.active {
    background: #4caf50;
    color: white;
}

#milestone, #congrats, #gameOver, #timeoutOverlay {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    z-index: 1000;
}

#milestone {
    font-size: 5rem;
    color: green;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s;
}

#milestone.show { 
    opacity: 1; 
}

#congrats {
    background: rgba(0,0,0,0.9);
    font-size: 4rem;
    color: #ffeb3b;
}

#finalScore {
    font-size: 2.5rem;
    margin-top: 20px;
    color: #4caf50;
}

#gameOver {
    background: rgba(0,0,0,0.9);
    font-size: 3rem;
    color: #ff5252;
}

#gameOverMsg {
    font-size: 2rem;
    margin-top: 20px;
    color: #fff;
    text-align: center;
    padding: 0 20px;
}

#timeoutOverlay {
    background: rgba(0,0,0,0.88);
    color: #ff5252;
    font-size: 5rem;
    font-weight: bold;
}

#timeoutCountdown {
    font-size: 2rem;
    color: #ff9800;
}

#wisdomOverlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.85);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 3000;
}

#wisdomBox {
    background: #000;
    border: 2px solid #ff9800;
    padding: 28px 34px;
    max-width: 520px;
    text-align: center;
    box-shadow: 0 0 30px rgba(255,152,0,0.35);
}

#wisdomText {
    color: #ff9800;
    font-size: 1.4rem;
    font-weight: 600;
    line-height: 1.4;
}

#wisdomHint {
    margin-top: 16px;
    font-size: 0.9rem;
    color: #ffcc80;
    opacity: 0.8;
}


.icon-button {
  
    cursor: pointer;     /* shows hand pointer */
    margin: 5px;
    transition: transform 0.2s; /* optional hover effect */
}

.icon-button:hover {
    transform: scale(1.1); /* slight zoom on hover */
}

.icon-button.active {
    border: 2px solid #550d71; /* indicates active selection */
    border-radius: 5px;
}


/* Add these styles to your CSS */
#usernameError, #recoverError {
    display: none;
    color: #d32f2f;
    margin: 10px 0;
    padding: 10px;
    background: #ffebee;
    border-radius: 4px;
    font-size: 0.9rem;
}

.modal input[type="text"] {
    width: 100%;
    padding: 12px;
    margin: 8px 0;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 1rem;
    box-sizing: border-box;
    transition: border-color 0.3s;
}

.modal input[type="text"]:focus {
    outline: none;
    border-color: #9c27b0;
}


#displayRecoveryCode {
    user-select: all;
    -webkit-user-select: all;
    -moz-user-select: all;
    cursor: text;
}

#volumeControl {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(0, 0, 0, 0.7);
    padding: 8px 15px;
    border-radius: 8px;
    border: 0px solid #9c27b0;
    box-shadow: 0 0 10px rgba(156, 39, 176, 0.3);
}

#volumeControl button {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 5px;
    transition: transform 0.2s, filter 0.2s;
    filter: drop-shadow(0 0 5px rgba(255, 152, 0, 0.5));
}

#volumeControl button:hover {
    transform: scale(1.15);
    filter: drop-shadow(0 0 10px rgba(255, 152, 0, 0.8));
}

#volumeControl button:active {
    transform: scale(0.95);
}

#volumeControl input[type="range"] {
    width: 100px;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: linear-gradient(to right, #9c27b0 0%, #e91e63 100%);
    border-radius: 5px;
    outline: none;
    cursor: pointer;
    box-shadow: 0 0 8px rgba(156, 39, 176, 0.4);
}

/* Webkit (Chrome, Safari) */
#volumeControl input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: radial-gradient(circle, #ffdf00, #ff9800);
    border: 2px solid #fff176;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(255, 152, 0, 0.6);
    transition: transform 0.2s, box-shadow 0.2s;
}

#volumeControl input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 0 15px rgba(255, 152, 0, 1);
}

#volumeControl input[type="range"]::-webkit-slider-thumb:active {
    transform: scale(1.1);
}

/* Firefox */
#volumeControl input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: radial-gradient(circle, #ffdf00, #ff9800);
    border: 2px solid #fff176;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(255, 152, 0, 0.6);
    transition: transform 0.2s, box-shadow 0.2s;
}

#volumeControl input[type="range"]::-moz-range-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 0 15px rgba(255, 152, 0, 1);
}

#volumeControl input[type="range"]::-moz-range-thumb:active {
    transform: scale(1.1);
}

/* Firefox track */
#volumeControl input[type="range"]::-moz-range-track {
    background: linear-gradient(to right, #9c27b0 0%, #e91e63 100%);
    border-radius: 5px;
    height: 6px;
}

/* Muted state styling */
#volumeControl button.muted {
    filter: drop-shadow(0 0 5px rgba(244, 67, 54, 0.5));
}

#volumeControl button.muted:hover {
    filter: drop-shadow(0 0 10px rgba(244, 67, 54, 0.8));
}

#doge-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
}
#doge-modal {
    background: transparent;
    max-width: 600px;
    max-height: 300px;
    margin: 5% auto;
    margin-top: 5px;
    padding: 1px;
}

a {
    color: rgb(212, 147, 17);
}


/* Tree Overlay - Floating Multi-Bubble Pulsing Entity */
#treeOverlay {
    position: absolute;
    width: 150px;
    height: 200px;
    pointer-events: none;
    z-index: 100;
    opacity: 0.75;
    transition: top 5s ease-in-out, left 5s ease-in-out;
    animation: colorShift 3s ease-in-out infinite;
}

@keyframes colorShift {
    0% {
        filter: hue-rotate(0deg) saturate(1);
    }
    25% {
        filter: hue-rotate(90deg) saturate(1.2);
    }
    50% {
        filter: hue-rotate(180deg) saturate(1.3);
    }
    75% {
        filter: hue-rotate(270deg) saturate(1.2);
    }
    100% {
        filter: hue-rotate(360deg) saturate(1);
    }
}

.jungle-leaf {
    position: absolute;
    background: radial-gradient(circle at center, #b388ff 0%, #7c4dff 50%, #5e35b1 85%, #311b92 100%);
    border-radius: 45% 55% 50% 50% / 50% 50% 45% 55%;
    transform-origin: center;
    box-shadow: inset -3px -3px 15px rgba(49, 27, 146, 0.5), 
                0 0 20px rgba(179, 136, 255, 0.4);
    animation: bubblePulse 2s ease-in-out infinite;
}

/* Large bubbles */
.leaf-1 {
    width: 120px;
    height: 120px;
    top: 20px;
    right: 30px;
    animation: sway1 4s ease-in-out infinite, bubblePulse 2s ease-in-out infinite;
}

.leaf-2 {
    width: 100px;
    height: 100px;
    top: 40px;
    right: 80px;
    animation: sway2 3.5s ease-in-out infinite 0.5s, bubblePulse 2.2s ease-in-out infinite 0.3s;
}

.leaf-3 {
    width: 90px;
    height: 90px;
    top: 10px;
    right: 120px;
    animation: sway1 4.2s ease-in-out infinite 1s, bubblePulse 1.8s ease-in-out infinite 0.6s;
}

/* Medium bubbles */
.leaf-4 {
    width: 80px;
    height: 80px;
    top: 80px;
    right: 50px;
    animation: sway2 3.8s ease-in-out infinite 0.3s, bubblePulse 2.1s ease-in-out infinite 0.9s;
}

.leaf-5 {
    width: 70px;
    height: 70px;
    top: 100px;
    right: 100px;
    animation: sway1 4.1s ease-in-out infinite 1.5s, bubblePulse 2.3s ease-in-out infinite 1.2s;
}

/* Small accent bubbles */
.leaf-6 {
    width: 60px;
    height: 60px;
    top: 60px;
    right: 150px;
    animation: sway2 3.6s ease-in-out infinite 0.8s, bubblePulse 1.9s ease-in-out infinite 0.4s;
}

.leaf-7 {
    width: 55px;
    height: 55px;
    top: 120px;
    right: 20px;
    animation: sway1 3.9s ease-in-out infinite 2s, bubblePulse 2.4s ease-in-out infinite 1.5s;
}

/* Swaying and pulsing animations */
@keyframes bubblePulse {
    0%, 100% {
        transform: scale(1);
        border-radius: 45% 55% 50% 50% / 50% 50% 45% 55%;
    }
    25% {
        transform: scale(1.08);
        border-radius: 50% 50% 45% 55% / 55% 45% 50% 50%;
    }
    50% {
        transform: scale(1.15);
        border-radius: 55% 45% 50% 50% / 50% 50% 55% 45%;
    }
    75% {
        transform: scale(1.08);
        border-radius: 50% 50% 55% 45% / 45% 55% 50% 50%;
    }
}

@keyframes sway1 {
    0%, 100% {
        transform: rotate(0deg) translateX(0);
    }
    25% {
        transform: rotate(-8deg) translateX(-5px);
    }
    75% {
        transform: rotate(8deg) translateX(5px);
    }
}

@keyframes sway2 {
    0%, 100% {
        transform: rotate(0deg) translateX(0);
    }
    30% {
        transform: rotate(10deg) translateX(6px);
    }
    70% {
        transform: rotate(-10deg) translateX(-6px);
    }
}

/* All vines - solid black */
.vine {
    position: absolute;
    width: 4px;
    background: black;
    border-radius: 2px;
}

/* Vines coming out of the top */
.vine-1 {
    height: 150px;
    top: -10px;
    right: 60px;
    animation: vineGrow 5s ease-in-out infinite;
}

.vine-2 {
    height: 120px;
    top: 5px;
    right: 110px;
    animation: vineGrow 5s ease-in-out infinite;
}

/* Vines inside the entity - visible through transparency */
.vine-3 {
    height: 90px;
    top: 50px;
    right: 140px;
    width: 4px;
    animation: vineSway 4s ease-in-out infinite;
}

.vine-4 {
    height: 110px;
    top: 40px;
    right: 180px;
    width: 4px;
    animation: vineSway 4.5s ease-in-out infinite 0.7s;
}

@keyframes vineGrow {
    0%, 100% {
        transform: scaleY(1);
    }
    50% {
        transform: scaleY(1.5);
    }
}

@keyframes vineSway {
    0%, 100% {
        transform: translateX(0) scaleY(1);
    }
    25% {
        transform: translateX(-3px) scaleY(1.1);
    }
    75% {
        transform: translateX(3px) scaleY(1.1);
    }
}