/* === Base === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #013369;
    color: #e0e0e0;
    line-height: 1.6;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}

/* === Header === */
header {
    text-align: center;
    margin-bottom: 30px;
}

header h1 {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 3.5rem;
    color: #D50A0A;
    letter-spacing: 3px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

.subtitle {
    color: #8899aa;
    font-size: 1rem;
    margin-top: 5px;
}

/* === Controls === */
.controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: #012244;
    border-radius: 8px;
    border: 1px solid #1a3a5c;
}

.card-count label {
    margin-right: 6px;
    color: #ccc;
}

.card-count select {
    background: #013369;
    color: #eee;
    border: 1px solid #1a3a5c;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.95rem;
}

.btn-generate,
.btn-print {
    padding: 10px 24px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-generate {
    background: #D50A0A;
    color: #fff;
}

.btn-generate:hover {
    background: #E52828;
}

.btn-print {
    background: #013369;
    color: #ccc;
    border: 1px solid #1a3a5c;
}

.btn-print:hover {
    background: #1a3a5c;
}

/* === Bingo Cards === */
.cards-container {
    margin-top: 25px;
    display: flex;
    flex-wrap: wrap;
    gap: 25px;
    justify-content: center;
}

.bingo-card {
    background: #fff;
    color: #222;
    border-radius: 8px;
    overflow: hidden;
    width: 380px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}

.card-header {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    background: #D50A0A;
    color: #fff;
    font-size: 1.8rem;
    font-weight: bold;
    text-align: center;
    letter-spacing: 2px;
}

.card-header span {
    padding: 8px 0;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    border: 2px solid #D50A0A;
}

.cell {
    min-height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #ddd;
    padding: 4px;
    font-size: 0.6rem;
    font-weight: 600;
    text-align: center;
    word-break: break-word;
    line-height: 1.3;
}

.free-cell {
    background: #fce8e8;
    flex-direction: column;
    gap: 2px;
}

.free-text {
    font-size: 0.7rem;
    color: #D50A0A;
    font-weight: bold;
}

.free-icon {
    font-size: 1.4rem;
}

/* === Print View === */
.print-body {
    background: #fff;
    color: #000;
}

.print-controls {
    text-align: center;
    padding: 15px;
    background: #f5f5f5;
    border-bottom: 1px solid #ddd;
}

.print-controls button {
    background: #D50A0A;
    color: #fff;
    border: none;
    padding: 10px 24px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: bold;
    margin-right: 10px;
}

.print-controls a {
    color: #666;
    text-decoration: none;
    font-size: 0.95rem;
}

.print-controls a:hover {
    text-decoration: underline;
}

.print-layout {
    padding: 20px;
}

/* === Print Styles === */
@media print {
    .no-print {
        display: none !important;
    }

    body {
        background: #fff;
        color: #000;
    }

    .bingo-card {
        box-shadow: none;
        page-break-inside: avoid;
        break-inside: avoid;
        width: 100%;
        max-width: 400px;
        margin: 0 auto 20px;
    }

    .cards-container {
        gap: 10px;
    }

    .cell {
        border-color: #999;
    }

    .card-header {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .free-cell {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}

/* === Mobile === */
@media (max-width: 600px) {
    header h1 {
        font-size: 2.2rem;
        letter-spacing: 2px;
    }

    .controls {
        flex-direction: column;
        align-items: stretch;
    }

    .btn-generate,
    .btn-print {
        width: 100%;
        text-align: center;
    }

    .bingo-card {
        width: 100%;
    }

    .cell {
        font-size: 0.55rem;
        min-height: 48px;
    }
}
