/* General Body and Font Styles */
body {
    font-family: 'Nunito', sans-serif;
    margin: 0;
    padding: 0;
    line-height: 1.6;
    color: #333;
    transition: background-color 0.5s ease; /* Smooth background transition */
}

.game-container {
    width: 100%;
    max-width: 900px; /* Max width for larger screens */
    margin: 0 auto;
    padding: 0 15px; /* Add some padding on the sides */
    box-sizing: border-box;
}

/* Section Styling */
.game-section {
    display: none; /* Hidden by default */
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 90vh; /* Make sections take up most of the viewport height */
    padding: 20px;
    text-align: center;
    box-sizing: border-box;
    border-radius: 10px; /* Optional: rounded corners for sections */
    margin-top: 2vh; /* Some margin from top */
    margin-bottom: 2vh; /* Some margin from bottom */
}

.game-section.active-section {
    display: flex; /* Show active section */
}

/* Specific Section Backgrounds */
#opening-section { background-color: #e0f7fa; /* Light Cyan */ }
#training-section { background-color: #fff9c4; /* Light Yellow */ }
#testing-section { background-color: #c8e6c9; /* Light Green */ }
#closing-section { background-color: #ffccbc; /* Light Peach */ }

.robot-image {
    width: 120px; /* Default size */
    height: auto;
    margin-bottom: 20px;
}

.speech-bubble {
    background-color: #ffffff;
    padding: 15px 20px;
    border-radius: 15px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    margin-bottom: 25px;
    position: relative;
    max-width: 80%;
}

.speech-bubble::after { /* Triangle for speech bubble */
    content: '';
    position: absolute;
    bottom: -10px; /* Position triangle at the bottom center */
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-top: 10px solid #ffffff;
}

.speech-bubble p {
    margin: 8px 0;
    font-size: 1em;
}

.instructions {
    margin-bottom: 15px;
    font-size: 0.95em;
    color: #555;
}

/* Buttons */
.nav-button, .action-button {
    background-color: #007bff; /* Primary Blue */
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 25px; /* Pill shape */
    cursor: pointer;
    font-size: 1em;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 15px;
    transition: background-color 0.3s ease, transform 0.2s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.nav-button:hover, .action-button:hover {
    background-color: #0056b3; /* Darker Blue */
    transform: translateY(-2px);
}

.nav-button:active, .action-button:active {
    transform: translateY(0px);
}

/* Training Section */
.item-gallery {
    display: flex;
    flex-wrap: wrap; /* Allow items to wrap to next line */
    justify-content: center;
    gap: 10px; /* Space between items */
    margin-bottom: 20px;
    max-width: 100%;
}

.train-item {
    width: 70px; /* Default size */
    height: 70px;
    border: 3px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    object-fit: contain; /* Ensure image fits well */
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.train-item:hover {
    transform: scale(1.1);
    border-color: #007bff;
}

.train-item.selected {
    border-color: #28a745; /* Green border for selected */
    transform: scale(1.05);
    box-shadow: 0 0 8px rgba(40, 167, 69, 0.5);
}

#training-feedback {
    font-weight: bold;
    min-height: 2.5em; /* Reserve space for potentially longer feedback */
    padding: 5px;
}

/* Testing Section */
.test-item-container {
    margin: 20px 0;
    min-height: 160px; /* Reserve space for test item */
}
#test-item-image {
    width: 150px; /* Default size */
    height: 150px;
    border: 3px solid #ddd;
    border-radius: 8px;
    object-fit: contain;
}

.robot-guess-text {
    font-size: 1.1em;
    font-weight: bold;
    min-height: 1.5em; /* Reserve space */
    margin-top: 10px;
    padding: 5px 10px;
    border-radius: 5px;
}
/* Confidence styling */
.robot-guess-text.confident { color: #28a745; background-color: #e9f7ef; }
.robot-guess-text.hesitant { color: #fd7e14; background-color: #fff3e0; }
.robot-guess-text.unsure { color: #6c757d; background-color: #f8f9fa; }
.robot-guess-text.unknown-item { color: #6f42c1; background-color: #f3e0ff;}
.robot-guess-text.neutral { color: #333; }


/* Responsive Design */
@media (max-width: 768px) {
    .robot-image {
        width: 100px;
    }
    .speech-bubble p {
        font-size: 0.9em;
    }
    .nav-button, .action-button {
        padding: 10px 20px;
        font-size: 0.9em;
    }
    .train-item {
        width: 60px;
        height: 60px;
    }
    #test-item-image {
        width: 120px;
        height: 120px;
    }
}

@media (max-width: 480px) {
    .game-section {
        padding: 15px;
        min-height: 85vh;
    }
    .robot-image {
        width: 80px;
    }
    .speech-bubble {
        padding: 10px 15px;
    }
    .speech-bubble p {
        font-size: 0.85em;
    }
    h2 {
        font-size: 1.3em;
    }
    .train-item {
        width: 50px;
        height: 50px;
    }
    #test-item-image {
        width: 100px;
        height: 100px;
    }
    .item-gallery {
        gap: 8px;
    }
    #training-feedback {
        font-size: 0.9em; /* Adjust feedback font size for small screens */
    }
}