:root {
    /* === 1. MODERN SPORTS PALETTE === */
    --bg-gradient: linear-gradient(135deg, #1a0b2e 0%, #2e1a47 100%); 
    
    --primary: #341f97;       
    --primary-dark: #2980b9;
    --secondary: #9b59b6; 
    --secondary-dark: #8e44ad;
    --accent: #e74c3c; 
    --accent-dark: #c0392b;
    
    --grass: #2ecc71; 
    --grass-dark: #27ae60;
    --orange: #f1c40f;
    --orange-dark: #f39c12;

    --home: #ff004c;
    --home-dark: #b30035;
    --away: #00d2ff;
    --away-dark: #0097b8;
    
    --neon: #f9ca24;
    
    --text-main: #2d3436;
    
    /* Option Colors */
    --opt-1: #ff4757; 
    --opt-2: #2ed573; 
    --opt-3: #1e90ff; 
    --opt-4: #ffa502; 

    /* === 2. TYPOGRAPHY === */
    --font-head: 'Russo One', sans-serif; 
    --font-body: 'Nunito', sans-serif;    
}

body {
    margin: 0;
    font-family: var(--font-body);
    background: var(--bg-gradient);
    background-attachment: fixed;
    color: var(--text-main);
    overflow-x: hidden;
    overscroll-behavior: none;
}

/* === UTILITIES === */
.hidden { display: none !important; }
.spacer { height: 20px; }
.divider { margin: 15px 0; border-top: 2px dashed #b2bec3; }
.label-bold { font-weight: 900; font-size: 0.9rem; color: #636e72; letter-spacing: 1px; margin-bottom: 5px; display:block; font-family: var(--font-head); }

/* === CONTAINERS === */
.view-section {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 15px;
    box-sizing: border-box;
    background-image: radial-gradient(rgba(255,255,255,0.03) 1px, transparent 1px);
    background-size: 30px 30px;
    z-index: 1;
}

.full-screen-black { 
    position: fixed; top: 0; left: 0; width: 100%; height: 100%; 
    background: rgba(0,0,0,0.95); z-index: 9999; 
    display: flex; flex-direction: column; align-items: center; justify-content: center; 
}

.card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 1.5rem;
    border-radius: 25px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.3);
    width: 100%;
    max-width: 500px;
    text-align: center;
    position: relative;
    border: 1px solid rgba(255,255,255,0.5);
    z-index: 10;
}

.overlay-modal {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(10, 10, 20, 0.9); z-index: 99999;
    display: flex; align-items: center; justify-content: center;
    padding: 20px; box-sizing: border-box;
}
.overlay-modal .card { max-height: 90vh; overflow-y: auto; overscroll-behavior: contain; }

/* === TYPOGRAPHY === */
h1, h2, h3 { font-family: var(--font-head); margin: 0; text-transform: uppercase; letter-spacing: 1px; }
.game-title { 
    font-size: 3.5rem; 
    color: var(--primary);
    text-shadow: 3px 3px 0px rgba(0,0,0,0.1);
    transform: rotate(-2deg);
    line-height: 0.9;
    margin-bottom: 15px;
}
.subtitle { font-size: 1rem; font-weight: 900; color: #636e72; letter-spacing: 3px; font-family: var(--font-head); }
.pause-title { font-size: 4rem; color: #f1c40f; text-shadow: 4px 4px 0 #e67e22; }

/* === BUTTONS === */
button {
    cursor: pointer; border: none; font-size: 1.2rem; padding: 15px;
    border-radius: 15px; margin-top: 10px; width: 100%;
    font-family: var(--font-head); text-transform: uppercase;
    position: relative; top: 0; transition: all 0.1s;
}
button:active { top: 4px; box-shadow: 0 0 0 !important; }

/* Variants */
.btn-primary { background: var(--primary); color: white; box-shadow: 0 6px 0 var(--primary-dark); }
.btn-secondary { background: #dfe6e9; color: #2d3436; box-shadow: 0 6px 0 #b2bec3; }
.btn-accent { background: var(--grass); color: white; box-shadow: 0 6px 0 var(--grass-dark); }
.btn-3d-orange { background: var(--orange); color: #2d3436; box-shadow: 0 6px 0 var(--orange-dark); }
.big-role-btn { padding: 30px; font-size: 1.6rem; display: flex; align-items: center; justify-content: center; gap: 15px; }
.role-player { background: var(--home); box-shadow: 0 8px 0 var(--home-dark); color: white; }
.role-host { background: var(--away); box-shadow: 0 8px 0 var(--away-dark); color: white; }
.btn-icon { font-size: 2.5rem; display: block; margin-bottom: 5px; }

/* === INPUTS === */
input, select {
    width: 100%; padding: 15px; margin: 8px 0; box-sizing: border-box;
    font-size: 1.2rem; text-align: center; 
    border: 3px solid #dfe6e9; border-radius: 15px;
    font-family: var(--font-head); font-weight: 700;
    background: #fdfdfd; transition: border 0.2s;
    color: var(--primary);
}
input:focus { border-color: var(--primary); outline: none; }
.game-code-input { font-size: 3rem; letter-spacing: 5px; color: var(--primary); }
.small-code-input { width: 60px; }
.input-panel { display: flex; gap: 10px; width: 100%; }
.config-box { text-align: left; margin-bottom: 10px; }
.team-input.home-border { border-color: var(--home); color: var(--home); }
.team-input.away-border { border-color: var(--away); color: var(--away); }
.styled-slider { width: 100%; margin: 10px 0; }
.flex-spread { display: flex; justify-content: space-between; align-items: center; }
.badge-blue { background: var(--primary); color: white; padding: 2px 8px; border-radius: 5px; font-weight: bold; }

/* === RADIO & TOGGLES === */
.category-grid { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 10px 0; }
.cat-radio {
    width: auto !important; background: white; border: 2px solid #dfe6e9;
    color: #636e72; font-family: var(--font-body); text-transform: capitalize !important;
    padding: 10px 20px; font-size: 1rem; box-shadow: none !important;
}
.cat-radio.selected {
    background: var(--primary) !important; color: white !important;
    border-color: var(--primary-dark) !important;
    box-shadow: 0 4px 0 var(--primary-dark) !important;
    transform: translateY(-2px);
}
.cat-radio:hover:not(.selected) { border-color: var(--primary); color: var(--primary); }

.language-toggle-container { display: flex; align-items: center; justify-content: center; gap: 15px; margin: 15px auto; background: white; padding: 10px 20px; border-radius: 50px; border: 2px solid #dfe6e9; width: fit-content; }
.lang-label { font-weight: bold; color: #bdc3c7; font-size: 1rem; transition: color 0.3s; }
.lang-label.active { color: var(--primary); text-shadow: 0 1px 0 rgba(0,0,0,0.1); }
.switch { position: relative; display: inline-block; width: 60px; height: 34px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #ccc; transition: .4s; border-radius: 34px; }
.slider:before { position: absolute; content: ""; height: 26px; width: 26px; left: 4px; bottom: 4px; background-color: white; transition: .4s; border-radius: 50%; box-shadow: 0 2px 5px rgba(0,0,0,0.2); }
input:checked + .slider { background-color: var(--orange); }
input:checked + .slider:before { transform: translateX(26px); }

/* === GAMEPLAY UI (CLIENT) === */
.player-header-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.mini-switch { position: relative; display: inline-block; width: 50px; height: 26px; }
.mini-switch input { opacity: 0; width: 0; height: 0; }
.mini-slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #b2bec3; transition: .4s; border-radius: 34px; }
.mini-slider:before { position: absolute; content: ""; height: 20px; width: 20px; left: 3px; bottom: 3px; background-color: white; transition: .4s; border-radius: 50%; }
input:checked + .mini-slider { background-color: var(--primary); }
input:checked + .mini-slider:before { transform: translateX(24px); }
.lang-icon { font-size: 1.2rem; margin: 0 5px; vertical-align: middle; }

/* Big Stats Bar */
.player-stats-bar { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 15px; }
.stat-group { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; background: white; border-radius: 15px; padding: 10px 5px; border-bottom: 5px solid #ccc; box-shadow: 0 4px 10px rgba(0,0,0,0.1); }
.stat-label { font-size: 0.8rem; font-weight: 900; color: #7f8c8d; letter-spacing: 1px; margin-bottom: 2px; font-family: var(--font-body); }
.stat-value { font-size: 1.8rem; font-weight: 900; font-family: var(--font-head); line-height: 1; }
.stat-group:nth-child(1) { border-bottom-color: var(--primary); }
.stat-group:nth-child(2) { border-bottom-color: var(--orange); }
.stat-group:nth-child(3) { border-bottom-color: var(--grass); border: 3px solid var(--grass); background: #f0fff4; transform: scale(1.05); }
#client-my-rank { color: var(--primary); }
#client-my-score { color: var(--orange-dark); }
#client-my-acc { color: var(--grass-dark); font-size: 2.2rem; }

/* Option Buttons (2x2 Grid) */
.options-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; margin-top: 15px; width: 100%; }
.option-btn { 
    color: white; padding: 15px; font-family: var(--font-body); font-weight: 700; font-size: 1.1rem; 
    min-height: 100px; border-radius: 20px; display: flex; align-items: center; justify-content: center; 
    box-shadow: 0 6px 0 rgba(0,0,0,0.2); text-shadow: 0 2px 0 rgba(0,0,0,0.2); line-height: 1.3; text-transform: none; border: none; 
    transition: transform 0.1s; 
}
.option-btn:nth-child(1) { background-color: var(--opt-1); border-bottom: 6px solid #c0392b; }
.option-btn:nth-child(2) { background-color: var(--opt-3); border-bottom: 6px solid #2980b9; }
.option-btn:nth-child(3) { background-color: var(--opt-4); border-bottom: 6px solid #f39c12; }
.option-btn:nth-child(4) { background-color: var(--opt-2); border-bottom: 6px solid #27ae60; }
.option-btn:active { transform: translateY(6px); box-shadow: none !important; }
.option-letter { display: inline-block; font-weight: 900; margin-right: 8px; font-size: 1.2rem; color: rgba(255,255,255,0.7); background: rgba(0,0,0,0.2); width: 30px; height: 30px; line-height: 30px; border-radius: 50%; text-align: center; }

/* Voting */
.vote-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; margin-top: 20px; width: 100%; }
.vote-btn { height: 120px; font-size: 1rem; font-weight: 900; line-height: 1.4; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 5px; }
.vote-grid button:nth-child(1) { background-color: #ff6b6b; border-bottom: 6px solid #ee5253; }
.vote-grid button:nth-child(2) { background-color: #54a0ff; border-bottom: 6px solid #2e86de; }
.vote-grid button:nth-child(3) { background-color: #1dd1a1; border-bottom: 6px solid #10ac84; }
.vote-locked-container { padding: 40px 0; color: #7f8c8d; text-align: center; }
.vote-locked-icon { font-size: 4rem; display: block; margin-bottom: 10px; animation: pulse 1.5s infinite; }
.vote-locked-text { font-size: 2rem; font-family: var(--font-head); color: var(--primary); }

/* Persistent Text & TTS */
#client-read-overlay { position: fixed !important; top: 0; left: 0; width: 100vw; height: 100vh; background: var(--primary); z-index: 4000 !important; display: flex; flex-direction: column; align-items: center; justify-content: center; color: white; text-align: center; }
.client-persistent-question { font-size: 1.3rem; font-weight: bold; color: #2c3e50; background: #ecf0f1; padding: 10px; border-radius: 10px; margin-bottom: 15px; min-height: 60px; display: flex; align-items: center; justify-content: center; border: 2px solid #bdc3c7; line-height: 1.3; font-family: var(--font-body); }
.tts-btn { background: none; border: none; font-size: 1.5rem; cursor: pointer; color: var(--primary); margin-left: 10px; padding: 5px; transition: transform 0.1s; }
.tts-btn:active { transform: scale(0.9); }
.question-row { display: flex; align-items: center; justify-content: center; width: 100%; }
.tts-active { border-color: #f1c40f !important; box-shadow: 0 0 15px #f1c40f, inset 0 0 10px rgba(255,255,255,0.5) !important; transform: scale(1.02); background-color: #f39c12 !important; transition: all 0.2s; }

/* Client Feedback & Game Over */
.client-feedback-box { padding: 20px; background: white; border-radius: 15px; border: 4px solid #bdc3c7; margin-top: 15px; }
.client-emoji { font-size: 5rem; display: block; margin-bottom: 10px; }
.feedback-text { font-size: 1.2rem; font-weight: bold; margin-top: 8px; padding: 12px; background: #f1f2f6; border-radius: 10px; }
.feedback-text.correct { background: var(--grass); color: white; }

#client-game-over-ui .card { border: 4px solid var(--primary); box-shadow: 0 0 30px rgba(52, 152, 219, 0.4); }
#client-final-rank { font-size: 6rem; color: var(--primary); text-shadow: 4px 4px 0 #dfe6e9; margin: 0; line-height: 1; font-family: var(--font-head); }
.game-over-stats-row { display: flex; justify-content: center; align-items: center; gap: 15px; margin-top: 30px; margin-bottom: 20px; }
.final-stat-card { background: white; border-radius: 20px; padding: 15px 10px; width: 40%; box-shadow: 0 10px 20px rgba(0,0,0,0.1); display: flex; flex-direction: column; align-items: center; border: 3px solid #dfe6e9; }
.final-stat-label { font-size: 0.8rem; font-weight: 900; color: #b2bec3; letter-spacing: 1px; }
.final-stat-value { font-family: var(--font-head); font-size: 2rem; line-height: 1.1; }
.score-card { border-color: var(--orange); }
.score-card .final-stat-value { color: var(--orange); }
.acc-card { border: 6px solid var(--grass); background: #f0fff4; transform: scale(1.25); box-shadow: 0 15px 40px rgba(46, 204, 113, 0.4); z-index: 5; }
.acc-card .final-stat-value { color: var(--grass-dark); font-size: 2.8rem; text-shadow: 2px 2px 0 rgba(255,255,255,1); }
.acc-card .final-stat-label { color: var(--grass-dark); font-size: 0.9rem; }

/* === HOST CONTROLS === */
.host-toolbar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 15px; justify-content: center; }
.host-toolbar button { font-size: 0.85rem; padding: 10px; width: auto; margin: 0; }
.header-strip { display: flex; justify-content: space-between; background: rgba(0,0,0,0.5); color: white; padding: 15px; border-radius: 8px; margin-bottom: 20px; }
.roster-split-view { display: flex; gap: 15px; height: 300px; overflow-y: auto; text-align: left; }
.roster-col { flex: 1; background: #f1f2f6; padding: 10px; border-radius: 10px; min-height: 150px; border: 2px dashed #bdc3c7; }
.roster-item { background: white; padding: 8px; margin: 5px 0; border-radius: 8px; border: 1px solid #dfe6e9; cursor: move; font-weight: bold; display: flex; align-items: center; gap: 10px; }
.lobby-grid, .roster-grid { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; padding: 10px; }
.lobby-card, .roster-card { background: white; padding: 5px; border-radius: 10px; text-align: center; width: 70px; font-size: 0.7rem; font-weight: bold; box-shadow: 0 4px 0 rgba(0,0,0,0.1); display: flex; flex-direction: column; align-items: center; }
.lobby-card img, .roster-card img { width: 50px !important; height: 50px !important; object-fit: contain; border-radius: 50%; border: 2px solid #bdc3c7; margin-bottom: 2px; background: #fff; }
.host-q-box { text-align: left; background: white; border-left: 6px solid var(--primary); padding: 15px; border-radius: 4px; margin-bottom: 15px; box-shadow: 0 2px 5px rgba(0,0,0,0.05); }
.host-q-box.current-q { border-color: var(--grass); }
.host-q-box.next-q { border-color: #f1c40f; opacity: 0.9; }
.log-box { text-align:left; font-size:0.8rem; color:#7f8c8d; height:100px; overflow-y:auto; background:#f9f9f9; padding:5px; margin-top:10px; }
.qr-border { border: 4px solid #bdc3c7; border-radius: 10px; }

/* === HOST LIVE FEED === */
.live-feed-container { background: #dfe6e9; border: 3px solid #b2bec3; border-radius: 15px; height: 300px; overflow-y: auto; padding: 10px; margin-top: 15px; box-shadow: inset 0 0 10px rgba(0,0,0,0.1); }
.live-section-header { font-size: 0.9rem; font-weight: 900; color: #636e72; text-transform: uppercase; margin: 10px 0 5px 0; border-bottom: 2px solid #b2bec3; padding-bottom: 2px; }
.chip-grid { display: flex; flex-wrap: wrap; gap: 8px; align-content: flex-start; }
.player-chip { padding: 8px 16px; border-radius: 50px; font-weight: bold; font-size: 0.9rem; color: #2d3436; background: white; border: 2px solid #bdc3c7; box-shadow: 0 2px 0 rgba(0,0,0,0.1); animation: popIn 0.3s; white-space: nowrap; }
.player-chip.waiting { background: white; color: #7f8c8d; border-style: dashed; }
.player-chip.correct { background: var(--grass); color: white; border-color: var(--grass-dark); }
.player-chip.wrong { background: var(--home); color: white; border-color: #c0392b; }

/* === PITCH & ANIMATIONS === */
.pitch-container { background: var(--grass); background-image: repeating-linear-gradient(0deg, transparent, transparent 19px, rgba(255,255,255,0.05) 20px, transparent 21px), linear-gradient(to bottom, #2d3436 0%, #202526 100%); border: 4px solid white; border-radius: 15px; position: relative; perspective: 800px; overflow: hidden; margin-top: 15px; box-shadow: 0 10px 30px rgba(0,0,0,0.5); }
.mini-pitch { width: 100%; height: 220px; }
#view-projector .pitch-container { width: 90vw; height: 70vh; margin-top: 120px; border-width: 8px; }
.client-pitch-box { width: 95%; height: 50vh; min-height: 350px; background: var(--grass); background-image: repeating-linear-gradient(0deg, transparent, transparent 19px, rgba(255,255,255,0.1) 20px, transparent 21px), linear-gradient(to bottom, var(--grass-dark) 0%, var(--grass) 100%); border: 6px solid white; position: relative; perspective: 600px; overflow: hidden; border-radius: 20px; box-shadow: 0 0 50px rgba(0,0,0,0.8); }
.client-flash-container { position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 3000; background: rgba(0,0,0,0.9); display: flex; align-items: center; justify-content: center; }
.pitch-lines { position: absolute; width: 100%; height: 100%; pointer-events: none; opacity: 0.7; border-color: rgba(255,255,255,0.8); }
.penalty-box { width: 60%; height: 25%; border: 4px solid white; border-top: none; position: absolute; top: 0; left: 20%; box-shadow: 0 0 10px rgba(255,255,255,0.3); }
.center-circle { width: 150px; height: 150px; border: 4px solid white; border-radius: 50%; position: absolute; bottom: -75px; left: calc(50% - 75px); box-shadow: 0 0 10px rgba(255,255,255,0.3); }
.goal { width: 40%; height: 15%; border: 6px solid white; border-bottom: none; position: absolute; top: 0; left: 30%; background: repeating-linear-gradient(45deg, transparent, transparent 10px, rgba(255,255,255,0.1) 10px, rgba(255,255,255,0.1) 20px); z-index: 1; box-shadow: 0 0 10px rgba(255,255,255,0.3); }
.goalkeeper, .kicker { width: 80px; height: 80px; position: absolute; left: 50%; transform: translateX(-50%); z-index: 10; transition: all 0.5s ease-out; }
.goalkeeper { top: 8%; } .kicker { bottom: 8%; z-index: 15; }
.goalkeeper img, .kicker img { width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 10px 10px rgba(0,0,0,0.5)); }
.ball { width: 30px; height: 30px; border-radius: 50%; position: absolute; bottom: 20%; left: 50%; transform: translateX(-50%); z-index: 12; background: white; border: 2px solid black; box-shadow: 0 5px 15px rgba(0,0,0,0.5); transition: all 1s cubic-bezier(0.25, 1, 0.5, 1); }
.ball.kick-left { left: 34%; bottom: 89%; transform: scale(0.6) translateX(-50%); } .ball.kick-center { left: 50%; bottom: 90%; transform: scale(0.6) translateX(-50%); } .ball.kick-right { left: 67%; bottom: 89%; transform: scale(0.6) translateX(-50%); }
.ball.kick-left-blocked { left: 34%; bottom: 78%; transform: scale(0.7) translateX(-50%); } .ball.kick-center-blocked { left: 50%; bottom: 78%; transform: scale(0.7) translateX(-50%); } .ball.kick-right-blocked { left: 67%; bottom: 78%; transform: scale(0.7) translateX(-50%); }
.goalkeeper.dive-left { left: 34%; top: 11%; transform: translateX(-50%) rotate(-15deg); } .goalkeeper.dive-center { left: 50%; top: 10%; transform: translateX(-50%); } .goalkeeper.dive-right { left: 67%; top: 11%; transform: translateX(-50%) rotate(15deg); }
.kicker.run-up { bottom: 20%; transform: translateX(-50%) scale(0.9); }

/* === PROJECTOR OVERLAYS === */
.announce-overlay, .question-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(10, 10, 25, 0.95); z-index: 2000; display: flex; flex-direction: column; align-items: center; justify-content: center; }
#proj-question-overlay { background: rgba(15, 15, 30, 0.98); z-index: 2100; color: white; }
.proj-header { position: absolute; top: 0; left: 0; width: 100%; height: 120px; background: rgba(0,0,0,0.8); backdrop-filter: blur(5px); display: flex; justify-content: space-between; align-items: center; padding: 0 40px; box-sizing: border-box; z-index: 500; border-bottom: 4px solid var(--neon); }
.header-score-container { display: flex; gap: 40px; align-items: center; font-family: var(--font-head); color: white; text-shadow: 0 2px 10px rgba(0,0,0,0.5); }
.huge-score { font-size: 4rem; line-height: 1; }
.home { color: var(--home); } .away { color: var(--away); }
.timer-box { font-size: 3.5rem; color: var(--neon); font-family: monospace; min-width: 100px; text-align: center; }
.announce-container { display: flex; gap: 60px; align-items: center; margin-top: 40px; }
.announce-card { background: white; padding: 20px; border-radius: 20px; width: 300px; text-align: center; animation: popIn 0.5s; position: relative; }
.announce-card.home-card { border-top: 15px solid var(--home); } .announce-card.away-card { border-top: 15px solid var(--away); }
.announce-card img { width: 100%; height: 250px; object-fit: contain; }
.announce-name { font-family: var(--font-head); font-size: 2.5rem; margin-top: 10px; color: #2d3436; }
.announce-vs { font-family: var(--font-head); font-size: 6rem; color: var(--neon); font-style: italic; text-shadow: 4px 4px 0 black; }
.question-text-big { font-size: 3rem; font-family: var(--font-body); font-weight: 900; line-height: 1.3; max-width: 80%; }
.explanation-text { font-size: 2rem; color: var(--neon); margin-top: 20px; font-weight: 700; }
/* === GAME OVERLAY TEXT (Fixed Timing) === */
.game-text-overlay {
    position: absolute;
    top: 40%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 5rem;
    font-weight: 900;
    color: white;
    text-shadow: 0 5px 15px rgba(0,0,0,0.8), 0 0 20px black; /* Strong shadow */
    z-index: 50;
    text-align: center;
    pointer-events: none;
    
    /* Animation: Pop in with Delay */
    opacity: 0; /* Hidden initially */
    transition: opacity 0.2s;
}

.game-text-overlay.show-now {
    opacity: 1; /* Show when JS adds this class */
    animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Fix Timer Visibility on Grass */
#proj-overlay-text {
    font-size: 5rem;
    font-weight: 900;
    
    /* White text with strong black outline */
    color: white !important;
    text-shadow: 
        3px 3px 0 #000, 
        -1px -1px 0 #000,  
        1px -1px 0 #000,
        -1px 1px 0 #000,
        1px 1px 0 #000,
        0 0 20px rgba(0,0,0,0.8) !important;
        
    z-index: 50;
}
/* === LIVE STATS BARS (Projector) === */
.live-stats-container { width: 80%; margin-top: 30px; background: rgba(0,0,0,0.6); padding: 20px; border-radius: 15px; animation: fadeIn 0.5s; display: flex; flex-direction: column; gap: 15px; }
.team-stat-row { display: flex; align-items: center; gap: 15px; width: 100%; }
.stat-label { width: 150px; text-align: right; font-weight: 900; font-size: 1.5rem; color: white; text-shadow: 0 2px 4px black; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-bar-track { flex: 1; height: 30px; background: rgba(255,255,255,0.2); border-radius: 15px; overflow: hidden; border: 2px solid rgba(255,255,255,0.5); position: relative; }
.stat-bar-fill { height: 100%; width: 0%; transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1); }
.home-fill { background-color: var(--home); box-shadow: 0 0 10px var(--home); }
.away-fill { background-color: var(--away); box-shadow: 0 0 10px var(--away); }
.stat-percent { width: 80px; font-size: 1.5rem; font-weight: bold; color: #f1c40f; font-family: monospace; text-align: left; }

/* === PODIUM & CELEBRATION === */
.celebration-header { margin-bottom: 30px; animation: slideUp 0.5s ease-out; width: 100%; display: flex; justify-content: center; }
.class-stats-box { background: rgba(255, 255, 255, 0.95); color: #2c3e50; padding: 20px 50px; border-radius: 50px; font-family: var(--font-head); font-size: 2.5rem; box-shadow: 0 10px 30px rgba(0,0,0,0.5), 0 0 20px var(--neon); border: 6px solid var(--neon); text-transform: uppercase; }
.winner-title { font-family: var(--font-head); font-size: 7rem; color: var(--neon); text-shadow: 0 0 30px rgba(249, 202, 36, 0.8), 4px 4px 0 black; margin-bottom: 10px; }
.podium-container { display: flex; align-items: flex-end; justify-content: center; gap: 30px; height: 500px; margin-top: 50px; }
.podium-step { display: flex; flex-direction: column; align-items: center; width: 200px; animation: slideUp 1s ease; }
.podium-bar { width: 100%; border-radius: 20px 20px 0 0; color: white; font-family: var(--font-head); font-size: 4rem; display: flex; align-items: center; justify-content: center; border: 4px solid white; box-shadow: 0 10px 30px rgba(0,0,0,0.5); position: relative; }
.step-1 .podium-bar { height: 320px; background: linear-gradient(to bottom, #f1c40f, #f39c12); order: 2; z-index: 2; }
.step-2 .podium-bar { height: 240px; background: linear-gradient(to bottom, #bdc3c7, #7f8c8d); order: 1; z-index: 1; }
.step-3 .podium-bar { height: 160px; background: linear-gradient(to bottom, #cd7f32, #a05a2c); order: 3; z-index: 1; }
.podium-avatar img { width: 130px; height: 130px; border-radius: 50%; border: 8px solid white; background: white; margin-bottom: -30px; position: relative; z-index: 5; box-shadow: 0 5px 15px rgba(0,0,0,0.3); }
.podium-name { margin-top: 15px; font-family: var(--font-head); font-size: 2rem; color: white; text-shadow: 0 3px 5px black; text-align: center; line-height: 1.1; white-space: nowrap; }
.podium-details { background: rgba(0, 0, 0, 0.8); color: var(--neon); padding: 10px; border-radius: 10px; width: 100%; margin-top: 10px; border: 2px solid white; text-align: center; }
.podium-details div { font-family: var(--font-head); font-size: 1.5rem; line-height: 1.2; }

/* === BENCH THEME === */
.floating-balls { position: absolute; top:0; left:0; width:100%; height:100%; overflow: hidden; pointer-events: none; }
.deco-ball { position: absolute; font-size: 3rem; opacity: 0.2; animation: float 10s infinite ease-in-out; }
.b1 { top: 10%; left: 10%; animation-delay: 0s; } .b2 { top: 50%; right: 10%; animation-delay: 2s; } .b3 { bottom: 10%; left: 30%; animation-delay: 4s; }
.bench-card { border-color: #f1c40f; box-shadow: 0 15px 30px rgba(0,0,0,0.3); min-height: 350px; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 30px; }
.bench-avatar-container { position: relative; display: inline-block; margin-bottom: 25px; overflow: visible; width: 140px; height: 140px; }
.bench-avatar-img { width: 140px; height: 140px; border-radius: 50%; border: 6px solid white; box-shadow: 0 8px 20px rgba(0,0,0,0.3); animation: pulse 3s infinite; object-fit: contain; background: #ecf0f1; }
.status-badge-bench { position: absolute; bottom: -15px; left: 50%; transform: translateX(-50%); background: #e74c3c; color: white; padding: 8px 20px; border-radius: 20px; font-weight: 900; font-size: 1rem; white-space: nowrap; box-shadow: 0 4px 10px rgba(0,0,0,0.3); z-index: 5; }
.bench-name { font-size: 2.5rem; color: #2c3e50; margin: 10px 0; text-shadow: 0 2px 0 rgba(0,0,0,0.1); }
.bench-message { background: rgba(255,255,255,0.9); padding: 15px; border-radius: 12px; margin-top: 15px; color: #7f8c8d; font-weight: bold; font-size: 1.2rem; border: 2px dashed #bdc3c7; width: 100%; }
.bench-decoration { display: flex; justify-content: center; gap: 30px; margin-top: 25px; }
.cone { width: 0; height: 0; border-left: 20px solid transparent; border-right: 20px solid transparent; border-bottom: 40px solid #e67e22; position: relative; }
.cone::after { content: ''; position: absolute; top: 12px; left: -12px; width: 24px; height: 6px; background: rgba(255,255,255,0.5); }

/* === ANIMATIONS === */
@keyframes fall { 0% { transform: translateY(-10vh) rotate(0deg); opacity: 1; } 100% { transform: translateY(110vh) rotate(720deg); opacity: 0; } }
@keyframes bounceIn { from { transform: scale(0.5); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
@keyframes pulse { 0% { transform: scale(1); } 50% { transform: scale(1.05); } 100% { transform: scale(1); } }
@keyframes float { 0% { transform: translateY(0) rotate(0deg); } 50% { transform: translateY(-20px) rotate(180deg); } 100% { transform: translateY(0) rotate(360deg); } }
/* === AVATAR GRID (Restored) === */
.avatar-grid { 
    display: grid; 
    grid-template-columns: repeat(4, 1fr); /* 4 Columns */
    gap: 10px; 
    margin: 15px 0; 
}

.avatar-option { 
    border: 3px solid #dfe6e9; 
    border-radius: 15px; 
    cursor: pointer; 
    padding: 2px; 
    background: white; 
    transition: all 0.2s; 
    overflow: hidden; 
}

.avatar-option img { 
    width: 100% !important; /* Fill the box */
    height: auto !important; 
    display: block; 
    border-radius: 10px;
    margin: 0; /* Remove centering margin */
}

.avatar-option.selected { 
    border-color: var(--grass); 
    background: #dff9fb; 
    transform: scale(1.1); 
    box-shadow: 0 5px 15px rgba(0,0,0,0.1); 
}
/* === PITCH (RESTORED GREEN TURF) === */
.pitch-container {
    background: var(--grass); 
    background-image: 
        repeating-linear-gradient(0deg, transparent, transparent 19px, rgba(255,255,255,0.1) 20px, transparent 21px),
        linear-gradient(to bottom, var(--grass-dark) 0%, var(--grass) 100%);
    border: 4px solid white; 
    border-radius: 15px; 
    position: relative; 
    perspective: 800px; 
    overflow: hidden; 
    margin-top: 15px; 
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

#view-projector .pitch-container { 
    width: 90vw; 
    height: 70vh; 
    margin-top: 200px; /* Increased from 120px */
    border-width: 8px; 
}

/* Specific fix for Player Device Pitch */
.client-pitch-box { 
    width: 95%; height: 60vh; 
    background: var(--grass); 
    background-image: 
        repeating-linear-gradient(0deg, transparent, transparent 19px, rgba(255,255,255,0.1) 20px, transparent 21px),
        linear-gradient(to bottom, var(--grass-dark) 0%, var(--grass) 100%);
    border: 6px solid white; 
    position: relative; perspective: 600px; overflow: hidden; border-radius: 20px; 
}

/* Lines - Clean White */
.pitch-lines { position: absolute; width: 100%; height: 100%; pointer-events: none; opacity: 0.7; border-color: rgba(255,255,255,0.9); }
.penalty-box { width: 60%; height: 25%; border: 4px solid white; border-top: none; position: absolute; top: 0; left: 20%; }
.center-circle { width: 150px; height: 150px; border: 4px solid white; border-radius: 50%; position: absolute; bottom: -75px; left: calc(50% - 75px); }
.goal { width: 40%; height: 15%; border: 6px solid white; border-bottom: none; position: absolute; top: 0; left: 30%; background: repeating-linear-gradient(45deg, transparent, transparent 10px, rgba(255,255,255,0.2) 10px, rgba(255,255,255,0.2) 20px); z-index: 1; }

/* Entities */
.goalkeeper, .kicker { width: 80px; height: 80px; position: absolute; left: 50%; transform: translateX(-50%); z-index: 10; transition: all 0.5s ease-out; }
.goalkeeper { top: 8%; } .kicker { bottom: 8%; z-index: 15; }
.goalkeeper img, .kicker img { width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 5px 5px rgba(0,0,0,0.3)); }

/* === VISIBLE NAME TAGS === */
.name-tag { 
    position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); 
    background: white; /* Solid White */
    color: #2d3436; /* Dark Text */
    padding: 4px 10px; 
    border-radius: 4px; 
    font-size: 0.9rem; 
    font-weight: 900; 
    white-space: nowrap; 
    font-family: var(--font-body); 
    border: 2px solid #bdc3c7; /* Subtle border */
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    z-index: 20;
}
/* === BIG GAME CODE === */
.code-display-box {
    font-size: 2rem;
    background: #ecf0f1;
    padding: 15px;
    border-radius: 15px;
    border: 3px dashed var(--primary);
    margin: 15px 0;
    color: #2c3e50;
    font-family: var(--font-head);
    letter-spacing: 2px;
}

.code-display-box strong {
    font-size: 3rem;
    color: var(--orange-dark);
    display: block; /* Put code on new line */
    margin-top: 5px;
}
/* === LIVE REPORT MODAL === */
.report-column h3 { color: #636e72; border-bottom: 2px solid #bdc3c7; padding-bottom: 5px; margin-bottom: 10px; }

/* Question Card */
.report-q-card {
    background: white; border: 1px solid #bdc3c7; border-radius: 8px;
    padding: 10px; margin-bottom: 10px; box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}
.report-q-text { font-weight: bold; margin-bottom: 5px; color: #2d3436; }

/* Progress Bar */
.report-bar-track {
    width: 100%; height: 20px; background: #e74c3c; /* Red Base */
    border-radius: 10px; overflow: hidden; position: relative;
}
.report-bar-fill {
    height: 100%; background: #2ecc71; /* Green Overlay */
    width: 0%; transition: width 0.5s;
}
.report-stats-text { font-size: 0.8rem; color: #7f8c8d; margin-top: 5px; display: flex; justify-content: space-between; }

/* Student List */
.report-student-row {
    display: flex; justify-content: space-between; padding: 5px;
    border-bottom: 1px solid #dfe6e9; font-weight: bold; font-size: 0.9rem;
}
.acc-high { color: #27ae60; }
.acc-med { color: #e67e22; }
.acc-low { color: #c0392b; }
/* REVIEW MODE STYLES */
.choice-bar {
    color: #dfe6e9;
    opacity: 1;
    transition: all 0.5s;
}

/* Default Bar Color */
.choice-bar div[style*="background:currentColor"] { background: #7f8c8d; }

/* Revealed Correct */
.choice-bar.correct.revealed {
    color: var(--grass);
    transform: scale(1.05);
}
.choice-bar.correct.revealed div[style*="background:currentColor"] { background: var(--grass); box-shadow: 0 0 15px var(--grass); }

/* Revealed Incorrect */
.choice-bar.incorrect.revealed {
    opacity: 0.3; /* Fade out */
}
.btn-mini {
    padding: 2px 8px;
    font-size: 0.7rem;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    background: #bdc3c7;
    color: #2d3436;
}
.btn-mini:hover { background: var(--primary); color: white; }

.report-q-card.active-card {
    border: 3px solid var(--primary);
    background-color: #f0faff;
    transform: scale(1.02);
    transition: all 0.2s;
}

/* === CLIENT SPECIFIC (UPDATED) === */
#client-read-overlay { 
    position: fixed !important; top: 0; left: 0; width: 100vw; height: 100vh; 
    background: var(--primary); z-index: 4000 !important; 
    display: flex; flex-direction: column; align-items: center; justify-content: center; 
    color: white; text-align: center; 
}

/* Question Row Container */
.question-row { 
    display: flex; 
    align-items: stretch; /* Stretch height to match */
    justify-content: space-between; 
    width: 100%;
    gap: 5px; /* Reduce gap */
    margin-bottom: 10px;
}

/* The Question Text Box */
.client-persistent-question { 
    font-size: 1.1rem; /* Slightly smaller base font */
    font-weight: 700; 
    color: #2d3436; 
    background: #f1f2f6; 
    padding: 10px; /* Reduced padding */
    border-radius: 15px; 
    min-height: 80px; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    border: 2px solid #dfe6e9; 
    line-height: 1.3; 
    font-family: var(--font-body);
    flex: 1; /* Take all available space */
    word-break: break-word; /* Prevent overflow */
    text-align: left; /* Easier to read stacking text */
}

/* The TTS Button */
.tts-btn { 
    background: white; /* Give it a background so it looks like a button */
    border: 2px solid #dfe6e9; 
    border-radius: 12px;
    font-size: 1.5rem; 
    cursor: pointer; 
    color: var(--primary); 
    width: 50px; /* Fixed width */
    flex-shrink: 0; /* Never shrink */
    display: flex;
    align-items: center;
    justify-content: center;
}
.tts-btn:active { transform: scale(0.9); background: #eee; }
.tts-active { 
    border-color: #f1c40f !important; 
    background-color: #fffbe6 !important; 
    box-shadow: 0 0 10px #f1c40f !important;
}

/* === AVATAR GRID (Square Boxes, Full Body) === */
.avatar-grid { 
    display: grid; 
    grid-template-columns: repeat(4, 1fr); 
    gap: 8px; 
    margin: 15px 0; 
}

.avatar-option { 
    border: 3px solid #dfe6e9; 
    border-radius: 10px; 
    cursor: pointer; 
    padding: 2px; 
    background: white; 
    transition: all 0.2s; 
    overflow: hidden; 
    
    /* Force Square */
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.avatar-option img { 
    width: 100% !important; 
    height: 100% !important; 
    object-fit: contain !important; /* Forces full image to be visible */
    display: block; 
}

/* Selected State */
.avatar-option.selected { 
    border-color: var(--grass); 
    background: #dff9fb; 
    transform: scale(1.05); 
    box-shadow: 0 5px 15px rgba(0,0,0,0.1); 
}
/* === NEW: CLIENT TIMER BAR === */
.client-timer-container {
    width: 100%;
    height: 10px;
    background: #dfe6e9;
    border-radius: 5px;
    margin-bottom: 10px;
    overflow: hidden;
    position: relative;
    border: 1px solid #b2bec3;
}

.client-timer-fill {
    height: 100%;
    background: linear-gradient(90deg, #f1c40f, #e67e22);
    width: 100%;
    transform-origin: left;
    /* Transition will be handled via JS for smooth countdown */
}
/* === NEW: REPORT DETAIL VIEWS === */
.student-row-clickable { 
    cursor: pointer; 
    transition: all 0.2s; 
    padding: 8px; 
    border-radius: 5px; 
}
.student-row-clickable:hover { 
    background: white; 
    box-shadow: 0 2px 5px rgba(0,0,0,0.1); 
    transform: translateX(5px);
}

.detail-card { 
    background: white; 
    padding: 12px; 
    margin-bottom: 10px; 
    border-left: 6px solid #bdc3c7; 
    border-radius: 8px; 
    box-shadow: 0 2px 4px rgba(0,0,0,0.05); 
}

.detail-card.correct { border-left-color: var(--grass); background: #f0fff4; }
.detail-card.wrong { border-left-color: var(--home); background: #fff5f5; }
.detail-card.skipped { border-left-color: #f1c40f; opacity: 0.7; }

.detail-q { font-weight: 900; font-size: 1rem; color: #2d3436; margin-bottom: 5px; font-family: var(--font-body); }
.detail-ans { font-size: 0.9rem; color: #636e72; display: flex; justify-content: space-between; }
.detail-badge { font-weight: bold; padding: 2px 8px; border-radius: 4px; font-size: 0.8rem; color: white; }
/* === PERSISTENT JOIN INFO === */
#persistent-join-info {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(5px);
    padding: 10px 15px;
    border-radius: 15px;
    display: flex;
    gap: 15px;
    align-items: center;
    box-shadow: 0 5px 20px rgba(0,0,0,0.2);
    z-index: 4000; /* Above background, below modals */
    border: 3px solid var(--primary);
    transform-origin: bottom right;
    animation: slideUp 0.5s ease-out;
    transition: transform 0.3s ease-out; /* Smooth slide out */
}
/* Hidden state sliding off screen */
#persistent-join-info.slide-hidden {
    transform: translateY(150%); 
}

/* Reverted Small URL Style */
.p-url {
    font-size: 0.8rem;
    font-weight: bold;
    color: var(--primary);
    margin-bottom: 5px;
    font-family: monospace;
    background: none;
    border: none;
    padding: 0;
}
#persistent-qr {
    width: 70px;
    height: 70px;
    border-radius: 5px;
    border: 2px solid #bdc3c7;
}

.persistent-text { text-align: left; }

.p-label {
    font-size: 0.65rem;
    font-weight: 900;
    color: #95a5a6;
    letter-spacing: 1px;
    margin-bottom: 2px;
}

.p-url {
    font-size: 0.8rem;
    font-weight: bold;
    color: var(--primary);
    margin-bottom: 5px;
    font-family: monospace;
}

.p-code {
    font-size: 2rem;
    font-weight: 900;
    line-height: 0.9;
    color: var(--orange-dark);
    font-family: var(--font-head);
    letter-spacing: 2px;
}

/* Hide on very small mobile screens to prevent blocking game UI */
@media (max-width: 600px) {
    #persistent-join-info {
        transform: scale(0.7);
        bottom: 10px;
        right: 10px;
    }
}
/* === NEW: CATEGORY BADGE === */
.badge-category {
    display: inline-block;
    background: var(--secondary);
    color: white;
    font-size: 0.8rem;
    font-weight: 900;
    padding: 2px 8px;
    border-radius: 4px;
    text-transform: uppercase;
    margin-left: 10px;
    vertical-align: middle;
}
/* === FLOATING SETUP BUTTON === */
.floating-setup-bar {
    position: fixed;
    bottom: 200px;
    left: 75%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 150px;
    z-index: 100;
    animation: slideUp 0.5s ease-out;
}
/* Report Colors */
.acc-high { color: #27ae60; font-weight: 900; } /* Green */
.acc-med { color: #f39c12; font-weight: 900; } /* Yellow/Orange */
.acc-low { color: #c0392b; font-weight: 900; } /* Red */

/* Sort Header */
.sort-header { 
    cursor: pointer; 
    user-select: none; 
    display: flex; 
    align-items: center; 
    gap: 5px; 
}
.sort-header:hover { color: var(--primary); }

/* ========================================= */
/* === PROJECTOR LOBBY (CONSOLIDATED) === */
/* ========================================= */

/* 1. Main Overlay (Dark transparent to see field) */
.lobby-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.4); 
    z-index: 100;
    
    display: block; /* SWITCH TO BLOCK to respect margins */
    text-align: center; /* Center text horizontally */
    
    /* Remove padding if we use margin on children */
    padding-top: 0; 
}

/* Ensure Pitch is visible underneath */
#view-projector .pitch-container {
    display: block !important; 
    z-index: 0;
}

/* 2. Header Info (Big QR) */
/* === PROJECTOR LOBBY SPECIFIC === */
.lobby-header-info {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 40px;
    width: 100%;
    height: 100%;
    
    /* Push content down slightly */
    padding-top: 20px; 
    box-sizing: border-box; /* Ensures padding doesn't break height */
}
.lobby-qr-big {
    width: 120px; height: 120px;
    border: 4px solid white; border-radius: 10px; background: white;
}
.lobby-url-text {
    font-size: 4rem; /* Even Bigger */
    font-weight: 900;
    font-family: var(--font-head);
    
    /* Transparent Background */
    color: var(--neon); /* Neon Yellow Text */
    text-shadow: 
        0 0 10px rgba(0,0,0,0.8), /* Glow */
        2px 2px 0px #000;         /* Outline */
    
    background: transparent;
    padding: 0;
    border-radius: 0;
    box-shadow: none;
    
    line-height: 1;
    margin-top: 5px;
}
.lobby-code-text {
    font-size: 4rem; color: white; font-family: var(--font-head); line-height: 1;
}

/* 3. Split Container */
.lobby-split-container {
    display: flex;
    width: 95%; height: 55vh;
    margin: 0 auto; gap: 20px;
    align-items: flex-start;
}

/* 4. Team Columns (Glassmorphism) */
.lobby-team-col {
    flex: 1;
    background: rgba(255, 255, 255, 0.85); /* Milky Glass */
    backdrop-filter: blur(10px);
    border: 4px solid white;
    border-radius: 20px;
    padding: 15px;
    display: flex; flex-direction: column;
    min-height: 400px; max-height: 70vh;
    overflow-y: auto;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.lobby-team-header {
    font-family: var(--font-head);
    font-size: 2.5rem;
    color: #2d3436; /* Dark Text */
    text-shadow: none;
    margin-bottom: 20px;
    text-transform: uppercase;
    border-bottom: 3px solid rgba(0,0,0,0.1);
    padding-bottom: 10px;
}

/* Team Specific Tints */
.lobby-team-col.home-col { background: rgba(255, 230, 230, 0.9); border-top: 10px solid var(--home); }
.lobby-team-col.away-col { background: rgba(230, 250, 255, 0.9); border-top: 10px solid var(--away); }
.lobby-team-col.pending-col { background: rgba(240, 240, 240, 0.9); border-top: 10px solid #7f8c8d; }

/* 5. Player Grid */
.lobby-team-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr); 
    gap: 15px; width: 100%;
}

.lobby-card {
    background: white; padding: 10px; border-radius: 15px;
    text-align: center; font-size: 0.9rem; font-weight: 900;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    display: flex; flex-direction: column; align-items: center;
    animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    width: 100% !important; box-sizing: border-box;
}

.lobby-card img {
    width: 70px !important; height: 70px !important;
    object-fit: contain; border-radius: 50%;
    border: 3px solid #dfe6e9; margin-bottom: 5px;
    background: #f1f2f6;
}
/* === SOLID BACKGROUNDS FIX === */
#overlay-paused {
    background: #000000 !important; /* Solid Black */
    opacity: 1 !important;
}

#proj-celebration-overlay {
    background: #1a0b2e !important; /* Solid Theme Dark Purple */
    opacity: 1 !important;
}

/* Import Modal Styles */
textarea:focus {
    border-color: var(--primary);
    outline: none;
}
/* === INTRO SEQUENCE === */
#proj-intro-overlay {
    background: radial-gradient(circle, #2c3e50 0%, #000000 100%);
    z-index: 5000;
}

.intro-title {
    font-size: 6rem;
    color: var(--neon);
    text-shadow: 0 0 30px var(--neon);
    animation: pulse 0.5s infinite;
}

.intro-avatar-box {
    width: 200px;
    height: 200px;
    margin: 30px auto;
    border: 10px solid white;
    border-radius: 50%;
    background: white;
    overflow: hidden;
    box-shadow: 0 0 50px white;
}

.intro-avatar-box img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.intro-player-name {
    font-size: 3rem;
    color: white;
    font-family: var(--font-head);
    margin-top: 10px;
}
/* ============================================================================= */
/* === MOBILE & TABLET OPTIMIZATION === */
/* ============================================================================= */

/* --- TABLET / SMALL DESKTOP (Max Width: 1024px) --- */
@media (max-width: 1024px) {
    /* Adjust Projector Lobby for smaller screens */
    .lobby-split-container {
        width: 98%;
        gap: 10px;
    }
    .lobby-team-col {
        min-height: 300px;
        padding: 10px;
    }
    .lobby-team-grid {
        grid-template-columns: repeat(2, 1fr); /* 2 per row instead of 3 */
    }
    
    /* Make Pitch smaller on tablets */
    .pitch-container, .mini-pitch {
        height: 40vh; 
    }
}

/* --- MOBILE PHONES (Max Width: 600px) --- */
@media (max-width: 600px) {
    
    /* ... (Keep your Login Screen styles) ... */

    /* 2. ACTIVE GAME UI */
    #client-active-game-ui {
        width: 100%;
        padding: 0;
        box-shadow: none;
        border: none;
    }
    
    #client-active-game-ui .card {
        border-radius: 0;
        min-height: 100vh;
        display: flex;
        flex-direction: column;
        padding: 10px; /* Reduced padding */
    }

    /* === FIXED: STICKY STATS BAR === */
    .player-stats-bar {
        position: sticky;
        top: 0;
        z-index: 100;
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(5px);
        margin: 0 -10px 10px -10px; /* Stretch to edges */
        padding: 10px;
        border-bottom: 1px solid #dfe6e9;
        box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    }

    .stat-value { font-size: 1.4rem; }
    .stat-label { font-size: 0.7rem; }
    
    /* === FIXED: KEEP 2x2 GRID (Save Vertical Space) === */
    .options-grid {
        grid-template-columns: 1fr 1fr; /* Keep 2x2 */
        gap: 8px;
    }
    
    .option-btn {
        min-height: 80px; 
        font-size: 1rem;
        padding: 5px;
        word-break: break-word; /* Prevent text overflow */
    }

    /* Adjust Question Text */
    .client-persistent-question {
        font-size: 1rem;
        padding: 8px;
        margin-bottom: 10px;
    }

    /* Hide Footer Info on Mobile */
    #persistent-join-info {
        display: none !important;
    }
}
/* --- LANDSCAPE MOBILE (Rotated Phone) --- */
@media (max-width: 900px) and (orientation: landscape) {
    /* Force scrolling if height is small */
    .view-section {
        justify-content: flex-start;
        padding-top: 20px;
        height: auto;
        min-height: 100vh;
        overflow-y: auto;
    }
    
    .client-pitch-box {
        height: 200px; /* Shrink pitch in landscape */
    }
}
/* === PROJECTOR SCALING FIXES === */

/* 1. Ensure Header stays visible */
.celebration-header {
    margin-top: 2vh; /* Use viewport height, not pixels */
    margin-bottom: 2vh;
    animation: slideUp 0.5s ease-out;
    width: 100%;
    display: flex;
    justify-content: center;
}

.winner-title {
    font-family: var(--font-head);
    
    /* FIX: Use clamp(MIN, PREFERRED, MAX) */
    font-size: clamp(3rem, 8vw, 6rem); 
    
    color: var(--neon);
    text-shadow: 0 0 30px rgba(249, 202, 36, 0.8), 4px 4px 0 black;
    margin-bottom: 1vh;
    line-height: 1;
}

/* 3. Ensure Podium fits */
.podium-container {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 2vw;
    height: 45vh; /* Fixed percentage of screen height */
    margin-top: 2vh;
}

/* 4. Fix Projector Padding overlap */
#projector-lobby {
    padding-top: 15vh !important; /* Dynamic padding */
}
/* === PROJECTOR SCALING FIXES === */
.celebration-header {
    margin-top: 2vh; 
    margin-bottom: 2vh;
    animation: slideUp 0.5s ease-out;
    width: 100%;
    display: flex;
    justify-content: center;
}

.winner-title {
    font-family: var(--font-head);
    font-size: clamp(3rem, 8vw, 6rem); /* Modern responsive font sizing */
    color: var(--neon);
    text-shadow: 0 0 30px rgba(249, 202, 36, 0.8), 4px 4px 0 black;
    margin-bottom: 1vh;
    line-height: 1;
}

.podium-container {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 2vw;
    height: 45vh; 
    margin-top: 2vh;
}

#projector-lobby {
    padding-top: 15vh !important; 
}

/* === MOBILE FIXES === */
@media (max-width: 600px) {
    .player-stats-bar {
        position: sticky;
        top: 0;
        z-index: 100;
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(5px);
        margin: 0 -10px 10px -10px;
        padding: 10px;
        border-bottom: 1px solid #dfe6e9;
        box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    }
    
    .options-grid {
        grid-template-columns: 1fr 1fr; /* Force 2x2 grid */
        gap: 8px;
    }
}
/* === EDITABLE GAME CODE STYLES === */
.code-edit-container {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-bottom: 3px dashed var(--primary); /* Dashed line implies editability */
    padding-bottom: 5px;
    cursor: pointer;
    transition: all 0.2s;
}

.code-edit-container:hover {
    border-bottom-color: var(--orange);
    transform: scale(1.05);
}

.editable-code {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    width: 140px !important;
    font-size: 3rem !important;
    color: var(--orange-dark) !important;
    font-family: var(--font-head);
    text-transform: uppercase;
    text-align: right; /* Aligns with icon */
    padding: 0 !important;
    margin: 0 !important;
}

.edit-icon {
    font-size: 1.5rem;
    margin-left: 10px;
    animation: bounceIn 1s;
}

.code-display-box {
    /* Updated container style */
    background: #f1f2f6;
    border: 1px solid #dfe6e9;
    box-shadow: inset 0 0 20px rgba(0,0,0,0.05);
}
/* ========================================= */
/* === CLEAN DASHBOARD REPORT STYLES === */
/* ========================================= */

/* 1. Toggle Switch (Segmented Control) */
.segmented-control {
    background: #e0e0e0;
    padding: 4px;
    border-radius: 30px;
    display: flex;
    position: relative;
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.1);
}

.segmented-btn {
    padding: 8px 25px;
    border-radius: 25px;
    border: none;
    background: transparent;
    color: #7f8c8d;
    font-weight: 900;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 2;
    width: 140px; /* Fixed width for alignment */
    text-align: center;
}

.segmented-btn.active {
    background: white;
    color: var(--primary);
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

/* 2. Questions Sidebar (Heatmap Style) */
#report-questions-list {
    padding-right: 10px;
}

.report-q-card {
    border: none;
    border-left: 6px solid #bdc3c7; /* Default gray bar */
    background: white;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    transition: all 0.2s;
    padding: 12px 15px;
    border-radius: 8px;
    margin-bottom: 8px;
    cursor: pointer;
}

/* Heatmap Colors */
.q-card-high { border-left-color: var(--grass); background: #f0fff4; } /* > 80% */
.q-card-med  { border-left-color: var(--orange); } /* 50-80% */
.q-card-low  { border-left-color: var(--home); background: #fff5f5; } /* < 50% */

.report-q-card:hover {
    transform: translateX(5px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.report-q-card.active-card {
    border: 3px solid var(--primary);
    border-left-width: 8px;
    transform: scale(1.02);
}

/* 3. Student League Table */
#report-students-list {
    background: white;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.05);
    border: 1px solid #eee;
    padding: 0;
    overflow: hidden; /* For rounded corners */
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* Header Row */
.league-header {
    display: grid; 
    grid-template-columns: 50px 1fr auto; 
    padding: 15px; 
    background: var(--primary); 
    color: white; 
    font-weight: 900; 
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Data Rows */
.report-student-row {
    padding: 12px 15px;
    border-bottom: 1px solid #f1f2f6;
    display: grid;
    grid-template-columns: 50px 1fr auto; /* Rank | Name | Score */
    align-items: center;
    transition: background 0.2s;
}

.report-student-row:nth-child(even) { background: #fcfcfc; }
.report-student-row:hover { background: #ecf0f1; }

/* Rank Badge */
.rank-badge {
    font-family: var(--font-head);
    color: #bdc3c7;
    font-size: 1.1rem;
    width: 30px;
    text-align: center;
}
/* Top 3 Colors */
.rank-1 { color: #f1c40f; text-shadow: 0 1px 0 rgba(0,0,0,0.1); font-size: 1.3rem; }
.rank-2 { color: #95a5a6; }
.rank-3 { color: #cd7f32; }

/* === MUSIC PLAYER STYLES === */
.music-player-panel {
    background: #f8f9fa;
    border: 2px solid #bdc3c7;
    box-shadow: 0 4px 0 rgba(0,0,0,0.05);
}

.music-player-panel input[type=range] {
    cursor: pointer;
    background: #dfe6e9;
    border: none;
    border-radius: 5px;
    height: 6px;
    padding: 0; /* Override default input padding */
}

.music-player-panel input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    height: 16px;
    width: 16px;
    border-radius: 50%;
    background: var(--primary);
    margin-top: -5px; /* Alignment fix */
}
/* ========================================= */
/* === MODAL STACKING FIX === */
/* ========================================= */

/* 
   The Report Card is at 99999. 
   We must force the Alert/Confirm boxes to be higher (100000+) 
   so they appear ON TOP of the Report Card when deleting archives.
*/
#custom-modal-overlay, 
#custom-alert-overlay {
    z-index: 100001 !important;
}
/* === SPECTATOR REACTION UI === */
.reaction-btn {
    font-size: 2.5rem;
    background: white;
    border: 2px solid #dfe6e9;
    border-radius: 50%;
    width: 70px;
    height: 70px;
    cursor: pointer;
    box-shadow: 0 4px 0 rgba(0,0,0,0.1);
    transition: transform 0.1s;
    padding: 0;
    line-height: 1;
}

.reaction-btn:active {
    transform: scale(0.9);
    background: #f1f2f6;
    box-shadow: 0 2px 0 rgba(0,0,0,0.1);
}

/* Floating Emoji Animation (Projector) */
.floating-reaction {
    position: fixed;
    bottom: -50px;
    font-size: 4rem;
    pointer-events: none;
    z-index: 9999;
    animation: floatUp 3s ease-in forwards;
}

@keyframes floatUp {
    0% { transform: translateY(0) scale(0.5); opacity: 0; }
    10% { opacity: 1; }
    100% { transform: translateY(-80vh) scale(1.5) rotate(20deg); opacity: 0; }
}
/* Floating Emoji Animation (Projector) */
.floating-reaction {
    position: fixed;
    bottom: -50px;
    font-size: 5rem; /* Bigger */
    pointer-events: none;
    z-index: 2147483647 !important; /* Max possible Z-Index */
    animation: floatUp 4s ease-in forwards;
    text-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

@keyframes floatUp {
    0% { transform: translateY(0) scale(0.5); opacity: 0; }
    10% { opacity: 1; }
    100% { transform: translateY(-80vh) scale(1.5) rotate(20deg); opacity: 0; }
}
.ball {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    position: absolute;
    bottom: 20%;
    left: 50%;
    transform: translateX(-50%);
    z-index: 12;
    background: transparent;
    border: none;
    box-shadow: 0 5px 15px rgba(0,0,0,0.5); /* Drop Shadow */
    
    /* Center the Emoji */
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px; /* Match width */
    line-height: 30px;
    transition: all 1s cubic-bezier(0.25, 1, 0.5, 1);
}

.ball::after {
    content: "⚽";
    display: block;
    width: 100%;
    height: 100%;
}
/* === CLIENT CONFETTI === */
.confetti-piece {
    position: fixed;
    width: 10px;
    height: 10px;
    background-color: #f1c40f;
    top: -10px;
    z-index: 9999;
    animation: fall 2.5s linear forwards;
}

@keyframes fall {
    0% { transform: translateY(0) rotate(0deg); opacity: 1; }
    100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

/* === DECK MANAGER === */
.deck-item {
    background: white;
    padding: 10px;
    margin-bottom: 8px;
    border-radius: 8px;
    border: 1px solid #dfe6e9;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s;
    cursor: pointer;
}

.deck-item:hover {
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.deck-item.disabled {
    opacity: 0.5;
    background: #f1f2f6;
    border-style: dashed;
}

.deck-q-text {
    font-weight: bold;
    font-size: 0.9rem;
    color: #2d3436;
}

.deck-check {
    font-size: 1.2rem;
    color: var(--grass);
}

.deck-item.disabled .deck-check {
    color: #bdc3c7;
    content: "❌"; /* We will swap text via JS logic */
}
/* === TOOLTIP STYLES === */
/* Only show when body has class 'tooltips-on' */
body.tooltips-on [data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 110%; /* Show above button */
    left: 50%;
    transform: translateX(-50%);
    background: #2d3436;
    color: #f1c40f;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-family: var(--font-body);
    font-weight: bold;
    white-space: nowrap;
    z-index: 1000;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    pointer-events: none;
    border: 1px solid #f1c40f;
    animation: fadeIn 0.2s;
}

/* Tiny triangle arrow below tooltip */
body.tooltips-on [data-tooltip]:hover::before {
    content: "";
    position: absolute;
    bottom: 100%; /* Touch bottom of tooltip */
    left: 50%;
    transform: translateX(-50%);
    border-width: 6px;
    border-style: solid;
    border-color: #2d3436 transparent transparent transparent;
    z-index: 1000;
}
/* === SHOOTOUT TOGGLE COLORS === */

/* 1. Unchecked State (CLASS VOTE) -> Blue */
#setup-toggle-shootout:not(:checked) + .slider,
#toggle-shootout-mode:not(:checked) + .slider {
    background-color: var(--primary); /* Blue */
    box-shadow: inset 0 0 5px rgba(0,0,0,0.2);
}

/* 2. Checked State (1v1 DUEL) -> Orange */
#setup-toggle-shootout:checked + .slider,
#toggle-shootout-mode:checked + .slider {
    background-color: #e67e22; /* Darker Orange */
}

/* Optional: Add icons or text inside the knob for extra clarity */
#setup-toggle-shootout:not(:checked) + .slider:before,
#toggle-shootout-mode:not(:checked) + .slider:before {
    /* Optional: You could add content here if you wanted, 
       but the color change is usually enough. */
    background-color: white; 
}
/* === NET RIPPLE ANIMATION === */
@keyframes netRipple {
    0% { 
        transform: scaleY(1) scaleX(1); 
    }
    10% { 
        transform: scaleY(1.2) scaleX(0.92) translateY(5px); 
    }
    25% { 
        transform: scaleY(0.9) scaleX(1.08) skewX(5deg); 
    }
    40% { 
        transform: scaleY(1.12) scaleX(0.96) skewX(-4deg); 
    }
    55% { 
        transform: scaleY(0.95) scaleX(1.04) skewX(3deg); 
    }
    70% { 
        transform: scaleY(1.05) scaleX(0.98) skewX(-2deg); 
    }
    85% { 
        transform: scaleY(0.98) scaleX(1.02) skewX(1deg); 
    }
    100% { 
        transform: scaleY(1) scaleX(1) skewX(0deg); 
    }
}

#view-projector .goal.ripple {
    animation: netRipple 1.5s ease-out;
    transform-origin: top center;
}
/* === GOALKEEPER BLOCK ANIMATION === */
@keyframes goalkeeperBlock {
    0% { 
        transform: translateX(-50%) scale(1); 
    }
    15% { 
        transform: translateX(-50%) scale(3); 
    }
    35% { 
        transform: translateX(-50%) scale(2.5); 
    }
    55% { 
        transform: translateX(-50%) scale(2.8); 
    }
    75% { 
        transform: translateX(-50%) scale(2.2); 
    }
    100% { 
        transform: translateX(-50%) scale(1); 
    }
}

#view-projector .goalkeeper.block-power {
    animation: goalkeeperBlock 1.5s ease-out;
    z-index: 50;
}

/* Override dive animations when block-power is active */
#view-projector .goalkeeper.dive-left.block-power {
    animation: goalkeeperBlock 1.5s ease-out;
    left: 34%;
    top: 11%;
    transform: translateX(-50%) rotate(-15deg);
    z-index: 50;
}

#view-projector .goalkeeper.dive-center.block-power {
    animation: goalkeeperBlock 1.5s ease-out;
    left: 50%;
    top: 10%;
    transform: translateX(-50%);
    z-index: 50;
}

#view-projector .goalkeeper.dive-right.block-power {
    animation: goalkeeperBlock 1.5s ease-out;
    left: 67%;
    top: 11%;
    transform: translateX(-50%) rotate(15deg);
    z-index: 50;
}

/* Ball stays in front of goalkeeper during block */
#view-projector .ball[class*="kick-"] {
    z-index: 100 !important;
}
