/* GAA BINGO BOARD */
.grid-wrapper {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-template-rows: repeat(4, minmax(0, 1fr));
    gap: 4px;
    max-width: 520px;
    margin: 30px auto;
    background: #0f172a;
    padding: 4px;
    border-radius: 16px;
    box-shadow:
        inset 0 0 0 8px #0f172a;
    overflow: hidden;
    position: relative;
    aspect-ratio: 1 / 1;
}

/* Bingo board title effect */
.grid-wrapper::before {
    content: 'BINGO';
    position: absolute;
    top: -45px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 2.5rem;
    font-weight: 900;
    color: var(--accent-green);
    text-shadow: 3px 3px 0 #0f172a;
    letter-spacing: 8px;
    z-index: -1;
}

/* Corner space (top-left empty cell) */
.corner-space {
    grid-column: 1;
    grid-row: 1;
    background: #0f172a;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Column labels (top row) */
.col-label {
    grid-row: 1;
    background: #0f172a;
    color: #ffffff;
    font-weight: 900;
    font-size: 0.9rem;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 8px;
    letter-spacing: 0.5px;
    text-shadow: none;
    position: relative;
}

.col-label:last-of-type {
    border-right: none;
}

#col-0 { grid-column: 2; }
#col-1 { grid-column: 3; }
#col-2 { grid-column: 4; }

/* Row labels (left column) */
.row-label {
    grid-column: 1;
    background: #0f172a;
    color: #ffffff;
    font-weight: 900;
    font-size: 0.85rem;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 8px;
    writing-mode: horizontal-tb;
    letter-spacing: 0.3px;
    line-height: 1.2;
    text-shadow: none;
    position: relative;
}

.label-pill {
    display: inline-block;
    background: #1e293b;
    color: var(--text-secondary);
    border: 2px solid var(--text-secondary);
    padding: 6px 10px;
    border-radius: 999px;
    box-shadow:
        0 2px 6px rgba(0, 0, 0, 0.25);
}

.row-label:last-of-type {
    border-bottom: none;
}

#row-0 { grid-row: 2; }
#row-1 { grid-row: 3; }
#row-2 { grid-row: 4; }

/* Bingo cells */
.grid-cell {
    background: linear-gradient(135deg, #1a2536 0%, #0f172a 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    min-height: 0;
    padding: 8px;
    text-align: center;
    box-shadow:
        inset 0 1px 3px rgba(255, 255, 255, 0.04),
        0 1px 2px rgba(0, 0, 0, 0.25);
}

/* Empty cell placeholder */
.grid-cell:not(.correct):not(.active)::before {
    content: '?';
    font-size: 3rem;
    font-weight: 900;
    color: rgba(255, 255, 255, 0.45);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    transition: all 0.3s ease;
}

/* Empty cell pattern background */
.grid-cell:not(.correct):not(.active)::after {
    display: none;
}

/* Hover state - only for non-selected, non-correct cells */
.grid-cell:not(.correct):not(.active):hover {
    background: linear-gradient(135deg, #223147 0%, #111b2f 100%);
    transform: scale(1.02);
    box-shadow:
        inset 0 1px 3px rgba(0, 0, 0, 0.05),
        0 4px 12px rgba(0, 0, 0, 0.08),
        0 2px 4px rgba(0, 0, 0, 0.1);
}

.grid-cell:not(.correct):not(.active):hover::before {
    color: rgba(255, 255, 255, 0.6);
    transform: translate(-50%, -50%) scale(1.1);
}

/* Active (selected) cell - always looks the same */
.grid-cell.active,
.grid-cell.active:hover {
    background: #0f172a !important;
    border: none !important;
    box-shadow:
        inset 0 0 0 4px var(--accent-yellow),
        0 4px 12px rgba(0, 0, 0, 0.15) !important;
    transform: scale(1.02) !important;
    z-index: 10;
}

.grid-cell.active::before,
.grid-cell.active:hover::before {
    content: '?' !important;
    font-size: 3rem !important;
    font-weight: 900 !important;
    color: rgba(255, 255, 255, 0.75) !important;
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    transition: none !important;
}

.grid-cell.active::after {
    background: none !important;
}

/* Correct answer cell */
.grid-cell.correct {
    background: linear-gradient(135deg, var(--accent-green) 0%, #15803d 100%);
    color: #ffffff;
    border-color: #064e3b;
    cursor: default;
    animation: bingoReveal 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    position: relative;
    overflow: hidden;
    box-shadow:
        inset 0 2px 4px rgba(255, 255, 255, 0.2),
        inset 0 -2px 4px rgba(0, 0, 0, 0.2),
        0 4px 12px rgba(34, 197, 94, 0.4);
}

.grid-cell.correct span {
    color: white;
    font-weight: 900;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    font-size: 0.75rem;
    position: relative;
    z-index: 3;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Big checkmark stamp */
.grid-cell.correct::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 4rem;
    font-weight: 900;
    color: rgba(255, 255, 255, 0.15);
    z-index: 1;
    animation: stampCheck 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55) 0.2s backwards;
}

/* Small checkmark badge */
.grid-cell.correct::before {
    display: none;
    content: '✓';
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    background: #ffffff;
    color: var(--accent-green);
    font-size: 1.2rem;
    font-weight: 900;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    z-index: 4;
    animation: badgePop 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55) 0.3s backwards;
}

/* ANIMATIONS */
@keyframes bingoReveal {
    0% {
        transform: scale(0.5) rotate(-10deg);
        opacity: 0;
    }
    60% {
        transform: scale(1.1) rotate(5deg);
    }
    100% {
        transform: scale(1) rotate(0);
        opacity: 1;
    }
}

@keyframes stampCheck {
    0% {
        transform: translate(-50%, -50%) scale(0) rotate(-45deg);
        opacity: 0;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.2) rotate(10deg);
    }
    100% {
        transform: translate(-50%, -50%) scale(1) rotate(0);
        opacity: 1;
    }
}

@keyframes badgePop {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.3);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Winning row/column/diagonal effects */
.grid-cell.winning {
    animation: winPulse 0.6s ease-in-out 3;
}

@keyframes winPulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7);
    }
    50% {
        box-shadow: 0 0 0 15px rgba(34, 197, 94, 0);
    }
}

/* Cell shine effect */
.grid-cell:not(.correct)::before {
    transition: all 0.3s ease;
}

/* Add subtle gloss to empty cells */
.grid-cell:not(.correct):not(.active) {
    background:
        linear-gradient(135deg,
            rgba(26, 37, 54, 0.9) 0%,
            rgba(15, 23, 42, 0.9) 100%
        ),
        linear-gradient(180deg,
            rgba(255, 255, 255, 0.05) 0%,
            transparent 50%,
            rgba(0, 0, 0, 0.25) 100%
        );
}

/* MOBILE RESPONSIVE */
@media (max-width: 768px) {
    .grid-wrapper {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        grid-template-rows: repeat(4, minmax(0, 1fr));
        max-width: 480px;
    }

    .grid-wrapper::before {
        font-size: 2rem;
        letter-spacing: 6px;
        top: -38px;
    }

    .col-label {
        font-size: 0.8rem;
        padding: 6px;
    }

    .row-label {
        font-size: 0.75rem;
        padding: 6px;
    }

    .grid-cell {
        font-size: 0.7rem;
    }

    .grid-cell.active::before {
        font-size: 3rem;
    }

    .grid-cell.correct::after {
        font-size: 3rem;
    }

    .grid-cell.correct::before {
        width: 24px;
        height: 24px;
        font-size: 1rem;
        top: 6px;
        right: 6px;
    }
}

@media (max-width: 480px) {
    .grid-wrapper {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        grid-template-rows: repeat(4, minmax(0, 1fr));
        max-width: 380px;
        margin: 20px auto;
    }

    .grid-wrapper::before {
        font-size: 1.8rem;
        letter-spacing: 4px;
        top: -35px;
    }

    .col-label,
    .row-label {
        font-size: 0.7rem;
        padding: 4px;
    }

    .grid-cell {
        font-size: 0.65rem;
        padding: 6px;
    }

    .grid-cell:not(.correct):not(.active)::before {
        font-size: 2.5rem;
    }

    .grid-cell.active::before {
        font-size: 2.8rem;
    }

    .grid-cell.correct span {
        font-size: 0.65rem;
    }

    .grid-cell.correct::after {
        font-size: 2.5rem;
    }

    .grid-cell.correct::before {
        width: 20px;
        height: 20px;
        font-size: 0.85rem;
        top: 4px;
        right: 4px;
    }
}
