/* Binary Search Game Styles */
.header-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.other-controls {
    display: flex;
    gap: 15px;
    align-items: center;
}

.difficulty select {
    padding: 8px 12px;
    border-radius: 20px;
    border: 1px solid #ddd;
    background: white;
    font-size: 0.9rem;
}

.number-line {
    display: flex;
    justify-content: center;
    margin: 30px 0;
    flex-wrap: wrap;
}

.number-box {
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--secondary);
    color: white;
    font-weight: bold;
    font-size: 1.2rem;
    margin: 5px;
    border-radius: 8px;
    position: relative;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    cursor: pointer; /* Add pointer cursor */
}

.target-element {
    box-shadow: 0 0 0 3px #FFD700, 0 0 15px #FFA500;
    animation: pulse 2s infinite;
    position: relative;
}

.target-element::after {
    content: 'Target';
    position: absolute;
    top: -30px;
    left: 50%;
    transform: translateX(-50%);
    background: gold;
    color: black;
    padding: 3px 10px;
    border-radius: 5px;
    font-size: 14px;
    font-weight: bold;
    white-space: nowrap;
    z-index: 10;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 3px rgba(255, 215, 0, 0.7); }
    50% { box-shadow: 0 0 0 8px rgba(255, 165, 0, 0.4); }
    100% { box-shadow: 0 0 0 3px rgba(255, 215, 0, 0.7); }
}

.annotation {
    position: absolute;
    bottom: -25px; /* Adjusted space below elements for better alignment */
    font-size: 0.9rem;
    font-weight: bold;
    color: var(--text-dark);
    z-index: 10; /* Ensure annotations appear above other elements */
    white-space: nowrap; /* Prevent wrapping */
}

.annotation.left { left: 50%; transform: translateX(-50%); }
.annotation.mid { left: 50%; transform: translateX(-50%); }
.annotation.right { left: 50%; transform: translateX(-50%); }

.number-line {
    position: relative;
    min-height: 100px; /* Ensure enough space for annotations */
    padding-bottom: 10px; /* Add padding at bottom for annotations */
}

.eliminated {
    opacity: 0.3;
    background-color: #ccc;
}

.core-buttons {
    display: flex;
    gap: 8px; /* Reduced gap between buttons */
    margin-top: 20px;
    justify-content: center; /* Center buttons horizontally */
}

.core-buttons button {
    flex: none; /* Allow buttons to shrink */
    padding: 8px 16px; /* Smaller padding */
    font-size: 14px; /* Slightly smaller font */
    transition: all 0.3s ease;
}

.core-buttons button.disabled-button {
    background: #cccccc !important;
    color: #666666 !important;
    cursor: not-allowed;
    transform: none !important;
    opacity: 0.7;
}

.feedback-message {
    margin-top: 15px;
    text-align: center;
    font-weight: bold;
    font-size: 1.1rem;
    min-height: 30px;
}

/* Visual indicators for boundary setting mode */
.number-box.active {
    background-color: #4ECDC4; /* Teal color for active search range */
    transform: scale(1.05);
    transition: all 0.3s ease;
}


/* Score change animation */
.score-animation-container {
    position: relative;
    height: 40px; /* Space for animations */
    margin-bottom: 10px; /* Padding between animation and score */
    left: 5%;
}

.score-change {
    position: absolute;
    font-weight: bold;
    font-size: 24px;
    z-index: 100;
    animation: scoreChangeAnimation 1.5s ease-out;
    pointer-events: none;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    text-align: center;
}

@keyframes scoreChangeAnimation {
    0% {
        transform: translate(-50%, -50px);
        opacity: 0.8;
    }
    50% {
        opacity: 1;
    }
    100% {
        transform: translate(-50%, 0);
        opacity: 0;
    }
}

.positive-change {
    color: #2ecc71; /* Green for positive changes */
}

.negative-change {
    color: #e74c3c; /* Red for negative changes */
}

.big-score {
    font-size: 28px;
    font-weight: bold;
    text-align: center;
    margin: 10px 0;
    color: #2c3e50;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
    padding: 5px 15px;
    background: linear-gradient(135deg, #f5f7fa, #e4e7eb);
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .header-container {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .other-controls {
        margin-top: 10px;
        width: 100%;
        justify-content: space-between;
    }
    
    .number-box {
        width: 50px;
        height: 50px;
        font-size: 1rem;
    }
    
    .annotation {
        bottom: -35px; /* More space on mobile */
        font-size: 0.8rem;
    }
    
    .big-score {
        font-size: 24px; /* Slightly smaller on mobile */
    }
}

/* Tutorial Modal Styles */
.modal {
    display: flex; /* Changed to flex to make it visible by default for tutorial */
    position: fixed; /* Stay in place */
    z-index: 1000; /* Sit on top */
    left: 0;
    top: 0;
    width: 100%; /* Full width */
    height: 100%; /* Full height */
    overflow: auto; /* Enable scroll if needed */
    background-color: rgba(0,0,0,0.7); /* Black w/ opacity */
    justify-content: center;
    align-items: center;
    padding-top: 50px;
}

.modal-content {
    background-color: #fefefe;
    margin: auto;
    padding: 20px; /* Reduced padding for more vertical space */
    border: 1px solid #888;
    width: 80%; /* Could be more responsive */
    max-width: 700px;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    text-align: center;
    color: #333;
}

.modal-content h2 {
    color: var(--primary);
    margin-bottom: 20px;
    font-size: 2em;
}

.modal-content h3 {
    color: var(--secondary);
    margin-top: 25px;
    margin-bottom: 10px;
    font-size: 1.5em;
}

.modal-content p, .modal-content ol {
    font-size: 1.1em;
    line-height: 1.6;
    margin-bottom: 15px;
    text-align: left;
    padding: 0 20px;
}

.modal-content ol {
    list-style-position: inside;
    padding-left: 0;
}

.modal-content li {
    margin-bottom: 8px;
}

.modal-content button {
    background-color: var(--primary);
    color: white;
    padding: 12px 25px;
    border: none;
    cursor: pointer;
    font-size: 1.1em;
    margin: 10px;
    transition: background-color 0.3s ease;
}

.modal-content button:hover {
    background-color: var(--primary-dark);
    color: var(--text-light); /* Ensure text remains visible on hover */
}

#skip-tutorial-button {
    background-color: #6c757d; /* Grey for skip button */
}

#skip-tutorial-button:hover {
    background-color: #5a6268;
}

/* Tutorial Animation Styles */
.animation-array-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 10px; /* Further reduced margin */
    margin-bottom: 50px; /* Further reduced space for pointers */
    position: relative;
    width: 100%;
    padding-bottom: 20px; /* Reduced space for pointers */
}

.animation-array {
    display: flex;
    justify-content: center;
    margin-bottom: 0; /* Removed gap between array and pointers */
}

.animation-number-box {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--secondary);
    color: white;
    font-weight: bold;
    font-size: 1rem;
    margin: 0 5px;
    border-radius: 5px;
    transition: all 0.5s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.eliminated-animation {
    opacity: 0.3;
    background-color: #ccc;
}

.target-animation {
    box-shadow: 0 0 0 3px var(--accent-yellow), 0 0 10px var(--accent-yellow);
    animation: pulse-animation 1.5s infinite;
}

@keyframes pulse-animation {
    0% { box-shadow: 0 0 0 3px rgba(255, 209, 102, 0.7); }
    50% { box-shadow: 0 0 0 8px rgba(255, 209, 102, 0.4); }
    100% { box-shadow: 0 0 0 3px rgba(255, 209, 102, 0.7); }
}

.animation-pointers {
    position: absolute;
    bottom: -5px; /* Adjusted to minimize gap, potentially slight overlap */
    display: flex;
    width: 100%;
    justify-content: center; /* Center the pointers container */
}

.pointer {
    position: absolute;
    background-color: var(--primary);
    color: white;
    padding: 2px 5px; /* Reduced padding for smaller size */
    border-radius: 3px;
    font-size: 0.7rem; /* Slightly smaller font */
    font-weight: bold;
    white-space: nowrap;
    transform: translateX(-50%); /* Center pointer text */
    transition: left 0.5s ease;
    z-index: 5;
    display: none; /* Hidden by default, shown by JS */
}

.tutorial-action-button {
    background-color: var(--primary);
    color: var(--text-light);
    padding: 12px 25px; /* Increased padding for a larger button */
    border: none;
    border-radius: 30px; /* Highly rounded corners */
    cursor: pointer;
    font-size: 1.1em; /* Slightly larger font */
    margin: 5px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 8px var(--shadow-medium); /* Add shadow */
    display: inline-flex; /* Align icon and text */
    align-items: center;
    justify-content: center;
    gap: 8px; /* Space between icon and text */
}

.tutorial-action-button:hover {
    background-color: var(--primary-dark);
    transform: translateY(-2px); /* Slight lift effect on hover */
    box-shadow: 0 6px 12px var(--shadow-medium); /* Enhanced shadow on hover */
}

.tutorial-action-button.clicked {
    background-color: var(--accent-yellow); /* Highlight color when clicked */
    transform: scale(1.05);
    box-shadow: 0 0 10px rgba(255, 209, 102, 0.7);
}

.pointer.left-pointer {
    background-color: #3498db; /* Blue for Left */
}

.pointer.mid-pointer {
    background-color: #e74c3c; /* Red for Mid */
}

.pointer.right-pointer {
    background-color: #2ecc71; /* Green for Right */
}

/* Game Description Styles */
.game-description {
    background-color: #f0f8ff; /* Light blue background */
    border: 1px solid #b0e0e6; /* Light blue border */
    border-radius: 8px;
    padding: 15px 20px;
    margin-top: 20px;
    text-align: left;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    color: #333;
}

.game-description h3 {
    color: var(--primary); /* Use primary color for heading */
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 1.3em;
}

.game-description p {
    font-size: 1em;
    line-height: 1.5;
    margin-bottom: 0;
}
