/* ==========================================================================
   MHENT STUDY - UNIFIED CORE STYLESHEET
   Thiết kế chuẩn EdTech: Dễ học - Dễ nhìn - Rõ nét chữ CJK - Không phân tâm
   ========================================================================== */

/* 1. Global Box-Sizing & Layout Reset */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    max-width: 100%;
    overflow-x: hidden;
}

/* Custom Sleek Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: var(--study-bg);
}
::-webkit-scrollbar-thumb {
    background: var(--study-border);
    border-radius: var(--radius-pill);
}
::-webkit-scrollbar-thumb:hover {
    background: var(--theme-accent, #0ea5e9);
}

:root {
    --study-bg: #f8fafc;
    --study-surface: #ffffff;
    --study-subtle: #f1f5f9;
    --study-border: rgba(226, 232, 240, 0.9);
    --study-text: #0f172a;
    --study-text-muted: #64748b;

    /* Theme Accents cho 4 Ngôn Ngữ */
    --color-ko: #ec4899;
    --color-ja: #ef4444;
    --color-zh: #f59e0b;
    --color-en: #6366f1;

    --study-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
    --study-shadow-hover: 0 12px 32px rgba(0, 0, 0, 0.09);
    --radius-card: 20px;
    --radius-pill: 9999px;

    /* Tương thích ngược cho các thành phần UI */
    --bg-primary: var(--study-bg);
    --bg-surface: var(--study-surface);
    --bg-subtle: var(--study-subtle);
    --bg-glass: rgba(255, 255, 255, 0.85);
    --bg-glass-strong: rgba(255, 255, 255, 0.96);
    --border-color: var(--study-border);
    --border-glass: rgba(255, 255, 255, 0.6);
    --text-primary: var(--study-text);
    --text-secondary: var(--study-text-muted);
    --text-muted: var(--study-text-muted);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-full: 9999px;
    --transition-fast: 0.18s ease;
    --transition-normal: 0.28s cubic-bezier(0.16, 1, 0.3, 1);
    --accent-edu: #0ea5e9;
    --accent-edu-glow: rgba(14, 165, 233, 0.25);
    --accent-korea: #ec4899;
    --accent-japan: #ef4444;
    --accent-china: #f59e0b;
    --accent-english: #6366f1;
    --success: #10b981;
    --success-bg: rgba(16, 185, 129, 0.12);
    --error: #ef4444;
    --error-bg: rgba(239, 68, 68, 0.12);
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.12);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.08);
    --shadow-glass: 0 8px 32px rgba(14, 165, 233, 0.08);

    /* AISA Mascot Palette */
    --aisa-harmony: #f472b6;
    --aisa-harmony-glow: rgba(244, 114, 182, 0.35);
    --aisa-echo: #a855f7;
    --aisa-echo-glow: rgba(168, 85, 247, 0.35);
}

body.dark-mode {
    --study-bg: #0b0f19;
    --study-surface: #131b2e;
    --study-subtle: #1a243b;
    --study-border: rgba(255, 255, 255, 0.08);
    --study-text: #f8fafc;
    --study-text-muted: #94a3b8;

    --study-shadow: 0 4px 25px rgba(0, 0, 0, 0.4);
    --study-shadow-hover: 0 14px 40px rgba(0, 0, 0, 0.55);

    --bg-primary: var(--study-bg);
    --bg-surface: var(--study-surface);
    --bg-subtle: var(--study-subtle);
    --bg-glass: rgba(19, 27, 46, 0.85);
    --bg-glass-strong: rgba(19, 27, 46, 0.96);
    --border-color: var(--study-border);
    --border-glass: rgba(255, 255, 255, 0.08);
    --text-primary: var(--study-text);
    --text-secondary: var(--study-text-muted);
    --text-muted: var(--study-text-muted);
    --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.5);
    --shadow-glass: 0 10px 40px rgba(0, 0, 0, 0.6);
}

body {
    background-color: var(--study-bg);
    color: var(--study-text);
    font-family: 'Nunito', 'Noto Sans JP', 'Noto Sans KR', 'Noto Sans SC', system-ui, -apple-system, sans-serif;
    margin: 0;
    padding: 0;
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* ==========================================================================
   1. NAVBAR CHUYÊN DỤNG CHO HỌC TẬP (STUDY NAVBAR)
   ========================================================================== */
.study-nav {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: var(--study-surface);
    border-bottom: 1px solid var(--study-border);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    padding: 10px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.nav-brand-box {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: inherit;
    flex-shrink: 0;
}

.brand-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 2px solid var(--theme-accent, #0ea5e9);
    object-fit: cover;
}

.brand-title-wrap {
    display: flex;
    flex-direction: column;
}

.brand-main-title {
    font-size: 18px;
    font-weight: 900;
    letter-spacing: -0.02em;
    line-height: 1.1;
}

.brand-main-title span {
    color: var(--theme-accent, #0ea5e9);
}

.brand-sub-badge {
    font-size: 10px;
    font-weight: 800;
    color: var(--study-text-muted);
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

/* Language Nav Links */
.nav-study-links {
    display: flex;
    align-items: center;
    gap: 6px;
    overflow-x: auto;
    scrollbar-width: none;
}

.nav-study-links::-webkit-scrollbar {
    display: none;
}

.study-link {
    padding: 8px 14px;
    border-radius: var(--radius-pill);
    font-size: 14px;
    font-weight: 800;
    color: var(--study-text-muted);
    text-decoration: none;
    transition: 0.2s;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.study-link:hover {
    color: var(--study-text);
    background: var(--study-subtle);
}

.study-link.active {
    color: #fff;
    background: var(--theme-accent, #0ea5e9);
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.35);
}

/* Right Actions */
.nav-study-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.streak-pill-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: var(--radius-pill);
    background: rgba(249, 115, 22, 0.12);
    border: 1px solid rgba(249, 115, 22, 0.3);
    color: #f97316;
    font-weight: 800;
    font-size: 13.5px;
    transition: all 0.3s ease;
}

.streak-pill-btn.lit {
    background: linear-gradient(135deg, rgba(249, 115, 22, 0.22), rgba(239, 68, 68, 0.2));
    border-color: rgba(249, 115, 22, 0.6);
    box-shadow: 0 0 14px rgba(249, 115, 22, 0.35);
    animation: streakGlow 2.5s infinite alternate ease-in-out;
}
@keyframes streakGlow {
    0% { box-shadow: 0 0 8px rgba(249, 115, 22, 0.2); }
    100% { box-shadow: 0 0 16px rgba(249, 115, 22, 0.55); }
}

.theme-toggle-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--study-border);
    background: var(--study-subtle);
    color: var(--study-text);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: 0.2s;
}

.theme-toggle-btn:hover {
    transform: scale(1.08);
    border-color: var(--theme-accent, #0ea5e9);
}

.auth-btn-pill {
    padding: 7px 16px;
    border-radius: var(--radius-pill);
    background: var(--theme-accent, #0ea5e9);
    color: #fff !important;
    font-weight: 800;
    font-size: 13.5px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: none;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(14, 165, 233, 0.3);
    transition: 0.2s;
}

.auth-btn-pill:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

.user-chip {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 2px !important;
    background: transparent !important;
    border: none !important;
    cursor: pointer !important;
    border-radius: 50% !important;
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s ease !important;
}

.user-chip:hover {
    transform: scale(1.08) !important;
}

.user-chip img,
.user-chip #user-avatar {
    width: 32px !important;
    height: 32px !important;
    border-radius: 50% !important;
    object-fit: cover !important;
    border: 2px solid var(--theme-accent, #0ea5e9) !important;
    box-shadow: 0 0 10px rgba(14, 165, 233, 0.4) !important;
}

.user-chip #user-name,
.user-chip span:not(.chip-badge),
.user-chip .btn-logout-tiny {
    display: none !important;
}

/* ==========================================================================
   2. BREADCRUMB THANH ĐIỀU HƯỚNG BẬC THANG
   ========================================================================== */
.study-breadcrumb-bar {
    padding: 10px 24px;
    background: var(--study-subtle);
    border-bottom: 1px solid var(--study-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 13.5px;
    font-weight: 700;
}

.breadcrumb-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--study-text-muted);
}

.breadcrumb-nav a {
    color: var(--study-text-muted);
    text-decoration: none;
}

.breadcrumb-nav a:hover {
    color: var(--theme-accent, #0ea5e9);
}

.breadcrumb-nav .current {
    color: var(--study-text);
    font-weight: 800;
}

/* ==========================================================================
   3. GIAO DIỆN PHÒNG HỌC NGÔN NGỮ (STUDY HUBS & CARDS)
   ========================================================================== */
.study-wrapper {
    max-width: 1440px;
    width: min(95%, 1440px);
    margin: 0 auto;
    padding: 28px 0 54px 0;
}

/* Modern Hero Welcome Banner (Study 3.0) */
.study-hero-banner {
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.12) 0%, rgba(99, 102, 241, 0.08) 50%, var(--study-surface) 100%);
    border: 1px solid var(--study-border);
    border-radius: var(--radius-card);
    padding: 30px 34px;
    margin-bottom: 24px;
    box-shadow: var(--study-shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
    flex-wrap: wrap;
    position: relative;
    overflow: hidden;
}

.hero-main-content {
    flex: 1;
    min-width: 300px;
}

.hero-badge-pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 4px 12px;
    border-radius: var(--radius-pill);
    background: rgba(14, 165, 233, 0.15);
    color: var(--accent-edu);
    font-size: 11.5px;
    font-weight: 800;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
    border: 1px solid rgba(14, 165, 233, 0.3);
}

.hero-title {
    font-size: 27px;
    font-weight: 900;
    margin: 0 0 8px 0;
    color: var(--study-text);
    letter-spacing: -0.4px;
}

.hero-title span {
    background: linear-gradient(135deg, #0ea5e9, #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-desc {
    font-size: 14.5px;
    color: var(--study-text-muted);
    max-width: 700px;
    line-height: 1.5;
    margin: 0;
}

.hero-stats-panel {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.hero-stat-card {
    background: var(--study-subtle);
    border: 1px solid var(--study-border);
    border-radius: 16px;
    padding: 12px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.hero-stat-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.hero-stat-val {
    font-size: 16px;
    font-weight: 900;
    color: var(--study-text);
}

.hero-stat-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--study-text-muted);
}

/* 3 Featured Learning Hubs Grid */
.featured-hubs-grid {
    display: grid;
    grid-template-columns: 1.25fr 1fr 1fr;
    gap: 20px;
    margin-bottom: 28px;
}
@media (max-width: 1080px) {
    .featured-hubs-grid {
        grid-template-columns: 1fr;
    }
}

.featured-hub-card {
    background: var(--study-surface);
    border: 1px solid var(--study-border);
    border-radius: var(--radius-card);
    padding: 22px 24px;
    box-shadow: var(--study-shadow);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: all 0.25s ease;
    position: relative;
    overflow: hidden;
}

.featured-hub-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--study-shadow-hover);
    border-color: rgba(56, 189, 248, 0.4);
}

.featured-hub-card.lyrics {
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.12) 0%, rgba(139, 92, 246, 0.15) 100%), var(--study-surface);
    border-color: rgba(14, 165, 233, 0.35);
}

.featured-hub-header {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 12px;
}

.featured-hub-icon {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.featured-hub-title {
    font-size: 17px;
    font-weight: 900;
    color: var(--study-text);
    margin-bottom: 3px;
}

.featured-hub-desc {
    font-size: 13px;
    color: var(--study-text-muted);
    line-height: 1.45;
}

.featured-hub-footer {
    margin-top: 16px;
    display: flex;
    gap: 10px;
    align-items: center;
}

/* Header Chào người học (Legacy Support) */
.study-greeting-box {
    background: var(--study-surface);
    border: 1px solid var(--study-border);
    border-radius: var(--radius-card);
    padding: 24px 28px;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    box-shadow: var(--study-shadow);
}

.greeting-text h1 {
    font-size: 24px;
    font-weight: 900;
    margin: 0 0 6px 0;
}

.greeting-text p {
    font-size: 14.5px;
    color: var(--study-text-muted);
    margin: 0;
}

/* 4 Language Hub Cards */
.lang-hub-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 22px;
    margin-bottom: 30px;
}
@media (max-width: 1240px) {
    .lang-hub-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
@media (max-width: 680px) {
    .lang-hub-grid {
        grid-template-columns: 1fr;
    }
}

.lang-hub-card {
    background: var(--study-surface);
    border: 1px solid var(--study-border);
    border-radius: var(--radius-card);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    box-shadow: var(--study-shadow);
    transition: all 0.25s ease;
    position: relative;
    overflow: hidden;
}

.lang-hub-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--study-shadow-hover);
    border-color: var(--card-color);
}

.lang-hub-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: var(--card-color);
}

.lang-hub-card.ko { --card-color: var(--color-ko); }
.lang-hub-card.ja { --card-color: var(--color-ja); }
.lang-hub-card.zh { --card-color: var(--color-zh); }
.lang-hub-card.en { --card-color: var(--color-en); }

.card-top-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-flag-badge {
    font-size: 32px;
}

.card-status-badge {
    padding: 4px 10px;
    border-radius: var(--radius-pill);
    font-size: 12px;
    font-weight: 800;
    background: var(--study-subtle);
    color: var(--study-text-muted);
}

.card-lang-name {
    font-size: 20px;
    font-weight: 900;
    margin: 0;
    color: var(--study-text);
}

.card-lang-native {
    font-size: 14px;
    font-weight: 700;
    color: var(--card-color);
}

/* Quick Action Pills in Language Card */
.card-actions-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 6px;
}

.btn-quick-tool {
    padding: 9px 12px;
    border-radius: 12px;
    background: var(--study-subtle);
    border: 1px solid var(--study-border);
    color: var(--study-text);
    font-size: 13px;
    font-weight: 800;
    text-decoration: none;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: 0.2s;
}

.btn-quick-tool:hover {
    background: var(--card-color);
    color: #fff !important;
    border-color: var(--card-color);
    transform: translateY(-2px);
}

.btn-main-enter {
    grid-column: span 2;
    padding: 10px;
    border-radius: 14px;
    background: var(--card-color);
    color: #fff !important;
    font-size: 14px;
    font-weight: 900;
    text-align: center;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transition: 0.2s;
}

.btn-main-enter:hover {
    filter: brightness(1.1);
    transform: translateY(-2px);
}

/* CJK Font Scale - Cho chữ Hàn, Nhật, Trung to rõ nét */
.cjk-text {
    font-size: 22px;
    font-weight: 800;
    letter-spacing: 0.02em;
}

/* ==========================================================================
   LANGUAGE HUBS, TOOL GRIDS & PRACTICE ARENAS (STUDY 3.0)
   ========================================================================== */

/* Universal Language Hub Banner */
.hub-banner {
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.08), rgba(99, 102, 241, 0.06));
    border: 1px solid var(--study-border);
    border-radius: var(--radius-card);
    padding: 30px 34px;
    margin-bottom: 26px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 20px;
    box-shadow: var(--study-shadow);
    position: relative;
    overflow: hidden;
}

.hub-banner.ko {
    background: linear-gradient(135deg, rgba(236, 72, 153, 0.12), rgba(14, 165, 233, 0.08)), var(--study-surface);
    border-color: rgba(236, 72, 153, 0.3);
}

.hub-banner.ja {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.12), rgba(245, 158, 11, 0.08)), var(--study-surface);
    border-color: rgba(239, 68, 68, 0.3);
}

.hub-banner.zh {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.12), rgba(239, 68, 68, 0.08)), var(--study-surface);
    border-color: rgba(245, 158, 11, 0.3);
}

.hub-banner.en {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.12), rgba(14, 165, 233, 0.08)), var(--study-surface);
    border-color: rgba(99, 102, 241, 0.3);
}

/* Tool Grid - Responsive 3-columns on desktop, 2 on tablet, 1 on mobile */
.tool-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 22px;
    margin-bottom: 34px;
}
@media (max-width: 1080px) {
    .tool-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
@media (max-width: 640px) {
    .tool-grid {
        grid-template-columns: 1fr;
    }
}

.tool-box {
    background: var(--study-surface);
    border: 1px solid var(--study-border);
    border-radius: var(--radius-card);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    box-shadow: var(--study-shadow);
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    text-decoration: none;
    color: inherit;
    position: relative;
    overflow: hidden;
}

.tool-box:hover {
    transform: translateY(-4px);
    box-shadow: var(--study-shadow-hover);
    border-color: var(--accent-edu);
}

.tool-box.ko:hover { border-color: var(--color-ko); }
.tool-box.ja:hover { border-color: var(--color-ja); }
.tool-box.zh:hover { border-color: var(--color-zh); }
.tool-box.en:hover { border-color: var(--color-en); }

/* Practice Arena Grid & Mode Boxes */
.practice-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
    margin-top: 24px;
}
@media (max-width: 1100px) {
    .practice-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
@media (max-width: 640px) {
    .practice-grid {
        grid-template-columns: 1fr;
    }
}

.mode-box {
    background: var(--study-surface);
    border: 1px solid var(--study-border);
    border-radius: var(--radius-card);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    text-decoration: none;
    color: inherit;
    box-shadow: var(--study-shadow);
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.mode-box:hover {
    transform: translateY(-4px);
    box-shadow: var(--study-shadow-hover);
    border-color: var(--accent-edu);
}

.mode-box.ko:hover { border-color: var(--color-ko); }
.mode-box.ja:hover { border-color: var(--color-ja); }
.mode-box.zh:hover { border-color: var(--color-zh); }
.mode-box.en:hover { border-color: var(--color-en); }

.mode-icon {
    font-size: 36px;
    line-height: 1;
}

.mode-title {
    font-size: 17px;
    font-weight: 900;
    margin: 0;
    color: var(--study-text);
}

.mode-desc {
    font-size: 13.5px;
    color: var(--study-text-muted);
    margin: 0;
    line-height: 1.5;
}

.mode-action {
    margin-top: auto;
    font-weight: 800;
    font-size: 13.5px;
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--accent-edu);
}

/* Fluid Alphabet Layout */
.alphabet-container {
    max-width: 1440px;
    width: min(95%, 1440px);
    margin: 0 auto;
    padding: 28px 0 54px 0;
}

/* Fluid Shared Decks Vault Layout */
.shared-hero {
    max-width: 1200px;
    width: min(95%, 1200px);
    margin: 2rem auto;
    padding: 2.5rem;
    background: var(--study-surface);
    border: 1px solid var(--study-border);
    border-radius: var(--radius-card);
    box-shadow: var(--study-shadow);
    text-align: center;
}

.community-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

/* Footer gọn gàng (Legacy) */
.study-footer {
    padding: 30px 24px;
    border-top: 1px solid var(--study-border);
    text-align: center;
    font-size: 13px;
    color: var(--study-text-muted);
}

/* ==========================================================================
   MHENT STUDY MEGA FOOTER (PREMIER ECOSYSTEM DIRECTORY)
   ========================================================================== */
.study-mega-footer {
    background-color: var(--study-surface-glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid var(--study-border);
    padding: 48px 0 24px;
    width: 100%;
    margin-top: auto;
    position: relative;
    z-index: 10;
    text-align: left;
    color: var(--study-text-secondary);
}

.study-mega-footer .footer-container {
    max-width: 1440px;
    width: min(95%, 1440px);
    margin: 0 auto;
    padding: 0 16px;
}

.study-mega-footer .footer-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr 1fr 1fr;
    gap: 36px;
    margin-bottom: 36px;
}

.study-mega-footer .footer-brand-col {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.study-mega-footer .footer-brand-title {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--study-text-primary);
}

.study-mega-footer .footer-brand-logo {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 2px solid var(--study-primary);
    box-shadow: 0 0 12px rgba(99, 102, 241, 0.35);
}

.study-mega-footer .footer-brand-name {
    font-size: 1.15rem;
    font-weight: 900;
    letter-spacing: -0.2px;
    background: linear-gradient(135deg, #6366f1 0%, #ec4899 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.study-mega-footer .footer-brand-slogan {
    font-size: 0.85rem;
    color: var(--study-text-secondary);
    line-height: 1.6;
    margin: 0;
}

.study-mega-footer .footer-corp-meta {
    font-size: 0.78rem;
    color: var(--study-text-muted);
    line-height: 1.5;
}

.study-mega-footer .footer-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 5px 12px;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.25);
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    color: #10b981;
    width: fit-content;
}

.study-mega-footer .pulse-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #10b981;
    box-shadow: 0 0 8px #10b981;
    animation: statusPulse 2s infinite ease-in-out;
}

.study-mega-footer .footer-col-heading {
    font-size: 0.85rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--study-text-primary);
    margin: 0 0 16px 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.study-mega-footer .footer-links-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.study-mega-footer .footer-nav-link {
    text-decoration: none;
    color: var(--study-text-secondary);
    font-size: 0.84rem;
    font-weight: 600;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

.study-mega-footer .footer-nav-link:hover {
    color: var(--study-primary);
    transform: translateX(3px);
}

.study-mega-footer .footer-divider {
    height: 1px;
    background: var(--study-border);
    margin: 28px 0 20px 0;
}

.study-mega-footer .footer-bottom-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--study-text-muted);
    flex-wrap: wrap;
    gap: 12px;
}

.study-mega-footer .footer-social-strip {
    display: flex;
    align-items: center;
    gap: 16px;
}

.study-mega-footer .footer-social-strip a {
    color: var(--study-text-secondary);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 700;
    transition: 0.2s;
    cursor: pointer;
}

.study-mega-footer .footer-social-strip a:hover {
    color: var(--study-primary);
}

@media (max-width: 900px) {
    .study-mega-footer .footer-grid {
        grid-template-columns: 1fr 1fr;
        gap: 28px;
    }
    .study-mega-footer .footer-brand-col {
        grid-column: 1 / -1;
    }
}

@media (max-width: 580px) {
    .study-mega-footer .footer-grid {
        grid-template-columns: 1fr;
        gap: 24px;
    }
    .study-mega-footer .footer-bottom-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
}

/* ==========================================================================
   4. NÚT BẤM TIỆN ÍCH CHUẨN MHENT STUDY (BUTTON UTILITIES)
   ========================================================================== */
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.6rem 1.25rem;
    border-radius: var(--radius-pill);
    background: var(--theme-accent, #0ea5e9);
    color: #ffffff !important;
    font-weight: 800;
    font-size: 0.9rem;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(14, 165, 233, 0.3);
    transition: all var(--transition-fast);
    text-decoration: none;
    white-space: nowrap;
    user-select: none;
}

.btn-primary:hover {
    filter: brightness(1.1);
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(14, 165, 233, 0.45);
}

.btn-ghost {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.6rem 1.15rem;
    border-radius: var(--radius-pill);
    background: var(--study-subtle);
    border: 1px solid var(--study-border);
    color: var(--study-text);
    font-weight: 800;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
    white-space: nowrap;
    user-select: none;
}

.btn-ghost:hover {
    background: var(--study-border);
    color: var(--study-text);
    transform: translateY(-1px);
}

.btn-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--study-subtle);
    border: 1px solid var(--study-border);
    color: var(--study-text);
    font-size: 14px;
    font-weight: 800;
    cursor: pointer;
    transition: all var(--transition-fast);
    user-select: none;
    padding: 0;
}

.btn-icon:hover {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.3);
    transform: scale(1.05);
}

/* ==========================================================================
   5. HỆ THỐNG MODAL POPUP & OVERLAY (MODAL OVERLAY SYSTEM)
   ========================================================================== */
.mhent-overlay {
    position: fixed;
    inset: 0;
    background: rgba(3, 7, 18, 0.72);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.mhent-overlay.active {
    opacity: 1;
    pointer-events: auto;
    visibility: visible;
}

.mhent-modal {
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    background: var(--study-surface);
    border: 1px solid var(--study-border);
    border-radius: var(--radius-card);
    box-shadow: var(--study-shadow-hover);
    transform: translateY(20px) scale(0.96);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
}

.mhent-overlay.active .mhent-modal {
    transform: translateY(0) scale(1);
}

.modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--study-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    background: var(--study-surface);
}

.modal-header h3 {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--study-text);
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    color: var(--study-text);
}

.modal-footer {
    padding: 1rem 1.5rem;
    background: var(--study-subtle);
    border-top: 1px solid var(--study-border);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
}

/* Modal Form Controls */
.modal-label {
    display: block;
    font-size: 13px;
    font-weight: 800;
    color: var(--study-text);
    margin-bottom: 6px;
}

.modal-input,
.modal-select {
    width: 100%;
    padding: 10px 14px;
    border-radius: 12px;
    border: 1px solid var(--study-border);
    background: var(--study-subtle);
    color: var(--study-text);
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    outline: none;
    transition: all var(--transition-fast);
}

.modal-input:focus,
.modal-select:focus {
    border-color: var(--theme-accent, #0ea5e9);
    background: var(--study-surface);
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.25);
}

/* ==========================================================================
   6. HỆ THỐNG THÔNG BÁO TOAST (TOAST NOTIFICATIONS)
   ========================================================================== */
#study-toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
    max-width: 90vw;
}

.study-toast {
    pointer-events: auto;
    min-width: 280px;
    max-width: 420px;
    padding: 0.85rem 1.15rem;
    border-radius: var(--radius-md);
    background: var(--study-surface);
    border: 1px solid var(--study-border);
    box-shadow: var(--study-shadow-hover);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--study-text);
    animation: toastSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.study-toast.success { border-left: 4px solid var(--success); }
.study-toast.error { border-left: 4px solid var(--error); }
.study-toast.info { border-left: 4px solid var(--accent-edu); }

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

/* ==========================================================================
   AI DECK CREATOR & SMART VOCAB IMPORTER MODAL STYLES
   ========================================================================== */
.ai-creator-modal {
    max-width: 820px !important;
    width: 95% !important;
    max-height: 88vh !important;
    height: auto !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    border: 1px solid var(--study-border) !important;
    border-radius: var(--radius-card) !important;
    background: var(--study-surface) !important;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.45) !important;
}

.ai-modal-header {
    flex-shrink: 0 !important;
    padding: 1.15rem 1.5rem !important;
    border-bottom: 1px solid var(--study-border) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    background: var(--study-surface) !important;
}

.btn-modal-close {
    width: 36px !important;
    height: 36px !important;
    border-radius: 10px !important;
    background: var(--study-subtle) !important;
    border: 1px solid var(--study-border) !important;
    color: var(--study-text-muted) !important;
    font-size: 1.15rem !important;
    line-height: 1 !important;
    cursor: pointer !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: 0.2s !important;
    padding: 0 !important;
}

.btn-modal-close:hover {
    background: rgba(239, 68, 68, 0.15) !important;
    color: var(--error) !important;
    border-color: rgba(239, 68, 68, 0.3) !important;
}

.ai-modal-body {
    flex: 1 1 auto !important;
    min-height: 0 !important; /* CỰC KỲ QUAN TRỌNG: Cho phép flex cuộn chuẩn trên mọi màn hình */
    overflow-y: auto !important;
    padding: 1.25rem 1.5rem 1.5rem 1.5rem !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 1.15rem !important;
}

.ai-header-title-wrap {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.ai-header-icon {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.2), rgba(236, 72, 153, 0.2));
    border: 1px solid rgba(14, 165, 233, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}

.ai-header-sub {
    font-size: 0.82rem;
    color: var(--study-text-muted);
    margin: 2px 0 0 0;
}

.ai-deck-meta-card {
    background: var(--study-subtle);
    border: 1px solid var(--study-border);
    border-radius: var(--radius-md);
    padding: 1rem 1.15rem;
    margin-bottom: 0 !important;
    flex-shrink: 0 !important;
}

.ai-form-row {
    display: flex;
    gap: 12px;
}

@media (max-width: 640px) {
    .ai-form-row { flex-direction: column; }
}

.ai-label {
    font-size: 0.82rem;
    font-weight: 800;
    color: var(--study-text);
    margin-bottom: 0.4rem;
    display: block;
}

.ai-tabs-bar {
    display: flex !important;
    gap: 8px !important;
    background: var(--study-subtle) !important;
    padding: 5px !important;
    border-radius: 14px !important;
    border: 1px solid var(--study-border) !important;
    margin-bottom: 0 !important;
    min-height: 48px !important;
    flex-shrink: 0 !important; /* QUAN TRỌNG: Không bao giờ bị bóp dẹp */
    overflow-x: auto !important;
}

.ai-tab-btn {
    flex: 1 !important;
    flex-shrink: 0 !important;
    min-width: 140px !important;
    min-height: 38px !important;
    padding: 8px 14px !important;
    border-radius: 10px !important;
    border: none !important;
    background: transparent !important;
    color: var(--study-text-muted) !important;
    font-size: 0.88rem !important;
    font-weight: 800 !important;
    cursor: pointer !important;
    transition: all 0.2s !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    white-space: nowrap !important;
}

.ai-tab-btn:hover {
    color: var(--study-text) !important;
    background: rgba(255, 255, 255, 0.05) !important;
}

.ai-tab-btn.active {
    background: var(--study-surface) !important;
    color: var(--accent-edu) !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08) !important;
}

/* DROPZONE */
.ai-dropzone {
    border: 2px dashed var(--study-border) !important;
    border-radius: var(--radius-md) !important;
    background: var(--study-subtle) !important;
    padding: 1.6rem 1.25rem !important;
    text-align: center !important;
    cursor: pointer !important;
    transition: all 0.25s !important;
    position: relative !important;
    flex-shrink: 0 !important;
}

.ai-dropzone:hover, .ai-dropzone.drag-active {
    border-color: var(--accent-edu) !important;
    background: rgba(14, 165, 233, 0.05) !important;
}

.dropzone-icon {
    font-size: 2.4rem !important;
    margin-bottom: 0.35rem !important;
}

.dropzone-title {
    margin: 0 0 0.35rem 0 !important;
    font-size: 0.95rem !important;
    font-weight: 800 !important;
    color: var(--study-text) !important;
}

.dropzone-desc {
    margin: 0 !important;
    font-size: 0.8rem !important;
    color: var(--study-text-muted) !important;
}

.ai-preview-box {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.5rem;
    text-align: left;
}

.preview-img-wrap {
    width: 90px;
    height: 90px;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--study-border);
    flex-shrink: 0;
}

.preview-img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.preview-img-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.preview-filename {
    font-size: 0.92rem;
    font-weight: 800;
    color: var(--study-text);
    word-break: break-all;
}

.preview-filesize {
    font-size: 0.8rem;
    color: var(--study-text-muted);
}

.btn-remove-img {
    align-self: flex-start;
    padding: 4px 10px;
    font-size: 0.78rem;
    color: var(--error);
    border-color: rgba(239, 68, 68, 0.3);
    margin-top: 4px;
}

.ai-textarea {
    width: 100%;
    resize: vertical;
    min-height: 140px;
    line-height: 1.5;
    font-family: inherit;
    font-size: 0.92rem;
}

.ai-hint {
    font-size: 0.8rem;
    color: var(--study-text-muted);
    margin: 6px 0 0 0;
}

.ai-blank-info-box {
    text-align: center;
    padding: 2rem 1.5rem;
    background: var(--study-subtle);
    border-radius: var(--radius-md);
    border: 1px solid var(--study-border);
}

.ai-blank-info-box h4 {
    margin: 0 0 0.5rem 0;
    font-size: 1.1rem;
    color: var(--study-text);
}

.ai-blank-info-box p {
    margin: 0;
    font-size: 0.86rem;
    color: var(--study-text-muted);
}

.ai-action-bar {
    margin-top: 1rem !important;
    display: flex !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
    padding-bottom: 0.5rem !important;
}

.ai-run-btn {
    width: 100% !important;
    padding: 13px 24px !important;
    font-size: 0.96rem !important;
    font-weight: 800 !important;
    border-radius: var(--radius-pill) !important;
    box-shadow: 0 4px 14px rgba(14, 165, 233, 0.35) !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
}

/* LOADING STATE */
.ai-loading-box {
    text-align: center;
    padding: 3rem 1.5rem;
}

.ai-loading-avatars {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.bounce-harmony {
    animation: bounceAnim 1s ease-in-out infinite alternate;
}

.bounce-echo {
    animation: bounceAnim 1s ease-in-out 0.3s infinite alternate;
}

@keyframes bounceAnim {
    from { transform: translateY(0); }
    to { transform: translateY(-12px); }
}

.loading-sparkle {
    animation: spinSparkle 2s linear infinite;
    font-size: 1.8rem;
}

@keyframes spinSparkle {
    0% { transform: rotate(0deg) scale(0.9); }
    50% { transform: rotate(180deg) scale(1.2); }
    100% { transform: rotate(360deg) scale(0.9); }
}

.loading-title {
    margin: 0 0 0.4rem 0;
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--study-text);
}

.loading-desc {
    margin: 0 0 1.5rem 0;
    font-size: 0.86rem;
    color: var(--study-text-muted);
}

.ai-loading-bar-wrap {
    width: 260px;
    height: 6px;
    background: var(--study-border);
    border-radius: 999px;
    margin: 0 auto;
    overflow: hidden;
    position: relative;
}

.ai-loading-bar {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 40%;
    background: linear-gradient(90deg, #ec4899, #0ea5e9);
    border-radius: 999px;
    animation: loadingBarSlide 1.4s ease-in-out infinite;
}

@keyframes loadingBarSlide {
    0% { left: -40%; width: 40%; }
    50% { left: 30%; width: 60%; }
    100% { left: 100%; width: 40%; }
}

/* RESULTS PREVIEW */
.ai-results-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.ai-results-actions {
    display: flex;
    gap: 6px;
}

.btn-sm {
    padding: 5px 10px;
    font-size: 0.78rem;
    border-radius: 8px;
}

.ai-table-scroll {
    max-height: 380px;
    overflow-y: auto;
    border: 1px solid var(--study-border);
    border-radius: var(--radius-md);
    background: var(--study-subtle);
    margin-bottom: 1.25rem;
}

.ai-preview-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.86rem;
}

.ai-preview-table th {
    position: sticky;
    top: 0;
    background: var(--study-surface);
    padding: 10px 8px;
    font-weight: 800;
    color: var(--study-text-muted);
    border-bottom: 1px solid var(--study-border);
    text-align: left;
    z-index: 10;
}

.ai-preview-table td {
    padding: 6px 8px;
    border-bottom: 1px solid var(--study-border);
    vertical-align: middle;
}

.ai-table-input {
    width: 100%;
    padding: 6px 8px;
    border-radius: 8px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--study-text);
    font-size: 0.85rem;
    font-family: inherit;
    transition: 0.2s;
}

.ai-table-input:hover {
    border-color: var(--study-border);
    background: var(--study-surface);
}

.ai-table-input:focus {
    border-color: var(--accent-edu);
    background: var(--study-surface);
    outline: none;
}

.btn-del-row {
    background: transparent;
    border: none;
    color: var(--study-text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    border-radius: 6px;
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: 0.2s;
}

.btn-del-row:hover {
    background: rgba(239, 68, 68, 0.15);
    color: var(--error);
}

.ai-confirm-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding-top: 0.5rem;
}

.ai-key-accordion {
    margin-top: 1.5rem;
    border-top: 1px dashed var(--study-border);
    padding-top: 1rem;
}

.ai-key-accordion summary {
    font-size: 0.8rem;
    font-weight: 800;
    color: var(--study-text-muted);
    cursor: pointer;
    user-select: none;
}

.ai-key-form {
    padding-top: 0.75rem;
}

/* DECK SELECTOR BAR (For Vocab Sheet) */
.deck-selector-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    background: var(--study-surface);
    border: 1px solid var(--study-border);
    border-radius: var(--radius-card);
    padding: 0.85rem 1.25rem;
    margin-bottom: 1.25rem;
    box-shadow: var(--study-shadow);
    flex-wrap: wrap;
}

.deck-info-wrap {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    flex: 1;
    min-width: 260px;
}

.deck-icon {
    font-size: 1.6rem;
}

.deck-title-box {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
}

.deck-label {
    font-size: 0.75rem;
    font-weight: 800;
    color: var(--study-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.deck-select-dropdown {
    padding: 0.45rem 0.85rem;
    border-radius: 10px;
    border: 1.5px solid var(--study-border);
    background: var(--study-subtle);
    color: var(--study-text);
    font-size: 0.95rem;
    font-weight: 800;
    font-family: inherit;
    cursor: pointer;
    outline: none;
    transition: 0.2s;
    max-width: 460px;
}

.deck-select-dropdown:hover, .deck-select-dropdown:focus {
    border-color: var(--accent-edu);
}

.deck-actions-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.btn-deck-action {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0.55rem 1rem;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 800;
    border: 1px solid var(--study-border);
    background: var(--study-subtle);
    color: var(--study-text);
    cursor: pointer;
    transition: 0.2s;
}

.btn-deck-action:hover {
    border-color: var(--accent-edu);
    color: var(--accent-edu);
    background: rgba(14, 165, 233, 0.08);
}

/* AI RECOGNITION VERIFY CARD & SMART COMPANION FEEDBACK */
.ai-verify-card {
    display: flex;
    align-items: flex-start;
    gap: 1.15rem;
    background: linear-gradient(135deg, rgba(236, 72, 153, 0.08), rgba(14, 165, 233, 0.08));
    border: 1.5px solid rgba(236, 72, 153, 0.3);
    border-radius: var(--radius-card);
    padding: 1.15rem 1.35rem;
    margin-bottom: 1.25rem;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.04);
}

.ai-verify-mascot {
    font-size: 2.2rem;
    background: var(--study-surface);
    width: 52px;
    height: 52px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(236, 72, 153, 0.2);
    border: 2px solid rgba(236, 72, 153, 0.3);
    flex-shrink: 0;
    animation: gentle-bob 3s ease-in-out infinite;
}

@keyframes gentle-bob {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}

.ai-verify-content {
    flex: 1;
}

.ai-verify-badge {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #ec4899;
    background: rgba(236, 72, 153, 0.12);
    padding: 2px 8px;
    border-radius: 6px;
    margin-bottom: 4px;
}

.ai-verify-title {
    margin: 0;
    font-size: 1.08rem;
    font-weight: 800;
    color: var(--study-text);
}

.ai-verify-desc {
    margin: 4px 0 10px 0;
    font-size: 0.86rem;
    color: var(--study-text-muted);
    line-height: 1.45;
}

.ai-verify-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.btn-verify-opt {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0.55rem 1.15rem;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 800;
    font-family: inherit;
    cursor: pointer;
    border: none;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.btn-verify-yes {
    background: linear-gradient(135deg, #10b981, #059669);
    color: #ffffff;
}

.btn-verify-yes:hover {
    filter: brightness(1.1);
    transform: translateY(-2px);
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35);
}

.btn-verify-edit {
    background: linear-gradient(135deg, #3b82f6, #6366f1);
    color: #ffffff;
}

.btn-verify-edit:hover {
    filter: brightness(1.1);
    transform: translateY(-2px);
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
}

.ai-verify-status-msg {
    margin-top: 10px;
    padding: 8px 12px;
    border-radius: 8px;
    background: var(--study-surface);
    border: 1px dashed var(--study-border);
    font-size: 0.82rem;
    color: var(--study-text);
    line-height: 1.4;
    animation: fadeIn 0.3s ease;
}

/* SMART INPUT WITH ACTIONS (AUTO-GEN SENTENCE) */
.ai-input-with-action {
    display: flex;
    align-items: center;
    position: relative;
    width: 100%;
}

.ai-input-with-action .ai-table-input {
    padding-right: 32px;
}

.btn-ai-sparkle {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    font-size: 0.95rem;
    cursor: pointer;
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    color: #ec4899;
    transition: 0.2s;
    padding: 0;
}

.btn-ai-sparkle:hover {
    background: rgba(236, 72, 153, 0.15);
    transform: translateY(-50%) scale(1.15);
}

.ai-table-input.ai-generating {
    background: linear-gradient(90deg, rgba(236, 72, 153, 0.08) 0%, rgba(14, 165, 233, 0.15) 50%, rgba(236, 72, 153, 0.08) 100%);
    background-size: 200% 100%;
    animation: shimmer-input 1.5s infinite;
    border-color: #ec4899 !important;
}

@keyframes shimmer-input {
    0% { background-position: 100% 0; }
    100% { background-position: -100% 0; }
}

.ai-autogen-hint {
    font-size: 0.78rem;
    color: var(--study-text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
}

.ai-autogen-hint i {
    color: #ec4899;
}

/* ==========================================================================
   OFFLINE STUDY & CLOUD SYNC SYSTEM STYLES
   ========================================================================== */

/* 1. Offline Download Button in Deck Bar */
.btn-offline-download {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 0.48rem 0.95rem;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    background: rgba(14, 165, 233, 0.08);
    color: #0ea5e9;
    border: 1.5px solid rgba(14, 165, 233, 0.35);
}

.btn-offline-download:hover {
    background: rgba(14, 165, 233, 0.18);
    border-color: #0ea5e9;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.2);
}

.btn-offline-download.is-downloaded {
    background: rgba(16, 185, 129, 0.12);
    color: #10b981;
    border-color: rgba(16, 185, 129, 0.45);
}

.btn-offline-download.is-downloaded:hover {
    background: rgba(16, 185, 129, 0.22);
    border-color: #10b981;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.2);
}

.btn-offline-download.is-loading {
    opacity: 0.75;
    pointer-events: none;
}

.offline-pulse-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10b981;
    box-shadow: 0 0 8px #10b981;
    display: inline-block;
    animation: offline-pulse 1.8s infinite;
}

@keyframes offline-pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.35); opacity: 0.65; }
}

/* 2. Floating Network Connection Indicator */
.offline-network-pill {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    z-index: 99999;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 22px;
    border-radius: 50px;
    font-size: 0.88rem;
    font-weight: 800;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(16px);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s;
    opacity: 0;
    pointer-events: none;
}

.offline-network-pill.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
    pointer-events: auto;
}

.offline-network-pill.status-offline {
    background: rgba(245, 158, 11, 0.95);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.25);
}

.offline-network-pill.status-online {
    background: rgba(16, 185, 129, 0.95);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.25);
}

/* 3. Offline Vault Modal */
.offline-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(7, 11, 19, 0.75);
    backdrop-filter: blur(8px);
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    opacity: 0;
    visibility: hidden;
    transition: all 0.25s ease;
}

.offline-modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.offline-modal-card {
    width: 100%;
    max-width: 620px;
    background: var(--study-surface);
    border: 1px solid var(--study-border);
    border-radius: 20px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    transform: scale(0.95);
    transition: transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    flex-direction: column;
    max-height: 90vh;
}

.offline-modal-overlay.show .offline-modal-card {
    transform: scale(1);
}

.offline-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--study-border);
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.08), rgba(16, 185, 129, 0.05));
}

.offline-modal-title {
    font-size: 1.15rem;
    font-weight: 900;
    color: var(--study-text);
    display: flex;
    align-items: center;
    gap: 9px;
}

.offline-modal-close {
    background: transparent;
    border: none;
    font-size: 1.25rem;
    color: var(--study-text-muted);
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: 0.2s;
}

.offline-modal-close:hover {
    background: var(--study-subtle);
    color: var(--study-text);
}

.offline-modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.offline-stat-bar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 10px;
    background: var(--study-subtle);
    padding: 1rem;
    border-radius: 14px;
    border: 1px solid var(--study-border);
}

.offline-stat-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.offline-stat-item .label {
    font-size: 0.75rem;
    font-weight: 800;
    color: var(--study-text-muted);
    text-transform: uppercase;
}

.offline-stat-item .val {
    font-size: 1.1rem;
    font-weight: 900;
    color: var(--study-text);
}

.offline-decks-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.offline-deck-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 0.9rem 1.1rem;
    border-radius: 12px;
    background: var(--study-surface);
    border: 1.5px solid var(--study-border);
    transition: 0.2s;
}

.offline-deck-item:hover {
    border-color: rgba(14, 165, 233, 0.4);
    background: var(--study-subtle);
}

.offline-deck-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.offline-deck-title {
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--study-text);
}

.offline-deck-meta {
    font-size: 0.8rem;
    color: var(--study-text-muted);
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.offline-deck-actions {
    display: flex;
    gap: 6px;
    align-items: center;
}

.btn-offline-action-sm {
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 800;
    cursor: pointer;
    border: 1px solid var(--study-border);
    background: var(--study-subtle);
    color: var(--study-text);
    transition: 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.btn-offline-action-sm:hover {
    background: var(--study-surface);
    border-color: #0ea5e9;
    color: #0ea5e9;
}

.btn-offline-action-sm.danger:hover {
    border-color: #ef4444;
    color: #ef4444;
}

.offline-modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--study-border);
    background: var(--study-subtle);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

/* ==========================================================================
   MOBILE TOP NAVBAR RESPONSIVENESS FALLBACK
   ========================================================================== */
@media screen and (max-width: 768px) {
    .study-nav {
        padding: max(6px, env(safe-area-inset-top, 6px)) 10px 6px 10px !important;
        gap: 8px !important;
        overflow: hidden !important;
    }
    .study-nav .btn-open-aisa-dict kbd {
        display: none !important;
    }
    .study-nav .btn-open-aisa-dict {
        padding: 4px 8px !important;
        font-size: 11.5px !important;
        height: 28px !important;
    }
}

@media screen and (max-width: 520px) {
    .study-nav .btn-open-aisa-dict span {
        display: none !important;
    }
    .study-nav .btn-open-aisa-dict {
        width: 30px !important;
        height: 30px !important;
        min-width: 30px !important;
        padding: 0 !important;
        justify-content: center !important;
        border-radius: 50% !important;
    }
}





/* ==========================================================================
   NATIVE APP RUNTIME STYLING (ELECTRON DESKTOP & PWA STANDALONE)
   ========================================================================== */

/* 1. Custom Frameless Desktop Titlebar (Discord/MHEnt. Link Style) */
.mhent-desktop-titlebar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 38px;
    background: #070b13;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 10000;
    user-select: none;
    -webkit-user-select: none;
    font-family: 'Nunito', sans-serif;
}

body.is-desktop-app {
    padding-top: 38px !important;
}

body.is-desktop-app .study-nav {
    top: 38px !important;
}

.titlebar-drag-region {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex: 1;
    height: 100%;
    -webkit-app-region: drag;
    padding-left: 14px;
    padding-right: 14px;
    cursor: default;
}

.titlebar-left {
    display: flex;
    align-items: center;
    gap: 9px;
}

.titlebar-logo {
    width: 20px;
    height: 20px;
    border-radius: 6px;
    object-fit: contain;
}

.titlebar-title {
    font-size: 12.5px;
    font-weight: 800;
    letter-spacing: 0.3px;
    color: #e2e8f0;
}

.titlebar-tag {
    font-size: 10px;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: var(--radius-pill);
    background: rgba(56, 189, 248, 0.12);
    color: #38bdf8;
    border: 1px solid rgba(56, 189, 248, 0.25);
}

.titlebar-center {
    display: flex;
    align-items: center;
    gap: 12px;
}

.titlebar-pill {
    font-size: 11px;
    font-weight: 800;
    padding: 3px 10px;
    border-radius: var(--radius-pill);
    background: rgba(88, 101, 242, 0.12);
    border: 1px solid rgba(88, 101, 242, 0.25);
    color: #818cf8;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.titlebar-window-controls {
    display: flex;
    align-items: center;
    height: 100%;
    -webkit-app-region: no-drag;
}

.win-btn {
    width: 46px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: #94a3b8;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.15s ease;
    outline: none;
}

.win-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
}

.win-btn.win-close:hover {
    background: #ef4444;
    color: #ffffff;
}

/* 2. Native App Status Bar / Dock (Replaces Marketing Website Mega Footer) */
body.is-app-mode .study-mega-footer {
    display: none !important;
}

body.is-app-mode {
    padding-bottom: 30px !important;
    user-select: none;
    -webkit-user-select: none;
    overscroll-behavior-y: none;
}

body.is-app-mode input,
body.is-app-mode textarea,
body.is-app-mode [contenteditable="true"] {
    user-select: text;
    -webkit-user-select: text;
}

.mhent-app-status-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 28px;
    background: #070b13;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    font-size: 11px;
    font-weight: 700;
    color: #94a3b8;
    z-index: 9999;
    user-select: none;
    -webkit-user-select: none;
    font-family: 'Nunito', sans-serif;
}

.status-bar-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #10b981;
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.6);
}

.status-badge-offline {
    padding: 1px 6px;
    border-radius: 4px;
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
    font-size: 9.5px;
    font-weight: 800;
}

.status-bar-center {
    font-size: 11px;
    color: #cbd5e1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 50%;
}

.status-bar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.status-discord-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: #818cf8;
}

.btn-pwa-pill {
    background: linear-gradient(135deg, #0ea5e9, #6366f1) !important;
    color: #fff !important;
    border: none !important;
    animation: pulseGlow 2s infinite alternate;
}

@keyframes pulseGlow {
    from { box-shadow: 0 0 8px rgba(14, 165, 233, 0.3); }
    to { box-shadow: 0 0 16px rgba(99, 102, 241, 0.6); }
}
