/* ══════════════════════════════════════
   DESIGN SYSTEM (Hojas Style)
   ══════════════════════════════════════ */
@font-face {
    font-family: 'Zain';
    src: url('picture/alfont_com_zainpcv2-VF-mobkaffswash.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

:root {
    /* Colors - Dark Mode (Default) */
    --bg-deep: #1a0d2e;
    --bg-surface: #2d1b4e;
    --primary: #d4a574;
    /* Gold */
    --primary-light: #f4c873;
    --secondary: #8b5cf6;
    /* Purple */
    --accent: #f59e0b;
    --success: #10b981;
    --danger: #ef4444;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --glass: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);

    /* Typography */
    --font-title: 'Zain', 'Lalezar', cursive;
    --font-body:  'Zain', 'Cairo', sans-serif;

    /* Shadows */
    --glow-gold: 0 0 20px rgba(212, 165, 116, 0.2);
    --shadow-card: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.light-mode {
    --bg-deep: #f8fafc;
    --bg-surface: #ffffff;
    --primary: #8b5cf6;
    --primary-light: #a78bfa;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --glass: rgba(0, 0, 0, 0.05);
    --glass-border: rgba(0, 0, 0, 0.1);
    --glow-gold: 0 0 20px rgba(139, 92, 246, 0.1);
}

/* ══════════════════════════════════════
   RESET & BASE
   ══════════════════════════════════════ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    background: var(--bg-deep);
    color: var(--text-main);
    font-family: var(--font-body);
    direction: rtl;
    min-height: 100vh;
    overflow-x: hidden;
    transition: background 0.3s, color 0.3s;
}

/* Background Ornament */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(circle at 10% 10%, rgba(139, 92, 246, 0.1) 0%, transparent 40%),
        radial-gradient(circle at 90% 90%, rgba(212, 165, 116, 0.1) 0%, transparent 40%);
    z-index: -1;
}

/* ══════════════════════════════════════
   NAV & TOP BAR
   ══════════════════════════════════════ */
.top-nav {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 20px;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 50;
}

.icon-btn {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.icon-btn:hover {
    background: var(--primary);
    color: var(--bg-deep);
    transform: scale(1.1);
}

/* ══════════════════════════════════════
   SETUP SCREEN
   ══════════════════════════════════════ */
.setup-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
    text-align: center;
}

.setup-logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    font-family: var(--font-title);
    font-size: 3.5rem;
    color: var(--primary);
    text-shadow: var(--glow-gold);
    margin-bottom: 40px;
}

.logo-icon {
    width: 80px;
    height: 80px;
    color: var(--primary);
}

.setup-container {
    background: var(--bg-surface);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 30px;
    width: 100%;
    max-width: 500px;
    box-shadow: var(--shadow-card);
}

.setup-section {
    margin-bottom: 24px;
    text-align: right;
}

.setup-section h3 {
    font-family: var(--font-title);
    font-size: 1.4rem;
    margin-bottom: 15px;
    color: var(--primary-light);
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.setup-input,
select {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 14px 18px;
    color: var(--text-main);
    font-family: var(--font-body);
    font-size: 1rem;
    width: 100%;
    outline: none;
    transition: border-color 0.2s;
}

.setup-input:focus,
select:focus {
    border-color: var(--primary);
}

.settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.setting-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
    text-align: right;
}

.setting-item label {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.setup-start-btn {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: var(--bg-deep);
    border: none;
    border-radius: 16px;
    padding: 16px;
    font-family: var(--font-title);
    font-size: 1.8rem;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    cursor: pointer;
    transition: transform 0.2s, filter 0.2s;
    margin-top: 10px;
}

.setup-start-btn:hover {
    transform: translateY(-4px);
    filter: brightness(1.1);
}

.btn-text {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    color: var(--primary-light);
    border-radius: 16px;
    padding: 14px;
    font-family: var(--font-body);
    font-weight: bold;
    font-size: 1.1rem;
    margin-top: 15px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
    width: 100%;
}

.btn-text:hover {
    background: rgba(212, 165, 116, 0.15);
    border-color: var(--primary);
    transform: translateY(-2px);
}

/* ══════════════════════════════════════
   GAME BOARD
   ══════════════════════════════════════ */
.app {
    max-width: 1200px;
    margin: 0 auto;
    padding: 80px 20px 40px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.header {
    text-align: center;
    margin-bottom: 10px;
}

.logo-text {
    font-family: var(--font-title);
    font-size: 2.5rem;
    color: var(--primary);
}

.logo-sub {
    font-size: 0.75rem;
    color: var(--text-muted);
    letter-spacing: 5px;
}

/* Top Scoreboard */
.top-scoreboard {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-surface);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 15px 25px;
    box-shadow: var(--shadow-card);
}

.top-scoreboard .team-score {
    font-family: var(--font-title);
    font-size: 1.4rem;
    color: var(--primary);
    background: var(--glass);
    border: 1px solid var(--glass-border);
    padding: 8px 20px;
    border-radius: 14px;
    display: flex;
    gap: 10px;
    align-items: center;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.2);
}

.top-scoreboard .score-val {
    color: var(--primary-light);
    font-size: 1.8rem;
    border-right: 2px solid var(--glass-border);
    padding-right: 10px;
}

.first-bidder-badge {
    background: var(--glass);
    border: 1px solid var(--primary-light);
    color: var(--primary-light);
    padding: 6px 18px;
    border-radius: 50px;
    font-size: 0.95rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Question Panel */
.question-panel {
    background: var(--bg-surface);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 30px;
    text-align: center;
    position: relative;
    box-shadow: var(--shadow-card);
}

.category-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--glass);
    padding: 8px 16px;
    border-radius: 50px;
    color: var(--primary-light);
    font-size: 0.9rem;
    font-weight: bold;
    margin-bottom: 15px;
}

.question-text {
    font-family: var(--font-title);
    font-size: 1.8rem;
    line-height: 1.4;
    color: var(--text-main);
}

.btn-skip {
    position: absolute;
    top: 20px;
    left: 20px;
    background: var(--glass);
    border: none;
    color: var(--text-muted);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.btn-skip:hover {
    color: var(--danger);
}

/* Game Area Layout */
.game-area {
    display: grid;
    grid-template-areas: "p1 timer p2";
    grid-template-columns: 1fr 200px 1fr;
    gap: 20px;
    align-items: center;
}

@media (max-width: 900px) {
    .game-area {
        grid-template-areas:
            "timer"
            "p1"
            "p2";
        grid-template-columns: 1fr;
    }
}

/* Player Card */
.player-card {
    grid-area: p1;
    background: var(--bg-surface);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 24px;
    text-align: center;
    transition: transform 0.3s, border-color 0.3s;
    position: relative;
}

#p2Card {
    grid-area: p2;
}

.player-card.active {
    border-color: var(--primary);
    box-shadow: 0 0 25px rgba(212, 165, 116, 0.15);
    transform: translateY(-5px);
}

.turn-badge {
    position: absolute;
    top: 15px;
    right: 15px;
    background: var(--primary);
    color: var(--bg-deep);
    font-size: 0.7rem;
    font-weight: bold;
    padding: 3px 10px;
    border-radius: 50px;
    opacity: 0;
}

.player-card.active .turn-badge {
    opacity: 1;
}

.avatar {
    width: 60px;
    height: 60px;
    background: var(--primary);
    color: var(--bg-deep);
    border-radius: 50%;
    margin: 0 auto 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-title);
    font-size: 1.5rem;
}

.player-name {
    font-weight: bold;
    font-size: 1.1rem;
    margin-bottom: 5px;
}

.player-score {
    font-family: var(--font-title);
    font-size: 3rem;
    color: var(--primary-light);
    line-height: 1;
}

.score-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin: 10px 0;
}

.score-adjust-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.score-adjust-btn:hover {
    background: var(--primary);
    color: var(--bg-deep);
    border-color: var(--primary);
}

.bid-display {
    margin: 20px 0;
    padding: 12px;
    background: var(--glass);
    border-radius: 16px;
}

.bid-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-bottom: 4px;
}

.bid-value {
    font-family: var(--font-title);
    font-size: 2.2rem;
    color: var(--accent);
}

/* Bid Controls */
.bid-controls {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.bid-adjuster {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.bid-btn {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    font-size: 1.2rem;
    cursor: pointer;
}

.bid-number {
    font-family: var(--font-title);
    font-size: 2rem;
    min-width: 40px;
}

.action-row {
    display: flex;
    gap: 10px;
}

.action-btn {
    flex: 1;
    padding: 12px;
    border-radius: 12px;
    border: none;
    font-family: var(--font-body);
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-bid {
    background: var(--primary);
    color: var(--bg-deep);
}

.btn-challenge {
    background: var(--accent);
    color: var(--bg-deep);
}

.btn-next {
    background: var(--secondary);
    color: white;
}

.btn-accept {
    background: var(--success);
    color: white;
}

.btn-reject {
    background: var(--danger);
    color: white;
}

.btn-reset {
    background: var(--glass);
    color: var(--text-muted);
    border: 1px solid var(--glass-border);
}

.action-btn:hover {
    filter: brightness(1.1);
    transform: scale(1.02);
}

/* Timer */
.timer-container {
    grid-area: timer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.timer-ring {
    position: relative;
    width: 140px;
    height: 140px;
}

.timer-ring svg {
    transform: rotate(-90deg);
    width: 100%;
    height: 100%;
}

.timer-track {
    fill: none;
    stroke: var(--glass);
    stroke-width: 8;
}

.timer-progress {
    fill: none;
    stroke: var(--primary);
    stroke-width: 8;
    stroke-linecap: round;
    stroke-dasharray: 440;
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 1s linear, stroke 0.3s;
}

.timer-progress.danger {
    stroke: var(--danger);
    animation: rotateShake 0.5s infinite;
}

.timer-display {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.timer-seconds {
    font-family: var(--font-title);
    font-size: 3.5rem;
    line-height: 1;
}

.timer-label {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.timer-btn {
    background: var(--glass);
    border: 1px solid var(--primary);
    color: var(--primary);
    padding: 8px 20px;
    border-radius: 50px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
}

.timer-btn.running {
    border-color: var(--danger);
    color: var(--danger);
}

/* Challenge Phase */
.challenge-phase {
    display: none;
    background: var(--bg-surface);
    border: 2px solid var(--primary);
    border-radius: 24px;
    padding: 30px;
    box-shadow: var(--shadow-card);
    animation: fadeIn 0.4s;
}

.challenge-phase.active {
    display: block;
}

.challenge-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.challenge-title {
    font-family: var(--font-title);
    font-size: 1.5rem;
    color: var(--primary-light);
}

.challenge-count {
    display: flex;
    gap: 15px;
}

.count-item {
    font-size: 1.2rem;
    font-weight: bold;
}

.count-item.success {
    color: var(--success);
}

.count-item.failure {
    color: var(--danger);
}

.challenge-controls-row {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 20px;
}

.action-btn.big {
    padding: 20px;
    font-size: 1.4rem;
    font-family: var(--font-title);
}

.manual-controls {
    display: flex;
    gap: 15px;
}

.auto-controls {
    display: flex;
    gap: 10px;
}

.auto-controls input {
    flex: 1;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 15px;
    color: white;
    font-size: 1.1rem;
    outline: none;
}

.answers-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.answer-chip {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    padding: 6px 14px;
    border-radius: 50px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 6px;
    animation: chipPop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.answer-chip.correct {
    border-color: var(--success);
    color: var(--success);
}

.answer-chip.wrong {
    border-color: var(--danger);
    color: var(--danger);
    opacity: 0.7;
}

/* History */
.history-panel {
    background: var(--glass);
    border-radius: 20px;
    padding: 15px;
    max-height: 150px;
    overflow-y: auto;
}

.history-title {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.history-item {
    font-size: 0.85rem;
    padding: 4px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.history-item.bid {
    color: var(--accent);
}

.history-item.challenge {
    color: var(--primary-light);
    font-weight: bold;
}

/* Game Footer */
.game-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* ══════════════════════════════════════
   MODALS & OVERLAYS
   ══════════════════════════════════════ */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-surface);
    border-radius: 24px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: var(--shadow-card);
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-family: var(--font-title);
    color: var(--primary);
}

.close-modal {
    background: none;
    border: none;
    color: white;
    font-size: 2rem;
    cursor: pointer;
}

.modal-body {
    padding: 20px;
}

.how-to-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.how-to-list li {
    display: flex;
    gap: 15px;
    align-items: center;
    line-height: 1.5;
}

.how-to-list li span {
    background: var(--primary);
    color: var(--bg-deep);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    flex-shrink: 0;
}

/* Result Overlay */
.result-overlay {
    position: fixed;
    inset: 0;
    background: rgba(26, 13, 46, 0.95);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.result-overlay.show {
    display: flex;
}

.result-card {
    background: var(--bg-surface);
    border: 2px solid var(--primary);
    border-radius: 30px;
    padding: 40px;
    text-align: center;
    width: 100%;
    max-width: 600px;
    box-shadow: var(--glow-gold);
    animation: scaleIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.result-icon {
    font-size: 5rem;
    margin-bottom: 20px;
    color: var(--primary);
}

.result-title {
    font-family: var(--font-title);
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.result-desc {
    color: var(--text-muted);
    margin-bottom: 30px;
    font-size: 1.1rem;
}

.correct-answers-view {
    text-align: right;
    background: var(--glass);
    padding: 20px;
    border-radius: 16px;
    margin-bottom: 25px;
}

.correct-answers-view h4 { margin-bottom: 10px; color: var(--primary-light); }

.correct-answers-view ul {
    list-style: none;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.correct-answers-view li { font-size: 0.9rem; color: var(--text-main); }

/* Stats View */
.session-stats {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    margin-bottom: 30px;
}

.stat-box {
    display: flex;
    justify-content: space-between;
    padding: 10px 15px;
    background: var(--glass);
    border-radius: 10px;
}

/* ══════════════════════════════════════
   MOBILE & RESPONSIVE TWEAKS (Portrait Friendly)
   ══════════════════════════════════════ */

@media (max-width: 768px) {
    /* Base */
    .app { 
        padding: 12px; 
        gap: 15px; 
        min-height: auto;
    }

    .top-nav { padding: 10px 15px; }
    .header { margin-bottom: 10px; }
    .logo-text { font-size: 1.8rem; }
    .logo-sub { font-size: 0.7rem; letter-spacing: 3px; }

    /* Top Scoreboard */
    .top-scoreboard { 
        padding: 10px; 
        gap: 10px; 
        flex-wrap: wrap;
        justify-content: center;
        border-radius: 16px;
    }
    .top-scoreboard .team-score { 
        font-size: 1.1rem; 
        padding: 6px 12px; 
        flex: 1; 
        justify-content: center;
        min-width: 120px;
    }
    .top-scoreboard .score-val { font-size: 1.4rem; padding-right: 8px; }
    .first-bidder-badge { 
        order: 3; 
        width: 100%; 
        justify-content: center; 
        font-size: 0.85rem;
    }

    /* Setup Screen */
    .setup-container { padding: 20px; width: 95%; }
    .setup-logo { font-size: 2rem; }
    .setup-start-btn { height: 55px; font-size: 1.3rem; }

    /* Question Panel */
    .question-panel { padding: 15px; border-radius: 16px; }
    .question-text { font-size: 1.3rem; line-height: 1.4; }
    .category-badge { font-size: 0.8rem; padding: 4px 12px; }

    /* Game Area Layout (Vertical Stacking) */
    .game-area {
        grid-template-columns: 1fr;
        grid-template-areas: 
            "timer"
            "p1"
            "p2";
        gap: 15px;
    }

    .timer-column { 
        width: 100%; 
        flex-direction: row; 
        justify-content: center; 
        gap: 20px;
        order: 1;
    }

    #p1Card { order: 2; }
    #p2Card { order: 3; }

    /* Player Cards */
    .player-card { 
        width: 100%; 
        padding: 15px; 
        border-radius: 20px; 
    }
    .avatar { width: 45px; height: 45px; font-size: 1.2rem; }
    .player-name { font-size: 1rem; }
    .player-score { font-size: 2.2rem; }

    .bid-display { padding: 8px; margin: 10px 0; }
    .bid-value { font-size: 1.8rem; }

    /* Controls */
    .bid-controls { gap: 10px; }
    .bid-adjuster { 
        background: var(--glass);
        padding: 5px;
        border-radius: 12px;
        justify-content: space-between;
        width: 100%;
    }
    .bid-btn { width: 48px; height: 48px; font-size: 1.2rem; }
    .bid-number { font-size: 1.8rem; min-width: 40px; }

    .action-btn { 
        height: 50px; 
        font-size: 1rem; 
        width: 100%; 
        border-radius: 12px;
    }

    .action-btn.big { height: 65px; font-size: 1.4rem; }

    /* Timer Container */
    .timer-container { width: 140px; height: 140px; }
    .timer-ring { width: 140px; height: 140px; border-width: 8px; }
    .timer-seconds { font-size: 3rem; }
    .timer-btn { height: 40px; padding: 0 15px; font-size: 0.85rem; }

    /* Challenge Phase */
    .challenge-phase { padding: 15px; border-radius: 20px; }
    .challenge-title { font-size: 1.3rem; }
    .target-num { font-size: 2.5rem; }
    
    .manual-controls { gap: 10px; }
    .auto-controls { flex-direction: column; }
    #autoAnswerInput { height: 50px; font-size: 1.1rem; }

    /* Modals & Overlays */
    .modal-content { 
        width: 90%; 
        max-height: 85vh; 
        padding: 0; 
        border-radius: 24px;
    }
    .modal-header { padding: 15px 20px; }
    .modal-body { padding: 15px; }

    .result-card { 
        width: 90%; 
        padding: 25px 15px; 
        border-radius: 24px;
    }
    .result-icon { font-size: 4rem; margin-bottom: 15px; }
    .result-title { font-size: 2rem; }
    .result-desc { font-size: 1rem; margin-bottom: 20px; }

    .correct-answers-view { padding: 15px; border-radius: 12px; margin-bottom: 15px; }
    .correct-answers-view ul { grid-template-columns: 1fr 1fr; font-size: 0.85rem; }

    /* History & Footer */
    .history-panel { 
        max-height: 120px; 
        padding: 10px; 
        border-radius: 12px;
        margin-top: 10px;
    }
    
    .game-footer { 
        flex-direction: column; 
        gap: 15px; 
        margin-top: 10px;
    }
    .footer-left, .footer-right { width: 100%; display: flex; gap: 10px; }
}

/* ══════════════════════════════════════
   ANIMATIONS
   ══════════════════════════════════════ */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes scaleIn { from { transform: scale(0.8); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes chipPop { from { transform: scale(0); } to { transform: scale(1); } }

@keyframes rotateShake {
    0%, 100% { transform: rotate(-90deg); }
    25% { transform: rotate(-92deg); }
    75% { transform: rotate(-88deg); }
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.pulse { animation: pulse 2s infinite; }

.shake { animation: shake 0.4s; }
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

/* ══════════════════════════════════════
   PLAYERS LOG MODAL
   ══════════════════════════════════════ */
.players-log-modal {
    max-width: 600px;
    width: 95%;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
}

.players-log-modal .modal-body {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding-top: 8px;
}

/* Summary Stats Row */
.players-log-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.summary-stat {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 14px 10px;
    text-align: center;
    transition: transform 0.2s;
}

.summary-stat:hover {
    transform: translateY(-2px);
    border-color: var(--primary);
}

.summary-num {
    font-family: var(--font-title);
    font-size: 2.2rem;
    color: var(--primary-light);
    line-height: 1;
}

.summary-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Search + Clear Controls */
.log-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

.log-search {
    flex: 1;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 12px 16px;
    color: var(--text-main);
    font-family: var(--font-body);
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s;
    direction: rtl;
}

.log-search:focus {
    border-color: var(--primary);
}

.log-clear-btn {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--danger);
    border-radius: 12px;
    padding: 12px 14px;
    font-family: var(--font-body);
    font-size: 0.85rem;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}

.log-clear-btn:hover {
    background: var(--danger);
    color: white;
    border-color: var(--danger);
}

/* Log Entry List */
.players-log-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-left: 4px;
    scrollbar-width: thin;
    scrollbar-color: var(--primary) transparent;
}

.players-log-list::-webkit-scrollbar {
    width: 5px;
}

.players-log-list::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 99px;
}

.log-empty {
    text-align: center;
    color: var(--text-muted);
    padding: 40px 20px;
    font-size: 1.1rem;
    opacity: 0.7;
}

/* Individual Log Entry */
.log-entry {
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 14px 18px;
    animation: slideLogIn 0.35s ease both;
    transition: border-color 0.2s, transform 0.2s;
}

.log-entry:hover {
    border-color: var(--primary);
    transform: translateX(-3px);
}

@keyframes slideLogIn {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

.log-entry-num {
    font-family: var(--font-title);
    font-size: 1.3rem;
    color: var(--primary);
    min-width: 36px;
    text-align: center;
    opacity: 0.7;
}

.log-entry-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.log-players {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    font-size: 1rem;
    font-weight: bold;
}

.log-p1 { color: #60a5fa; }
.log-p2 { color: #f87171; }

.log-vs {
    font-family: var(--font-title);
    font-size: 0.8rem;
    color: var(--primary);
    background: rgba(212, 165, 116, 0.15);
    padding: 2px 8px;
    border-radius: 50px;
    border: 1px solid rgba(212, 165, 116, 0.3);
}

.log-datetime {
    display: flex;
    gap: 14px;
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* ══════════════════════════════════════
   SESSION NAME — SETUP INPUT
   ══════════════════════════════════════ */
.session-name-wrapper {
    position: relative;
}

.session-name-input {
    border-color: var(--primary) !important;
    background: rgba(212, 165, 116, 0.06) !important;
    font-size: 1.05rem;
    font-weight: bold;
    letter-spacing: 0.3px;
}

.session-name-input:focus {
    box-shadow: 0 0 0 3px rgba(212, 165, 116, 0.15);
}

.session-required-badge {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.7rem;
    font-weight: bold;
    color: var(--primary);
    background: rgba(212, 165, 116, 0.15);
    border: 1px solid rgba(212, 165, 116, 0.35);
    border-radius: 50px;
    padding: 2px 8px;
    pointer-events: none;
}

/* Input error shake */
.input-error {
    border-color: var(--danger) !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2) !important;
    animation: inputShake 0.4s ease;
}

@keyframes inputShake {
    0%, 100% { transform: translateX(0); }
    20%       { transform: translateX(-8px); }
    60%       { transform: translateX(8px); }
    80%       { transform: translateX(-4px); }
}

.log-session-name {
    font-size: 1rem;
    font-weight: 800;
    color: var(--primary-light);
    font-family: var(--font-title);
    margin-bottom: 4px;
    letter-spacing: 0.3px;
}

/* ══════════════════════════════════════
   TEAMS SETUP — CARDS
   ══════════════════════════════════════ */
.teams-setup-grid {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 16px;
    align-items: start;
}

@media (max-width: 640px) {
    .teams-setup-grid {
        grid-template-columns: 1fr;
    }
    .teams-vs-divider { display: none; }
}

.team-setup-card {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.team-setup-header {
    font-family: var(--font-title);
    font-size: 1.2rem;
    font-weight: 800;
    margin-bottom: 4px;
}

.t1-header { color: #60a5fa; }
.t2-header { color: #f87171; }

.team-name-input {
    font-weight: bold;
}

.players-input-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.player-input-row {
    display: flex;
    gap: 6px;
    align-items: center;
    animation: slideLogIn 0.25s ease;
}

.player-input-row .setup-input {
    flex: 1;
    margin: 0;
}

.remove-player-btn {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--danger);
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    line-height: 1;
}

.remove-player-btn:hover {
    background: var(--danger);
    color: white;
}

.add-player-btn {
    background: var(--glass);
    border: 1px dashed var(--glass-border);
    color: var(--primary-light);
    border-radius: 10px;
    padding: 8px 12px;
    font-family: var(--font-body);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
}

.add-player-btn:hover {
    background: rgba(212, 165, 116, 0.1);
    border-color: var(--primary);
    border-style: solid;
}

.teams-vs-divider {
    font-family: var(--font-title);
    font-size: 1.4rem;
    color: var(--primary);
    padding-top: 52px;
    text-align: center;
    opacity: 0.6;
}

/* ══════════════════════════════════════
   ROUND PLAYERS BANNER
   ══════════════════════════════════════ */
.round-players-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-surface);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 16px 24px;
    box-shadow: var(--shadow-card);
    gap: 12px;
    transition: transform 0.3s;
}

.rp-side {
    flex: 1;
    text-align: center;
}

.rp-team-label {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.rp-player-name {
    font-family: var(--font-title);
    font-size: 1.6rem;
    font-weight: 800;
    line-height: 1.1;
}

.rp-t1 .rp-player-name { color: #60a5fa; }
.rp-t2 .rp-player-name { color: #f87171; }

.rp-vs {
    font-family: var(--font-title);
    font-size: 1.3rem;
    color: var(--primary);
    background: rgba(212, 165, 116, 0.1);
    border: 1px solid rgba(212, 165, 116, 0.25);
    border-radius: 12px;
    padding: 8px 16px;
    white-space: nowrap;
}

@keyframes bannerPop {
    0%   { transform: scale(0.92); opacity: 0.5; }
    60%  { transform: scale(1.03); }
    100% { transform: scale(1);    opacity: 1; }
}

.banner-pop {
    animation: bannerPop 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Scoreboard team color highlights */
.t1-score { border-right: 3px solid #60a5fa; }
.t2-score { border-left: 3px solid #f87171; }
