/* ===================================
   CSS Variables (Telegram Theme Integration)
   =================================== */
:root {
    /* Default theme colors (will be overridden by Telegram) */
    --tg-theme-bg-color: #0a0a0f;
    --tg-theme-text-color: #e0e0e0;
    --tg-theme-hint-color: #b0b0b0;
    --tg-theme-link-color: #64ffda;
    --tg-theme-button-color: #64ffda;
    --tg-theme-button-text-color: #0a0a0f;
    --tg-theme-secondary-bg-color: #0d1117;

    /* Custom theme colors */
    --primary-color: #64ffda;
    --primary-dark: #4db8a8;
    --secondary-color: #bb86fc;
    --success-color: #4ade80;
    --error-color: #ef4444;
    --warning-color: #fbbf24;

    /* Shadows and overlays */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
    --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.6);

    /* Borders */
    --border-radius-sm: 8px;
    --border-radius-md: 12px;
    --border-radius-lg: 16px;
    --border-radius-xl: 20px;

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;

    /* Spacing */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;
}

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

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Vazirmatn', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--tg-theme-bg-color);
    color: var(--tg-theme-text-color);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* Disable user selection for better mobile UX */
.no-select {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

/* ===================================
   Loading Screen
   =================================== */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--tg-theme-bg-color);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: fadeIn 0.3s ease;
}

.loading-content {
    text-align: center;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(100, 255, 218, 0.1);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    margin: 0 auto 20px;
    animation: spin 1s linear infinite;
}

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

.loading-content h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 8px;
}

.loading-content p {
    color: var(--tg-theme-hint-color);
}

/* ===================================
   Error Screen
   =================================== */
.error-screen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--tg-theme-bg-color);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9998;
}

.error-content {
    text-align: center;
    padding: var(--spacing-xl);
    max-width: 400px;
}

.error-icon {
    font-size: 4rem;
    margin-bottom: var(--spacing-lg);
    animation: shake 0.5s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

.error-content h2 {
    font-size: 1.5rem;
    color: var(--error-color);
    margin-bottom: var(--spacing-md);
}

.error-content p {
    color: var(--tg-theme-hint-color);
    margin-bottom: var(--spacing-lg);
    line-height: 1.6;
}

/* ===================================
   Buttons
   =================================== */
.btn {
    padding: 14px 28px;
    border: none;
    border-radius: var(--border-radius-md);
    font-family: 'Vazirmatn', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition-normal);
    outline: none;
    text-align: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:active::before {
    width: 300px;
    height: 300px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: var(--tg-theme-button-text-color);
    box-shadow: 0 6px 20px rgba(100, 255, 218, 0.4);
    border: 2px solid transparent;
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(100, 255, 218, 0.5);
    border-color: rgba(255, 255, 255, 0.3);
}

.btn-primary:active {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(100, 255, 218, 0.4);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: var(--tg-theme-text-color);
    border: 2px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
    border-color: rgba(255, 255, 255, 0.3);
}

.btn-secondary:active {
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
}

/* ===================================
   Container and Layout
   =================================== */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: var(--spacing-md);
}

.hidden {
    display: none !important;
}

/* ===================================
   Sticky Header
   =================================== */
.sticky-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(10, 10, 15, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: var(--spacing-md);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    transform: translateY(-100%);
    transition: transform var(--transition-normal);
}

.sticky-header.visible {
    transform: translateY(0);
}

.sticky-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--spacing-md);
    max-width: 1400px;
    margin: 0 auto;
}

.sticky-last-announced {
    background: rgba(100, 255, 218, 0.1);
    border: 2px solid rgba(100, 255, 218, 0.3);
    border-radius: var(--border-radius-md);
    padding: 10px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.sticky-label {
    font-size: 0.9rem;
    color: var(--tg-theme-hint-color);
    font-weight: 500;
}

.sticky-number {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--primary-color);
    min-width: 40px;
    text-align: center;
}

.connection-status {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.05);
    padding: 8px 16px;
    border-radius: var(--border-radius-md);
    font-size: 0.9rem;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--success-color);
    animation: pulse 2s ease-in-out infinite;
}

.status-dot.disconnected {
    background: var(--error-color);
    animation: none;
}

.status-dot.connecting {
    background: var(--warning-color);
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.5;
        transform: scale(0.9);
    }
}

/* ===================================
   Game Header
   =================================== */
.game-header {
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--border-radius-lg);
    padding: var(--spacing-lg);
    margin-bottom: var(--spacing-xl);
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(10px);
    animation: slideDown 0.5s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-lg);
}

.player-info {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.player-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--tg-theme-button-text-color);
    box-shadow: var(--shadow-md);
}

.player-details h3 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.player-balance {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.9rem;
    color: var(--tg-theme-hint-color);
}

.balance-icon {
    font-size: 1rem;
}

.menu-button {
    background: rgba(255, 255, 255, 0.05);
    border: none;
    border-radius: var(--border-radius-md);
    width: 44px;
    height: 44px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    cursor: pointer;
    transition: all var(--transition-normal);
}

.menu-button span {
    width: 20px;
    height: 2px;
    background: var(--tg-theme-text-color);
    border-radius: 2px;
    transition: all var(--transition-normal);
}

.menu-button:hover {
    background: rgba(255, 255, 255, 0.1);
}

.header-center {
    text-align: center;
    margin-bottom: var(--spacing-lg);
}

.game-title {
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 900;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: var(--spacing-md);
    text-shadow: 0 0 30px rgba(100, 255, 218, 0.3);
}

.game-stats {
    display: flex;
    justify-content: center;
    gap: var(--spacing-lg);
    flex-wrap: wrap;
}

.stat-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.05);
    padding: 8px 16px;
    border-radius: var(--border-radius-md);
    font-size: 0.95rem;
    font-weight: 600;
}

.stat-icon {
    font-size: 1.2rem;
}

.last-announced {
    background: rgba(100, 255, 218, 0.1);
    border: 2px solid rgba(100, 255, 218, 0.3);
    border-radius: var(--border-radius-md);
    padding: var(--spacing-lg);
    text-align: center;
}

.last-announced-label {
    font-size: 0.95rem;
    color: var(--tg-theme-hint-color);
    margin-bottom: var(--spacing-sm);
    font-weight: 500;
}

.last-announced-number {
    font-size: 3rem;
    font-weight: 900;
    color: var(--primary-color);
    text-shadow: 0 4px 20px rgba(100, 255, 218, 0.4);
    animation: numberPop 0.5s ease;
}

@keyframes numberPop {
    0% {
        transform: scale(0.8);
        opacity: 0;
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* ===================================
   Sections
   =================================== */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-lg);
    flex-wrap: wrap;
    gap: var(--spacing-md);
}

.section-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.count-badge {
    background: var(--primary-color);
    color: var(--tg-theme-button-text-color);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 700;
    box-shadow: var(--shadow-sm);
}

/* ===================================
   Announced Numbers Section
   =================================== */
.announced-numbers-section {
    margin-bottom: var(--spacing-xl);
}

.announced-numbers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(42px, 1fr));
    gap: var(--spacing-sm);
    background: rgba(255, 255, 255, 0.03);
    padding: var(--spacing-lg);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-md);
}

.number-cell {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--border-radius-sm);
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--tg-theme-hint-color);
    transition: all var(--transition-normal);
    border: 2px solid transparent;
}

.number-cell.announced {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: var(--tg-theme-button-text-color);
    border-color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(100, 255, 218, 0.4);
    transform: scale(1.05);
    animation: cellPop 0.4s ease;
}

@keyframes cellPop {
    0% {
        transform: scale(0.8);
        opacity: 0;
    }
    50% {
        transform: scale(1.15);
    }
    100% {
        transform: scale(1.05);
        opacity: 1;
    }
}

/* ===================================
   Filter Controls
   =================================== */
.filter-controls {
    display: flex;
    gap: var(--spacing-md);
}

.filter-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(100, 255, 218, 0.08);
    border: 2px solid rgba(100, 255, 218, 0.3);
    color: var(--primary-color);
    padding: 12px 24px;
    border-radius: var(--border-radius-md);
    cursor: pointer;
    font-size: 0.95rem;
    font-family: 'Vazirmatn', sans-serif;
    font-weight: 700;
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.filter-icon {
    font-size: 1.1rem;
    transition: transform var(--transition-normal);
}

.filter-toggle:hover {
    background: rgba(100, 255, 218, 0.15);
    border-color: rgba(100, 255, 218, 0.5);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(100, 255, 218, 0.2);
}

.filter-toggle:hover .filter-icon {
    transform: scale(1.2) rotate(5deg);
}

.filter-toggle.active {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: var(--tg-theme-button-text-color);
    border-color: var(--primary-color);
    box-shadow: 0 6px 20px rgba(100, 255, 218, 0.4);
}

.filter-toggle.active:hover {
    box-shadow: 0 8px 24px rgba(100, 255, 218, 0.5);
}

.filter-toggle.active .filter-icon {
    transform: scale(1.1);
}

/* ===================================
   Bingo Cards
   =================================== */
.cards-section {
    margin-bottom: var(--spacing-xl);
}

.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: var(--spacing-lg);
    justify-content: center;
    max-width: 1400px;
    margin: 0 auto;
}

.bingo-card {
    background: rgba(255, 255, 255, 0.04);
    border-radius: var(--border-radius-lg);
    padding: var(--spacing-lg);
    box-shadow: var(--shadow-lg);
    transition: all var(--transition-normal);
    border: 2px solid rgba(100, 255, 218, 0.2);
    opacity: 0;
    animation: cardFadeIn 0.5s ease forwards;
}

@keyframes cardFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.bingo-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 40px rgba(100, 255, 218, 0.3);
    border-color: rgba(100, 255, 218, 0.4);
}

.bingo-card.winner {
    background: linear-gradient(135deg, rgba(74, 222, 128, 0.25), rgba(34, 197, 94, 0.20)) !important;
    border: 3px solid var(--success-color) !important;
    box-shadow: 0 0 30px rgba(74, 222, 128, 0.6), 0 0 15px rgba(74, 222, 128, 0.3) inset !important;
    animation: winnerGlow 1.5s ease-in-out infinite !important;
    opacity: 1 !important;
    display: block !important;
    visibility: visible !important;
}

@keyframes winnerGlow {
    0%, 100% {
        box-shadow: 0 0 30px rgba(74, 222, 128, 0.6), 0 0 15px rgba(74, 222, 128, 0.3) inset;
        background: linear-gradient(135deg, rgba(74, 222, 128, 0.25), rgba(34, 197, 94, 0.20));
    }
    50% {
        box-shadow: 0 0 50px rgba(74, 222, 128, 0.9), 0 0 25px rgba(74, 222, 128, 0.5) inset;
        background: linear-gradient(135deg, rgba(74, 222, 128, 0.35), rgba(34, 197, 94, 0.30));
    }
}

.card-header {
    text-align: center;
    margin-bottom: var(--spacing-md);
    padding-bottom: var(--spacing-md);
    border-bottom: 2px solid rgba(100, 255, 218, 0.3);
}

.card-number {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary-color);
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: var(--spacing-sm);
}

.card-cell {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.06);
    border-radius: var(--border-radius-md);
    font-size: clamp(1.1rem, 2vw, 1.4rem);
    font-weight: 700;
    color: var(--tg-theme-text-color);
    transition: all var(--transition-normal);
    border: 2px solid transparent;
    position: relative;
    overflow: hidden;
}

.card-cell:hover {
    background: rgba(100, 255, 218, 0.1);
    border-color: rgba(100, 255, 218, 0.3);
    transform: scale(1.05);
}

.card-cell.marked {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: var(--tg-theme-button-text-color);
    border-color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(100, 255, 218, 0.4);
}

.card-cell.marked::after {
    content: '✓';
    position: absolute;
    top: 2px;
    left: 2px;
    font-size: 0.7rem;
    opacity: 0.7;
}

/* Staggered animation delays for cards */
.bingo-card:nth-child(1) { animation-delay: 0.05s; }
.bingo-card:nth-child(2) { animation-delay: 0.1s; }
.bingo-card:nth-child(3) { animation-delay: 0.15s; }
.bingo-card:nth-child(4) { animation-delay: 0.2s; }
.bingo-card:nth-child(5) { animation-delay: 0.25s; }
.bingo-card:nth-child(6) { animation-delay: 0.3s; }
.bingo-card:nth-child(7) { animation-delay: 0.35s; }
.bingo-card:nth-child(8) { animation-delay: 0.4s; }
.bingo-card:nth-child(9) { animation-delay: 0.45s; }
.bingo-card:nth-child(10) { animation-delay: 0.5s; }

.no-cards-message {
    text-align: center;
    padding: var(--spacing-xl);
    color: var(--tg-theme-hint-color);
}

.no-cards-icon {
    font-size: 4rem;
    margin-bottom: var(--spacing-md);
}

/* ===================================
   Winner Announcement
   =================================== */
.winner-announcement {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    animation: fadeIn 0.5s ease;
}

.winner-content {
    text-align: center;
    padding: var(--spacing-xl);
    max-width: 600px;
    position: relative;
}

.winner-title {
    font-size: 2.5rem;
    font-weight: 900;
    color: var(--success-color);
    margin-bottom: var(--spacing-md);
    animation: bounceIn 1s ease;
}

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

.winner-message {
    font-size: 1.2rem;
    color: var(--tg-theme-text-color);
    margin-bottom: var(--spacing-lg);
}

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

/* ===================================
   Game Finished
   =================================== */
.game-finished {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1999;
    animation: fadeIn 0.5s ease;
}

.finished-content {
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--border-radius-lg);
    padding: var(--spacing-xl);
    max-width: 500px;
    text-align: center;
}

.finished-content h2 {
    font-size: 1.5rem;
    margin-bottom: var(--spacing-md);
    color: var(--primary-color);
    transition: all var(--transition-normal);
    line-height: 1.3;
}

.finished-title-winner {
    font-size: clamp(1.3rem, 4vw, 1.8rem) !important;
    color: var(--success-color) !important;
    text-align: center;
    line-height: 1.4;
}

.finished-title-normal {
    font-size: 1.8rem !important;
    color: var(--primary-color) !important;
    text-align: center;
}

.finished-subtitle {
    font-size: 1rem;
    margin-bottom: var(--spacing-lg);
    color: var(--success-color);
    font-weight: 600;
    animation: fadeIn 0.5s ease;
    line-height: 1.5;
}

.finished-time {
    color: var(--tg-theme-hint-color);
    font-size: 0.95rem;
    margin-bottom: var(--spacing-lg);
    padding: var(--spacing-md);
    background: rgba(100, 255, 218, 0.1);
    border-radius: var(--border-radius-md);
    border: 1px solid rgba(100, 255, 218, 0.2);
}

#winnersListContainer {
    margin-top: var(--spacing-lg);
    animation: fadeInUp 0.5s ease 0.2s both;
}

#winnersListContainer h3 {
    font-size: 1.2rem;
    color: var(--primary-color);
    margin-bottom: var(--spacing-md);
    text-align: right;
    font-weight: 700;
}

.winner-item {
    padding: var(--spacing-md);
    background: rgba(74, 222, 128, 0.1);
    border-radius: var(--border-radius-md);
    margin-bottom: var(--spacing-sm);
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--spacing-md);
    border: 2px solid transparent;
    transition: all var(--transition-normal);
    animation: fadeInUp 0.4s ease both;
}

.winner-item:nth-child(1) { animation-delay: 0.1s; }
.winner-item:nth-child(2) { animation-delay: 0.2s; }
.winner-item:nth-child(3) { animation-delay: 0.3s; }
.winner-item:nth-child(4) { animation-delay: 0.4s; }
.winner-item:nth-child(5) { animation-delay: 0.5s; }

.winner-item:hover {
    background: rgba(74, 222, 128, 0.15);
    transform: translateX(-4px);
}

.winner-name {
    color: var(--success-color);
    font-size: 1rem;
    flex: 1;
    text-align: right;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.winner-badge {
    background: var(--success-color);
    color: var(--tg-theme-button-text-color);
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 700;
    box-shadow: var(--shadow-sm);
    animation: pulse 2s ease-in-out infinite;
}

.current-player-winner {
    background: rgba(74, 222, 128, 0.2);
    border-color: var(--success-color);
    box-shadow: 0 0 20px rgba(74, 222, 128, 0.4);
    animation: winnerItemGlow 2s ease-in-out infinite;
}

@keyframes winnerItemGlow {
    0%, 100% {
        box-shadow: 0 0 20px rgba(74, 222, 128, 0.4);
    }
    50% {
        box-shadow: 0 0 30px rgba(74, 222, 128, 0.6);
    }
}

.finished-actions {
    display: flex;
    gap: var(--spacing-md);
    margin-top: var(--spacing-lg);
    flex-wrap: wrap;
    animation: fadeInUp 0.5s ease 0.4s both;
}

.finished-actions .btn {
    flex: 1;
    min-width: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.finished-actions .btn span:first-child {
    font-size: 1.2rem;
}

/* ===================================
   Winner Card Highlighting
   =================================== */
.bingo-card.winner-card-highlight {
    border-color: var(--success-color);
    background: linear-gradient(135deg, rgba(74, 222, 128, 0.15), rgba(34, 197, 94, 0.15));
    box-shadow: 0 0 40px rgba(74, 222, 128, 0.6),
                0 0 20px rgba(74, 222, 128, 0.4) inset;
    animation: winnerPulse 2s ease-in-out infinite;
    opacity: 1 !important;
    display: block !important;
}

@keyframes winnerPulse {
    0%, 100% {
        box-shadow: 0 0 40px rgba(74, 222, 128, 0.6),
                    0 0 20px rgba(74, 222, 128, 0.4) inset;
        background: linear-gradient(135deg, rgba(74, 222, 128, 0.15), rgba(34, 197, 94, 0.15));
    }
    50% {
        box-shadow: 0 0 60px rgba(74, 222, 128, 0.8),
                    0 0 30px rgba(74, 222, 128, 0.6) inset;
        background: linear-gradient(135deg, rgba(74, 222, 128, 0.25), rgba(34, 197, 94, 0.25));
    }
}

/* ===================================
   Side Menu
   =================================== */
.side-menu {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 3000;
    pointer-events: none;
}

.side-menu.open {
    pointer-events: all;
}

.side-menu-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.side-menu.open .side-menu-overlay {
    opacity: 1;
}

.side-menu-content {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 300px;
    max-width: 85%;
    background: var(--tg-theme-secondary-bg-color);
    box-shadow: var(--shadow-xl);
    transform: translateX(100%);
    transition: transform var(--transition-normal);
    display: flex;
    flex-direction: column;
}

.side-menu.open .side-menu-content {
    transform: translateX(0);
}

.side-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-lg);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.side-menu-header h3 {
    font-size: 1.5rem;
    font-weight: 700;
}

.close-menu-button {
    background: none;
    border: none;
    font-size: 2rem;
    color: var(--tg-theme-text-color);
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all var(--transition-fast);
}

.close-menu-button:hover {
    background: rgba(255, 255, 255, 0.1);
}

.side-menu-nav {
    flex: 1;
    padding: var(--spacing-lg);
}

.menu-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-md);
    background: rgba(255, 255, 255, 0.03);
    border: none;
    border-radius: var(--border-radius-md);
    color: var(--tg-theme-text-color);
    font-family: 'Vazirmatn', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-normal);
    margin-bottom: var(--spacing-sm);
}

.menu-item:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateX(-4px);
}

.menu-icon {
    font-size: 1.5rem;
}

.count-badge-small {
    background: var(--primary-color);
    color: var(--tg-theme-button-text-color);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 700;
    margin-right: auto;
}

/* ===================================
   Modal Styles
   =================================== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 4000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.modal-content {
    position: relative;
    background: var(--tg-theme-secondary-bg-color);
    border-radius: var(--border-radius-xl);
    box-shadow: var(--shadow-xl);
    width: 90%;
    max-width: 600px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s ease;
    border: 2px solid rgba(100, 255, 218, 0.2);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-lg);
    border-bottom: 2px solid rgba(100, 255, 218, 0.2);
}

.modal-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin: 0;
}

.close-modal-button {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    font-size: 2rem;
    color: var(--tg-theme-text-color);
    cursor: pointer;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all var(--transition-normal);
    line-height: 1;
}

.close-modal-button:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: var(--spacing-lg);
}

.announced-count-display {
    text-align: center;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: var(--spacing-lg);
    padding: var(--spacing-md);
    background: rgba(100, 255, 218, 0.1);
    border-radius: var(--border-radius-md);
    border: 2px solid rgba(100, 255, 218, 0.3);
}

.announced-count-display #modalAnnouncedCount {
    font-size: 1.5rem;
    font-weight: 800;
}

.modal-body .announced-numbers-grid {
    background: rgba(255, 255, 255, 0.03);
    padding: var(--spacing-md);
    border-radius: var(--border-radius-md);
}

/* 15 columns for modal (15x6 = 90 numbers) */
.modal-numbers-grid {
    grid-template-columns: repeat(15, 1fr) !important;
    justify-content: center;
    justify-items: center;
}

/* ===================================
   Responsive Design
   =================================== */
@media (max-width: 768px) {
    :root {
        font-size: 14px;
    }

    .container {
        padding: var(--spacing-sm);
    }

    .game-header {
        padding: var(--spacing-md);
    }

    .header-top {
        margin-bottom: var(--spacing-md);
    }

    .player-avatar {
        width: 48px;
        height: 48px;
        font-size: 1.2rem;
    }

    .game-title {
        font-size: clamp(1.8rem, 8vw, 2.5rem);
    }

    .last-announced-number {
        font-size: 2.5rem;
    }

    .cards-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-md);
    }

    .announced-numbers-grid {
        grid-template-columns: repeat(auto-fill, minmax(36px, 1fr));
        gap: 6px;
        padding: var(--spacing-md);
    }

    /* Responsive modal grid for tablets */
    .modal-numbers-grid {
        grid-template-columns: repeat(10, 1fr) !important;
    }

    .sticky-header {
        padding: var(--spacing-sm);
    }

    .sticky-content {
        flex-direction: column;
        gap: var(--spacing-sm);
    }

    .sticky-last-announced {
        width: 100%;
        justify-content: center;
    }

    .connection-status {
        font-size: 0.8rem;
        padding: 6px 12px;
    }

    .filter-toggle {
        font-size: 0.85rem;
        padding: 8px 16px;
    }
}

@media (max-width: 480px) {
    .announced-numbers-grid {
        grid-template-columns: repeat(auto-fill, minmax(32px, 1fr));
        gap: 4px;
    }

    /* Responsive modal grid for phones */
    .modal-numbers-grid {
        grid-template-columns: repeat(6, 1fr) !important;
        gap: 6px;
    }

    .number-cell {
        font-size: 0.85rem;
    }

    .card-cell {
        font-size: 1rem;
    }

    .winner-title {
        font-size: 2rem;
    }

    .winner-message {
        font-size: 1rem;
    }

    .finished-title-winner {
        font-size: clamp(1.1rem, 5vw, 1.5rem) !important;
    }

    .finished-subtitle {
        font-size: 0.9rem;
    }

    .winner-name {
        font-size: 0.9rem;
    }

    .finished-actions .btn {
        font-size: 0.9rem;
        padding: 12px 20px;
    }
}

/* ===================================
   Utility Animations
   =================================== */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

/* ===================================
   Print Styles
   =================================== */
@media print {
    .sticky-header,
    .menu-button,
    .filter-controls,
    .side-menu {
        display: none !important;
    }
}
