/* --- INTRO SCREEN --- */
#intro-screen { background: rgba(30, 30, 30, 0.6) !important; }

.profile-area { display: flex; flex-direction: column; align-items: center; margin-bottom: 20px; }
.profile-area p#user-display { margin-bottom: 5px; }

#switch-user-btn { opacity: 0.8; transition: opacity 0.2s; }
#switch-user-btn:hover { opacity: 1; }

.avatar-wrapper { position: relative; width: 100px; height: 100px; margin-bottom: 10px; }
.intro-avatar { width: 100%; height: 100%; border-radius: 50%; border: 3px solid var(--brand-orange); background-color: var(--panel-bg); object-fit: cover; }
.edit-icon {
    position: absolute; bottom: 0; right: 0;
    background: var(--accent-grey); color: white;
    width: 30px; height: 30px; border-radius: 50%;
    display: flex; justify-content: center; align-items: center;
    font-size: 1.2rem; cursor: pointer; border: 2px solid var(--bg-color);
}
.edit-icon:hover { background: var(--brand-orange); }

/* --- REGISTRATION SPECIFIC --- */
.reg-split-container { display: flex; width: 100%; gap: 15px; margin-bottom: 10px; }
.reg-left { width: 75%; display: flex; flex-direction: column; align-items: flex-end; gap: 15px; }
.reg-right { width: 25%; display: flex; flex-direction: column; align-items: flex-start; justify-content: flex-start; gap: 15px; padding-top: 10px; }

/* --- LEADERBOARD & STATS --- */
.stats-grid { display: flex; gap: 20px; margin-bottom: 20px; justify-content: center;}
.stat-box { 
    background: var(--panel-bg); padding: 20px; border-radius: 5px; min-width: 100px;
    border: 1px solid var(--border-color); text-align: center;
}
.stat-box span { display: block; font-size: 0.8rem; color: var(--text-muted); margin-bottom: 5px; }
.stat-box h3 { margin: 0; font-size: 1.5rem; color: var(--brand-orange); }

.leaderboard-container {
    background: var(--panel-bg); padding: 20px; border-radius: 8px;
    width: 80%; max-height: 65vh; overflow-y: auto; margin-bottom: 20px;
    border: 1px solid var(--border-color);
}
#leaderboard-table { width: 100%; border-collapse: collapse; }
#leaderboard-table th, #leaderboard-table td { text-align: left; padding: 12px; border-bottom: 1px solid #444; }
#leaderboard-table th { color: var(--brand-orange); border-bottom: 2px solid var(--brand-orange); }

.lb-controls { display: flex; gap: 10px; margin-bottom: 10px; justify-content: center;}
.lb-sort-btn {
    background: var(--accent-grey); border: none; padding: 8px 15px; color: #ccc;
    cursor: pointer; border-radius: 4px; transition: background 0.2s;
}
.lb-sort-btn:hover { background: #666; color: white; }
.lb-sort-btn.active { background: var(--brand-orange); color: white; font-weight: bold; }

.lb-user-cell { display: flex; align-items: center; gap: 10px; }
.lb-avatar { width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--accent-grey); background: var(--panel-bg); }

/* --- COMPARISON & PROGRESS --- */
#comparison-container {
    background: var(--panel-bg); padding: 20px; border-radius: 8px; margin-bottom: 20px;
    border: 1px solid var(--border-color); width: fit-content; margin: 10px auto;
}
.compare-wrapper { display: flex; gap: 40px; align-items: center; justify-content: center;}
.compare-row { display: flex; flex-direction: column; align-items: center; }

.progress-container { width: 300px; height: 10px; background: #333; border-radius: 5px; overflow: hidden; margin: 10px auto;}
#progress-bar { height: 100%; background: var(--brand-orange); width: 100%; }

/* --- AVATAR SELECTION GRID --- */
.avatar-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    gap: 15px; width: 100%; max-height: 50vh; overflow-y: auto; padding: 10px;
}
.grid-avatar-item { width: 60px; height: 60px; border-radius: 50%; cursor: pointer; border: 2px solid transparent; transition: transform 0.2s; }
.grid-avatar-item:hover { transform: scale(1.1); border-color: var(--brand-orange); }
.grid-avatar-item.selected { border-color: var(--brand-orange); box-shadow: 0 0 10px var(--brand-orange); }

/* --- TUTORIAL SPECIFIC --- */
.tutorial-box { 
    text-align: center; gap: 10px; width: 600px; max-width: 95vw; max-height: 95dvh;
    display: flex; flex-direction: column; justify-content: space-between;
    padding: 20px; box-sizing: border-box; overflow: hidden;
}
#tutorial-stage {
    width: 100%; display: flex; flex-direction: column; align-items: center;
    flex: 1; justify-content: center; min-height: 0;
}
#tut-title { color: #4ecca3; text-align: center; margin-bottom: 5px; font-size: 1.5rem; flex-shrink: 0; }
.tut-instruction {
    height: 30px; text-align: center; font-size: 1rem; margin-bottom: 5px; 
    font-weight: bold; color: var(--brand-orange); flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
}

/* Updated Explanation Container */
.tut-explanation {
    min-height: 60px; 
    max-height: 100px;
    overflow-y: auto;
    text-align: center; font-size: 0.95rem; color: #ccc;
    margin-bottom: 15px; padding: 0 10px; flex-shrink: 0;
    display: flex; flex-direction: column; align-items: center; gap: 5px;
    
    /* Hide scrollbar for IE, Edge and Firefox */
    -ms-overflow-style: none;  
    scrollbar-width: none;  
}

/* Hide scrollbar for Chrome, Safari and Opera */
.tut-explanation::-webkit-scrollbar {
    display: none;
}

.tut-msg-line {
    animation: fadeIn 0.5s ease-in-out;
    margin: 0;
}

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

#tut-board-container { 
    margin-bottom: 10px; 
    position: relative; 
    max-width: 100%; 
    min-height: 120px; /* Safe minimum fallback */
    min-width: 200px;  /* Safe minimum fallback */
    display: flex;     /* Ensures the generated grid stays centered */
    justify-content: center;
}
.tut-slots { margin-bottom: 10px; flex-shrink: 0; }

.tut-footer { 
    width: 100%; margin-top: 10px; flex-shrink: 0;
    display: flex; justify-content: center; gap: 15px;
}

/* --- BUTTON GRADIENT ANIMATION --- */
#tutorial-next-btn {
    position: relative;
    overflow: hidden;
    z-index: 1; 
}

/* The sliding dark overlay */
#tutorial-next-btn::after {
    content: "";
    position: absolute;
    top: 0; 
    right: 0; /* Anchors the fill to the right edge */
    width: 0%; /* Start empty */
    height: 100%; /* Full height to create a vertical slider edge */
    background: rgba(0, 0, 0, 0.25); /* Darker orange effect over the base color */
    z-index: -1; 
    pointer-events: none;
}

/* Trigger the slide from right to left */
#tutorial-next-btn.counting-down::after {
    width: 100%;
    transition: width 15s linear;
}

/* This ensures the text label is above the sliding background */
#tutorial-next-btn span, #tutorial-next-btn { 
    /* No inner span in HTML, so we rely on the stacking context of the element text */
}

.tut-result {
    margin-top: 15px; display: flex; justify-content: space-around;
    font-size: 1.2rem; font-weight: bold; color: white;
    background: #338a6e; padding: 10px; border-radius: 5px; width: 100%; box-sizing: border-box;
}

#info-modal, 
#avatar-modal,
#tutorial-prompt-modal {
    /* Force position in case the modal is missing the .overlay class */
    position: fixed !important; 
    /* Brute-force it above the 9999 .overlay baseline */
    z-index: 10005 !important; 
}

/* =========================================
  FROM HTML -- screen_leaderboard
  ========================================== */

/* --- Leaderboard Baseline Styling (Replaces Inline Styles) --- */
.lb-subtitle { color: #888; margin-top: 5px; font-size: 0.9rem; }
.lb-result-msg { margin: 10px 0; color: var(--brand-orange); font-weight: bold; }
.lb-action-footer { display: flex; flex-direction: column; align-items: center; margin-top: 10px; }
.lb-btn-group { display: flex; gap: 10px; }
.email-btn { background-color: #338a6e; margin-top: 0; }
.return-btn { margin: 0; }
.lb-notification { color: #4ecca3; font-weight: bold; margin-top: 8px; height: 20px; }
.lb-explanation { color: #888; font-size: 0.8rem; margin-top: 5px; text-align: center; max-width: 400px; }

/* Campaign Modal Baseline */
.campaign-overlay { z-index: 55; }
.campaign-modal-box { width: 400px; max-width: 90%; }
.campaign-desc { color: #aaa; font-size: 0.9rem; margin-bottom: 10px; }
.campaign-select { background: #333; color: white; margin-bottom: 20px; padding: 10px; border: 1px solid #555; }
.campaign-actions { display: flex; gap: 15px; width: 100%; justify-content: center; }

/* --- BUSINESS CARD PREVIEW STYLES --- */
.business-card-preview-wrapper {
    display: flex;
    flex-direction: row;
    align-items: center; /* Centers items vertically */
    justify-content: center;
    gap: 30px; /* Space between video and buttons */
    width: 100%;
    margin-top: 15px;
}

.preview-actions {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 180px; /* Gives the buttons a consistent width */
}

/* Stack vertically on mobile and small tablets */
@media (max-width: 768px) {
    .business-card-preview-wrapper {
        flex-direction: column;
        gap: 15px;
    }
    .preview-actions {
        width: 100%;
        max-width: 300px;
    }
}