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

:root {
    --purple: #6a11cb;
    --blue: #2575fc;
    --red: #ff416c;
    --orange: #ff4b2b;
    --green: #00b09b;
    --yellow: #f8b500;
    
    --bg-dark: #0f172a;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

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

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
}

.app-mode {
    overflow: hidden;
    height: 100dvh; /* Use dynamic viewport height for mobile */
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg-dark);
    /* Dynamic premium gradient background */
    background: linear-gradient(-45deg, #1f005c, #5b0060, #870160, #ac255e, #ca485c, #e16b5c, #f39060, #ffb56b);
    background-size: 400% 400%;
    animation: gradientBG 20s ease infinite;
    color: var(--text-main);
    display: flex;
    flex-direction: column;
}

@keyframes gradientBG {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

h1, h2, h3, h4 {
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    letter-spacing: -0.5px;
}

h1 { font-size: 3.5rem; text-shadow: 0 4px 20px rgba(0,0,0,0.4); margin-bottom: 20px;}
h2 { font-size: 2.2rem; margin-bottom: 15px;}

/* Glassmorphism Containers */
.container {
    max-width: 900px;
    margin: 20px auto;
    padding: 30px;
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    box-shadow: var(--glass-shadow);
    color: white;
}

/* Base Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 14px 28px;
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 1.1rem;
    color: white;
    background: linear-gradient(135deg, var(--purple) 0%, var(--blue) 100%);
    border: none;
    border-radius: 12px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.25, 1.5, 0.5, 1);
    box-shadow: 0 4px 15px rgba(106, 17, 203, 0.4);
}

.btn:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 8px 25px rgba(106, 17, 203, 0.6);
}
.btn:active { transform: translateY(1px); }

.btn-green { background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%); box-shadow: 0 4px 15px rgba(56, 239, 125, 0.4); }
.btn-green:hover { box-shadow: 0 8px 25px rgba(56, 239, 125, 0.6); }

.btn-red { background: linear-gradient(135deg, #ff416c 0%, #ff4b2b 100%); box-shadow: 0 4px 15px rgba(255, 65, 108, 0.4); }
.btn-red:hover { box-shadow: 0 8px 25px rgba(255, 65, 108, 0.6); }

.btn-large {
    width: 100%;
    padding: 18px;
    font-size: 1.4rem;
    border-radius: 16px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Forms */
.form-group { margin-bottom: 20px; }
.form-group label { display: block; font-weight: 500; margin-bottom: 8px; font-size: 1rem; color: #e2e8f0; }
input[type="text"], input[type="number"], select {
    width: 100%;
    padding: 16px 20px;
    font-family: 'Inter', sans-serif;
    font-size: 1.1rem;
    color: white;
    background: rgba(0, 0, 0, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    outline: none;
    transition: all 0.3s ease;
}
input::placeholder { color: rgba(255, 255, 255, 0.5); }
input:focus, select:focus {
    border-color: var(--blue);
    background: rgba(0, 0, 0, 0.4);
    box-shadow: 0 0 0 4px rgba(37, 117, 252, 0.2);
}
select option { background: var(--bg-dark); color: white; }

/* Tables */
.choice-table { width: 100%; border-collapse: collapse; margin-top: 10px; }
.choice-table th, .choice-table td { border: 1px solid rgba(255,255,255,0.1); padding: 12px; text-align: left; }
.choice-table th { background: rgba(0,0,0,0.3); font-weight: bold; }

/* Lists and Cards */
.quiz-list { list-style: none; display: flex; flex-direction: column; gap: 15px; }
.quiz-list li {
    background: rgba(255,255,255,0.08);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.1);
    padding: 20px 25px;
    border-radius: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: transform 0.2s ease, background 0.2s ease;
}
.quiz-list li:hover {
    background: rgba(255,255,255,0.15);
    transform: translateX(5px);
}
.quiz-title { font-size: 1.3rem; font-weight: 700; font-family: 'Outfit'; }

/* Layouts */
.admin-header {
    background: rgba(0,0,0,0.3);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255,255,255,0.1);
    padding: 20px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.admin-header h1 { margin: 0; font-size: 2rem; }

/* Game Pad & Screens */
.screen { 
    display: none; 
    flex: 1;
    width: 100%; 
    flex-direction: column; 
    justify-content: center; 
    align-items: center; 
    padding: 20px; 
    box-sizing: border-box; 
    overflow-y: auto;
}
.active { display: flex; animation: fadeIn 0.5s ease-out forwards; }

@keyframes fadeIn { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }

.game-pad {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 15px;
    width: 100%;
    height: 100%;
    max-height: 800px;
    max-width: 800px;
    padding: 15px;
}
.pad-btn {
    border: none;
    border-radius: 20px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 10px 0 rgba(0,0,0,0.3), inset 0 2px 10px rgba(255,255,255,0.4);
    transition: all 0.1s;
    position: relative;
    overflow: hidden;
}
.pad-btn::after {
    content: ''; position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(180deg, rgba(255,255,255,0.2) 0%, transparent 50%);
    pointer-events: none;
}
.pad-btn:active {
    transform: translateY(10px);
    box-shadow: 0 0 0 rgba(0,0,0,0.3), inset 0 2px 10px rgba(255,255,255,0.2);
}

.bg-red { background-color: #ff3333; }
.bg-blue { background-color: #3366ff; }
.bg-yellow { background-color: #ffcc00; }
.bg-green { background-color: #00cc66; }

.shape-icon { width: 80px; height: 80px; background-color: white; box-shadow: 0 4px 10px rgba(0,0,0,0.2);}
.shape-triangle { clip-path: polygon(50% 0%, 0% 100%, 100% 100%); }
.shape-diamond { transform: rotate(45deg); }
.shape-circle { border-radius: 50%; }

/* Host Views */
.pin-display {
    font-size: 4rem;
    font-family: 'Outfit';
    font-weight: 900;
    letter-spacing: 6px;
    background: rgba(255,255,255,0.9);
    color: var(--bg-dark);
    padding: 15px 45px;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    margin: 20px 0;
    display: inline-block;
    animation: pulse 2s infinite;
}
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.players-grid { display: flex; flex-wrap: wrap; gap: 15px; justify-content: center; margin-top: 40px; }
.player-badge {
    background: rgba(255,255,255,0.15);
    backdrop-filter: blur(10px);
    padding: 12px 24px;
    font-size: 1.5rem;
    font-weight: 700;
    border-radius: 50px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    border: 1px solid rgba(255,255,255,0.2);
    animation: slideUp 0.4s ease-out;
    align-items: center;
    justify-content: space-between;
}
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

/* Question text */
.question-text {
    font-size: 4rem;
    font-weight: 900;
    text-shadow: 0 4px 15px rgba(0,0,0,0.5);
    margin-bottom: 50px;
    line-height: 1.2;
}

/* Emojis */
.emoji-picker { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-bottom: 20px; }
.emoji-btn { font-size: 30px; background: rgba(255,255,255,0.1); border: 2px solid transparent; border-radius: 50%; width: 50px; height: 50px; cursor: pointer; transition: 0.2s; }
.emoji-btn.selected { border-color: var(--purple); background: white; transform: scale(1.1); }
.emoji-btn:hover { background: rgba(255,255,255,0.2); }

/* Live Reactions */
.reaction-bar { display: flex; justify-content: center; gap: 15px; margin-top: 30px; }
.reaction-btn { font-size: 50px; background: rgba(255,255,255,0.2); border: none; border-radius: 50%; width: 80px; height: 80px; cursor: pointer; transition: 0.2s; box-shadow: 0 4px 10px rgba(0,0,0,0.2); }
.reaction-btn:hover { background: rgba(255,255,255,0.4); transform: translateY(-5px); }
.reaction-btn:active { transform: scale(0.9); }

.floating-emoji {
    position: fixed;
    bottom: -50px;
    font-size: 60px;
    pointer-events: none;
    animation: floatUp 3s ease-out forwards;
    z-index: 1000;
}
.floating-emoji-name {
    font-size: 16px;
    background: rgba(0,0,0,0.5);
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    position: absolute;
    bottom: -20px;
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
}

@keyframes floatUp {
    0% { transform: translateY(0) scale(0.8); opacity: 0; }
    20% { transform: translateY(-20vh) scale(1.2); opacity: 1; }
    80% { transform: translateY(-60vh) scale(1); opacity: 1; }
    100% { transform: translateY(-80vh) scale(0.8); opacity: 0; }
}

/* Navigation */
.navbar {
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 10px 30px;
    display: flex;
    justify-content: center;
    gap: 30px;
    position: sticky;
    top: 0;
    z-index: 1000;
}
.navbar a {
    color: var(--text-main);
    text-decoration: none;
    font-weight: 600;
    font-size: 1.1rem;
    transition: color 0.2s ease, transform 0.2s ease;
}
.navbar a:hover {
    color: var(--yellow);
    transform: translateY(-2px);
}

/* Choices Grid on Host */
.choices-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; width: 100%; max-width: 1200px; margin: 0 auto; }
.choice-card {
    display: flex;
    align-items: center;
    padding: 30px;
    font-size: 2.2rem;
    font-weight: 700;
    color: white;
    border-radius: 20px;
    box-shadow: 0 8px 0 rgba(0,0,0,0.2), inset 0 2px 10px rgba(255,255,255,0.3);
    position: relative;
}
.choice-card .shape-icon { width: 50px; height: 50px; margin-right: 30px; }

/* Leaderboard */
.leaderboard-row {
    display: flex;
    justify-content: space-between;
    font-size: 2rem;
    font-weight: 800;
    padding: 20px 40px;
    background: rgba(255,255,255,0.1);
    border-radius: 16px;
    margin-bottom: 15px;
    border: 1px solid rgba(255,255,255,0.2);
    backdrop-filter: blur(10px);
}
.leaderboard-row:nth-child(1) { background: linear-gradient(90deg, #FFD700 0%, #FDB931 100%); color: #333; transform: scale(1.05); border: none; box-shadow: 0 10px 20px rgba(255, 215, 0, 0.3);}
.leaderboard-row:nth-child(2) { background: linear-gradient(90deg, #C0C0C0 0%, #E8E8E8 100%); color: #333; transform: scale(1.02); border: none; }
.leaderboard-row:nth-child(3) { background: linear-gradient(90deg, #cd7f32 0%, #e6a267 100%); color: #333; border: none; }

.status-msg { font-size: 1.8rem; font-weight: 500; opacity: 0.9; margin-top: 20px; }
