@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;800&display=swap');

:root {
    --bg-dark: #121212;
    --bg-card: #1e1e1e;
    --gold-primary: #d4af37; /* Emas Mewah */
    --gold-light: #f3e5ab;
    --text-white: #ffffff;
    --text-grey: #a0a0a0;
    --red-danger: #e74c3c;
    --green-success: #2ecc71;
    --border-subtle: 1px solid rgba(255, 255, 255, 0.1);
}

* { box-sizing: border-box; user-select: none; -webkit-tap-highlight-color: transparent; outline: none; }
body { margin: 0; padding: 0; background: #000; font-family: 'Inter', sans-serif; overflow: hidden; color: var(--text-white); }

/* --- BACKGROUND ELEGANT --- */
.app-bg {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; z-index: -1;
    background: linear-gradient(135deg, #0f0f0f 0%, #1a1a1a 100%);
}

/* --- LAYOUT UTAMA (SIDEBAR + CONTENT) --- */
#app-container { display: flex; width: 100vw; height: 100vh; display: none; }

/* 1. SIDEBAR KIRI (NAVIGASI) */
.sidebar {
    width: 80px; height: 100%; background: #121212; border-right: var(--border-subtle);
    display: flex; flex-direction: column; align-items: center; padding-top: 20px; z-index: 50;
}
.brand-icon {
    font-size: 1.5rem; color: var(--gold-primary); margin-bottom: 40px;
    filter: drop-shadow(0 2px 5px rgba(0,0,0,0.5));
}
.nav-btn {
    width: 50px; height: 50px; border-radius: 12px; margin-bottom: 15px;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    color: var(--text-grey); cursor: pointer; transition: 0.2s;
    font-size: 1.2rem;
}
.nav-btn span { font-size: 0.55rem; margin-top: 4px; font-weight: 600; }
.nav-btn.active, .nav-btn:hover {
    background: rgba(212, 175, 55, 0.1); color: var(--gold-primary);
}

/* 2. HEADER ATAS (SALDO & PROFILE) */
.main-area { flex: 1; display: flex; flex-direction: column; position: relative; }

.top-header {
    height: 60px; border-bottom: var(--border-subtle); display: flex;
    justify-content: space-between; align-items: center; padding: 0 25px;
    background: rgba(18, 18, 18, 0.95);
}
.page-title { font-weight: 800; font-size: 1.1rem; letter-spacing: 0.5px; color: var(--text-white); }

.user-badge {
    display: flex; align-items: center; gap: 15px; background: #252525;
    padding: 6px 15px; border-radius: 50px; border: var(--border-subtle);
}
.u-info { text-align: right; line-height: 1.2; }
.u-name { font-size: 0.8rem; font-weight: bold; color: var(--gold-primary); display: block; }
.u-id { font-size: 0.65rem; color: #777; }
.u-balance { color: var(--text-white); font-weight: bold; font-size: 0.9rem; margin-right: 10px; padding-right: 10px; border-right: 1px solid #444; }

/* 3. KONTEN TENGAH (PAGES) */
.content-wrapper { flex: 1; position: relative; overflow: hidden; background: #0b0b0b; }
.page-screen { 
    position: absolute; top: 0; left: 0; width: 100%; height: 100%; 
    padding: 20px; display: none; overflow-y: auto;
}
.page-screen.active { display: block; animation: fadeEffect 0.3s; }

/* --- LOBBY PAGE (FIXED) --- */
.lobby-layout { 
    display: flex; 
    gap: 20px; 
    height: 100%; 
    width: 100%; /* Pastikan lebar 100% */
    overflow: hidden; /* Mencegah layout meluber keluar layar */
}

.lobby-main { 
    flex: 1; 
    display: flex; 
    flex-direction: column; 
    gap: 20px; 
    /* KUNCI PERBAIKAN DI SINI: */
    min-width: 0; /* Ini memaksa kolom kiri TIDAK BOLEH melebar didorong teks */
    overflow: hidden; /* Memastikan running text terpotong rapi */
}

/* Pastikan Chat Col Punya Ukuran Tetap yang Kuat */
.lobby-chat-col {
    width: 320px; 
    min-width: 320px; /* Paksa agar tidak bisa digencet jadi kecil */
    background: #151515; 
    border-radius: 12px; 
    border: var(--border-subtle);
    display: flex; 
    flex-direction: column; 
    overflow: hidden;
    height: 100%; /* Pastikan tinggi full */
}

/* CARD GAME UTAMA */
.game-banner {
    width: 100%; height: 180px; border-radius: 12px; position: relative; overflow: hidden;
    background: linear-gradient(to right, #141e30, #243b55);
    border: 1px solid #333; cursor: pointer; transition: 0.2s;
    display: flex; align-items: center; justify-content: space-between; padding: 0 40px;
}
.game-banner:hover { border-color: var(--gold-primary); transform: translateY(-2px); }
.banner-txt h2 { font-size: 2rem; margin: 0; color: var(--gold-primary); }
.banner-txt p { color: #ccc; margin: 5px 0 15px 0; font-size: 0.9rem; }
.btn-play {
    background: var(--gold-primary); color: #000; padding: 10px 30px;
    border-radius: 6px; font-weight: 800; border: none; cursor: pointer;
}
.live-indicator {
    position: absolute; top: 15px; left: 15px; background: var(--red-danger);
    color: white; padding: 3px 8px; border-radius: 4px; font-size: 0.7rem; font-weight: bold;
    display: flex; align-items: center; gap: 5px;
}
.dot-blink { width: 6px; height: 6px; background: white; border-radius: 50%; animation: blink 1s infinite; }

/* --- MARQUEE WINNER (SINGLE MODE) --- */
.winner-ticker {
    background: #111; 
    padding: 0 15px; 
    height: 40px; 
    border-radius: 8px; 
    border: var(--border-subtle);
    display: flex; 
    align-items: center; 
    justify-content: center; /* Posisi di Tengah Pas */
    overflow: hidden; 
    position: relative;
}

.tick-item { 
    white-space: nowrap; 
    font-size: 0.9rem; /* Font agak dibesarkan dikit biar jelas */
    display: flex; 
    align-items: center; 
    gap: 8px;
    color: #888;
    width: 100%;
    justify-content: center; /* Teks rata tengah */
    animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275); /* Efek Muncul */
}

.tick-item b { color: #eee; font-weight: 700; }

/* Animasi Muncul Membesar */
@keyframes popIn {
    0% { opacity: 0; transform: scale(0.8) translateY(10px); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
}

/* Hapus class .winner-label dan .ticker-track yang lama kalau masih ada, 
   atau biarkan saja tidak terpakai tidak masalah. */

/* --- CHAT GLOBAL (INTEGRATED) --- */
.lobby-chat-col {
    width: 320px; background: #151515; border-radius: 12px; border: var(--border-subtle);
    display: flex; flex-direction: column; overflow: hidden;
}
.chat-head-simple { padding: 10px 15px; background: #1f1f1f; font-weight: bold; font-size: 0.85rem; color: #ddd; border-bottom: 1px solid #222; }
.chat-list-simple { flex: 1; overflow-y: auto; padding: 10px; display: flex; flex-direction: column; gap: 10px; }
.bubble-simple { font-size: 0.8rem; color: #ccc; line-height: 1.4; padding-bottom: 5px; border-bottom: 1px solid #222; }
.bubble-simple b { color: var(--gold-primary); margin-right: 5px; }
.chat-input-simple { padding: 10px; border-top: 1px solid #222; display: flex; gap: 8px; }
.input-clean {
    flex: 1; background: #000; border: 1px solid #333; color: white;
    padding: 8px; border-radius: 4px; font-size: 0.8rem;
}
.btn-send-clean { background: #333; color: white; border: none; padding: 0 12px; border-radius: 4px; cursor: pointer; }

/* --- GAME TABLE (REALISTIC FLAT) --- */
.table-ui { width: 100%; height: 100%; display: flex; gap: 20px; }
.chip-panel {
    width: 80px; display: flex; flex-direction: column; gap: 10px; align-items: center; justify-content: center;
    background: #151515; border-radius: 12px; padding: 10px 0; border: var(--border-subtle);
}
.flat-chip {
    width: 55px; height: 55px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 0.75rem; color: #fff; cursor: pointer;
    border: 3px solid rgba(255,255,255,0.2); transition: 0.1s; position: relative;
    box-shadow: 0 2px 5px rgba(0,0,0,0.5);
}
.flat-chip.active { transform: scale(1.15); border-color: #fff; z-index: 2; }
/* Warna Chip Flat Professional */
.fc-100 { background: #546e7a; } /* Grey */
.fc-1k { background: #1e88e5; }  /* Blue */
.fc-5k { background: #8e24aa; }  /* Purple */
.fc-10k { background: #e53935; } /* Red */
.fc-50k { background: #fdd835; color: black; } /* Gold */

.board-area { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; position: relative; }

/* TIMER */
.timer-pill {
    background: #111; padding: 8px 30px; border-radius: 30px; border: 1px solid #333;
    display: flex; flex-direction: column; align-items: center; margin-bottom: 15px;
}
.timer-val { font-size: 2rem; font-weight: 800; color: var(--text-white); font-variant-numeric: tabular-nums; }
.timer-label { font-size: 0.7rem; color: #666; letter-spacing: 1px; }

/* GRID ANGKA (BERSIH) */
.grid-clean {
    display: grid; grid-template-columns: repeat(10, 1fr); gap: 4px;
    background: #1a1a1a; padding: 10px; border-radius: 8px; border: 1px solid #333;
}
.num-clean {
    width: 40px; height: 40px; background: #252525; color: #888;
    display: flex; align-items: center; justify-content: center; font-weight: 600;
    cursor: pointer; border-radius: 4px; font-size: 0.9rem;
}
.num-clean.red-num { color: #e74c3c; } 
.num-clean.selected { background: var(--gold-primary); color: black !important; font-weight: 800; }
.num-badge { position: absolute; top: -3px; right: -3px; font-size: 8px; background: white; color: black; padding: 1px 3px; border-radius: 2px; }

/* MODAL LOGIN (SIMPLE DARK) */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.8); z-index: 1000; display: flex; align-items: center; justify-content: center;
}
.login-card {
    background: #1a1a1a; padding: 30px; border-radius: 12px; width: 350px; text-align: center; border: 1px solid #333;
}
.login-card h2 { color: var(--gold-primary); margin-top: 0; }
.inp-std { width: 100%; padding: 12px; margin: 15px 0; background: #000; border: 1px solid #444; color: white; border-radius: 6px; }
.btn-std { width: 100%; padding: 12px; background: var(--gold-primary); border: none; font-weight: bold; border-radius: 6px; cursor: pointer; }

/* ANIMASI & UTILS */
@keyframes fadeEffect { from {opacity: 0;} to {opacity: 1;} }
@keyframes blink { 50% {opacity: 0;} }
@keyframes tick { 0% {transform: translateX(0);} 100% {transform: translateX(-100%);} }
#orientation-lock { display: none; }
@media screen and (orientation: portrait) {
    #orientation-lock { display: flex; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: #111; z-index: 9999; color: white; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
}