:root {
    --primary: #379583;
    --primary-dark: #2A6B62;
    --primary-light: #52B788;
    --primary-pale: #95D5B2;
    --primary-tint: #E8F5F0;
    --bg: #F0FAF7;
    --text-dark: #1B3A2F;
    --text-muted: #5A7A70;
    --alert: #E76F51;
    --accent: #52B788;
    --white: #FFFFFF;
    --shadow: 0 4px 20px rgba(55, 149, 131, 0.15);
    --shadow-lg: 0 8px 40px rgba(55, 149, 131, 0.2);
    --radius: 12px;
    --radius-lg: 20px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --glass-bg: rgba(255, 255, 255, 0.72);
    --glass-border: rgba(255, 255, 255, 0.3);
    --nature-1: #1a4731;
    --nature-2: #245a3d;
    --nature-3: #379583;
    --nature-4: #52B788;
    --nature-5: #95D5B2;
    --coral: #E76F51;
    --gold: #F4A261;
    --ocean: #2196F3;
}

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

html, body {
    font-family: 'Nunito', sans-serif;
    background: var(--bg);
    color: var(--text-dark);
    min-height: 100vh;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 12px 24px; border: none; border-radius: var(--radius);
    font-family: 'Nunito', sans-serif; font-weight: 700; font-size: 16px;
    cursor: pointer; transition: var(--transition); text-decoration: none;
}
.btn:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--primary); color: var(--white); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--white); color: var(--primary); border: 2px solid var(--primary); }
.btn-secondary:hover { background: var(--primary-tint); }
.btn-accent { background: var(--accent); color: var(--white); }
.btn-accent:hover { background: var(--primary-light); }
.btn-danger { background: var(--alert); color: var(--white); }
.btn-danger:hover { background: #d4604a; }
.btn-outline { background: transparent; color: var(--primary); border: 2px solid var(--primary-pale); }
.btn-outline:hover { background: var(--primary-tint); }
.btn-large { padding: 16px 32px; font-size: 18px; border-radius: var(--radius-lg); }
.btn-full { width: 100%; }
.btn-nav { background: var(--primary); color: var(--white); padding: 14px 28px; font-size: 18px; flex: 1; }
.btn-icon { font-size: 20px; }
.btn-small { padding: 6px 14px; font-size: 13px; }

.form-input {
    width: 100%; padding: 14px 18px; border: 2px solid var(--primary-pale);
    border-radius: var(--radius); font-family: 'Nunito', sans-serif; font-size: 16px;
    background: var(--white); color: var(--text-dark); transition: var(--transition);
}
.form-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px rgba(55, 149, 131, 0.15); }
.form-group { margin-bottom: 20px; }
.form-group label { display: block; font-weight: 700; margin-bottom: 6px; color: var(--text-dark); }
.form-hint { display: block; font-size: 13px; color: var(--text-muted); margin-top: 4px; }
.form-error { background: #FEF2F2; color: var(--alert); padding: 12px; border-radius: var(--radius); margin-bottom: 16px; font-weight: 600; }
.form-textarea { min-height: 100px; resize: vertical; }

/* ==================== HOME PAGE ==================== */
.home-page {
    min-height: 100vh;
    background: linear-gradient(135deg, var(--bg) 0%, var(--primary-tint) 30%, #c8e6d0 60%, var(--primary-pale) 100%);
    position: relative; overflow: hidden;
}
.home-nav { position: absolute; top: 20px; right: 20px; z-index: 100; }
.nav-btn {
    display: inline-flex; align-items: center; gap: 6px; padding: 10px 20px;
    background: rgba(255,255,255,0.95); color: var(--primary); text-decoration: none;
    border-radius: 30px; font-weight: 700; font-size: 14px;
    box-shadow: 0 2px 10px rgba(55,149,131,0.15); transition: all 0.3s;
}
.nav-btn:hover { background: var(--primary); color: white; transform: translateY(-2px); box-shadow: 0 4px 20px rgba(55,149,131,0.3); }

.home-particles { position: absolute; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; z-index: 0; overflow: hidden; }
.particle {
    position: absolute; font-size: 24px; opacity: 0.35;
    animation: particleFloat 5s ease-in-out infinite; pointer-events: none; will-change: transform;
}
@keyframes particleFloat {
    0%, 100% { transform: translateY(0) rotate(0deg) scale(1); opacity: 0.3; }
    50% { transform: translateY(-30px) rotate(15deg) scale(1.1); opacity: 0.6; }
}

.home-container {
    position: relative; z-index: 10; display: flex; flex-direction: column;
    align-items: center; justify-content: center; min-height: 100vh;
    padding: 40px 20px; text-align: center;
}
.home-logo { margin-bottom: 16px; }
.logo-img { width: 100px; height: 100px; animation: gentleFloat 4s ease-in-out infinite; }
@keyframes gentleFloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-12px); } }

.home-title {
    font-size: 52px; font-weight: 900; margin-bottom: 8px; letter-spacing: -1px;
    background: linear-gradient(135deg, var(--primary-dark), var(--primary-light));
    -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.home-subtitle { font-size: 18px; color: var(--text-muted); margin-bottom: 48px; }
.home-actions { display: flex; flex-direction: column; align-items: center; gap: 16px; width: 100%; max-width: 420px; }
.join-form-home { display: flex; gap: 10px; width: 100%; align-items: stretch; }
.join-form-home .input-code {
    flex: 1; padding: 16px 20px; border: 2px solid var(--primary-pale);
    border-radius: var(--radius); font-family: 'Nunito', sans-serif; font-size: 18px;
    font-weight: 700; text-transform: uppercase; letter-spacing: 3px; text-align: center;
    background: var(--white); color: var(--text-dark); min-width: 0; transition: var(--transition);
}
.join-form-home .input-code:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px rgba(55,149,131,0.15); }
.join-form-home .btn { padding: 16px 28px; white-space: nowrap; }
@media (max-width: 480px) {
    .home-title { font-size: 40px; }
    .home-subtitle { font-size: 16px; }
    .join-form-home { flex-direction: column; }
    .join-form-home .btn { width: 100%; }
}

/* ==================== JOIN PAGE (FANCY) ==================== */
.join-page {
    min-height: 100vh; display: flex; align-items: flex-start; justify-content: center;
    background: linear-gradient(135deg, #0d3320 0%, var(--nature-2) 30%, var(--nature-3) 60%, var(--nature-4) 100%);
    position: relative;
    padding: 20px 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
.join-page::before {
    content: ''; position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    background: radial-gradient(circle at 30% 70%, rgba(82, 183, 136, 0.3) 0%, transparent 60%),
                radial-gradient(circle at 70% 20%, rgba(55, 149, 131, 0.2) 0%, transparent 50%);
    pointer-events: none;
}
.join-page .particle-layer {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    pointer-events: none; overflow: hidden; z-index: 0;
}
.join-page .particle-layer span {
    position: absolute; font-size: 30px; opacity: 0.25;
    animation: leafDrift 8s ease-in-out infinite;
}
@keyframes leafDrift {
    0% { transform: translateY(100vh) rotate(0deg); opacity: 0.2; }
    50% { transform: translateY(50vh) rotate(180deg); opacity: 0.4; }
    100% { transform: translateY(-10vh) rotate(360deg); opacity: 0.1; }
}

.glass-card {
    background: var(--glass-bg); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border); border-radius: var(--radius-lg);
    padding: 40px; max-width: 460px; width: 100%; margin: 20px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.1); position: relative; z-index: 10;
    max-height: 90vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
.glass-card h1 { color: var(--white); text-shadow: 0 2px 10px rgba(0,0,0,0.2); }
.glass-card .form-subtitle { color: rgba(255,255,255,0.8); }
.glass-card .form-code { color: rgba(255,255,255,0.9); }
.glass-card .form-code strong { color: var(--white); }
.glass-card .form-input {
    background: rgba(10, 40, 25, 0.75); border-color: rgba(82, 183, 136, 0.5); color: var(--white);
}
.glass-card .form-input::placeholder { color: rgba(255,255,255,0.7); font-weight: 500; }
.glass-card .form-input:focus { border-color: var(--primary-light); box-shadow: 0 0 0 4px rgba(82, 183, 136, 0.3); background: rgba(10, 40, 25, 0.9); }
.glass-card .form-group label { color: rgba(255,255,255,0.9); }
.glass-card .form-error { background: rgba(255,255,255,0.15); color: #FFD4D4; border: 1px solid rgba(255,200,200,0.3); }

.join-code-display {
    font-size: 36px; font-weight: 900; letter-spacing: 8px; color: var(--white);
    text-align: center; margin: 16px 0; padding: 16px; border-radius: var(--radius);
    background: rgba(255,255,255,0.1); border: 2px dashed rgba(255,255,255,0.3);
    text-shadow: 0 0 20px rgba(82, 183, 136, 0.5);
}

.avatar-grid-fancy {
    display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; margin-top: 8px;
}
.avatar-btn-fancy {
    width: 48px; height: 48px; border-radius: 50%; border: 3px solid rgba(255,255,255,0.3);
    background: rgba(255,255,255,0.1); font-size: 24px; cursor: pointer; transition: var(--transition);
    display: flex; align-items: center; justify-content: center;
}
.avatar-btn-fancy:hover { border-color: var(--white); transform: scale(1.15) translateY(-4px); box-shadow: 0 4px 15px rgba(82,183,136,0.4); }
.avatar-btn-fancy.selected {
    border-color: var(--white); background: rgba(82,183,136,0.4); transform: scale(1.2);
    box-shadow: 0 0 0 4px rgba(255,255,255,0.3), 0 4px 20px rgba(82,183,136,0.5);
}

/* ==================== CREATE PAGE ==================== */
.create-page {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--bg) 0%, var(--primary-tint) 100%);
}
.form-container {
    background: var(--white); padding: 40px; border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg); max-width: 460px; width: 100%; margin: 20px;
}
.form-container h1 { font-size: 28px; font-weight: 900; color: var(--primary-dark); margin-bottom: 4px; }
.form-subtitle { color: var(--text-muted); margin-bottom: 24px; }
.form-code { font-size: 16px; color: var(--text-muted); margin-bottom: 16px; }
.form-code strong { font-size: 20px; letter-spacing: 3px; color: var(--primary); }
.form-logo { text-align: center; margin-bottom: 16px; }
.logo-img-small { width: 60px; height: 60px; }
.back-link { display: block; text-align: center; margin-top: 20px; color: var(--text-muted); text-decoration: none; font-weight: 600; }
.back-link:hover { color: var(--primary); }

/* ==================== PARTICIPANT ==================== */
.participant-page {
    min-height: 100vh; display: flex; flex-direction: column;
    background: linear-gradient(180deg, #0d3320 0%, #1a4731 40%, var(--nature-3) 100%);
    position: relative;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
.participant-page::before {
    content: ''; position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    background: radial-gradient(ellipse at 50% 0%, rgba(82,183,136,0.15) 0%, transparent 70%);
    pointer-events: none;
}

.p-topbar {
    background: var(--glass-bg); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--glass-border);
    padding: 10px 16px; display: flex; align-items: center; gap: 12px;
    position: sticky; top: 0; z-index: 100;
}

.p-avatar-ring {
    width: 40px; height: 40px; border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    display: flex; align-items: center; justify-content: center;
    font-size: 22px; box-shadow: 0 0 0 3px rgba(82,183,136,0.3);
    flex-shrink: 0;
}
.p-player-info { flex: 1; min-width: 0; }
.p-player-name { font-weight: 800; font-size: 14px; color: var(--nature-1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.p-score-box {
    display: flex; align-items: center; gap: 6px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    padding: 6px 14px; border-radius: 20px; color: var(--white);
}
.p-score-icon { font-size: 14px; }
.p-score-num { font-weight: 900; font-size: 18px; transition: var(--transition); }
.p-score-num.bump { animation: scoreBump 0.5s ease; }
@keyframes scoreBump {
    0% { transform: scale(1); }
    50% { transform: scale(1.4); color: #FFD700; }
    100% { transform: scale(1); }
}

.p-streak-badge {
    background: linear-gradient(135deg, #FF6B35, #F7931E);
    padding: 4px 12px; border-radius: 20px; color: white; font-weight: 800; font-size: 13px;
    display: flex; align-items: center; gap: 3px; animation: glowStreak 1.5s ease-in-out infinite;
}
@keyframes glowStreak {
    0%, 100% { box-shadow: 0 0 5px rgba(255,107,53,0.5); }
    50% { box-shadow: 0 0 15px rgba(255,107,53,0.8), 0 0 30px rgba(255,107,53,0.3); }
}

.p-badges-strip { display: flex; gap: 4px; overflow-x: auto; max-width: 120px; }
.p-badge-icon {
    width: 28px; height: 28px; border-radius: 50%;
    background: rgba(255,255,255,0.2); display: flex; align-items: center; justify-content: center;
    font-size: 16px; flex-shrink: 0; animation: badgeFloat 3s ease-in-out infinite;
}
@keyframes badgeFloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }

/* ==================== PARTICIPANT SLIDE AREA ==================== */
.p-slide-wrapper {
    flex: 1; display: flex; flex-direction: column; position: relative; z-index: 5;
    padding: 16px; max-width: 600px; margin: 0 auto; width: 100%;
}
.p-progress-bar { display: flex; gap: 4px; margin-bottom: 16px; overflow-x: auto; padding: 4px 0; }
.p-progress-dot {
    width: 10px; height: 10px; border-radius: 50%; background: rgba(255,255,255,0.3);
    flex-shrink: 0; transition: var(--transition);
}
.p-progress-dot.active { background: var(--primary-light); transform: scale(1.4); box-shadow: 0 0 8px rgba(82,183,136,0.6); }
.p-progress-dot.done { background: rgba(82,183,136,0.5); }
.p-progress-dot.activity { background: var(--gold); }

.p-slide-card {
    background: var(--glass-bg); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border); border-radius: var(--radius-lg);
    padding: 28px; min-height: 260px; box-shadow: 0 8px 32px rgba(0,0,0,0.15);
    animation: slideFadeIn 0.5s ease-out;
    max-height: 70vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
.p-slide-title {
    font-size: 26px; font-weight: 900; line-height: 1.3; margin-bottom: 16px;
    background: linear-gradient(135deg, var(--white), var(--primary-pale));
    -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.p-slide-title.shocking-text {
    background: linear-gradient(135deg, #FF6B6B, var(--coral)); -webkit-background-clip: text; background-clip: text;
}
.p-slide-body { font-size: 16px; line-height: 1.8; color: rgba(255,255,255,0.9); white-space: pre-line; }
.p-slide-image { max-width: 100%; border-radius: var(--radius); margin-bottom: 16px; box-shadow: 0 4px 20px rgba(0,0,0,0.2); }

.p-slide-card.shocking {
    background: linear-gradient(135deg, rgba(231,111,81,0.2), rgba(180,60,40,0.15)) !important;
    border-color: rgba(231,111,81,0.5) !important;
    box-shadow: 0 0 40px rgba(231,111,81,0.3), inset 0 0 40px rgba(231,111,81,0.05) !important;
    animation: shockPulse 2s ease-in-out infinite;
}
@keyframes shockPulse {
    0%, 100% { box-shadow: 0 0 40px rgba(231,111,81,0.4), inset 0 0 40px rgba(231,111,81,0.1); }
    50% { box-shadow: 0 0 60px rgba(231,111,81,0.6), inset 0 0 60px rgba(231,111,81,0.2); }
}

.p-slide-empty {
    text-align: center; padding: 60px 20px; color: rgba(255,255,255,0.6);
}
.p-slide-empty .empty-icon { font-size: 64px; margin-bottom: 12px; animation: gentleFloat 4s ease-in-out infinite; }
.p-slide-empty h2 { color: rgba(255,255,255,0.9); font-size: 24px; margin-bottom: 8px; }
.p-slide-empty p { color: rgba(255,255,255,0.6); }

/* ==================== ACTIVITY PANEL (PARTICIPANT) ==================== */
.activity-panel {
    margin-top: 16px; padding-top: 16px;
    border-top: 2px solid rgba(255,255,255,0.2);
    animation: actSlideUp 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}
@keyframes actSlideUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}
.activity-panel.activity-submitted { opacity: 0.5; pointer-events: none; }
.activity-title { font-size: 20px; font-weight: 800; color: var(--white); margin-bottom: 16px; }

/* Poll / Quiz Options */
.poll-options, .quiz-options { display: flex; flex-direction: column; gap: 10px; }
.poll-option, .quiz-option, .guess-option {
    padding: 16px; border: 2px solid rgba(255,255,255,0.25); border-radius: var(--radius);
    background: rgba(255,255,255,0.1); font-size: 16px; font-weight: 600;
    cursor: pointer; transition: var(--transition); font-family: 'Nunito', sans-serif;
    color: var(--white); text-align: left;
}
.poll-option:hover, .quiz-option:hover, .guess-option:hover {
    border-color: var(--primary-light); background: rgba(82,183,136,0.25);
    transform: translateX(4px); box-shadow: 0 4px 15px rgba(82,183,136,0.3);
}
.poll-option:active, .quiz-option:active { transform: scale(0.98); }
.quiz-option .quiz-letter {
    display: inline-flex; align-items: center; justify-content: center;
    width: 28px; height: 28px; border-radius: 50%; background: rgba(255,255,255,0.2);
    font-weight: 800; font-size: 14px; margin-right: 10px;
}

/* Sort bins */
.sort-game-bins { display: flex; gap: 10px; margin-bottom: 16px; }
.sort-game-bin {
    flex: 1; min-height: 140px; border: 2px dashed rgba(255,255,255,0.3);
    border-radius: var(--radius); padding: 10px; text-align: center;
    background: rgba(255,255,255,0.05); transition: var(--transition);
    display: flex; flex-direction: column;
}
.sort-game-bin.bin-over { border-color: var(--primary-light); background: rgba(82,183,136,0.15); }
.sort-game-bin h4 { color: var(--white); font-weight: 800; margin-bottom: 8px; }
.bin-dropzone {
    flex: 1; min-height: 80px; display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 4px;
}
.sort-game-items { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.sort-game-item {
    padding: 8px 16px; background: rgba(255,255,255,0.15); border: 2px solid rgba(255,255,255,0.25);
    border-radius: 20px; font-weight: 600; cursor: grab; transition: var(--transition); color: var(--white);
}
.sort-game-item:active { cursor: grabbing; }
.sort-game-item:hover { transform: scale(1.05); background: rgba(82,183,136,0.3); }
.sort-game-item.selected-mobile {
    background: rgba(82,183,136,0.5);
    border-color: var(--primary-light);
    box-shadow: 0 0 15px rgba(82,183,136,0.5);
}

/* True / False */
.tf-statement {
    font-size: 18px; font-weight: 700; color: var(--white); text-align: center;
    padding: 20px; background: rgba(255,255,255,0.1); border-radius: var(--radius);
    margin-bottom: 16px; line-height: 1.5;
}
.tf-buttons { display: flex; gap: 12px; }
.tf-btn {
    flex: 1; padding: 18px; border: 3px solid rgba(255,255,255,0.3);
    border-radius: var(--radius); font-size: 18px; font-weight: 800;
    cursor: pointer; transition: var(--transition); text-align: center;
    font-family: 'Nunito', sans-serif;
}
.tf-btn-true { background: rgba(82,183,136,0.2); color: #52B788; }
.tf-btn-true:hover { background: rgba(82,183,136,0.4); border-color: #52B788; transform: scale(1.03); }
.tf-btn-false { background: rgba(231,111,81,0.2); color: #E76F51; }
.tf-btn-false:hover { background: rgba(231,111,81,0.4); border-color: #E76F51; transform: scale(1.03); }

/* Decomposition Game */
.decompose-items { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.decompose-item {
    padding: 10px 18px; background: rgba(255,255,255,0.15); border: 2px solid rgba(255,255,255,0.25);
    border-radius: 25px; font-weight: 700; cursor: grab; transition: var(--transition); color: var(--white);
}
.decompose-item:hover { background: rgba(82,183,136,0.3); transform: scale(1.05); }
.decompose-item.selected-mobile {
    background: rgba(82,183,136,0.5);
    border-color: var(--primary-light);
    box-shadow: 0 0 15px rgba(82,183,136,0.5);
}
.decompose-timeline {
    display: flex; gap: 6px; margin-bottom: 16px; overflow-x: auto; padding: 4px 0;
}
.decompose-slot {
    flex: 1; min-width: 80px; padding: 10px 6px; text-align: center;
    border: 2px dashed rgba(255,255,255,0.3); border-radius: var(--radius);
    background: rgba(255,255,255,0.05); font-size: 12px; color: rgba(255,255,255,0.7);
    min-height: 100px; transition: var(--transition);
}
.decompose-slot.slot-over { border-color: var(--primary-light); background: rgba(82,183,136,0.15); }
.decompose-slot h5 { color: var(--white); font-size: 11px; margin-bottom: 4px; }
.decompose-slot .slot-item { font-size: 24px; margin-top: 8px; }

/* Commitment Wall */
.commit-wall, .discuss-wall-player {
    max-height: 180px; overflow-y: auto; margin-bottom: 12px;
}
.wall-post {
    display: flex; align-items: flex-start; gap: 8px; padding: 10px;
    background: rgba(255,255,255,0.1); border-radius: 10px; margin-bottom: 6px;
    animation: slideUp 0.3s ease-out;
}
.wall-post-avatar { font-size: 20px; flex-shrink: 0; }
.wall-post-content { flex: 1; font-size: 14px; line-height: 1.4; color: rgba(255,255,255,0.9); }
.wall-post-time { font-size: 11px; color: rgba(255,255,255,0.5); flex-shrink: 0; }
.act-input-area { display: flex; gap: 8px; }
.act-input {
    flex: 1; padding: 12px; border: 2px solid rgba(255,255,255,0.25);
    border-radius: var(--radius); font-family: 'Nunito', sans-serif; font-size: 14px;
    background: rgba(255,255,255,0.1); color: var(--white); resize: none; min-height: 44px;
}
.act-input::placeholder { color: rgba(255,255,255,0.4); }
.act-input:focus { outline: none; border-color: var(--primary-light); }

/* ==================== BADGE NOTIFICATION ==================== */
.badge-notification {
    position: fixed; top: 80px; right: 16px;
    z-index: 1000; animation: slideInRight 0.4s ease-out;
}
.badge-popup {
    background: var(--white); padding: 14px 18px; border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    display: flex; align-items: center; gap: 12px;
    min-width: 200px;
}
@keyframes slideInRight { 0% { transform: translateX(120%); opacity: 0; } 100% { transform: translateX(0); opacity: 1; } }
@keyframes slideOutRight { 0% { transform: translateX(0); opacity: 1; } 100% { transform: translateX(120%); opacity: 0; } }
.badge-popup-icon { font-size: 32px; animation: gentleFloat 2s ease-in-out infinite; }
.badge-popup-name { display: block; font-size: 15px; font-weight: 900; color: var(--primary-dark); margin-bottom: 2px; }
.badge-popup-desc { display: block; font-size: 12px; color: var(--text-muted); }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ==================== POINTS ANIMATION ==================== */
.points-float {
    position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
    font-size: 48px; font-weight: 900; color: #FFD700; pointer-events: none;
    animation: pointsUp 1.5s ease-out forwards; z-index: 999;
    text-shadow: 0 2px 10px rgba(255,215,0,0.5);
}
@keyframes pointsUp {
    0% { opacity: 1; transform: translate(-50%, -50%) scale(0.5); }
    30% { transform: translate(-50%, -80%) scale(1.3); }
    100% { opacity: 0; transform: translate(-50%, -200%) scale(1); }
}

/* ==================== FACILITATOR ==================== */
.facilitator-page {
    min-height: 100vh; display: flex; flex-direction: column;
    background: linear-gradient(135deg, #0d3320, #1a4731 30%, var(--bg) 100%);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
.facilitator-header {
    background: var(--white); padding: 12px 24px; display: flex; align-items: center;
    justify-content: space-between; box-shadow: 0 2px 10px rgba(0,0,0,0.08); z-index: 10;
}
.header-left { display: flex; align-items: center; gap: 16px; }
.logo-facilitator { width: 40px; height: 40px; }
.header-title { font-size: 20px; font-weight: 800; color: var(--primary-dark); }
.header-right { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.session-code {
    background: var(--primary-tint); color: var(--primary-dark);
    padding: 6px 14px; border-radius: 8px; font-weight: 700; font-size: 14px; letter-spacing: 1px;
}
.participant-count {
    background: var(--primary); color: var(--white);
    padding: 6px 14px; border-radius: 8px; font-weight: 700; font-size: 14px;
}
.session-status { padding: 6px 14px; border-radius: 8px; font-weight: 700; font-size: 13px; text-transform: uppercase; }
.status-waiting { background: #FEF3C7; color: #92400E; }
.status-active { background: #D1FAE5; color: #065F46; }
.status-ended { background: #FEE; color: #991B1B; }

.facilitator-main { flex: 1; display: flex; gap: 0; overflow: hidden; }

.slide-display {
    flex: 1; padding: 40px; display: flex; align-items: center; justify-content: center;
    background: var(--white); margin: 16px; margin-right: 0;
    border-radius: var(--radius-lg); box-shadow: var(--shadow); min-height: 500px;
    position: relative; overflow: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
.slide-content { text-align: center; max-width: 800px; width: 100%; animation: slideFadeIn 0.5s ease-out; }
@keyframes slideFadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
.slide-decoration {
    position: absolute; font-size: 120px; opacity: 0.06;
    pointer-events: none; animation: floatSlow 6s ease-in-out infinite;
}
.slide-decoration.top-right { top: 20px; right: 30px; }
.slide-decoration.bottom-left { bottom: 20px; left: 30px; }
@keyframes floatSlow {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-10px) rotate(5deg); }
}
.slide-image {
    max-width: 100%; max-height: 300px; border-radius: var(--radius);
    margin-bottom: 24px; animation: imageFadeIn 0.6s ease-out 0.2s both;
}
@keyframes imageFadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}
.slide-content.shocking {
    border: 3px solid var(--alert);
    animation: pulse-alert 2s ease-in-out infinite;
}
.slide-display .slide-content.dark-glass.shocking {
    background: linear-gradient(135deg, rgba(231,111,81,0.2), rgba(180,60,40,0.15)) !important;
    border-color: rgba(231,111,81,0.5);
    box-shadow: 0 0 40px rgba(231,111,81,0.3), inset 0 0 40px rgba(231,111,81,0.05);
}
.dark-glass.shocking .slide-title {
    color: #FFD4D4 !important;
    -webkit-text-fill-color: #FFD4D4 !important;
}
.dark-glass.shocking .slide-body {
    color: rgba(255,255,255,0.95) !important;
}
@keyframes pulse-alert {
    0%, 100% { box-shadow: 0 0 0 0 rgba(231,111,81,0.4); }
    50% { box-shadow: 0 0 0 20px rgba(231,111,81,0); }
}
.slide-title { font-size: 42px; font-weight: 900; color: var(--primary-dark); margin-bottom: 24px; line-height: 1.2; }
.shocking-text { color: var(--alert) !important; }
.slide-body { font-size: 20px; line-height: 1.8; color: var(--text-dark); white-space: pre-line; }
.slide-image { max-width: 100%; max-height: 300px; border-radius: var(--radius); margin-bottom: 24px; }
.activity-badge {
    display: inline-flex; align-items: center; gap: 8px;
    background: var(--primary-tint); color: var(--primary);
    padding: 10px 20px; border-radius: 30px; font-weight: 700; font-size: 16px; margin-top: 16px;
}
.activity-icon { font-size: 24px; }
.slide-empty { text-align: center; color: var(--text-muted); }
.empty-icon { font-size: 64px; margin-bottom: 16px; animation: gentleFloat 3s ease-in-out infinite; }
.slide-empty h2 { font-size: 28px; color: var(--primary-dark); margin-bottom: 8px; }

/* ==================== FACILITATOR SIDEBAR ==================== */
.facilitator-sidebar {
    width: 360px; background: var(--white); padding: 24px;
    overflow-y: auto; border-left: 1px solid var(--primary-pale);
}
.controls-section, .actions-section, .leaderboard-section, .qr-section, .players-section {
    margin-bottom: 24px; padding-bottom: 24px; border-bottom: 1px solid var(--primary-tint);
}
.controls-section h3, .actions-section h3, .leaderboard-section h3, .qr-section h3, .players-section h3 {
    font-size: 14px; text-transform: uppercase; letter-spacing: 1px;
    color: var(--text-muted); margin-bottom: 12px;
}
.players-list { max-height: 250px; overflow-y: auto; }
.player-item {
    display: flex; align-items: center; gap: 8px; padding: 8px 12px;
    border-radius: 8px; margin-bottom: 4px; background: var(--bg); transition: var(--transition);
    position: relative;
}
.player-item:hover { background: var(--primary-tint); }
.player-avatar { font-size: 20px; flex-shrink: 0; }
.player-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.player-name { font-weight: 700; font-size: 14px; }
.player-phone { font-size: 11px; color: var(--text-muted); }
.player-joined { font-size: 10px; color: var(--text-muted); opacity: 0.7; }
.player-points { font-weight: 800; color: var(--primary); font-size: 13px; }
.player-streak { font-size: 13px; }
.player-kick-btn {
    background: rgba(231,111,81,0.15); border: 1px solid rgba(231,111,81,0.3);
    color: #E76F51; border-radius: 50%; width: 22px; height: 22px;
    font-size: 12px; cursor: pointer; display: flex; align-items: center;
    justify-content: center; transition: var(--transition); margin-left: 4px; flex-shrink: 0;
}
.player-kick-btn:hover { background: rgba(231,111,81,0.3); }
.kick-confirm-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.7); display: flex; align-items: center; justify-content: center;
    z-index: 10000; animation: fadeIn 0.2s ease-out;
}
.kick-confirm-card {
    background: #1a2a20; border: 1px solid rgba(82,183,136,0.3); border-radius: 16px;
    padding: 28px 32px; text-align: center; max-width: 380px; width: 90%;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}
.kick-confirm-card h3 { color: #fff; margin-bottom: 8px; }
.kick-confirm-card p { color: rgba(255,255,255,0.7); margin-bottom: 20px; font-size: 14px; }
.kick-confirm-buttons { display: flex; gap: 12px; justify-content: center; }
.slide-counter { text-align: center; font-size: 18px; font-weight: 800; color: var(--primary); margin-bottom: 12px; }
.slide-nav { display: flex; gap: 12px; margin-bottom: 16px; }
.progress-dots { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.dot { width: 12px; height: 12px; border-radius: 50%; background: var(--primary-pale); border: none; cursor: pointer; transition: var(--transition); }
.dot.active { background: var(--primary); transform: scale(1.3); }
.dot.activity { background: var(--accent); }
.dot:hover { transform: scale(1.4); }
.action-buttons { display: flex; flex-direction: column; gap: 8px; }
.leaderboard-list { max-height: 300px; overflow-y: auto; }
.leaderboard-item { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 8px; margin-bottom: 4px; background: var(--bg); transition: var(--transition); }
.leaderboard-item.top-1 { background: #FEF3C7; }
.leaderboard-item.top-2 { background: #E5E7EB; }
.leaderboard-item.top-3 { background: #FDE8D0; }
.lb-rank { font-size: 18px; min-width: 24px; }
.lb-avatar { font-size: 20px; }
.lb-name { flex: 1; font-weight: 700; font-size: 14px; }
.lb-points { font-weight: 800; color: var(--primary); font-size: 14px; }
.lb-streak { font-size: 14px; }
.lb-badges { font-size: 14px; }
.qr-info { background: var(--bg); padding: 16px; border-radius: var(--radius); text-align: center; }
.join-url { font-family: monospace; font-size: 16px; font-weight: 700; color: var(--primary); padding: 8px; background: var(--white); border-radius: 8px; margin-top: 8px; letter-spacing: 1px; }

.submitted-indicator {
    margin-top: 16px;
    animation: actSlideUp 0.5s ease-out;
}
.submitted-banner {
    padding: 12px 24px;
    background: rgba(82, 183, 136, 0.25);
    border: 2px solid #52B788;
    border-radius: var(--radius);
    color: #52B788;
    font-weight: 800;
    font-size: 16px;
    text-align: center;
}
.answers-reveal {
    margin-top: 16px;
    padding: 16px;
    background: rgba(10, 35, 25, 0.9);
    border: 1px solid rgba(82, 183, 136, 0.3);
    border-radius: var(--radius);
    animation: actSlideUp 0.5s ease-out;
    max-height: 50vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* ==================== ACTIVITY OVERLAY ==================== */
.activity-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.5); z-index: 50; display: flex; align-items: center; justify-content: center; }
.activity-result-panel { background: var(--white); padding: 32px; border-radius: var(--radius-lg); max-width: 500px; width: 90%; }

/* ==================== FACILITATOR ACTIVITY PANEL ==================== */
.fac-activity-panel {
    margin-top: 20px; padding: 20px;
    background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.15);
    border-radius: var(--radius-lg); animation: actSlideUp 0.5s ease-out;
}
.fac-activity-panel .activity-title {
    font-size: 18px; font-weight: 800; color: var(--primary-light); margin-bottom: 12px;
}
.fac-live-stats {
    display: flex; gap: 16px; margin-bottom: 12px; flex-wrap: wrap;
}
.fac-stat {
    padding: 8px 16px; background: rgba(82,183,136,0.15); border-radius: 8px;
    font-size: 14px; color: rgba(255,255,255,0.9); font-weight: 600;
}
.fac-stat strong { color: var(--primary-light); }
.fac-live-feed {
    max-height: 200px; overflow-y: auto; margin-top: 12px;
}
.fac-feed-item {
    display: flex; align-items: flex-start; gap: 8px; padding: 8px 12px;
    background: rgba(255,255,255,0.06); border-radius: 8px; margin-bottom: 4px;
    animation: slideUp 0.3s ease-out;
}
.fac-feed-avatar { font-size: 18px; flex-shrink: 0; }
.fac-feed-content { flex: 1; font-size: 13px; color: rgba(255,255,255,0.85); line-height: 1.4; }
.fac-feed-name { font-weight: 700; color: var(--primary-light); font-size: 12px; }
.fac-feed-correct { color: #52B788; font-weight: 700; }
.fac-feed-wrong { color: #E76F51; font-weight: 700; }

/* ==================== QUIZ PROGRESS ==================== */
.quiz-progress { display: flex; gap: 4px; margin-bottom: 16px; }
.quiz-progress-dot {
    width: 100%; height: 6px; border-radius: 3px; background: rgba(255,255,255,0.2); transition: var(--transition); flex: 1;
}
.quiz-progress-dot.done { background: var(--primary-light); }
.quiz-progress-dot.current { background: var(--white); }
.quiz-progress-dot.wrong { background: var(--coral); }
.quiz-counter { font-size: 14px; color: rgba(255,255,255,0.6); margin-bottom: 8px; }

/* ==================== RESULT OVERLAY ==================== */
.act-result-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.7); display: flex; align-items: center; justify-content: center;
    z-index: 200; animation: fadeIn 0.3s ease-out;
}
.act-result-card {
    background: var(--glass-bg); backdrop-filter: blur(20px); border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg); padding: 32px; text-align: center;
    max-width: 400px; width: 90%; color: var(--white);
}
.act-result-card .result-emoji { font-size: 64px; margin-bottom: 12px; }
.act-result-card .result-title { font-size: 24px; font-weight: 900; margin-bottom: 8px; }
.act-result-card .result-points { font-size: 48px; font-weight: 900; color: #FFD700; }

/* ==================== RESPONSIVE ==================== */
@media (max-width: 768px) {
    .facilitator-header { flex-direction: column; gap: 8px; padding: 10px; }
    .facilitator-main { flex-direction: column; }
    .slide-display { margin: 8px; padding: 20px; min-height: 300px; }
    .facilitator-sidebar { width: 100%; border-left: none; border-top: 1px solid var(--primary-pale); }
    .home-title { font-size: 36px; }
    .sort-bins, .tf-buttons { flex-direction: column; }
    .p-slide-title { font-size: 20px; }
    .p-topbar { flex-wrap: wrap; padding: 8px; gap: 8px; }
    .p-badges-strip { max-width: 80px; }
}
@media (max-width: 480px) {
    .slide-title { font-size: 28px; }
    .slide-body { font-size: 16px; }
    .form-container { padding: 24px; margin: 12px; }
    .avatar-grid, .avatar-grid-fancy { grid-template-columns: repeat(4, 1fr); }
    .glass-card { padding: 24px; margin: 12px; }
    .decompose-timeline { flex-direction: column; }
    .sort-game-bins { flex-direction: column; }
}

/* ==================== BUTTON LOADING STATES ==================== */
.btn-loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
    opacity: 0.8;
}
.btn-loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ==================== TREE DECORATIONS ==================== */
.tree-decoration {
    position: fixed;
    bottom: 40px;
    pointer-events: none;
    z-index: 2;
    opacity: 0.35;
}
.tree-left { left: -20px; width: 140px; animation: treeSway 8s ease-in-out infinite; }
.tree-right { right: -10px; width: 120px; animation: treeSway 10s ease-in-out infinite reverse; }
@keyframes treeSway {
    0%, 100% { transform: rotate(-1deg); }
    50% { transform: rotate(2deg); }
}

/* ==================== GRASS STRIP ==================== */
.grass-strip {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 50px;
    background: linear-gradient(to top, #0d3320 0%, #1a4731 60%, transparent 100%);
    pointer-events: none;
    z-index: 3;
    overflow: hidden;
}
.grass-strip::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 30px;
    background: repeating-linear-gradient(
        90deg,
        transparent 0px,
        transparent 8px,
        #1a4731 8px,
        #1a4731 10px,
        transparent 10px,
        transparent 18px,
        #245a3d 18px,
        #245a3d 20px
    );
    opacity: 0.6;
    animation: grassWave 4s ease-in-out infinite;
}
@keyframes grassWave {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(-5px); }
}

/* ==================== DARK GLASS THEME (Participant & Facilitator) ==================== */
.p-slide-card.dark-glass,
.slide-display .slide-content.dark-glass {
    background: rgba(10, 35, 25, 0.88) !important;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(82, 183, 136, 0.25);
    box-shadow: 0 8px 32px rgba(0,0,0,0.3), inset 0 0 40px rgba(82, 183, 136, 0.08);
}
.dark-glass .p-slide-title,
.dark-glass .slide-title {
    color: #fff !important;
    -webkit-text-fill-color: #fff !important;
    background: none !important;
    text-shadow: 0 0 20px rgba(82, 183, 136, 0.4);
}
.dark-glass .p-slide-body,
.dark-glass .slide-body {
    color: rgba(255,255,255,0.95) !important;
}
.dark-glass .slide-empty,
.dark-glass .slide-empty h2,
.dark-glass .slide-empty p {
    color: rgba(255,255,255,0.8) !important;
}

/* ==================== FACILITATOR DARK THEME ==================== */
.facilitator-page.dark-theme {
    background: linear-gradient(180deg, #0d3320 0%, #1a4731 40%, var(--nature-3) 100%);
    position: relative;
}
.facilitator-page.dark-theme::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: radial-gradient(ellipse at 50% 0%, rgba(82,183,136,0.15) 0%, transparent 70%);
    pointer-events: none;
}
.facilitator-page.dark-theme .facilitator-header {
    background: rgba(10, 35, 25, 0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(82, 183, 136, 0.25);
}
.facilitator-page.dark-theme .header-title {
    color: #fff;
}
.facilitator-page.dark-theme .session-code {
    background: rgba(82, 183, 136, 0.2);
    color: #fff;
}
.facilitator-page.dark-theme .participant-count {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
}
.facilitator-page.dark-theme .facilitator-sidebar {
    background: rgba(10, 35, 25, 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-left: 1px solid rgba(82, 183, 136, 0.25);
}
.facilitator-page.dark-theme .controls-section h3,
.facilitator-page.dark-theme .actions-section h3,
.facilitator-page.dark-theme .leaderboard-section h3,
.facilitator-page.dark-theme .qr-section h3,
.facilitator-page.dark-theme .players-section h3 {
    color: rgba(255,255,255,0.6);
}
.facilitator-page.dark-theme .slide-counter {
    color: var(--primary-light);
}
.facilitator-page.dark-theme .dot {
    background: rgba(255,255,255,0.2);
}
.facilitator-page.dark-theme .dot.active {
    background: var(--primary-light);
}
.facilitator-page.dark-theme .leaderboard-item {
    background: rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.9);
}
.facilitator-page.dark-theme .player-item {
    background: rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.9);
}
.facilitator-page.dark-theme .player-item:hover {
    background: rgba(82,183,136,0.15);
}
.facilitator-page.dark-theme .player-phone,
.facilitator-page.dark-theme .player-joined {
    color: rgba(255,255,255,0.5);
}
.facilitator-page.dark-theme .qr-info {
    background: rgba(255,255,255,0.08);
}
.facilitator-page.dark-theme .join-url {
    background: rgba(10, 35, 25, 0.8);
    color: var(--primary-light);
}
.facilitator-page.dark-theme .slide-display {
    background: transparent;
    box-shadow: none;
    margin: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* ==================== PARTICLE UPGRADE ==================== */
.particle-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
    z-index: 1;
}
.particle-layer span {
    position: absolute;
    font-size: 28px;
    opacity: 0.3;
    animation: particleFloatEnhanced 12s ease-in-out infinite;
    will-change: transform;
}
@keyframes particleFloatEnhanced {
    0% { transform: translateY(100vh) translateX(0) rotate(0deg); opacity: 0.2; }
    25% { transform: translateY(75vh) translateX(20px) rotate(90deg); opacity: 0.35; }
    50% { transform: translateY(50vh) translateX(-10px) rotate(180deg); opacity: 0.3; }
    75% { transform: translateY(25vh) translateX(15px) rotate(270deg); opacity: 0.25; }
    100% { transform: translateY(-10vh) translateX(0) rotate(360deg); opacity: 0.1; }
}

/* ==================== FACILITATOR ACTIVITY PANEL FIXES ==================== */
.answers-modal-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.7); display: flex; align-items: center; justify-content: center;
    z-index: 10000; animation: fadeIn 0.2s ease-out;
}
.answers-modal-card {
    background: linear-gradient(135deg, #0d3320, #1a4731);
    border: 1px solid rgba(82,183,136,0.3); border-radius: 16px;
    padding: 24px; max-width: 600px; width: 95%; max-height: 80vh;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
    overflow-y: auto;
}

/* Facilitator activity panel - ensure button text is visible */
.fac-activity-panel .quiz-option,
.fac-activity-panel .tf-btn {
    color: #fff !important;
    font-weight: 700;
}
.fac-activity-panel .quiz-letter {
    color: #fff !important;
    background: rgba(255,255,255,0.25) !important;
}
.fac-activity-panel .tf-btn-true {
    background: rgba(82,183,136,0.35) !important;
    border-color: #52B788 !important;
}
.fac-activity-panel .tf-btn-false {
    background: rgba(231,111,81,0.35) !important;
    border-color: #E76F51 !important;
}
.fac-activity-panel .quiz-question-block {
    background: rgba(255,255,255,0.08) !important;
}
.fac-activity-panel .quiz-question-block div {
    color: #fff !important;
}