/* Speed Bingo 75 — Classic Casino Red & Gold */

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

:root {
    --crimson-deep:   #4a0812;
    --crimson:        #7a0f1f;
    --crimson-soft:   #a3162c;
    --red:            #c91b2b;
    --red-bright:     #e93448;
    --gold:           #ffc83d;
    --gold-soft:      #ffe089;
    --gold-deep:      #b88a18;
    --cream:          #fff8e1;
    --cream-shadow:   #e9dfb8;
    --ink:            #1a0506;
    --win-green:      #22c55e;
    --win-green-soft: #4ade80;

    --text-white:     #fff5e8;
    --text-muted:     #d9a99c;

    --r-card:         0.875rem;
    --r-btn:          0.5rem;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    display: flex;
    justify-content: center;
    align-items: center;
    background: var(--crimson-deep);
    color: var(--text-white);
    min-height: calc(100dvh - 3.5rem);
}

/* ============ BACKGROUND ============ */
#crimson-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background:
        radial-gradient(ellipse at 50% 0%, #931329 0%, var(--crimson) 35%, var(--crimson-deep) 85%),
        repeating-linear-gradient(45deg,
            rgba(255, 200, 61, 0.025) 0 2rem,
            transparent 2rem 4rem);
}

#crimson-bg::after {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 20% 20%, rgba(255, 200, 61, 0.08), transparent 25%),
        radial-gradient(circle at 80% 80%, rgba(255, 200, 61, 0.06), transparent 30%);
    animation: bgPulse 6s ease-in-out infinite alternate;
}

@keyframes bgPulse {
    0%   { opacity: 0.7; }
    100% { opacity: 1; }
}

/* ============ SCREENS ============ */
.screen {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: var(--crimson-deep);
    color: var(--text-white);
    z-index: 1000;
}

.screen.hidden { display: none; }

.loading-spinner {
    width: 3.25rem;
    height: 3.25rem;
    border: 0.2rem solid rgba(255, 200, 61, 0.15);
    border-top-color: var(--gold);
    border-radius: 50%;
    animation: spinAnim 1s linear infinite;
}

@keyframes spinAnim { to { transform: rotate(360deg); } }

#loading-screen p {
    margin-top: 1rem;
    color: var(--gold);
    font-size: 0.95rem;
    letter-spacing: 0.0625rem;
}

.login-content { text-align: center; }
.login-icon { font-size: 3.5rem; margin-bottom: 1rem; }
.login-content h2 { color: var(--gold); margin-bottom: 0.5rem; }
.login-content p { color: var(--text-muted); }

/* ============ GAME CONTAINER ============ */
#game-container {
    width: 100%;
    max-width: 31rem;
    height: 100%;
    max-height: 56rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.5rem 0.75rem;
    position: relative;
    z-index: 1;
}

#game-container.hidden { display: none; }

/* ============ HEADER ============ */
#game-header {
    width: 100%;
    padding: 0.4rem 0;
    display: flex;
    justify-content: center;
}

.balance-display {
    background: linear-gradient(180deg, rgba(255, 200, 61, 0.15) 0%, rgba(201, 27, 43, 0.18) 100%);
    border: 0.0625rem solid var(--gold);
    border-radius: 1.25rem;
    padding: 0.45rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.45rem;
    box-shadow: 0 0 1.1rem rgba(255, 200, 61, 0.25),
                inset 0 0.0625rem 0 rgba(255, 255, 255, 0.08);
}

.balance-label {
    color: var(--gold-soft);
    font-size: 0.75rem;
    letter-spacing: 0.04rem;
    font-weight: 600;
}

#balance-value {
    color: var(--gold);
    font-size: 1.25rem;
    font-weight: 800;
    min-width: 4.5rem;
    text-align: right;
    text-shadow: 0 0 0.625rem rgba(255, 200, 61, 0.55);
    transition: transform 0.2s ease, color 0.2s ease;
}

.balance-currency {
    color: var(--gold-soft);
    font-size: 0.7rem;
    font-weight: 700;
}

/* ============ BINGO HEADER BALLS ============ */
.bingo-letters {
    width: 100%;
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 0 0.4rem;
}

.bingo-ball {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: 1.05rem;
    color: #fff;
    text-shadow: 0 0.0625rem 0.0625rem rgba(0, 0, 0, 0.4);
    box-shadow:
        inset 0 -0.2rem 0.4rem rgba(0, 0, 0, 0.35),
        inset 0 0.25rem 0.4rem rgba(255, 255, 255, 0.35),
        0 0.25rem 0.6rem rgba(0, 0, 0, 0.35);
    border: 0.0625rem solid rgba(0, 0, 0, 0.2);
}

.ball-b { background: radial-gradient(circle at 35% 30%, #6ec1ff, #1e6bd6); }
.ball-i { background: radial-gradient(circle at 35% 30%, #ff8a8a, #c91b2b); }
.ball-n { background: radial-gradient(circle at 35% 30%, #ffe089, #d49b0f); color: #4a0812; text-shadow: 0 0.0625rem 0 rgba(255, 255, 255, 0.4); }
.ball-g { background: radial-gradient(circle at 35% 30%, #7fe39f, #1a8a3c); }
.ball-o { background: radial-gradient(circle at 35% 30%, #d8a4ff, #7a30c8); }

/* ============ BINGO BOARD ============ */
#bingo-board {
    width: 100%;
    display: flex;
    justify-content: center;
    padding: 0.25rem 0 0.5rem;
}

.card-frame {
    width: 100%;
    background:
        linear-gradient(180deg, var(--cream) 0%, var(--cream-shadow) 100%) padding-box,
        linear-gradient(135deg, var(--gold) 0%, var(--gold-deep) 50%, var(--gold) 100%) border-box;
    border: 0.2rem solid transparent;
    border-radius: var(--r-card);
    padding: 0.5rem;
    box-shadow:
        0 0 0 0.0625rem rgba(0, 0, 0, 0.35),
        0 0.5rem 1.5rem rgba(0, 0, 0, 0.45),
        inset 0 0.0625rem 0 rgba(255, 255, 255, 0.45);
}

.bingo-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.3rem;
}

.bingo-cell {
    aspect-ratio: 1 / 1;
    background: linear-gradient(180deg, #fffdf3 0%, #f3e9c1 100%);
    border: 0.0625rem solid rgba(0, 0, 0, 0.15);
    border-radius: 0.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--ink);
    position: relative;
    box-shadow:
        inset 0 0.0625rem 0 rgba(255, 255, 255, 0.7),
        inset 0 -0.0625rem 0.15rem rgba(0, 0, 0, 0.08),
        0 0.0625rem 0.0625rem rgba(0, 0, 0, 0.1);
    transition: transform 0.15s ease;
}

.bingo-cell.free {
    background: linear-gradient(180deg, var(--gold-soft) 0%, var(--gold) 100%);
    color: var(--crimson-deep);
    font-size: 0.85rem;
    letter-spacing: 0.05rem;
}

.bingo-cell.marked::after {
    content: '';
    position: absolute;
    inset: 0.18rem;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, var(--red-bright) 0%, var(--red) 60%, var(--crimson) 100%);
    box-shadow:
        inset 0 -0.15rem 0.3rem rgba(0, 0, 0, 0.35),
        inset 0 0.18rem 0.3rem rgba(255, 255, 255, 0.35),
        0 0.0625rem 0.18rem rgba(0, 0, 0, 0.3);
    z-index: 1;
    opacity: 0.92;
    animation: daubIn 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.bingo-cell.marked {
    color: var(--cream);
    text-shadow: 0 0.0625rem 0.0625rem rgba(0, 0, 0, 0.5);
}

.bingo-cell.marked > * { position: relative; z-index: 2; }
.bingo-cell.marked { z-index: 0; }
.bingo-cell.marked.free::after { display: none; }
.bingo-cell.marked.free { color: var(--crimson-deep); text-shadow: none; }

/* number appears above the daub */
.bingo-cell {
    z-index: 1;
}
.bingo-cell.marked {
    /* keep number visible above daub via z-index already on cell */
}

@keyframes daubIn {
    0%   { transform: scale(0.2); opacity: 0; }
    60%  { transform: scale(1.15); opacity: 1; }
    100% { transform: scale(1); opacity: 0.92; }
}

.bingo-cell.just-marked {
    animation: cellPulse 0.35s ease;
}

@keyframes cellPulse {
    0%, 100% { transform: scale(1); }
    50%       { transform: scale(1.08); }
}

.bingo-cell.winning::before {
    content: '';
    position: absolute;
    inset: -0.1rem;
    border-radius: 0.45rem;
    border: 0.15rem solid var(--win-green);
    box-shadow:
        0 0 0.75rem var(--win-green),
        inset 0 0 0.5rem rgba(34, 197, 94, 0.4);
    z-index: 3;
    animation: winLinePulse 0.9s ease-in-out infinite;
    pointer-events: none;
}

@keyframes winLinePulse {
    0%, 100% { opacity: 0.95; box-shadow: 0 0 0.6rem var(--win-green); }
    50%       { opacity: 0.55; box-shadow: 0 0 1.2rem var(--win-green-soft); }
}

/* ============ DRAW AREA ============ */
.draw-area {
    width: 100%;
    height: 4.5rem;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0.25rem 0;
}

.called-ball {
    width: 4.25rem;
    height: 4.25rem;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #fff;
    text-shadow: 0 0.0625rem 0.125rem rgba(0, 0, 0, 0.45);
    border: 0.125rem solid rgba(255, 255, 255, 0.25);
    box-shadow:
        inset 0 -0.4rem 0.7rem rgba(0, 0, 0, 0.35),
        inset 0 0.35rem 0.55rem rgba(255, 255, 255, 0.35),
        0 0.4rem 0.9rem rgba(0, 0, 0, 0.45),
        0 0 1.2rem rgba(255, 200, 61, 0.3);
    background: radial-gradient(circle at 35% 30%, #ff8a8a, #c91b2b);
    position: relative;
}

.called-ball.hidden { visibility: hidden; }

.called-ball.letter-b { background: radial-gradient(circle at 35% 30%, #6ec1ff, #1e6bd6); }
.called-ball.letter-i { background: radial-gradient(circle at 35% 30%, #ff8a8a, #c91b2b); }
.called-ball.letter-n { background: radial-gradient(circle at 35% 30%, #ffe089, #d49b0f); color: #4a0812; text-shadow: 0 0.0625rem 0 rgba(255, 255, 255, 0.4); }
.called-ball.letter-g { background: radial-gradient(circle at 35% 30%, #7fe39f, #1a8a3c); }
.called-ball.letter-o { background: radial-gradient(circle at 35% 30%, #d8a4ff, #7a30c8); }

.called-letter {
    font-size: 0.85rem;
    font-weight: 800;
    line-height: 1;
    letter-spacing: 0.05rem;
    opacity: 0.95;
}

.called-number {
    font-size: 1.6rem;
    font-weight: 900;
    line-height: 1;
    margin-top: 0.1rem;
}

.called-ball.bounce { animation: ballBounce 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275); }

@keyframes ballBounce {
    0%   { transform: translateY(-1.5rem) scale(0.3); opacity: 0; }
    50%  { transform: translateY(0.25rem) scale(1.15); opacity: 1; }
    75%  { transform: translateY(-0.15rem) scale(0.95); }
    100% { transform: translateY(0) scale(1); opacity: 1; }
}

/* ============ STATS ROW ============ */
.stats-row {
    width: 100%;
    display: flex;
    justify-content: space-between;
    gap: 0.4rem;
    padding: 0.25rem 0.25rem 0.4rem;
}

.stat-block {
    flex: 1;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.35) 0%, rgba(0, 0, 0, 0.18) 100%);
    border: 0.0625rem solid rgba(255, 200, 61, 0.35);
    border-radius: 0.5rem;
    padding: 0.3rem 0.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-shadow: inset 0 0.0625rem 0 rgba(255, 255, 255, 0.05);
}

.stat-label {
    color: var(--gold-soft);
    font-size: 0.65rem;
    letter-spacing: 0.075rem;
    font-weight: 700;
    text-transform: uppercase;
    opacity: 0.85;
}

.stat-value {
    color: var(--gold);
    font-size: 1.05rem;
    font-weight: 800;
    text-shadow: 0 0 0.4rem rgba(255, 200, 61, 0.45);
    margin-top: 0.1rem;
}

.stat-value.urgent {
    color: var(--red-bright);
    animation: urgentBlink 0.7s ease-in-out infinite;
}

@keyframes urgentBlink {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.55; }
}

/* ============ RESULT DISPLAY ============ */
#result-display {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(160deg, var(--crimson-deep) 0%, var(--crimson) 100%);
    padding: 1.1rem 2rem;
    border-radius: 1rem;
    border: 0.125rem solid var(--gold);
    box-shadow:
        0 0 0 0.0625rem rgba(0, 0, 0, 0.45),
        0 0 3rem rgba(255, 200, 61, 0.5),
        inset 0 0.0625rem 0 rgba(255, 255, 255, 0.1);
    z-index: 100;
    text-align: center;
    min-width: 16rem;
    animation: resultPopup 0.45s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

#result-display.hidden { display: none; }

@keyframes resultPopup {
    0%   { transform: translate(-50%, -50%) scale(0.6); opacity: 0; }
    100% { transform: translate(-50%, -50%) scale(1);   opacity: 1; }
}

.result-icon {
    font-size: 2.5rem;
    margin-bottom: 0.25rem;
}

.result-title {
    font-size: 1.5rem;
    font-weight: 900;
    letter-spacing: 0.15rem;
    margin-bottom: 0.4rem;
}

.result-title.win {
    color: var(--gold);
    text-shadow: 0 0 0.9rem rgba(255, 200, 61, 0.6);
}

.result-title.lose {
    color: var(--text-muted);
}

.result-pattern {
    color: var(--gold-soft);
    font-size: 0.85rem;
    letter-spacing: 0.1rem;
    text-transform: uppercase;
    margin-bottom: 0.25rem;
}

.result-pattern.hidden,
.result-multiplier.hidden,
.result-amount.hidden { display: none; }

.result-multiplier {
    color: var(--red-bright);
    font-size: 1.4rem;
    font-weight: 800;
    margin: 0.25rem 0;
    text-shadow: 0 0 0.6rem rgba(233, 52, 72, 0.55);
}

.result-amount {
    color: var(--gold);
    font-size: 1.8rem;
    font-weight: 900;
    line-height: 1;
    text-shadow: 0 0 1rem rgba(255, 200, 61, 0.65);
}

/* ============ BET CONTROLS ============ */
#bet-controls {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.4rem 0.25rem;
    flex-wrap: wrap;
}

.bet-label {
    color: var(--gold-soft);
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.075rem;
    text-transform: uppercase;
}

.bet-buttons { display: flex; gap: 0.4rem; }

.bet-btn {
    min-width: 3rem;
    height: 2rem;
    background: rgba(0, 0, 0, 0.35);
    border: 0.0625rem solid rgba(255, 200, 61, 0.4);
    border-radius: var(--r-btn);
    color: var(--gold-soft);
    font-size: 0.85rem;
    font-weight: 800;
    cursor: pointer;
    padding: 0 0.65rem;
    transition: all 0.15s ease;
}

.bet-btn:hover:not(:disabled) {
    border-color: var(--gold);
    color: var(--gold);
    background: rgba(255, 200, 61, 0.12);
}

.bet-btn.active {
    background: linear-gradient(160deg, var(--gold) 0%, var(--gold-deep) 100%);
    color: var(--crimson-deep);
    border-color: var(--gold-soft);
    box-shadow: 0 0.125rem 0.65rem rgba(255, 200, 61, 0.45);
}

.bet-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.current-bet {
    background: rgba(0, 0, 0, 0.45);
    padding: 0.25rem 0.85rem;
    border-radius: var(--r-btn);
    border: 0.0625rem solid rgba(255, 200, 61, 0.3);
}

#current-bet-value {
    color: var(--gold);
    font-size: 1rem;
    font-weight: 800;
}

/* ============ ACTION BUTTON ============ */
#action-button {
    width: 11.25rem;
    height: 3.25rem;
    background: linear-gradient(160deg, var(--gold) 0%, var(--red-bright) 55%, var(--red) 100%);
    border: 0.0625rem solid var(--gold-soft);
    border-radius: 1.625rem;
    cursor: pointer;
    box-shadow:
        0 0.25rem 1.4rem rgba(255, 200, 61, 0.45),
        0 0.0625rem 0 rgba(255, 255, 255, 0.25) inset;
    transition: all 0.18s ease;
    margin: 0.5rem 0;
}

#action-button:hover:not(:disabled) {
    transform: translateY(-0.125rem);
    box-shadow: 0 0.5rem 1.85rem rgba(233, 52, 72, 0.6);
}

#action-button:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 0.125rem 0.6rem rgba(255, 200, 61, 0.4);
}

#action-button:disabled {
    background: linear-gradient(160deg, #4a2026 0%, #2a1014 100%);
    border-color: rgba(255, 255, 255, 0.08);
    box-shadow: none;
    cursor: not-allowed;
}

#action-button.pulse {
    animation: buttonPulse 2s ease-in-out infinite;
}

@keyframes buttonPulse {
    0%, 100% { box-shadow: 0 0.25rem 1.4rem rgba(255, 200, 61, 0.45); }
    50%       { box-shadow: 0 0.25rem 2.5rem rgba(255, 200, 61, 0.85); }
}

#action-text {
    color: var(--crimson-deep);
    font-size: 1.25rem;
    font-weight: 900;
    letter-spacing: 0.2rem;
}

#action-button:disabled #action-text {
    color: #885058;
}

/* ============ GAME TITLE ============ */
.game-title {
    display: flex;
    align-items: baseline;
    gap: 0.4rem;
    padding: 0.25rem 0 0.4rem;
}

.title-speed {
    color: var(--gold-soft);
    font-size: 0.7rem;
    letter-spacing: 0.125rem;
    text-transform: uppercase;
    opacity: 0.6;
}

.title-75 {
    color: var(--gold);
    font-size: 1.25rem;
    font-weight: 900;
    letter-spacing: 0.125rem;
    text-shadow: 0 0 0.85rem rgba(255, 200, 61, 0.6);
}

/* ============ MESSAGE ============ */
#message-display {
    position: absolute;
    bottom: 11rem;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(20, 6, 8, 0.94);
    padding: 0.5rem 1.4rem;
    border-radius: 0.5rem;
    border: 0.0625rem solid rgba(255, 200, 61, 0.4);
    z-index: 100;
    white-space: nowrap;
}

#message-display.hidden { display: none; }

#message-text { color: var(--cream); font-size: 0.85rem; }

/* ============ PARTICLES ============ */
#particles-container {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1000;
}

.particle {
    position: absolute;
    font-size: 1.3rem;
    animation: particleFall 2s ease-out forwards;
}

@keyframes particleFall {
    0%   { opacity: 1; transform: translateY(0) rotate(0deg) scale(1); }
    100% { opacity: 0; transform: translateY(70vh) rotate(540deg) scale(0.4); }
}

/* ============ RESPONSIVE ============ */
@media (max-width: 25rem) {
    .bingo-cell { font-size: 0.95rem; }
    .bingo-ball { width: 2rem; height: 2rem; font-size: 0.9rem; }
    .called-ball { width: 3.6rem; height: 3.6rem; }
    .called-number { font-size: 1.35rem; }
    .called-letter { font-size: 0.75rem; }
    .stat-value { font-size: 0.95rem; }
    .bet-btn { min-width: 2.6rem; height: 1.9rem; font-size: 0.8rem; }
    #action-button { width: 9.5rem; height: 2.85rem; }
    #action-text { font-size: 1.05rem; letter-spacing: 0.15rem; }
}

@media (max-height: 44rem) {
    .draw-area { height: 3.75rem; margin: 0.15rem 0; }
    .called-ball { width: 3.7rem; height: 3.7rem; }
    .called-number { font-size: 1.4rem; }
    #action-button { height: 2.85rem; margin: 0.25rem 0; }
    .bingo-letters { padding: 0.3rem 0 0.25rem; }
    .stats-row { padding: 0.15rem 0.25rem 0.25rem; }
}
