:root {
    --bg-color: #f5f5f5;
    --text-color: #333;
    --accent-color: #333;
    --cell-bg: #fff;
    --cell-bg-hover: #eee;
    --cell-selected: #ccc;
    --overlay-bg: rgba(0,0,0,0.5);
    --font-family: 'Roboto Mono', monospace;
}

.theme-windows {
    --bg-color: #f5f5f5;
    --text-color: #333;
    --accent-color: #0078d7;
    --cell-bg: #fff;
    --cell-bg-hover: #eee;
    --cell-selected: #cce4f7;
    --overlay-bg: rgba(0,0,0,0.5);
    --font-family: 'Segoe UI', sans-serif;
}

.theme-linux {
    --bg-color: #0d0d0d; 
    --text-color: #33ff33;
    --accent-color: #33ff33;
    --cell-bg: #001900;
    --cell-bg-hover: #002f00;
    --cell-selected: #00aa00;
    --overlay-bg: rgba(0,0,0,0.9);
    --font-family: 'Roboto Mono', monospace;
}

.theme-mac {
    --bg-color: #ECECEC;
    --text-color: #333;
    --accent-color: #007AFF;
    --cell-bg: #ffffff;
    --cell-bg-hover: #f0f0f0;
    --cell-selected: #d0e7ff;
    --overlay-bg: rgba(0,0,0,0.4);
    --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body {
    background: var(--bg-color);
    font-family: var(--font-family);
    color: var(--text-color);
    margin: 0;
    overflow-x: hidden;
}

.topbar {
    display: flex;
    align-items: center;
    height: 40px;
    padding: 0 10px;
    box-sizing: border-box;
    justify-content: space-between;
    background: #ddd;
    color: var(--text-color);
}

.left-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.traffic-lights {
    display: none;
    align-items: center;
    gap: 5px;
}

.traffic-btn {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    box-shadow: 0 0 0 1px rgba(0,0,0,0.1) inset;
}
.traffic-btn.red { background: #FF5F57; }
.traffic-btn.yellow { background: #FFBD2E; }
.traffic-btn.green { background: #28C840; }

.win-buttons {
    display:none;
    align-items:center;
    gap:3px;
}
.win-btn {
    width: 18px;
    height: 18px;
    font-size: 0.8em;
    font-weight: bold;
    line-height: 18px;
    text-align: center;
    background: #ccc;
    border-radius: 2px;
    border: 1px solid #999;
    color: #000;
    display:flex;
    align-items:center;
    justify-content:center;
    cursor:pointer;
}
.win-btn:hover {
    background:#bbb;
}

.theme-icon {
    height: 20px;
    width: 20px;
    object-fit: contain;
    display: none;
}

.topbar-title {
    flex:1;
    text-align:center;
    font-size:1em;
    color: var(--text-color);
}

.mac-fullwidth {
    max-width: 100% !important;
    width: 100% !important;
    padding: 20px;
}

.container {
    max-width: 700px;
    padding: 20px;
    margin: 0 auto;
    box-sizing: border-box;
}

header {
    width: 100%;
    text-align: center;
}

h1 {
    margin-bottom: 10px;
    font-size: 2em;
    letter-spacing: 1px;
    color: var(--accent-color);
}

.info-bar {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 20px;
}

.info-section {
    font-size: 1em;
    display: flex;
    align-items: center;
    gap: 5px;
}

.theme-select {
    border: 1px solid var(--accent-color);
    background: var(--cell-bg);
    color: var(--text-color);
    border-radius: 4px;
    padding: 3px 5px;
    font-size: 0.9em;
}

.theme-select:focus {
    outline: none;
}

/* Bingo-Board */
.bingo-board {
    display: grid;
    grid-template-columns: repeat(5,1fr);
    grid-auto-rows: 1fr;
    gap:5px;
    margin:0 auto;
    width:100%;
}

.bingo-cell {
    background: var(--cell-bg);
    border: 1px solid rgba(0,0,0,0.1);
    cursor: pointer;
    user-select: none;
    color: var(--text-color);
    text-align: center;
    box-sizing: border-box;
    aspect-ratio: 1/1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9em;
    border-radius: 5px;
    padding: 5px;
    word-wrap: break-word;
    transition: background-color 0.3s ease, transform 0.3s ease;
}

.bingo-cell:hover {
    background: var(--cell-bg-hover);
    transform: translateY(-1px);
}

.bingo-cell.selected {
    background: var(--cell-selected);
    color: var(--text-color);
    box-shadow: 0 0 0 2px var(--accent-color) inset;
}

@media (min-width: 600px) {
    .bingo-board {
        max-width: 400px;
    }
}

@media (max-width: 600px) {
    h1 {
        font-size: 1.7em;
    }

    .info-section {
        font-size: 0.9em;
    }

    .bingo-cell {
        font-size: 0.8em;
        padding: 4px;
    }
}

@media (max-width: 400px) {
    h1 {
        font-size: 1.4em;
    }

    .info-section {
        font-size: 0.8em;
    }

    .bingo-board {
        gap: 2px; 
        width:95vw;
    }

    .bingo-cell {
        font-size: 0.7em;
        padding: 1px;
        border: 1px solid rgba(0,0,0,0.05);
    }
}

/* Overlay */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--overlay-bg);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 999;
    opacity: 0;
    transition: opacity 0.4s ease;
    padding: 10px;
    box-sizing: border-box;
}

.overlay.show {
    display: flex;
    opacity: 1;
}

.overlay-content {
    background: var(--bg-color);
    padding: 30px;
    border-radius: 10px;
    text-align: center;
    animation: pop 0.5s ease;
    color: var(--text-color);
    border: 2px solid var(--accent-color);
    max-width: 90%;
}

.overlay-content h2 {
    font-size: 2em;
    margin-bottom: 15px;
    color: var(--accent-color);
}

.overlay-content p {
    margin-bottom: 20px;
    font-size: 1em;
}

.overlay-content button {
    padding: 5px 10px;
    font-size: 1em;
    cursor: pointer;
    border: 2px solid var(--accent-color);
    border-radius: 5px;
    background: transparent;
    color: var(--accent-color);
    transition: background 0.3s, color 0.3s;
    font-family: var(--font-family);
}

.overlay-content button:hover {
    background: var(--accent-color);
    color: #000;
}

@keyframes pop {
    0% {transform: scale(0.5); opacity: 0;}
    100% {transform: scale(1); opacity: 1;}
}

.confetti-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
}

.confetti {
    position: absolute;
    width: 8px;
    height: 8px;
    background: var(--accent-color);
    top: -10px;
    left: 50%;
    animation: fall 2s linear infinite;
    opacity: 0.9;
}

.confetti:nth-child(2) { left: 25%; animation-delay: 0.2s; }
.confetti:nth-child(3) { left: 75%; animation-delay: 0.4s; }
.confetti:nth-child(4) { left: 15%; animation-delay: 0.6s; }
.confetti:nth-child(5) { left: 85%; animation-delay: 0.8s; }
.confetti:nth-child(6) { left: 40%; animation-delay: 1s; }
.confetti:nth-child(7) { left: 60%; animation-delay: 1.2s; }
.confetti:nth-child(8) { left: 10%; animation-delay: 1.4s; }
.confetti:nth-child(9) { left: 90%; animation-delay: 1.6s; }
.confetti:nth-child(10){left: 50%; animation-delay: 1.8s; }

@keyframes fall {
    0% {
        transform: translateY(-10px) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(360deg);
        opacity: 0;
    }
}

.theme-windows-select, .theme-linux-select, .theme-mac-select {
    border: 1px solid var(--accent-color);
    background: var(--cell-bg);
    color: var(--text-color);
}
