@import url('https://fonts.googleapis.com/css2?family=Lexend:wght@400;500;600;700;800&family=Be+Vietnam+Pro:wght@400;500;600;700;800&family=Outfit:wght@700;800&display=swap&subset=vietnamese');

:root {
    --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.05);
    --glass-blur: blur(16px);
}

/* THEME LAB (Dựa trên ảnh tham khảo) */
body.theme-lab {
    --bg-color: #fdf4f4; /* Light pink background */
    --surface: rgba(255, 255, 255, 0.45); /* More transparent for stronger glass effect */
    --text-main: #333333;
    --text-muted: #777777;
    --primary: #b91c1c; /* Dark red */
    --primary-light: #fef2f2;
    --accent: #991b1b;
    --border: #fca5a5; /* Light red border */
    --border-hover: var(--primary);
    --shadow-lg: 0 10px 25px rgba(185, 28, 28, 0.05);
    --card-shadow: 0 2px 10px rgba(0,0,0,0.03);
    --btn-bg: #ffffff;
}

/* Các theme cũ giữ nguyên để dùng chung form làm bài */
body.theme-cyber { --bg-color: #0a0f1c; --surface: rgba(15, 23, 42, 0.6); --text-main: #f8fafc; --text-muted: #94a3b8; --primary: #8b5cf6; --primary-light: rgba(139, 92, 246, 0.15); --border: rgba(255, 255, 255, 0.1); --border-hover: var(--primary); --card-shadow: 0 0 0 1px rgba(255, 255, 255, 0.05); --btn-bg: #1e293b; }
body.theme-neumorphic { --bg-color: #e0e5ec; --surface: #e0e5ec; --text-main: #2d3748; --text-muted: #718096; --primary: #10b981; --primary-light: #d1fae5; --border: rgba(16, 185, 129, 0.35); --border-hover: var(--primary); --card-shadow: 9px 9px 16px rgb(163,177,198,0.6), -9px -9px 16px rgba(255,255,255, 0.5); --btn-bg: #e0e5ec; }
body.theme-mesh { --bg-color: #f3f4f6; --surface: rgba(255, 255, 255, 0.7); --text-main: #111827; --text-muted: #6b7280; --primary: #4f46e5; --primary-light: #e0e7ff; --border: rgba(79, 70, 229, 0.3); --border-hover: var(--primary); --card-shadow: 0 20px 40px -10px rgba(79, 70, 229, 0.15); --btn-bg: white; }
body.theme-crimson { --bg-color: #f8fafc; --surface: rgba(255, 255, 255, 0.85); --text-main: #0f172a; --text-muted: #64748b; --primary: #e11d48; --primary-light: #fff1f2; --accent: #111827; --border: rgba(226, 232, 240, 0.8); --border-hover: var(--primary); --card-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.05); --btn-bg: white; }
body.theme-crimson::before { content: ''; position: absolute; top: -10%; left: -10%; width: 50%; height: 50%; background: radial-gradient(circle, rgba(225,29,72,0.06) 0%, transparent 70%); z-index: -1; pointer-events: none; }
body.theme-crimson::after { content: ''; position: absolute; bottom: -20%; right: -10%; width: 60%; height: 60%; background: radial-gradient(circle, rgba(17,24,39,0.05) 0%, transparent 70%); z-index: -1; pointer-events: none; }

/* ── CSS Cascade Layers: base < utilities ──
   Wrap global resets vào @layer base để Tailwind @layer utilities
   có thể override khi cần (vd: px-5, py-2, rounded-full).
   
   Tất cả legacy CSS còn lại (bento-card, btn-primary...) vẫn UNLAYERED
   → vẫn có priority CAO NHẤT, không bị ảnh hưởng.
   
   Xem VTCG_2.0_ARCHITECTURE_RULES.md §4.4 để hiểu chi tiết. */
/* Anti-FOUC: Block ALL transitions during initial page load to prevent dark/light flash */
html.no-transitions,
html.no-transitions *,
html.no-transitions *::before,
html.no-transitions *::after {
    transition: none !important;
}

@layer base {
    * { margin: 0; padding: 0; box-sizing: border-box; }
    body { font-family: 'Be Vietnam Pro', sans-serif; background-color: var(--bg-color); color: var(--text-main); min-height: 100vh; display: flex; flex-direction: column; overflow-x: hidden; overflow-y: auto; position: relative; transition: background-color 0.5s ease; }
    h1, h2, h3, .question-number, .timer, .palette-header { font-family: 'Lexend', sans-serif; }
}

/* Switcher */
.theme-switcher { position: fixed; bottom: 2rem; left: 2rem; background: var(--surface); backdrop-filter: var(--glass-blur); padding: 0.75rem; border-radius: 50px; display: flex; gap: 0.75rem; box-shadow: var(--card-shadow); border: 1px solid var(--border); z-index: 1000; transition: opacity 0.3s ease, visibility 0.3s ease; }
body.hide-switcher .theme-switcher { opacity: 0; visibility: hidden; pointer-events: none; }
.theme-dot { width: 24px; height: 24px; border-radius: 50%; cursor: pointer; border: 2px solid white; box-shadow: 0 2px 4px rgba(0,0,0,0.2); transition: transform 0.2s; }
.theme-dot:hover { transform: scale(1.2); }
.dot-cyber { background: linear-gradient(135deg, #0f172a, #8b5cf6); }
.dot-neumorphic { background: #e0e5ec; border: 2px solid #cbd5e1; }
.dot-mesh { background: linear-gradient(135deg, #e0c3fc, #8ec5fc); }

/* Dark Mode Toggle Button */
.dark-mode-btn {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    background: #1e293b;
    color: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    transition: transform 0.2s, background-color 0.3s;
    padding: 0;
    margin: 0;
    outline: none;
}
.dark-mode-btn:hover {
    transform: scale(1.2);
}
body.dark-mode .dark-mode-btn {
    background: #f8fafc;
    color: #0f172a;
    border-color: #0f172a;
}

/* Dark Mode Theme Overrides - Standard High-Quality Charcoal/Dark Grey (Cốc Cốc style) */
html.dark-mode body,
body.dark-mode {
    --bg-color: #121214;
    --surface: rgba(30, 30, 35, 0.75);
    --text-main: #f3f4f6;
    --text-muted: #9ca3af;
    --border: rgba(255, 255, 255, 0.08);
    --btn-bg: #1e1e24;
    --card-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}
/* Propagate dark-mode class from html to body for legacy selectors */
html.dark-mode body { background-color: var(--bg-color); color: var(--text-main); }

html.dark-mode body.theme-lab,
body.dark-mode.theme-lab {
    --bg-color: #320808;
    --surface: rgba(20, 20, 25, 0.75);
    --text-main: #f3f4f6;
    --text-muted: #fca5a5;
    --border: rgba(239, 68, 68, 0.25);
    --btn-bg: #4c1111;
    --primary: #ff4d4d;
    --primary-light: rgba(255, 77, 77, 0.15);
    --accent: #f87171;
}

html.dark-mode body.theme-mesh,
body.dark-mode.theme-mesh {
    --primary: #4f46e5;
    --primary-light: rgba(79, 70, 229, 0.15);
    --accent: #818cf8;
}

html.dark-mode body.theme-neumorphic,
body.dark-mode.theme-neumorphic {
    --bg-color: #18191c;
    --surface: #1e2024;
    --primary: #10b981;
    --primary-light: rgba(16, 185, 129, 0.15);
    --accent: #34d399;
    --border: rgba(16, 185, 129, 0.25);
    --card-shadow: 6px 6px 12px rgba(0, 0, 0, 0.6), -6px -6px 12px rgba(255, 255, 255, 0.02);
    --btn-bg: #1e2024;
}

html.dark-mode body.theme-cyber,
body.dark-mode.theme-cyber {
    --bg-color: #0c0d12;
    --surface: rgba(20, 21, 30, 0.8);
    --primary: #8b5cf6;
    --primary-light: rgba(139, 92, 246, 0.15);
    --accent: #a78bfa;
}

/* High specificity overrides to bypass page-level !important rules */
html.dark-mode body.theme-lab,
html.dark-mode body.theme-mesh,
html.dark-mode body.theme-neumorphic,
html.dark-mode body.theme-cyber,
html.dark-mode body.theme-crimson,
body.dark-mode.theme-lab,
body.dark-mode.theme-mesh,
body.dark-mode.theme-neumorphic,
body.dark-mode.theme-cyber,
body.dark-mode.theme-crimson {
    background-color: var(--bg-color) !important;
}

html.dark-mode body.theme-lab #loading-screen,
html.dark-mode body.theme-mesh #loading-screen,
html.dark-mode body.theme-neumorphic #loading-screen,
html.dark-mode body.theme-cyber #loading-screen,
html.dark-mode body.theme-crimson #loading-screen,
body.dark-mode.theme-lab #loading-screen,
body.dark-mode.theme-mesh #loading-screen,
body.dark-mode.theme-neumorphic #loading-screen,
body.dark-mode.theme-cyber #loading-screen,
body.dark-mode.theme-crimson #loading-screen {
    background-color: var(--bg-color) !important;
}

/* Views */
.view { display: none; flex: 1; height: 100%; width: 100%; flex-direction: column; }
.view.active { display: flex; }

/* ================== BENTO DASHBOARD VIEW ================== */
.bento-layout { background: transparent; color: var(--text-main); transition: background-color 0.5s ease; overflow-y: auto; position: relative; z-index: 10; display: flex; flex-direction: column; }

/* Top Nav */
.bento-nav { display: flex; justify-content: space-between; align-items: center; padding: 0.4rem 3rem; background: var(--surface); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border-bottom: 1px solid var(--border); transition: background-color 0.5s ease; position: sticky; top: 0; z-index: 50; }
.nav-left, .nav-right { display: flex; align-items: center; gap: 2.5rem; }
.bento-logo { font-size: 1.75rem; font-weight: 800; color: var(--primary); font-family: 'Be Vietnam Pro', sans-serif; letter-spacing: -0.5px; display: flex; align-items: center; }
.bento-logo .logo-image-desktop { display: none; height: 38px; width: auto; object-fit: contain; }
.bento-logo .logo-image-desktop-wrapper { display: none; align-items: center; gap: 0.75rem; }
.bento-logo .logo-text-mobile { display: inline; }
.bento-logo .logo-admin-badge { background: var(--primary); color: #ffffff; font-size: 0.7rem; font-weight: 800; padding: 2px 8px; border-radius: 4px; letter-spacing: 0.5px; margin-left: 0.5rem; }

@media (min-width: 768px) {
    .bento-logo .logo-image-desktop { display: block; }
    .bento-logo .logo-image-desktop-wrapper { display: flex; }
    .bento-logo .logo-text-mobile { display: none; }
}
.nav-links { display: flex; gap: 1.25rem; align-items: center; flex-wrap: wrap; position: relative; }
.nav-links a {
    text-decoration: none;
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 0.4rem;
    position: relative;
    padding: 0.25rem 0;
    white-space: nowrap;
}
.nav-links a::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary);
    transform: scaleX(0); transform-origin: left; transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 2px;
}
.nav-links a:hover {
    color: var(--text-main);
}
.nav-links a:hover::after {
    transform: scaleX(1);
}
.nav-links a.active {
    color: var(--primary);
    font-weight: 700;
}
.nav-links a.active::after {
    transform: scaleX(1);
}
.nav-links a svg.nav-icon {
    stroke: var(--text-muted);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), stroke 0.3s ease;
}
.nav-links a:hover svg.nav-icon {
    stroke: var(--text-main);
    transform: scale(1.2) rotate(4deg);
}
.nav-links a.active svg.nav-icon {
    stroke: var(--primary);
    transform: scale(1.2);
}

.streak-badge { background: rgba(245, 158, 11, 0.1); color: #d97706; padding: 0.4rem 0.8rem; border-radius: 50px; font-weight: 700; font-size: 0.9rem; border: 1px solid rgba(245, 158, 11, 0.2); }
.bento-user { display: flex; align-items: center; gap: 0.75rem; cursor: pointer; font-weight: 600; font-size: 0.95rem; color: var(--text-main); }
.bento-user .avatar { width: 36px; height: 36px; background: var(--primary-light); border: 1px solid var(--border); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 1rem; }

/* Subheader */
.bento-subheader { display: flex; justify-content: space-between; align-items: center; padding: 1.5rem 0 0 0; max-width: 1280px; margin: 0 auto; width: 100%; }
.breadcrumb { font-size: 0.95rem; color: var(--text-muted); font-weight: 500; }
.breadcrumb span.active { color: var(--text-main); font-weight: 700; }
.btn-sm { padding: 0.6rem 1.5rem; font-size: 0.9rem; border-radius: 50px; }

/* Bento Content */
.bento-content { padding: 1rem 0; max-width: 1280px; margin: 0 auto; width: 100%; flex: 1; display: flex; flex-direction: column; min-height: 0; }
.bento-grid { flex: 1; display: grid; grid-template-columns: repeat(4, 1fr); grid-template-rows: minmax(0, 26fr) minmax(0, 21fr) minmax(0, 22fr); gap: 1rem; min-height: 0; padding-bottom: 1rem; }

/* Bento Cards */
@keyframes bento-fade-in-up {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
.bento-card {
    background: var(--surface);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: 20px;
    padding: 1.25rem 1.5rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.02);
    display: flex;
    flex-direction: column;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.4s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.4s ease;
    border: 1px solid var(--border);
    overflow-y: auto;
    animation: bento-fade-in-up 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.bento-card:hover {
    transform: translateY(-5px) scale(1.01);
    border-color: var(--border-hover, var(--border));
    box-shadow: 0 15px 35px var(--primary-light), 0 0 0 1px var(--primary-light);
}
body.dark-mode .bento-card:hover {
    border-color: var(--border-hover, var(--border));
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5), 0 0 0 1px var(--border-hover, var(--border));
}
.bento-card h3 { font-size: 1.1rem; font-weight: 700; color: var(--text-main); margin-bottom: 1rem; }

/* Stagger card entry animation delays */
.bento-grid > :nth-child(1) { animation-delay: 0.05s; }
.bento-grid > :nth-child(2) { animation-delay: 0.1s; }
.bento-grid > :nth-child(3) { animation-delay: 0.15s; }
.bento-grid > :nth-child(4) { animation-delay: 0.2s; }
.bento-grid > :nth-child(5) { animation-delay: 0.25s; }
.bento-grid > :nth-child(6) { animation-delay: 0.3s; }
.bento-grid > :nth-child(7) { animation-delay: 0.35s; }
.bento-grid > :nth-child(8) { animation-delay: 0.4s; }

/* Specific Cards */
.bento-hero { grid-column: span 2; background: linear-gradient(135deg, var(--surface) 0%, var(--primary-light) 100%); justify-content: space-between; position: relative; overflow: hidden; }
.bento-hero::after { content: ''; position: absolute; right: -10%; top: -10%; width: 200px; height: 200px; background: radial-gradient(circle, var(--primary) 0%, transparent 70%); opacity: 0.1; border-radius: 50%; pointer-events: none; }
.hero-text h1 { font-size: 1.5rem; font-weight: 800; color: var(--text-main); margin-top: 0; margin-bottom: 0.25rem; line-height: 1.2; }
.hero-text p { font-size: 0.82rem; color: var(--text-muted); margin: 0; line-height: 1.35; max-width: 100%; }
.hero-stats { display: flex; gap: 1.5rem; margin-top: auto; padding-top: 0; flex-shrink: 0; }
.bento-countdown .text-lg { font-size: 1.1rem; font-weight: 700; color: var(--text-main); margin-bottom: 0.25rem; }
.bento-countdown .text-sm { font-size: 0.85rem; color: var(--text-muted); }

.exp-container { display: flex; flex-direction: column; gap: 0.5rem; margin-top: 0.5rem; margin-bottom: 0.5rem; flex: 0 1 auto !important; }
.stat-box { display: flex; flex-direction: column; gap: 0.2rem; }
.stat-num { font-size: 2rem; font-weight: 800; color: var(--primary); font-family: 'Lexend'; line-height: 1; }
.stat-lbl { font-size: 0.8rem; color: var(--text-muted); font-weight: 500; }

.bento-action { grid-column: span 1; background: var(--primary); color: white; cursor: pointer; justify-content: center; align-items: flex-start; position: relative; overflow: hidden; }
.pulse-bg::before { content: ''; position: absolute; top: 0; left: -100%; width: 50%; height: 100%; background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent); transform: skewX(-20deg); animation: shine 3s infinite; pointer-events: none; }
@keyframes shine { 0% { left: -100%; } 20% { left: 200%; } 100% { left: 200%; } }
.action-content h3 { color: white; margin-bottom: 0.25rem; font-size: 1.25rem; }
.action-content p { color: rgba(255,255,255,0.8); font-size: 0.85rem; margin-bottom: 1rem; }
.btn-start-now { background: white; color: var(--primary); padding: 0.5rem 1rem; border-radius: 50px; font-weight: 700; font-size: 0.85rem; display: inline-block; }

.leaderboard-list { list-style: none; display: flex; flex-direction: column; gap: 0.75rem; }
.leaderboard-list li { display: flex; align-items: center; gap: 0.75rem; padding: 0.5rem 0.75rem; background: var(--bg-color); border-radius: 10px; font-weight: 600; }
.rank { width: 20px; height: 20px; background: #fbbf24; color: white; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 0.75rem; }
.leaderboard-list li:nth-child(2) .rank { background: #94a3b8; }
.leaderboard-list li:nth-child(3) .rank { background: #b45309; }
.leaderboard-list .name { flex: 1; color: var(--text-main); font-size: 0.85rem; }
.leaderboard-list .score { color: var(--primary); font-family: 'Lexend'; font-size: 0.95rem; }

/* Heatmap Styles */
.bento-heatmap { grid-column: span 3; }
.heatmap-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.5rem; }
.heatmap-header h3 { margin-bottom: 0; }
.heatmap-total { font-size: 0.85rem; color: var(--text-muted); font-weight: 500; }
.heatmap-body { display: flex; flex-direction: column; gap: 0.5rem; }
.heatmap-months { display: flex; justify-content: space-between; padding-left: 1.5rem; font-size: 0.75rem; color: var(--text-muted); }
.heatmap-grid-container { display: grid; grid-template-rows: repeat(7, 10px); grid-auto-flow: column; grid-auto-columns: 10px; gap: 3px; overflow-x: auto; padding-bottom: 0; }
.heatmap-cell { width: 10px; height: 10px; border-radius: 2px; }
.level-0 { background: var(--text-muted); opacity: 0.1; }
.level-1 { background: var(--primary); opacity: 0.25; }
.level-2 { background: var(--primary); opacity: 0.5; }
.level-3 { background: var(--primary); opacity: 0.75; }
.level-4 { background: var(--primary); opacity: 1; }
.heatmap-footer { display: flex; justify-content: flex-end; align-items: center; gap: 0.5rem; font-size: 0.75rem; color: var(--text-muted); margin-top: 0.25rem; }
.legend-squares { display: flex; gap: 3px; }

/* Daily Quests */
.bento-quests { grid-column: span 1; }

/* Skill Gap Analysis */
.bento-skills { grid-column: span 2; }


/* ================== EXAM VIEW SHARED (Keep identical logic) ================== */
.btn-primary { background: var(--primary); color: white; padding: 1rem 2.5rem; border-radius: 12px; font-weight: 700; font-size: 1.3rem; text-transform: uppercase; letter-spacing: 0.5px; border: none; cursor: pointer; transition: all 0.3s; font-family: 'Lexend'; box-shadow: 0 4px 15px var(--primary-light); }
.btn-primary:hover { transform: translateY(-2px); filter: brightness(1.1); box-shadow: 0 8px 20px var(--primary-light); }
.btn-outline { background: var(--btn-bg); border: 2px solid var(--border); color: var(--text-main); padding: 1rem 2rem; border-radius: 12px; font-weight: 600; font-size: 1.3rem; cursor: pointer; transition: all 0.3s ease; font-family: 'Lexend'; box-shadow: var(--card-shadow); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
#exam-view header { background: var(--surface); backdrop-filter: var(--glass-blur); border-bottom: 1px solid var(--border); padding: 0.75rem 2rem; display: flex; justify-content: space-between; align-items: center; z-index: 10; }
.section-info { text-align: center; background: var(--btn-bg); padding: 0.5rem 2rem; border-radius: 100px; box-shadow: var(--card-shadow); border: 1px solid var(--border); }
.section-title { font-weight: 700; font-size: 1.3rem; color: var(--primary); text-transform: uppercase; }
.timer { display: flex; align-items: center; gap: 0.75rem; background: rgba(220, 38, 38, 0.08); color: var(--primary); padding: 0.6rem 1.2rem; border-radius: 50px; font-weight: 700; font-size: 1.4rem; border: 1px solid rgba(220, 38, 38, 0.15); position: relative; }
.main-container { display: flex; flex: 1; padding: 1.5rem 2rem; gap: 2rem; max-width: 1800px; margin: 0 auto; width: 100%; height: calc(100vh - 70px); }
.panel { background: var(--surface); backdrop-filter: var(--glass-blur); border: 1px solid var(--border); border-radius: 24px; box-shadow: var(--card-shadow); display: flex; flex-direction: column; }
.question-panel { flex: 1; min-width: 0; padding: 2rem; position: relative; overflow-y: auto; display: flex; flex-direction: column; }
.question-header { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 2rem; }
.question-number { font-size: 3rem; font-weight: 800; color: var(--text-main); }
.question-content { font-size: 1.3rem; line-height: 1.6; margin-bottom: 1.5rem; color: var(--text-main); }
.options-list { display: flex; flex-direction: column; gap: 1rem; }
.option { display: flex; align-items: center; padding: 1.15rem 1.75rem; background: var(--surface); border: 2px solid var(--border); border-radius: 16px; cursor: pointer; transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); box-shadow: 0 4px 6px rgba(0,0,0,0.02); }
.option:hover { border-color: var(--primary); transform: translateY(-2px); box-shadow: 0 8px 15px rgba(0,0,0,0.05); }
.option.selected { border-color: var(--primary); background: var(--primary-light); color: var(--text-main); }
.option-text { font-size: 1.3rem; font-weight: 500; color: var(--text-main); }
.radio-custom { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--text-muted); margin-right: 1.5rem; display: flex; align-items: center; justify-content: center; transition: all 0.2s; }
.option:hover .radio-custom { border-color: var(--primary); }
.option.selected .radio-custom { border-color: var(--primary); background: var(--primary); }
.option.selected .radio-custom::after { content: ''; width: 8px; height: 8px; background: white; border-radius: 50%; }
.action-buttons { margin-top: auto; padding-top: 2rem; display: flex; justify-content: space-between; }
.palette-panel { width: 350px; flex-shrink: 0; padding: 1.5rem; display: flex; flex-direction: column; }
.palette-header { font-weight: 700; font-size: 1.4rem; margin-bottom: 1.5rem; color: var(--text-main); }
.status-legend { display: flex; flex-wrap: wrap; gap: 1rem; margin-bottom: 2rem; font-size: 0.85rem; font-weight: 600; color: var(--text-muted); }
.legend-item { display: flex; align-items: center; gap: 0.5rem; }
.legend-dot { width: 14px; height: 14px; border-radius: 4px; }
.dot-answered { background: var(--primary); }
.dot-unanswered { background: var(--btn-bg); border: 2px solid var(--border); }
.dot-current { background: var(--btn-bg); border: 2px solid var(--primary); }
.question-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 0.85rem; overflow-y: auto; padding-right: 10px; height: calc(100% - 130px); flex: 1; align-content: start; }
.q-box { width: 48px; height: 48px; border-radius: 50%; background: var(--surface); border: 2px solid var(--border); display: flex; align-items: center; justify-content: center; font-family: 'Lexend', sans-serif; font-weight: 700; font-size: 1.1rem; cursor: pointer; transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1); color: var(--text-muted); box-shadow: 0 2px 5px rgba(0,0,0,0.02); }
.q-box:hover { border-color: var(--primary); color: var(--primary); transform: scale(1.15); box-shadow: 0 5px 15px rgba(220, 38, 38, 0.2); }
.q-box.answered { background: var(--primary); color: white; border-color: transparent; }
.q-box.current { border: 2px solid var(--primary); color: var(--primary); }
.q-box.correct { background: #10b981; color: white; border-color: transparent; }
.q-box.incorrect { background: #ef4444; color: white; border-color: transparent; }
.q-box.skipped { background: var(--btn-bg); color: var(--text-muted); border-color: var(--border); }
.option.correct { border-color: #10b981; background: rgba(16, 185, 129, 0.1); }
.option.incorrect { border-color: #ef4444; background: rgba(239, 68, 68, 0.1); }
.dot-correct { background: #10b981; }
.dot-incorrect { background: #ef4444; }
.dot-skipped { background: var(--btn-bg); border: 2px solid var(--border); }
.submit-area { margin-top: auto; padding-top: 1.5rem; }
.btn-submit { width: 100%; background: var(--primary); color: white; padding: 1.25rem; font-size: 1.1rem; text-transform: uppercase; letter-spacing: 1px; border-radius: 14px; border: none; cursor: pointer; font-family: 'Lexend'; font-weight: 700; transition: all 0.3s; box-shadow: 0 8px 20px var(--primary-light); }
.btn-submit:hover { transform: translateY(-2px); filter: brightness(1.1); }

/* KaTeX Math Scaling */
.question-content .katex, .option-text .katex { font-size: 1.3em !important; }
.katex .scriptstyle { font-size: 0.9em !important; } /* Make exponents bigger */
.katex .scriptscriptstyle { font-size: 0.8em !important; } /* Make nested exponents bigger */

/* Result */
.center-view { align-items: center; justify-content: center; text-align: center; padding: 2rem; }
.score-circle { width: 220px; height: 220px; border-radius: 50%; background: var(--primary); color: white; display: flex; flex-direction: column; align-items: center; justify-content: center; border: 8px solid var(--btn-bg); box-shadow: var(--card-shadow); margin-bottom: 2rem; }
.score-number { font-size: 5rem; font-weight: 800; font-family: 'Lexend'; }
.score-label { font-size: 1.2rem; font-weight: 600; text-transform: uppercase; opacity: 0.9; }
.result-details { display: flex; gap: 2rem; margin-bottom: 3rem; }
.detail-box { background: var(--surface); backdrop-filter: var(--glass-blur); padding: 1.5rem; border-radius: 16px; border: 1px solid var(--border); min-width: 160px; box-shadow: var(--card-shadow); }
.detail-value { font-size: 2.5rem; font-weight: 800; color: var(--primary); font-family: 'Lexend'; }

.review-panel { border-top: 1px solid var(--border); padding-top: 1.5rem; margin-top: 1.5rem; }
.review-panel p { margin-bottom: 0.5rem; color: var(--text-main); font-weight: 500; }
.explanation-box { background: var(--surface); border: 1px solid var(--border); padding: 1rem; border-radius: 8px; font-size: 0.95rem; color: var(--text-muted); line-height: 1.6; white-space: pre-wrap; }

/* Tu Tien Magic Formation Background */
.bg-animated { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; z-index: 0; overflow: hidden; pointer-events: none; background: transparent; }
.tran-phap { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); opacity: 0.12; width: 100vw; height: 100vh; }
.ring { position: absolute; top: 50%; left: 50%; border-radius: 50%; }

.ring-1 { width: 1500px; height: 1500px; border: 2px solid var(--primary); animation: spin-center 180s linear infinite; }
.ring-2 { width: 1440px; height: 1440px; border: 12px dashed var(--primary); animation: spin-center-reverse 120s linear infinite; opacity: 0.5; }
.ring-3 { width: 1000px; height: 1000px; border: 4px solid var(--primary); animation: spin-center 200s linear infinite; }

.ring-bagua { width: 1000px; height: 1000px; animation: spin-center-reverse 90s linear infinite; }
.bagua { position: absolute; top: 50%; left: 50%; font-size: 6rem; color: var(--primary); margin-top: -3rem; margin-left: -3rem; font-weight: bold; }
.bagua:nth-child(1) { transform: rotate(0deg) translateY(-460px); }
.bagua:nth-child(2) { transform: rotate(45deg) translateY(-460px); }
.bagua:nth-child(3) { transform: rotate(90deg) translateY(-460px); }
.bagua:nth-child(4) { transform: rotate(135deg) translateY(-460px); }
.bagua:nth-child(5) { transform: rotate(180deg) translateY(-460px); }
.bagua:nth-child(6) { transform: rotate(225deg) translateY(-460px); }
.bagua:nth-child(7) { transform: rotate(270deg) translateY(-460px); }
.bagua:nth-child(8) { transform: rotate(315deg) translateY(-460px); }

.ring-4 { font-size: 25rem; color: var(--primary); line-height: 1; display: flex; align-items: center; justify-content: center; animation: spin-center 60s linear infinite; text-shadow: 0 0 30px var(--primary-light); }

@keyframes spin-center { 0% { transform: translate(-50%, -50%) rotate(0deg); } 100% { transform: translate(-50%, -50%) rotate(360deg); } }
@keyframes spin-center-reverse { 0% { transform: translate(-50%, -50%) rotate(360deg); } 100% { transform: translate(-50%, -50%) rotate(0deg); } }

/* V2 PREMIUM CRIMSON SPECIFIC ANIMATIONS & STYLES */
body.theme-crimson .logo .icon-box { background: linear-gradient(135deg, var(--primary) 0%, #991b1b 100%); box-shadow: 0 0 20px rgba(220, 38, 38, 0.15); }
body.theme-crimson .timer { overflow: hidden; box-shadow: 0 0 15px rgba(220, 38, 38, 0.1); border-color: rgba(220, 38, 38, 0.2); }
body.theme-crimson .timer::before { content: ''; position: absolute; top: 0; left: 0; right: 0; bottom: 0; border-radius: 50px; border: 2px solid var(--primary); opacity: 0; animation: pulse-border 2s infinite cubic-bezier(0.4, 0, 0.2, 1); }
@keyframes pulse-border { 0% { transform: scale(0.95); opacity: 0.5; } 100% { transform: scale(1.1); opacity: 0; } }

body.theme-crimson .option { overflow: hidden; }
body.theme-crimson .option.selected .radio-custom::after { animation: popIn 0.3s cubic-bezier(0.4, 0, 0.2, 1); }
@keyframes popIn { 0% { transform: scale(0); } 100% { transform: scale(1); } }

body.theme-crimson .q-box:hover { transform: scale(1.1) rotate(2deg); z-index: 2; border-color: var(--primary); color: var(--primary); }
body.theme-crimson .q-box.answered { background: linear-gradient(135deg, var(--primary) 0%, #be123c 100%); box-shadow: 0 4px 10px rgba(225, 29, 72, 0.2); color: white; border-color: transparent;}
body.theme-crimson .q-box.current { box-shadow: 0 0 0 4px var(--primary-light); transform: scale(1.05); }

/* Premium SaaS Buttons */
body.theme-crimson .btn-outline { background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%); color: #334155; border: 1px solid #cbd5e1; box-shadow: 0 1px 2px rgba(0,0,0,0.05); transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1); }
body.theme-crimson .btn-outline:hover { background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%); border-color: #94a3b8; color: #0f172a; transform: translateY(-1px); box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05); }
body.theme-crimson .btn-outline:active { transform: scale(0.98); box-shadow: inset 0 2px 4px rgba(0,0,0,0.05); }

body.theme-crimson .btn-submit { background: linear-gradient(180deg, #f43f5e 0%, #e11d48 100%); color: #ffffff; border: 1px solid #be123c; box-shadow: inset 0 1px 0 rgba(255,255,255,0.2), 0 4px 12px rgba(225, 29, 72, 0.3); text-shadow: 0 1px 2px rgba(0,0,0,0.2); transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1); }
body.theme-crimson .btn-submit:hover { background: linear-gradient(180deg, #fb7185 0%, #f43f5e 100%); box-shadow: inset 0 1px 0 rgba(255,255,255,0.3), 0 6px 16px rgba(225, 29, 72, 0.4); transform: translateY(-1px); }
body.theme-crimson .btn-submit:active { transform: scale(0.98); box-shadow: inset 0 2px 6px rgba(159, 18, 57, 0.4); }

body.theme-crimson .btn-primary { background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%); color: #ffffff; border: 1px solid #000000; box-shadow: inset 0 1px 0 rgba(255,255,255,0.1), 0 2px 4px rgba(0,0,0,0.2); transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1); }
body.theme-crimson .btn-primary:hover { background: linear-gradient(180deg, #334155 0%, #1e293b 100%); box-shadow: inset 0 1px 0 rgba(255,255,255,0.15), 0 4px 8px rgba(0,0,0,0.3); transform: translateY(-1px); }
body.theme-crimson .btn-primary:active { transform: scale(0.98); box-shadow: inset 0 2px 4px rgba(0,0,0,0.3); }

/* ================== LEADERBOARD TABS ================== */
.leaderboard-tabs button {
    background: none; border: none; cursor: pointer; font-family: inherit;
    font-size: 0.75rem; font-weight: 600; color: var(--text-muted);
    padding: 0.25rem 0.6rem; border-radius: 6px;
    transition: all 0.2s; white-space: nowrap;
}
.leaderboard-tabs button:hover { color: var(--text-main); background: rgba(0,0,0,0.05); }
.leaderboard-tabs button.active-tab { background: var(--surface); color: var(--primary); box-shadow: 0 1px 4px rgba(0,0,0,0.08); }

/* Clickable nav user */
.bento-user { cursor: pointer; }
.bento-user:hover #nav-username { color: var(--primary); }

/* Skill progress bars */
/* skill progress bars deleted (now using tailwind) */

/* ================== HAMBURGER BUTTON (Desktop: ẩn) ================== */
.hamburger-btn {
    display: none; /* Ẩn trên desktop */
}

/* ================== MOBILE NAV DRAWER ================== */
/* Mobile-only: chỉ áp dụng khi JS inject class mobile-nav-drawer */
.mobile-nav-drawer {
    /* Desktop: không thay đổi gì */
}


/* Mobile Responsiveness */
@media (max-width: 768px) {
    /* Reset zoom and unlock scroll on mobile */
    html { overflow-x: hidden !important; }
    body { zoom: 1 !important; width: 100% !important; height: auto !important; min-height: 100vh !important; overflow: auto !important; overflow-x: hidden !important; -webkit-text-size-adjust: 100%; }
    * { -webkit-tap-highlight-color: transparent; }
    .view { height: auto !important; overflow: visible !important; }
    .bento-layout { overflow: visible !important; }

    /* Hide animated background on mobile - causes visual chaos and performance issues */
    .bg-animated { display: none !important; }
    .tran-phap { display: none !important; }

    /* ===== HAMBURGER BUTTON ===== */
    .hamburger-btn {
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 5px;
        width: 38px;
        height: 38px;
        padding: 0;
        background: var(--surface);
        border: 1px solid var(--border);
        border-radius: 10px;
        cursor: pointer;
        transition: background 0.2s, border-color 0.2s;
        flex-shrink: 0;
        order: 99; /* Luôn ở cuối nav-right */
    }
    .hamburger-btn:hover {
        background: var(--primary-light);
        border-color: var(--primary);
    }
    .ham-line {
        display: block;
        width: 18px;
        height: 2px;
        background: var(--text-main);
        border-radius: 2px;
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s;
        transform-origin: center;
    }
    /* Hiệu ứng X khi mở */
    .hamburger-btn.is-open .ham-line:nth-child(1) {
        transform: translateY(7px) rotate(45deg);
    }
    .hamburger-btn.is-open .ham-line:nth-child(2) {
        opacity: 0;
        transform: scaleX(0);
    }
    .hamburger-btn.is-open .ham-line:nth-child(3) {
        transform: translateY(-7px) rotate(-45deg);
    }

    /* ===== NAVBAR — single row: logo trái, user+hamburger phải ===== */
    .bento-nav {
        padding: 0.5rem 1rem;
        flex-wrap: nowrap; /* Chỉ 1 hàng */
        gap: 0;
        align-items: center;
        justify-content: space-between;
    }
    .nav-left {
        gap: 0.5rem;
        width: auto;
        flex: 1;
        justify-content: flex-start;
    }
    .nav-right {
        gap: 0.6rem;
        width: auto;
        flex-shrink: 0;
        align-items: center;
    }

    /* ===== MOBILE DRAWER — slide in từ trái ===== */
    .mobile-nav-drawer {
        position: fixed !important;
        top: 0;
        left: -100%;
        width: min(280px, 80vw);
        height: 100dvh;
        background: var(--surface, rgba(255,255,255,0.97));
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border-right: 1px solid var(--border);
        box-shadow: 4px 0 24px rgba(0,0,0,0.12);
        z-index: 100;
        display: flex !important;
        flex-direction: column !important;
        gap: 0 !important;
        padding: 5rem 0 1.5rem 0;
        overflow-y: auto;
        transform: translateX(-100%); transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        flex-wrap: nowrap !important;
        overflow-x: hidden;
    }
    .mobile-nav-drawer.drawer-open {
        transform: translateX(0);
    }
    .mobile-nav-drawer a {
        font-size: 1rem !important;
        font-weight: 600 !important;
        white-space: nowrap;
        padding: 0.85rem 1.5rem !important;
        border-bottom: 1px solid var(--border);
        display: flex !important;
        align-items: center;
        gap: 0.75rem !important;
        color: var(--text-muted);
        transition: background 0.15s, color 0.15s;
        border-radius: 0 !important;
    }
    .mobile-nav-drawer a:hover,
    .mobile-nav-drawer a:active {
        background: var(--primary-light);
        color: var(--primary);
    }
    .mobile-nav-drawer a.active {
        color: var(--primary);
        font-weight: 700 !important;
        background: var(--primary-light);
    }
    .mobile-nav-drawer a i {
        width: 20px;
        text-align: center;
        font-size: 1rem;
    }
    /* Ẩn underline animation trong drawer */
    .mobile-nav-drawer a::after { display: none !important; }

    /* ===== ẨN các element không cần trong mobile navbar ===== */
    .streak-badge { display: none !important; } /* Ẩn streak — quá chật */

    .bento-logo { font-size: 1.25rem; }
    .bento-logo .main-logo-img { height: 40px !important; }
    .bento-user { font-size: 0.85rem; gap: 0.4rem; }
    .bento-user .avatar { width: 30px; height: 30px; font-size: 0.85rem; }
    #btn-logout { font-size: 0.75rem !important; padding: 0.3rem 0.6rem !important; }

    /* Subheader */
    .bento-subheader {
        padding: 0.75rem 1rem 0 1rem;
        flex-direction: column;
        gap: 0.5rem;
        align-items: flex-start;
    }
    .breadcrumb { font-size: 0.85rem; }
    .btn-sm { padding: 0.5rem 1rem; font-size: 0.8rem; width: 100%; text-align: center; }

    /* Content area */
    .bento-content {
        padding: 0.5rem 0.75rem;
        flex: none;
        display: block;
    }

    /* Grid - single column stack */
    .bento-grid {
        grid-template-columns: 1fr !important;
        grid-template-rows: auto !important;
        gap: 0.75rem;
    }
    .bento-hero, .bento-action, .bento-countdown, .bento-league, 
    .bento-heatmap, .bento-recent, .bento-quests, .bento-skills {
        grid-column: span 1 !important;
        grid-row: span 1 !important;
        min-height: auto !important;
    }

    /* Cards — disable float/hover animations on mobile */
    .bento-card {
        padding: 1rem !important;
        border-radius: 12px !important;
        animation: none !important;
        transition: none !important;
    }
    .bento-card:hover {
        transform: none !important;
        box-shadow: 0 4px 15px rgba(0,0,0,0.02) !important;
    }
    body.dark-mode .bento-card:hover {
        transform: none !important;
        box-shadow: none !important;
    }
    .bento-card h3 { font-size: 1rem !important; }

    /* Nav — firm sticky, no backdrop jitter */
    .bento-nav {
        position: sticky;
        top: 0;
        z-index: 50;
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
        will-change: transform;
    }
    /* Disable hover underline animation on nav links for touch */
    .nav-links a::after {
        display: none !important;
    }
    .nav-links a:hover svg.nav-icon {
        transform: none !important;
    }
    .nav-links a.active svg.nav-icon {
        transform: none !important;
    }

    /* Hero card */
    .bento-hero { min-height: 180px !important; }
    .bento-hero h2 { font-size: 1.1rem !important; }
    .bento-hero p { font-size: 0.85rem !important; }

    /* Action card (VÀO THI NHANH) */
    .bento-action { min-height: 80px !important; }
    .bento-action h2 { font-size: 1.2rem !important; }

    /* Heatmap - scroll horizontally */
    .bento-heatmap { overflow-x: auto; }
    .bento-heatmap svg { min-width: 600px; }

    /* League/Leaderboard */
    .bento-league { max-height: 350px; overflow-y: auto; }
    .league-day-selector { flex-wrap: wrap; gap: 0.25rem; }
    .league-day-selector .btn-day { font-size: 0.75rem; padding: 0.25rem 0.5rem; }

    /* Stats row */
    .stats-row, .stat-row, .bento-stats-row {
        flex-wrap: wrap !important;
        gap: 0.5rem !important;
    }
    .stat-item, .bento-stat-item {
        flex: 1 1 45% !important;
        min-width: 0 !important;
    }

    /* Recent exams */
    .bento-recent { max-height: 300px; overflow-y: auto; }

    /* Quests */
    .bento-quests { max-height: 300px; overflow-y: auto; }

    /* Skills chart */
    .bento-skills { max-height: 300px; overflow-y: auto; }

    /* Theme switcher */
    .theme-switcher {
        bottom: 0.75rem;
        left: 50%;
        transform: translateX(-50%);
        padding: 0.4rem;
        gap: 0.3rem;
        z-index: 100;
    }
    .theme-switcher .theme-dot { width: 16px !important; height: 16px !important; }
    .theme-switcher .dark-mode-btn { width: 16px !important; height: 16px !important; font-size: 0.55rem !important; }

    /* Countdown card */
    .bento-countdown { min-height: 160px !important; }
    .countdown-timer { font-size: 1.2rem !important; }

    /* Floating elements */
    .chat-float-btn { bottom: 3.5rem !important; right: 0.75rem !important; width: 44px !important; height: 44px !important; }
}

/* Compact layout for smaller height screens (e.g. 1080p at 125% scale) */
@media (max-height: 900px) and (min-width: 769px) {
    body { zoom: 0.8; width: 125vw; min-height: 125vh; }
    .bg-animated { width: 125vw !important; min-height: 125vh !important; }
}

@media (min-width: 1600px), (max-height: 900px) and (min-width: 769px) {
    .bento-content { max-width: 1600px !important; }
    .bento-subheader { max-width: 1600px !important; padding-left: 0 !important; }
    .bento-grid { grid-template-columns: repeat(12, 1fr) !important; grid-template-rows: none !important; grid-auto-rows: auto !important; gap: 1rem; }
    
    .bento-league { grid-column: 1 / span 3 !important; grid-row: 1 / span 3 !important; }
    .bento-hero { grid-column: 4 / span 4 !important; grid-row: 1 !important; }
    .bento-countdown { grid-column: 8 / span 2 !important; grid-row: 1 !important; }
    .bento-action { grid-column: 10 / span 3 !important; grid-row: 1 !important; }
    
    .bento-heatmap { grid-column: 4 / span 9 !important; grid-row: 2 !important; }
    
    .bento-quests { grid-column: 4 / span 3 !important; grid-row: 3 !important; }
    .bento-recent { grid-column: 7 / span 3 !important; grid-row: 3 !important; }
    .bento-skills { grid-column: 10 / span 3 !important; grid-row: 3 !important; }

    .leaderboard-list { max-height: 500px; overflow-y: auto; padding-right: 5px; }

    .theme-switcher { left: 1rem !important; right: auto !important; padding: 0.5rem !important; gap: 0.5rem !important; }
    .theme-switcher .theme-dot { width: 18px !important; height: 18px !important; }
    .theme-switcher .dark-mode-btn { width: 18px !important; height: 18px !important; font-size: 0.6rem !important; }
}
@media (max-width: 768px) {
    .bento-grid { grid-template-rows: auto; }
    .bento-content { flex: none; display: block; }
}

/* ======================== SKELETON LOADING ======================== */
@keyframes skeleton-shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.skeleton {
    background: linear-gradient(90deg,
        var(--border, rgba(0,0,0,0.06)) 25%,
        rgba(255,255,255,0.15) 37%,
        var(--border, rgba(0,0,0,0.06)) 63%
    );
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
    border-radius: 8px;
}

.skeleton-card {
    padding: 1.5rem;
    border-radius: 16px;
    border: 1px solid var(--border, rgba(0,0,0,0.06));
    background: var(--surface, rgba(255,255,255,0.6));
    backdrop-filter: blur(12px);
}

.skeleton-line {
    height: 14px;
    border-radius: 6px;
    margin-bottom: 0.75rem;
}

.skeleton-line.w-60 { width: 60%; }
.skeleton-line.w-40 { width: 40%; }
.skeleton-line.w-80 { width: 80%; }
.skeleton-line.w-full { width: 100%; }
.skeleton-line.h-lg { height: 20px; }
.skeleton-line.h-btn { height: 38px; border-radius: 10px; margin-top: 1rem; }

.skeleton-row {
    display: flex;
    gap: 1rem;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border, rgba(0,0,0,0.04));
}
.skeleton-row .skeleton-cell {
    height: 16px;
    border-radius: 4px;
    flex: 1;
}
.skeleton-row .skeleton-cell:first-child { flex: 0.3; }
.skeleton-row .skeleton-cell:last-child { flex: 0.5; }

/* Admin search + pagination bar */
.admin-toolbar {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 0.75rem;
    flex-wrap: wrap;
}
.admin-search-input {
    padding: 0.45rem 0.85rem;
    border: 1px solid var(--border, rgba(0,0,0,0.12));
    border-radius: 8px;
    background: var(--surface, #fff);
    color: var(--text-main, #1e293b);
    font-size: 0.85rem;
    outline: none;
    min-width: 220px;
    transition: border-color 0.2s;
}
.admin-search-input:focus {
    border-color: var(--primary, #ef4444);
}
.users-pagination {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-left: auto;
}

/* --- Page Loading Screen --- */
#loading-screen {
    position: fixed;
    inset: 0;
    z-index: 999999;
    background: var(--bg-color);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.4s ease, transform 0.4s ease;
}
#loading-screen.fade-out {
    opacity: 0;
    pointer-events: none;
    transform: scale(1.05);
}
.loader-container {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 400px;
    width: 90%;
    z-index: 2;
}
.loader-portal {
    position: relative;
    width: 140px;
    height: 140px;
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
}
.portal-ring {
    position: absolute;
    border-radius: 50%;
    border: 2px solid transparent;
}
.portal-ring.ring-outer {
    width: 140px;
    height: 140px;
    border-top-color: var(--primary);
    border-bottom-color: var(--primary);
    animation: portal-spin-clockwise 3s linear infinite;
    box-shadow: 0 0 15px var(--primary-light), inset 0 0 15px var(--primary-light);
}
.portal-ring.ring-middle {
    width: 110px;
    height: 110px;
    border-left-color: var(--primary);
    border-right-color: var(--primary);
    border-style: dashed;
    animation: portal-spin-counter 2s linear infinite;
}
.portal-ring.ring-inner {
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    color: var(--primary);
    text-shadow: 0 0 10px var(--primary-light);
    animation: portal-pulse 1.5s ease-in-out infinite;
}
.loader-title {
    font-family: 'Lexend', sans-serif;
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: 2px;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    animation: text-pulse 2s infinite;
}
.loader-subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    font-weight: 500;
}
.loader-progress-bar {
    width: 200px;
    height: 4px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--border);
}
body.theme-cyber .loader-progress-bar {
    background: rgba(255, 255, 255, 0.05);
}
.loader-progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--primary), var(--border));
    border-radius: 10px;
    animation: progress-fill-anim 2.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}
@keyframes portal-spin-clockwise {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
@keyframes portal-spin-counter {
    0% { transform: rotate(360deg); }
    100% { transform: rotate(0deg); }
}
@keyframes portal-pulse {
    0%, 100% { transform: scale(0.95); opacity: 0.8; }
    50% { transform: scale(1.05); opacity: 1; }
}
@keyframes text-pulse {
    0%, 100% { opacity: 0.8; }
    50% { opacity: 1; }
}
@keyframes progress-fill-anim {
    0% { width: 0%; }
    30% { width: 40%; }
    60% { width: 75%; }
    100% { width: 100%; }
}

/* ================= LEVEL UP THIÊN KIẾP ANIMATION ================= */
#level-up-modal {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: radial-gradient(circle at center, rgba(153, 27, 27, 0.3) 0%, rgba(5, 5, 5, 0.98) 75%);
    backdrop-filter: blur(15px); z-index: 999999;
    display: none; align-items: center; justify-content: center; flex-direction: column;
    opacity: 0; transition: opacity 0.5s ease-out;
}
#level-up-modal.active { display: flex; opacity: 1; }

#level-up-modal.active .shake-container {
    width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; flex-direction: column;
    animation: cameraShake 0.7s cubic-bezier(.36,.07,.19,.97) both;
}
@keyframes cameraShake {
    0%, 100% { transform: translate3d(0, 0, 0); }
    10%, 30%, 50%, 70%, 90% { transform: translate3d(-15px, 15px, 0); }
    20%, 40%, 60%, 80% { transform: translate3d(15px, -15px, 0); }
}

/* 1. Lôi Kiếp Huyết Sắc */
.lightning-bolt {
    position: absolute; top: 0; left: 50%; transform: translateX(-50%);
    width: 350px; height: 100%; z-index: 20; pointer-events: none; opacity: 0;
    filter: brightness(1.5);
}
#level-up-modal.active .lightning-bolt { animation: strikeLightning 0.6s ease-out forwards; }
@keyframes strikeLightning {
    0% { opacity: 0; transform: translateX(-50%) scaleY(0); }
    5% { opacity: 1; transform: translateX(-50%) scaleY(1); filter: brightness(3); }
    10% { opacity: 0; }
    15% { opacity: 1; filter: brightness(4); }
    20% { opacity: 0; }
    25% { opacity: 1; }
    100% { opacity: 0; transform: translateX(-50%) scaleY(1.1); filter: brightness(1.5); }
}

.flash-overlay {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: #ffffff; z-index: 15; pointer-events: none; opacity: 0;
    mix-blend-mode: overlay;
}
#level-up-modal.active .flash-overlay { animation: flashScreen 0.8s ease-out forwards; }
@keyframes flashScreen { 0% { opacity: 0.9; } 20% { opacity: 0.2; } 30% { opacity: 0.8; } 100% { opacity: 0; } }

/* Vùng bọc huy hiệu - Tâm điểm */
.badge-wrapper {
    position: relative; display: flex; align-items: center; justify-content: center;
    margin: 40px 0; z-index: 1; pointer-events: none;
}

/* 2. God Rays (Tia sáng chiếu rọi) */
.god-rays {
    position: absolute; top: 50%; left: 50%; width: 1200px; height: 1200px;
    transform: translate(-50%, -50%);
    background: repeating-conic-gradient(from 0deg, rgba(251, 191, 36, 0.15) 0deg 3deg, transparent 3deg 12deg);
    -webkit-mask-image: radial-gradient(circle, black 10%, transparent 60%);
    z-index: -2; opacity: 0; pointer-events: none;
}
#level-up-modal.active .god-rays {
    animation: rotateRays 40s linear infinite;
    transition: opacity 2s ease-in 1s; opacity: 1;
}
@keyframes rotateRays { 0% { transform: translate(-50%, -50%) rotate(0deg); } 100% { transform: translate(-50%, -50%) rotate(360deg); } }

/* 3. Aura Thái Cực & Trận Pháp */
.aura-bg {
    position: absolute; top: 50%; left: 50%; width: 550px; height: 550px;
    transform: translate(-50%, -50%); z-index: -1; opacity: 0; pointer-events: none;
    display: flex; align-items: center; justify-content: center;
    transition: opacity 1s ease-in 0.8s;
}
#level-up-modal.active .aura-bg { opacity: 1; }

.magic-circle {
    position: absolute; width: 100%; height: 100%; border: 2px solid rgba(251, 191, 36, 0.3); border-radius: 50%;
    box-shadow: 0 0 60px rgba(220, 38, 38, 0.5), inset 0 0 60px rgba(220, 38, 38, 0.5);
    animation: rotateMagicCircle 20s linear infinite;
    background: repeating-radial-gradient(circle, transparent 0, transparent 40px, rgba(220, 38, 38, 0.05) 40px, rgba(220, 38, 38, 0.05) 41px);
}
.magic-circle::before {
    content: ''; position: absolute; top: -30px; left: -30px; right: -30px; bottom: -30px;
    border: 4px dashed rgba(220, 38, 38, 0.4); border-radius: 50%;
    animation: rotateMagicCircle 15s linear infinite reverse;
}
.taiji {
    font-size: 350px; color: rgba(251, 191, 36, 0.1); animation: rotateTaiji 30s linear infinite reverse;
    text-shadow: 0 0 80px rgba(220, 38, 38, 0.6); line-height: 1;
}
@keyframes rotateMagicCircle { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
@keyframes rotateTaiji { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* 4. Shockwave (Sóng âm bùng nổ) */
.shockwave {
    position: absolute; top: 50%; left: 50%; width: 200px; height: 200px;
    transform: translate(-50%, -50%) scale(0);
    border: 10px solid rgba(251, 191, 36, 0.8); border-radius: 50%;
    box-shadow: 0 0 50px rgba(220, 38, 38, 1), inset 0 0 50px rgba(220, 38, 38, 1);
    pointer-events: none; z-index: 6; opacity: 0;
}
#level-up-modal.active .shockwave { animation: fireShockwave 0.8s cubic-bezier(0.1, 0.8, 0.2, 1) 1.5s forwards; }
@keyframes fireShockwave {
    0% { transform: translate(-50%, -50%) scale(0.5); opacity: 1; border-width: 30px; }
    100% { transform: translate(-50%, -50%) scale(6); opacity: 0; border-width: 1px; }
}

/* 5. Lens Flare (Tia sáng vắt ngang) */
.lens-flare {
    position: absolute; top: 50%; left: 50%; width: 800px; height: 4px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,1), transparent);
    transform: translate(-50%, -50%) scaleX(0);
    box-shadow: 0 0 30px rgba(255, 255, 255, 1), 0 0 60px #ef4444;
    z-index: 10; opacity: 0; pointer-events: none;
}
#level-up-modal.active .lens-flare { animation: flareFlash 0.6s cubic-bezier(0.1, 0.8, 0.2, 1) 1.5s forwards; }
@keyframes flareFlash {
    0% { transform: translate(-50%, -50%) scaleX(0); opacity: 1; height: 1px; }
    50% { transform: translate(-50%, -50%) scaleX(1); opacity: 1; height: 12px; }
    100% { transform: translate(-50%, -50%) scaleX(0); opacity: 0; height: 1px; }
}

/* Badge Image */
.level-up-badge {
    width: 250px; height: 250px; object-fit: contain; position: relative; z-index: 5;
    transform: scale(4) translateY(-150px); opacity: 0;
    filter: drop-shadow(0 0 50px rgba(220, 38, 38, 1));
    transition: all 0.7s cubic-bezier(0.4, 0, 0.2, 1) 0.8s; /* Rơi xuống */
}
#level-up-modal.active .level-up-badge {
    transform: scale(1) translateY(0); opacity: 1;
    animation: floatBadge 4s ease-in-out infinite 1.6s, pulseGlow 2s infinite 1.6s;
}
@keyframes floatBadge {
    0%, 100% { transform: translateY(0); filter: drop-shadow(0 0 40px rgba(251, 191, 36, 0.8)); }
    50% { transform: translateY(-20px); filter: drop-shadow(0 0 80px rgba(220, 38, 38, 1)); }
}
@keyframes pulseGlow {
    0%, 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.5); border-radius: 50%; }
    50% { box-shadow: 0 0 0 70px rgba(220, 38, 38, 0); border-radius: 50%; }
}

/* TEXTS */
.level-up-content { position: relative; z-index: 25; text-align: center; display: flex; flex-direction: column; align-items: center; }

.level-up-title {
    font-family: 'Lexend', sans-serif; font-size: 3rem; font-weight: 900; text-transform: uppercase;
    letter-spacing: 12px; margin: 0;
    background: linear-gradient(180deg, #ffffff 0%, #fcd34d 50%, #dc2626 100%);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 25px rgba(220, 38, 38, 0.9));
    transform: scale(0.8) translateY(-30px); opacity: 0;
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1) 0.4s;
}
@media (min-width: 768px) { .level-up-title { font-size: 5.5rem; letter-spacing: 15px; } }
#level-up-modal.active .level-up-title { transform: scale(1) translateY(0); opacity: 1; }

.level-up-rank {
    font-family: 'Lexend', sans-serif; font-size: 2.2rem; color: #fef3c7; font-weight: 800;
    text-shadow: 0 0 20px rgba(251, 191, 36, 0.8), 0 0 40px rgba(220, 38, 38, 0.8);
    margin: 0 0 15px 0; transform: translateY(40px); opacity: 0;
    transition: all 0.6s ease-out 1.2s;
}
#level-up-modal.active .level-up-rank { transform: translateY(0); opacity: 1; }

.level-up-desc {
    font-family: 'Be Vietnam Pro', sans-serif; color: #e2e8f0; font-size: 1.15rem; max-width: 500px;
    line-height: 1.6; margin-bottom: 45px; transform: translateY(30px); opacity: 0;
    transition: all 0.6s ease-out 1.4s; text-shadow: 0 2px 5px rgba(0,0,0,0.8);
}
#level-up-modal.active .level-up-desc { transform: translateY(0); opacity: 1; }

.continue-btn {
    font-family: 'Lexend', sans-serif; padding: 14px 45px; font-size: 1.2rem; font-weight: bold; text-transform: uppercase;
    background: linear-gradient(135deg, rgba(0,0,0,0.6), rgba(153, 27, 27, 0.4));
    color: #fbbf24; border: 2px solid #fbbf24; border-radius: 50px; cursor: pointer;
    box-shadow: 0 0 20px rgba(245, 158, 11, 0.3), inset 0 0 10px rgba(245, 158, 11, 0.2);
    opacity: 0; transform: translateY(20px);
    transition: all 0.6s ease-out 1.8s, background 0.3s, color 0.3s, transform 0.3s, box-shadow 0.3s;
    position: relative; overflow: hidden; pointer-events: auto; z-index: 50;
}
#level-up-modal.active .continue-btn { opacity: 1; transform: translateY(0); }
.continue-btn:hover {
    background: #fbbf24; color: #000; box-shadow: 0 0 40px rgba(245, 158, 11, 0.8); transform: scale(1.05);
}
.continue-btn::after {
    content: ''; position: absolute; top: -50%; left: -50%; width: 200%; height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255,255,255,0.3), transparent);
    transform: rotate(45deg) translateX(-100%); transition: transform 0.6s;
}
.continue-btn:hover::after { transform: rotate(45deg) translateX(100%); }

/* Cải tiến Particles (Hạt linh khí) */
.level-up-particle {
    position: absolute; bottom: -50px;
    border-radius: 50%; pointer-events: none; opacity: 0; z-index: 5;
    filter: blur(1px);
}
@keyframes sparkUpAdvanced {
    0% { transform: translateY(0) scale(1) translateX(0); opacity: 0; }
    10% { opacity: 1; }
    50% { opacity: 1; transform: translateY(-50vh) scale(1.5) translateX(20px); filter: blur(0px); }
    100% { transform: translateY(-110vh) scale(0.2) translateX(-20px); opacity: 0; filter: blur(2px); }
}

/* ======================== ADMIN TABLES ======================== */
.admin-table-container {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}
.admin-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.9rem;
}
.admin-table th {
    background: rgba(0,0,0,0.03);
    padding: 1rem;
    font-weight: 600;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
body.dark-mode .admin-table th {
    background: rgba(255,255,255,0.03);
}
.admin-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    color: var(--text-main);
    vertical-align: middle;
}
.admin-table tr:last-child td {
    border-bottom: none;
}
.admin-table tbody tr {
    transition: background-color 0.2s;
}
.admin-table tbody tr:hover {
    background: rgba(0,0,0,0.015);
}
body.dark-mode .admin-table tbody tr:hover {
    background: rgba(255,255,255,0.02);
}
/* Admin table specific utilities */
.admin-table td .status-badge {
    padding: 0.25rem 0.6rem;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-block;
}
.admin-table td .status-badge.active {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.2);
}
.admin-table td .status-badge.inactive {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

/* Custom Dropdown Overrides for Tailwind CDN */
.group:hover .group-hover\:opacity-100 { opacity: 1 !important; }
.group:hover .group-hover\:visible { visibility: visible !important; }
.group:hover .group-hover\:scale-100 { transform: scale(1) !important; }

/* Admin Sidebar Accordion Dropdown -> Converted to Absolute Float Dropdown */
.admin-sidebar-group { position: relative; cursor: pointer; display: flex; align-items: center; }
.admin-sidebar-group > a { display: flex !important; align-items: center; }
.admin-sidebar-menu {
    position: absolute; top: 100%; left: 50%; transform: translateX(-50%) scale(0.95);
    width: max-content; min-width: 200px; background: var(--btn-bg); border: 1px solid var(--border);
    border-radius: 0.75rem; box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    opacity: 0; visibility: hidden; transition: all 0.2s ease;
    display: flex; flex-direction: column; z-index: 9999; padding: 0.5rem 0; margin-top: 0.5rem;
}
.admin-sidebar-group:hover .admin-sidebar-menu {
    opacity: 1; visibility: visible; transform: translateX(-50%) scale(1);
}
.admin-sidebar-menu a {
    padding: 0.75rem 1.25rem !important; font-size: 0.875rem !important; gap: 0.75rem !important;
    color: var(--text-main) !important; justify-content: flex-start !important;
    background: transparent !important;
}
.admin-sidebar-menu a:hover {
    background: var(--primary, #3b82f6) !important; color: #fff !important;
}

/* Top Nav Admin Dropdown */
.nav-dropdown-container {
    position: relative;
    z-index: 9999;
}
.nav-dropdown-trigger {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    padding-right: 1rem;
    padding-top: 0.25rem;
    padding-bottom: 0.25rem;
    border-radius: 0.25rem;
    transition: background-color 0.2s;
    font-weight: bold;
}
.nav-dropdown-trigger:hover {
    background-color: rgba(255, 255, 255, 0.1);
}
.nav-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 0.5rem;
    width: 15rem;
    background: var(--btn-bg);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    opacity: 0;
    visibility: hidden;
    transform: scale(0.95);
    transform-origin: top left;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.nav-dropdown-container:hover .nav-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: scale(1);
}
.nav-dropdown-menu a {
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    transition: background-color 0.2s;
}
.nav-dropdown-menu a:hover {
    background-color: var(--primary, #3b82f6);
    color: #ffffff;
}
.nav-dropdown-menu a i {
    width: 1.25rem;
    text-align: center;
}

/* ============================================================
   MOBILE RESPONSIVE — Admin & Shared Components
   All rules are scoped to max-width: 768px.
   Desktop layout is NOT affected.
   ============================================================ */
@media (max-width: 768px) {

    /* --- ADMIN TABLES: horizontal scroll wrapper --- */
    .admin-table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        border-radius: 10px;
    }
    .admin-table {
        min-width: 600px;
        font-size: 0.82rem;
    }
    .admin-table th,
    .admin-table td {
        padding: 0.65rem 0.75rem;
        white-space: nowrap;
    }

    /* --- ADMIN TOOLBAR --- */
    .admin-toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }
    .admin-search-input {
        min-width: 0;
        width: 100%;
    }
    .users-pagination {
        margin-left: 0;
        justify-content: center;
    }

    /* --- NAV DROPDOWNS: touch friendly --- */
    .nav-dropdown-menu {
        width: 12rem;
    }
    .nav-dropdown-menu a {
        padding: 0.85rem 1rem;
        font-size: 0.82rem;
    }
    .admin-sidebar-menu {
        min-width: 160px;
    }
    .admin-sidebar-menu a {
        padding: 0.65rem 1rem !important;
        font-size: 0.82rem !important;
    }

    /* --- LEVEL UP MODAL: scale down on mobile --- */
    .level-up-badge {
        width: 180px !important;
        height: 180px !important;
    }
    .level-up-title {
        font-size: 2.2rem !important;
        letter-spacing: 6px !important;
    }
    .level-up-rank {
        font-size: 1.6rem !important;
    }
    .level-up-desc {
        font-size: 0.95rem !important;
        max-width: 300px !important;
        margin-bottom: 30px !important;
    }
    .continue-btn {
        padding: 10px 30px !important;
        font-size: 1rem !important;
    }
    .aura-bg {
        width: 350px !important;
        height: 350px !important;
    }
    .god-rays {
        width: 600px !important;
        height: 600px !important;
    }
}

/* ================== MOBILE NOTICE BANNER ================== */
#mobile-notice {
    position: fixed;
    bottom: -200px;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 2rem);
    max-width: 420px;
    background: var(--surface, rgba(255,255,255,0.97));
    border: 1px solid var(--border, rgba(185,28,28,0.2));
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.12);
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem 1rem 1rem 1.1rem;
    z-index: 99999;
    transition: bottom 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}
#mobile-notice.mn-show {
    bottom: 1rem;
}
.mn-icon {
    font-size: 1.6rem;
    line-height: 1;
    flex-shrink: 0;
    margin-top: 0.1rem;
}
.mn-body {
    flex: 1;
    min-width: 0;
}
.mn-title {
    font-family: 'Lexend', sans-serif;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-main, #333);
    margin-bottom: 0.25rem;
}
.mn-desc {
    font-size: 0.78rem;
    color: var(--text-muted, #777);
    line-height: 1.45;
}
.mn-close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted, #999);
    font-size: 1rem;
    padding: 0.1rem 0.25rem;
    flex-shrink: 0;
    line-height: 1;
    transition: color 0.2s;
}
.mn-close:hover {
    color: var(--primary, #b91c1c);
}

/* ─── NAME FRAMES (BẾ QUAN THẦN THỤ) ─── */
.name-frame-base {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 2px 8px;
    border-radius: 6px;
    font-weight: 800;
    line-height: 1.2;
    overflow: visible;
    white-space: nowrap;
}

/* 1. Hỏa Phượng (Red/Orange Flame) */
.name-frame-hoa_phuong {
    background: linear-gradient(90deg, #ef4444, #f59e0b, #ef4444);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: gradientShift 3s linear infinite;
    text-shadow: 0 0 10px rgba(239, 68, 68, 0.4);
}
.name-frame-hoa_phuong::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 6px;
    padding: 1.5px;
    background: linear-gradient(90deg, rgba(239, 68, 68, 0.8), rgba(245, 158, 11, 0.8), rgba(239, 68, 68, 0.8));
    background-size: 200% auto;
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    animation: gradientShift 3s linear infinite, glowPulse 2s ease-in-out infinite alternate;
}

/* 2. Ngọc Quang (Green Jade) */
.name-frame-jade {
    background: linear-gradient(90deg, #10b981, #34d399, #10b981);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: gradientShift 4s linear infinite;
    text-shadow: 0 0 8px rgba(16, 185, 129, 0.5);
}
.name-frame-jade::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 6px;
    border: 1.5px solid rgba(16, 185, 129, 0.7);
    box-shadow: inset 0 0 8px rgba(16, 185, 129, 0.2), 0 0 12px rgba(16, 185, 129, 0.4);
}
.name-frame-jade::after {
    content: '✧';
    position: absolute;
    top: -6px; right: -6px;
    color: #34d399;
    font-size: 12px;
    text-shadow: 0 0 5px #10b981;
    animation: floatAnim 2s ease-in-out infinite;
}

/* 3. Hư Không (Purple Void) */
.name-frame-void {
    background: linear-gradient(90deg, #8b5cf6, #d946ef, #8b5cf6);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: gradientShift 5s linear infinite;
    text-shadow: 0 0 15px rgba(139, 92, 246, 0.6);
}
.name-frame-void::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 8px;
    background: linear-gradient(90deg, rgba(139, 92, 246, 0.5), transparent, rgba(217, 70, 239, 0.5));
    background-size: 200% auto;
    z-index: -1;
    filter: blur(4px);
    animation: gradientShift 3s linear infinite;
}
.name-frame-void::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 6px;
    border: 1px dashed rgba(139, 92, 246, 0.8);
    animation: rotateDashed 10s linear infinite;
}

/* 4. Lôi Kiếp (Lightning Cyan) */
.name-frame-loi_kiep {
    color: #fff;
    text-shadow: 0 0 5px #06b6d4, 0 0 10px #06b6d4, 0 0 20px #06b6d4;
    animation: lightningFlicker 3s infinite;
}
.name-frame-loi_kiep::before {
    content: '';
    position: absolute;
    bottom: -2px; left: 0; width: 100%; height: 2px;
    background: #06b6d4;
    box-shadow: 0 0 10px #06b6d4, 0 0 20px #06b6d4;
    transform: scaleX(0);
    transform-origin: left;
    animation: lightningStrike 2s infinite;
}
.name-frame-loi_kiep::after {
    content: '⚡';
    position: absolute;
    left: -18px; top: 50%; transform: translateY(-50%);
    font-size: 14px;
    filter: drop-shadow(0 0 5px #06b6d4);
    animation: lightningFlicker 3s infinite;
}

/* 5. Tinh Không (Galaxy) */
.name-frame-tinh_khong {
    background: url("data:image/svg+xml,<svg width='100' height='100' xmlns='http://www.w3.org/2000/svg'><rect width='100%' height='100%' fill='%230f172a'/><circle cx='20' cy='20' r='1' fill='white'/><circle cx='70' cy='60' r='1.5' fill='%23a78bfa'/><circle cx='40' cy='80' r='1' fill='white'/><circle cx='80' cy='20' r='2' fill='%2338bdf8'/></svg>");
    color: #fff;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    position: relative;
}
.name-frame-tinh_khong::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 6px;
    padding: 2px;
    background: conic-gradient(from 0deg, #3b82f6, #8b5cf6, #ec4899, #3b82f6);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    animation: rotateConic 4s linear infinite;
}
.name-frame-tinh_khong::after {
    content: '✦';
    position: absolute;
    right: -15px; top: -5px;
    font-size: 14px;
    color: #8b5cf6;
    animation: twinkle 1.5s ease-in-out infinite alternate;
}

/* 6. Hoàng Kim Long (Golden Dragon) */
.name-frame-hoang_kim {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 25%, #fef3c7 50%, #f59e0b 75%, #fbbf24 100%);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: gradientShift 2.5s linear infinite;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.name-frame-hoang_kim::before {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 4px;
    border: 2px solid transparent;
    background: linear-gradient(135deg, #fbbf24, #fef3c7, #f59e0b, #fbbf24) border-box;
    -webkit-mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    animation: borderPulse 1.5s ease-in-out infinite alternate;
}
.name-frame-hoang_kim::after {
    content: '🐉';
    position: absolute;
    left: -22px; top: 50%; transform: translateY(-50%);
    font-size: 16px;
    filter: drop-shadow(0 0 5px #fbbf24);
}

/* 7. Băng Tôn (Ice/Snow) */
.name-frame-bang_ton {
    color: #e0f2fe;
    text-shadow: 0 0 5px #38bdf8, 0 0 10px #7dd3fc;
}
.name-frame-bang_ton::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 4px;
    border-bottom: 2px solid #7dd3fc;
    border-right: 2px solid #7dd3fc;
    box-shadow: 2px 2px 8px rgba(125, 211, 252, 0.5);
}
.name-frame-bang_ton::after {
    content: '❄️';
    position: absolute;
    right: -20px; top: 50%; transform: translateY(-50%);
    font-size: 14px;
    animation: floatAnim 3s ease-in-out infinite;
}

/* Animations */
@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    100% { background-position: 200% 50%; }
}
@keyframes glowPulse {
    0% { box-shadow: 0 0 5px rgba(239, 68, 68, 0.4), inset 0 0 5px rgba(239, 68, 68, 0.4); }
    100% { box-shadow: 0 0 15px rgba(245, 158, 11, 0.8), inset 0 0 10px rgba(245, 158, 11, 0.6); }
}
@keyframes floatAnim {
    0%, 100% { transform: translateY(-50%) translateY(0px); }
    50% { transform: translateY(-50%) translateY(-3px); }
}
@keyframes rotateDashed {
    100% { transform: rotate(360deg); }
}
@keyframes rotateConic {
    100% { transform: rotate(360deg); }
}
@keyframes lightningFlicker {
    0%, 100% { opacity: 1; }
    92% { opacity: 1; }
    93% { opacity: 0; }
    94% { opacity: 1; }
    96% { opacity: 0; }
    98% { opacity: 1; }
}
@keyframes lightningStrike {
    0% { transform: scaleX(0); opacity: 1; }
    10% { transform: scaleX(1); opacity: 1; }
    15% { transform: scaleX(1); opacity: 0; }
    100% { transform: scaleX(0); opacity: 0; }
}
@keyframes twinkle {
    0% { opacity: 0.3; transform: scale(0.8); }
    100% { opacity: 1; transform: scale(1.2); }
}
@keyframes borderPulse {
    0% { opacity: 0.6; filter: brightness(1); }
    100% { opacity: 1; filter: brightness(1.3); }
}
