body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    text-align: center;
    background-color: #2c3e50;
    color: white;
    margin: 0;
    padding: 20px;
}

/* Host Specific */
#host-container {
    max-width: 1400px; /* Wider for new layout */
    margin: 0 auto;
}

h1 {
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
    font-size: 2.5em;
    margin-bottom: 20px;
}

#qr-code {
    margin: 20px;
    background: white;
    padding: 10px;
    border-radius: 10px;
    display: inline-block;
}

/* New Grid Layout for Host Header */
.host-header-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 0.5fr 1fr;
    gap: 15px;
    margin-bottom: 20px;
    align-items: stretch;
}

.host-panel {
    position: relative;
    border: 4px solid white;
    border-radius: 20px;
    padding: 15px;
    background: rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 300px; /* Ensure uniform height */
}

.host-panel h3 {
    margin: 0 0 15px 0;
    font-size: 1.2em;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-bottom: 2px solid rgba(255,255,255,0.3);
    padding-bottom: 5px;
    width: 100%;
}

/* Specific Panel Tweaks */
#panel-powerups .powerup-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    width: 100%;
    align-content: start;
    padding: 5px;
    box-sizing: border-box;
}

.powerup-btn {
    font-size: 0.75em;
    padding: 6px 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    border: none;
    border-radius: 4px;
    color: white;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(0,0,0,0.2);
    transition: transform 0.1s;
}

.powerup-btn:active {
    transform: scale(0.95);
}

.powerup-info {
    margin-top: 10px;
    padding: 10px;
    background: rgba(0,0,0,0.3);
    border-radius: 10px;
    width: 90%;
    font-size: 0.8em;
    text-align: left;
}

.powerup-info h4 {
    margin: 0 0 5px 0;
    font-size: 1.1em;
    text-align: center;
    color: #ffd700;
}

.powerup-info ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.powerup-info li {
    margin: 3px 0;
    display: flex;
    justify-content: space-between;
}

#powerup-notification {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.9);
    border: 3px solid #ffd700;
    padding: 20px;
    border-radius: 15px;
    z-index: 100;
    text-align: center;
    width: 80%;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

#powerup-msg {
    color: #fff;
    font-size: 1.2em;
    font-weight: bold;
    text-shadow: 1px 1px 2px black;
    line-height: 1.4;
}

@keyframes popIn {
    from { opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
    to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

#panel-current {
    justify-content: center;
}

#drawn-ball-display {
    font-size: 5em;
    font-weight: 900;
    color: #ffffff;
    text-shadow: 4px 4px 0px #c0392b, 8px 8px 10px rgba(0,0,0,0.5);
    background: radial-gradient(circle at 30% 30%, #e74c3c, #c0392b);
    width: 200px; 
    height: 200px; 
    line-height: 200px;
    border-radius: 50%;
    margin: 0 auto;
    box-shadow: 
        inset -10px -10px 20px rgba(0,0,0,0.3),
        inset 10px 10px 20px rgba(255,255,255,0.3),
        0 10px 20px rgba(0,0,0,0.4);
    display: flex;
    justify-content: center;
    align-items: center;
    border: 5px solid rgba(255,255,255,0.2);
}

#panel-history {
    background: rgba(0,0,0,0.4); /* Slightly darker */
}

#ball-history {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
    justify-content: flex-start;
    height: 100%;
    overflow: hidden;
}

/* History Balls - Smaller */
.history-ball {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1em;
    font-weight: bold;
    color: white;
    border: 2px solid rgba(255,255,255,0.5);
    box-shadow: 2px 2px 5px rgba(0,0,0,0.3);
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
    animation: slideInRight 0.3s ease-out;
}

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

#panel-settings .settings-controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    align-items: center;
    height: 100%;
}

/* Flashboard */
#flashboard {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 20px; /* Reduced margin */
    padding: 20px;
    background: #000;
    border-radius: 20px;
    box-shadow: 0 0 20px rgba(0,0,0,0.8);
    border: 4px solid white; /* Matches header style */
}

.flash-row {
    display: flex;
    gap: 5px;
    justify-content: center;
}

.flash-header {
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5em;
    font-weight: 900;
    color: white;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
    border: 2px solid rgba(255,255,255,0.5);
}

/* Specific Header Colors matching standard Bingo */
.header-B { background-color: #00bfff; } /* Blue */
.header-I { background-color: #ff0000; } /* Red */
.header-N { background-color: #32cd32; } /* Green */
.header-G { background-color: #ffd700; } /* Yellow */
.header-O { background-color: #da70d6; } /* Purple/Pink */

.flash-cell {
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #333;
    border: 1px solid #555;
    font-weight: bold;
    font-size: 1.8em;
    color: #555;
    transition: all 0.3s;
    font-family: 'Times New Roman', serif;
}

/* 3D Active State */
.flash-cell.active {
    background: white;
    color: black;
    transform: scale(1.05);
    z-index: 2;
    box-shadow: 0 0 10px rgba(255,255,255,0.8);
    border: 2px solid white;
    text-shadow: none;
}

/* Player Specific */
#player-container {
    max-width: 400px;
    margin: 0 auto;
    color: #333;
}

#join-screen, #game-screen {
    background: white;
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
}

#bingo-card {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    margin: 20px 0;
    background-color: #2c3e50;
    padding: 10px;
    border-radius: 10px;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.5);
}

.bingo-header {
    background: linear-gradient(to bottom, #e67e22, #d35400);
    color: white;
    font-weight: 900;
    padding: 15px 0;
    border-radius: 5px;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

.bingo-cell {
    background-color: #ecf0f1;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3em;
    font-weight: bold;
    cursor: pointer;
    user-select: none;
    border-radius: 5px;
    box-shadow: 0 3px 0 #bdc3c7;
    transition: all 0.1s;
    color: #2c3e50;
}

.bingo-cell:active {
    transform: translateY(3px);
    box-shadow: none;
}

.bingo-cell.marked {
    background: radial-gradient(circle at 30% 30%, #e74c3c, #c0392b);
    color: white;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.3);
    border: 2px solid #c0392b;
}

.bingo-cell.free {
    background: radial-gradient(circle at 30% 30%, #3498db, #2980b9);
    color: white;
    font-size: 0.9em;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.3);
}

button {
    padding: 12px 25px;
    font-size: 1.2em;
    cursor: pointer;
    background: linear-gradient(to bottom, #3498db, #2980b9);
    color: white;
    border: none;
    border-radius: 8px;
    margin: 10px;
    box-shadow: 0 4px 0 #1a5276;
    transition: transform 0.1s, box-shadow 0.1s;
}

button:active {
    transform: translateY(4px);
    box-shadow: none;
}

button:disabled {
    background: #bdc3c7;
    box-shadow: none;
    cursor: not-allowed;
    transform: none;
}

#bingo-btn {
    background: linear-gradient(to bottom, #e74c3c, #c0392b);
    font-size: 2em;
    width: 100%;
    padding: 20px;
    box-shadow: 0 6px 0 #922b21;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-weight: 900;
    margin-top: 20px;
}

.hidden {
    display: none !important;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 10px;
}
::-webkit-scrollbar-track {
    background: #2c3e50; 
}
::-webkit-scrollbar-thumb {
    background: #34495e; 
    border-radius: 5px;
}

/* Modal Styles */
#modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s;
}

#modal-content {
    background: white;
    padding: 30px;
    border-radius: 15px;
    max-width: 90%;
    width: 300px;
    text-align: center;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    animation: slideUp 0.3s;
}

#modal-title {
    margin-top: 0;
    font-size: 2em;
}

#modal-message {
    font-size: 1.2em;
    margin: 20px 0;
    color: #333;
}

/* Modal Types */
.modal-error #modal-title { color: #e74c3c; }
.modal-success #modal-title { color: #2ecc71; }
.modal-info #modal-title { color: #3498db; }

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Host Modal Overrides */
#host-container + #modal-overlay #modal-content {
    width: 600px;
    padding: 50px;
    background: linear-gradient(135deg, #ffffff 0%, #f0f0f0 100%);
    border: 5px solid #f1c40f;
    box-shadow: 0 0 50px rgba(241, 196, 15, 0.5);
}

#host-container + #modal-overlay #modal-title {
    font-size: 5em;
    color: #c0392b;
    text-shadow: 2px 2px 0 #fff, 4px 4px 0 #2c3e50;
    margin: 0;
    animation: bounce 1s infinite;
}

#host-container + #modal-overlay #modal-winner {
    font-size: 3em;
    color: #2c3e50;
    margin: 20px 0;
}

#host-container + #modal-overlay #modal-close-btn {
    font-size: 1.5em;
    padding: 15px 40px;
    background: #2ecc71;
    border: none;
    border-radius: 50px;
    color: white;
    cursor: pointer;
    box-shadow: 0 5px 0 #27ae60;
    transition: transform 0.1s;
}

#host-container + #modal-overlay #modal-close-btn:active {
    transform: translateY(5px);
    box-shadow: none;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}

@keyframes pulse-red {
    0% {
        box-shadow: 0 0 0 0 rgba(244, 67, 54, 0.7);
        transform: scale(1);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(244, 67, 54, 0);
        transform: scale(1.05);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(244, 67, 54, 0);
        transform: scale(1);
    }
}

.pulse-btn {
    animation: pulse-red 1.5s infinite;
}
