/* Base Styles */
:root {
    --primary-color: #4a86e8;
    --secondary-color: #ff9900;
    --success-color: #34a853;
    --error-color: #ea4335;
    --sky-color: #87CEEB;
    --water-color: #1E90FF;
    --land-color: #8B4513;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Comic Neue', cursive;
    background-color: #e9f5ff;
    overflow: hidden;
    height: 100vh;
    width: 100vw;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Game Container */
.game-container {
    width: 100%;
    height: 100%;
    max-width: 1200px;
    max-height: 800px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background-color: white;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    position: relative;
}

/* Game Header */
.game-header {
    background-color: var(--primary-color);
    color: white;
    padding: 15px 20px;
    text-align: center;
    border-radius: 20px 20px 0 0;
    z-index: 10;
}

.game-header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.instructions {
    font-size: 1.2rem;
    font-weight: bold;
}

/* Main Game Area */
.game-area {
    flex: 1;
    position: relative;
    overflow: hidden;
    background: linear-gradient(to bottom, #87CEEB, #87CEFA 33.3%, #1E90FF 33.3%, #1E90FF 66.6%, #8B4513 66.6%, #8B4513 100%);
    padding-bottom: 140px; /* Add padding at the bottom to make room for the tray */
}

/* Creation Scene Zones */
.creation-scene {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow-y: auto; /* Allow scrolling if needed */
    padding-bottom: 20px; /* Extra space at the bottom */
}

.drop-zone {
    position: relative;
    border: 3px dashed rgba(255, 255, 255, 0.5);
    margin: 5px;
    border-radius: 15px;
    transition: all 0.3s ease;
    flex: 1; /* Equal flex value for all zones */
    min-height: 150px; /* Minimum height to ensure zones are visible */
}

#sky-zone {
    background-color: rgba(135, 206, 235, 0.3);
}

#water-zone {
    background-color: rgba(30, 144, 255, 0.3);
}

#land-zone {
    background-color: rgba(139, 69, 19, 0.3);
    margin-bottom: 120px; /* Add margin to prevent tray from covering it */
}

.zone-label {
    position: absolute;
    top: 5px;
    left: 10px;
    color: white;
    font-weight: bold;
    font-size: 1.5rem;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.7);
}

/* Draggable Items Tray */
.items-tray {
    position: fixed;
    bottom: 75px; /* Position it above the game controls */
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 1100px;
    background-color: rgba(255, 255, 255, 0.95);
    display: flex;
    justify-content: space-around;
    padding: 15px 10px 40px 10px; /* Increased bottom padding for labels */
    border-radius: 15px;
    z-index: 100;
    overflow-x: auto;
    white-space: nowrap;
    scrollbar-width: thin;
    height: auto;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.draggable-item {
    text-align: center;
    margin: 0 12px;
    cursor: pointer;
    transition: transform 0.2s ease;
    flex: 0 0 auto;
    position: relative; /* Add this to enable absolute positioning of children */
    padding-bottom: 25px; /* Add space for the label */
}

.draggable-item:hover {
    transform: scale(1.05);
}

.draggable {
    width: 90px;
    height: 90px;
    object-fit: contain;
    pointer-events: auto;
    touch-action: none;
    user-select: none;
    -webkit-user-drag: element;
}

.item-label {
    display: block;
    font-weight: bold;
    margin-top: 8px;
    font-size: 1.2rem;
    color: #333;
    text-shadow: 0px 1px 1px rgba(255, 255, 255, 0.8);
    position: absolute; /* Position labels absolutely */
    bottom: 0;
    left: 0;
    right: 0;
    text-align: center;
    background-color: rgba(255, 255, 255, 0.7); /* Semi-transparent background */
    padding: 4px 0;
    border-radius: 8px;
}

/* Placed items styles */
.placed-item {
    position: absolute;
    z-index: 50;
    transition: all 0.5s ease;
}

/* Ensure draggable items maintain their size after placement */
.drop-zone .draggable {
    width: 90px;
    height: 90px;
    filter: drop-shadow(0px 3px 5px rgba(0, 0, 0, 0.3));
}

/* Feedback popup */
.feedback-popup {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: white;
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    z-index: 200;
    display: none;
}

.popup-content {
    text-align: center;
    font-size: 1.5rem;
    font-weight: bold;
}

/* Success Screen */
.success-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.9);
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 300;
    text-align: center;
}

.success-content {
    max-width: 80%;
}

.success-content h2 {
    font-size: 3rem;
    color: var(--success-color);
    margin-bottom: 20px;
}

.success-content p {
    font-size: 2rem;
    margin-bottom: 15px;
}

.rabbit-celebration {
    margin-top: 30px;
}

#rafi {
    width: 200px;
    height: auto;
}

/* Game Controls */
.game-controls {
    display: flex;
    justify-content: center;
    padding: 15px;
    background-color: #f5f5f5;
    border-top: 1px solid #ddd;
    border-radius: 0 0 20px 20px;
    position: relative;
    z-index: 150; /* Make sure it's above the tray */
}

.control-btn {
    margin: 0 15px;
    padding: 10px 20px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: bold;
    transition: all 0.2s ease;
}

.control-btn:hover {
    background-color: #3a76d8;
    transform: translateY(-2px);
}

.control-btn:active {
    transform: translateY(0);
}

/* Responsive Design */
@media (max-width: 768px) {
    .game-header h1 {
        font-size: 2rem;
    }
    
    .instructions {
        font-size: 1rem;
    }
    
    .draggable {
        width: 75px;
        height: 75px;
    }
    
    .item-label {
        font-size: 1rem;
    }
    
    .control-btn {
        padding: 8px 15px;
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .game-header h1 {
        font-size: 1.5rem;
    }
    
    .game-area {
        padding-bottom: 160px;
    }
    
    .items-tray {
        bottom: 65px;
        padding: 10px 5px;
    }
    
    .draggable {
        width: 65px;
        height: 65px;
    }
    
    .zone-label {
        font-size: 1rem;
    }
    
    .control-btn {
        padding: 6px 12px;
        font-size: 0.8rem;
        margin: 0 5px;
    }
}
