/* --- 1. 공통 레이아웃 및 베팅 카드 --- */
.game_layout_row {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    width: 100%;
}

.game_view_area { flex: 1; min-width: 0; }
.bet_cart_sidebar { width: 380px; flex-shrink: 0; }
/* --- 수정 후 --- */
.sticky_cart { 
    position: -webkit-sticky; /* 사파리 지원 */
    position: sticky; 
    top: 20px; 
    /* 중요: 슬립이 화면 높이보다 길어질 경우 슬립 내부에서 스크롤이 생기도록 설정 */
    max-height: calc(100vh - 40px); 
    overflow-y: auto;
    z-index: 10;
}
.grid_container_box {
    background: #111927;
    overflow: hidden;
}

.bet_card_header {
    background: #1c263b;
    color: #fff;
    font-weight: 700;
    font-size: 15px;
    border-left: 4px solid #1976d2; /* 포인트 라인 */
}

.bet_card_body { padding: 15px; }

/* --- 2. 베팅 버튼 그리드 (좌측 베팅판용) --- */
.bet_row {
    display: flex;
    gap: 6px;
    margin-bottom: 6px;
}

/* 컬럼별 너비 자동 계산 (Gap 고려) */
.bet_row.col_3 .btn_bet_item { width: calc(100% / 3); }
.bet_row.col_4 .btn_bet_item { width: calc(100% / 4); }
.bet_row.col_5 .btn_bet_item { width: calc(100% / 5); }

.btn_bet_item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10px 0;
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #fff;
    background: #2d3748; /* 기본 배경 */
}

.btn_bet_item:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
    border-color: rgba(255,255,255,0.2);
}

/* 베팅 항목 내부 텍스트 */
.bet_name { font-size: 14px; font-weight: 500; margin-bottom: 2px; }
.game_type{ font-size: 13px; font-weight: 700; color: #e1e1e1; }
.bet_odds { font-size: 13px; font-weight: 700; color: #ffeb3b; } /* 배당률 강조 */

/* 숫자 볼 스타일 */
.ball_num {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    background: rgba(0,0,0,0.3);
    border-radius: 50%;
    margin-bottom: 5px;
    font-size: 13px;
    font-weight: 800;
    border: 1px solid rgba(255,255,255,0.2);
}

/* --- 3. 우측 베팅 슬립 (Cart) 상세 디자인 --- */
.cart_gauge_area { padding: 15px; background: #162033; border-bottom: 1px solid #0b1425; }
.gauge_bar { width: 100%; height: 6px; background: #0b1425; border-radius: 3px; overflow: hidden; margin-bottom: 8px; }
.gauge_inner { height: 100%; background: linear-gradient(90deg, #1976d2, #64b5f6); }
.round_time { display: block; text-align: right; font-size: 13px; color: #a0aec0; }

.cart_bet_list { list-style: none; padding: 0; margin: 0; }
.cart_bet_list li {
    display: flex;
    justify-content: space-between;
    padding: 12px 15px;
    background: #1c263b;
    border-bottom: 1px solid #111927;
}

.cart_calc_area { padding: 15px; background: #162033; }
.calc_row { display: flex; justify-content: space-between; margin-bottom: 8px; font-size: 13px; color: #cbd5e0; }
.calc_row .highlight { color: #fff; font-weight: 700; font-size: 15px; }

/* 금액 입력 및 버튼 */
.betting_input_box {
    display: flex;
    align-items: center;
    background: #0b1425;
    border: 1px solid #2d3748;
    border-radius: 4px;
    padding: 0 12px;
    margin: 10px 0;
}
.betting_input_box input {
    flex: 1;
    background: transparent;
    border: none;
    color: #fff;
    height: 40px;
    text-align: right;
    font-size: 16px;
    font-weight: 700;
    outline: none;
}

.amount_btn_grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr); /* 3열로 정돈 */
    gap: 5px;
    padding: 0 15px 15px;
    background: #162033;
}
.amount_btn_grid button {
    height: 34px;
    background: #2d3748;
    border: none;
    color: #fff;
    font-size: 12px;
    border-radius: 3px;
    cursor: pointer;
}

.btn_submit_bet {
    width: 100%;
    height: 54px;
    background: #1976d2;
    color: #fff;
    font-size: 17px;
    font-weight: 800;
    border: none;
    cursor: pointer;
}
/* 카트 헤더 내 닫기 버튼 스타일 */
.btn_cart_close_square {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.05); /* 은은한 배경색 */
    border: 1px solid rgba(255, 255, 255, 0.2); /* 반투명 테두리 */
    border-radius: 6px; /* 라운드 네모의 핵심 */
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    padding: 0;
    line-height: 1;
}

    /* 마우스를 올렸을 때 효과 */
    .btn_cart_close_square:hover {
        background: #e74c3c; /* 포인트 컬러 (레드계열) */
        border-color: #e74c3c;
        color: #fff;
        transform: translateY(-1px); /* 살짝 위로 뜨는 느낌 */
        box-shadow: 0 4px 12px rgba(231, 76, 60, 0.3);
    }

    /* 클릭했을 때 살짝 눌리는 느낌 */
    .btn_cart_close_square:active {
        transform: translateY(0);
    }

/* 헤더 안에서 우측 정렬을 위해 (헤더에 적용) */
.bet_card_header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    /* 기존 스타일 유지... */
}

/* --- 4. 색상 테마 및 유틸리티 --- */
.bg-blue { background-color: #346abd !important; }
.bg-red { background-color: #c13526 !important; }
.bg-orange { background-color: #d98e1c !important; }

.mt-20 { margin-top: 20px; }
.mt-10 { margin-top: 10px; }
.mt-5 { margin-top: 5px; }
.mb-10 { margin-bottom: 10px; }

/* --- 모바일 레이아웃 (1024px 미만) --- */
@media screen and (max-width: 1024px) {

    .game_layout_row {
        flex-direction: column !important; /* 세로 배치 */
    }

    .bet_cart_sidebar {
        position: fixed !important;
        top: 0;
        right: -100%; /* 기본적으로 화면 밖에 숨김 */
        width: 80% !important; /* 90% 크기 */
        height: 100vh !important;
        background: #111927;
        z-index: 9999;
        transition: right 0.3s ease-in-out;
        box-shadow: -5px 0 15px rgba(0,0,0,0.5);
    }

    /* 슬립이 열렸을 때 클래스 */
    .bet_cart_sidebar.active {
        right: 0;
    }

    /* 배경 어둡게 */
    .cart_overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.7);
        display: none;
        z-index: 9998;
    }

    .cart_overlay.active {
        display: block;
    }

    /* 모바일 카트 헤더 (닫기 버튼 포함) */
    .m_cart_header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 15px;
        background: #1c263b;
        color: #fff;
        font-weight: bold;
    }

    .btn_cart_close {
        background: none;
        border: none;
        color: #fff;
        font-size: 30px;
        cursor: pointer;
    }

    /* 플로팅 버튼 (우측 하단) */
    .m_bet_slip_open_btn {
        display: flex;
        position: fixed;
        bottom: 20px;
        right: 20px;
        background: #1976d2;
        color: white;
        border: none;
        padding: 12px 20px;
        border-radius: 30px;
        box-shadow: 0 4px 10px rgba(0,0,0,0.3);
        z-index: 999;
        font-weight: bold;
        align-items: center;
        gap: 8px;
    }

    .m_bet_slip_open_btn .count {
        background: red;
        border-radius: 50%;
        padding: 2px 6px;
        font-size: 11px;
    }

    /* 모바일에서 sticky 해제 */
    .sticky_cart {
        position: relative !important;
        top: 0 !important;
        max-height: calc(100vh - 60px) !important;
    }
}

/* PC에서는 모바일 버튼 숨김 */
@media screen and (min-width: 1025px) {
    .m_bet_slip_open_btn, .m_cart_header, .cart_overlay {
        display: none !important;
    }
}