/* Tiny Little Bingo - Mobile-First Styles */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

:root {
    /* BINGO Column Colors */
    --col-b: #3B82F6;  /* Blue */
    --col-i: #F59E0B;  /* Yellow/Amber */
    --col-n: #06B6D4;  /* Cyan */
    --col-g: #EC4899;  /* Pink */
    --col-o: #22C55E;  /* Green */

    /* UI Colors */
    --primary: #6366F1;
    --primary-dark: #4F46E5;
    --secondary: #EC4899;
    --success: #22C55E;
    --warning: #F59E0B;
    --danger: #EF4444;
    --bg-dark: #1E1B4B;
    --bg-card: #2D2A5E;
    --text-light: #FFFFFF;
    --text-muted: #A5B4FC;
}

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(180deg, #1E1B4B 0%, #312E81 100%);
    color: var(--text-light);
    min-height: 100vh;
    min-height: -webkit-fill-available;
}

.game-container {
    width: 100%;
    height: 100vh;
    height: -webkit-fill-available;
    max-width: 480px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

/* App Mode - Add top margin for mobile app integration */
body.app-mode .game-container {
    padding-top: 44px; /* Standard iOS status bar height */
}

/* ================================ */
/* Board Selection Screen */
/* ================================ */

.board-selection-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, #1E1B4B 0%, #312E81 100%);
    display: flex;
    flex-direction: column;
    z-index: 9998;
    padding: 20px;
    overflow-y: auto;
}

.selection-header {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}

.user-badge {
    display: flex;
    align-items: center;
    background: linear-gradient(135deg, #D97706 0%, #F59E0B 100%);
    padding: 8px 24px 8px 8px;
    border-radius: 50px;
    gap: 12px;
    border: 3px solid #92400E;
}

.user-avatar-circle {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 3px solid #FBBF24;
    overflow: hidden;
    background: white;
}

.user-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-name-badge {
    font-size: 18px;
    font-weight: 800;
    color: white;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.selection-title {
    text-align: center;
    font-size: 24px;
    font-weight: 700;
    color: white;
    margin-bottom: 24px;
}

.boards-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 24px;
    flex: 1;
}

.board-card {
    position: relative;
    background: white;
    border-radius: 12px;
    padding: 8px;
    border: 4px solid #F59E0B;
    cursor: pointer;
    transition: transform 0.2s;
}

.board-card:active {
    transform: scale(0.95);
}

.board-card-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(34, 197, 94, 0.85);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    font-weight: 900;
    color: white;
    text-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

.board-card-badge {
    position: absolute;
    bottom: 12px;
    right: 12px;
    background: white;
    border-radius: 20px;
    padding: 6px 12px;
    display: flex;
    align-items: center;
    gap: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    z-index: 10;
}

.board-badge-icon {
    font-size: 16px;
}

.board-badge-text {
    font-size: 14px;
    font-weight: 700;
    color: #333;
}

.board-card.free-badge .board-card-badge {
    background: linear-gradient(135deg, #EC4899 0%, #F59E0B 100%);
}

.board-card.free-badge .board-badge-text {
    color: white;
}

.bottom-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    background: rgba(0,0,0,0.2);
    border-radius: 16px;
    gap: 12px;
}

.nav-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    background: rgba(109, 40, 217, 0.3);
    border: none;
    border-radius: 12px;
    padding: 12px;
    color: white;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.nav-btn:active {
    transform: scale(0.95);
}

.nav-icon {
    font-size: 28px;
}

.nav-btn-play {
    flex: 1.5;
    background: linear-gradient(135deg, #22C55E 0%, #16A34A 100%);
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.4);
}

.play-circle {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 4px;
}

.play-icon {
    font-size: 24px;
    color: #16A34A;
    margin-left: 4px;
}

.play-cost {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 14px;
    font-weight: 700;
}

.coin-icon {
    font-size: 16px;
}

/* ================================ */
/* Login Section */
/* ================================ */

.login-section {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, #1E1B4B 0%, #312E81 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.login-content {
    text-align: center;
    padding: 40px 30px;
    max-width: 350px;
    width: 90%;
}

.login-title {
    font-size: 32px;
    font-weight: 800;
    color: var(--text-light);
    margin-bottom: 8px;
    text-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

.login-subtitle {
    font-size: 16px;
    color: var(--text-muted);
    margin-bottom: 40px;
}

.btn-google {
    width: 100%;
    padding: 16px 24px;
    background: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    color: #333;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.btn-google:active {
    transform: scale(0.98);
}

.login-features {
    margin-top: 40px;
    display: flex;
    justify-content: center;
    gap: 20px;
    font-size: 14px;
    color: var(--text-muted);
}

.login-features span {
    padding: 8px 16px;
    background: rgba(255,255,255,0.1);
    border-radius: 20px;
}

/* ================================ */
/* Main Game Area */
/* ================================ */

.game-main {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 8px;
    gap: 8px;
}

/* Top Bar Compact */
.top-bar-compact {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 10px;
    gap: 8px;
}

.user-info-compact {
    display: flex;
    align-items: center;
    background: linear-gradient(135deg, #D97706 0%, #F59E0B 100%);
    padding: 3px 12px 3px 3px;
    border-radius: 50px;
    gap: 6px;
    border: 2px solid #92400E;
}

.user-avatar-circle-small {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 2px solid #FBBF24;
    overflow: hidden;
    background: white;
}

.user-avatar-small {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-name-badge-small {
    font-size: 12px;
    font-weight: 800;
    color: white;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.timer-compact {
    display: flex;
    align-items: center;
    gap: 4px;
    background: rgba(0,0,0,0.3);
    padding: 6px 12px;
    border-radius: 50px;
    border: 2px solid rgba(255,255,255,0.2);
}

.timer-icon-compact {
    font-size: 14px;
}

.timer-text {
    font-size: 14px;
    font-weight: 800;
    color: white;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

/* ================================ */
/* Ball Carousel Section */
/* ================================ */

.ball-carousel-section {
    position: relative;
    background: rgba(0,0,0,0.3);
    border-radius: 12px;
    padding: 8px;
    margin-bottom: 6px;
}

.ball-info-header {
    display: flex;
    justify-content: center;
    margin-bottom: 6px;
}

.ball-count-badges {
    display: flex;
    gap: 6px;
}

.ball-badge {
    display: flex;
    align-items: center;
    gap: 4px;
    background: rgba(0,0,0,0.4);
    padding: 4px 8px;
    border-radius: 16px;
    border: 2px solid rgba(255,255,255,0.2);
}

.badge-icon {
    font-size: 14px;
}

.badge-count {
    font-size: 13px;
    font-weight: 800;
    color: white;
}

.carousel-track-wrapper {
    overflow-x: auto;
    overflow-y: hidden;
    margin: 0 35px;
    padding: 4px 0;
    scrollbar-width: none;
}

.carousel-track-wrapper::-webkit-scrollbar {
    display: none;
}

.carousel-track {
    display: flex;
    gap: 6px;
    min-width: min-content;
}

.carousel-ball {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    flex-shrink: 0;
    box-shadow: 0 3px 8px rgba(0,0,0,0.3);
    color: white;
}

.carousel-ball .ball-letter {
    font-size: 8px;
    font-weight: 800;
    line-height: 1;
}

.carousel-ball .ball-number {
    font-size: 13px;
    font-weight: 800;
    line-height: 1;
}

.carousel-ball.col-b { background: var(--col-b); }
.carousel-ball.col-i { background: var(--col-i); }
.carousel-ball.col-n { background: var(--col-n); }
.carousel-ball.col-g { background: var(--col-g); }
.carousel-ball.col-o { background: var(--col-o); }

.current-ball-display {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 6px;
}

.current-ball-large {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
    color: white;
    background: var(--col-i);
}

.current-ball-letter {
    font-size: 12px;
    font-weight: 900;
    line-height: 1;
}

.current-ball-number {
    font-size: 24px;
    font-weight: 900;
    line-height: 1;
}

.carousel-nav {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    border: 2px solid rgba(255,255,255,0.4);
    color: white;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.carousel-nav:active {
    transform: scale(0.9);
    background: rgba(255,255,255,0.3);
}

.carousel-prev {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
}

.carousel-next {
    /* Position handled in current-ball-display */
}

.game-status-bar {
    text-align: center;
    padding: 6px;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.3) 0%, rgba(236, 72, 153, 0.3) 100%);
    border-radius: 10px;
    margin-bottom: 6px;
    border: 2px solid rgba(139, 92, 246, 0.5);
}

.status-text-game {
    font-size: 12px;
    font-weight: 700;
    color: white;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

/* ================================ */
/* Game Info Bar */
/* ================================ */

.game-info-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: rgba(255,255,255,0.08);
    border-radius: 10px;
    font-size: 12px;
}

.status-section {
    display: flex;
    align-items: center;
    gap: 6px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #888;
}

.status-dot.connected { background: var(--success); }
.status-dot.disconnected { background: var(--danger); }
.status-dot.connecting { background: var(--warning); animation: blink 1s infinite; }

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.status-text {
    color: var(--text-muted);
    font-weight: 500;
}

.timer-section {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    background: rgba(245, 158, 11, 0.2);
    border: 1px solid var(--warning);
    border-radius: 8px;
}

.timer-text {
    font-size: 16px;
    font-weight: 800;
    color: var(--warning);
}

.timer-icon {
    font-size: 14px;
}

.pool-section {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 10px;
    background: rgba(34, 197, 94, 0.15);
    border: 1px solid var(--success);
    border-radius: 8px;
}

.pool-label {
    font-size: 10px;
    color: var(--text-muted);
}

.pool-amount {
    font-size: 14px;
    font-weight: 800;
    color: var(--success);
}

/* ================================ */
/* Ticket Tabs */
/* ================================ */

.ticket-tabs {
    display: flex;
    gap: 6px;
    padding: 4px;
    background: rgba(0,0,0,0.2);
    border-radius: 10px;
}

.ticket-tab {
    flex: 1;
    padding: 8px;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.ticket-tab.active {
    background: var(--primary);
    color: white;
}

.ticket-tab:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Notification dot on ticket tabs */
.tab-notification {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    background: var(--danger);
    border-radius: 9px;
    font-size: 10px;
    font-weight: 700;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    animation: notification-pulse 1.5s ease-in-out infinite;
    box-shadow: 0 2px 6px rgba(239, 68, 68, 0.5);
}

@keyframes notification-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* ================================ */
/* Bingo Card */
/* ================================ */

.bingo-card-container {
    flex: 1;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    min-height: 0;
    overflow-y: auto;
}

/* Waiting Message */
.waiting-message {
    text-align: center;
    padding: 40px 20px;
}

.waiting-icon {
    font-size: 64px;
    margin-bottom: 16px;
    animation: float 2s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.waiting-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-light);
    margin-bottom: 8px;
}

.waiting-subtitle {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 20px;
}

.waiting-loader {
    display: flex;
    justify-content: center;
    gap: 8px;
}

.loader-dot {
    width: 10px;
    height: 10px;
    background: var(--primary);
    border-radius: 50%;
    animation: loader-bounce 1.4s ease-in-out infinite;
}

.loader-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.loader-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes loader-bounce {
    0%, 80%, 100% {
        transform: scale(0.6);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* No Tickets Message */
.no-tickets-message {
    text-align: center;
    color: var(--text-muted);
    padding: 40px 20px;
}

.no-tickets-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.no-tickets-message p {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-light);
}

.no-tickets-message .sub-text {
    font-size: 14px;
    font-weight: 400;
    color: var(--text-muted);
}

/* Next Round Tickets Purchased */
.next-round-tickets {
    text-align: center;
    padding: 30px 20px;
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.15) 0%, rgba(99, 102, 241, 0.15) 100%);
    border-radius: 16px;
    border: 2px solid var(--success);
    margin: 10px;
}

.next-round-icon {
    font-size: 48px;
    margin-bottom: 12px;
    animation: bounce 1s ease infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

.next-round-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--success);
    margin-bottom: 8px;
}

.next-round-title span {
    font-size: 28px;
}

.next-round-subtitle {
    font-size: 14px;
    color: var(--text-muted);
}

/* Bingo Cards Grid - Dynamic layout based on card count */
.bingo-cards-grid {
    width: 100%;
    max-width: 100%;
    display: grid;
    gap: 4px;
    padding: 4px;
    box-sizing: border-box;
    grid-template-columns: repeat(2, 1fr);
    overflow-y: auto;
    max-height: calc(100vh - 320px);
}

/* 1 card: centered single column */
.bingo-cards-grid[data-card-count="1"] {
    grid-template-columns: 1fr;
    place-items: center;
}

/* 2 cards: side by side */
.bingo-cards-grid[data-card-count="2"] {
    grid-template-columns: repeat(2, 1fr);
}

/* 3 cards: 2 on top, 1 on bottom centered */
.bingo-cards-grid[data-card-count="3"] {
    grid-template-columns: repeat(2, 1fr);
}

.bingo-cards-grid[data-card-count="3"] .bingo-card:last-child {
    grid-column: 1 / -1;
    justify-self: center;
    max-width: 50%;
}

/* 4 cards: 2x2 grid */
.bingo-cards-grid[data-card-count="4"] {
    grid-template-columns: repeat(2, 1fr);
}

.bingo-card {
    position: relative;
    width: 100%;
    background: linear-gradient(135deg, #FEF3C7 0%, #FDE68A 100%);
    border-radius: 8px;
    padding: 4px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    border: 2px solid #D97706;
    box-sizing: border-box;
}

.bingo-card-win-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 215, 0, 0.85);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.win-overlay-bingo {
    background: rgba(245, 158, 11, 0.9);
}

.win-overlay-gameover {
    background: rgba(139, 92, 246, 0.9);
}

.win-overlay-text {
    font-size: 32px;
    font-weight: 900;
    color: #FEF3C7;
    text-shadow:
        3px 3px 0 #DC2626,
        -1px -1px 0 #DC2626,
        1px -1px 0 #DC2626,
        -1px 1px 0 #DC2626,
        1px 1px 0 #DC2626,
        0 4px 8px rgba(0,0,0,0.3);
    letter-spacing: 2px;
    transform: rotate(-5deg);
}

/* Larger cards for single ticket */
.bingo-cards-grid.single-ticket .bingo-card {
    max-width: min(360px, 90vw);
}

/* Auto-Daub Badge */
.auto-daub-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: linear-gradient(135deg, #10B981 0%, #059669 100%);
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.4);
    z-index: 10;
    border: 2px solid #FFFFFF;
    letter-spacing: 0.5px;
}

.auto-daub-badge span {
    display: flex;
    align-items: center;
    gap: 3px;
}

.auto-daub-enabled {
    border-color: #10B981;
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2), 0 3px 8px rgba(0,0,0,0.2);
}

.bingo-header {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1px;
    margin-bottom: 3px;
    border-radius: 4px 4px 0 0;
    overflow: hidden;
}

.bingo-letter {
    height: clamp(18px, 4.5vw, 24px);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(11px, 2.8vw, 16px);
    font-weight: 800;
    color: white;
    border-radius: 4px;
}

.bingo-letter.col-b { background: var(--col-b); }
.bingo-letter.col-i { background: var(--col-i); }
.bingo-letter.col-n { background: var(--col-n); }
.bingo-letter.col-g { background: var(--col-g); }
.bingo-letter.col-o { background: var(--col-o); }

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

.bingo-cell {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.95);
    border-radius: 3px;
    font-size: clamp(9px, 2.8vw, 14px);
    font-weight: 700;
    color: #333;
    cursor: pointer;
    transition: all 0.15s;
    position: relative;
    user-select: none;
    border: 1px solid transparent;
}

/* Larger cells for single ticket */
.bingo-cards-grid.single-ticket .bingo-cell {
    font-size: 20px;
    border-radius: 8px;
}

.bingo-cards-grid.single-ticket .bingo-letter {
    height: 36px;
    font-size: 22px;
}

.bingo-cards-grid.single-ticket .bingo-header {
    gap: 3px;
    margin-bottom: 8px;
}

.bingo-cards-grid.single-ticket .bingo-grid {
    gap: 5px;
}

.bingo-cell:active {
    transform: scale(0.95);
}

/* Column color indicators on cells */
.bingo-cell.col-b { border-bottom: 3px solid var(--col-b); }
.bingo-cell.col-i { border-bottom: 3px solid var(--col-i); }
.bingo-cell.col-n { border-bottom: 3px solid var(--col-n); }
.bingo-cell.col-g { border-bottom: 3px solid var(--col-g); }
.bingo-cell.col-o { border-bottom: 3px solid var(--col-o); }

/* Free cell */
.bingo-cell.free {
    background: linear-gradient(135deg, var(--secondary) 0%, var(--primary) 100%);
    color: white;
    font-size: 12px;
    font-weight: 800;
}

/* Callable - number has been drawn but not marked */
/* Use value-based colors to match drawn balls */
.bingo-cell.callable {
    animation: callable-pulse 1s ease-in-out infinite;
}

.bingo-cell.callable.value-b {
    box-shadow: 0 0 0 3px var(--col-b);
}
.bingo-cell.callable.value-i {
    box-shadow: 0 0 0 3px var(--col-i);
}
.bingo-cell.callable.value-n {
    box-shadow: 0 0 0 3px var(--col-n);
}
.bingo-cell.callable.value-g {
    box-shadow: 0 0 0 3px var(--col-g);
}
.bingo-cell.callable.value-o {
    box-shadow: 0 0 0 3px var(--col-o);
}

@keyframes callable-pulse-b {
    0%, 100% { box-shadow: 0 0 0 3px var(--col-b); }
    50% { box-shadow: 0 0 0 5px var(--col-b), 0 0 15px var(--col-b); }
}
@keyframes callable-pulse-i {
    0%, 100% { box-shadow: 0 0 0 3px var(--col-i); }
    50% { box-shadow: 0 0 0 5px var(--col-i), 0 0 15px var(--col-i); }
}
@keyframes callable-pulse-n {
    0%, 100% { box-shadow: 0 0 0 3px var(--col-n); }
    50% { box-shadow: 0 0 0 5px var(--col-n), 0 0 15px var(--col-n); }
}
@keyframes callable-pulse-g {
    0%, 100% { box-shadow: 0 0 0 3px var(--col-g); }
    50% { box-shadow: 0 0 0 5px var(--col-g), 0 0 15px var(--col-g); }
}
@keyframes callable-pulse-o {
    0%, 100% { box-shadow: 0 0 0 3px var(--col-o); }
    50% { box-shadow: 0 0 0 5px var(--col-o), 0 0 15px var(--col-o); }
}

.bingo-cell.callable.value-b { animation-name: callable-pulse-b; }
.bingo-cell.callable.value-i { animation-name: callable-pulse-i; }
.bingo-cell.callable.value-n { animation-name: callable-pulse-n; }
.bingo-cell.callable.value-g { animation-name: callable-pulse-g; }
.bingo-cell.callable.value-o { animation-name: callable-pulse-o; }

/* Marked/Daubed cell */
.bingo-cell.marked {
    background: linear-gradient(135deg, var(--secondary) 0%, var(--danger) 100%);
    color: white;
    transform: scale(0.95);
}

.bingo-cell.marked::after {
    content: '';
    position: absolute;
    width: 70%;
    height: 70%;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Ccircle cx='12' cy='12' r='10' opacity='0.3'/%3E%3C/svg%3E");
    background-size: contain;
}

/* Winning cell */
.bingo-cell.winning {
    animation: winning-glow 0.5s ease-in-out infinite alternate;
    box-shadow: 0 0 20px var(--success);
}

@keyframes winning-glow {
    from { box-shadow: 0 0 10px var(--success); }
    to { box-shadow: 0 0 25px var(--success), 0 0 40px var(--success); }
}

/* ================================ */
/* BINGO Claim Button */
/* ================================ */

.bingo-claim-section {
    padding: 8px;
}

.btn-bingo-claim {
    width: 100%;
    padding: 16px 24px;
    background: linear-gradient(135deg, #FF6B6B 0%, #FFE66D 50%, #4ECDC4 100%);
    background-size: 200% 200%;
    animation: bingo-gradient 2s ease infinite, bingo-pulse 0.5s ease-in-out infinite;
    border: none;
    border-radius: 16px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    box-shadow: 0 4px 20px rgba(255, 107, 107, 0.5),
                0 0 40px rgba(255, 230, 109, 0.3);
    transition: transform 0.2s;
}

.btn-bingo-claim:active {
    transform: scale(0.95);
}

@keyframes bingo-gradient {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes bingo-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

.bingo-text {
    font-size: 32px;
    font-weight: 900;
    color: white;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3),
                 0 0 20px rgba(255,255,255,0.5);
    letter-spacing: 4px;
}

.bingo-subtext {
    font-size: 12px;
    font-weight: 600;
    color: rgba(255,255,255,0.9);
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

.btn-bingo-claim:disabled {
    animation: none;
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-bingo-claim.claiming .bingo-text {
    animation: bingo-flash 0.3s ease infinite;
}

@keyframes bingo-flash {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ================================ */
/* Bottom Controls */
/* ================================ */

.bottom-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    background: rgba(0,0,0,0.3);
    border-radius: 16px;
    gap: 12px;
}

.home-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    background: linear-gradient(135deg, #DC2626 0%, #B91C1C 100%);
    border: none;
    border-radius: 12px;
    padding: 10px 16px;
    color: white;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 8px rgba(220, 38, 38, 0.3);
    transition: all 0.2s;
}

.home-btn:active {
    transform: scale(0.95);
}

.home-icon {
    font-size: 24px;
}

.sound-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    background: rgba(255,255,255,0.1);
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.2);
    cursor: pointer;
    transition: all 0.2s;
}

.sound-btn:active {
    transform: scale(0.9);
    background: rgba(255,255,255,0.2);
}

.sound-icon {
    font-size: 24px;
}

.auto-toggle-wrapper {
    display: flex;
    align-items: center;
}

.auto-daub-button {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    background: linear-gradient(135deg, #22C55E 0%, #16A34A 100%);
    padding: 10px 20px;
    border-radius: 50px;
    box-shadow: 0 4px 8px rgba(34, 197, 94, 0.3);
    cursor: pointer;
    border: 3px solid rgba(255,255,255,0.3);
    transition: all 0.2s;
    min-width: 80px;
}

.auto-daub-button:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: 0 6px 12px rgba(34, 197, 94, 0.4);
}

.auto-daub-button:active:not(:disabled) {
    transform: scale(0.95);
}

.auto-daub-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: linear-gradient(135deg, #6B7280 0%, #4B5563 100%);
}

.auto-daub-button.purchased {
    background: linear-gradient(135deg, #10B981 0%, #059669 100%);
    border-color: #FFFFFF;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.5);
}

.auto-daub-button.purchased::before {
    content: '✓ ';
}

.auto-toggle-label {
    font-weight: 800;
    color: white;
    font-size: 16px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
    line-height: 1;
}

.auto-daub-cost {
    display: flex;
    align-items: center;
    gap: 3px;
    font-size: 13px;
    font-weight: 700;
    color: white;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.coin-icon-small {
    font-size: 14px;
}

/* Floating cost indicator animation */
.floating-cost-indicator {
    animation: floatUp 0.8s ease-out forwards;
}

@keyframes floatUp {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateY(-50px) scale(1.2);
    }
}

.coin-display {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(255,255,255,0.1);
    padding: 10px 16px;
    border-radius: 50px;
    border: 2px solid rgba(255,255,255,0.2);
}

.coin-icon-display {
    font-size: 20px;
}

.coin-amount {
    font-size: 16px;
    font-weight: 800;
    color: white;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

/* ================================ */
/* Ticket Selection Screen (Full page) */
/* ================================ */

.ticket-selection-screen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100vh;
    background: linear-gradient(180deg, #1e3a8a 0%, #312e81 100%);
    display: flex;
    flex-direction: column;
    padding: 12px;
    box-sizing: border-box;
    z-index: 1000;
    overflow: hidden;
}

.ticket-selection-screen .selection-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.balance-badge {
    background: rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 18px;
    padding: 6px 12px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.balance-badge .coin-icon {
    font-size: 16px;
}

.balance-badge span:last-child {
    font-size: 16px;
    font-weight: 800;
    color: #FCD34D;
}

.round-info-detailed {
    margin-bottom: 8px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    padding: 6px 12px;
}

.round-info-row {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
}

.round-number {
    font-size: 13px;
    font-weight: 700;
    color: white;
}

.round-number span {
    color: #FCD34D;
}

.round-time {
    font-size: 13px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.8);
}

.watch-live-message {
    text-align: center;
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 12px;
    font-weight: 700;
    color: #EF4444;
    animation: pulse 2s ease-in-out infinite;
}

.watch-live-message span {
    color: white;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

.ticket-selection-screen .selection-title {
    text-align: center;
    font-size: 20px;
    font-weight: 700;
    color: white;
    margin: 0 0 12px 0;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.game-status-message {
    text-align: center;
    background: linear-gradient(135deg, rgba(236, 72, 153, 0.3) 0%, rgba(139, 92, 246, 0.3) 100%);
    border: 2px solid rgba(236, 72, 153, 0.5);
    border-radius: 10px;
    padding: 8px 12px;
    margin: 0 0 10px 0;
}

.game-status-message span {
    font-size: 12px;
    font-weight: 700;
    color: white;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.tickets-preview-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: auto;
    flex: 1;
    align-content: center;
}

.ticket-preview-card {
    position: relative;
    background: linear-gradient(135deg, #FDE68A 0%, #F59E0B 100%);
    border-radius: 12px;
    padding: 6px;
    border: 3px solid #F59E0B;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 3px 8px rgba(0,0,0,0.3);
}

.ticket-preview-card.selected {
    border-color: #10B981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.5);
}

.ticket-preview-card:active {
    transform: scale(0.98);
}

/* Smaller bingo cells in preview cards */
.ticket-preview-card .bingo-header {
    gap: 1px;
    margin-bottom: 1px;
}

.ticket-preview-card .bingo-letter {
    height: 14px;
    font-size: 9px;
    font-weight: 700;
}

.ticket-preview-card .bingo-grid {
    gap: 1px;
}

.ticket-preview-card .bingo-cell {
    font-size: 8px;
    font-weight: 700;
    border-width: 1px;
    border-radius: 2px;
}

.ticket-preview-card .bingo-cell.free {
    font-size: 6px;
    font-weight: 700;
}

.ticket-preview-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(16, 185, 129, 0.92);
    border-radius: 12px;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 5;
}

.ticket-preview-card.selected .ticket-preview-overlay {
    display: flex;
}

.bought-text {
    font-size: 24px;
    font-weight: 900;
    color: white;
    text-shadow:
        0 3px 8px rgba(0,0,0,0.5);
    letter-spacing: 1px;
}

.ticket-preview-badge {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: white;
    border-radius: 18px;
    padding: 4px 10px;
    display: flex;
    align-items: center;
    gap: 4px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
    z-index: 10;
}

.ticket-preview-badge.free-badge {
    background: white;
}

.ticket-preview-badge.cost-badge {
    background: white;
}

.badge-icon {
    font-size: 14px;
}

.badge-text {
    font-size: 12px;
    font-weight: 800;
    color: #333;
}

.ticket-preview-badge.free-badge .badge-text {
    color: #10B981;
}

.ticket-preview-badge.cost-badge .badge-text {
    color: #F59E0B;
}

/* ================================ */
/* Buy Section (Legacy - keeping for compatibility) */
/* ================================ */

.buy-section {
    padding: 12px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15) 0%, rgba(236, 72, 153, 0.15) 100%);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 12px;
    animation: buy-section-glow 2s ease-in-out infinite;
}

@keyframes buy-section-glow {
    0%, 100% { box-shadow: 0 0 10px rgba(99, 102, 241, 0.2); }
    50% { box-shadow: 0 0 20px rgba(99, 102, 241, 0.4); }
}

.buy-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-size: 14px;
}

.buy-header span:first-child {
    font-weight: 700;
}

.tickets-owned {
    color: var(--text-muted);
}

.buy-buttons {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
}

.buy-btn {
    flex: 1;
    padding: 10px 8px;
    background: rgba(255,255,255,0.1);
    border: 2px solid transparent;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.buy-btn.active {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.2);
}

.buy-count {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-light);
}

.buy-price {
    font-size: 12px;
    color: var(--text-muted);
}

.btn-buy-confirm {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, var(--success) 0%, #16A34A 100%);
    border: none;
    border-radius: 12px;
    color: white;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.2s;
}

.btn-buy-confirm:active {
    transform: scale(0.98);
}

.btn-buy-confirm:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ================================ */
/* Bottom Bar */
/* ================================ */

.bottom-bar {
    padding: 10px 12px;
    background: rgba(255,255,255,0.05);
    border-radius: 12px;
}

.players-section {
    display: flex;
    align-items: center;
    gap: 10px;
}

.players-label {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
}

.player-avatars {
    display: flex;
    gap: -8px;
    flex: 1;
    overflow: hidden;
}

.player-avatar-item {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid var(--bg-dark);
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    margin-left: -8px;
}

.player-avatar-item:first-child {
    margin-left: 0;
}

.player-avatar-item img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.player-count-more {
    background: rgba(255,255,255,0.2);
    font-size: 10px;
    font-weight: 600;
}

/* ================================ */
/* Modals */
/* ================================ */

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.modal.show {
    display: flex;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: var(--bg-card);
    border-radius: 24px;
    padding: 32px 24px;
    max-width: 320px;
    width: 90%;
    text-align: center;
    animation: modal-pop 0.3s ease-out;
}

@keyframes modal-pop {
    from {
        transform: scale(0.8);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* Winner Modal */
.winner-content {
    overflow: hidden;
}

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

.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    animation: confetti-fall 3s ease-out forwards;
}

@keyframes confetti-fall {
    0% {
        transform: translateY(-100%) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(400px) rotate(720deg);
        opacity: 0;
    }
}

.winner-icon {
    font-size: 60px;
    margin-bottom: 16px;
    animation: bounce 0.6s ease-in-out infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.winner-title {
    font-size: 32px;
    font-weight: 800;
    color: var(--warning);
    margin-bottom: 8px;
    text-shadow: 0 2px 10px rgba(245, 158, 11, 0.5);
}

.winner-message {
    font-size: 16px;
    color: var(--text-muted);
    margin-bottom: 20px;
}

.winner-prize {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 16px;
    background: rgba(34, 197, 94, 0.2);
    border-radius: 12px;
    margin-bottom: 16px;
}

.prize-label {
    font-size: 12px;
    color: var(--text-muted);
}

.prize-amount {
    font-size: 36px;
    font-weight: 800;
    color: var(--success);
}

.winner-pattern {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 20px;
}

.btn-modal-close {
    width: 100%;
    padding: 14px;
    background: var(--primary);
    border: none;
    border-radius: 12px;
    color: white;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
}

/* Result Modal */
.result-content {
    padding: 24px;
}

.result-title {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 20px;
    color: var(--text-light);
}

.result-winner, .result-prize {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

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

.result-name {
    font-weight: 600;
}

.result-amount {
    font-weight: 700;
    color: var(--success);
}

.result-pattern {
    padding: 16px;
    background: rgba(255,255,255,0.05);
    border-radius: 8px;
    margin: 16px 0;
    color: var(--text-muted);
}

/* ================================ */
/* Responsive */
/* ================================ */

@media (min-height: 700px) {
    .bingo-card {
        max-width: 360px;
    }

    .bingo-cell {
        font-size: 20px;
    }

    .bingo-letter {
        height: 40px;
        font-size: 22px;
    }
}

@media (min-height: 800px) {
    .game-main {
        gap: 12px;
        padding: 12px;
    }

    .bingo-card {
        padding: 16px;
    }

    .bingo-grid {
        gap: 8px;
    }
}

/* Desktop adjustments */
@media (min-width: 481px) {
    body {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .game-container {
        height: 100vh;
        max-height: 900px;
        border-radius: 24px;
        overflow: hidden;
        box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    }
}
