/* Add a background image to the body */
body {
    font-family: 'Patrick Hand', Arial, sans-serif;
    text-align: center;
    margin: 0;
    padding: 0;
    background-image: url('../img/field-water-victoria-lucero.JPG');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    background-blend-mode: overlay;
    background-color: rgba(255, 255, 255, 0.4);
}

#game-container {
    width: 60%;
    margin: 20px auto;
    border: 2px solid #000;
    position: relative;
    background-color: #f9f9f9;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    height: auto;
    min-height: 500px;
    padding: 20px;
    box-sizing: border-box;
}

/* Rules screen styles */
#rules-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.9);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 10;
}

/* Styles for the start buttons */
.start-btn {
    font-family: 'Patrick Hand', Arial, sans-serif;
    padding: 10px 20px;
    font-size: 16px;
    cursor: pointer;
    margin: 5px;
}

/* Bingo board container */
#bingo-board {
    display: none;
    text-align: center;
    pointer-events: none;
}

/* Bingo title styling */
#bingo-title {
    font-family: 'Patrick Hand', Arial, sans-serif;
    font-size: 2.5rem;
    margin-bottom: 10px;
}

/* Grid layout for the bingo board */
.grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    grid-template-rows: repeat(5, 1fr);
    gap: 5px;
    width: 100%;
}

/* Individual cell styles */
.cell {
    display: flex;
    justify-content: center;
    align-items: center;
    border: 1px solid #000;
    font-size: 2rem; 
    line-height: 1; 
    background-color: #fff;
    transition: background-color 0.3s ease, transform 0.2s ease;
    aspect-ratio: 1 / 1; 
    text-transform: inherit; 
}

/* Uppercase mode for consistent sizing */
.grid.uppercase-mode .cell {
    text-transform: uppercase; 
}

/* Hover effect for cells */
.cell:hover {
    background-color: #f0f0f0;
    transform: scale(1.1);
    cursor: pointer;
}

/* Free space cell styling */
.free-space {
    background-color: #ffeb3b;
    animation: pulse 1s infinite;
}

/* Animation for the free space */
@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
    }
}

#called-letter-tile {
    z-index: 5; /* Make sure it's above other elements */
    visibility: visible; /* Ensure it's not hidden */
    transition: transform 0.5s ease, opacity 0.5s ease;
    width: 80px;
    height: 80px;
    margin: 10px auto;
    font-size: 2rem;
    font-weight: bold;
    display: flex;
    justify-content: center;
    align-items: center;
    border: 2px solid #000;
    border-radius: 50%; 
    background-color: #fff; 
    position: relative;
    overflow: hidden;
}

#called-letter-tile span {
    position: relative;
    z-index: 2;
}

#called-letter-tile::before {
    content: '';
    position: absolute;
    width: 60%;
    height: 60%;
    background-color: #fff;
    border-radius: 50%; 
    z-index: 1;
}

#called-letter-tile span {
    position: relative;
    z-index: 2;
    color: #000;
}

/* Roll-out animation */
.roll-out {
    transform: rotate(540deg) translateY(0px);
    opacity: 0;
}

/* Roll-in animation */
.roll-in {
    transform: rotate(0deg) translateY(0px);
    opacity: 1;
}

/* Game over screen styling */
#game-over-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    color: white;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 20;
    pointer-events: all;
}

/* Restart button styling */
#restart-btn {
    font-family: 'Patrick Hand', Arial, sans-serif;
    padding: 10px 20px;
    font-size: 16px;
    cursor: pointer;
    background-color: #ffffff;
    color: #000000;
    border: none;
    border-radius: 5px;
    transition: background-color 0.3s ease;
}

#restart-btn:hover {
    background-color: #f0f0f0;
}

/* Winning tile animation */
.winning-tile {
    animation: pulse-gold 0.8s infinite, shine 1.5s infinite;
    background-color: gold !important;
    background-clip: padding-box;
    border: 3px solid #ffd700;
    box-shadow: 0 0 15px 5px rgba(255, 215, 0, 0.8);
}

/* Container for the BINGO letters */
#bingo-title-container {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 5px;
    width: 100%;
    background-color: red;
    color: white;
    text-align: center;
    padding: 10px 0;
    margin-bottom: 10px;
    font-family: 'Patrick Hand', Arial, sans-serif;
    font-size: 1.5rem;
    font-weight: bold;
    border-radius: 5px;
}

/* Individual BINGO letters */
.bingo-letter {
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Outer card that holds the bingo title and tiles */
#bingo-card {
    border: 2px solid #000;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    padding: 20px;
    background-color: #fff;
    max-width: 450px;
    margin: 0 auto;
}

.share-header {
  display: flex;
  justify-content: flex-end;
  gap: 1rem;          /* space between music & share buttons */
  padding: 0.5rem 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;    /* handles small screens */
}

/* Music toggle button styling */
#toggle-music-btn {
    background-color: #ffffff;
    border: 2px solid #000;
    border-radius: 50%;
    width: 70px;
    height: 70px;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    padding: 5px;
    cursor: pointer;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    transition: background-color 0.3s ease, transform 0.2s ease;
    gap: 4px;
}

#toggle-music-btn:hover {
    background-color: #f0f0f0;
    transform: scale(1.1);
}

#music-icon {
    font-size: 32px;
    color: #000;
    line-height: 1;
}

.music-icon {
    position: relative;
    display: inline-block;
}

#toggle-music-btn.muted {
    filter: grayscale(100%);
    opacity: 0.6;
}

/* Button label below emoji */
.button-label {
    font-family: 'Patrick Hand', Arial, sans-serif;
    font-size: 0.75rem;
    color: #000;
    user-select: none;
}


@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    25% {
        transform: translateX(-5px);
    }
    50% {
        transform: translateX(5px);
    }
    75% {
        transform: translateX(-5px);
    }
}

.wrong-cell {
    animation: shake 0.5s;
    background-color: #ff4d4d !important; 
}

/* Media query for smaller screens (e.g., tablets) */
@media (max-width: 768px) {
    #game-container {
        width: 90%; 
        padding: 15px; 
        min-height: 400px; 
    }

    #bingo-title {
        font-size: 2rem; 
    }

    .cell {
        font-size: 1.5rem; 
    }
}

/* Media query for very small screens (e.g., phones) */
@media (max-width: 480px) {
    #game-container {
        width: 100%; 
        padding: 10px; 
        min-height: 300px; 
    }

    #bingo-title {
        font-size: 1.5rem; 
    }

    .cell {
        font-size: 1.2rem; 
    }

    .start-btn {
        font-size: 14px; 
        padding: 8px 15px; 
    }

    #toggle-music-btn,
    #share-btn {
        width: 50px;
        height: 50px;
    }

    #music-icon,
    #share-icon {
        font-size: 24px;
    }

    .button-label {
        font-size: 0.6rem;
    }
}

/* Media query for very small screens in landscape orientation */
@media (max-width: 1080px) and (orientation: landscape) {
    #game-container {
        width: 100%; 
        padding: 5px; 
        min-height: 100vh; 
        overflow-y: auto; 
        transform: scale(0.8); 
        transform-origin: top center; 
    }

    #bingo-title {
        font-size: 1.2rem; 
    }

    .cell {
        font-size: 1rem; 
    }

    .start-btn {
        font-size: 12px; 
        padding: 5px 10px; 
    }

    #called-letter-tile {
        width: 60px; 
        height: 60px;
        font-size: 1.5rem; 
    }
}