:root {
    --bg-app: #131f24; /* Darker, cooler background */
    --surface: #202f36;
    --primary: #58cc02; /* Learning Green */
    --primary-depth: #46a302;
    --secondary: #ce82ff; /* Soft Purple */
    --secondary-depth: #a568cc;
    --danger: #ff4b4b;
    --danger-depth: #ea2b2b;
    --text-main: #ffffff;
    --text-muted: #afb8bc;
    --border: #37464f;
    --radius: 16px;
    --font: 'Nunito', sans-serif;
    --nav-height: 70px;
    --header-height: 60px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
    font-family: var(--font);
}

body {
    background-color: var(--bg-app);
    color: var(--text-main);
    overflow-x: hidden; /* Prevent horizontal scroll */
    min-height: 100vh;
}

/* --- Login Screen --- */
.fullscreen-view {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    display: flex; justify-content: center; align-items: center;
    background: var(--bg-app);
    z-index: 2000;
    transition: opacity 0.5s;
}
.fullscreen-view.hidden { opacity: 0; pointer-events: none; }

.login-content {
    text-align: center;
    z-index: 2;
    width: 90%;
    max-width: 400px;
}

.logo-area { margin-bottom: 2rem; color: var(--primary); }
.logo-area h1 { font-size: 2.5rem; font-weight: 800; margin-top: 1rem; }

.login-form input {
    width: 100%; padding: 1rem; margin-bottom: 1rem;
    border-radius: var(--radius); border: 2px solid var(--border);
    background: var(--surface); color: white; font-size: 1.1rem;
    text-align: center; font-weight: 700;
}
.login-form input:focus { border-color: var(--secondary); outline: none; }

.blob {
    position: absolute; border-radius: 50%; opacity: 0.1; filter: blur(60px); z-index: 1;
}
.blob-1 { width: 300px; height: 300px; background: var(--secondary); top: -100px; left: -100px; }
.blob-2 { width: 300px; height: 300px; background: var(--primary); bottom: -100px; right: -100px; }

/* --- Online Badge --- */
/* --- Online Badge --- */
.online-badge {
    position: fixed;
    top: 20px;
    right: 20px;
    bottom: auto;
    left: auto;       
    background: rgba(32, 47, 54, 0.9);
    backdrop-filter: blur(5px);
    padding: 8px 12px;
    border-radius: 20px;
    border: 1px solid var(--border);
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 1100; 
    box-shadow: 0 4px 6px rgba(0,0,0,0.2);
    transition: transform 0.2s;
}
.online-badge:hover { transform: scale(1.05); }

/* --- App Layout --- */
.app-wrapper {
    display: flex; flex-direction: column; height: 100%;
}

.hidden { display: none !important; }

/* Navigation (Bottom for Mobile, Left for Desktop) */
#navbar {
    position: fixed; bottom: 0; left: 0; width: 100%; 
    height: var(--nav-height);
    background: var(--bg-app); border-top: 2px solid var(--border);
    display: flex; justify-content: space-evenly; align-items: center;
    z-index: 1000;
    padding: 0 5px;
}

.nav-item {
    background: none; border: none; color: var(--text-muted);
    font-size: 0.65rem; font-weight: 700;
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    padding: 6px 8px; cursor: pointer;
    text-transform: uppercase; letter-spacing: 0;
    flex: 1;
    max-width: 80px;
    min-width: 50px;
}
.nav-item i { font-size: 1.3rem; margin-bottom: 2px; }
.nav-item.active { color: var(--secondary); }
.nav-item:active { transform: scale(0.95); }

/* Mobile: nav-items should be horizontal row */
.nav-items {
    display: flex;
    flex-direction: row;
    justify-content: space-evenly;
    align-items: center;
    width: 100%;
    height: 100%;
}

.desktop-only { display: none; }

/* Question Navigation Buttons */
.question-nav-buttons {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 1.5rem;
    padding: 0 0.5rem;
}

.btn-nav {
    flex: 1;
    padding: 12px 20px;
    border-radius: var(--radius);
    border: 2px solid var(--border);
    background: var(--surface);
    color: var(--text-main);
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
}

.btn-nav:hover:not(:disabled) {
    background: var(--primary);
    border-color: var(--primary);
}

.btn-nav:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Content Area */
#content-area {
    width: 100%;
    padding-bottom: calc(var(--nav-height) + 40px);
}

/* --- Dashboard --- */
.page-view {
    display: none; flex-direction: column;
    padding: 1rem; max-width: 600px; margin: 0 auto;
    animation: fadeIn 0.3s ease;
}
.page-view.active { display: flex; }

.page-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 1.5rem; padding: 1rem 0;
}
.page-header h2 { font-size: 1.5rem; font-weight: 800; }

.user-pill {
    background: var(--surface); padding: 0.5rem 1rem;
    border-radius: 20px; font-weight: 800; color: #ff9600;
    border: 2px solid var(--border);
}

.packs-list { display: grid; gap: 1rem; }

.pack-card-new {
    background: var(--surface);
    border: 2px solid var(--border);
    border-bottom-width: 4px; /* 3D effect */
    border-radius: var(--radius);
    padding: 1.25rem;
    display: flex; align-items: center; gap: 1rem;
    cursor: pointer; position: relative;
}
.pack-card-new:active { border-bottom-width: 2px; transform: translateY(2px); }

.pack-icon {
    width: 60px; height: 60px; border-radius: 50%;
    background: var(--bg-app); /* Fallback */
    display: flex; justify-content: center; align-items: center;
    font-size: 1.8rem; flex-shrink: 0;
}
/* Assign colors via JS or nth-child logic later, default green */
.pack-icon { color: var(--primary); border: 2px solid var(--border); }

.pack-details h3 { font-size: 1.2rem; font-weight: 700; margin-bottom: 0.3rem; }
.pack-details p { font-size: 0.9rem; color: var(--text-muted); }

/* Progress Ring (Mini) */
.mini-progress {
    font-size: 0.8rem; font-weight: 800; color: var(--secondary);
    margin-left: auto;
}

/* --- Quiz Interface --- */
.quiz-top-bar {
    display: flex; align-items: center; gap: 1rem; margin-bottom: 2rem;
}
.icon-btn {
    background: none; 
    border: none; 
    color: var(--text-muted); 
    font-size: 1.5rem; 
    cursor: pointer;
    width: 44px; /* Minimum touch target */
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}
.icon-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}
.progress-track {
    flex: 1; height: 16px; background: var(--surface); border-radius: 10px; overflow: hidden;
}
.progress-fill {
    height: 100%; background: var(--primary);
    width: 0%; transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}
.hearts { font-weight: 800; color: var(--danger); }

.quiz-body { 
    flex: 1; 
    display: flex; 
    flex-direction: column; 
    justify-content: flex-start;
    padding: 1.5rem;
    overflow-y: auto;
}

#question-text {
    font-size: 1.3rem; 
    font-weight: 800; 
    line-height: 1.4;
    margin-bottom: 1.5rem; 
    text-align: left;
    word-wrap: break-word;
}

.options-grid { display: grid; gap: 1rem; }

.option-card {
    padding: 1.2rem;
    border: 2px solid var(--border); border-bottom-width: 4px;
    border-radius: var(--radius);
    background: var(--bg-app);
    font-size: 1.1rem; font-weight: 600;
    cursor: pointer; text-align: left;
    transition: all 0.1s;
}
.option-card:hover { background: var(--surface); }
.option-card:active { border-bottom-width: 2px; transform: translateY(2px); }

.option-card.selected {
    border-color: var(--secondary); background: rgba(206, 130, 255, 0.1); color: var(--secondary);
}
.option-card.correct {
    border-color: var(--primary); background: rgba(88, 204, 2, 0.1); color: var(--primary);
}
.option-card.wrong {
    border-color: var(--danger); background: rgba(255, 75, 75, 0.1); color: var(--danger);
}

/* Footer & Feedback Sheet */
.quiz-footer {
    position: fixed; bottom: 0; left: 0; width: 100%;
    z-index: 1100; pointer-events: none; /* Let clicks pass through if empty */
}

.feedback-sheet {
    background: var(--bg-app); /* Fallback */
    border-top: 2px solid var(--border);
    padding: 1.5rem;
    pointer-events: auto;
    animation: slideUp 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}
.feedback-sheet.correct { background: #1a2e1d; border-color: var(--primary); }
.feedback-sheet.wrong { background: #2e1a1a; border-color: var(--danger); }

@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }

.feedback-header { display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.feedback-icon {
    width: 30px; height: 30px; border-radius: 50%; background: white;
    display: flex; justify-content: center; align-items: center; font-size: 1.2rem;
}
.feedback-sheet.correct .feedback-icon { color: var(--primary); }
.feedback-sheet.wrong .feedback-icon { color: var(--danger); }
.feedback-title { font-size: 1.5rem; font-weight: 800; }
.feedback-sheet.correct .feedback-title { color: var(--primary); }
.feedback-sheet.wrong .feedback-title { color: var(--danger); }

.feedback-content { margin-bottom: 1.5rem; color: var(--text-main); line-height: 1.5; }

/* Buttons */
.btn-primary-lg {
    width: 100%; padding: 1rem; border-radius: var(--radius);
    border: none; background: var(--primary); border-bottom: 4px solid var(--primary-depth);
    color: white; font-size: 1.1rem; font-weight: 800; text-transform: uppercase;
    cursor: pointer;
}
.btn-primary-lg:active { border-bottom-width: 0; transform: translateY(4px); margin-top: 4px; }

.feedback-sheet.wrong .btn-primary-lg {
    background: var(--danger); border-color: var(--danger-depth);
}

.full-width { width: 100%; }

/* --- Chat Drawer --- */
.drawer {
    position: fixed; bottom: -100%; left: 0; width: 100%; height: 80vh;
    background: var(--bg-app); border-radius: 20px 20px 0 0;
    z-index: 1500; transition: bottom 0.3s;
    display: flex; flex-direction: column;
    border-top: 2px solid var(--border);
}
.drawer.active { bottom: 0; }

.drawer-header {
    padding: 1rem; display: flex; justify-content: space-between; align-items: center;
    border-bottom: 2px solid var(--border);
}

.close-drawer-btn {
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s;
}

.close-drawer-btn:hover {
    background: var(--danger);
    border-color: var(--danger);
    color: white;
}

.chat-messages { flex: 1; overflow-y: auto; padding: 1rem; display: flex; flex-direction: column; gap: 1rem; }
.chat-input-wrapper {
    padding: 1rem; border-top: 2px solid var(--border); display: flex; gap: 0.5rem;
}
.chat-input-wrapper input {
    flex: 1; padding: 0.8rem; background: var(--surface); border: 2px solid var(--border);
    border-radius: var(--radius); color: white;
}
.chat-input-wrapper button {
    width: 50px; background: var(--secondary); border: none; border-radius: var(--radius);
    color: white; font-size: 1.2rem;
}

.backdrop {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5); z-index: 1400; opacity: 0; pointer-events: none; transition: opacity 0.3s;
}
.backdrop.active { opacity: 1; pointer-events: auto; }

/* --- Media Queries --- */
@media (min-width: 768px) {
    /* Restore App Shell Layout for Desktop */
    body { overflow: hidden; height: 100vh; }
    .app-wrapper { height: 100%; overflow: hidden; }
    
    #navbar {
        top: 0; left: 0; width: 250px; height: 100%;
        flex-direction: column; justify-content: start; padding-top: 2rem;
        border-right: 2px solid var(--border); border-top: none;
        align-items: stretch; padding: 1rem;
    }
    .desktop-only { display: flex; align-items: center; gap: 1rem; margin-bottom: 2rem; padding: 0 1rem; font-size: 1.5rem; font-weight: 800; color: var(--primary); }
    
    .nav-items { 
        display: flex; 
        flex-direction: column; 
        gap: 0.5rem; 
        width: 100%; 
        justify-content: flex-start; /* Ensure items don't spread */
    }
    .nav-item {
        flex: 0 0 auto; /* Stop stretching */
        height: auto;
        flex-direction: row; gap: 1rem; font-size: 1rem; padding: 12px 16px;
        border-radius: var(--radius); border: 2px solid transparent;
        margin-bottom: 0.5rem;
    }
    .nav-item:hover { background: var(--surface); }
    .nav-item.active { border-color: var(--secondary); background: rgba(206, 130, 255, 0.1); }

    #content-area {
        padding-left: 250px; /* Offset for sidebar */
        padding-bottom: 2rem;
        display: flex; justify-content: center;
        height: 100%; overflow-y: auto; /* Desktop internal scroll */
    }
    
    /* Center the quiz/dashboard content on desktop */
    .page-view { width: 100%; max-width: 800px; padding-top: 2rem; }
    
    .drawer {
        width: 400px; left: auto; right: 20px; bottom: 20px; height: 600px;
        border-radius: 20px; border: 2px solid var(--border);
        transform: translateY(110%); transition: transform 0.3s;
    }
    .drawer.active { bottom: 20px; transform: translateY(0); }
    
    .quiz-footer {
        width: 100%; max-width: 800px; left: 50%; transform: translateX(-50%);
        bottom: 2rem;
    }
    .feedback-sheet { border-radius: var(--radius); border: 2px solid var(--border); }
    
    /* Desktop Nav Buttons Fix - Aggressive */
    .question-nav-buttons {
        display: flex;
        justify-content: center; 
        gap: 1rem;
        margin-top: 1.5rem;
        width: 100%;
    }
    
    .btn-nav {
        flex: 0 0 auto !important; /* Force no growth */
        width: auto !important;
        min-width: 0 !important; /* Remove min-width */
        padding: 8px 20px !important;
        font-size: 0.9rem !important;
        display: inline-flex;
    }
}

/* --- Ranking --- */
.ranking-list { display: flex; flex-direction: column; gap: 0.75rem; }

.ranking-item {
    display: flex; align-items: center; gap: 1rem;
    padding: 1rem; background: var(--surface);
    border: 2px solid var(--border); border-radius: var(--radius);
}
.rank-position { font-size: 1.3rem; font-weight: 800; min-width: 40px; }
.rank-name { flex: 1; font-weight: 600; }
.rank-score { font-weight: 800; color: var(--primary); }

/* --- Profile --- */
.profile-card {
    text-align: center; padding: 2rem;
    background: var(--surface); border: 2px solid var(--border);
    border-radius: var(--radius);
}
.profile-avatar { color: var(--secondary); margin-bottom: 1rem; }
.profile-card h3 { font-size: 1.5rem; margin-bottom: 1.5rem; }

.profile-stats {
    display: flex; justify-content: center; gap: 2rem; margin-bottom: 2rem;
}
.stat-item { text-align: center; }
.stat-value { display: block; font-size: 2rem; font-weight: 800; color: var(--primary); }
.stat-label { font-size: 0.9rem; color: var(--text-muted); }

.profile-info { margin-bottom: 2rem; color: var(--text-muted); }
.profile-info p { margin: 0.5rem 0; }

.btn-danger-lg {
    padding: 1rem 2rem; border-radius: var(--radius);
    border: none; background: var(--danger); border-bottom: 4px solid var(--danger-depth);
    color: white; font-weight: 800; cursor: pointer;
}

/* Chat Bubbles */
.chat-msg {
    display: flex; flex-direction: column; align-items: flex-start;
}
.chat-msg.me { align-items: flex-end; }

.msg-author { font-size: 0.75rem; color: var(--text-muted); margin-bottom: 2px; margin-left: 4px; }
.chat-msg.me .msg-author { margin-right: 4px; }

.msg-bubble {
    background: var(--surface); padding: 0.8rem 1rem; border-radius: 12px;
    border-bottom-left-radius: 2px; max-width: 80% ;line-height: 1.4;
    border: 1px solid var(--border);
}
.chat-msg.me .msg-bubble {
    background: var(--primary); color: #05220a;
    border-bottom-left-radius: 12px; border-bottom-right-radius: 2px;
    border: none;
}


/* --- Code Formatting --- */
code {
    background: rgba(0, 0, 0, 0.3);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    color: #ffd700; /* Gold for inline code visibility */
    font-size: 0.95em;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

pre {
    background: #0d161a; /* Very dark background */
    padding: 1rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    overflow-x: auto;
    margin: 1rem 0;
    width: 100%;
}

pre code {
    background: transparent;
    padding: 0;
    color: #adbac7; 
    font-size: 0.9rem;
    display: block;
    white-space: pre-wrap; /* Wrap long lines if needed */
    border: none;
}

/* --- Search View --- */
.search-container {
    padding: 1rem;
    max-width: 800px;
    margin: 0 auto;
}

#search-input {
    width: 100%;
    padding: 1rem;
    font-size: 1.2rem;
    border-radius: var(--radius);
    border: 2px solid var(--border);
    background: var(--surface);
    color: white;
    margin-bottom: 2rem;
    transition: border-color 0.3s;
}

#search-input:focus {
    border-color: var(--secondary);
    outline: none;
}

.search-results {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding-bottom: 120px; /* Ensure content is visible above navbar/keyboard */
}

/* Fix for mobile scrolling */
#content-area {
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
}

.search-card {
    background: var(--surface);
    padding: 1.5rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: 0 4px 6px rgba(0,0,0,0.2);
    /* Mobile Override */
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: hidden; /* Prevent spill */
}

/* Ensure content wrap */
.search-card-content, .details-content {
    overflow-wrap: break-word;
    word-wrap: break-word;
    word-break: break-word;
}
.search-card-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
}

.search-card h3 {
    margin-bottom: 1rem;
    color: var(--text-main);
    font-size: 1.1rem;
    line-height: 1.5;
}

.search-card .options-list {
    margin-bottom: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    list-style: none; /* Remove bullets */
    padding-left: 0;
}

.search-card .option-item {
    padding: 0.5rem 1rem;
    background: rgba(255,255,255,0.05);
    border-radius: 8px;
    font-size: 0.95rem;
}

.search-card .option-item.correct {
    background: rgba(88, 204, 2, 0.2);
    border: 1px solid var(--primary);
    color: var(--primary);
    font-weight: bold;
}

.search-card .explanation-box {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
    font-size: 0.9rem;
    color: var(--text-muted);
}
.search-card .explanation-box strong {
    color: var(--secondary);
}

/* Browse Button on Pack Card */
/* Browse Button on Pack Card */
.btn-icon-browse {
    position: absolute;
    top: 50%;
    right: 15px;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.1rem;
    transition: all 0.2s;
    display: flex;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(4px);
    z-index: 10; /* Ensure it's clickable */
}
.btn-icon-browse:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-50%) scale(1.1); /* Keep vertical center on hover */
}
/* Adjust mini-progress to be top-right */
.mini-progress {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 0.8rem; 
    font-weight: 800; 
    color: var(--secondary);
    margin-left: 0;
}

/* Browse View Title */
#browse-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.3rem;
}

/* Toggle Button in Search/Browse */
.btn-text-sm {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--secondary);
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    margin-bottom: 0.5rem;
    transition: all 0.2s;
    display: inline-block;
}
.btn-text-sm:hover {
    background: rgba(206, 130, 255, 0.1);
    transform: translateY(-1px);
}

/* Users List */
.users-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding-bottom: 80px; /* Space for FAB/Nav */
}
.user-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: transform 0.2s;
}
.user-card:hover {
    transform: translateY(-2px);
    border-color: var(--primary);
}
.user-card.user-me {
    background: rgba(206, 130, 255, 0.05);
    border-color: var(--primary);
}
.user-avatar {
    position: relative;
    width: 40px; 
    height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2rem;
    color: var(--text-muted);
}
.status-dot {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 2px solid var(--surface);
}
.status-online { background-color: #4ade80; }
.status-offline { background-color: #9ca3af; }
.user-info {
    flex: 1;
}
.user-name {
    font-weight: 600;
    color: var(--text-main);
}
.user-action {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* FAB Chat */
.fab-chat {
    position: fixed;
    bottom: 90px; /* Above nav which is usually 60-80px */
    right: 20px;
    width: 60px; /* Force width */
    height: 60px; /* Force height */
    border-radius: 50%;
    background: var(--primary);
    color: white;
    border: none;
    box-shadow: 0 4px 12px rgba(206, 130, 255, 0.4);
    font-size: 1.5rem;
    cursor: pointer;
    display: flex !important; /* Force flex */
    justify-content: center;
    align-items: center;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 9999; /* Max z-index */
    flex-shrink: 0;
}
.fab-chat:hover {
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 6px 16px rgba(206, 130, 255, 0.6);
}
.fab-chat:active {
    transform: scale(0.95);
}

/* Hide FAB when drawer is active (via sibling selector if applicable, or JS class on body) */
/* Better approach: JS adds class to body or FAB itself */
body.chat-open .fab-chat { display: none; }
/* --- Custom Modal --- */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex; justify-content: center; align-items: center;
    z-index: 3000; /* Highest */
    backdrop-filter: blur(4px);
    opacity: 1; transition: opacity 0.3s;
}
.modal-overlay.hidden { opacity: 0; pointer-events: none; }

.modal-box {
    background: var(--surface);
    padding: 2rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    width: 90%; max-width: 400px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    transform: scale(1); transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.modal-overlay.hidden .modal-box { transform: scale(0.9); }

.modal-box h3 { margin-bottom: 1rem; color: var(--text-main); font-size: 1.4rem; }
.modal-box p { margin-bottom: 2rem; color: var(--text-muted); line-height: 1.5; }

.modal-buttons { display: flex; gap: 1rem; justify-content: center; margin-top: 1.5rem; }
.modal-buttons button { 
    min-width: 100px; 
    padding: 10px 20px;
    border-radius: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

#modal-cancel-btn {
    background: transparent;
    border: 2px solid var(--border);
    color: var(--text-muted);
}
#modal-cancel-btn:hover {
    border-color: var(--text-muted);
    color: var(--text-main);
    background: rgba(255,255,255,0.05);
}

#modal-confirm-btn {
    background: var(--primary);
    border: 2px solid var(--primary);
    color: white;
    box-shadow: 0 4px 0 var(--primary-depth);
}
#modal-confirm-btn:hover {
    background: #6be312; 
    transform: translateY(-2px);
    box-shadow: 0 6px 0 var(--primary-depth);
}
#modal-confirm-btn:active {
    transform: translateY(2px);
    box-shadow: 0 0 0 var(--primary-depth);
}

/* FIX: Ensure Header is above Feedback Sheet but below Modal */
.quiz-top-bar { z-index: 100; position: relative; } 
.feedback-sheet { z-index: 50; }

/* --- Pack Mini Stats --- */
/* --- Pack Mini Stats --- */
.pack-mini-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
    margin-bottom: 8px;
}

.pack-mini-stats span {
    display: flex;
    align-items: center;
    gap: 5px;
    background: rgba(255, 255, 255, 0.05);
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 600;
}

.pack-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 4px;
}

.pack-header-row h3 {
    margin: 0;
    font-size: 1.1rem;
    flex-grow: 1;
}

.pack-total-badge {
    font-size: 0.75rem;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.08); /* slightly stronger than stats bg */
    padding: 2px 6px;
    border-radius: 4px;
    white-space: nowrap;
}
/* Cleaned up malformed block */

.pack-mini-stats i {
    width: 16px; 
    text-align: center;
    opacity: 0.8;
}

.pack-mini-stats .stat-success {
    color: var(--primary);
    background: rgba(88, 204, 2, 0.1); 
    border: 1px solid rgba(88, 204, 2, 0.2);
}

.pack-mini-stats .stat-error {
    color: var(--danger);
    background: rgba(255, 75, 75, 0.1); 
    border: 1px solid rgba(255, 75, 75, 0.2);
}

/* Search Term Highlighting */
.highlight {
    background: linear-gradient(120deg, rgba(255, 230, 0, 0.3) 0%, rgba(255, 200, 0, 0.4) 100%);
    color: #fff;
    font-weight: 600;
    padding: 1px 4px;
    border-radius: 3px;
    box-shadow: 0 0 4px rgba(255, 230, 0, 0.5);
}

/* Profile Actions */
.profile-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 20px;
}

.btn-warning-lg {
    background: linear-gradient(135deg, #ff9800 0%, #f57c00 100%);
    color: white;
    border: none;
    padding: 14px 28px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.btn-warning-lg:hover {
    background: linear-gradient(135deg, #f57c00 0%, #e65100 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(255, 152, 0, 0.4);
}

.btn-danger-lg {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
