body, html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: #222;
    font-family: 'Pusab', sans-serif;
    user-select: none;
    touch-action: none;
}

#game-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: none; /* Hide default cursor */
}

#game-container, #game-canvas, #ui, #score-container, button, input, div, * {
    cursor: none !important;
}

#custom-cursor {
    position: fixed;
    top: 0;
    left: 0;
    width: 48px;
    height: 48px;
    background-image: url('/cursor.png');
    background-size: contain;
    background-repeat: no-repeat;
    pointer-events: none;
    z-index: 999999;
    display: none;
    filter: drop-shadow(2px 2px 2px rgba(0,0,0,0.5));
}

#game-canvas {
    display: block;
    width: 100%;
    height: 100%;
    background-color: #87CEEB;
}

#ui {
    position: absolute;
    top: 20px;
    width: 100%;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    transition: opacity 0.5s;
    z-index: 50;
}

#main-menu {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    color: white;
}

#game-title {
    font-size: 48px;
    margin-bottom: 40px;
    text-shadow: 4px 4px 0px #f39c12;
    text-align: center;
}

#menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

#menu-buttons button {
    font-family: 'Pusab', sans-serif;
    padding: 15px 30px;
    font-size: 20px;
    cursor: pointer;
    background: #f39c12;
    border: none;
    border-radius: 10px;
    color: white;
    box-shadow: 0 5px 0 #d35400;
}

#menu-buttons button:active {
    transform: translateY(3px);
    box-shadow: 0 2px 0 #d35400;
}

#decor-shop {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.9);
    border: 4px solid #fff;
    padding: 20px;
    color: white;
    z-index: 600;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    border-radius: 20px;
}

#decor-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.decor-item {
    font-family: 'Pusab', sans-serif;
    padding: 10px;
    cursor: pointer;
    background: #444;
    color: white;
    border: 2px solid white;
    border-radius: 5px;
}

#decor-toggle-btn {
    border-color: #3498db !important;
}

.glitch-active #ui {
    pointer-events: auto;
}

#glitch-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    mix-blend-mode: difference;
    background: transparent;
    z-index: 100;
}

.glitch-active #glitch-overlay {
    animation: glitch-anim 0.05s infinite, tear-anim 0.3s infinite;
    background: repeating-linear-gradient(0deg, rgba(0,0,0,0.1) 0px, rgba(0,0,0,0.1) 1px, transparent 1px, transparent 2px);
}

@keyframes glitch-anim {
    0% { background: rgba(255, 0, 0, 0.3); transform: translate(8px, 2px) skew(5deg); }
    25% { background: rgba(0, 255, 0, 0.3); transform: translate(-8px, -4px) skew(-5deg); filter: hue-rotate(90deg); }
    50% { background: rgba(0, 0, 255, 0.3); transform: translate(15px, 0px) scaleY(1.1); }
    75% { background: rgba(255, 255, 0, 0.3); transform: translate(-5px, 5px) rotate(1deg); }
    100% { background: transparent; transform: translate(0, 0); }
}

@keyframes tear-anim {
    0% { clip-path: inset(80% 0 0% 0); opacity: 0.8; background: #fff; }
    10% { clip-path: inset(10% 0 70% 0); opacity: 0.4; }
    20% { clip-path: inset(40% 0 40% 0); opacity: 0.6; background: #f0f; }
    30% { clip-path: none; opacity: 0; }
}

#error-popups {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 150;
}

.fake-error {
    position: absolute;
    background: #c0c0c0;
    border: 2px solid #fff;
    border-right: 2px solid #444;
    border-bottom: 2px solid #444;
    padding: 10px;
    font-family: 'Courier New', Courier, monospace;
    font-weight: bold;
    font-size: 14px;
    color: #000;
    box-shadow: 5px 5px 0px rgba(0,0,0,0.5);
    min-width: 150px;
}

.fake-error::before {
    content: "SYSTEM FAILURE";
    display: block;
    background: #000080;
    color: white;
    padding: 2px 5px;
    margin-bottom: 5px;
}

#score-container {
    position: relative;
    background: rgba(0, 0, 0, 0.5);
    padding: 10px 20px;
    border-radius: 20px;
    color: white;
    font-size: 24px;
    text-shadow: 2px 2px 0px #000;
    border: 3px solid #fff;
    user-select: none;
    touch-action: none;
}

#score-container.glitched {
    position: absolute;
    cursor: move;
    background: rgba(255, 0, 255, 0.3);
    border-color: #f0f;
    box-shadow: 0 0 20px #f0f;
}

#tiny-secret {
    position: absolute;
    top: -5px;
    left: 10px;
    width: 45px;
    height: 45px;
    display: none;
    cursor: pointer;
    border: 2px solid white;
    z-index: 10;
    pointer-events: auto;
}

#tiny-secret.active {
    display: block;
}



#shop-ui {
    display: flex;
    gap: 10px;
    pointer-events: auto;
}

#shop-ui button {
    font-family: 'Pusab', sans-serif;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: 2px solid white;
    padding: 8px 12px;
    border-radius: 10px;
    font-size: 14px;
    cursor: pointer;
    transition: transform 0.1s, background 0.3s;
}

#shop-ui button:active {
    transform: scale(0.95);
}

#shop-ui button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#rebirth-btn, #rebirth-2-btn {
    border-color: #ffd700 !important;
    color: #ffd700 !important;
    display: none;
}

#rebirth-2-btn {
    border-color: #a29bfe !important;
    color: #a29bfe !important;
}

#rebirth-3-btn {
    border-color: #f1c40f !important;
    color: #f1c40f !important;
}

#story-btn {
    border-color: #ff00ff !important;
    color: #ff00ff !important;
    animation: story-glow 2s infinite alternate;
}

@keyframes story-glow {
    from { box-shadow: 0 0 5px #ff00ff; }
    to { box-shadow: 0 0 20px #ff00ff, 0 0 30px #00ffff; }
}

#story-modal {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.85);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: auto;
}

#story-content {
    background: linear-gradient(135deg, #1a1a1a 0%, #000 100%);
    width: 85%;
    max-height: 85%;
    border: 4px solid #ff00ff;
    border-radius: 20px;
    padding: 30px;
    color: white;
    display: flex;
    flex-direction: column;
    box-shadow: 0 0 50px rgba(255, 0, 255, 0.5);
    box-sizing: border-box;
}

#story-header h2 {
    margin-top: 0;
    color: #00ffff;
    text-shadow: 2px 2px #ff00ff;
    text-align: center;
    font-size: 28px;
}

#story-body {
    flex: 1;
    overflow-y: auto;
    font-family: 'Courier New', Courier, monospace;
    font-size: 16px;
    line-height: 1.5;
    padding-right: 10px;
}

#story-body p {
    margin-bottom: 20px;
}

#story-body strong {
    color: #f1c40f;
}

#close-story {
    margin-top: 20px;
    font-family: 'Pusab', sans-serif;
    padding: 10px;
    background: #ff00ff;
    border: none;
    color: white;
    border-radius: 10px;
    cursor: pointer;
}



#joystick-zone {
    position: absolute;
    bottom: 20px;
    left: 20px;
    width: 150px;
    height: 150px;
    z-index: 200;
    pointer-events: auto;
}