/* Load Custom Fonts from the "design" folder */
@font-face {
    font-family: 'Times Regular';
    src: url('design/TimesRegular.woff2') format('woff2');
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: 'Gotham Black';
    src: url('design/Gotham-Black.woff2') format('woff2');
    font-weight: 900;
    font-style: normal;
}

@font-face {
    font-family: 'Gotham Light';
    src: url('design/Gotham-light.woff2') format('woff2');
    font-weight: 300;
    font-style: normal;
}

/* UConn Branded Base Styling with Light Grid Pattern */
body {
    font-family: 'Gotham Light', Arial, sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    
    /* The base gradient AND the transparent grid pattern layered on top */
    background-color: #0c2340;
    background-image: 
        linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px),
        linear-gradient(to bottom, #0c2340 0%, #03080f 100%);
    background-size: 30px 30px, 30px 30px, 100% 100%;
    background-attachment: fixed;
    
    color: #ffffff; 
    margin: 0;
    padding: 20px;
    min-height: 100vh;
    box-sizing: border-box;
}

.header {
    text-align: center;
    margin-bottom: -10px; /* Reduced from 20px to pull the image closer to the grid */
}

/* Updated Image Header Styling */
.header-image {
    width: 100%;
    max-width: 350px; /* Shrunk by 40% */
    aspect-ratio: 16 / 9;
    object-fit: contain; /* Switched to 'contain' so the whole graphic fits perfectly */
    
    /* Box-shadow and border-radius have been completely removed! */
}

/* Moved Guesses Text */
.guesses-text {
    font-family: 'Gotham Black', sans-serif;
    color: #ffffff; 
    font-size: 1.2rem;
    margin-top: 15px; /* Adds space between the grid and the text */
    margin-bottom: 0;
    text-transform: uppercase; 
    text-align: center;
}

/* The number styling stays exactly the same */
#guesses-left {
    color: #ffffff; 
    -webkit-text-stroke: 1.5px #E4002B; 
    font-size: 1.4rem; 
}

/* New block specifically for the number */
#guesses-left {
    color: #ffffff; 
    -webkit-text-stroke: 1px #E4002B; /* Adds the UConn Red outline */
    font-size: 1.4rem; /* Made the number slightly larger so the stroke looks clean */
}

.grid-container {
    display: grid;
    grid-template-columns: 120px repeat(3, 120px);
    grid-template-rows: 120px repeat(3, 120px);
    gap: 5px;
    background-color: #ffffff; /* White background separating the grid items */
    padding: 5px;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.5); /* Stronger shadow for depth against dark bg */
}

.grid-header {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #0c2340; /* Navy headers */
    color: #ffffff;
    font-family: 'Gotham Black', sans-serif;
    font-size: 12px;
    text-align: center;
    padding: 10px;
    border-radius: 4px;
    text-transform: uppercase;
}

.grid-header.empty {
    background-color: transparent;
}

.grid-cell {
    background-color: #f4f4f9;
    color: #0c2340;
    font-family: 'Times Regular', serif; /* Classic look for the player names */
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-size: 16px;
    transition: all 0.2s ease-in-out;
    padding: 5px;
}

.grid-cell:hover {
    background-color: #e0e0e0;
}

/* Gameplay States */
.grid-cell.correct {
    background-color: #ffffff; /* White background */
    color: #0c2340;
    border: 3px solid #4caf50; /* Green border for correct! */
    font-family: 'Gotham Black', sans-serif;
    font-size: 14px;
    cursor: default;
    box-sizing: border-box;
}

/* The red flash animation */
@keyframes flashRed {
    0% { background-color: #E4002B; color: #ffffff; border-color: #E4002B; }
    60% { background-color: #E4002B; color: #ffffff; border-color: #E4002B; }
    100% { background-color: #f4f4f9; color: transparent; border-color: transparent; }
}

.grid-cell.flash-incorrect {
    animation: flashRed 1.5s ease-out forwards;
    font-family: 'Gotham Black', sans-serif;
    font-size: 14px;
    cursor: default; /* Prevents clicking while flashing */
    box-sizing: border-box;
}

/* Modal and Dropdown Styles */
.modal {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: #ffffff;
    color: #0c2340;
    padding: 20px;
    border-radius: 8px;
    width: 300px;
    max-width: 90%;
    position: relative;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    border: 4px solid #0c2340;
}

.modal-content h3 {
    font-family: 'Gotham Black', sans-serif;
    margin-top: 0;
    text-transform: uppercase;
}

#close-modal {
    position: absolute;
    top: 10px;
    right: 15px;
    cursor: pointer;
    font-size: 24px;
    color: #E4002B; /* Red close button */
    font-weight: bold;
}

#search-input {
    width: 100%;
    padding: 10px;
    box-sizing: border-box;
    margin-bottom: 10px;
    font-size: 16px;
    font-family: 'Gotham Light', sans-serif;
    border: 2px solid #0c2340;
    border-radius: 4px;
    outline: none;
}

#search-input:focus {
    border-color: #E4002B;
}

#search-results {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #ddd;
    border-radius: 4px;
    display: none; 
}

#search-results li {
    padding: 10px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    font-size: 15px;
    font-family: 'Gotham Light', sans-serif;
}

#search-results li:last-child {
    border-bottom: none;
}

#search-results li:hover {
    background-color: #0c2340;
    color: #ffffff;
}

/* Button Styles */
.action-btn {
    padding: 10px;
    background-color: #E4002B; /* UConn Red */
    color: white;
    border: none;
    cursor: pointer;
    border-radius: 4px;
    font-family: 'Gotham Black', sans-serif;
    text-transform: uppercase;
    width: 100%;
    margin-bottom: 10px;
    transition: background-color 0.2s;
}

.action-btn:hover {
    background-color: #b30022;
}

.action-btn.secondary {
    background-color: #0c2340;
    border: 2px solid #E4002B;
}

.action-btn.secondary:hover {
    background-color: #03080f;
}

.recap-buttons {
    display: flex;
    flex-direction: column;
    margin-top: 15px;
}

.small-reset-btn {
    margin-top: 15px;
    background-color: transparent;
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 4px;
    font-size: 12px;
    padding: 5px 15px;
    cursor: pointer;
    font-family: 'Gotham Light', sans-serif;
    transition: background-color 0.2s;
}

.small-reset-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* =========================================
   Mobile Responsiveness
   ========================================= */
@media (max-width: 520px) {
    .grid-container {
        /* Changes from fixed pixels to Viewport Width (vw) percentages */
        grid-template-columns: 22vw repeat(3, 22vw);
        grid-template-rows: 22vw repeat(3, 22vw);
        gap: 3px;
        padding: 4px;
    }

    .grid-header {
        font-size: 9px; /* Shrunk so the text still fits */
        padding: 2px;
    }

    .grid-cell {
        font-size: 11px; /* Shrunk so player names don't spill over */
        padding: 2px;
    }

    .grid-cell.correct {
        font-size: 9px;
        border: 2px solid #4caf50; /* Slightly thinner border for the smaller box */
    }

    .grid-cell.flash-incorrect {
        font-size: 9px;
    }

    .header-image {
        max-width: 80%; /* Ensures the title image scales down alongside the grid */
    }
    
    /* Make the recap modal fit better on small screens */
    .modal-content {
        width: 85%;
        padding: 15px;
    }
    
    #recap-grid {
        font-size: 22px !important; /* Smaller emojis on mobile */
    }
}

/* Hide injected Netlify badge */
a[href*="netlify.com"] {
    display: none !important;
}