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

body {
    overflow: hidden;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    background: #1a1a2e;
}

#scene-container {
    width: 100vw;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
}

#scene-container canvas {
    display: block;
}

#crosshair {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 6px;
    height: 6px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    pointer-events: none;
    z-index: 100;
    box-shadow: 0 0 4px rgba(0, 0, 0, 0.5);
}

#instructions {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(20, 20, 30, 0.85);
    color: #E8E4E0;
    padding: 15px 30px;
    border-radius: 8px;
    font-size: 14px;
    letter-spacing: 0.5px;
    z-index: 100;
    transition: opacity 0.5s ease;
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
}

#instructions p {
    margin: 0;
    text-align: center;
}

#minimap {
    position: fixed;
    top: 20px;
    right: 20px;
    display: none;
    z-index: 100;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

#reset-button {
    position: fixed;
    top: 20px;
    left: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, #E74C3C, #C0392B);
    border: 3px solid rgba(255, 255, 255, 0.5);
    font-size: 22px;
    cursor: pointer;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(231, 76, 60, 0.5);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

#reset-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(231, 76, 60, 0.7);
}

#reset-button:active,
#reset-button.active {
    transform: scale(0.95);
    background: linear-gradient(135deg, #C0392B, #922B21);
    box-shadow: 0 2px 10px rgba(231, 76, 60, 0.8), 0 0 30px rgba(231, 76, 60, 0.5);
}

#debug-overlay {
    position: fixed;
    top: 20px;
    left: 20px;
    background: rgba(0, 0, 0, 0.75);
    color: #0f0;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 12px;
    padding: 10px 14px;
    border-radius: 6px;
    z-index: 200;
    display: none;
    line-height: 1.6;
    border: 1px solid rgba(0, 255, 0, 0.3);
}

#debug-overlay.visible {
    display: block;
    top: 80px;
}

#debug-overlay span {
    color: #fff;
}

#debug-collision.colliding {
    color: #ff4444 !important;
    font-weight: bold;
}

#remix-link {
    position: fixed;
    bottom: 10px;
    right: 10px;
    color: rgba(255, 255, 255, 0.4);
    text-decoration: none;
    font-size: 11px;
    font-family: 'JetBrains Mono', monospace;
    z-index: 100;
    transition: color 0.3s ease;
}

#remix-link:hover {
    color: rgba(255, 255, 255, 0.8);
}

#hedgehog-button {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #FF69B4;
    border: 3px solid rgba(255, 255, 255, 0.5);
    font-size: 28px;
    cursor: pointer;
    z-index: 200;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(255, 105, 180, 0.5);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

#hedgehog-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(255, 105, 180, 0.7);
}

#hedgehog-button:active,
#hedgehog-button.active {
    transform: scale(0.95);
    background: #FF1493;
    box-shadow: 0 2px 10px rgba(255, 105, 180, 0.8), 0 0 30px rgba(255, 105, 180, 0.5);
}

#roguepig-button {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #9B59B6;
    border: 3px solid rgba(255, 255, 255, 0.5);
    font-size: 28px;
    cursor: pointer;
    z-index: 200;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(155, 89, 182, 0.5);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

#roguepig-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(155, 89, 182, 0.7);
}

#roguepig-button:active,
#roguepig-button.active {
    transform: scale(0.95);
    background: #8E44AD;
    box-shadow: 0 2px 10px rgba(155, 89, 182, 0.8), 0 0 30px rgba(155, 89, 182, 0.5);
}

#frok-button {
    position: fixed;
    bottom: 170px;
    right: 30px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #2ECC71;
    border: 3px solid rgba(255, 255, 255, 0.5);
    font-size: 28px;
    cursor: pointer;
    z-index: 200;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(46, 204, 113, 0.5);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

#frok-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(46, 204, 113, 0.7);
}

#frok-button:active,
#frok-button.active {
    transform: scale(0.95);
    background: #27AE60;
    box-shadow: 0 2px 10px rgba(46, 204, 113, 0.8), 0 0 30px rgba(46, 204, 113, 0.5);
}

#summon-button {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: linear-gradient(135deg, #E74C3C, #C0392B);
    border: 3px solid rgba(255, 255, 255, 0.6);
    font-size: 32px;
    cursor: pointer;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(231, 76, 60, 0.6), 0 0 40px rgba(231, 76, 60, 0.3);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    animation: summon-pulse 2s ease-in-out infinite;
}

@keyframes summon-pulse {
    0%, 100% { box-shadow: 0 4px 20px rgba(231, 76, 60, 0.6), 0 0 40px rgba(231, 76, 60, 0.3); }
    50% { box-shadow: 0 4px 30px rgba(231, 76, 60, 0.8), 0 0 60px rgba(231, 76, 60, 0.5); }
}

#summon-button:hover {
    transform: translateX(-50%) scale(1.1);
    box-shadow: 0 6px 25px rgba(231, 76, 60, 0.8), 0 0 50px rgba(231, 76, 60, 0.5);
}

#summon-button:active,
#summon-button.active {
    transform: translateX(-50%) scale(0.9);
    background: linear-gradient(135deg, #C0392B, #922B21);
    box-shadow: 0 2px 15px rgba(231, 76, 60, 1), 0 0 60px rgba(231, 76, 60, 0.7);
}

#mic-button {
    position: fixed;
    bottom: 30px;
    left: 30px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3498DB, #2980B9);
    border: 3px solid rgba(255, 255, 255, 0.5);
    font-size: 28px;
    cursor: pointer;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(52, 152, 219, 0.5);
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

#mic-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(52, 152, 219, 0.7);
}

#mic-button:active,
#mic-button.active {
    transform: scale(0.95);
    background: linear-gradient(135deg, #E74C3C, #C0392B);
    box-shadow: 0 2px 10px rgba(231, 76, 60, 0.8), 0 0 30px rgba(231, 76, 60, 0.5);
    animation: mic-pulse 0.5s ease-in-out infinite;
}

@keyframes mic-pulse {
    0%, 100% { box-shadow: 0 2px 10px rgba(231, 76, 60, 0.8), 0 0 30px rgba(231, 76, 60, 0.5); }
    50% { box-shadow: 0 2px 20px rgba(231, 76, 60, 1), 0 0 50px rgba(231, 76, 60, 0.8); }
}

#speech-display {
    position: fixed;
    bottom: 15%;
    left: 50%;
    transform: translateX(-50%);
    width: 80%;
    max-width: 600px;
    min-height: 80px;
    background: rgba(20, 20, 30, 0.9);
    border: 2px solid rgba(52, 152, 219, 0.5);
    border-radius: 16px;
    padding: 20px 25px;
    z-index: 150;
    display: none;
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

#speech-display.visible {
    display: block;
    animation: speech-fade-in 0.3s ease-out;
}

@keyframes speech-fade-in {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

#speech-text {
    color: #E8E4E0;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 18px;
    line-height: 1.5;
    text-align: center;
    word-wrap: break-word;
}

#speech-text.listening {
    color: rgba(52, 152, 219, 0.7);
}

#speech-text.listening::after {
    content: '';
    animation: listening-dots 1.5s infinite;
}

#speech-text {
    min-height: 1.5em;
}

@keyframes listening-dots {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60%, 100% { content: '...'; }
}

/* Hedgey dialog indicator */
#hedgehog-button.has-dialog {
    animation: hedgey-talking 0.5s ease-in-out infinite;
}

@keyframes hedgey-talking {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}

#target-mode-indicator {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 105, 180, 0.9);
    color: white;
    padding: 15px 25px;
    border-radius: 10px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    z-index: 300;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.3);
}

#target-mode-indicator.visible {
    opacity: 1;
    animation: pulse-indicator 1.5s ease-in-out infinite;
}

@keyframes pulse-indicator {
    0%, 100% { transform: translate(-50%, -50%) scale(1); }
    50% { transform: translate(-50%, -50%) scale(1.05); }
}

#joystick-container {
    position: fixed;
    bottom: 30px;
    left: 30px;
    z-index: 200;
    display: none;
    touch-action: none;
}

#joystick-base {
    width: 120px;
    height: 120px;
    background: rgba(20, 20, 30, 0.6);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
    touch-action: none;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

#joystick-stick {
    width: 50px;
    height: 50px;
    background: rgba(255, 107, 107, 0.8);
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    pointer-events: none;
}

.desktop-only {
    display: block;
}

.mobile-only {
    display: none;
}

@media (max-width: 768px) {
    #instructions {
        font-size: 11px;
        padding: 10px 20px;
        bottom: 20px;
    }
    
    #minimap {
        width: 150px;
        height: 210px;
    }
}

@media (pointer: coarse), (max-width: 768px) {
    #joystick-container {
        display: block;
    }
    
    #crosshair {
        display: none;
    }
    
    .desktop-only {
        display: none;
    }
    
    .mobile-only {
        display: block;
    }
    
    #instructions {
        bottom: 160px;
        font-size: 12px;
        padding: 8px 16px;
    }
    
    #summon-button {
        bottom: 120px;
    }
    
    #mic-button {
        left: auto;
        right: 100px;
        bottom: 30px;
    }
    
    #speech-display {
        width: 90%;
        bottom: 20%;
    }
    
    #speech-text {
        font-size: 16px;
    }
}