/* Main styling for Blob Quest: The Transformation */
@import url('https://fonts.googleapis.com/css2?family=Exo+2:wght@300;400;700&display=swap');

/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body, html {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: 'Exo 2', sans-serif;
    background-color: #000;
    color: #fff;
}

/* Game container */
#game-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* UI container and elements */
#ui-container {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none; /* Allow clicking through UI */
}

.ui-item {
    display: flex;
    align-items: center;
    gap: 10px;
    background-color: rgba(0, 0, 0, 0.6);
    padding: 8px 12px;
    border-radius: 20px;
    backdrop-filter: blur(4px);
    border: 1px solid rgba(0, 200, 255, 0.3);
    box-shadow: 0 0 15px rgba(0, 200, 255, 0.2);
    transition: all 0.3s ease;
}

.ui-item span {
    font-size: 16px;
    font-weight: 500;
    text-shadow: 0 0 5px rgba(0, 200, 255, 0.7);
}

.ui-bar {
    width: 100px;
    height: 6px;
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
    overflow: hidden;
}

.ui-bar-fill {
    height: 100%;
    width: 0%;
    background-color: #00ccff;
    box-shadow: 0 0 10px rgba(0, 200, 255, 0.8);
    transition: width 0.2s ease-out;
}

#power-ui .ui-bar-fill {
    background-color: #A020F0;
    box-shadow: 0 0 10px rgba(160, 32, 240, 0.8);
}

/* FPS counter */
#fps-counter {
    position: absolute;
    top: 20px;
    right: 20px;
    background-color: rgba(0, 0, 0, 0.6);
    padding: 5px 10px;
    border-radius: 10px;
    font-family: monospace;
    font-size: 14px;
    z-index: 10;
    border: 1px solid rgba(0, 200, 255, 0.3);
}

/* Position display for debugging */
#position-display {
    position: absolute;
    top: 50px;
    right: 20px;
    background-color: rgba(0, 0, 0, 0.6);
    padding: 5px 10px;
    border-radius: 10px;
    font-family: monospace;
    font-size: 12px;
    z-index: 10;
    border: 1px solid rgba(0, 200, 255, 0.3);
}

/* Ability notification */
#ability-notification {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(0, 0, 0, 0.7);
    color: #00BBFF;
    padding: 15px 30px;
    border-radius: 30px;
    font-size: 20px;
    font-weight: bold;
    opacity: 0;
    transition: opacity 0.3s, transform 0.3s;
    text-align: center;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    text-shadow: 0 0 10px rgba(0, 187, 255, 0.5);
    z-index: 100;
    pointer-events: none;
}

/* Loading screen */
#loading-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, #001428 0%, #000000 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    transition: opacity 0.5s, transform 0.5s;
}

#loading-screen h1 {
    font-size: 4rem;
    margin-bottom: 0.5rem;
    color: #00ccff;
    text-shadow: 0 0 20px rgba(0, 200, 255, 0.8);
    letter-spacing: 4px;
}

#loading-screen h2 {
    font-size: 2rem;
    margin-bottom: 2rem;
    color: #ffffff;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
    letter-spacing: 2px;
}

#loading-bar-container {
    width: 300px;
    height: 10px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 5px;
    overflow: hidden;
    margin-bottom: 1rem;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.5);
}

#loading-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(to right, #00CCFF, #33FFFF);
    box-shadow: 0 0 10px rgba(0, 204, 255, 0.6);
    transition: width 0.3s ease-out;
}

#loading-text {
    font-size: 1rem;
    color: #ffffff;
    text-shadow: 0 0 5px rgba(255, 255, 255, 0.5);
}

/* Intro screen */
#intro-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, #001428 0%, #000000 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    z-index: 1000;
    transition: opacity 0.5s, transform 0.5s;
    padding: 20px;
}

#intro-screen h1 {
    font-size: 4rem;
    margin-bottom: 0.5rem;
    color: #00ccff;
    text-shadow: 0 0 20px rgba(0, 200, 255, 0.8);
    letter-spacing: 4px;
}

#intro-screen h2 {
    font-size: 2rem;
    margin-bottom: 1.5rem;
    color: #ffffff;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
    letter-spacing: 2px;
}

#intro-screen p {
    font-size: 1.2rem;
    max-width: 600px;
    margin-bottom: 2rem;
    line-height: 1.6;
    color: #bbdefb;
}

/* Controls section */
#controls {
    background-color: rgba(0, 0, 0, 0.4);
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 2rem;
    max-width: 600px;
    border: 1px solid rgba(0, 200, 255, 0.3);
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
}

#controls h3 {
    font-size: 1.5rem;
    margin-bottom: 15px;
    color: #00ccff;
    text-shadow: 0 0 10px rgba(0, 200, 255, 0.5);
    letter-spacing: 2px;
}

.control-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.control-row div {
    flex: 1;
    min-width: 250px;
    text-align: left;
    margin: 5px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.control-key {
    display: inline-block;
    background-color: rgba(0, 200, 255, 0.2);
    padding: 5px 10px;
    border-radius: 5px;
    font-family: monospace;
    font-weight: bold;
    border: 1px solid rgba(0, 200, 255, 0.5);
    box-shadow: 0 0 5px rgba(0, 200, 255, 0.3);
    min-width: 60px;
    text-align: center;
}

/* Game over screen */
#game-over-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, #001428 0%, #000000 90%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    transition: opacity 0.5s, transform 0.5s;
}

#game-over-screen h1 {
    font-size: 4rem;
    margin-bottom: 1rem;
    color: #00ccff;
    text-shadow: 0 0 20px rgba(0, 200, 255, 0.8);
    letter-spacing: 4px;
}

#game-over-screen p {
    font-size: 1.5rem;
    max-width: 600px;
    margin-bottom: 2rem;
    text-align: center;
    line-height: 1.6;
    color: #bbdefb;
}

/* Settings panel */
#settings-panel {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80%;
    max-width: 400px;
    background: rgba(0, 20, 40, 0.9);
    border-radius: 15px;
    padding: 20px;
    z-index: 1001;
    border: 1px solid rgba(0, 200, 255, 0.5);
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
}

#settings-panel h2 {
    color: #00ccff;
    text-align: center;
    margin-bottom: 20px;
    text-shadow: 0 0 10px rgba(0, 200, 255, 0.5);
}

.settings-option {
    margin-bottom: 15px;
}

.settings-option label {
    display: block;
    margin-bottom: 5px;
    color: #fff;
}

.settings-option select,
.settings-option input {
    width: 100%;
    padding: 8px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(0, 200, 255, 0.3);
    border-radius: 5px;
    color: #fff;
}

.settings-option input[type="range"] {
    height: 6px;
    -webkit-appearance: none;
    background: rgba(0, 200, 255, 0.2);
    outline: none;
}

.settings-option input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #00ccff;
    cursor: pointer;
    box-shadow: 0 0 5px rgba(0, 204, 255, 0.8);
}

#settings-button {
    position: absolute;
    top: 20px;
    right: 80px;
    width: 40px;
    height: 40px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 100;
    border: 1px solid rgba(0, 200, 255, 0.3);
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.5);
    font-size: 24px;
    transition: transform 0.3s, box-shadow 0.3s;
}

#settings-button:hover {
    transform: rotate(30deg);
    box-shadow: 0 0 15px rgba(0, 204, 255, 0.4);
}

/* Buttons */
button {
    padding: 15px 40px;
    background: linear-gradient(to bottom, #00CCFF, #0099CC);
    color: white;
    border: none;
    border-radius: 30px;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    letter-spacing: 1px;
    transition: all 0.3s ease;
    box-shadow: 0 0 20px rgba(0, 204, 255, 0.4),
                0 0 60px rgba(0, 204, 255, 0.1);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    position: relative;
    overflow: hidden;
}

button:before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: 0.5s;
}

button:hover {
    transform: scale(1.05);
    box-shadow: 0 0 25px rgba(0, 204, 255, 0.6),
                0 0 80px rgba(0, 204, 255, 0.2);
    background: linear-gradient(to bottom, #33DDFF, #00BBEE);
}

button:hover:before {
    left: 100%;
}

button:active {
    transform: scale(0.98);
}

/* Utility classes */
.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateY(20px);
}

/* Tooltips */
.tooltip {
    position: absolute;
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 10px 15px;
    border-radius: 5px;
    transform: translate(-50%, -100%);
    margin-top: -10px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s, transform 0.3s;
    white-space: nowrap;
    z-index: 100;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    border: 1px solid rgba(0, 200, 255, 0.4);
}

/* Animations */
@keyframes pulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.8; }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes float {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
    100% { transform: translateY(0px); }
}

@keyframes glow {
    0% { text-shadow: 0 0 10px rgba(0, 200, 255, 0.5); }
    50% { text-shadow: 0 0 20px rgba(0, 200, 255, 0.8), 0 0 30px rgba(0, 200, 255, 0.4); }
    100% { text-shadow: 0 0 10px rgba(0, 200, 255, 0.5); }
}

/* Apply animations */
#intro-screen h1, #loading-screen h1, #game-over-screen h1 {
    animation: glow 2s infinite ease-in-out;
}

button {
    animation: pulse 3s infinite ease-in-out;
}

/* Mobile Controls Styling */
#mobile-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 40%;
    z-index: 100;
    pointer-events: none; /* Let click events pass through by default */
    display: none; /* Hidden by default, will be shown on mobile */
}

/* Show mobile controls on touch devices or small screens */
@media (max-width: 768px), (hover: none) {
    #mobile-controls {
        display: block;
    }
    
    /* Hide mouse instructions on mobile */
    #intro-screen .control-row div:nth-child(2n) {
        display: none;
    }
    
    /* Add mobile instructions */
    #intro-screen #controls:after {
        content: "Touch controls will appear automatically on mobile devices.";
        display: block;
        margin-top: 15px;
        font-style: italic;
        color: #00ccff;
    }
}

/* Virtual joystick */
#joystick-container {
    position: absolute;
    bottom: 20px;
    left: 20px;
    width: 120px;
    height: 120px;
    background-color: rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(0, 204, 255, 0.5);
    border-radius: 50%;
    pointer-events: auto;
    box-shadow: 0 0 10px rgba(0, 204, 255, 0.3), inset 0 0 15px rgba(0, 204, 255, 0.2);
    backdrop-filter: blur(4px);
}

#joystick-knob {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(0, 204, 255, 0.8) 0%, rgba(0, 102, 204, 0.6) 70%);
    transform: translate(-50%, -50%);
    box-shadow: 0 0 15px rgba(0, 204, 255, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
}

#joystick-knob:after {
    content: '';
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.4);
}

/* Action buttons */
#action-buttons-container {
    position: absolute;
    bottom: 20px;
    right: 20px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 15px;
    pointer-events: auto;
}

.action-button {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background-color: rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(0, 204, 255, 0.5);
    box-shadow: 0 0 10px rgba(0, 204, 255, 0.3), inset 0 0 15px rgba(0, 204, 255, 0.2);
    color: white;
    font-size: 14px;
    font-weight: bold;
    text-shadow: 0 0 5px rgba(0, 204, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
    backdrop-filter: blur(4px);
    transition: transform 0.15s, box-shadow 0.15s, background-color 0.15s;
}

.action-button.active {
    transform: scale(0.9);
    background-color: rgba(0, 204, 255, 0.3);
    box-shadow: 0 0 20px rgba(0, 204, 255, 0.6), inset 0 0 20px rgba(0, 204, 255, 0.4);
}

#jump-button {
    background: radial-gradient(circle, rgba(0, 204, 255, 0.3) 0%, rgba(0, 102, 204, 0.2) 70%);
    grid-column: 2;
    grid-row: 1;
    width: 80px;
    height: 80px;
}

#squeeze-button {
    background: radial-gradient(circle, rgba(255, 204, 0, 0.3) 0%, rgba(204, 102, 0, 0.2) 70%);
    grid-column: 1;
    grid-row: 1;
}

#transform-button {
    background: radial-gradient(circle, rgba(160, 32, 240, 0.3) 0%, rgba(128, 0, 255, 0.2) 70%);
    grid-column: 2;
    grid-row: 2;
}

#fullscreen-button {
    background: radial-gradient(circle, rgba(0, 204, 51, 0.3) 0%, rgba(0, 153, 51, 0.2) 70%);
    grid-column: 1;
    grid-row: 2;
    font-size: 12px;
}

/* Look controls (camera rotation) */
#look-controls {
    position: absolute;
    top: 0;
    right: 0;
    width: 70%;
    height: 60%;
    pointer-events: auto;
    z-index: 90;
}

/* Enhanced UI for mobile */
@media (max-width: 768px) {
    .ui-item {
        background-color: rgba(0, 0, 0, 0.5);
        border: 1px solid rgba(0, 200, 255, 0.5);
        box-shadow: 0 0 15px rgba(0, 200, 255, 0.3);
    }
    
    /* Adjust HUD positioning */
    #ui-container {
        top: 10px;
        left: 10px;
        transform: scale(0.85);
        transform-origin: top left;
    }
    
    #fps-counter, #position-display {
        transform: scale(0.85);
        transform-origin: top right;
    }
    
    /* Larger touch targets */
    .tooltip {
        padding: 15px;
        font-size: 16px;
    }
    
    /* Visual improvements for the ability notification */
    #ability-notification {
        backdrop-filter: blur(10px);
        border: 1px solid rgba(0, 204, 255, 0.5);
        box-shadow: 0 0 30px rgba(0, 204, 255, 0.3);
        width: auto;
        max-width: 80%;
        padding: 20px 40px;
        letter-spacing: 1px;
    }
}

/* Responsive design */
@media (max-width: 768px) {
    #loading-screen h1, #intro-screen h1, #game-over-screen h1 {
        font-size: 2.5rem;
    }
    
    #loading-screen h2, #intro-screen h2 {
        font-size: 1.5rem;
    }
    
    #controls {
        padding: 15px;
    }
    
    .control-row div {
        min-width: 200px;
    }
    
    button {
        padding: 12px 30px;
        font-size: 1rem;
    }
    
    #ui-container {
        top: 10px;
        left: 10px;
    }
    
    .ui-item {
        padding: 6px 10px;
    }
    
    .ui-item span {
        font-size: 14px;
    }
    
    .ui-bar {
        width: 80px;
        height: 5px;
    }
}

@media (max-width: 480px) {
    #loading-screen h1, #intro-screen h1, #game-over-screen h1 {
        font-size: 2rem;
    }
    
    #loading-screen h2, #intro-screen h2 {
        font-size: 1.2rem;
    }
    
    #intro-screen p, #game-over-screen p {
        font-size: 1rem;
    }
    
    #loading-bar-container {
        width: 250px;
    }
    
    .control-key {
        min-width: 50px;
        padding: 4px 8px;
    }
    
    #joystick-container {
        width: 100px;
        height: 100px;
    }
    
    #joystick-knob {
        width: 40px;
        height: 40px;
    }
    
    .action-button {
        width: 60px;
        height: 60px;
        font-size: 12px;
    }
    
    #jump-button {
        width: 70px;
        height: 70px;
    }
}

/* Landscape orientation adjustments */
@media (max-width: 900px) and (orientation: landscape) {
    #mobile-controls {
        height: 60%;
    }
    
    #joystick-container {
        bottom: 10px;
        left: 10px;
    }
    
    #action-buttons-container {
        bottom: 10px;
        right: 10px;
        gap: 10px;
    }
    
    .action-button {
        width: 50px;
        height: 50px;
        font-size: 10px;
    }
    
    #jump-button {
        width: 60px;
        height: 60px;
    }
}