@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;700;900&display=swap');
@import url('https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css');

:root {
    --bg-deep: #050505;
    --gold: #FFD700;
    --neon-blue: #00f3ff;
    --neon-red: #ff0055;
    --glass: rgba(255, 255, 255, 0.05);
}

body {
    margin: 0; background: radial-gradient(circle at center, #1a1a2e 0%, #000 100%);
    color: #fff; font-family: 'Cairo', sans-serif;
    overflow: hidden; direction: rtl; height: 100vh; width: 100vw;
}

/* --- PREMIUM HEADER --- */
.top-bar {
    width: 100%; height: 15vh;
    display: flex; justify-content: space-between; align-items: center;
    padding: 0 40px; box-sizing: border-box;
    background: linear-gradient(to bottom, rgba(0,0,0,0.9), rgba(0,0,0,0));
    position: relative; z-index: 10;
}

.team-card {
    background: var(--glass);
    border: 1px solid rgba(255,255,255,0.1);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 10px 30px;
    min-width: 280px;
    display: flex; align-items: center; justify-content: space-between;
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    opacity: 0.6; transform: scale(0.9);
}

.team-info { text-align: right; }
.team-name { font-size: 1.2rem; color: #aaa; margin: 0; font-weight: bold; }
.team-score { font-size: 3.5rem; font-weight: 900; line-height: 1; margin: 0; text-shadow: 0 0 20px currentColor; }

.team-icon {
    font-size: 2.5rem; width: 60px; height: 60px;
    display: flex; align-items: center; justify-content: center;
    background: rgba(0,0,0,0.3); border-radius: 50%;
    margin-right: 15px; border: 2px solid transparent;
}

/* ACTIVE STATE */
.team-card.active {
    opacity: 1; transform: scale(1.1);
    background: rgba(0,0,0,0.6);
    border-color: currentColor;
    box-shadow: 0 0 50px rgba(0,0,0,0.5);
}

.team-card.t1 { color: var(--neon-red); }
.team-card.t1.active { box-shadow: 0 0 40px rgba(255, 0, 85, 0.3); }
.team-card.t1 .team-icon { color: var(--neon-red); }

.team-card.t2 { color: var(--neon-blue); }
.team-card.t2.active { box-shadow: 0 0 40px rgba(0, 243, 255, 0.3); }
.team-card.t2 .team-icon { color: var(--neon-blue); }

/* TURN BADGE */
.turn-badge {
    position: absolute; top: -15px; left: 50%; transform: translateX(-50%);
    background: var(--gold); color: #000;
    padding: 5px 15px; border-radius: 20px;
    font-weight: bold; font-size: 0.9rem;
    opacity: 0; transition: 0.3s;
}
.team-card.active .turn-badge { opacity: 1; top: -20px; }

/* VS LOGO */
.vs-logo {
    font-size: 3rem; font-weight: 900; color: #333;
    text-shadow: 0 0 5px rgba(255,255,255,0.1);
}

/* --- GRID & OTHERS (Existing styles preserved) --- */
.screen { display: none; height: 100%; flex-direction: column; align-items: center; justify-content: center; }
.screen.active { display: flex; animation: fadeIn 0.5s; }
@keyframes fadeIn { from{opacity:0} to{opacity:1} }

.grid-container { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; width: 96%; height: 75vh; margin-top: 10px; }
.col-header { background: linear-gradient(to bottom, #FFD700, #DAA520); color: #000; font-weight: 900; font-size: 1.4rem; display: flex; align-items: center; justify-content: center; border-radius: 12px; height: 60px; box-shadow: 0 5px 15px rgba(0,0,0,0.5); }
.cell { background: rgba(30, 30, 50, 0.6); border: 1px solid rgba(255,255,255,0.1); color: var(--gold); font-size: 2.2rem; font-weight: 900; display: flex; align-items: center; justify-content: center; border-radius: 8px; cursor: pointer; transition: 0.2s; }
.cell:hover { background: var(--gold); color: #000; transform: scale(1.1); z-index: 10; box-shadow: 0 0 25px var(--gold); }
.cell.done { background: #000; border-color: #222; color: #222; pointer-events: none; }

/* Setup & Draft Styles */
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 20px; width: 90%; }
.cat-card { background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1); border-radius: 20px; padding: 25px; text-align: center; cursor: pointer; transition: 0.3s; }
.cat-card.selected { border: 2px solid var(--gold); background: rgba(255, 215, 0, 0.15); }
.cat-card i { font-size: 3rem; margin-bottom: 10px; color: #888; }
.cat-card.selected i { color: var(--gold); }

/* Inputs & Buttons */
input { background: rgba(255,255,255,0.1); border: 2px solid #555; color: #fff; padding: 15px; font-size: 1.8rem; border-radius: 15px; text-align: center; outline: none; }
.btn-main { background: linear-gradient(145deg, #ffd700, #b8860b); color: #000; border: none; padding: 15px 50px; font-size: 1.8rem; font-weight: 900; border-radius: 50px; cursor: pointer; box-shadow: 0 0 15px rgba(255, 215, 0, 0.6); }

/* Modals */
.overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.9); z-index: 999; display: none; align-items: center; justify-content: center; backdrop-filter: blur(10px); }
.modal-box { background: linear-gradient(135deg, #1a1a2e, #16213e); border: 2px solid var(--gold); padding: 40px; border-radius: 30px; width: 70%; text-align: center; }
.q-text { font-size: 3rem; margin: 20px 0; font-weight: bold; }
.ans-input { width: 60%; font-size: 2.5rem; background: #fff; color: #000; }
.lifelines { display: flex; gap: 30px; justify-content: center; margin-top: 30px; }
.life-item { opacity: 1; cursor: pointer; text-align: center; }
.life-item.used { opacity: 0.3; filter: grayscale(1); pointer-events: none; }
.life-icon-box { width: 60px; height: 60px; background: #333; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 1.5rem; border: 2px solid #555; margin-bottom: 5px; }

/* --- ADAPTIVE FIXES --- */
.cat-grid {
    /* Auto-layout: Fits cards based on screen width */
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); 
    justify-content: center;
    
    /* Scroll support if you have 50+ categories */
    max-height: 60vh; 
    overflow-y: auto;
    padding: 10px; /* Space for scrollbar */
    
    /* Scrollbar Styling */
    scrollbar-width: thin;
    scrollbar-color: var(--gold) #333;
}

/* Chrome Scrollbar */
.cat-grid::-webkit-scrollbar { width: 8px; }
.cat-grid::-webkit-scrollbar-track { background: #111; }
.cat-grid::-webkit-scrollbar-thumb { background: var(--gold); border-radius: 4px; }

/* --- BUTTON FIXES --- */
.btn-row {
    display: flex;
    gap: 20px; /* Space between buttons */
    justify-content: center;
    align-items: center;
    margin-top: 30px;
}

.btn-reset {
    background: rgba(255,255,255,0.1);
    color: #aaa;
    width: auto;
    padding: 15px 25px;
    font-size: 1.5rem;
    border: 2px solid #444;
}
.btn-reset:hover {
    background: #333;
    color: #fff;
    border-color: #fff;
}

/* --- DARK TOAST (REPLACES WHITE ALERT) --- */
#toast .modal-box {
    background: rgba(10, 10, 20, 0.95) !important;
    border: 2px solid var(--gold);
    color: #fff !important;
    box-shadow: 0 0 50px rgba(0,0,0,0.8);
}
#toast-icon { font-size: 5rem; text-shadow: 0 0 20px var(--gold); }
#toast-msg { font-family: 'Cairo'; margin-top: 20px; color: #ddd; }

/* --- DARK TOAST (REPLACES WHITE ALERT) --- */
#toast .modal-box {
    background: rgba(10, 10, 20, 0.95) !important;
    border: 2px solid var(--gold);
    color: #fff !important;
    box-shadow: 0 0 50px rgba(0,0,0,0.8);
}
#toast-icon { font-size: 5rem; text-shadow: 0 0 20px var(--gold); }
#toast-msg { font-family: 'Cairo'; margin-top: 20px; color: #ddd; }
