body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: #ffffff;
    background-image: url('../images/PatronCircularFondo.png');
    color: #333;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1em; /* Reduced padding for mobile */
    margin: 0;
    min-height: 100vh;
}

#logo-lachinita {
    max-width: 64px;
}

.logo {
    max-width: 200px;
}

#caller-area {
    background-color: #ffffff;
	padding: 40px;
	border-radius: 12px;
	box-shadow: 0 6px 12px rgba(0,0,0,0.1);
	text-align: center;
}

/* --- YouTube Live Stream Styles --- */

.video-container {
    position: relative;
    overflow: hidden;
    width: 100%;
    padding-top: 56.25%; /* 16:9 Aspect Ratio (9 / 16 = 0.5625) */
    margin-bottom: 20px;
    border-radius: 8px;
    background-color: #000;
}

.video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

#bingo-board-container {
    background-color: #ffffff;
	padding: 40px;
	border-radius: 12px;
	box-shadow: 0 6px 12px rgba(0,0,0,0.1);
	text-align: center;
}

#game-container {
    display: flex;
    flex-direction: column; /* Stack vertically by default */
    gap: 20px;
    align-items: center;
    width: 75%;
}

h1, h2 {
    text-align: center;
}

.host-container, .player-container {
    background-color: #ffffff;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 6px 12px rgba(0,0,0,0.1);
    text-align: center;
    width: 100%;
    max-width: 500px; /* Max width for mobile-first */
    box-sizing: border-box;
}

.hidden {
    display: none;
}

button {
    padding: 12px 25px;
    font-size: 1em;
    font-weight: bold;
    cursor: pointer;
    background-color: #ff037e;
    color: white;
    border: none;
    border-radius: 8px;
    transition: background-color 0.3s, transform 0.1s;
    margin-top: 10px;
}
button:hover:not(:disabled) { background-color: #ff65b0; }
button:active:not(:disabled) { transform: scale(0.98); }
button:disabled { background-color: #cccccc; cursor: not-allowed; }

/* Host's Drawn Cards Grid */
.drawn-cards-view {
    display: grid;
    grid-template-columns: repeat(4, 1fr); /* 4 columns for mobile */
    gap: 8px;
    width: 100%;
    margin: auto;
    background-color: rgba(255,255,255,0.5);
    padding: 10px;
    border-radius: 8px;
    box-sizing: border-box;
}

.card-cell {
    border-radius: 4px;
    overflow: hidden;
    aspect-ratio: 3 / 4;
}
.card-cell img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

/* Host Controls */
#host-controls {
    display: flex;
    flex-direction: column; /* Stack controls vertically on mobile */
    gap: 20px;
    align-items: center;
}

#drawn-card-display {
    width: 200px;
    height: 200px;
    border: 3px dashed #d1d1d1;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 15px auto;
    background-color: #fafafa;
    border-radius: 8px;
}
#drawn-image { max-width: 100%; max-height: 100%; object-fit: contain; }

#player-info { text-align: center; }
#player-list { list-style-type: none; padding: 0; max-height: 150px; overflow-y: auto; }
#winner-notification { margin-top: 15px; font-size: 1.2em; color: #4CAF50; font-weight: bold; }

/* Player View */
#join-game-form input, #join-game-form select {
    display: block;
    width: 90%;
    margin: 15px auto;
    padding: 10px;
    font-size: 1em;
    border-radius: 5px;
    border: 1px solid #ccc;
    box-sizing: border-box;
}

#board-preview-container {
    width: 80%;
    max-width: 250px;
    margin: 20px auto;
    border: 3px solid #eee;
    border-radius: 8px;
    overflow: hidden;
}
#board-preview-img { width: 100%; display: block; }

#chosen-board-name { font-size: 1.2em; }

.last-drawn-card-display {
    width: 150px;
    height: 150px;
    border: 2px dashed #ddd;
    margin: 10px auto;
    display: flex;
    align-items: center;
    justify-content: center;
}
.last-drawn-card-display img { max-width: 100%; max-height: 100%; }

.drawn-cards-history {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    width: 100%;
    /* This value controls the overall size. Reduce it to make the cards smaller. */
    max-width: 280px; 
    margin: 0 auto 20px;
}
.history-card-cell {
    border: 2px dashed #ddd;
    border-radius: 5px;
    aspect-ratio: 3 / 4;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #fafafa;
}
.history-card-cell img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* ✨ UPDATED: Player board with correct aspect ratio */
#player-board {
    position: relative;
    max-width: 400px;
    width: 95%;
    margin: auto;
    aspect-ratio: 1561 / 2460; /* The exact ratio of your images */
}

#player-board-bg { width: 100%; height: 100%; display: block; border-radius: 8px; }

#player-board-markers {
    position: absolute;
    top: -17px;
    left: 0;
    width: 100%;
    height: 103%;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(4, 1fr);
    /* These values may need manual tweaking to perfectly align with your board image design */
    padding: 14% 0%; 
    gap: 0% 0%;
    box-sizing: border-box;
}

.marker-cell { display: flex; align-items: center; justify-content: center; }
.marker { font-size: 2em; color: #ff037e; font-weight: bold; animation: fadeIn 0.3s; background-color: #00000075; width: 100%; height: 100%; align-content: center;}
@keyframes fadeIn { from { transform: scale(0.5); opacity: 0; } to { transform: scale(1); opacity: 0.9; } }

/* --- ✨ RESPONSIVE DESIGN --- */

@media (min-width: 570px) and (max-width: 767px){
    #player-board-markers {
    top: -29px;
    height: 102%;
    padding: 14% 0%;
    }

    .marker { font-size: 3em;}

    .logo {
    min-width: 250px;
    }
}

@media (min-width: 768px) {
    #game-container {
        flex-direction: row;
        align-items: flex-start;
        justify-content: space-evenly;
    }
    .host-container { max-width: 1000px; }
    #host-controls { flex-direction: row; }
    .drawn-cards-view { grid-template-columns: repeat(8, 1fr); }
    #player-info { text-align: left; }
    .marker { font-size: 6em; }
    #player-board-markers {
    top: -33px;
    left: 0;
    width: 100%;
    height: 102%;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(4, 1fr);
    /* These values may need manual tweaking to perfectly align with your board image design */
    padding: 14% 0%; 
    gap: 0% 0%;
    box-sizing: border-box;
    }

    .logo {
    min-width: 350px;
    }
}

