/* ═══════════════════════════════════════════════════════
   MAIN — Game Bài Online
   Biến toàn cục, reset, base, auth, buttons, lobby, modal, badges
   ═══════════════════════════════════════════════════════ */

:root {
    --bg:           #0a0a10;
    --surface:      #14141f;
    --surface-2:    #1c1c2c;
    --border:       rgba(255,215,0,0.12);
    --primary:      #c62828;
    --primary-glow: rgba(198,40,40,0.35);
    --gold:         #ffd700;
    --gold-dim:     rgba(255,215,0,0.12);
    --text-main:    #f0f0f0;
    --text-sub:     #7a7a9a;
    --felt-dark:    #063b12;
    --felt-mid:     #0a5018;
    --felt-light:   #0e6422;
    --sidebar-w:    72px;
    --radius-card:  14px;
    --radius-sm:    8px;
    --accent:       #e53935;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg);
    color: var(--text-main);
    text-align: center;
    overflow-x: hidden;
}

/* ─── SCREENS ────────────────────────────────────────── */

.screen { display: none; padding: 20px; min-height: 100vh; }
.active { display: block; animation: fadeIn 0.3s ease; }

/* ─── AUTH ───────────────────────────────────────────── */

#auth-screen {
    background:
        radial-gradient(ellipse at 50% 0%, rgba(198,40,40,0.15) 0%, transparent 60%),
        var(--bg);
}

.auth-glow {
    position: fixed;
    top: -20vh;
    left: 50%;
    transform: translateX(-50%);
    width: 60vw;
    height: 60vh;
    background: radial-gradient(ellipse, rgba(198,40,40,0.12) 0%, transparent 70%);
    pointer-events: none;
}

h1 {
    margin-top: 28vh;
    font-size: 2.4rem;
    color: var(--primary);
    letter-spacing: 2px;
    text-shadow: 0 0 30px rgba(198,40,40,0.4);
}

.subtitle { color: var(--text-sub); margin-bottom: 40px; font-size: 0.9rem; margin-top: 6px; }
#sys-msg  { color: #ff5252; margin-top: 15px; font-size: 0.9rem; }

/* ─── BUTTONS ────────────────────────────────────────── */

.btn {
    background: linear-gradient(135deg, #e53935, #b71c1c);
    color: white;
    border: none;
    padding: 15px 30px;
    font-size: 1.05rem;
    border-radius: 25px;
    font-weight: bold;
    width: 80%;
    max-width: 300px;
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.1s, opacity 0.15s;
    margin-top: 20px;
    box-shadow: 0 4px 18px rgba(198,40,40,0.4);
}
.btn:active  { transform: scale(0.96); box-shadow: 0 2px 8px rgba(0,0,0,0.4); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
    box-shadow: none;
}
.btn-outline:active { opacity: 0.7; transform: scale(0.96); }

.btn-small { width: auto; padding: 8px 16px; font-size: 0.88rem; margin: 0; }
.btn i { margin-right: 5px; }

/* ─── LOBBY ──────────────────────────────────────────── */

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 20px;
    background: linear-gradient(180deg, #13131e 0%, #1a1a28 100%);
    border-bottom: 1px solid var(--border);
}

.user-info  { text-align: left; }
.user-name  { font-weight: bold; font-size: 1.05rem; display: flex; align-items: center; gap: 6px; }
.user-balance {
    color: var(--gold);
    font-weight: bold;
    font-size: 0.88rem;
    margin-top: 3px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}
.edit-icon { font-size: 0.8rem; cursor: pointer; opacity: 0.5; transition: opacity 0.15s; }
.edit-icon:hover { opacity: 1; }

.content-pad  { padding: 20px; text-align: left; }
.section-title { margin-bottom: 14px; font-size: 0.95rem; color: var(--text-sub); }
.mt-20     { margin-top: 20px; }
.highlight { color: var(--primary); }

.room-list { display: flex; flex-direction: column; gap: 10px; }

.room-card {
    background: var(--surface-2);
    padding: 14px 16px;
    border-radius: var(--radius-card);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: border-color 0.2s, transform 0.1s, box-shadow 0.2s;
}
.room-card:hover  { border-color: rgba(255,215,0,0.35); box-shadow: 0 2px 12px rgba(255,215,0,0.08); }
.room-card:active { transform: scale(0.98); }
.room-info h4 { margin: 0 0 4px 0; color: var(--primary); font-size: 0.95rem; }
.room-info p  { margin: 0; font-size: 0.82rem; color: var(--text-sub); }

/* ─── MODAL ──────────────────────────────────────────── */

.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.88);
    align-items: center;
    justify-content: center;
    z-index: 100000;
    backdrop-filter: blur(4px);
}

.modal-box {
    background: var(--surface-2);
    padding: 26px;
    border-radius: 18px;
    width: 85%;
    max-width: 340px;
    text-align: center;
    border: 1px solid rgba(255,215,0,0.18);
    box-shadow: 0 8px 40px rgba(0,0,0,0.8), 0 0 0 1px rgba(255,255,255,0.03);
}

.modal-box input,
.modal-select {
    width: 100%;
    padding: 12px;
    border-radius: var(--radius-sm);
    border: 1px solid #2a2a40;
    background: #0e0e18;
    color: white;
    margin-bottom: 14px;
    outline: none;
    font-size: 0.92rem;
    transition: border-color 0.2s;
}
.modal-box input:focus,
.modal-select:focus { border-color: rgba(255,215,0,0.4); }

/* ─── BADGES ─────────────────────────────────────────── */

.bet-badge {
    background: rgba(198,40,40,0.12);
    color: var(--primary);
    padding: 3px 7px;
    border-radius: 10px;
    font-size: 0.72rem;
    font-weight: bold;
    border: 1px solid rgba(198,40,40,0.35);
    display: inline-flex;
    align-items: center;
    gap: 3px;
    white-space: nowrap;
    max-width: 90px;
    overflow: hidden;
    text-overflow: ellipsis;
}
