/* Bottom Tab Bar */
.bottom-tab-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 65px;
    background: rgba(10, 10, 10, 0.95);
    backdrop-filter: blur(20px);
    border-top: 1px solid rgba(255, 215, 0, 0.3);
    display: none;
    /* Only visible on mobile/small screens */
    justify-content: space-around;
    align-items: center;
    z-index: 2000;
    padding-bottom: env(safe-area-inset-bottom);
}

.tab-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #888;
    text-decoration: none;
    font-size: 0.7rem;
    gap: 4px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    flex: 1;
}

.tab-item.active {
    color: var(--gold);
}

.tab-icon {
    font-size: 1.4rem;
}

.tab-item:active {
    transform: scale(0.9);
}

/* Glassmorphism Sidebar for Statistics/Settings */
.mobile-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    z-index: 2100;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mobile-overlay.active {
    display: block;
    opacity: 1;
}

.side-panel {
    position: fixed;
    top: 0;
    right: -100%;
    width: 85%;
    max-width: 400px;
    height: 100%;
    background: #050505;
    z-index: 2200;
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 30px 20px;
    border-left: 1px solid var(--gold);
    overflow-y: auto;
}

.side-panel.active {
    right: 0;
}

/* Game Selector Card UI */
.game-selector-overlay {
    position: fixed;
    bottom: -100%;
    left: 0;
    width: 100%;
    height: 85vh;
    background: #0a0a0a;
    border-radius: 30px 30px 0 0;
    z-index: 2300;
    transition: bottom 0.4s cubic-bezier(0.18, 0.89, 0.32, 1.28);
    display: flex;
    flex-direction: column;
    padding: 20px;
    padding-bottom: 80px;
}

.game-selector-overlay.active {
    bottom: 0;
}

.selector-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 0 10px;
}

.selector-title {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--gold);
}

.close-selector {
    font-size: 1.5rem;
    color: #fff;
    cursor: pointer;
}

.card-swipe-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    padding: 10px;
}

.card-swipe-container::-webkit-scrollbar {
    display: none;
}

.card-swipe-container::-webkit-scrollbar-track {
    display: none;
}

.card-swipe-container::-webkit-scrollbar-thumb {
    display: none;
}

.game-swipe-card {
    width: 100%;
    aspect-ratio: 1/1.2;
    background: linear-gradient(135deg, #1a1a1a 0%, #050505 100%);
    border: 1px solid rgba(255, 215, 0, 0.2);
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 15px;
    text-align: center;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.5);
}

.game-swipe-card:hover,
.game-swipe-card:active {
    border-color: var(--gold);
    transform: scale(1.05) translateY(-5px);
    box-shadow: 0 15px 30px rgba(255, 215, 0, 0.15);
}

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

.game-swipe-icon {
    font-size: 3rem;
    margin-bottom: 15px;
}

.game-swipe-name {
    color: #fff;
    font-weight: 700;
    font-size: 1.1rem;
}

/* Common Touch Improvements */
button,
.btn-group button,
.amount-btns button {
    min-height: 44px;
    min-width: 44px;
}

/* Game Log Area */
.game-log {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass);
    border-radius: 12px;
    padding: 10px;
    height: 100%;
    overflow-y: auto;
    scrollbar-width: none;
    display: flex;
    flex-direction: column;
}

.game-log::-webkit-scrollbar {
    display: none;
}

.log-item {
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Mini Dashboard */
.mini-dashboard {
    display: none;
    width: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--glass);
    padding: 10px 20px;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.dash-item {
    display: flex;
    flex-direction: column;
}

.dash-label {
    font-size: 0.6rem;
    color: #888;
    text-transform: uppercase;
}

.dash-value {
    font-size: 0.9rem;
    font-weight: 800;
    font-family: 'Outfit', sans-serif;
}

.dash-toggle {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--glass);
    border-radius: 50%;
    font-size: 1.2rem;
}

@media (max-width: 850px) {
    .mini-dashboard {
        display: flex;
    }

    .stats-panel {
        position: relative !important;
        bottom: 0 !important;
        left: 0;
        width: 100% !important;
        height: auto !important;
        z-index: 100;
        transform: none !important;
        transition: none !important;
        border-left: none;
        border-top: 2px solid var(--gold);
        display: block !important;
        padding: 20px 15px 40px !important;
        background: rgba(0, 0, 0, 0.8) !important;
    }

    .stats-panel.mobile-visible {
        /* Not strictly needed now, but keeping for JS compatibility */
        display: block !important;
    }
}

@media (max-width: 850px) {

    /* Broad scrolling fix for mobile */
    html,
    body {
        height: auto !important;
        min-height: 100vh !important;
        overflow: auto !important;
        overflow-x: hidden !important;
        position: static !important;
        -webkit-overflow-scrolling: touch;
    }

    /* Fixed elements stay visible */
    .bottom-tab-bar,
    .game-header,
    .game-controls {
        pointer-events: auto;
    }

    * {
        touch-action: auto;
    }

    .bottom-tab-bar {
        display: flex;
    }

    /* Adjust main content padding for tab bar */
    .main-container,
    .lobby-container {
        padding-bottom: 120px !important;
        /* Increased for safety */
        height: auto !important;
        min-height: 100vh !important;
        overflow: visible !important;
        display: block !important;
        /* Prevent flex/grid issues on some browsers */
    }

    .game-controls {
        bottom: 65px !important;
    }
}

/* Haptic Animation */
@keyframes touch-push {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(0.92);
    }

    100% {
        transform: scale(1);
    }
}

.haptic-touch {
    animation: touch-push 0.15s ease;
}

@media (orientation: landscape) and (max-height: 600px) {
    .main-container {
        grid-template-columns: 1fr 300px !important;
        display: grid !important;
        flex-direction: row !important;
    }

    .game-area {
        height: 100vh;
        overflow-y: auto;
    }

    .stats-panel {
        display: block !important;
        height: 100vh;
        overflow-y: auto;
    }

    .bottom-tab-bar {
        width: 65px;
        height: 100%;
        left: 0;
        top: 0;
        flex-direction: column;
        border-top: none;
        border-right: 1px solid rgba(255, 215, 0, 0.3);
        padding-bottom: 0;
        padding-top: env(safe-area-inset-top);
    }

    body {
        padding-left: 65px;
    }

    .game-header {
        display: none;
        /* Hide header in landscape to save vertical space */
    }
}