/* Galactic Bingo — Sci-Fi Planetarium Style */

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

:root {
    --teal:        #2bd4c8;
    --teal-soft:   #6ce9df;
    --violet:      #8b5cf6;
    --violet-soft: #b794f6;
    --pink:        #ec4899;
    --pink-soft:   #f472b6;
    --bg-deep:     #0a0220;
    --bg-mid:      #160a36;
    --bg-soft:     #1d0e4a;
    --text-white:  #f1ecff;
    --text-muted:  #8b7ec0;
    --text-mute2:  #5a4a8c;

    --halo-cyan:   rgba(43, 212, 200, 0.85);
    --halo-pink:   rgba(236, 72, 153, 0.6);

    /* Base unit for rem sizing — keep root 16px default */
    font-size: 16px;
}

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: radial-gradient(ellipse at 50% 0%, #2a155e 0%, var(--bg-mid) 40%, var(--bg-deep) 100%);
    min-height: 100dvh;
    color: var(--text-white);
}

/* ============ STARFIELD ============ */
#starfield {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background:
        radial-gradient(0.0625rem 0.0625rem at 18% 28%, rgba(255,255,255,0.9), transparent),
        radial-gradient(0.0625rem 0.0625rem at 72% 13%, rgba(43,212,200,0.85), transparent),
        radial-gradient(0.0625rem 0.0625rem at 42% 68%, rgba(255,255,255,0.7), transparent),
        radial-gradient(0.0625rem 0.0625rem at 88% 53%, rgba(236,72,153,0.7), transparent),
        radial-gradient(0.0625rem 0.0625rem at 12% 82%, rgba(255,255,255,0.8), transparent),
        radial-gradient(0.0625rem 0.0625rem at 58% 92%, rgba(139,92,246,0.75), transparent),
        radial-gradient(0.125rem 0.125rem at 92% 22%, rgba(255,255,255,0.6), transparent),
        radial-gradient(0.0625rem 0.0625rem at 28% 48%, rgba(255,255,255,0.5), transparent);
    background-repeat: repeat;
    background-size: 20rem 20rem;
    animation: starTwinkle 4s ease-in-out infinite alternate;
}

@keyframes starTwinkle {
    0%   { opacity: 0.5; }
    100% { opacity: 1; }
}

/* ============ NEBULA ============ */
#nebula {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.nebula-layer {
    position: absolute;
    width: 60rem;
    height: 60rem;
    border-radius: 50%;
    filter: blur(4rem);
    opacity: 0.35;
    mix-blend-mode: screen;
    animation: nebulaDrift 30s linear infinite;
}

.nebula-violet {
    background: radial-gradient(circle, rgba(139,92,246,0.55) 0%, transparent 70%);
    top: -20rem;
    left: -10rem;
    animation-duration: 36s;
}

.nebula-cyan {
    background: radial-gradient(circle, rgba(43,212,200,0.5) 0%, transparent 70%);
    bottom: -25rem;
    right: -15rem;
    animation-duration: 42s;
    animation-direction: reverse;
}

.nebula-pink {
    background: radial-gradient(circle, rgba(236,72,153,0.45) 0%, transparent 70%);
    top: 30%;
    right: -20rem;
    animation-duration: 50s;
}

@keyframes nebulaDrift {
    0%   { transform: translate(0, 0) rotate(0deg); }
    50%  { transform: translate(2rem, -1rem) rotate(180deg); }
    100% { transform: translate(0, 0) rotate(360deg); }
}

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

.screen.hidden { display: none; }

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

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

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

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

/* ============ GAME CONTAINER ============ */
#game-container {
    width: 100%;
    max-width: 28.75rem;
    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.375rem 0;
    display: flex;
    justify-content: center;
}

.balance-display {
    background: linear-gradient(180deg, rgba(43,212,200,0.12) 0%, rgba(139,92,246,0.08) 100%);
    border: 0.0625rem solid rgba(43,212,200,0.35);
    border-radius: 1.25rem;
    padding: 0.4375rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.4375rem;
    box-shadow: 0 0 1.125rem rgba(43,212,200,0.15);
}

.balance-label { color: var(--text-muted); font-size: 0.75rem; letter-spacing: 0.03125rem; }

#balance-value {
    color: var(--teal);
    font-size: 1.25rem;
    font-weight: 700;
    min-width: 4.375rem;
    text-align: right;
    text-shadow: 0 0 0.625rem rgba(43,212,200,0.5);
}

.balance-currency { color: var(--violet-soft); font-size: 0.6875rem; }

/* ============ PAYTABLE STRIP ============ */
.paytable-strip {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    padding: 0.4375rem 0.75rem;
    background:
        linear-gradient(180deg, #100530 0%, #1a0a48 100%) padding-box,
        linear-gradient(90deg, var(--teal), var(--violet) 50%, var(--pink)) border-box;
    border: 0.0625rem solid transparent;
    border-radius: 0.625rem;
    margin-bottom: 0.25rem;
}

.pay-item {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0 0.5rem;
}

.pay-name {
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.0625rem;
}

.pay-mult {
    color: var(--teal);
    font-size: 0.8125rem;
    font-weight: 700;
    letter-spacing: 0.03125rem;
    white-space: nowrap;
}

.pay-sep {
    width: 0.0625rem;
    height: 1.125rem;
    background: linear-gradient(to bottom, transparent, rgba(43,212,200,0.4), transparent);
}

/* ============ CALLER AREA ============ */
.caller-area {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.5rem 0 0.25rem;
    gap: 0.25rem;
}

.caller-planet {
    width: 4.5rem;
    height: 4.5rem;
    border-radius: 50%;
    background:
        radial-gradient(circle at 30% 30%, rgba(255,255,255,0.6) 0%, transparent 30%),
        linear-gradient(135deg, var(--teal) 0%, var(--violet) 50%, var(--pink) 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow:
        0 0 0 0.125rem rgba(255,255,255,0.05) inset,
        0 0 1.5rem rgba(43,212,200,0.5),
        0 0 3rem rgba(139,92,246,0.35);
    position: relative;
}

.caller-planet::before {
    content: '';
    position: absolute;
    inset: -0.25rem;
    border-radius: 50%;
    background: conic-gradient(from 0deg, transparent, rgba(43,212,200,0.45), transparent 60%);
    z-index: -1;
    animation: callerRing 6s linear infinite;
    filter: blur(0.25rem);
}

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

.caller-planet.calling {
    animation: callerPulse 0.3s ease-out;
}

@keyframes callerPulse {
    0%   { transform: scale(1) rotate(0deg); }
    50%  { transform: scale(1.15) rotate(180deg); box-shadow: 0 0 2.5rem rgba(236,72,153,0.7); }
    100% { transform: scale(1) rotate(360deg); }
}

#caller-number {
    color: #fff;
    font-size: 1.625rem;
    font-weight: 800;
    text-shadow: 0 0 0.625rem rgba(0,0,0,0.5), 0 0.125rem 0.25rem rgba(0,0,0,0.6);
    letter-spacing: 0.0625rem;
}

.balls-drawn {
    color: var(--text-muted);
    font-size: 0.75rem;
    letter-spacing: 0.0625rem;
}

#balls-count {
    color: var(--teal);
    font-weight: 700;
    text-shadow: 0 0 0.5rem rgba(43,212,200,0.4);
}

.balls-total { color: var(--text-mute2); }

/* ============ BINGO CARD ============ */
#bingo-card-wrapper {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    padding: 0.5rem 0.5rem;
    position: relative;
}

.card-frame {
    position: relative;
    background:
        linear-gradient(180deg, #0e0530 0%, #150840 100%) padding-box,
        linear-gradient(135deg, var(--teal) 0%, var(--violet) 50%, var(--pink) 100%) border-box;
    border: 0.1875rem solid transparent;
    border-radius: 1.125rem;
    padding: 0.625rem;
    box-shadow:
        0 0 0 0.0625rem rgba(0,0,0,0.7),
        0 0 2rem rgba(43,212,200,0.25),
        0 0 4rem rgba(139,92,246,0.15),
        0 1rem 2.5rem rgba(0,0,0,0.55);
}

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

.bingo-cell {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 50%;
    background:
        radial-gradient(circle at 30% 30%, rgba(255,255,255,0.18) 0%, transparent 35%),
        linear-gradient(155deg, #1f0f55 0%, #0e0530 100%);
    border: 0.0625rem solid rgba(139,92,246,0.35);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    box-shadow:
        inset 0 0 0.5rem rgba(0,0,0,0.55),
        0 0 0 0.0625rem rgba(0,0,0,0.35);
    transition: transform 0.2s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

.cell-motif {
    font-size: 0.75rem;
    opacity: 0.4;
    line-height: 1;
    margin-bottom: 0.125rem;
    filter: drop-shadow(0 0 0.125rem rgba(43,212,200,0.3));
}

.cell-number {
    color: var(--text-white);
    font-size: 1.0625rem;
    font-weight: 700;
    line-height: 1;
    letter-spacing: 0.03125rem;
}

.bingo-cell.free {
    background:
        radial-gradient(circle at 50% 50%, #000 0%, #1a0540 60%, #0e0530 100%);
    border-color: var(--pink);
    box-shadow:
        inset 0 0 0.75rem #000,
        0 0 0.75rem rgba(236,72,153,0.6);
}

.bingo-cell.free .cell-motif { opacity: 0.85; font-size: 0.875rem; }
.bingo-cell.free .cell-number {
    color: var(--pink-soft);
    font-size: 0.625rem;
    letter-spacing: 0.0625rem;
    text-shadow: 0 0 0.5rem rgba(236,72,153,0.7);
}

.bingo-cell.marked {
    background:
        radial-gradient(circle at 30% 30%, rgba(108,233,223,0.45) 0%, transparent 45%),
        linear-gradient(155deg, #105f5a 0%, #0a3a5c 100%);
    border-color: var(--teal);
    box-shadow:
        inset 0 0 0.625rem rgba(43,212,200,0.4),
        0 0 0.75rem var(--halo-cyan),
        0 0 1.5rem rgba(43,212,200,0.35);
}

.bingo-cell.marked .cell-motif { opacity: 0.85; }
.bingo-cell.marked .cell-number {
    color: #eafffe;
    text-shadow: 0 0 0.5rem rgba(43,212,200,0.8);
}

.bingo-cell.just-marked {
    animation: cellMarkPulse 0.5s ease;
}

@keyframes cellMarkPulse {
    0%   { transform: scale(1);    box-shadow: 0 0 0.25rem var(--halo-cyan); }
    50%  { transform: scale(1.18); box-shadow: 0 0 1.5rem var(--halo-cyan), 0 0 2.5rem rgba(43,212,200,0.5); }
    100% { transform: scale(1);    box-shadow: 0 0 0.75rem var(--halo-cyan); }
}

.bingo-cell.winning {
    animation: cellWinPulse 0.9s ease-in-out infinite;
    border-color: var(--pink);
}

@keyframes cellWinPulse {
    0%, 100% {
        box-shadow:
            inset 0 0 0.625rem rgba(43,212,200,0.4),
            0 0 0.75rem var(--halo-cyan),
            0 0 1.5rem var(--halo-pink);
        transform: scale(1);
    }
    50% {
        box-shadow:
            inset 0 0 0.875rem rgba(236,72,153,0.5),
            0 0 1.25rem var(--halo-pink),
            0 0 2.5rem var(--halo-cyan);
        transform: scale(1.05);
    }
}

/* ============ RESULT DISPLAY ============ */
#result-display {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(160deg, rgba(15,5,48,0.97) 0%, rgba(35,15,80,0.97) 100%);
    padding: 1.25rem 2.25rem;
    border-radius: 1rem;
    border: 0.0625rem solid var(--teal);
    box-shadow:
        0 0 0 0.0625rem rgba(43,212,200,0.25),
        0 0 3.5rem rgba(43,212,200,0.45),
        inset 0 0.0625rem 0 rgba(255,255,255,0.08);
    z-index: 100;
    text-align: center;
    min-width: 14rem;
    animation: resultPopup 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

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

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

.result-icon {
    font-size: 2.25rem;
    line-height: 1;
    margin-bottom: 0.375rem;
}

.result-title {
    font-size: 1.125rem;
    font-weight: 800;
    letter-spacing: 0.125rem;
    margin-bottom: 0.5rem;
}

.result-title.win {
    color: var(--teal);
    text-shadow: 0 0 0.875rem rgba(43,212,200,0.7);
}

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

.result-pattern {
    color: var(--violet-soft);
    font-size: 0.8125rem;
    letter-spacing: 0.0625rem;
    margin-bottom: 0.25rem;
}

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

.result-multiplier {
    color: var(--pink-soft);
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.0625rem;
    text-shadow: 0 0 0.625rem rgba(236,72,153,0.45);
}

.result-amount {
    color: var(--teal);
    font-size: 2rem;
    font-weight: 800;
    line-height: 1.1;
    margin-top: 0.25rem;
    text-shadow: 0 0 1rem rgba(43,212,200,0.6);
}

.supernova-badge {
    margin-top: 0.5rem;
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 0.5rem;
    background: linear-gradient(90deg, var(--violet) 0%, var(--pink) 100%);
    color: #fff;
    font-size: 0.6875rem;
    font-weight: 800;
    letter-spacing: 0.125rem;
    box-shadow: 0 0 1rem rgba(236,72,153,0.5);
    animation: supernovaPulse 1.2s ease-in-out infinite;
}

.supernova-badge.hidden { display: none; }

@keyframes supernovaPulse {
    0%, 100% { box-shadow: 0 0 0.75rem rgba(236,72,153,0.5); transform: scale(1); }
    50%      { box-shadow: 0 0 2rem rgba(236,72,153,0.85);   transform: scale(1.05); }
}

/* ============ MESSAGE DISPLAY ============ */
#message-display {
    position: absolute;
    bottom: 11.875rem;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(15,5,48,0.95);
    padding: 0.5rem 1.375rem;
    border-radius: 0.5rem;
    border: 0.0625rem solid rgba(43,212,200,0.3);
    z-index: 200;
    white-space: nowrap;
}

#message-display.hidden { display: none; }
#message-text { color: var(--text-white); font-size: 0.8125rem; }

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

#bet-controls.hidden { display: none; }

.bet-label {
    color: var(--text-muted);
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.0625rem;
    text-transform: uppercase;
}

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

.bet-btn {
    width: 3rem;
    height: 2rem;
    background: rgba(255,255,255,0.04);
    border: 0.0625rem solid rgba(43,212,200,0.25);
    border-radius: 0.375rem;
    color: rgba(241,236,255,0.65);
    font-size: 0.8125rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
}

.bet-btn:hover:not(:disabled) {
    border-color: var(--teal);
    color: var(--text-white);
    background: rgba(43,212,200,0.08);
}

.bet-btn.active {
    background: linear-gradient(160deg, var(--teal) 0%, var(--violet) 50%, var(--pink) 100%);
    color: #0a0220;
    border-color: var(--teal-soft);
    box-shadow: 0 0.125rem 0.75rem rgba(43,212,200,0.4);
}

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

/* ============ ACTION BUTTON ============ */
#action-button {
    width: 11.25rem;
    height: 3.25rem;
    background: linear-gradient(160deg, var(--teal) 0%, var(--violet) 55%, var(--pink) 100%);
    border: 0.0625rem solid rgba(108,233,223,0.5);
    border-radius: 1.625rem;
    cursor: pointer;
    box-shadow:
        0 0.25rem 1.375rem rgba(43,212,200,0.4),
        0 0.0625rem 0 rgba(255,255,255,0.18) 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.875rem rgba(139,92,246,0.55);
}

#action-button:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 0.125rem 0.625rem rgba(43,212,200,0.3);
}

#action-button:disabled {
    background: linear-gradient(160deg, #1e1830 0%, #14101f 100%);
    border-color: rgba(255,255,255,0.08);
    box-shadow: none;
    cursor: not-allowed;
}

#action-text {
    color: #0a0220;
    font-size: 1.0625rem;
    font-weight: 800;
    letter-spacing: 0.1875rem;
}

#action-button:disabled #action-text {
    color: #5a4a8c;
}

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

.title-mute {
    color: rgba(241,236,255,0.25);
    font-size: 0.75rem;
}

.title-main {
    color: rgba(241,236,255,0.55);
    font-size: 0.75rem;
    letter-spacing: 0.1875rem;
    text-transform: uppercase;
}

.title-accent {
    color: var(--pink-soft);
    font-size: 1.125rem;
    font-weight: 800;
    letter-spacing: 0.125rem;
    text-transform: uppercase;
    text-shadow: 0 0 0.875rem rgba(236,72,153,0.55);
}

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

.particle {
    position: absolute;
    font-size: 1.25rem;
    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) {
    .caller-planet { width: 3.75rem; height: 3.75rem; }
    #caller-number { font-size: 1.375rem; }
    .cell-number { font-size: 0.9375rem; }
    .cell-motif { font-size: 0.625rem; }
    .bet-btn { width: 2.625rem; height: 1.875rem; font-size: 0.75rem; }
    #action-button { width: 9.6875rem; height: 2.875rem; }
    #action-text { font-size: 0.9375rem; }
    .pay-name, .pay-mult { font-size: 0.6875rem; }
}

@media (max-height: 43.75rem) {
    .paytable-strip { padding: 0.3125rem 0.625rem; margin-bottom: 0; }
    .caller-area { padding: 0.25rem 0; }
    .caller-planet { width: 3.5rem; height: 3.5rem; }
    #caller-number { font-size: 1.25rem; }
    #bingo-card-wrapper { padding: 0.25rem; }
    .card-frame { padding: 0.5rem; }
    .bingo-grid { gap: 0.25rem; }
    .cell-number { font-size: 0.9375rem; }
}
