/* Game Header Styles (Reusable) */

.gh-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: calc(100% - 30px);
    height: 72px;
    flex-shrink: 0;
    background: #2857ADBF;
    /* Dark Blue BG matching screenshot roughly */
    padding: 0 24px;
    margin: 12px auto 0;
    box-sizing: border-box;
    color: #fff;
    font-family: 'Poppins', sans-serif;
    position: relative;
    z-index: 100;
    border-radius: 15px;
}

/* Left Section: Name & Balance */
.gh-left {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    gap: 2px;
}

.gh-game-name {
    font-family: 'Konkhmer Sleokchher', sans-serif;
    /* Using the font from previous tasks/index.html */
    font-size: 24px;
    text-transform: uppercase;
    line-height: 1;
    color: #fff;
    letter-spacing: 0.5px;
}

.gh-balance {
    font-size: 13px;
    color: #e0e0e0;
    font-weight: 400;
    display: flex;
    align-items: center;
    gap: 4px;
}

.gh-balance-val {
    font-weight: 600;
    font-family: 'Roboto Mono', monospace;
}

/* Center Section: Status Pill */
.gh-center {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    justify-content: center;
    align-items: center;
}

.gh-status-pill {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: #228b22;
    /* Default green */
    color: #fff;
    padding: 4px 30px;
    border-radius: 20px;
    min-width: 180px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    transition: background-color 0.3s ease;
}

/* Variants for status colors */
.gh-status-pill.phase-betting {
    /* background-color: #2e7d32; */
    background: #2B9D06BF;
    border: 1px solid #00BF16
}

/* Green */
.gh-status-pill.phase-reveal {
    background: linear-gradient(135deg, #D4AC0D 0%, #B7950B 50%, #9A7D0A 100%);
    box-shadow:
        0 4px 20px rgba(241, 196, 15, 0.4),
        0 2px 8px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

/* Orange */
.gh-status-pill.phase-payout {
    background: var(--payout, #E8CB26);
    border: 1px solid var(--payout-stroke, #FFFFFF);
}

/* Amber */
.gh-status-pill.phase-locked {
    background: var(--running, #1B52D9);
    border: 1px solid var(--stroke-running, #2A76FF);
    /* background: linear-gradient(135deg, #C0392B 0%, #A93226 50%, #922B21 100%);
    box-shadow:
        0 4px 20px rgba(231, 76, 60, 0.4),
        0 2px 8px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.15); */
}

/* Red */
.gh-status-pill.phase-idle {
    background-color: #455a64;
}

/* Grey */

.gh-status-text {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    line-height: 1.2;
}

.gh-status-timer {
    font-size: 16px;
    font-weight: 800;
    line-height: 1.2;
}


/* Right Section: Top Row (Live + Ham), Bottom Row (Icons) */
.gh-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}

.gh-right-top {
    display: flex;
    align-items: center;
    gap: 12px;
    height: 28px;
    /* Fixed height for alignment */
}

/* LIVE Badge */
.gh-live-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    background-color: #d32f2f;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 12px;
    text-transform: uppercase;
    line-height: 1;
}

.gh-dot {
    width: 8px;
    height: 8px;
    background-color: #fff;
    border-radius: 50%;
    animation: gh-pulse 1.5s infinite;
}

@keyframes gh-pulse {
    0% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.5;
        transform: scale(0.9);
    }

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

/* Hamburger */
.gh-hamburger {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 24px;
    height: 20px;
}

.gh-hamburger span {
    display: block;
    width: 100%;
    height: 3px;
    background-color: #5c8ae6;
    /* Blueish distinct color from screenshot */
    border-radius: 2px;
}

/* Right Bottom: Icons */
.gh-right-bottom {
    display: flex;
    align-items: center;
    gap: 8px;
}

.gh-icon-btn {
    background: #00033D;
    border: none;
    border-radius: 6px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    cursor: pointer;
    transition: background 0.2s;
    font-size: 14px;
}

.gh-icon-btn:hover {
    background: rgba(255, 255, 255, 0.25);
}


.gh-viewers-btn {
    flex-direction: column;
    gap: 0;
    justify-content: center;
    padding: 2px 0;
}

.gh-btn-label {
    font-size: 9px;
    line-height: 1;
    font-weight: 600;
}

.gh-icon-btn svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

/* Menu Popup */
.menu-popup {
    position: absolute;
    top: 50px;
    right: 16px;
    background: #0f1936;
    border: 1px solid #4869a8;
    border-radius: 8px;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    z-index: 200;
    min-width: 160px;
}

.menu-popup[hidden] {
    display: none !important;
}

.menu-item-btn {
    background: transparent;
    border: none;
    color: #fff;
    text-align: left;
    padding: 8px 12px;
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
    border-radius: 4px;
    transition: background 0.2s;
}

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

/* Mobile Responsiveness */
@media (max-width: 600px) {
    .gh-header {
        height: 72px;
        flex-wrap: nowrap;
        padding: 0 16px;
        gap: 0;
        justify-content: space-between;
        background: #2857ADBF;
        border-radius: 12px;
    }

    /* Left: Name + Balance */
    .gh-left {
        z-index: 2;
        gap: 0;
    }

    .gh-game-name {
        font-size: 16px;
    }

    .gh-balance {
        font-size: 11px;
    }

    .gh-balance-val {
        font-size: 12px;
    }

    /* Center: Absolute center */
    .gh-center {
        position: absolute;
        left: 50%;
        top: 50%;
        transform: translate(-50%, -50%);
        width: auto;
        margin: 0;
        z-index: 1;
    }

    .gh-status-pill {
        min-width: 110px;
        /* Much smaller min-width */
        padding: 2px 12px;
        height: 38px;
        /* Compact height */
        border-radius: 20px;
        background-color: #2e7d32;
        /* Ensure green default */
        box-shadow: 0 0 8px rgba(46, 125, 50, 0.6);
        /* Glow */
        border: 1px solid rgba(255, 255, 255, 0.1);
    }

    .gh-status-text {
        font-size: 10px;
        white-space: nowrap;
    }

    .gh-status-timer {
        font-size: 13px;
    }

    /* Right: Top (Live+Ham) + Bottom (Icons) */
    .gh-right {
        z-index: 2;
        align-items: flex-end;
        gap: 2px;
    }

    .gh-right-top {
        height: 22px;
        gap: 6px;
    }

    .gh-live-badge {
        padding: 2px 6px;
        font-size: 10px;
        height: 18px;
    }

    .gh-dot {
        width: 6px;
        height: 6px;
    }

    .gh-hamburger {
        width: 20px;
        padding: 2px;
        height: 16px;
    }

    .gh-hamburger span {
        height: 2px;
    }

    /* Show icons on mobile now */
    .gh-right-bottom {
        display: flex;
        gap: 4px;
        margin-top: 2px;
    }

    .gh-icon-btn {
        width: 24px;
        height: 24px;
        border-radius: 4px;
        background: rgba(66, 100, 180, 0.6);
        /* Blueish background like screenshot */
    }

    .gh-icon-btn svg {
        width: 14px;
        height: 14px;
    }
}

/* Tiny mobile adjustment */
@media (max-width: 360px) {
    /* .gh-game-name {
        display: none;
    } */

    /* Hide name if extremely small? Or text-scale. Screenshot keeps it. */
    .gh-status-pill {
        padding: 2px 8px;
        min-width: 90px;
    }

    .gh-icon-btn {
        width: 20px;
        height: 20px;
    }
}

/* Specific Mobile Adjustment (430px) */
@media (max-width: 430px) {

    .gh-header {
        padding: 0 10px;
    }

    .gh-left {
        gap: 3px;
    }

    .gh-balance {
        font-size: 9px;
    }

    .gh-balance-val {
        font-size: 10px;
    }


}

/* Mobile Menu Overlay (New UI for <= 1199px) */
.mobile-menu-overlay {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    left: auto;
    transform: none;
    width: 75%;
    height: calc(80vh - 90px);
    background: rgba(34, 35, 101, 1);
    /* Dark indigo background */
    border: 1px solid rgba(68, 103, 204, 1);
    border-radius: 16px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    padding: 0;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.8);
    color: #fff;
    font-family: 'Inter', sans-serif;
    overflow: hidden;
}

.mobile-menu-overlay[hidden] {
    display: none !important;
}

/* Header: User Info + Close */
.mm-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(23, 6, 64, 1);
    padding: 12px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

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

.mm-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #fff;
}

.mm-username {
    font-weight: 700;
    font-size: 14px;
    letter-spacing: 0.5px;
}

.mm-close-btn {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

/* Body: Buttons */
.mm-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 24px;
    padding: 24px 24px 0 24px;
}

.mm-item-btn {
    background: rgba(12, 48, 158, 1);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 14px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 6px 6px 4px 0px rgba(0, 0, 0, 0.25) inset;
    text-align: center;
    font-family: 'Inter', sans-serif;
    transition: transform 0.1s;
}

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

/* Footer: Home Button */
.mm-footer {
    width: 100%;
    padding: 0 24px 24px 24px;
    box-sizing: border-box;
}

.mm-home-btn {
    width: 100%;
    background: rgba(12, 48, 158, 1);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 14px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 6px 6px 4px 0px rgba(0, 0, 0, 0.25) inset;
    font-family: 'Inter', sans-serif;
}

/* Visibility Control */
@media (min-width: 1200px) {
    .mobile-menu-overlay {
        display: none !important;
    }
}

@media (max-width: 1199px) {
    .menu-popup {
        display: none !important;
    }

    /* Ensure the mobile menu shows up if not hidden attribute */
    .mobile-menu-overlay:not([hidden]) {
        display: flex !important;
    }
}