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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    overflow: hidden;
    background: linear-gradient(180deg, #1e40af 0%, #0369a1 100%);
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

#scene-container {
    width: 100vw;
    height: 100vh;
    touch-action: none;
}

#loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, #1e40af 0%, #0369a1 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-content {
    text-align: center;
    color: white;
}

.frog-loader {
    font-size: 4rem;
    animation: bounce 1s infinite;
    margin-bottom: 20px;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-20px);
    }
    60% {
        transform: translateY(-10px);
    }
}

.loading-text {
    font-size: 1.2rem;
    margin-bottom: 20px;
    color: #bbf7d0;
}

.loading-bar {
    width: 200px;
    height: 4px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
    overflow: hidden;
    margin: 0 auto;
}

.loading-progress {
    height: 100%;
    background: linear-gradient(90deg, #22c55e, #16a34a);
    width: 0%;
    transition: width 0.3s ease;
}

/* Virtual Joystick */
.joystick {
    position: fixed;
    width: 80px;
    height: 80px;
    z-index: 200;
    pointer-events: none;
}

.joystick-outer {
    width: 80px;
    height: 80px;
    border: 3px solid rgba(34, 197, 94, 0.8);
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.3);
    position: relative;
    backdrop-filter: blur(5px);
}

.joystick-inner {
    width: 30px;
    height: 30px;
    background: linear-gradient(145deg, #22c55e, #16a34a);
    border-radius: 50%;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    transition: transform 0.1s ease;
}

/* Mobile Settings Button */
.mobile-btn {
    position: fixed;
    background: linear-gradient(145deg, #22c55e, #16a34a);
    border: none;
    color: white;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 150;
    transition: all 0.3s ease;
}

.settings-btn {
    top: 20px;
    right: 20px;
}

.mobile-btn:active {
    transform: scale(0.95);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

/* Settings Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 300;
    backdrop-filter: blur(10px);
}

.modal-content {
    background: linear-gradient(145deg, #1e40af, #1e3a8a);
    border: 2px solid #22c55e;
    border-radius: 15px;
    padding: 20px;
    max-width: 350px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    color: white;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 1px solid rgba(34, 197, 94, 0.3);
    padding-bottom: 10px;
}

.modal-header h3 {
    color: #22c55e;
    margin: 0;
}

.close-btn {
    background: none;
    border: none;
    color: #ef4444;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.setting-group label {
    display: block;
    margin-bottom: 5px;
    color: #e5e7eb;
    font-size: 14px;
}

.setting-group select,
.setting-group input[type="range"] {
    width: 100%;
    padding: 8px;
    border: 1px solid #22c55e;
    border-radius: 5px;
    background: rgba(0, 0, 0, 0.3);
    color: white;
    font-size: 14px;
}

.setting-group input[type="checkbox"] {
    margin-right: 8px;
}

#hud {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 100;
}

.hud-panel {
    position: absolute;
    background: rgba(0, 0, 0, 0.8);
    border: 2px solid #22c55e;
    border-radius: 10px;
    padding: 12px;
    color: white;
    font-size: 14px;
    backdrop-filter: blur(10px);
    pointer-events: all;
}

.top-stats {
    top: 20px;
    left: 20px;
}

.bottom-controls {
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
}

.controls-help {
    top: 80px;
    right: 20px;
    max-width: 250px;
}

.controls-help h3 {
    color: #22c55e;
    margin-bottom: 10px;
    text-align: center;
    font-size: 16px;
}

.stat-line, .control-row {
    margin-bottom: 4px;
    color: #e5e7eb;
    font-size: 12px;
}

.game-btn {
    background: linear-gradient(145deg, #22c55e, #16a34a);
    border: none;
    color: white;
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    white-space: nowrap;
}

.game-btn:hover {
    background: linear-gradient(145deg, #16a34a, #15803d);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.4);
}

.game-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.tooltip {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(145deg, rgba(34, 197, 94, 0.95), rgba(22, 163, 74, 0.95));
    border: 2px solid #22c55e;
    border-radius: 10px;
    padding: 15px 20px;
    color: white;
    font-size: 16px;
    font-weight: bold;
    text-align: center;
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    z-index: 200;
    animation: tooltipPop 0.3s ease-out;
    max-width: 90vw;
}

@keyframes tooltipPop {
    0% {
        transform: translate(-50%, -50%) scale(0.5);
        opacity: 0;
    }
    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
}

.tooltip-content .file-name {
    font-size: 18px;
    margin-bottom: 5px;
    color: #f0fdf4;
}

.tooltip-content .file-size {
    font-size: 14px;
    color: #bbf7d0;
}

.hidden {
    display: none !important;
}

.footer {
    position: fixed;
    bottom: 10px;
    right: 20px;
    z-index: 150;
    opacity: 0.7;
}

.footer a {
    color: #22c55e;
    text-decoration: none;
    font-size: 12px;
    font-weight: bold;
    transition: opacity 0.3s ease;
}

.footer a:hover {
    opacity: 1;
    text-decoration: underline;
}

/* Mobile Responsive Design */
@media (max-width: 768px) {
    .hud-panel {
        font-size: 12px;
        padding: 8px;
    }
    
    .top-stats {
        top: 10px;
        left: 10px;
    }
    
    .controls-help {
        top: 70px;
        right: 10px;
        max-width: 200px;
        font-size: 11px;
    }
    
    .controls-help h3 {
        font-size: 14px;
    }
    
    .bottom-controls {
        bottom: 90px;
        flex-direction: row;
        gap: 8px;
    }
    
    .game-btn {
        padding: 8px 12px;
        font-size: 11px;
    }
    
    .tooltip {
        font-size: 14px;
        padding: 12px 16px;
        max-width: 85vw;
    }
    
    .tooltip-content .file-name {
        font-size: 16px;
    }
    
    .tooltip-content .file-size {
        font-size: 12px;
    }
    
    .mobile-btn {
        width: 45px;
        height: 45px;
        font-size: 16px;
    }
    
    .settings-btn {
        top: 15px;
        right: 15px;
    }
    
    .joystick {
        width: 70px;
        height: 70px;
    }
    
    .joystick-outer {
        width: 70px;
        height: 70px;
    }
    
    .joystick-inner {
        width: 25px;
        height: 25px;
    }
}

@media (max-width: 480px) {
    .controls-help {
        max-width: 160px;
        font-size: 10px;
    }
    
    .hud-panel {
        font-size: 11px;
        padding: 6px;
    }
    
    .tooltip {
        font-size: 12px;
        padding: 10px 14px;
    }
    
    .tooltip-content .file-name {
        font-size: 14px;
    }
    
    .tooltip-content .file-size {
        font-size: 11px;
    }
    
    .bottom-controls {
        bottom: 80px;
    }
    
    .game-btn {
        padding: 6px 10px;
        font-size: 10px;
    }
    
    .joystick {
        width: 60px;
        height: 60px;
    }
    
    .joystick-outer {
        width: 60px;
        height: 60px;
    }
    
    .joystick-inner {
        width: 20px;
        height: 20px;
    }
}

/* Landscape orientation adjustments */
@media (max-height: 500px) and (orientation: landscape) {
    .top-stats {
        top: 5px;
        left: 5px;
    }
    
    .controls-help {
        top: 5px;
        right: 5px;
        max-width: 180px;
    }
    
    .bottom-controls {
        bottom: 10px;
    }
    
    .settings-btn {
        top: 5px;
        right: 200px;
    }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .joystick-inner {
        box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
    }
}

/* PWA specific styles */
@media (display-mode: standalone) {
    body {
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
        padding-left: env(safe-area-inset-left);
        padding-right: env(safe-area-inset-right);
    }
}