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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 0;
    margin: 0;
    color: #333;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    touch-action: pan-y;
}

.container {
    width: 100%;
    height: 100vh;
    height: 100dvh; /* Dynamic viewport height for mobile browsers */
    margin: 0;
    background: white;
    border-radius: 0;
    box-shadow: none;
    padding: 20px;
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.fullscreen-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    width: 50px;
    height: 50px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    z-index: 1000;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
}

.fullscreen-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.fullscreen-btn svg {
    width: 24px;
    height: 24px;
}

.top-row {
    display: grid;
    grid-template-columns: 1fr 2fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
    align-items: start;
}

.top-left {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: flex-start;
}

.top-center {
    display: flex;
    align-items: center;
    justify-content: center;
}

.top-right {
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: flex-end;
}

.top-right-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    width: 100%;
}

.current-number-display {
    text-align: center;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    width: 100%;
}

.current-label {
    font-size: 1.2rem;
    color: white;
    font-weight: 600;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.current-number {
    font-size: 5rem;
    font-weight: 900;
    color: white;
    text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.3);
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.current-number.showing {
    animation: pulse 0.5s ease-in-out;
}

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


.btn {
    padding: 12px 20px;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 60px;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
}

.btn-text {
    display: block;
    line-height: 1.2;
}

.btn-shortcut {
    display: block;
    font-size: 0.7rem;
    font-weight: 400;
    opacity: 0.85;
    margin-top: 4px;
    text-transform: none;
    letter-spacing: 0;
    line-height: 1.2;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-success {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    color: white;
}

.btn-warning {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.bingo-board {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.letter-header {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    margin-bottom: 15px;
}

.letter-cell {
    text-align: center;
    font-size: clamp(1.5rem, 3vw, 3rem);
    font-weight: 900;
    color: #667eea;
    padding: clamp(10px, 1.5vh, 20px);
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border-radius: 10px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
}

.number-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    flex: 1;
    min-height: 0;
}

.letter-column {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    flex: 1;
    min-height: 0;
}

.sub-column {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}

.number-cell {
    background: #f8f9fa;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    padding: 8px 4px;
    text-align: center;
    font-size: clamp(0.8rem, 2vw, 2rem);
    font-weight: 600;
    color: #495057;
    transition: all 0.3s ease;
    cursor: pointer;
    flex: 1;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.number-cell:hover {
    border-color: #667eea;
    transform: scale(1.05);
}

.number-cell.called {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: #667eea;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    transform: scale(1.05);
    font-weight: 700;
}

.number-cell.called:hover {
    transform: scale(1.08);
}

.stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    width: 100%;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
    margin-top: 0;
}

.stat-item {
    text-align: center;
}

.stat-label {
    display: block;
    font-size: 0.9rem;
    color: #6c757d;
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stat-value {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    color: #667eea;
}

/* Tablet Landscape (769px - 1024px) */
@media (max-width: 1024px) and (min-width: 769px) {
    .container {
        padding: 15px;
    }

    .top-row {
        grid-template-columns: 1fr 2fr 1fr;
        gap: 15px;
        margin-bottom: 15px;
    }

    .current-number {
        font-size: 4rem;
        min-height: 90px;
    }

    .current-label {
        font-size: 1.1rem;
    }

    .btn {
        padding: 11px 18px;
        font-size: 0.95rem;
        min-height: 55px;
    }

    .btn-shortcut {
        font-size: 0.65rem;
    }

    .number-grid {
        gap: 8px;
    }

    .letter-column {
        gap: 6px;
    }

    .sub-column {
        gap: 5px;
    }

    .stats {
        padding: 12px;
    }

    .stat-value {
        font-size: 1.8rem;
    }
}

/* Tablet Portrait (481px - 768px) */
@media (max-width: 768px) {
    .container {
        padding: 8px;
        min-height: 100vh;
        min-height: 100dvh;
        height: auto;
        overflow-x: hidden;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .top-row {
        grid-template-columns: 1fr;
        gap: 8px;
        margin-bottom: 8px;
        flex-shrink: 0;
    }

    .bingo-board {
        flex-shrink: 0;
        min-height: auto;
    }

    .top-left,
    .top-center,
    .top-right {
        width: 100%;
        align-items: stretch;
    }

    .top-right-buttons {
        grid-template-columns: 1fr 1fr;
        width: 100%;
        gap: 6px;
    }

    .stats {
        grid-template-columns: 1fr 1fr;
        padding: 8px;
        gap: 6px;
    }

    .fullscreen-btn {
        top: 8px;
        right: 8px;
        width: 40px;
        height: 40px;
        touch-action: manipulation;
    }

    .fullscreen-btn svg {
        width: 18px;
        height: 18px;
    }

    .current-number-display {
        padding: 10px;
    }

    .current-number {
        font-size: 2.5rem;
        min-height: 60px;
    }

    .current-label {
        font-size: 0.75rem;
        margin-bottom: 4px;
        letter-spacing: 1px;
    }

    .btn {
        padding: 10px 12px;
        font-size: 0.8rem;
        min-height: 48px;
        touch-action: manipulation;
    }

    .btn-text {
        font-size: 0.8rem;
    }

    .btn-shortcut {
        font-size: 0.6rem;
        margin-top: 2px;
    }

    .number-grid {
        gap: 4px;
    }

    .letter-header {
        gap: 4px;
        margin-bottom: 6px;
    }

    .letter-column {
        gap: 3px;
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    .sub-column {
        gap: 3px;
        display: flex;
        flex-direction: column;
    }

    .number-cell {
        font-size: 1.5rem !important;
        padding: 0 !important;
        flex: none !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        height: auto;
        min-height: auto;
        width: 100%;
        text-align: center;
        line-height: 1.2;
    }

    .stat-label {
        font-size: 0.7rem;
        margin-bottom: 2px;
    }

    .stat-value {
        font-size: 1.3rem;
    }
}

/* Mobile Landscape (481px - 768px) in landscape orientation */
@media (max-width: 768px) and (orientation: landscape) and (max-height: 500px) {
    .container {
        padding: 8px;
        min-height: 100vh;
        min-height: 100dvh;
        height: auto;
        overflow-x: hidden;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .top-row {
        grid-template-columns: 1fr 1.5fr 1fr;
        gap: 8px;
        margin-bottom: 8px;
    }

    .current-number {
        font-size: 2.5rem;
        min-height: 50px;
    }

    .current-label {
        font-size: 0.85rem;
        margin-bottom: 4px;
    }

    .btn {
        padding: 8px 12px;
        font-size: 0.8rem;
        min-height: 45px;
    }

    .btn-shortcut {
        font-size: 0.6rem;
        margin-top: 2px;
    }

    .stats {
        padding: 8px;
    }

    .stat-value {
        font-size: 1.3rem;
    }

    .stat-label {
        font-size: 0.75rem;
    }
}

/* Mobile Portrait (max-width: 480px) */
@media (max-width: 480px) {
    .container {
        padding: 6px;
        min-height: 100vh;
        min-height: 100dvh;
        height: auto;
        overflow-x: hidden;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .top-row {
        gap: 6px;
        margin-bottom: 6px;
        flex-shrink: 0;
    }

    .bingo-board {
        flex-shrink: 0;
        min-height: auto;
    }

    .fullscreen-btn {
        top: 6px;
        right: 6px;
        width: 36px;
        height: 36px;
        touch-action: manipulation;
    }

    .fullscreen-btn svg {
        width: 16px;
        height: 16px;
    }

    .current-number-display {
        padding: 8px;
    }

    .current-number {
        font-size: 2rem;
        min-height: 50px;
    }

    .current-label {
        font-size: 0.65rem;
        margin-bottom: 3px;
        letter-spacing: 0.5px;
    }

    .btn {
        padding: 8px 10px;
        font-size: 0.75rem;
        min-height: 44px;
        touch-action: manipulation;
    }

    .btn-text {
        font-size: 0.75rem;
        line-height: 1.1;
    }

    .btn-shortcut {
        font-size: 0.55rem;
        margin-top: 1px;
        line-height: 1.1;
    }

    .top-right-buttons {
        gap: 4px;
    }

    .stats {
        padding: 6px;
        gap: 4px;
    }

    .stat-label {
        font-size: 0.65rem;
        margin-bottom: 2px;
    }

    .stat-value {
        font-size: 1.1rem;
    }

    .number-grid {
        gap: 3px;
    }

    .letter-header {
        gap: 3px;
        margin-bottom: 4px;
    }

    .letter-column {
        gap: 2px;
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    .sub-column {
        gap: 2px;
        display: flex;
        flex-direction: column;
    }

    .number-cell {
        font-size: 1.5rem !important;
        padding: 0 !important;
        flex: none !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        height: auto;
        min-height: auto;
        width: 100%;
        text-align: center;
        line-height: 1.2;
    }
}

/* Small Mobile (max-width: 360px) */
@media (max-width: 360px) {
    .container {
        padding: 4px;
        min-height: 100vh;
        min-height: 100dvh;
        height: auto;
        overflow-x: hidden;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .top-row {
        gap: 4px;
        margin-bottom: 4px;
    }

    .current-number {
        font-size: 1.75rem;
        min-height: 45px;
    }

    .current-label {
        font-size: 0.6rem;
    }

    .btn {
        padding: 7px 8px;
        font-size: 0.7rem;
        min-height: 44px;
    }

    .btn-text {
        font-size: 0.7rem;
    }

    .btn-shortcut {
        font-size: 0.5rem;
    }

    .stats {
        padding: 5px;
    }

    .stat-value {
        font-size: 1rem;
    }

    .stat-label {
        font-size: 0.6rem;
    }

    .number-grid {
        gap: 2px;
    }

    .letter-header {
        gap: 2px;
        margin-bottom: 3px;
    }

    .letter-column {
        gap: 2px;
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    .sub-column {
        gap: 2px;
        display: flex;
        flex-direction: column;
    }

    .number-cell {
        font-size: 1.5rem !important;
        padding: 0 !important;
        flex: none !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        height: auto;
        min-height: auto;
        width: 100%;
        text-align: center;
        line-height: 1.2;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    .btn {
        min-height: 44px; /* Minimum touch target size */
    }

    .number-cell {
        min-height: 44px;
    }

    .fullscreen-btn {
        min-width: 44px;
        min-height: 44px;
    }

    /* Remove hover effects on touch devices */
    .btn:hover {
        transform: none;
    }

    .number-cell:hover {
        transform: none;
    }
}

/* Additional mobile optimizations */
@media (max-width: 768px) {
    .top-left {
        order: 1;
    }

    .top-center {
        order: 2;
    }

    .top-right {
        order: 3;
    }

    /* Ensure buttons are touch-friendly */
    .btn:active {
        opacity: 0.8;
        transform: scale(0.98);
    }

    /* Prevent text selection on mobile */
    .btn,
    .number-cell,
    .stat-item {
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        -khtml-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
    }
}

