/* Style for Torah Trivia Web Application */

/* Theme Variables */
:root {
    /* Dark Theme (Default) */
    --bg-main: #0a0915;
    --bg-gradient: linear-gradient(135deg, #0a0915 0%, #151130 100%);
    --card-bg: rgba(21, 19, 44, 0.75);
    --card-border: rgba(147, 51, 234, 0.25);
    --card-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.5);
    --text-main: #f3f4f6;
    --text-muted: #9ca3af;
    --primary: #9333ea;
    --primary-hover: #a855f7;
    --primary-glow: rgba(147, 51, 234, 0.6);
    --secondary: #d97706;
    --secondary-hover: #f59e0b;
    --secondary-glow: rgba(217, 119, 6, 0.6);
    --success: #10b981;
    --success-glow: rgba(16, 185, 129, 0.4);
    --error: #ef4444;
    --error-glow: rgba(239, 68, 68, 0.4);
    --input-bg: rgba(30, 27, 61, 0.6);
    --input-border: rgba(147, 51, 234, 0.3);
    
    --header-bg: rgba(10, 9, 21, 0.85);
    --footer-bg: rgba(5, 4, 10, 0.9);
    --hud-bg: rgba(30, 27, 61, 0.8);
    
    --transition-speed: 0.3s;
}

[data-theme="light"] {
    /* Light Theme */
    --bg-main: #f5f6fa;
    --bg-gradient: linear-gradient(135deg, #f5f6fa 0%, #e9eaf2 100%);
    --card-bg: rgba(255, 255, 255, 0.85);
    --card-border: rgba(124, 58, 237, 0.2);
    --card-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.08);
    --text-main: #1f2937;
    --text-muted: #6b7280;
    --primary: #7c3aed;
    --primary-hover: #6d28d9;
    --primary-glow: rgba(124, 58, 237, 0.4);
    --secondary: #d97706;
    --secondary-hover: #b45309;
    --secondary-glow: rgba(217, 119, 6, 0.4);
    --success: #10b981;
    --success-glow: rgba(16, 185, 129, 0.3);
    --error: #ef4444;
    --error-glow: rgba(239, 68, 68, 0.3);
    --input-bg: rgba(255, 255, 255, 0.9);
    --input-border: rgba(124, 58, 237, 0.3);
    
    --header-bg: rgba(245, 246, 250, 0.85);
    --footer-bg: rgba(233, 234, 242, 0.9);
    --hud-bg: rgba(255, 255, 255, 0.9);
}

/* Global Reset & Zero-Scrolling Fit */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Rubik', 'Outfit', system-ui, -apple-system, sans-serif;
    background: var(--bg-main);
    background-image: var(--bg-gradient);
    color: var(--text-main);
    height: 100vh;
    overflow: hidden; /* Lock body scrolling completely */
    display: flex;
    flex-direction: column;
    position: relative;
    transition: background var(--transition-speed), color var(--transition-speed);
}

/* Floating Hebrew Letters Background */
.letters-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
    opacity: 0.03;
    transition: opacity var(--transition-speed);
}

[data-theme="light"] .letters-bg {
    opacity: 0.06;
}

.floating-letter {
    position: absolute;
    font-size: 3rem;
    font-weight: 800;
    user-select: none;
    animation: float-letters 20s linear infinite;
    color: var(--primary);
}

@keyframes float-letters {
    0% {
        transform: translateY(110vh) rotate(0deg);
        opacity: 0;
    }
    10% { opacity: 1; }
    90% { opacity: 1; }
    100% {
        transform: translateY(-10vh) rotate(360deg);
        opacity: 0;
    }
}

/* Helper utilities */
.d-none { display: none !important; }
.text-center { text-align: center; }
.text-left { text-align: left; }
.w-100 { width: 100%; }
.color-gold { color: var(--secondary) !important; }
.color-green { color: var(--success) !important; }

/* SVG Icons configuration */
.svg-icon {
    width: 1.25rem;
    height: 1.25rem;
    fill: currentColor;
    display: inline-block;
    vertical-align: middle;
}

/* App Header */
.app-header {
    background: var(--header-bg);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--card-border);
    height: 60px;
    flex-shrink: 0;
    padding: 0.5rem 1.5rem;
    z-index: 10;
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 100%;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo-icon {
    color: var(--secondary);
    filter: drop-shadow(0 0 8px var(--secondary-glow));
    animation: crown-pulse 3s infinite ease-in-out;
}

.logo-icon svg {
    width: 1.8rem;
    height: 1.8rem;
}

.logo h1 {
    font-size: 1.35rem;
    font-weight: 800;
    background: linear-gradient(90deg, var(--secondary) 0%, var(--primary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-pill {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    background: var(--hud-bg);
    border: 1px solid var(--card-border);
    padding: 0.2rem 0.65rem 0.2rem 0.85rem;
    border-radius: 50px;
    font-size: 0.85rem;
}

.username { font-weight: 600; }
.user-score { color: var(--secondary); font-weight: 800; }

.icon-btn {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    color: var(--text-main);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.icon-btn:hover {
    background: var(--primary);
    color: #fff;
    transform: scale(1.05);
    box-shadow: 0 0 8px var(--primary-glow);
}

.icon-btn svg {
    width: 1.2rem;
    height: 1.2rem;
}

/* Main Action Flex Container */
.app-main {
    flex: 1;
    min-height: 0; /* Important: allows flex children to shrink */
    z-index: 1;
    position: relative;
    width: 100%;
}

.app-layout {
    display: flex;
    flex-direction: row;
    height: 100%;
    width: 100%;
    min-height: 0;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0.8rem;
    gap: 1.25rem;
}

/* Main Content Panel */
.main-content-area {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 100%;
}

/* Glassmorphism card elements */
.glass-card {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    padding: 1.5rem;
    box-shadow: var(--card-shadow);
    width: 100%;
    max-height: 100%;
    display: flex;
    flex-direction: column;
    min-height: 0;
    transition: border-color var(--transition-speed);
}

/* Persistent User Progress Sidebar */
/* CRITICAL FIX: Staged after .glass-card to override default card widths */
.activity-sidebar {
    width: 270px !important;
    max-width: 270px !important;
    flex-shrink: 0 !important;
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    padding: 1.2rem !important;
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border-bottom: 1px solid var(--card-border);
    padding-bottom: 0.6rem;
    margin-bottom: 0.75rem;
}

.sidebar-header h3 {
    font-size: 1.05rem;
    font-weight: 700;
}

.pulse-dot {
    width: 8px;
    height: 8px;
    background: var(--success);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--success);
    animation: pulse-dot-anim 1.8s infinite ease-in-out;
}

@keyframes pulse-dot-anim {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.4); opacity: 0.4; }
}

.activity-feed {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding-right: 0.2rem;
    scrollbar-width: thin;
}

.activity-item {
    background: var(--input-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 0.65rem;
    font-size: 0.82rem;
    animation: slide-in-activity 0.3s ease forwards;
}

@keyframes slide-in-activity {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.activity-item-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-bottom: 0.2rem;
}

.activity-user {
    font-weight: 700;
    color: var(--secondary);
}

.activity-msg {
    color: var(--text-main);
    line-height: 1.35;
    word-break: break-word;
}

/* Circular glowing profile rank avatars */
.user-avatar {
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
    border: 2px solid rgba(255, 255, 255, 0.1);
    background-size: 200% 200%;
    animation: animate-avatar-bg 5s ease infinite;
}

@keyframes animate-avatar-bg {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.avatar-sm {
    width: 28px;
    height: 28px;
}

.avatar-sm svg {
    width: 14px;
    height: 14px;
}

.avatar-md {
    width: 32px;
    height: 32px;
}

.avatar-md svg {
    width: 16px;
    height: 16px;
}

.avatar-lg {
    width: 80px;
    height: 80px;
    border-width: 3px;
    filter: drop-shadow(0 0 15px var(--primary-glow));
    transition: transform 0.3s ease;
}

.avatar-lg:hover {
    transform: scale(1.08) rotate(6deg);
}

.avatar-lg svg {
    width: 44px;
    height: 44px;
}

/* 10 Rank Color Theme Themes */
.rank-theme-disciple {
    background-image: linear-gradient(135deg, #4b5563 0%, #1f2937 100%);
    border-color: #6b7280;
}
.rank-theme-young {
    background-image: linear-gradient(135deg, #2563eb 0%, #1e3a8a 100%);
    border-color: #3b82f6;
}
.rank-theme-fellow {
    background-image: linear-gradient(135deg, #0d9488 0%, #115e59 100%);
    border-color: #14b8a6;
}
.rank-theme-sage {
    background-image: linear-gradient(135deg, #0891b2 0%, #164e63 100%);
    border-color: #06b6d4;
}
.rank-theme-teacher {
    background-image: linear-gradient(135deg, #16a34a 0%, #14532d 100%);
    border-color: #22c55e;
}
.rank-theme-prodigy {
    background-image: linear-gradient(135deg, #7c3aed 0%, #4c1d95 100%);
    border-color: #8b5cf6;
}
.rank-theme-genius {
    background-image: linear-gradient(135deg, #db2777 0%, #831843 100%);
    border-color: #ec4899;
}
.rank-theme-dean {
    background-image: linear-gradient(135deg, #ca8a04 0%, #713f12 100%);
    border-color: #eab308;
    animation: gold-glow 2.5s infinite ease-in-out;
}
.rank-theme-decisor {
    background-image: linear-gradient(135deg, #ea580c 0%, #7c2d12 100%);
    border-color: #f97316;
    animation: orange-glow 2.5s infinite ease-in-out;
}
.rank-theme-beacon {
    background-image: linear-gradient(135deg, #e11d48 0%, #ffe119 50%, #4f46e5 100%);
    border-color: #f43f5e;
    animation: rainbow-glow 2.5s infinite ease-in-out;
}

@keyframes gold-glow {
    0%, 100% { box-shadow: 0 0 10px rgba(234, 179, 8, 0.4); }
    50% { box-shadow: 0 0 20px rgba(234, 179, 8, 0.8); }
}
@keyframes orange-glow {
    0%, 100% { box-shadow: 0 0 10px rgba(249, 115, 22, 0.4); }
    50% { box-shadow: 0 0 20px rgba(249, 115, 22, 0.8); }
}
@keyframes rainbow-glow {
    0%, 100% { box-shadow: 0 0 12px rgba(244, 63, 94, 0.4), 0 0 6px rgba(79, 70, 229, 0.4); }
    50% { box-shadow: 0 0 24px rgba(244, 63, 94, 0.8), 0 0 12px rgba(79, 70, 229, 0.8); }
}

/* Rank XP Progress bar */
.rank-progress-container {
    margin: 0.8rem 0 1rem 0;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.rank-progress-text {
    display: flex;
    justify-content: space-between;
    font-size: 0.78rem;
    color: var(--text-muted);
}

.rank-progress-bar {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
}

.rank-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--secondary) 0%, var(--primary) 100%);
    width: 0%;
    border-radius: 4px;
    transition: width 0.4s ease;
}

.menu-avatar-container {
    display: flex;
    justify-content: center;
    margin-bottom: 0.8rem;
}

.screen-section {
    width: 100%;
    max-height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 0;
}

/* Layout stacking fix on game screen */
.screen-section#screenGame {
    flex-direction: column !important;
}

.screen-section#screenGame .game-hud, 
.screen-section#screenGame .timer-bar-container, 
.screen-section#screenGame .game-card {
    max-width: 580px !important;
    width: 100% !important;
}

/* Compact Forms */
.form-group {
    margin-bottom: 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.form-group label {
    font-weight: 600;
    font-size: 0.82rem;
}

.form-group input, .form-select {
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 10px;
    padding: 0.6rem 0.8rem;
    color: var(--text-main);
    font-size: 0.9rem;
    font-family: inherit;
    transition: all 0.2s ease;
}

.form-group input:focus, .form-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 6px var(--primary-glow);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.6rem 1.4rem;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: 12px;
    cursor: pointer;
    border: none;
    font-family: inherit;
    transition: all 0.2s ease;
}

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); transform: translateY(-1px); }
.btn-secondary { background: var(--card-bg); border: 1px solid var(--card-border); color: var(--text-main); }
.btn-secondary:hover { background: rgba(147, 51, 234, 0.1); border-color: var(--primary); }
.btn-danger { background: transparent; border: 1px solid var(--error); color: var(--error); }
.btn-danger:hover { background: var(--error); color: #fff; }
.btn-link { background: none; color: var(--primary); font-size: 0.82rem; padding: 0.3rem; }
.btn-link:hover { color: var(--primary-hover); text-decoration: underline; }
.btn-glow { box-shadow: 0 0 10px var(--primary-glow); }
.btn-glow:hover { box-shadow: 0 0 18px var(--primary-glow); }
.btn-large { padding: 0.8rem 2rem; font-size: 1.05rem; border-radius: 14px; }

/* 1. AUTH SCREEN */
.auth-card { max-width: 370px; }
.card-header h2 { font-size: 1.45rem; font-weight: 800; margin-bottom: 0.35rem; text-align: center; }
.subtitle { font-size: 0.78rem; color: var(--text-muted); text-align: center; margin-bottom: 0.8rem; }
.auth-tabs { display: flex; background: var(--input-bg); border: 1px solid var(--card-border); border-radius: 10px; padding: 0.2rem; margin-bottom: 0.8rem; }
.tab-btn { flex: 1; background: none; border: none; color: var(--text-muted); padding: 0.45rem; font-size: 0.82rem; font-weight: 600; cursor: pointer; border-radius: 7px; font-family: inherit; }
.tab-btn.active { background: var(--primary); color: #fff; }
.error-msg { background: rgba(239, 68, 68, 0.15); border: 1px solid var(--error); color: #fca5a5; padding: 0.55rem; border-radius: 8px; font-size: 0.78rem; margin-bottom: 0.75rem; text-align: center; }
.auth-footer { margin-top: 0.8rem; text-align: center; border-top: 1px solid var(--card-border); padding-top: 0.65rem; }

.auth-info-section {
    margin-top: 0.85rem;
    padding-top: 0.85rem;
    border-top: 1px solid var(--card-border);
    text-align: right;
}
.auth-info-section h3 {
    font-size: 0.85rem;
    font-weight: 700;
    margin-bottom: 0.3rem;
    color: var(--secondary);
}
.auth-info-section p {
    font-size: 0.74rem;
    color: var(--text-muted);
    line-height: 1.45;
}


/* 2. MENU SCREEN */
.menu-card { max-width: 480px; }
.welcome-title { font-size: 1.65rem; font-weight: 800; margin-bottom: 0.75rem; }
.stats-badge-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.65rem; margin-bottom: 1.2rem; }
.stat-badge-card { background: var(--input-bg); border: 1px solid var(--card-border); border-radius: 14px; padding: 0.75rem 0.5rem; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.stat-icon { color: var(--secondary); margin-bottom: 0.35rem; }
.stat-icon svg { width: 1.3rem; height: 1.3rem; }
.stat-value { font-size: 1.1rem; font-weight: 800; margin-bottom: 0.1rem; }
.stat-label { font-size: 0.68rem; color: var(--text-muted); }
.menu-actions { display: flex; flex-direction: column; gap: 0.65rem; }
.menu-sub-actions { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.65rem; width: 100%; }

/* 3. QUIZ SETUP SCREEN */
.setup-card { max-width: 580px; }
.back-btn { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 0.85rem; font-weight: 600; margin-bottom: 0.4rem; display: flex; align-items: center; gap: 0.2rem; font-family: inherit; }
.back-btn:hover { color: var(--primary); }
.back-btn svg { width: 0.95rem; height: 0.95rem; }
.setup-grid { display: flex; flex-direction: column; gap: 1.15rem; margin-bottom: 1.25rem; overflow-y: auto; padding-right: 0.2rem; scrollbar-width: none; }
.setup-section h3 { font-size: 0.95rem; margin-bottom: 0.5rem; border-right: 3px solid var(--secondary); padding-right: 0.4rem; }

.setup-scope-header {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    margin-bottom: 0.55rem;
    cursor: pointer;
}
.setup-scope-header input {
    cursor: pointer;
}
.scope-header-text {
    font-size: 0.95rem;
    font-weight: 800;
    border-right: 3px solid var(--secondary);
    padding-right: 0.4rem;
}

.category-options-grid, .mode-options-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.55rem; }
.mode-options-grid { grid-template-columns: repeat(3, 1fr); }
.category-card-content, .mode-card-content { background: var(--input-bg); border: 2px solid var(--card-border); border-radius: 12px; padding: 0.5rem; text-align: center; transition: all 0.2s ease; display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; }
.category-card input:checked + .category-card-content, .mode-card input:checked + .mode-card-content { border-color: var(--primary); background: rgba(147, 51, 234, 0.12); box-shadow: 0 0 10px var(--primary-glow); }
.cat-icon { color: var(--primary); margin-bottom: 0.25rem; }
.cat-icon svg { width: 1.2rem; height: 1.2rem; }
.cat-title, .mode-title { font-size: 0.8rem; font-weight: 700; color: var(--text-main); }
.select-wrapper { position: relative; }
.form-select { width: 100%; cursor: pointer; }
.setup-footer { flex-shrink: 0; }

.opacity-muted {
    opacity: 0.45;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

/* Modal Overlay & Card styling */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 9, 21, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 1.5rem;
}
[data-theme="light"] .modal-overlay {
    background: rgba(245, 246, 250, 0.9);
}

.modal-card {
    max-width: 500px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

.close-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-family: inherit;
    margin-bottom: 0.4rem;
}
.close-btn:hover {
    color: var(--primary);
}
.close-btn svg {
    width: 0.95rem;
    height: 0.95rem;
}

.ranks-list-container {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding-right: 0.25rem;
    scrollbar-width: thin;
}

.rank-modal-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--input-bg);
    border: 1px solid var(--card-border);
    border-radius: 14px;
    padding: 0.65rem 1rem;
    gap: 1rem;
    transition: all 0.2s ease;
}

.rank-modal-item.current {
    border-color: var(--secondary) !important;
    box-shadow: 0 0 12px var(--secondary-glow) !important;
    background: rgba(217, 119, 6, 0.08) !important;
}

.rank-modal-item.locked {
    opacity: 0.5;
}

.rank-modal-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.rank-modal-info {
    display: flex;
    flex-direction: column;
}

.rank-modal-title {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-main);
}

.rank-modal-req {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.rank-modal-status {
    display: flex;
    align-items: center;
    justify-content: center;
}

.rank-modal-status svg {
    width: 1.3rem;
    height: 1.3rem;
}

/* 4. GAME SCREEN */
.game-hud { display: flex; justify-content: space-between; align-items: center; background: var(--hud-bg); border: 1px solid var(--card-border); border-radius: 14px; padding: 0.45rem 1.25rem; margin-bottom: 0.65rem; width: 100%; box-shadow: var(--card-shadow); }
.hud-item { display: flex; flex-direction: column; align-items: center; }
.hud-label { font-size: 0.68rem; color: var(--text-muted); }
.hud-value { font-size: 0.9rem; font-weight: 800; }
.btn-exit { color: var(--error); padding: 0; font-size: 0.82rem; display: flex; align-items: center; gap: 0.2rem; }
.btn-exit svg { width: 0.9rem; height: 0.9rem; }
.btn-exit:hover { text-decoration: underline; }
.timer-bar-container { height: 6px; background: rgba(255, 255, 255, 0.08); border-radius: 10px; overflow: hidden; margin-bottom: 0.8rem; width: 100%; }
.timer-bar-fill { height: 100%; background: linear-gradient(90deg, var(--secondary) 0%, var(--primary) 100%); width: 100%; transition: width 0.1s linear; }

.game-card { max-width: 580px; min-height: 300px; position: relative; overflow: hidden; padding: 1.25rem !important; }
.question-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.85rem; }
.badge { background: var(--primary); color: #fff; padding: 0.15rem 0.55rem; font-size: 0.72rem; font-weight: bold; border-radius: 15px; }
.question-type-label { font-size: 0.75rem; color: var(--text-muted); font-weight: 600; }
.question-body { margin-bottom: 1.25rem; flex: 1; display: flex; align-items: center; justify-content: center; }
.bible-quote { font-size: 1.35rem; font-weight: 600; line-height: 1.45; text-align: center; width: 100%; color: var(--text-main); }
.options-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.65rem; width: 100%; }
.option-btn { background: var(--input-bg); border: 1px solid var(--card-border); border-radius: 12px; padding: 0.65rem 0.85rem; font-size: 0.9rem; font-weight: 600; color: var(--text-main); cursor: pointer; display: flex; align-items: center; gap: 0.5rem; transition: all 0.2s ease; font-family: inherit; }
.option-marker { background: rgba(255, 255, 255, 0.08); color: var(--text-muted); width: 22px; height: 22px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 0.7rem; font-weight: 700; flex-shrink: 0; }
.option-btn:hover:not(:disabled) { background: rgba(147, 51, 234, 0.12); border-color: var(--primary); transform: translateY(-1px); }
.option-btn:disabled { cursor: not-allowed; opacity: 0.6; }

.option-btn.btn-correct { background: rgba(16, 185, 129, 0.2) !important; border-color: var(--success) !important; box-shadow: 0 0 10px var(--success-glow); color: #fff; }
.option-btn.btn-correct .option-marker { background: var(--success); color: #fff; }
.option-btn.btn-incorrect { background: rgba(239, 68, 68, 0.2) !important; border-color: var(--error) !important; box-shadow: 0 0 10px var(--error-glow); color: #fff; }
.option-btn.btn-incorrect .option-marker { background: var(--error); color: #fff; }

.shake-animation { animation: shake 0.5s ease-in-out; }
.pulse-animation { animation: pulse-correct 0.5s ease-in-out; }
@keyframes shake { 0%, 100% { transform: translateX(0); } 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }
@keyframes pulse-correct { 0% { transform: scale(1); } 50% { transform: scale(1.02); } 100% { transform: scale(1); } }

/* Feedback Overlay */
.feedback-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: rgba(10, 9, 21, 0.95); display: flex; align-items: center; justify-content: center; z-index: 10; padding: 1.25rem; border-radius: 20px; }
[data-theme="light"] .feedback-overlay { background: rgba(245, 246, 250, 0.98); }
.feedback-content { display: flex; flex-direction: column; align-items: center; gap: 0.65rem; }
.feedback-icon { margin-bottom: 0.25rem; }
.feedback-icon svg { width: 3.5rem; height: 3.5rem; }
.feedback-title { font-size: 1.5rem; font-weight: 800; }
.feedback-subtitle { font-size: 0.9rem; color: var(--text-muted); margin-bottom: 0.4rem; line-height: 1.35; }
.auto-next-label { font-size: 0.72rem; color: var(--primary); font-weight: 600; display: block; animation: pulse-dot-anim 1.5s infinite; }

/* 5. LEADERBOARD SCREEN */
.leaderboard-card { max-width: 580px; }
.leaderboard-container { overflow-y: auto; margin-top: 0.85rem; border-radius: 12px; border: 1px solid var(--card-border); scrollbar-width: thin; }
.leaderboard-table { width: 100%; border-collapse: collapse; text-align: right; }
.leaderboard-table th { background: var(--input-bg); color: var(--text-muted); font-weight: 600; padding: 0.65rem; font-size: 0.78rem; }
.leaderboard-table td { padding: 0.7rem; border-bottom: 1px solid var(--card-border); font-size: 0.88rem; }
.leaderboard-table tr:last-child td { border-bottom: none; }
.leaderboard-table tr:hover { background: rgba(147, 51, 234, 0.03); }
.rank-podium { display: inline-flex; width: 26px; height: 26px; border-radius: 50%; align-items: center; justify-content: center; font-weight: 800; font-size: 0.8rem; }
.rank-1 { background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%); color: #fff; box-shadow: 0 0 8px rgba(245, 158, 11, 0.4); }
.rank-2 { background: linear-gradient(135deg, #9ca3af 0%, #4b5563 100%); color: #fff; }
.rank-3 { background: linear-gradient(135deg, #b45309 0%, #78350f 100%); color: #fff; }
.rank-other { background: rgba(255, 255, 255, 0.08); color: var(--text-muted); }

/* Footer */
.app-footer { background: var(--footer-bg); border-top: 1px solid var(--card-border); height: 40px; display: flex; align-items: center; justify-content: center; font-size: 0.72rem; color: var(--text-muted); z-index: 5; flex-shrink: 0; }
.confetti-canvas { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; z-index: 999; pointer-events: none; }

/* Animations */
.animate-fade-in { animation: fadeIn 0.3s ease forwards; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes crown-pulse { 0%, 100% { transform: scale(1); filter: drop-shadow(0 0 6px var(--secondary-glow)); } 50% { transform: scale(1.08); filter: drop-shadow(0 0 12px var(--secondary-hover)); } }

/* RWD / Viewport limits media queries */
@media (max-width: 800px) {
    body {
        height: 100vh;
        overflow: hidden;
    }
    .app-layout {
        flex-direction: column-reverse; /* Sidebar moves to bottom */
        padding: 0.5rem;
        gap: 0.75rem;
    }
    .activity-sidebar {
        width: 100% !important;
        max-width: 100% !important;
        height: 55px; /* Horizontal sliding ticker */
        flex-direction: row;
        align-items: center;
        padding: 0.4rem 0.8rem !important;
        flex-shrink: 0;
    }
    .sidebar-header {
        border-bottom: none;
        padding-bottom: 0;
        margin-bottom: 0;
        flex-shrink: 0;
        gap: 0.35rem;
    }
    .sidebar-header h3 { font-size: 0.85rem; }
    .activity-feed {
        flex-direction: row;
        align-items: center;
        overflow-x: auto;
        overflow-y: hidden;
        white-space: nowrap;
        gap: 0.75rem;
        width: 100%;
        height: 100%;
        padding-right: 0;
    }
    .activity-item {
        display: inline-flex;
        align-items: center;
        padding: 0.35rem 0.7rem;
        height: 32px;
        gap: 0.4rem;
        white-space: nowrap;
    }
    .activity-item-header {
        margin-bottom: 0;
        flex-shrink: 0;
        font-size: 0.65rem;
    }
    .activity-msg {
        font-size: 0.72rem;
        white-space: nowrap;
    }
    .main-content-area {
        flex: 1;
        min-height: 0;
        width: 100%;
    }
    .category-options-grid { grid-template-columns: repeat(2, 1fr); }
    .mode-options-grid { grid-template-columns: repeat(3, 1fr); }
    .stats-badge-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 480px) {
    .category-options-grid { grid-template-columns: repeat(2, 1fr); }
    .mode-options-grid { grid-template-columns: 1fr; }
    .options-grid { grid-template-columns: 1fr; }
    .stat-icon { font-size: 1.1rem; }
    .stat-value { font-size: 1rem; }
    .stat-label { font-size: 0.65rem; }
    .bible-quote { font-size: 1.25rem; }
    .glass-card { padding: 1.25rem; }
}
