/* ==========================================================================
   CHITRA GAME - HYBRID RESPONSIVE (PRO CASINO GLASS UI FOR PC & MOBILE)
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@500;600;700&display=swap');

/* --------------------------------------------------------------------------
   0. HARDWARE RESET
   -------------------------------------------------------------------------- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Poppins', sans-serif;
    -webkit-user-select: none;
    user-select: none;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    background: radial-gradient(circle at 50% 10%, #0c1d3f 0%, #020919 60%, #000208 100%) !important;
    color: #ffffff;
    padding: 0;
    margin: 0;
    overflow: hidden !important;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    font-size: 100%;
}

/* Ambient Background Spheres (Glowing Glass Backdrop) */
body::before {
    content: "";
    position: fixed;
    top: -150px;
    left: -150px;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(0, 180, 255, 0.4), transparent 70%);
    filter: blur(120px);
    border-radius: 50%;
    pointer-events: none;
    z-index: 0;
}

body::after {
    content: "";
    position: fixed;
    bottom: -150px;
    right: -150px;
    width: 650px;
    height: 650px;
    background: radial-gradient(circle, rgba(255, 120, 0, 0.35), transparent 70%);
    filter: blur(130px);
    border-radius: 50%;
    pointer-events: none;
    z-index: 0;
}

/* Scrollbar */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: rgba(2, 8, 20, 0.9); }
::-webkit-scrollbar-thumb { background: linear-gradient(180deg, #00f2fe, #0055ff); border-radius: 4px; }

/* --------------------------------------------------------------------------
   1. MAIN GAME CONTAINER
   -------------------------------------------------------------------------- */
.game-container {
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    background: rgba(3, 10, 26, 0.75);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border: 1px solid rgba(0, 180, 255, 0.25);
    padding: clamp(6px, 1.2vh, 12px);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-shadow: 0 0 60px rgba(0, 0, 0, 0.9);
    position: relative;
    z-index: 1;
    overflow: hidden !important;
}

/* --------------------------------------------------------------------------
   2. TOP BAR & BRANDING
   -------------------------------------------------------------------------- */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(8, 26, 56, 0.65);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(0, 180, 255, 0.3);
    border-radius: 12px;
    padding: clamp(4px, 0.8vh, 8px) clamp(10px, 1.2vw, 16px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
    flex-shrink: 0;
}

.brand { display: flex; align-items: center; gap: 8px; }
.brand-logo { font-size: clamp(20px, 3.2vh, 28px); filter: drop-shadow(0 0 10px rgba(0, 210, 255, 0.8)); }

.brand-text h1 {
    font-size: clamp(14px, 2.4vh, 20px);
    font-weight: 700;
    background: linear-gradient(90deg, #00f2fe 0%, #ffffff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    line-height: 1;
}

.brand-text span { font-size: clamp(7px, 1.2vh, 9px); color: #00d2ff; font-weight: 600; }

.header-stats { display: flex; align-items: center; gap: clamp(6px, 1vw, 12px); }

.stat-box {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(12, 32, 68, 0.5);
    border: 1px solid rgba(0, 150, 255, 0.25);
    padding: clamp(3px, 0.6vh, 6px) clamp(8px, 1vw, 12px);
    border-radius: 8px;
    backdrop-filter: blur(10px);
}

.stat-box .icon { font-size: clamp(13px, 2vh, 16px); }
.stat-box .label { display: block; font-size: clamp(7.5px, 1.1vh, 9px); color: #72b2ff; font-weight: 600; }
.stat-box strong { font-size: clamp(11px, 1.8vh, 14px); font-weight: 700; color: #ffffff; }

.date-box { flex-direction: column; align-items: flex-end; background: transparent; border: none; padding: 0; }
.date-box span { font-size: clamp(9px, 1.4vh, 11px); color: #e2f0ff; font-weight: 600; }
.date-box strong { font-size: clamp(9px, 1.4vh, 11px); color: #ffb700; font-weight: 700; }
.green-text { color: #00ff88 !important; }

.logout-btn {
    background: linear-gradient(180deg, #ef4444 0%, #991b1b 100%);
    border: 1px solid #f87171;
    color: #ffffff;
    font-size: clamp(9px, 1.4vh, 11px);
    font-weight: 700;
    padding: clamp(5px, 0.8vh, 8px) clamp(10px, 1.2vw, 16px);
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.4);
}

/* --------------------------------------------------------------------------
   3. MAIN CONTENT
   -------------------------------------------------------------------------- */
.main-content {
    display: grid;
    grid-template-columns: minmax(160px, 230px) 1fr;
    gap: clamp(8px, 1vw, 14px);
    margin-top: clamp(4px, 0.8vh, 8px);
    align-items: stretch;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.result-panel {
    background: rgba(8, 26, 56, 0.55);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border: 1px solid rgba(0, 212, 255, 0.4);
    border-radius: 14px;
    padding: clamp(8px, 1.2vh, 12px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), inset 0 0 20px rgba(0, 180, 255, 0.15);
}

.panel-title { font-size: clamp(10px, 1.6vh, 13px); color: #ffb700; font-weight: 700; text-transform: uppercase; }

.result-display { width: 100%; flex: 1; display: flex; justify-content: center; align-items: center; }
.result-display img { max-width: 100%; max-height: clamp(70px, 16vh, 130px); object-fit: contain; filter: drop-shadow(0 10px 20px rgba(0, 212, 255, 0.9)); }
.winner-name { font-size: clamp(14px, 2.2vh, 18px); font-weight: 700; color: #ffffff; text-align: center; }

.chitra-panel {
    background: rgba(8, 26, 56, 0.45);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(0, 150, 255, 0.25);
    border-radius: 14px;
    padding: clamp(8px, 1.2vh, 12px);
    display: flex;
    flex-direction: column;
    height: 100%;
}

.chitra-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: clamp(6px, 0.8vw, 10px);
    flex: 1;
    height: 100%;
}

/* --------------------------------------------------------------------------
   4. HIGH-GLOSS CASINO CHITRA CARDS (GLASS EFFECT RECOVERED)
   -------------------------------------------------------------------------- */
.chitra-card {
    background: rgba(255, 255, 255, 0.06) !important;
    backdrop-filter: blur(25px) !important;
    -webkit-backdrop-filter: blur(25px) !important;
    border: 1.5px solid rgba(255, 255, 255, 0.2) !important;
    border-radius: 12px;
    padding: 4px;
    cursor: pointer;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: all 0.25s cubic-bezier(0.25, 0.8, 0.25, 1);
    outline: none;
    overflow: hidden;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
}

/* Glass Shine Effect on Cards */
.chitra-card::before {
    content: "";
    position: absolute;
    top: -80%;
    left: -80%;
    width: 260%;
    height: 260%;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transform: rotate(35deg);
    transition: 0.6s ease;
    pointer-events: none;
}

.chitra-card:hover::before { left: 100%; }

.chitra-card:hover {
    background: rgba(255, 255, 255, 0.15) !important;
    border-color: rgba(0, 212, 255, 0.85) !important;
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 10px 25px rgba(0, 180, 255, 0.4);
}

.chitra-card.selected {
    background: rgba(0, 255, 136, 0.18) !important;
    border: 2px solid #00ff88 !important;
    box-shadow: 0 0 25px rgba(0, 255, 136, 0.75) !important;
}

.card-badge {
    position: absolute;
    top: 4px;
    left: 4px;
    background: linear-gradient(135deg, #0055ff, #001166);
    border: 1px solid rgba(255, 255, 255, 0.6);
    color: #ffffff;
    width: clamp(18px, 2.6vh, 24px);
    height: clamp(18px, 2.6vh, 24px);
    border-radius: 50%;
    font-size: clamp(10px, 1.5vh, 12px);
    font-weight: 700;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
}

.chitra-card img {
    width: clamp(42px, 9vh, 75px) !important;
    height: clamp(42px, 9vh, 75px) !important;
    object-fit: contain;
    margin: 2px 0;
    filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.6));
}

.card-name {
    font-size: clamp(11px, 1.8vh, 14px) !important;
    font-weight: 600 !important;
    color: #ffffff;
    text-align: center;
    text-shadow: 0 2px 5px rgba(0, 0, 0, 0.9);
}

/* --------------------------------------------------------------------------
   5. CONTROL BAR & COINS
   -------------------------------------------------------------------------- */
.control-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(8, 26, 56, 0.65);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(0, 150, 255, 0.25);
    border-radius: 12px;
    padding: clamp(5px, 0.9vh, 9px) clamp(10px, 1.4vw, 18px);
    margin-top: clamp(4px, 0.8vh, 8px);
    gap: clamp(8px, 1vw, 14px);
    flex-shrink: 0;
}

.coins-selector { display: flex; align-items: center; gap: 8px; flex: 1; overflow-x: auto; padding: 2px 0; }
.coins-selector .label { font-size: clamp(10px, 1.6vh, 13px); color: #ffb700; font-weight: 700; white-space: nowrap; }
.coins-list { display: flex; gap: 5px; align-items: center; }

.coin-btn {
    background: rgba(12, 38, 80, 0.6);
    border: 1px solid rgba(0, 150, 255, 0.3);
    color: #ffffff;
    font-weight: 600;
    font-size: clamp(10px, 1.6vh, 13px);
    padding: clamp(4px, 0.8vh, 7px) clamp(8px, 1.2vw, 14px);
    border-radius: 7px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.coin-btn:hover { background: rgba(0, 150, 255, 0.35); border-color: #00d2ff; }
.coin-btn.selected { background: linear-gradient(180deg, #ff9900 0%, #e65100 100%) !important; border-color: #ffe066 !important; box-shadow: 0 0 12px rgba(255, 153, 0, 0.6) !important; }

.place-bet-btn {
    background: linear-gradient(180deg, #10b981 0%, #047857 100%);
    border: 1px solid #34d399;
    color: #ffffff;
    font-weight: 700;
    font-size: clamp(12px, 2.1vh, 16px);
    padding: clamp(6px, 1.1vh, 10px) clamp(16px, 2vw, 28px);
    border-radius: 9px;
    cursor: pointer;
    white-space: nowrap;
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.4);
}

.bet-info-group { display: flex; gap: 8px; justify-content: flex-end; }
.info-box { background: rgba(2, 8, 22, 0.85); border: 1px solid rgba(0, 150, 255, 0.25); border-radius: 7px; padding: clamp(3px, 0.6vh, 6px) clamp(8px, 1vw, 12px); text-align: center; min-width: clamp(75px, 8vw, 105px); }
.info-box .label { display: block; font-size: clamp(7px, 1vh, 8.5px); color: #ffb700; font-weight: 600; }
.info-box strong { font-size: clamp(10px, 1.6vh, 13px); color: #ffffff; font-weight: 700; }

/* --------------------------------------------------------------------------
   6. BET HISTORY SECTION
   -------------------------------------------------------------------------- */
.history-section {
    background: rgba(8, 26, 56, 0.45);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(0, 150, 255, 0.25);
    border-radius: 12px;
    padding: clamp(4px, 0.7vh, 7px) clamp(8px, 1vw, 12px);
    margin-top: clamp(4px, 0.8vh, 8px);
    flex: 0.75;
    display: flex;
    flex-direction: column;
    min-height: clamp(60px, 12vh, 90px);
    overflow: hidden;
}

.history-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 3px; }
.history-header h2 { font-size: clamp(10px, 1.6vh, 13px); color: #00d2ff; font-weight: 700; }
.refresh-btn { background: rgba(12, 38, 80, 0.6); border: 1px solid rgba(0, 150, 255, 0.3); color: #72b2ff; padding: 3px 8px; border-radius: 5px; font-size: clamp(9px, 1.3vh, 11px); cursor: pointer; }

.table-responsive { flex: 1; overflow-y: auto; }
table { width: 100%; border-collapse: collapse; table-layout: fixed; }
th { background: rgba(4, 18, 48, 0.95); color: #72b2ff; font-size: clamp(8px, 1.3vh, 10px); font-weight: 700; padding: clamp(3px, 0.5vh, 5px); text-align: center; position: sticky; top: 0; }
td { padding: clamp(3px, 0.5vh, 5px); font-size: clamp(9px, 1.4vh, 11px); font-weight: 600; text-align: center; border-bottom: 1px solid rgba(0, 150, 255, 0.1); }

.history-chitra-cell { display: inline-flex !important; align-items: center !important; gap: 5px !important; white-space: nowrap !important; width: 95px; }
.history-chitra-img { width: clamp(16px, 2.2vh, 22px) !important; height: clamp(16px, 2.2vh, 22px) !important; object-fit: contain !important; border-radius: 4px; background: rgba(255, 255, 255, 0.95); padding: 1px; }

/* --------------------------------------------------------------------------
   7. LAPTOP & LARGE SCREEN SPECIFIC STYLES (MIN-WIDTH: 900PX)
   -------------------------------------------------------------------------- */
@media screen and (min-width: 900px) {
    .game-container { padding: 12px 18px; }
    .top-bar { padding: 8px 20px; }
    .main-content { grid-template-columns: 260px 1fr; gap: 16px; }
    .chitra-grid { gap: 12px; }
    .chitra-card img { width: 65px !important; height: 65px !important; }
    .card-name { font-size: 14px !important; }
    .result-display img { max-height: 120px; }
    .control-bar { padding: 10px 20px; }
    .history-section { padding: 8px 16px; }
}

/* --------------------------------------------------------------------------
   8. PERFECT MOBILE / EMULATOR LANDSCAPE FIX (MAX-HEIGHT: 520PX)
   -------------------------------------------------------------------------- */
@media screen and (max-height: 520px) and (orientation: landscape) {
    .game-container { padding: 3px 6px; }
    .top-bar { padding: 2px 8px; border-radius: 8px; }
    .main-content { grid-template-columns: 130px 1fr; gap: 6px; margin-top: 3px; }
    .chitra-grid { gap: 4px; }
    
    .chitra-card { padding: 1px; border-radius: 8px; }
    .chitra-card img { width: 32px !important; height: 32px !important; }
    .card-name { font-size: 9px !important; }
    .card-badge { width: 14px; height: 14px; font-size: 8px; top: 2px; left: 2px; }

    .result-panel { padding: 4px; border-radius: 8px; }
    .result-display img { max-height: 50px; }
    .winner-name { font-size: 11px; }

    .control-bar { padding: 3px 8px; margin-top: 3px; gap: 6px; border-radius: 8px; }
    .coins-selector .label { font-size: 9px; }
    .coin-btn { font-size: 9px; padding: 2px 6px; border-radius: 4px; }
    .place-bet-btn { font-size: 11px; padding: 4px 12px; border-radius: 6px; }
    .info-box { min-width: 65px; padding: 2px 6px; }
    .info-box .label { font-size: 6.5px; }
    .info-box strong { font-size: 9px; }

    .history-section { min-height: 45px; padding: 2px 6px; margin-top: 3px; border-radius: 8px; flex: 0.6; }
    .history-header h2 { font-size: 9px; }
    .refresh-btn { font-size: 8px; padding: 1px 4px; }
    th { font-size: 7.5px; padding: 2px; }
    td { font-size: 8px; padding: 2px; }
    .history-chitra-cell { width: 70px; gap: 3px !important; }
    .history-chitra-img { width: 14px !important; height: 14px !important; }
}