@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700;800&display=swap');
/* =========================================
   1. VARIABLES & RESET
   ========================================= */
:root {
    /* Backgrounds */
--bg-gradient:
radial-gradient(circle at 20% 20%, rgba(0,0,0,0.10), transparent 35%),
radial-gradient(circle at 80% 30%, rgba(0,0,0,0.08), transparent 40%),
radial-gradient(circle at 50% 80%, rgba(0,0,0,0.06), transparent 35%),
#ffffff;

--glass-bg: rgba(255, 255, 255, 0.65);

--glass-border: rgba(0, 0, 0, 0.08);
    
    /* Brand Colors */
    --primary: #3b82f6;      /* Blue */
    --accent: #f59e0b;       /* Amber/Yellow */
    --success: #22c55e;      /* Green */
    --danger: #ef4444;       /* Red */
    
    /* Text Colors */
    --text-main: #000000;    /* White-ish */
    --text-muted: #0b2345;   /* Grey */
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Space Grotesk', sans-serif;
}

body {
    background: #ffffff;
    background-image:
        linear-gradient(rgba(255,215,0,0.10) 1px, transparent 1.6px),
        linear-gradient(90deg, rgba(255,215,0,0.10) 1px, transparent 1.7px);
    background-size: 60px 60px;
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
}

/* =========================================
   2. LAYOUT & UTILITIES
   ========================================= */
.container {
    width: 100%;
    max-width: 480px;
    padding: 1.5rem;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.hidden {
    display: none !important;
}

.text-right {
    text-align: right;
}

/* =========================================
   3. GLASSMORPHISM CARD
   ========================================= */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px); /* Safari support */
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.2);
    
    /* Animation for smooth screen switching */
    animation: slideUp 0.4s ease-out;
}

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

/* =========================================
   4. TYPOGRAPHY
   ========================================= */
h1, h2 {
    text-align: center;
    margin-bottom: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    color: rgb(23, 23, 55);
}

h3 {
    font-size: 1.1rem;
    color: var(--text-muted);
    font-weight: 600;
}

p {
    line-height: 1.5;
    color: var(--text-muted);
}

/* =========================================
   5. FORMS & INPUTS
   ========================================= */
input {
    width: 100%;
    padding: 14px;
    margin-bottom: 1rem;
    background: rgba(255, 255, 255, 0.3);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    color: rgb(0, 0, 0);
    font-size: 1rem;
    outline: none;
}

input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

/* =========================================
   6. BUTTONS
   ========================================= */
button {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 8px;
    background: var(--primary);
    color: white;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.1s, opacity 0.2s;
    margin-bottom: 0.5rem;
}

button:active {
    transform: scale(0.97);
}
/* Secondary Button (Outline) */
button.secondary {
    background: transparent;
    color: var(--text-muted);
}
/* Danger Button */
button.danger {
    background: var(--danger);
}

/* Yellow/Action Button */
button.btn-yellow {
    background: var(--accent);
    color: #000; /* Black text for contrast */
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* =========================================
   7. DASHBOARD & STATS (Admin)
   ========================================= */
.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 2rem;
}

.stat-card {
    background: rgba(255,255,255,0.03);
    padding: 12px;
    border-radius: 8px;
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-muted);
    border: 1px solid rgba(255,255,255,0.05);
}

.stat-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: white;
    margin-bottom: 4px;
    font-variant-numeric: tabular-nums; /* Fixed width numbers */
}

/* Status Badge */
.status-badge {
    background: rgba(255,255,255,0.05);
    padding: 4px 12px;
    border-radius: 20px;
    border: 1px solid var(--glass-border);
}

/* =========================================
   8. QUIZ INTERFACE (Participant)
   ========================================= */
/* Timer Bar */
.timer-bar {
    width: 100%;
    height: 6px;
    background: rgba(255,255,255,0.1);
    border-radius: 10px;
    margin: 1rem 0 2rem 0;
    overflow: hidden;
}

.timer-fill {
    height: 100%;
    background: var(--accent);
    width: 100%;
    /* Transition is handled via JS for precision */
}

/* Question Styling */
.question-text {
    font-size: 1.25rem;
    line-height: 1.5;
    margin-bottom: 2rem;
    font-weight: 600;
    text-align: center;
}

/* Options Grid */
.options-grid {
    display: grid;
    gap: 12px;
}

.option-btn {
    text-align: left;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--glass-border);
    padding: 16px;
    font-size: 1rem;
    transition: all 0.2s;
}

.option-btn:hover:not(:disabled) {
    background: rgba(255,255,255,0.1);
    transform: translateX(5px); /* Slight slide effect */
}

/* Feedback States */
.option-btn.correct {
    background: rgba(34, 197, 94, 0.2) !important;
    border-color: var(--success) !important;
    color: var(--success);
}

.option-btn.wrong {
    background: rgba(239, 68, 68, 0.2) !important;
    border-color: var(--danger) !important;
    color: var(--danger);
}

/* =========================================
   9. LEADERBOARD TABLE
   ========================================= */
.leaderboard-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.leaderboard-table th {
    text-align: left;
    color: var(--text-muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--glass-border);
}

.leaderboard-table td {
    padding: 12px 0;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    font-size: 0.95rem;
}

.rank-1 {
    color: var(--accent);
    font-weight: bold;
    font-size: 1.1rem;
}

.rank-top {
    color: white;
    font-weight: 600;
}

/* =========================================
   10. LOADING SPINNER
   ========================================= */
.spinner {
    display: inline-block;
    animation: spin 2s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* =========================================
   LOGIN CARD
   ========================================= */
.login-card {
    background: #ffffff;
    border-radius: 20px;
    padding: 32px 28px;
    width: 100%;
    max-width: 360px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.12);
    text-align: center;
    animation: slideUp 0.4s ease-out;
    box-sizing: border-box;
}

.login-logo {
    font-size: 2.8rem;
    margin-bottom: 4px;
}

.login-title {
    font-size: 1.8rem;
    font-weight: 800;
    color: #1e3a8a;
    margin-bottom: 4px;
    letter-spacing: 1px;
}

.login-sub {
    font-size: 0.88rem;
    font-weight: 600;
    color: #64748b;
    margin-bottom: 20px;
}

.login-form input {
    background: #f8fafc;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    padding: 12px 14px;
    font-size: 0.95rem;
    color: #1e293b;
    margin-bottom: 12px;
}

.login-form input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
}

.login-btn-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.login-btn {
    width: 100%;
    padding: 12px;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    border: none;
    margin: 0;
    transition: transform 0.1s, opacity 0.2s;
}
.login-btn:active { transform: scale(0.97); }

.login-btn-primary  { background: #1e40af; color: white; }
.login-btn-secondary { background: #f1f5f9; color: #1e3a8a; border: 1.5px solid #cbd5e1; }
.login-btn-ghost    { background: transparent; color: #64748b; font-weight: 700; }

#login-error {
    color: #ef4444;
    font-size: 0.85rem;
    text-align: center;
    margin-top: 8px;
    min-height: 20px;
}

/* =========================================
   11. MOBILE RESPONSIVENESS
   ========================================= */
@media (max-width: 480px) {
    .container {
        padding: 16px;
        max-width: 100%;
        width: 100%;
    }
    .login-card {
        padding: 24px 16px;
        border-radius: 16px;
        max-width: 100%;
    }
    .login-title { font-size: 1.5rem; }
    .login-btn   { font-size: 0.9rem; padding: 11px; }
    input        { font-size: 0.95rem; padding: 12px; }
    h1 { font-size: 1.3rem; }
}
/* =========================================
   FORCE LEADERBOARD DESIGN (Floating Pills)
   ========================================= */

/* 1. The Main "Leader board" Banner */
.lb-main-title {
    background: linear-gradient(180deg, #1e40af 0%, #172554 100%) !important;
    color: white !important;
    padding: 15px !important;
    border-radius: 12px !important;
    font-size: 1.4rem !important;
    font-weight: bold !important;
    text-align: center !important;
    box-shadow: 0 4px 15px rgba(30, 64, 175, 0.4) !important;
    margin-bottom: 20px !important;
    display: block !important;
}

/* 2. The Container for the List */
.lb-list-container {
    display: flex !important;
    flex-direction: column !important;
    gap: 12px !important; /* Space between white pills */
    padding: 10px 5px !important;
}

/* 3. Grid Layout for Rows & Headers */
.lb-grid {
    display: grid !important;
    /* Columns: Rank | Team ID | Team Name | Score */
    grid-template-columns: 0.5fr 1fr 1.5fr 0.8fr !important;
    gap: 10px !important;
    align-items: center !important;
}

/* 4. Blue Header Pills */
.lb-header-row {
    margin-bottom: 5px !important;
}

.lb-col-header {
    background: #1e40af !important; /* Blue */
    color: white !important;
    padding: 8px 4px !important;
    border-radius: 20px !important; /* Rounded Buttons */
    font-size: 0.85rem !important;
    font-weight: bold !important;
    text-align: center !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2) !important;
}

/* 5. White Data Rows (The Floating Cards) */
.lb-data-row {
    background: white !important;
    color: #0f172a !important; /* Dark Text */
    padding: 15px 10px !important;
    border-radius: 12px !important;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2) !important; /* Drop Shadow */
    font-weight: 600 !important;
    font-size: 0.95rem !important;
}

.lb-cell {
    text-align: center !important;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 6. Rank #1 Highlight (Gold Border) */
.lb-data-row.top-rank {
    border: 3px solid #f59e0b !important; /* Gold/Orange Border */
    background: #fffbeb !important;
    transform: scale(1.02);
}
/* GRID: 4 Columns (Rank | ID | Name | Score) - NO TIME */
.lb-grid {
    display: grid !important;
    grid-template-columns: 0.6fr 0.8fr 1.5fr 0.8fr !important; 
    gap: 10px !important;
    align-items: center !important;
}

.lb-col-header {
    font-size: 0.85rem !important;
    padding: 10px 5px !important;
}
/* =========================================
   ✨ ATTRACTIVE STAR RATING STYLES
   ========================================= */
.feedback-box {
    margin-top: 20px;
    padding: 20px;
    background: linear-gradient(135deg, rgba(255,255,255,0.1), rgba(255,255,255,0.05));
    border-radius: 16px;
    border: 1px solid rgba(255,255,255,0.2);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(4px);
    text-align: center;
}

/* The Star Container */
.stars-wrapper {
    display: flex;
    justify-content: center;
    gap: 15px; /* Space between stars */
    margin: 15px 0;
}

/* Individual Stars */
.star-rating {
    font-size: 3rem; /* Big Size */
    cursor: pointer;
    color: #475569; /* Dark Grey (Inactive) */
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); /* Bouncy animation */
    display: inline-block;
    user-select: none;
}

/* Hover Effect (Slightly larger) */
.star-rating:hover {
    transform: scale(1.3);
    color: #fbbf24; /* Preview Gold */
}

/* Active / Selected State (Gold + Glow) */
.star-rating.active {
    color: #fbbf24; /* Bright Gold */
    text-shadow: 0 0 20px rgba(251, 191, 36, 0.8); /* Golden Glow */
    transform: scale(1.2);
}

/* The Text Area */
.styled-textarea {
    width: 90%;
    padding: 12px;
    border-radius: 10px;
    border: 2px solid rgba(255,255,255,0.1);
    background: rgba(0,0,0,0.2);
    color: white;
    font-size: 1rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.3s;
    resize: none;
}

.styled-textarea:focus {
    border-color: #fbbf24; /* Gold border on focus */
}

/* The Submit Button */
.btn-submit-feedback {
    margin-top: 15px;
    background: linear-gradient(45deg, #fbbf24, #d97706); /* Gold Gradient */
    color: black;
    border: none;
    padding: 12px 30px;
    border-radius: 50px; /* Pill shape */
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(251, 191, 36, 0.4);
    transition: transform 0.2s;
}

.btn-submit-feedback:active {
    transform: scale(0.95);
}
/* =========================================
   📝 NEW WHITE CARD DESIGN
   ========================================= */
.question-card {
    background: #ffffff;
    color: #333333;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    margin-bottom: 25px;
    text-align: left;
    border-left: 6px solid #3b82f6; /* Blue accent line */
}
.q-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

.q-count {
    font-size: 1rem;
    font-weight: 700;
    color: #2563eb;
}

.timer-box {
    background: #8595e8;
    color: #ed0505;
    padding: 5px 12px;
    font-size: 1.2rem;
    font-weight: bold;
    border-radius: 4px;
    font-family: monospace;
}
.question-text {
    font-size: 1.1rem;
    font-weight: 500;
    line-height: 1.6;
    white-space: pre-wrap;  /* 👈 KEEPS SPACES & ENTERS! */
    font-family: 'Space Grotesk', sans-serif;
    background: #f8fafc; 
    padding: 15px;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
    display: block;
}
.option-btn {
    display: block;
    width: 100%;
    background: #ffffff;
    color: #333;
    padding: 15px 20px;
    margin-bottom: 12px;
    border-radius: 8px;
    border: 1px solid #ddd;
    text-align: left;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}

.option-btn:hover {
    background: #f1f5f9;
    transform: translateY(-2px);
    border-color: #3b82f6;
}
.option-btn.correct { background: #22c55e !important; color: white !important; }
.option-btn.wrong { background: #ef4444 !important; color: white !important; }
.final-header-bar {
    background: #0d47a1; 
    color: white;
    padding: 15px;
    border-radius: 8px;
    font-size: 1.2rem;
    font-weight: bold;
    text-align: center;
    margin-bottom: 20px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.2);
    text-transform: capitalize;
}
.final-pill-row {
    display: grid;
    grid-template-columns: 0.8fr 1.2fr 2fr 1fr; /* Rank | ID | Name | Score */
    gap: 10px;
    margin-bottom: 15px;
}

.final-pill {
    background: #1565c0;
    color: white;
    padding: 8px 5px;
    border-radius: 20px; /* Round Pill Shape */
    font-size: 0.85rem;
    font-weight: 600;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.final-row {
    background: #ffffff;
    color: #333;
    padding: 15px 10px;
    border-radius: 8px;
    margin-bottom: 10px;
    display: grid;
    grid-template-columns: 0.8fr 1.2fr 2fr 1fr; /* Matches Headers */
    align-items: center;
    text-align: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    font-weight: 500;
    font-size: 0.95rem;
}
.thank-you-card {
    background: #ffffff;
    color: #333;
    padding: 30px 20px;
    border-radius: 12px;
    margin-top: 30px;
    text-align: center;
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
}

.thank-text {
    font-size: 1rem;
    line-height: 1.5;
    color: #444;
    margin-bottom: 25px;
}
.btn-feedback-blue {
    background: #0d47a1;
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 6px;
    font-size: 1rem;
    cursor: pointer;
    width: 100%;
    max-width: 250px;
    transition: background 0.2s;
}

.btn-feedback-blue:hover { 
    background: #0a357a; 
}
#feedback-ui {
    display: none; 
    margin-top: 20px;
    border-top: 1px solid #eee;
    padding-top: 20px;
}
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-box {
    background: #1e293b;
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    border: 1px solid #334155;
    box-shadow: 0 4px 6px rgba(0,0,0,0.2);
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 600;
    color: #3b82f6;
    margin: 10px 0;
}
.admin-container {
    max-width: 500px; 
    margin: 0 auto;
    width: 100%;
}
.admin-stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 20px;
}

.admin-stat-box {
    background: #000000;
    color: white;
    padding: 10px 5px;
    border-radius: 8px;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 80px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
}

.active-box { border: 2px solid #00a8ff; } /* Blue outline for Active */

.stat-label { font-size: 0.65rem; margin-bottom: 5px; line-height: 1.2; opacity: 0.9; }
.stat-val { font-size: 1.2rem; font-weight: bold; }
.admin-timer-display {
    text-align: center;
    font-size: 3rem;
    font-weight: 600;
    background: white;
    color: black;
    border: 3px solid #333;
    width: fit-content;
    margin: 0 auto 25px auto;
    padding: 5px 25px;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    letter-spacing: 2px;
}
.admin-button-stack {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 35px;
}

.admin-btn {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 3px 5px rgba(0,0,0,0.2);
    transition: transform 0.1s;
}
.admin-btn:active { transform: scale(0.98); }

.btn-blue { background: #1e40af; color: white; border: 1px solid #172554; } 
.btn-blue:hover { background: #1e3a8a; }

.btn-red { background: #b91c1c; color: white; border: 1px solid #991b1b; }

/* 4. SECTION HEADERS */
.admin-section-header {
    background: #1e40af;
    color: white;
    text-align: center;
    padding: 10px;
    border-radius: 8px;
    font-weight: bold;
    margin-bottom: 15px;
    text-transform: uppercase;
    font-size: 0.9rem;
    letter-spacing: 1px;
}

/* 5. LIVE QUESTION CARD (Orange Accent) */
.admin-live-q-card {
    background: #ffffff;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    margin-bottom: 30px;
    border-left: 6px solid #f59e0b;
}

.admin-q-text {
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 15px;
}

.admin-options-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.admin-opt-btn {
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    padding: 10px;
    border-radius: 8px;
    color: #475569;
    font-size: 0.85rem;
    text-align: left;
}

/* 6. LIVE LEADERBOARD (Blue Header + White Rows) */
.admin-lb-header {
    display: grid;
    grid-template-columns: 0.5fr 1fr 2fr 1fr;
    gap: 10px;
    background: #1e3a8a;
    color: white;
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 10px;
    font-weight: bold;
    text-align: center;
    font-size: 0.8rem;
}

.admin-lb-row {
    display: grid;
    grid-template-columns: 0.5fr 1fr 2fr 1fr;
    gap: 10px;
    background: white;
    padding: 12px 10px;
    border-radius: 8px;
    margin-bottom: 8px;
    align-items: center;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    font-weight: 500;
    color: #333;
    font-size: 0.9rem;
}
/* =========================================
   🏆 FINAL SCREEN STYLES (Target Design Match)
   ========================================= */

/* Main Title */
.fs-title {
    color: #2563eb; 
    text-align: center;
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 20px;
}

/* "Leader board" Header Box */
.fs-main-header {
    background: #0d47a1; /* Dark Blue */
    color: white;
    padding: 15px;
    border-radius: 8px;
    text-align: center;
    font-weight: bold;
    font-size: 1.1rem;
    margin-bottom: 20px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.2);
}

/* Grid Layout */
.fs-grid-layout {
    display: grid;
    grid-template-columns: 0.6fr 1fr 2fr 0.8fr; 
    gap: 8px;
    align-items: center;
}

/* Column Headers (Pills) */
.fs-pill {
    background: #1565c0; /* Blue */
    color: white;
    padding: 8px 4px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Data Rows (Zebra Striping) */
.fs-row {
    background: #f3f4f6; /* Default Light Grey */
    color: #333;
    padding: 12px 5px;
    border-radius: 6px;
    margin-bottom: 5px;
    text-align: center;
    font-weight: 500;
    font-size: 0.95rem;
}

/* Make every ODD row white (Zebra Effect) */
.fs-row:nth-child(odd) {
    background: #ffffff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

/* Appreciation Card (Grey Box) */
.fs-card {
    background: #f3f4f6; /* Light Grey Background */
    border-radius: 12px;
    padding: 30px 20px;
    text-align: center;
    margin-top: 30px;
}

.fs-icon {
    font-size: 3.5rem;
    margin-bottom: 15px;
    display: block;
    color: #333;
}

.fs-text {
    color: #1f2937;
    font-size: 1.1rem;
    line-height: 1.4;
    margin-bottom: 25px;
    font-weight: 500;
}

/* Button */
.fs-btn {
    background: #0d47a1;
    color: white;
    padding: 12px 40px;
    border-radius: 8px;
    border: none;
    font-size: 1rem;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    transition: transform 0.1s;
}
.fs-btn:active { transform: scale(0.98); }

/* Stars */
.star-rating {
    font-size: 2.5rem;
    cursor: pointer;
    color: #cbd5e1; /* Grey inactive */
    transition: color 0.2s;
    margin: 0 2px;
}
.star-rating.active { color: #f59e0b; } /* Gold active */
/* ===============================
   QUIZ ENDED SCREEN
================================ */

#ended-screen{
    display:none;
    justify-content:center;
    align-items:center;
    min-height:100vh;
    width:100%;
    box-sizing:border-box;
    padding:20px;
}

#ended-screen.active{
    display:flex;
}

.ended-card{
    background:#ffffff;
    padding:32px 24px;
    border-radius:16px;
    text-align:center;
    box-shadow:0 10px 30px rgba(0,0,0,0.25);
    max-width:420px;
    width:100%;
    box-sizing:border-box;
}

.ended-icon{
    font-size:55px;
    margin-bottom:10px;
}

.ended-card h2{
    font-size:22px;
    color:#111827;
    margin-bottom:8px;
}

.ended-card p{
    color:#6b7280;
    margin-bottom:20px;
}

.ended-btn{
    background:#2563eb;
    color:#fff;
    border:none;
    padding:12px 26px;
    border-radius:8px;
    font-weight:600;
    cursor:pointer;
    transition:0.2s;
}

.ended-btn:hover{
    background:#1d4ed8;
}
.ended-card{
    background:#fff;
    padding:32px 20px;
    border-radius:14px;
    text-align:center;
    max-width:420px;
    width:100%;
    margin:auto;
    box-sizing:border-box;
}

.ended-icon{
    font-size:50px;
}

.ended-btn{
    background:#2563eb;
    color:#fff;
    border:none;
    padding:12px 24px;
    border-radius:8px;
    cursor:pointer;
}
/* =========================
   JOIN TOGGLE
========================= */

.join-toggle-wrap{

    display:flex;

    align-items:center;

    justify-content:center;

    gap:14px;

    padding:14px;

    background:rgba(255,255,255,0.06);

    border-radius:14px;

    margin-top:10px;
}

.join-label{

    font-weight:700;

    color:white;
}

.switch{

    position:relative;

    display:inline-block;

    width:58px;

    height:30px;
}

.switch input{

    opacity:0;

    width:0;

    height:0;
}

.slider{

    position:absolute;

    cursor:pointer;

    inset:0;

    background:#ef4444;

    transition:.3s;

    border-radius:999px;
}

.slider:before{

    position:absolute;

    content:"";

    height:22px;

    width:22px;

    left:4px;

    bottom:4px;

    background:white;

    transition:.3s;

    border-radius:50%;
}

input:checked + .slider{

    background:#22c55e;
}

input:checked + .slider:before{

    transform:translateX(28px);
}

#join-status-text{

    font-weight:800;

    min-width:50px;

    color:white;
}
.timer-wrapper{
    display:flex;
    flex-direction:column;
    align-items:flex-end;
    gap:6px;
}

.timer-box{
    min-width:75px;
    text-align:center;

    background:linear-gradient(
        135deg,
        #2563eb,
        #1d4ed8
    );

    color:white;

    padding:10px 14px;

    border-radius:14px;

    font-size:1rem;

    font-weight:800;

    box-shadow:
        0 4px 15px rgba(37,99,235,0.3);
}

.timer-bar{

    width:120px;

    height:6px;

    background:
        rgba(255,255,255,0.12);

    border-radius:20px;

    overflow:hidden;
}

.timer-fill{

    width:100%;

    height:100%;

    border-radius:20px;

    background:linear-gradient(
        90deg,
        #22c55e,
        #f59e0b,
        #ef4444
    );
}
.hidden{
    display:none !important;
}
.answer-feedback{

    display:flex;

    flex-direction:column;

    align-items:center;

    justify-content:center;

    text-align:center;

    padding:35px 20px;

    border-radius:24px;

    animation:popIn .35s ease;
}

.answer-feedback.correct{

    background:
        linear-gradient(
            135deg,
            rgba(34,197,94,.18),
            rgba(22,163,74,.08)
        );

    border:2px solid #000000;
}

.answer-feedback.wrong{

    background:
        linear-gradient(
            135deg,
            rgba(239,68,68,.18),
            rgba(185,28,28,.08)
        );

    border:2px solid #ef4444;
}

.answer-feedback.timeout{

    background:
        linear-gradient(
            135deg,
            rgba(245,158,11,.18),
            rgba(217,119,6,.08)
        );

    border:2px solid #f59e0b;
}

.feedback-icon{

    font-size:4rem;

    margin-bottom:15px;
}

.feedback-title{

    font-size:2rem;

    font-weight:700;

    margin-bottom:10px;

    color:white;
}

.feedback-sub{

    font-size:1rem;

    color:#d1d5db;

    font-weight:700;
}

@keyframes popIn{

    from{

        transform:scale(.8);

        opacity:0;
    }

    to{

        transform:scale(1);

        opacity:1;
    }
}
.csv-upload-box{

    padding:20px;
    margin-bottom:20px;
}

.csv-input{

    width:100%;
    padding:14px;
    border-radius:12px;
    border:none;
    background:#1e293b;
    color:white;
    margin-bottom:18px;
}

.csv-btn-row{

    display:flex;
    gap:12px;
    margin-bottom:12px;
}

.csv-btn-row button{

    flex:1;
}

.csv-format-text{

    font-size:13px;
    color:#94a3b8;
    line-height:1.6;
}

/* =========================================
   QUESTION SCREEN - REDESIGNED
   ========================================= */

.qscreen-wrap {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 4px 0;
}

/* Top bar: Q number + timer */
.qscreen-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.qscreen-badge {
    background: #1e40af;
    color: white;
    font-size: 1rem;
    font-weight: 600;
    padding: 6px 16px;
    border-radius: 20px;
    letter-spacing: 0.5px;
}

.qscreen-timer {
    background: #0f172a;
    color: #f59e0b;
    font-size: 1.4rem;
    font-weight: 700;
    padding: 6px 18px;
    border-radius: 12px;
    font-family: monospace;
    min-width: 64px;
    text-align: center;
    border: 2px solid #f59e0b;
}

/* Timer progress bar */
.qscreen-timerbar {
    width: 100%;
    height: 8px;
    background: rgba(255,255,255,0.1);
    border-radius: 99px;
    overflow: hidden;
}

.qscreen-timerbar-fill {
    height: 100%;
    width: 100%;
    border-radius: 99px;
    background: linear-gradient(90deg, #22c55e, #f59e0b, #ef4444);
    transition: width linear;
}

/* Question text box */
.qscreen-question {
    background: #ffffff;
    color: #1e293b;
    font-size: 1.15rem;
    font-weight: 600;
    line-height: 1.6;
    padding: 20px 18px;
    border-radius: 14px;
    border-left: 5px solid #3b82f6;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    white-space: pre-wrap;
    word-break: break-word;
}

/* Options grid: 2 columns */
.qscreen-options {

    display: flex;

    flex-direction: column;

    gap: 14px;

    width: 100%;
}

/* Each option button */
.qscreen-opt {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #ffffff;
    color: #1e293b;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 14px 12px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    text-align: left;
    transition: transform 0.15s, box-shadow 0.15s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    width: 100%;
    margin-bottom: 0;
}

.qscreen-opt:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.15);
}

.qscreen-opt:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* A / B / C / D label pill */
.qscreen-opt-label {

    min-width: 38px;

    height: 38px;

    border-radius: 12px;

    background: #111827;

    color: white;

    font-weight: 600;

    font-size: 1rem;

    display: flex;

    align-items: center;

    justify-content: center;

    flex-shrink: 0;
}

.qscreen-opt-text {
    flex: 1;
    line-height: 1.4;
    word-break: break-word;
}

/* =========================================
   🖥️ ADMIN GRID DASHBOARD
   ========================================= */

#admin-dashboard {
    display: block !important;
    width: 100%;
    min-height: 100vh;
    background: #f1f5f9;
    position: fixed;
    inset: 0;
    overflow-y: auto;
    z-index: 10;
}

#admin-dashboard.hidden {
    display: none !important;
}

.adm-page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* HEADER */
.adm-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #ffffff;
    color: rgb(193, 0, 0);
    padding: 14px 20px;
    border-radius: 12px;
    margin-bottom: 20px;
}

.adm-header-title {
    font-size: 1.2rem;
    font-weight: 600;
    letter-spacing: 1px;
}

.adm-logout-btn {
    background: #b91c1c;
    color: white;
    border: none;
    padding: 8px 18px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    width: auto;
    margin: 0;
    font-size: 0.85rem;
}

/* STATS GRID */
.adm-stats-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
    margin-bottom: 20px;
}

.adm-stat-card {
    background: #ffffff;
    border-radius: 12px;
    padding: 16px 10px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    border-top: 4px solid #3b82f6;
}

.adm-stat-active { border-top-color: #22c55e; }
.adm-stat-timer  { border-top-color: #f59e0b; }

.adm-stat-icon { font-size: 1.4rem; margin-bottom: 4px; }
.adm-stat-num  { font-size: 1.5rem; font-weight: 700; color: #1e293b; line-height: 1.1; }
.adm-stat-lbl  { font-size: 0.7rem; color: #64748b; margin-top: 4px; font-weight: 700; text-transform: uppercase; }

/* MAIN 2-COLUMN GRID */
.adm-main-grid {
    display: grid;
    grid-template-columns: 340px 1fr;
    gap: 20px;
    align-items: start;
}

.adm-col {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* CARDS */
.adm-card {
    background: #ffffff;
    border-radius: 12px;
    padding: 18px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.07);
}

.adm-card-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: #1e3a8a;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 14px;
    padding-bottom: 8px;
    border-bottom: 2px solid #e2e8f0;
}

/* BUTTON GRID (2 cols) */
.adm-btn-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.adm-btn {
    padding: 11px 8px;
    border: none;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    width: 100%;
    margin: 0;
    transition: opacity 0.15s, transform 0.1s;
}

.adm-btn:active  { transform: scale(0.97); }
.adm-btn:disabled { opacity: 0.45; cursor: not-allowed; }

.adm-btn-green  { background: #16a34a; color: white; }
.adm-btn-blue   { background: #1e40af; color: white; }
.adm-btn-orange { background: #d97706; color: white; }
.adm-btn-red    { background: #b91c1c; color: white; }

/* TOGGLE ROWS */
.adm-toggle-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid #f1f5f9;
}
.adm-toggle-row:last-child { border-bottom: none; }

.adm-toggle-lbl { flex: 1; font-size: 0.9rem; font-weight: 700; color: #334155; }
.adm-toggle-val { font-weight: 600; font-size: 0.85rem; color: #1e3a8a; min-width: 36px; }

/* FILE UPLOAD */
.adm-upload-block { display: flex; flex-direction: column; gap: 10px; }
.adm-upload-lbl   { font-size: 0.8rem; font-weight: 600; color: #475569; text-transform: uppercase; }
.adm-file-input   {
    width: 100%;
    padding: 8px;
    border-radius: 8px;
    border: 1px dashed #94a3b8;
    background: #f8fafc;
    color: #334155;
    font-size: 0.85rem;
    margin: 0;
}

/* EMPTY STATE */
.adm-empty {
    text-align: center;
    color: #94a3b8;
    padding: 24px;
    font-size: 0.9rem;
}

/* RESPONSIVE */
@media (max-width: 900px) {
    .adm-stats-grid { grid-template-columns: repeat(3, 1fr); }
    .adm-main-grid  { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
    .adm-page         { padding: 10px; }
    .adm-stats-grid   { grid-template-columns: repeat(3, 1fr); gap: 6px; }
    .adm-stat-card    { padding: 10px 6px; }
    .adm-stat-num     { font-size: 1rem; }
    .adm-stat-lbl     { font-size: 0.58rem; }
    .adm-card         { padding: 12px; }
    .adm-header-title { font-size: 0.9rem; }
    .adm-btn          { font-size: 0.78rem; padding: 9px 6px; }
    .adm-main-grid    { gap: 12px; }
    .admin-lb-header,
    .admin-lb-row     { font-size: 0.75rem; padding: 8px 6px; gap: 6px; }
}

@media (max-width: 400px) {
    .adm-stats-grid { grid-template-columns: repeat(2, 1fr); }
    .adm-btn-grid   { grid-template-columns: 1fr 1fr; }
    .adm-toggle-lbl { font-size: 0.8rem; }
}

/* =========================================
   HOST DASHBOARD — FULL WIDTH SCREENS
   ========================================= */

#host-dashboard {
    width: 100%;
    min-height: 100vh;
}

/* Every screen inside host-dashboard fills viewport */
.hd-screen {
    width: 100%;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px 16px;
    box-sizing: border-box;
    background: transparent;
    overflow-x: hidden;
    overflow-y: auto;
}

/* ── WAITING SCREEN ── */
#waiting-screen {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
    pointer-events: none;
}

#waiting-screen.hidden { display: none !important; }

.hd-wait-card {
    pointer-events: all;
    background: #ffffff;
    border-radius: 20px;
    padding: 48px 36px;
    text-align: center;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.10);
    position: relative;
    transform: none !important;
    user-select: none;
}

.hd-wait-icon  { font-size: 3.5rem; margin-bottom: 16px; }
.hd-wait-title { font-size: 1.6rem; font-weight: 700; color: #1e3a8a; margin-bottom: 8px; }
.hd-wait-sub   { color: #64748b; font-size: 0.95rem; font-weight: 600; margin-bottom: 24px; }

/* Animated dots */
.hd-wait-dots { display: flex; justify-content: center; gap: 8px; }
.hd-wait-dots span {
    width: 10px; height: 10px;
    border-radius: 50%;
    background: #3b82f6;
    animation: hdBounce 1.2s infinite ease-in-out;
}
.hd-wait-dots span:nth-child(2) { animation-delay: 0.2s; }
.hd-wait-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes hdBounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40%            { transform: scale(1);   opacity: 1;   }
}

.hd-q-logo-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
}

.hd-q-logo-img {
    width: 120px;
    height: 120px;
    object-fit: contain;
    border-radius: 16px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    background: #f8fafc;
    padding: 10px;
}

.hd-q-logo-hint {
    font-size: 0.95rem;
    color: #64748b;
    font-weight: 500;
    margin: 0;
}

/* ── QUESTION SCREEN ── */
.hd-q-wrap {
    width: 100%;
    max-width: 680px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* =========================================
   NEW QUESTION UI — qq-*
   ========================================= */

#question-screen {
    width: 100%;
    min-height: 100vh;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 20px 16px 32px;
    box-sizing: border-box;
    background: #f8fafc;
    overflow-y: auto;
}

.qq-wrap {
    width: 100%;
    max-width: 500px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    animation: qqSlide 0.35s cubic-bezier(0.22,1,0.36,1) both;
    box-sizing: border-box;
    padding-bottom: 24px;
}

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

/* HEADER ROW */
.qq-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 4px;
}

.qq-progress {
    background: #1e3a8a;
    color: white;
    border-radius: 99px;
    padding: 8px 20px;
    display: flex;
    align-items: baseline;
    gap: 4px;
    box-shadow: 0 4px 12px rgba(30,58,138,0.25);
}

.qq-num   { font-size: 1.5rem; font-weight: 800; line-height: 1; color: white; }
.qq-sep   { font-size: 1rem;   font-weight: 600; opacity: 0.5; color: white; }
.qq-total { font-size: 1rem;   font-weight: 700; opacity: 0.7; color: white; }

.qq-timer-ring {
    background: #0f172a;
    border: 3px solid #f59e0b;
    border-radius: 99px;
    padding: 7px 20px;
    display: flex;
    align-items: baseline;
    gap: 3px;
    box-shadow: 0 0 16px rgba(245,158,11,0.4);
}

.qq-timer-val  { font-size: 1.7rem; font-weight: 800; color: #f59e0b; line-height: 1; font-variant-numeric: tabular-nums; }
.qq-timer-unit { font-size: 0.85rem; font-weight: 700; color: #f59e0b; opacity: 0.8; }

/* TIMER BAR */
.qq-timerbar {
    width: 100%;
    height: 8px;
    background: #e2e8f0;
    border-radius: 99px;
    overflow: hidden;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.08);
}

.qq-timerbar-fill {
    height: 100%;
    width: 100%;
    border-radius: 99px;
    background: linear-gradient(90deg, #22c55e 0%, #f59e0b 55%, #ef4444 100%);
    transform-origin: left;
}

/* QUESTION BODY CARD */
.qq-body {
    background: #ffffff;
    border-radius: 18px;
    padding: 24px 20px;
    box-shadow: 0 2px 16px rgba(0,0,0,0.08);
    border-top: 5px solid #1e3a8a;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
}

.qq-logo-wrap { display: flex; justify-content: center; }

.qq-logo {
    width: 80px;
    height: 80px;
    object-fit: contain;
    border-radius: 12px;
    background: #f8fafc;
    padding: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
}

.qq-question {
    font-size: 1.15rem;
    font-weight: 700;
    color: #1e293b;
    line-height: 1.65;
    text-align: center;
    white-space: pre-wrap;
    word-break: break-word;
    width: 100%;
}

/* OPTIONS — vertical list */
.qq-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
}

.qq-opt {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #ffffff;
    border: 2px solid #e2e8f0;
    border-radius: 14px;
    padding: 14px 16px;
    font-size: 0.97rem;
    font-weight: 700;
    color: #1e293b;
    cursor: pointer;
    text-align: left;
    margin: 0;
    width: 100%;
    transition: border-color 0.12s, box-shadow 0.12s, transform 0.1s, background 0.12s;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    animation: qqOptIn 0.28s ease both;
    -webkit-tap-highlight-color: transparent;
}

.qq-opt:nth-child(1) { animation-delay: 0.04s; }
.qq-opt:nth-child(2) { animation-delay: 0.09s; }
.qq-opt:nth-child(3) { animation-delay: 0.14s; }
.qq-opt:nth-child(4) { animation-delay: 0.19s; }

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

.qq-opt:hover:not(:disabled) {
    border-color: var(--opt-color, #1e3a8a);
    box-shadow: 0 4px 14px rgba(0,0,0,0.10);
    transform: translateY(-1px);
    background: #fafbff;
}

.qq-opt:active:not(:disabled) {
    transform: scale(0.98);
}

.qq-opt:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.qq-opt-label {
    min-width: 36px;
    height: 36px;
    border-radius: 10px;
    color: white;
    font-weight: 800;
    font-size: 0.88rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    letter-spacing: 0.3px;
}

.qq-opt-text {
    flex: 1;
    line-height: 1.45;
    word-break: break-word;
    font-size: 0.97rem;
}

/* RANKING & FINAL screens — scrollable */
#ranking-screen,
#final-screen {
    align-items: flex-start;
    padding-top: 20px;
    overflow-y: auto;
}

/* MOBILE */
@media (max-width: 480px) {
    #question-screen  { padding: 12px 12px 24px; }
    .qq-wrap          { gap: 12px; }
    .qq-body          { padding: 18px 14px; }
    .qq-question      { font-size: 1rem; }
    .qq-opt           { font-size: 0.9rem; padding: 12px 12px; }
    .qq-opt-label     { min-width: 30px; height: 30px; font-size: 0.8rem; border-radius: 8px; }
    .qq-num           { font-size: 1.2rem; }
    .qq-timer-val     { font-size: 1.4rem; }
    .qq-timer-ring    { padding: 5px 14px; }
    .qq-progress      { padding: 6px 14px; }
}
.hd-disq-card {
    background: #ffffff;
    border-radius: 20px;
    padding: 48px 36px;
    text-align: center;
    max-width: 400px;
    width: 100%;
    box-shadow: 0 8px 32px rgba(239,68,68,0.15);
    border-top: 5px solid #ef4444;
}

.hd-disq-btn {
    background: #ef4444;
    color: white;
    border: none;
    padding: 12px 36px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    width: auto;
    margin: 0;
}

/* ── MOBILE ── */
@media (max-width: 480px) {
    .hd-screen      { padding: 14px;}
    .hd-q-text      { font-size: 1rem; padding: 16px 14px; }
    .hd-q-opt       { padding: 12px 12px; font-size: 0.92rem; }
    .hd-q-opt-label { min-width: 30px; height: 30px; font-size: 0.85rem; }
    .hd-q-timer     { font-size: 1.2rem; padding: 5px 14px; }
    #waiting-screen { padding: 16px; }
    .hd-wait-card   { padding: 36px 20px; max-width: 100%; }
}

/* =========================================
   LEADERBOARD — RANKING & FINAL SCREENS
   ========================================= */

/* Full-page wrapper */
.lb-page {
    width: 100%;
    max-width: 520px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    box-sizing: border-box;
    padding: 0 4px;
}

/* Blue header bar */
.lb-header-bar {
    background: #1e3a8a;
    color: white;
    text-align: center;
    font-size: 1rem;
    font-weight: 700;
    padding: 12px 20px;
    border-radius: 12px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

/* Result banner */
.lb-result-banner {
    border-radius: 14px;
    padding: 20px 16px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.lb-banner-correct { background: #f0fdf4; border: 2px solid #22c55e; }
.lb-banner-wrong   { background: #fef2f2; border: 2px solid #ef4444; }
.lb-banner-timeout { background: #fffbeb; border: 2px solid #f59e0b; }

.lb-result-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    font-weight: 700;
}

.lb-icon-correct { background: #22c55e; color: white; }
.lb-icon-correct::after { content: '\2713'; }

.lb-icon-wrong   { background: #ef4444; color: white; }
.lb-icon-wrong::after { content: '\2717'; }

.lb-icon-timeout { background: #f59e0b; color: white; }
.lb-icon-timeout::after { content: '\23F0'; }

.lb-result-label {
    font-size: 1.2rem;
    font-weight: 700;
    color: #1e293b;
}

.lb-result-stats {
    display: flex;
    gap: 16px;
    font-size: 0.85rem;
    font-weight: 700;
    margin-top: 4px;
}

.lb-stat-correct { color: #16a34a; }
.lb-stat-wrong   { color: #dc2626; }
.lb-stat-timeout { color: #d97706; }

/* Table container */
.lb-table {
    background: #ffffff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}

/* Header row */
.lb-table-head {
    display: grid;
    grid-template-columns: 0.5fr 1fr 2.2fr 0.8fr;
    background: #1e3a8a;
    color: white;
    padding: 10px 14px;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    gap: 10px;
}

/* Data rows */
.lb-table-row {
    display: grid;
    grid-template-columns: 0.5fr 1fr 2.2fr 0.8fr;
    padding: 12px 14px;
    gap: 10px;
    align-items: center;
    border-bottom: 1px solid #f1f5f9;
    font-size: 0.9rem;
    font-weight: 600;
    color: #1e293b;
    transition: background 0.15s;
}

.lb-table-row:last-child { border-bottom: none; }

.lb-table-row:nth-child(even) { background: #f8fafc; }

/* Top rank — gold accent */
.lb-row-top {
    background: #fffbeb !important;
    border-left: 4px solid #f59e0b;
}

/* Current user highlight */
.lb-row-me {
    background: #eff6ff !important;
    border-left: 4px solid #3b82f6;
    font-weight: 700;
}

.lb-rank  { font-weight: 700; color: #1e3a8a; text-align: center; }
.lb-id    { font-size: 0.82rem; color: #64748b; padding-left: 4px; }
.lb-name  { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-left: 2px; }
.lb-score { font-weight: 800; color: #16a34a; text-align: center; font-size: 1rem; }

/* Final leaderboard — same 4 cols as live */
.lb-table-head.lb-final,
.lb-table-row.lb-final {
    grid-template-columns: 0.5fr 1fr 2.2fr 0.8fr;
}

/* =========================================
   🎉 FINAL LEADERBOARD CELEBRATION
   ========================================= */

#final-screen .lb-page {
    animation: celebrationPop 0.6s cubic-bezier(0.175,0.885,0.32,1.275) both;
}

@keyframes celebrationPop {
    0%   { opacity:0; transform: scale(0.85) translateY(30px); }
    100% { opacity:1; transform: scale(1)   translateY(0); }
}

#final-screen .lb-header-bar {
    animation: headerFlash 1.8s ease infinite alternate;
}

@keyframes headerFlash {
    0%   { background: #1e3a8a; box-shadow: 0 0 0px rgba(59,130,246,0); }
    50%  { background: #1d4ed8; box-shadow: 0 0 18px rgba(59,130,246,0.5); }
    100% { background: #1e40af; box-shadow: 0 0 28px rgba(99,102,241,0.6); }
}

#final-screen .lb-row-top {
    animation: goldPulse 1.2s ease infinite alternate;
}

@keyframes goldPulse {
    0%   { box-shadow: 0 0 0px rgba(245,158,11,0); border-left-color: #f59e0b; }
    100% { box-shadow: 0 0 16px rgba(245,158,11,0.5); border-left-color: #fbbf24; }
}

#final-screen .lb-table-row {
    animation: rowSlideIn 0.4s ease both;
}

#final-screen .lb-table-row:nth-child(1)  { animation-delay: 0.05s; }
#final-screen .lb-table-row:nth-child(2)  { animation-delay: 0.10s; }
#final-screen .lb-table-row:nth-child(3)  { animation-delay: 0.15s; }
#final-screen .lb-table-row:nth-child(4)  { animation-delay: 0.20s; }
#final-screen .lb-table-row:nth-child(5)  { animation-delay: 0.25s; }
#final-screen .lb-table-row:nth-child(6)  { animation-delay: 0.30s; }
#final-screen .lb-table-row:nth-child(7)  { animation-delay: 0.35s; }
#final-screen .lb-table-row:nth-child(8)  { animation-delay: 0.40s; }
#final-screen .lb-table-row:nth-child(9)  { animation-delay: 0.45s; }
#final-screen .lb-table-row:nth-child(10) { animation-delay: 0.50s; }

@keyframes rowSlideIn {
    0%   { opacity:0; transform: translateX(-20px); }
    100% { opacity:1; transform: translateX(0); }
}

@media (max-width: 480px) {
    .lb-table-head,
    .lb-table-row     { grid-template-columns: 0.5fr 0.8fr 1.6fr 0.7fr; padding: 9px 8px; font-size: 0.78rem; gap: 6px; }
    .lb-table-head.lb-final,
    .lb-table-row.lb-final { grid-template-columns: 0.5fr 0.8fr 1.6fr 0.7fr; font-size: 0.78rem; }
    .lb-result-stats  { gap: 8px; font-size: 0.75rem; flex-wrap: wrap; justify-content: center; }
    .lb-header-bar    { font-size: 0.85rem; padding: 10px 14px; }
    .lb-result-banner { padding: 14px 12px; }
    .lb-name          { font-size: 0.8rem; }
    .hd-screen        { padding: 12px; align-items: flex-start; padding-top: 16px; }
    #waiting-screen   { padding: 16px; }
    .hd-wait-card     { padding: 32px 18px; max-width: 100%; }
    .hd-disq-card     { padding: 32px 18px; }
    .ended-card       { padding: 28px 16px; }
}
