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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    overflow: hidden;
    background: #87ceeb;
}

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

canvas {
    display: block;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(135deg, #1a1a2e 0%, #0f0f1e 100%);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.loading-overlay.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loading-container {
    width: 90%;
    max-width: 800px;
    display: flex;
    flex-direction: column;
    gap: 30px;
}

/* Terminal */
.terminal {
    background: #000000;
    border: 3px solid #00ff00;
    border-radius: 8px;
    box-shadow: 0 0 20px rgba(0, 255, 0, 0.3), inset 0 0 60px rgba(0, 255, 0, 0.05);
    overflow: hidden;
    font-family: 'Courier New', Courier, monospace;
}

.terminal-header {
    background: #00ff00;
    color: #000000;
    padding: 10px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: bold;
    font-size: 14px;
}

.terminal-title {
    letter-spacing: 1px;
}

.terminal-status {
    animation: pulse 1.5s ease-in-out infinite;
}

.terminal-body {
    padding: 20px;
    color: #00ff00;
    font-size: 13px;
    line-height: 1.6;
    height: 300px;
    overflow-y: auto;
    background: #000000;
}

.terminal-line {
    margin-bottom: 5px;
    animation: terminal-flicker 0.15s ease-in;
}

.terminal-line.success {
    color: #00ff00;
}

.terminal-line.warning {
    color: #ffaa00;
}

.terminal-line.error {
    color: #ff0000;
}

.terminal-line.info {
    color: #00aaff;
}

.terminal-cursor {
    display: inline-block;
    width: 8px;
    height: 14px;
    background: #00ff00;
    animation: blink 1s step-end infinite;
    margin-left: 2px;
}

/* Loading Bar */
.loading-bar-container {
    background: rgba(0, 0, 0, 0.4);
    border: 2px solid rgba(255, 105, 180, 0.5);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 0 20px rgba(255, 105, 180, 0.2);
}

.loading-bar-label {
    color: #ff69b4;
    font-size: 14px;
    font-weight: bold;
    margin-bottom: 10px;
    text-align: center;
    letter-spacing: 2px;
    text-shadow: 0 0 10px rgba(255, 105, 180, 0.5);
}

.loading-bar-track {
    width: 100%;
    height: 30px;
    background: rgba(0, 0, 0, 0.6);
    border: 2px solid rgba(255, 105, 180, 0.3);
    border-radius: 15px;
    overflow: hidden;
    position: relative;
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.5);
}

.loading-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, 
        #ff1493 0%, 
        #ff69b4 25%, 
        #ffb6c1 50%, 
        #ff69b4 75%, 
        #ff1493 100%);
    background-size: 200% 100%;
    border-radius: 13px;
    width: 0%;
    transition: width 0.3s ease;
    animation: shimmer 2s linear infinite;
    box-shadow: 0 0 20px rgba(255, 105, 180, 0.6);
    position: relative;
}

.loading-bar-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 50%;
    background: linear-gradient(180deg, 
        rgba(255, 255, 255, 0.3) 0%, 
        transparent 100%);
    border-radius: 13px 13px 0 0;
}

.loading-bar-percentage {
    color: #ff69b4;
    font-size: 18px;
    font-weight: bold;
    text-align: center;
    margin-top: 10px;
    text-shadow: 0 0 10px rgba(255, 105, 180, 0.5);
}

/* Animations */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

@keyframes terminal-flicker {
    0% { opacity: 0.8; }
    100% { opacity: 1; }
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Scrollbar for terminal */
.terminal-body::-webkit-scrollbar {
    width: 8px;
}

.terminal-body::-webkit-scrollbar-track {
    background: #000000;
}

.terminal-body::-webkit-scrollbar-thumb {
    background: #00ff00;
    border-radius: 4px;
}

.joystick {
    position: fixed;
    bottom: 30px;
    left: 30px;
    z-index: 100;
    pointer-events: none;
}

.joystick-base {
    width: 120px;
    height: 120px;
    background: rgba(0, 0, 0, 0.3);
    border: 3px solid rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    position: relative;
    pointer-events: all;
    touch-action: none;
}

.joystick-knob {
    width: 50px;
    height: 50px;
    background: rgba(255, 105, 180, 0.8);
    border: 3px solid rgba(255, 255, 255, 0.6);
    border-radius: 50%;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    transition: background 0.2s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.joystick-base:active .joystick-knob {
    background: rgba(255, 105, 180, 1);
}

.zoom-slider {
    position: fixed;
    top: 50%;
    right: 30px;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    z-index: 100;
    pointer-events: none;
}

.zoom-label {
    font-size: 18px;
    user-select: none;
    opacity: 0.8;
    pointer-events: none;
}

.zoom-track {
    width: 50px;
    height: 200px;
    background: rgba(0, 0, 0, 0.3);
    border: 3px solid rgba(255, 255, 255, 0.4);
    border-radius: 25px;
    position: relative;
    cursor: pointer;
    touch-action: none;
    pointer-events: all;
}

.zoom-handle {
    width: 44px;
    height: 44px;
    background: rgba(59, 206, 172, 0.9);
    border: 3px solid rgba(255, 255, 255, 0.6);
    border-radius: 50%;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    transition: background 0.2s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    pointer-events: none;
}

.zoom-track:active .zoom-handle {
    background: rgba(59, 206, 172, 1);
}

/* Catch Fish Button - FIXED Z-INDEX AND POINTER EVENTS */
.catch-fish-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 70px;
    height: 70px;
    background: rgba(255, 105, 180, 0.9);
    border: 4px solid rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    font-size: 32px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
    z-index: 1000;
    display: none;
    pointer-events: all;
    touch-action: manipulation;
}

.catch-fish-btn:hover {
    background: rgba(255, 105, 180, 1);
    transform: scale(1.1);
    box-shadow: 0 8px 30px rgba(255, 105, 180, 0.6);
}

.catch-fish-btn:active {
    transform: scale(0.95);
}

.catch-fish-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: scale(1);
}

.controls-overlay {
    position: fixed;
    bottom: 170px;
    left: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    color: white;
    padding: 15px 25px;
    border-radius: 10px;
    font-size: 14px;
    transition: opacity 0.5s ease;
    pointer-events: none;
    z-index: 50;
    text-align: center;
}

.controls-overlay.fade {
    opacity: 0;
}

.controls-overlay p {
    margin: 0;
}

/* Settings Toggle Button - FIXED Z-INDEX AND POINTER EVENTS */
.settings-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 1001;
    pointer-events: all;
    touch-action: manipulation;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.settings-toggle:hover {
    background: rgba(0, 0, 0, 0.8);
    transform: rotate(90deg);
    border-color: rgba(255, 255, 255, 0.5);
}

.settings-toggle:active {
    transform: rotate(90deg) scale(0.95);
}

.settings-panel {
    position: fixed;
    top: 20px;
    right: -350px;
    width: 320px;
    max-height: 90vh;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(20px);
    color: white;
    padding: 20px;
    border-radius: 15px;
    transition: right 0.4s ease;
    overflow-y: auto;
    z-index: 1000;
    pointer-events: all;
}

.settings-panel.open {
    right: 20px;
}

.settings-panel h3 {
    margin: 0 0 20px 0;
    font-size: 20px;
    font-weight: 600;
}

.setting-group {
    margin-bottom: 20px;
}

.setting-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 500;
}

.setting-group input[type="range"] {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.2);
    outline: none;
    -webkit-appearance: none;
}

.setting-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #3bceac;
    cursor: pointer;
    transition: all 0.2s ease;
}

.setting-group input[type="range"]::-webkit-slider-thumb:hover {
    background: #2db89a;
    transform: scale(1.2);
}

.setting-group select {
    width: 100%;
    padding: 10px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: white;
    font-size: 14px;
    cursor: pointer;
}

.setting-group select option {
    background: #1a1a1a;
}

.preset-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 20px;
}

.preset-btn {
    padding: 12px;
    background: rgba(59, 206, 172, 0.2);
    border: 1px solid rgba(59, 206, 172, 0.4);
    border-radius: 8px;
    color: white;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.preset-btn:hover {
    background: rgba(59, 206, 172, 0.4);
    transform: translateY(-2px);
}

.easter-eggs {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    text-align: center;
    color: rgba(255, 255, 255, 0.6);
}

.fps-counter {
    position: fixed;
    top: 20px;
    left: 20px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    color: #3bceac;
    padding: 10px 15px;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    font-weight: bold;
    z-index: 50;
}

.footer {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    color: white;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 13px;
    z-index: 50;
    display: flex;
    align-items: center;
    gap: 10px;
    pointer-events: none;
}

.footer a {
    color: #3bceac;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s ease;
    pointer-events: all;
}

.footer a:hover {
    color: #2db89a;
}

.divider {
    color: rgba(255, 255, 255, 0.3);
}

/* Scrollbar styling for settings panel */
.settings-panel::-webkit-scrollbar {
    width: 6px;
}

.settings-panel::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
}

.settings-panel::-webkit-scrollbar-thumb {
    background: rgba(59, 206, 172, 0.5);
    border-radius: 3px;
}

.settings-panel::-webkit-scrollbar-thumb:hover {
    background: rgba(59, 206, 172, 0.7);
}

/* Mobile optimizations */
@media (max-width: 768px) {
    .joystick {
        bottom: 20px;
        left: 20px;
    }
    
    .joystick-base {
        width: 100px;
        height: 100px;
    }
    
    .joystick-knob {
        width: 40px;
        height: 40px;
    }
    
    .zoom-slider {
        right: 20px;
    }
    
    .zoom-track {
        width: 40px;
        height: 160px;
    }
    
    .zoom-handle {
        width: 34px;
        height: 34px;
    }
    
    .zoom-label {
        font-size: 16px;
    }
    
    .catch-fish-btn {
        width: 60px;
        height: 60px;
        font-size: 28px;
        bottom: 15px;
        right: 15px;
    }
    
    .settings-toggle {
        width: 45px;
        height: 45px;
        top: 15px;
        right: 15px;
    }
    
    .settings-panel {
        width: 90vw;
        right: -95vw;
    }
    
    .settings-panel.open {
        right: 5vw;
    }
    
    .controls-overlay {
        bottom: 150px;
        left: 10px;
        right: 10px;
        text-align: center;
        font-size: 12px;
        padding: 12px 15px;
    }
    
    .footer {
        font-size: 11px;
        padding: 8px 15px;
        bottom: 10px;
    }
    
    .preset-buttons {
        grid-template-columns: 1fr;
    }
    
    .loading-container {
        width: 95%;
        gap: 20px;
    }
    
    .terminal-body {
        height: 200px;
        font-size: 11px;
        padding: 15px;
    }
    
    .terminal-header {
        font-size: 12px;
        padding: 8px 12px;
    }
}