/* ==========================================================================
   FLIPVOCAB ANKI CHAT — MODERN THEME (LIGHT & DARK MODE)
   Tối ưu giao diện Chat đồng bộ 100% với Web App
   Khắc phục triệt để: Nền xám bẩn, lỗi font chữ, viền Hextech cũ
   ========================================================================== */

/* --------------------------------------------------------------------------
   0. PHÔNG CHỮ CHUẨN ĐỒNG BỘ TOÀN BỘ (BE VIETNAM PRO / INTER)
   -------------------------------------------------------------------------- */
#chat-modal,
#chat-modal *,
#chat-modal button,
#chat-modal input,
#chat-modal textarea,
#chat-modal select {
    font-family: 'Be Vietnam Pro', 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Bảo toàn font icon FontAwesome cho icon vương miện & hệ thống */
#chat-modal i.fa-solid,
#chat-modal i.fa-solid::before,
#chat-modal i.fas,
#chat-modal i.fas::before,
#chat-modal i.far,
#chat-modal i.far::before,
#chat-modal i.fab,
#chat-modal i.fab::before,
#chat-modal i.fa,
#chat-modal i.fa::before,
#chat-modal .vip-ui-crown,
#chat-modal [class*="fa-"],
#chat-modal [class*="fa-"]::before {
    font-family: "Font Awesome 6 Free", "FontAwesome" !important;
    font-style: normal !important;
    font-weight: 900 !important;
}

/* --------------------------------------------------------------------------
   VIP BADGE & VIP CROWN (ĐỒNG BỘ CHUẨN XÁC VỚI HUD ẢNH 2)
   -------------------------------------------------------------------------- */
#chat-modal .vip-ui-badge,
#ladder-modal .vip-ui-badge,
.ladder-modal .vip-ui-badge,
.ladder-row .vip-ui-badge {
    display: inline-flex !important;
    align-items: center !important;
    gap: 2px !important;
    vertical-align: middle !important;
    margin-left: 3px !important;
    line-height: 1 !important;
    flex-shrink: 0 !important;
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    box-shadow: none !important;
    text-shadow: none !important;
}

#chat-modal .vip-ui-crown,
#ladder-modal .vip-ui-crown,
.ladder-modal .vip-ui-crown,
.ladder-row .vip-ui-crown {
    display: inline-block !important;
    vertical-align: middle !important;
    width: 14px !important;
    height: 12px !important;
    line-height: 1 !important;
    flex-shrink: 0 !important;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 576 512'%3E%3Cpath fill='%23000' d='M309 106c11.4-7 19-19.7 19-34c0-22.1-17.9-40-40-40s-40 17.9-40 40c0 14.4 7.6 27 19 34L209.7 220.6 96.5 137.8c7.5-6.8 12.2-16.6 12.2-27.4c0-20.3-16.5-36.8-36.8-36.8S35.2 90.1 35.2 110.4c0 12.8 6.5 24 16.4 30.6L76.1 329.4c3.4 17.1 18.4 29.5 35.8 29.5l352.2 0c17.5 0 32.4-12.4 35.8-29.5l24.5-188.4c9.9-6.6 16.4-17.8 16.4-30.6c0-20.3-16.5-36.8-36.8-36.8s-36.8 16.5-36.8 36.8c0 10.9 4.7 20.6 12.2 27.4L402.3 220.6 345 106h-36zM91.7 416c-15.3 0-27.7 12.4-27.7 27.7c0 15.3 12.4 27.7 27.7 27.7l392.7 0c15.3 0 27.7-12.4 27.7-27.7c0-15.3-12.4-27.7-27.7-27.7L91.7 416z'/%3E%3C/svg%3E") no-repeat center / contain !important;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 576 512'%3E%3Cpath fill='%23000' d='M309 106c11.4-7 19-19.7 19-34c0-22.1-17.9-40-40-40s-40 17.9-40 40c0 14.4 7.6 27 19 34L209.7 220.6 96.5 137.8c7.5-6.8 12.2-16.6 12.2-27.4c0-20.3-16.5-36.8-36.8-36.8S35.2 90.1 35.2 110.4c0 12.8 6.5 24 16.4 30.6L76.1 329.4c3.4 17.1 18.4 29.5 35.8 29.5l352.2 0c17.5 0 32.4-12.4 35.8-29.5l24.5-188.4c9.9-6.6 16.4-17.8 16.4-30.6c0-20.3-16.5-36.8-36.8-36.8s-36.8 16.5-36.8 36.8c0 10.9 4.7 20.6 12.2 27.4L402.3 220.6 345 106h-36zM91.7 416c-15.3 0-27.7 12.4-27.7 27.7c0 15.3 12.4 27.7 27.7 27.7l392.7 0c15.3 0 27.7-12.4 27.7-27.7c0-15.3-12.4-27.7-27.7-27.7L91.7 416z'/%3E%3C/svg%3E") no-repeat center / contain !important;
}
#chat-modal .vip-ui-crown::before,
#ladder-modal .vip-ui-crown::before,
.ladder-modal .vip-ui-crown::before,
.ladder-row .vip-ui-crown::before {
    content: "" !important;
    display: none !important;
}

/* VIP Thường: Vương miện Hoàng Kim rực rỡ (Đồng bộ Ảnh 2) */
#chat-modal .vip-ui-crown:not(.vip-ui-crown-lifetime),
#ladder-modal .vip-ui-crown:not(.vip-ui-crown-lifetime),
.ladder-modal .vip-ui-crown:not(.vip-ui-crown-lifetime),
.ladder-row .vip-ui-crown:not(.vip-ui-crown-lifetime) {
    background: linear-gradient(135deg, #ffe066 0%, #f59e0b 50%, #d97706 100%) !important;
    background-color: #f59e0b !important;
    filter: drop-shadow(0 0 3px rgba(245, 158, 11, 0.75)) !important;
    text-shadow: none !important;
    -webkit-text-fill-color: unset !important;
}

#chat-modal .vip-ui-badge .vip-ui-days,
#ladder-modal .vip-ui-badge .vip-ui-days,
.ladder-modal .vip-ui-badge .vip-ui-days,
.ladder-row .vip-ui-badge .vip-ui-days {
    color: #fbbf24 !important;
    font-size: 10px !important;
    font-weight: 800 !important;
    margin-left: 1px !important;
    line-height: 1 !important;
    -webkit-text-fill-color: currentColor !important;
}

/* VIP Vĩnh Viễn / Trọn Đời: Vương miện Xanh Sapphire Quý Tộc Gradient */
#chat-modal .vip-ui-crown.vip-ui-crown-lifetime,
#chat-modal .vip-ui-badge-lifetime .vip-ui-crown,
#ladder-modal .vip-ui-crown.vip-ui-crown-lifetime,
#ladder-modal .vip-ui-badge-lifetime .vip-ui-crown,
.ladder-modal .vip-ui-crown.vip-ui-crown-lifetime,
.ladder-modal .vip-ui-badge-lifetime .vip-ui-crown,
.ladder-row .vip-ui-crown.vip-ui-crown-lifetime,
.ladder-row .vip-ui-badge-lifetime .vip-ui-crown {
    background: linear-gradient(135deg, #7dd3fc 0%, #38bdf8 35%, #2563eb 80%, #1d4ed8 100%) !important;
    background-color: #38bdf8 !important;
    filter: drop-shadow(0 0 3px rgba(56, 189, 248, 0.75)) !important;
    text-shadow: none !important;
    -webkit-text-fill-color: unset !important;
}

#chat-modal .vip-ui-badge.vip-ui-badge-lifetime,
#ladder-modal .vip-ui-badge.vip-ui-badge-lifetime,
.ladder-modal .vip-ui-badge.vip-ui-badge-lifetime,
.ladder-row .vip-ui-badge.vip-ui-badge-lifetime {
    color: #38bdf8 !important;
    text-shadow: none !important;
    filter: none !important;
}

/* --------------------------------------------------------------------------
   1. KHUNG CHÍNH (CHAT MODAL CONTAINER)
   -------------------------------------------------------------------------- */
html #chat-modal {
    border-radius: 20px !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
    transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease !important;
    backdrop-filter: blur(24px) !important;
    -webkit-backdrop-filter: blur(24px) !important;
}

/* Light Mode: Sạch sẽ, trắng sáng tinh khôi, viền mềm mại, đồng bộ web */
html:not(.dark) #chat-modal {
    background: rgba(255, 255, 255, 0.98) !important;
    border: 1px solid rgba(226, 232, 240, 0.95) !important;
    box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.18), 0 0 0 1px rgba(15, 23, 42, 0.05) !important;
    color: #0f172a !important;
}

/* Dark Mode: Midnight Slate sang trọng, huyền bí, đồng bộ web tối */
html.dark #chat-modal {
    background: rgba(15, 23, 42, 0.96) !important;
    border: 1px solid rgba(51, 65, 85, 0.85) !important;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.75), 0 0 0 1px rgba(255, 255, 255, 0.08) !important;
    color: #f8fafc !important;
}

/* --------------------------------------------------------------------------
   2. THANH TIÊU ĐỀ (HEADER)
   -------------------------------------------------------------------------- */
html:not(.dark) #chat-modal .chat-header {
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%) !important;
    border-bottom: 1px solid #e2e8f0 !important;
    padding: 10px 14px !important;
}

html.dark #chat-modal .chat-header {
    background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%) !important;
    border-bottom: 1px solid rgba(51, 65, 85, 0.7) !important;
    padding: 10px 14px !important;
}

html:not(.dark) #chat-modal .chat-header-title {
    color: #0f172a !important;
    font-size: 13px !important;
    font-weight: 800 !important;
    letter-spacing: 0.02em !important;
    text-transform: none !important;
}

html.dark #chat-modal .chat-header-title {
    color: #f8fafc !important;
    font-size: 13px !important;
    font-weight: 800 !important;
    letter-spacing: 0.02em !important;
    text-transform: none !important;
}

html:not(.dark) #chat-modal .close-chat-btn {
    color: #64748b !important;
    background: transparent !important;
    border-radius: 8px !important;
    font-size: 15px !important;
}
html:not(.dark) #chat-modal .close-chat-btn:hover {
    background: #f1f5f9 !important;
    color: #0f172a !important;
}

html.dark #chat-modal .close-chat-btn {
    color: #94a3b8 !important;
    background: transparent !important;
    border-radius: 8px !important;
    font-size: 15px !important;
}
html.dark #chat-modal .close-chat-btn:hover {
    background: #334155 !important;
    color: #ffffff !important;
}

html:not(.dark) #chat-modal .chat-back-btn {
    color: #4f46e5 !important;
    font-weight: 750 !important;
}
html.dark #chat-modal .chat-back-btn {
    color: #818cf8 !important;
    font-weight: 750 !important;
}

/* --------------------------------------------------------------------------
   3. CÁC TAB ĐIỀU HƯỚNG (CHAT TABS)
   -------------------------------------------------------------------------- */
html:not(.dark) #chat-modal .chat-tabs {
    background: #f8fafc !important;
    border-bottom: 1px solid #e2e8f0 !important;
    padding: 4px 6px 0 !important;
}

html.dark #chat-modal .chat-tabs {
    background: #0f172a !important;
    border-bottom: 1px solid rgba(51, 65, 85, 0.7) !important;
    padding: 4px 6px 0 !important;
}

#chat-modal .chat-tabs {
    display: flex !important;
    align-items: stretch !important;
    gap: 2px !important;
}

#chat-modal .chat-tab {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    position: relative !important;
    cursor: pointer !important;
    user-select: none !important;
    min-height: 38px !important;
}

#chat-modal .chat-tab svg {
    width: 18px !important;
    height: 18px !important;
    display: inline-block !important;
    vertical-align: middle !important;
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), stroke 0.18s ease, fill 0.18s ease !important;
    pointer-events: none !important;
}

#chat-modal .chat-tab:hover svg {
    transform: scale(1.18) !important;
}

#chat-modal .chat-tab.active svg {
    transform: scale(1.1) !important;
    filter: drop-shadow(0 2px 6px rgba(99, 102, 241, 0.45)) !important;
}

html.dark #chat-modal .chat-tab.active svg {
    filter: drop-shadow(0 2px 8px rgba(129, 140, 248, 0.55)) !important;
}

html:not(.dark) #chat-modal .chat-tab {
    color: #64748b !important;
    font-size: 13.5px !important;
    font-weight: 600 !important;
    border-bottom: 2px solid transparent !important;
    border-radius: 8px 8px 0 0 !important;
    padding: 7px 8px !important;
    transition: all 0.18s ease !important;
}
html:not(.dark) #chat-modal .chat-tab:hover {
    color: #4f46e5 !important;
    background: rgba(79, 70, 229, 0.05) !important;
}
html:not(.dark) #chat-modal .chat-tab.active {
    color: #4f46e5 !important;
    border-bottom: 2px solid #4f46e5 !important;
    background: rgba(79, 70, 229, 0.08) !important;
    font-weight: 750 !important;
}

html.dark #chat-modal .chat-tab {
    color: #94a3b8 !important;
    font-size: 13.5px !important;
    font-weight: 600 !important;
    border-bottom: 2px solid transparent !important;
    border-radius: 8px 8px 0 0 !important;
    padding: 7px 8px !important;
    transition: all 0.18s ease !important;
}
html.dark #chat-modal .chat-tab:hover {
    color: #c7d2fe !important;
    background: rgba(99, 102, 241, 0.08) !important;
}
html.dark #chat-modal .chat-tab.active {
    color: #818cf8 !important;
    border-bottom: 2px solid #818cf8 !important;
    background: rgba(99, 102, 241, 0.16) !important;
    font-weight: 750 !important;
}

/* Huy hiệu số lượng bạn bè / tin nhắn / thông báo */
@keyframes badgePop {
    0% { transform: scale(0); opacity: 0; }
    70% { transform: scale(1.15); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}

html #chat-modal .friend-req-badge,
html #chat-modal .chat-tab-badge {
    position: absolute !important;
    top: 2px !important;
    right: 4px !important;
    background: linear-gradient(135deg, #ef4444, #dc2626) !important;
    color: #ffffff !important;
    border: 1px solid #ffffff !important;
    box-shadow: 0 1px 4px rgba(239, 68, 68, 0.45) !important;
    font-size: 9px !important;
    font-weight: 800 !important;
    line-height: 1 !important;
    min-width: 14px !important;
    height: 14px !important;
    padding: 0 3px !important;
    border-radius: 9999px !important;
    display: inline-flex;
    align-items: center !important;
    justify-content: center !important;
    z-index: 10 !important;
    animation: badgePop 0.25s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
}

html #chat-modal .friend-req-badge,
html #chat-modal .chat-tab-badge,
.hw-chat-unread-badge,
.dm-badge {
    box-sizing: border-box;
}

html #chat-modal .friend-req-badge[style*="display: none"],
html #chat-modal .friend-req-badge[style*="display:none"],
html #chat-modal .chat-tab-badge[style*="display: none"],
html #chat-modal .chat-tab-badge[style*="display:none"],
.hw-chat-unread-badge[style*="display: none"],
.hw-chat-unread-badge[style*="display:none"],
.dm-badge[style*="display: none"],
.dm-badge[style*="display:none"],
#chat-modal [style*="display: none"],
#chat-modal [style*="display:none"],
[style*="display: none"],
[style*="display:none"] {
    display: none !important;
}

html.dark #chat-modal .friend-req-badge,
html.dark #chat-modal .chat-tab-badge {
    border-color: #0f172a !important;
    box-shadow: 0 1px 6px rgba(239, 68, 68, 0.6) !important;
}

/* Huy hiệu thông minh ngoài nút mở chat (Library Dashboard & Header) */
.hw-chat-unread-badge {
    display: inline-flex;
    align-items: center !important;
    justify-content: center !important;
    min-width: 18px !important;
    height: 18px !important;
    padding: 0 5px !important;
    background: linear-gradient(135deg, #ef4444, #dc2626) !important;
    color: #ffffff !important;
    font-size: 10.5px !important;
    font-weight: 800 !important;
    line-height: 1 !important;
    border-radius: 9999px !important;
    border: 1.5px solid #ffffff !important;
    box-shadow: 0 2px 6px rgba(220, 38, 38, 0.4) !important;
    margin-left: 6px !important;
    animation: badgePop 0.28s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
    pointer-events: none !important;
    vertical-align: middle !important;
    box-sizing: border-box !important;
    letter-spacing: -0.02em !important;
    font-family: 'Be Vietnam Pro', 'Inter', sans-serif !important;
}

html:not(.dark) .hw-chat-unread-badge {
    border-color: #ffffff !important;
    box-shadow: 0 2px 6px rgba(220, 38, 38, 0.4) !important;
}

html.dark .hw-chat-unread-badge {
    border-color: #0f172a !important;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.55) !important;
}

/* Nút hành động bạn bè có SVG */
#chat-modal .fbtn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
}
#chat-modal .fbtn svg {
    display: inline-block !important;
    vertical-align: middle !important;
    pointer-events: none !important;
    transition: transform 0.15s ease !important;
}
#chat-modal .fbtn:hover svg {
    transform: scale(1.15) !important;
}

#chat-modal .close-chat-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
}
#chat-modal .close-chat-btn svg {
    display: inline-block !important;
    vertical-align: middle !important;
    transition: transform 0.2s ease !important;
}
#chat-modal .close-chat-btn:hover svg {
    transform: rotate(90deg) scale(1.1) !important;
}

#chat-modal .chat-send-btn-icon {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
}
#chat-modal .chat-send-btn-icon svg {
    display: inline-block !important;
    vertical-align: middle !important;
    transition: transform 0.18s ease !important;
}
#chat-modal .chat-send-btn-icon:hover svg {
    transform: scale(1.15) translate(1px, -1px) !important;
}

/* --------------------------------------------------------------------------
   4. KHUNG NỘI DUNG CHÍNH (CHAT BODY)
   -------------------------------------------------------------------------- */
html:not(.dark) #chat-modal .chat-body {
    background: #f8fafc !important;
    color: #0f172a !important;
    padding: 10px !important;
}

html.dark #chat-modal .chat-body {
    background: #0b0f19 !important;
    color: #f8fafc !important;
    padding: 10px !important;
}

/* Scrollbar tinh tế */
html #chat-modal .chat-body::-webkit-scrollbar {
    display: block !important;
    width: 4px !important;
}
html:not(.dark) #chat-modal .chat-body::-webkit-scrollbar-thumb {
    background: rgba(203, 213, 225, 0.8) !important;
    border-radius: 4px !important;
}
html.dark #chat-modal .chat-body::-webkit-scrollbar-thumb {
    background: rgba(51, 65, 85, 0.8) !important;
    border-radius: 4px !important;
}

/* --------------------------------------------------------------------------
   5. TIN NHẮN (MESSAGE BUBBLES & ROWS)
   -------------------------------------------------------------------------- */
html #chat-modal .chat-msg-row,
html #chat-modal .msg-row {
    padding: 3px 0 !important;
    margin-bottom: 4px !important;
}

/* Meta tác giả & thời gian */
html:not(.dark) #chat-modal .chat-msg-meta,
html:not(.dark) #chat-modal .msg-meta {
    color: #64748b !important;
    font-size: 10.5px !important;
}
html:not(.dark) #chat-modal .chat-msg-meta-name,
html:not(.dark) #chat-modal .msg-meta span:first-child {
    color: #4f46e5 !important;
    font-weight: 750 !important;
}

html.dark #chat-modal .chat-msg-meta,
html.dark #chat-modal .msg-meta {
    color: #94a3b8 !important;
    font-size: 10.5px !important;
}
html.dark #chat-modal .chat-msg-meta-name,
html.dark #chat-modal .msg-meta span:first-child {
    color: #a5b4fc !important;
    font-weight: 750 !important;
}

/* Bong bóng tin nhắn người khác (Incoming) */
html:not(.dark) #chat-modal .chat-msg-row.them .chat-msg-bubble,
html:not(.dark) #chat-modal .msg-row:not(.msg-self) .msg-bubble {
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    color: #1e293b !important;
    border-radius: 14px !important;
    border-bottom-left-radius: 4px !important;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04) !important;
    font-size: 13px !important;
    line-height: 1.45 !important;
}

html.dark #chat-modal .chat-msg-row.them .chat-msg-bubble,
html.dark #chat-modal .msg-row:not(.msg-self) .msg-bubble {
    background: #1e293b !important;
    border: 1px solid rgba(51, 65, 85, 0.7) !important;
    color: #f1f5f9 !important;
    border-radius: 14px !important;
    border-bottom-left-radius: 4px !important;
    box-shadow: none !important;
    font-size: 13px !important;
    line-height: 1.45 !important;
}

/* Bong bóng tin nhắn của chính mình (Self) */
html #chat-modal .chat-msg-row.me .chat-msg-bubble,
html #chat-modal .msg-row.msg-self .msg-bubble {
    background: linear-gradient(135deg, #4f46e5, #6366f1) !important;
    color: #ffffff !important;
    border: none !important;
    border-radius: 14px !important;
    border-bottom-right-radius: 4px !important;
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.28) !important;
    font-size: 13px !important;
    line-height: 1.45 !important;
    font-weight: 500 !important;
}

/* Trích dẫn (Reply Quote) */
html:not(.dark) #chat-modal .msg-quote {
    background: #f1f5f9 !important;
    border-left: 3px solid #6366f1 !important;
    color: #475569 !important;
    border-radius: 0 8px 8px 0 !important;
}
html:not(.dark) #chat-modal .msg-quote b {
    color: #4f46e5 !important;
}

html.dark #chat-modal .msg-quote {
    background: rgba(30, 41, 59, 0.7) !important;
    border-left: 3px solid #818cf8 !important;
    color: #cbd5e1 !important;
    border-radius: 0 8px 8px 0 !important;
}
html.dark #chat-modal .msg-quote b {
    color: #a5b4fc !important;
}

/* Hộp xem trước trích dẫn khi trả lời (Reply Preview Box) */
html:not(.dark) #chat-modal .reply-preview-box {
    background: #f1f5f9 !important;
    border-left: 3px solid #4f46e5 !important;
    color: #475569 !important;
    border-radius: 8px !important;
}
html.dark #chat-modal .reply-preview-box {
    background: #1e293b !important;
    border-left: 3px solid #818cf8 !important;
    color: #cbd5e1 !important;
    border-radius: 8px !important;
}

/* Thông báo hệ thống (System Message) */
html:not(.dark) #chat-modal .chat-sys-msg {
    background: #fef9c3 !important;
    color: #854d0e !important;
    border: 1px solid #fde047 !important;
    font-weight: 600 !important;
}
html.dark #chat-modal .chat-sys-msg {
    background: rgba(234, 179, 8, 0.12) !important;
    color: #fef08a !important;
    border: 1px solid rgba(234, 179, 8, 0.3) !important;
    font-weight: 600 !important;
}

/* --------------------------------------------------------------------------
   6. KHUNG NHẬP TIN NHẮN (FOOTER & INPUT)
   -------------------------------------------------------------------------- */
html:not(.dark) #chat-modal .chat-footer {
    background: #ffffff !important;
    border-top: 1px solid #e2e8f0 !important;
    padding: 8px 10px !important;
}

html.dark #chat-modal .chat-footer {
    background: #0f172a !important;
    border-top: 1px solid rgba(51, 65, 85, 0.7) !important;
    padding: 8px 10px !important;
}

html:not(.dark) #chat-modal .chat-input-bar {
    background: #f8fafc !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 20px !important;
    padding: 4px 6px 4px 14px !important;
}
html:not(.dark) #chat-modal .chat-input-bar:focus-within {
    border-color: #6366f1 !important;
    background: #ffffff !important;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15) !important;
}
html:not(.dark) #chat-modal .chat-input {
    color: #0f172a !important;
}
html:not(.dark) #chat-modal .chat-input::placeholder {
    color: #94a3b8 !important;
}

html.dark #chat-modal .chat-input-bar {
    background: #1e293b !important;
    border: 1px solid rgba(71, 85, 105, 0.7) !important;
    border-radius: 20px !important;
    padding: 4px 6px 4px 14px !important;
}
html.dark #chat-modal .chat-input-bar:focus-within {
    border-color: #818cf8 !important;
    background: #1e293b !important;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25) !important;
}
html.dark #chat-modal .chat-input {
    color: #f8fafc !important;
}
html.dark #chat-modal .chat-input::placeholder {
    color: #64748b !important;
}

/* Nút gửi tin nhắn (Send Button) */
html:not(.dark) #chat-modal .chat-send-btn-icon {
    background: linear-gradient(135deg, #4f46e5, #6366f1) !important;
    color: #ffffff !important;
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.3) !important;
    border-radius: 50% !important;
}
html.dark #chat-modal .chat-send-btn-icon {
    background: linear-gradient(135deg, #6366f1, #4f46e5) !important;
    color: #ffffff !important;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.35) !important;
    border-radius: 50% !important;
}

/* Nút công cụ kèm theo (Bàn phím ảo, emoji) */
html:not(.dark) #chat-modal .chat-tool-btn {
    color: #64748b !important;
    background: transparent !important;
}
html:not(.dark) #chat-modal .chat-tool-btn:hover {
    color: #4f46e5 !important;
    background: #f1f5f9 !important;
}

html.dark #chat-modal .chat-tool-btn {
    color: #94a3b8 !important;
    background: transparent !important;
}
html.dark #chat-modal .chat-tool-btn:hover {
    color: #c7d2fe !important;
    background: rgba(51, 65, 85, 0.6) !important;
}

/* Nút chọn ảnh (Photo Button) */
#chat-modal .chat-btn-photo {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 28px !important;
    height: 28px !important;
    padding: 0 !important;
    border-radius: 6px !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
}
html:not(.dark) #chat-modal .chat-btn-photo {
    color: #475569 !important;
}
html:not(.dark) #chat-modal .chat-btn-photo:hover {
    color: #2563eb !important;
    background: #eff6ff !important;
}
html.dark #chat-modal .chat-btn-photo {
    color: #94a3b8 !important;
}
html.dark #chat-modal .chat-btn-photo:hover {
    color: #60a5fa !important;
    background: rgba(37, 99, 235, 0.15) !important;
}

/* Khung xem trước ảnh (Image Preview Box - Kế thừa từ Ảnh 2) */
#chat-modal .chat-image-preview-box {
    display: none;
    align-items: center;
    gap: 10px;
    padding: 6px 10px;
    margin-bottom: 6px;
    border-radius: 12px;
    position: relative;
    max-width: 100%;
    box-sizing: border-box;
    animation: fadeIn 0.15s ease;
}
html:not(.dark) #chat-modal .chat-image-preview-box {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
}
html.dark #chat-modal .chat-image-preview-box {
    background: #1e293b;
    border: 1px solid rgba(51, 65, 85, 0.7);
}

.chat-preview-item {
    position: relative;
    display: inline-block;
    border-radius: 10px;
    overflow: hidden;
    line-height: 0;
    max-width: 110px;
    max-height: 70px;
}
.chat-preview-thumb {
    width: auto;
    height: auto;
    max-width: 110px;
    max-height: 70px;
    border-radius: 8px;
    object-fit: cover;
    display: block;
}
.chat-preview-close {
    position: absolute;
    top: 3px;
    right: 3px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(15, 23, 42, 0.8);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    cursor: pointer;
    line-height: 1;
    transition: 0.15s ease;
    border: 1px solid rgba(255, 255, 255, 0.3);
}
.chat-preview-close:hover {
    background: #ef4444;
    color: #ffffff;
    transform: scale(1.1);
}
.chat-preview-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow: hidden;
    flex: 1;
}
.chat-preview-name {
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 160px;
}
html:not(.dark) .chat-preview-name { color: #1e293b; }
html.dark .chat-preview-name { color: #f1f5f9; }
.chat-preview-status {
    font-size: 10px;
    color: #10b981;
    font-weight: 500;
}

/* Ảnh đính kèm trong bong bóng tin nhắn (Message Image Bubble) */
.chat-msg-img-wrap {
    margin-top: 4px;
    border-radius: 14px !important;
    overflow: hidden !important;
    max-width: 240px !important;
    cursor: pointer !important;
    position: relative !important;
    border: none !important;
    background: transparent !important;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25) !important;
    transition: transform 0.15s ease, box-shadow 0.15s ease !important;
}
.chat-msg-img-wrap:hover {
    transform: scale(1.02) !important;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35) !important;
}
.chat-msg-img {
    width: 100% !important;
    max-height: 240px !important;
    object-fit: cover !important;
    display: block !important;
    border-radius: 14px !important;
    border: none !important;
    background: transparent !important;
}

/* Loại bỏ hoàn toàn khung viền xanh / nền xanh bao quanh ảnh */
.msg-bubble:has(.chat-msg-img-wrap),
.chat-msg-bubble:has(.chat-msg-img-wrap) {
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    box-shadow: none !important;
}

/* Modal phóng to ảnh Lightbox */
.chat-lightbox-modal {
    display: none;
    position: fixed !important;
    inset: 0 !important;
    background: rgba(0, 0, 0, 0.9) !important;
    backdrop-filter: blur(10px) !important;
    -webkit-backdrop-filter: blur(10px) !important;
    z-index: 2147483647 !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 16px !important;
    box-sizing: border-box !important;
}
.chat-lightbox-backdrop {
    position: absolute !important;
    inset: 0 !important;
    cursor: pointer !important;
    z-index: 1 !important;
}
.chat-lightbox-content {
    position: relative !important;
    max-width: 92vw !important;
    max-height: 90vh !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 16px !important;
    z-index: 2 !important;
}
.chat-lightbox-content img {
    max-width: 100% !important;
    max-height: calc(85vh - 64px) !important;
    border-radius: 14px !important;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.75) !important;
    object-fit: contain !important;
    display: block !important;
    order: 1 !important;
}
.chat-lightbox-close {
    order: 2 !important;
    position: static !important;
    margin: 0 auto !important;
    background: rgba(255, 255, 255, 0.22) !important;
    color: #ffffff !important;
    border: 1px solid rgba(255, 255, 255, 0.4) !important;
    width: 44px !important;
    height: 44px !important;
    min-width: 44px !important;
    min-height: 44px !important;
    border-radius: 50% !important;
    font-size: 20px !important;
    line-height: 1 !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5) !important;
    backdrop-filter: blur(8px) !important;
    -webkit-backdrop-filter: blur(8px) !important;
    flex-shrink: 0 !important;
    outline: none !important;
    padding: 0 !important;
    user-select: none !important;
    -webkit-tap-highlight-color: transparent !important;
}
.chat-lightbox-close:hover {
    background: #ef4444 !important;
    border-color: #ef4444 !important;
    color: #ffffff !important;
    transform: scale(1.12) !important;
    box-shadow: 0 8px 24px rgba(239, 68, 68, 0.6) !important;
}
.chat-lightbox-close:active {
    transform: scale(0.95) !important;
}

/* --------------------------------------------------------------------------
   7. HÒM THƯ (MAILBOX VIEW — FIX TRIỆT ĐỂ NỀN ĐEN BẨN / HEXTECH CŨ)
   -------------------------------------------------------------------------- */
/* Thẻ quà tặng trong Hòm thư (Tương thích cả thẻ .glass lẫn thẻ mới) */
html:not(.dark) #chat-modal .chat-body .glass,
html:not(.dark) #chat-modal .mailbox-card {
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 12px !important;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.05) !important;
    padding: 10px !important;
    margin-bottom: 8px !important;
    transition: all 0.2s ease !important;
}
html:not(.dark) #chat-modal .chat-body .glass:hover,
html:not(.dark) #chat-modal .mailbox-card:hover {
    border-color: #cbd5e1 !important;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08) !important;
}

html.dark #chat-modal .chat-body .glass,
html.dark #chat-modal .mailbox-card {
    background: #1e293b !important;
    border: 1px solid rgba(51, 65, 85, 0.7) !important;
    border-radius: 12px !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35) !important;
    padding: 10px !important;
    margin-bottom: 8px !important;
    transition: all 0.2s ease !important;
}
html.dark #chat-modal .chat-body .glass:hover,
html.dark #chat-modal .mailbox-card:hover {
    border-color: rgba(71, 85, 105, 0.9) !important;
    background: #243044 !important;
}

/* Tên quà / Rương thưởng */
html:not(.dark) #chat-modal .chat-body .glass div[style*="font-weight:bold"],
html:not(.dark) #chat-modal .mailbox-title {
    color: #0f172a !important;
    font-size: 13px !important;
    font-weight: 800 !important;
}
html.dark #chat-modal .chat-body .glass div[style*="font-weight:bold"],
html.dark #chat-modal .mailbox-title {
    color: #f8fafc !important;
    font-size: 13px !important;
    font-weight: 800 !important;
}

/* Mô tả quà tặng */
html:not(.dark) #chat-modal .chat-body .glass div[style*="font-size:10px"],
html:not(.dark) #chat-modal .mailbox-desc {
    color: #64748b !important;
    font-size: 11px !important;
}
html.dark #chat-modal .chat-body .glass div[style*="font-size:10px"],
html.dark #chat-modal .mailbox-desc {
    color: #94a3b8 !important;
    font-size: 11px !important;
}

/* Ngày nhận quà */
html:not(.dark) #chat-modal .chat-body .glass div[style*="font-size:9px"],
html:not(.dark) #chat-modal .mailbox-date {
    color: #94a3b8 !important;
    font-size: 10px !important;
}
html.dark #chat-modal .chat-body .glass div[style*="font-size:9px"],
html.dark #chat-modal .mailbox-date {
    color: #64748b !important;
    font-size: 10px !important;
}

/* Nút nhận quà (NHẬN) */
html:not(.dark) #chat-modal .chat-body .hex-btn-style,
html:not(.dark) #chat-modal .mailbox-claim-btn {
    background: linear-gradient(135deg, #4f46e5, #6366f1) !important;
    color: #ffffff !important;
    border: none !important;
    border-radius: 8px !important;
    padding: 6px 14px !important;
    font-size: 11px !important;
    font-weight: 800 !important;
    letter-spacing: 0.03em !important;
    box-shadow: 0 2px 6px rgba(79, 70, 229, 0.3) !important;
    text-shadow: none !important;
    cursor: pointer !important;
    transition: all 0.18s ease !important;
}
html:not(.dark) #chat-modal .chat-body .hex-btn-style:hover,
html:not(.dark) #chat-modal .mailbox-claim-btn:hover {
    transform: translateY(-1px) scale(1.02) !important;
    box-shadow: 0 4px 10px rgba(79, 70, 229, 0.4) !important;
}

html.dark #chat-modal .chat-body .hex-btn-style,
html.dark #chat-modal .mailbox-claim-btn {
    background: linear-gradient(135deg, #6366f1, #4f46e5) !important;
    color: #ffffff !important;
    border: none !important;
    border-radius: 8px !important;
    padding: 6px 14px !important;
    font-size: 11px !important;
    font-weight: 800 !important;
    letter-spacing: 0.03em !important;
    box-shadow: 0 2px 6px rgba(99, 102, 241, 0.35) !important;
    text-shadow: none !important;
    cursor: pointer !important;
    transition: all 0.18s ease !important;
}
html.dark #chat-modal .chat-body .hex-btn-style:hover,
html.dark #chat-modal .mailbox-claim-btn:hover {
    transform: translateY(-1px) scale(1.02) !important;
    box-shadow: 0 4px 10px rgba(99, 102, 241, 0.45) !important;
}

/* --------------------------------------------------------------------------
   8. PHÒNG ĐẤU TRÍ (PVP ROOMS VIEW) — TỐI ƯU MÀU NỀN & CHỮ (ẢNH 3)
   -------------------------------------------------------------------------- */
/* Thanh công cụ tạo phòng / nhập mã dính trên đầu */
html:not(.dark) #chat-modal .pvp-toolbar,
html:not(.dark) #chat-modal .chat-body > div[style*="backdrop-filter"] {
    background: rgba(255, 255, 255, 0.98) !important;
    border-bottom: 1px solid #e2e8f0 !important;
}
html.dark #chat-modal .pvp-toolbar,
html.dark #chat-modal .chat-body > div[style*="backdrop-filter"] {
    background: rgba(15, 23, 42, 0.95) !important;
    border-bottom: 1px solid rgba(51, 65, 85, 0.7) !important;
}

/* Nút trên thanh công cụ */
html:not(.dark) #chat-modal .pvp-btn-create,
html:not(.dark) #chat-modal button[onclick*="PVP.createRoomMenu"] {
    background: linear-gradient(135deg, #10b981, #059669) !important;
    color: #ffffff !important;
    box-shadow: 0 2px 6px rgba(16, 185, 129, 0.25) !important;
}
html:not(.dark) #chat-modal .pvp-btn-join,
html:not(.dark) #chat-modal button[onclick*="PVP.joinRoomMenu"] {
    background: linear-gradient(135deg, #6366f1, #4f46e5) !important;
    color: #ffffff !important;
    box-shadow: 0 2px 6px rgba(99, 102, 241, 0.25) !important;
}

/* Thẻ trạng thái chưa có phòng (PVP Empty State Card - Fix triệt để màu nền & chữ Ảnh 3) */
html:not(.dark) #chat-modal .pvp-empty-state-card,
html:not(.dark) #chat-modal div[style*="Chưa có phòng đấu trí nào"],
html:not(.dark) #chat-modal div:has(> .pvp-pulse-icon) {
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.05) !important;
    border-radius: 14px !important;
}
html:not(.dark) #chat-modal .pvp-empty-title,
html:not(.dark) #chat-modal div:has(> .pvp-pulse-icon) > div:nth-child(2),
html:not(.dark) #chat-modal div[style*="Chưa có phòng đấu trí nào"] {
    color: #0f172a !important;
    font-weight: 800 !important;
}
html:not(.dark) #chat-modal .pvp-empty-desc,
html:not(.dark) #chat-modal div:has(> .pvp-pulse-icon) > div:nth-child(3) {
    color: #64748b !important;
}

html.dark #chat-modal .pvp-empty-state-card,
html.dark #chat-modal div:has(> .pvp-pulse-icon) {
    background: rgba(30, 41, 59, 0.7) !important;
    border: 1px solid rgba(51, 65, 85, 0.7) !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4) !important;
}
html.dark #chat-modal .pvp-empty-title,
html.dark #chat-modal div:has(> .pvp-pulse-icon) > div:nth-child(2) {
    color: #f8fafc !important;
}
html.dark #chat-modal .pvp-empty-desc,
html.dark #chat-modal div:has(> .pvp-pulse-icon) > div:nth-child(3) {
    color: #94a3b8 !important;
}

/* Thẻ phòng đấu trí */
html:not(.dark) #chat-modal [onclick*="PVP.joinRoom"],
html:not(.dark) #chat-modal [onclick*="PVP.promptJoinPrivateRoom"],
html:not(.dark) #chat-modal [onclick*="pvp_err_already_in"],
html:not(.dark) #chat-modal .pvp-room-card {
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 12px !important;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.04) !important;
    color: #0f172a !important;
}
html:not(.dark) #chat-modal [onclick*="PVP.joinRoom"]:hover,
html:not(.dark) #chat-modal [onclick*="PVP.promptJoinPrivateRoom"]:hover,
html:not(.dark) #chat-modal .pvp-room-card:hover {
    background: #f8fafc !important;
    border-color: #cbd5e1 !important;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08) !important;
}

html.dark #chat-modal [onclick*="PVP.joinRoom"],
html.dark #chat-modal [onclick*="PVP.promptJoinPrivateRoom"],
html.dark #chat-modal [onclick*="pvp_err_already_in"],
html.dark #chat-modal .pvp-room-card {
    background: #1e293b !important;
    border: 1px solid rgba(51, 65, 85, 0.7) !important;
    border-radius: 12px !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4) !important;
    color: #f8fafc !important;
}
html.dark #chat-modal [onclick*="PVP.joinRoom"]:hover,
html.dark #chat-modal [onclick*="PVP.promptJoinPrivateRoom"]:hover,
html.dark #chat-modal .pvp-room-card:hover {
    background: #243044 !important;
    border-color: rgba(71, 85, 105, 0.9) !important;
}

/* Tên phòng và số người */
html:not(.dark) #chat-modal .pvp-room-name,
html:not(.dark) #chat-modal div[style*="max-width:90px"],
html:not(.dark) #chat-modal span[style*="max-width:120px"] {
    color: #0f172a !important;
    font-weight: 750 !important;
}
html.dark #chat-modal .pvp-room-name,
html.dark #chat-modal div[style*="max-width:90px"],
html.dark #chat-modal span[style*="max-width:120px"] {
    color: #f8fafc !important;
    font-weight: 750 !important;
}

html:not(.dark) #chat-modal .pvp-room-host,
html:not(.dark) #chat-modal span[title*="Chủ phòng:"] {
    color: #64748b !important;
}
html.dark #chat-modal .pvp-room-host,
html.dark #chat-modal span[title*="Chủ phòng:"] {
    color: #94a3b8 !important;
}

/* Huy hiệu số người trong phòng */
html:not(.dark) #chat-modal .pvp-room-count {
    background: #f1f5f9 !important;
    color: #334155 !important;
    border: 1px solid #e2e8f0 !important;
}
html.dark #chat-modal .pvp-room-count {
    background: #0f172a !important;
    color: #cbd5e1 !important;
    border: 1px solid rgba(51, 65, 85, 0.7) !important;
}

/* Trạng thái phòng */
html:not(.dark) #chat-modal div[style*="Trạng thái:"] {
    color: #64748b !important;
}
html.dark #chat-modal div[style*="Trạng thái:"] {
    color: #94a3b8 !important;
}

/* --------------------------------------------------------------------------
   9. LỊCH SỬ ĐẤU TRÍ (QUIZ HISTORY VIEW)
   -------------------------------------------------------------------------- */
/* Banner ôn tập câu sai */
html:not(.dark) #chat-modal div[style*="🧠 Ôn Tập Câu Trả Lời Sai"] {
    color: #4c1d95 !important;
}
html:not(.dark) #chat-modal div:has(> div:contains("🧠 Ôn Tập Câu Trả Lời Sai")) {
    background: linear-gradient(135deg, #ede9fe, #f5f3ff) !important;
    border: 1px solid #ddd6fe !important;
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.08) !important;
}
html.dark #chat-modal div:has(> div:contains("🧠 Ôn Tập Câu Trả Lời Sai")) {
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.15), rgba(76, 29, 149, 0.25)) !important;
    border: 1px solid rgba(124, 58, 237, 0.4) !important;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4) !important;
}

/* Thẻ câu hỏi lịch sử */
html:not(.dark) #chat-modal div[style*="border-radius:10px"]:has(> div > span:contains("THẮNG")),
html:not(.dark) #chat-modal div[style*="border-radius:10px"]:has(> div > span:contains("THUA")) {
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.04) !important;
}
html:not(.dark) #chat-modal div[style*="font-size:13px"][style*="line-height:1.4"] {
    color: #0f172a !important;
    font-weight: 700 !important;
}

html.dark #chat-modal div[style*="border-radius:10px"]:has(> div > span:contains("THẮNG")),
html.dark #chat-modal div[style*="border-radius:10px"]:has(> div > span:contains("THUA")) {
    background: #1e293b !important;
    border: 1px solid rgba(51, 65, 85, 0.7) !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35) !important;
}
html.dark #chat-modal div[style*="font-size:13px"][style*="line-height:1.4"] {
    color: #f8fafc !important;
    font-weight: 700 !important;
}

/* --------------------------------------------------------------------------
   10. TRA CỨU LỊCH THI EPS (EPS SCHEDULE VIEW) — FIX MÀU NỀN & CHỮ (ẢNH 4)
   -------------------------------------------------------------------------- */
/* Tiêu đề tra cứu lịch thi EPS */
html:not(.dark) #chat-modal .eps-schedule-title,
html:not(.dark) #chat-modal div[style*="TRA CỨU LỊCH THI EPS"] {
    color: #0f172a !important;
    font-weight: 800 !important;
}
html.dark #chat-modal .eps-schedule-title,
html.dark #chat-modal div[style*="TRA CỨU LỊCH THI EPS"] {
    color: #f8fafc !important;
    font-weight: 800 !important;
}

/* Ô nhập số báo danh */
html:not(.dark) #chat-modal #eps-sbd-input {
    background: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    color: #0f172a !important;
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.05) !important;
}
html:not(.dark) #chat-modal #eps-sbd-input::placeholder {
    color: #94a3b8 !important;
}
html:not(.dark) #chat-modal #eps-sbd-input:focus {
    border-color: #4f46e5 !important;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15) !important;
    background: #ffffff !important;
}

html.dark #chat-modal #eps-sbd-input {
    background: #1e293b !important;
    border: 1px solid rgba(71, 85, 105, 0.7) !important;
    color: #f8fafc !important;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.3) !important;
}
html.dark #chat-modal #eps-sbd-input:focus {
    border-color: #818cf8 !important;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25) !important;
}

/* Nút Tra Cứu */
html:not(.dark) #chat-modal .eps-search-btn,
html:not(.dark) #chat-modal button[onclick*="Chat.searchEpsSchedule"] {
    background: linear-gradient(135deg, #4f46e5, #6366f1) !important;
    color: #ffffff !important;
    box-shadow: 0 2px 6px rgba(79, 70, 229, 0.28) !important;
}
html.dark #chat-modal .eps-search-btn,
html.dark #chat-modal button[onclick*="Chat.searchEpsSchedule"] {
    background: linear-gradient(135deg, #6366f1, #4f46e5) !important;
    color: #ffffff !important;
    box-shadow: 0 2px 6px rgba(99, 102, 241, 0.35) !important;
}

/* Thẻ kết quả lịch thi (EPS Result Card) */
html:not(.dark) #chat-modal .eps-res-card,
html:not(.dark) #chat-modal #eps-schedule-results > div[style*="border-radius:12px"] {
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    color: #0f172a !important;
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.06) !important;
    border-radius: 14px !important;
}
html:not(.dark) #chat-modal .eps-res-title,
html:not(.dark) #chat-modal #eps-schedule-results div[style*="border-bottom"][style*="padding-bottom:8px"] {
    color: #4f46e5 !important;
    border-bottom: 1px solid #e2e8f0 !important;
}
html:not(.dark) #chat-modal .eps-res-row,
html:not(.dark) #chat-modal #eps-schedule-results div[style*="border-bottom:1px solid"] {
    border-bottom-color: #f1f5f9 !important;
}
html:not(.dark) #chat-modal .eps-res-label,
html:not(.dark) #chat-modal #eps-schedule-results span[style*="color:#8b949e"] {
    color: #64748b !important;
}
html:not(.dark) #chat-modal .eps-res-val,
html:not(.dark) #chat-modal #eps-schedule-results span[style*="font-weight:bold; color:#fff;"],
html:not(.dark) #chat-modal #eps-schedule-results span[style*="color:#fff"] {
    color: #0f172a !important;
}
html:not(.dark) #chat-modal .eps-res-sbd,
html:not(.dark) #chat-modal #eps-schedule-results span[style*="color:#58a6ff"] {
    color: #2563eb !important;
}
html:not(.dark) #chat-modal .eps-warn-box,
html:not(.dark) #chat-modal #eps-schedule-results div[style*="color:#f87171"] {
    background: #fef2f2 !important;
    border: 1px solid #fecaca !important;
    color: #991b1b !important;
}
html:not(.dark) #chat-modal .eps-not-found-box {
    background: #fef2f2 !important;
    border: 1px solid #fecaca !important;
    color: #b91c1c !important;
}

html.dark #chat-modal .eps-res-card,
html.dark #chat-modal #eps-schedule-results > div[style*="border-radius:12px"] {
    background: #1e293b !important;
    border: 1px solid rgba(51, 65, 85, 0.7) !important;
    color: #f8fafc !important;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5) !important;
}

/* --------------------------------------------------------------------------
   11. DANH SÁCH BẠN BÈ & TÌM KIẾM (FRIENDS VIEW)
   -------------------------------------------------------------------------- */
html:not(.dark) #chat-modal .friend-header-v2 {
    border-bottom: 1px solid #e2e8f0 !important;
}
html:not(.dark) #chat-modal .friend-header-title {
    color: #0f172a !important;
    font-weight: 800 !important;
}
html:not(.dark) #chat-modal .friend-stat-online {
    color: #059669 !important;
    font-weight: 750 !important;
}
html:not(.dark) #chat-modal .friend-stat-count {
    color: #4f46e5 !important;
    font-weight: 750 !important;
}

html.dark #chat-modal .friend-header-v2 {
    border-bottom: 1px solid rgba(51, 65, 85, 0.7) !important;
}
html.dark #chat-modal .friend-header-title {
    color: #f8fafc !important;
    font-weight: 800 !important;
}
html.dark #chat-modal .friend-stat-online {
    color: #34d399 !important;
    font-weight: 750 !important;
}
html.dark #chat-modal .friend-stat-count {
    color: #818cf8 !important;
    font-weight: 750 !important;
}

/* Ô tìm kiếm bạn bè */
html:not(.dark) #chat-modal .friend-search-box {
    background: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 12px !important;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05) !important;
}
html:not(.dark) #chat-modal .friend-search-input {
    color: #0f172a !important;
}
html:not(.dark) #chat-modal .friend-search-btn {
    background: #4f46e5 !important;
    color: #ffffff !important;
    border: none !important;
    border-radius: 8px !important;
    padding: 5px 12px !important;
    font-weight: 750 !important;
    cursor: pointer !important;
}

html.dark #chat-modal .friend-search-box {
    background: #1e293b !important;
    border: 1px solid rgba(71, 85, 105, 0.7) !important;
    border-radius: 12px !important;
}
html.dark #chat-modal .friend-search-input {
    color: #ffffff !important;
}
html.dark #chat-modal .friend-search-btn {
    background: #6366f1 !important;
    color: #ffffff !important;
    border: none !important;
    border-radius: 8px !important;
    padding: 5px 12px !important;
    font-weight: 750 !important;
    cursor: pointer !important;
}

/* Thẻ bạn bè (Friend Card) */
html:not(.dark) #chat-modal .friend-card {
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 12px !important;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04) !important;
}
html:not(.dark) #chat-modal .friend-card:hover {
    background: #f8fafc !important;
    border-color: #cbd5e1 !important;
}
html:not(.dark) #chat-modal .friend-name,
html:not(.dark) #chat-modal .friend-name-v2 {
    color: #0f172a !important;
    font-weight: 750 !important;
}
html:not(.dark) #chat-modal .friend-sub-v2,
html:not(.dark) #chat-modal .friend-status {
    color: #64748b !important;
}
html:not(.dark) #chat-modal .friend-section-title-v2 {
    color: #4f46e5 !important;
    font-weight: 800 !important;
    border-bottom: 1px solid #e2e8f0 !important;
}

html.dark #chat-modal .friend-card {
    background: rgba(30, 41, 59, 0.6) !important;
    border: 1px solid rgba(51, 65, 85, 0.6) !important;
    border-radius: 12px !important;
}
html.dark #chat-modal .friend-card:hover {
    background: rgba(30, 41, 59, 0.95) !important;
    border-color: rgba(71, 85, 105, 0.8) !important;
}
html.dark #chat-modal .friend-name,
html.dark #chat-modal .friend-name-v2 {
    color: #f8fafc !important;
    font-weight: 750 !important;
}
html.dark #chat-modal .friend-sub-v2,
html.dark #chat-modal .friend-status {
    color: #94a3b8 !important;
}
html.dark #chat-modal .friend-section-title-v2 {
    color: #a5b4fc !important;
    font-weight: 800 !important;
    border-bottom: 1px solid rgba(51, 65, 85, 0.6) !important;
}

/* Nút thao tác trên thẻ bạn bè */
html:not(.dark) #chat-modal .friend-btn {
    background: #f1f5f9 !important;
    border: 1px solid #cbd5e1 !important;
    color: #475569 !important;
}
html:not(.dark) #chat-modal .friend-btn.dm,
html:not(.dark) #chat-modal .fbtn-msg,
html:not(.dark) #chat-modal .btn-dm-start {
    background: #e0e7ff !important;
    border-color: #c7d2fe !important;
    color: #4338ca !important;
}
html:not(.dark) #chat-modal .friend-btn.del,
html:not(.dark) #chat-modal .fbtn-reject,
html:not(.dark) #chat-modal .fbtn-remove,
html:not(.dark) #chat-modal .btn-friend-block {
    background: #fee2e2 !important;
    border-color: #fecaca !important;
    color: #b91c1c !important;
}
html:not(.dark) #chat-modal .fbtn-add,
html:not(.dark) #chat-modal .btn-friend-add {
    background: #e0e7ff !important;
    color: #4338ca !important;
}
html:not(.dark) #chat-modal .fbtn-add:hover,
html:not(.dark) #chat-modal .btn-friend-add:hover {
    background: #c7d2fe !important;
    color: #3730a3 !important;
}
html:not(.dark) #chat-modal .fbtn-accept {
    background: #dcfce7 !important;
    color: #15803d !important;
}
html:not(.dark) #chat-modal .fbtn-pvp {
    background: #ffedd5 !important;
    color: #c2410c !important;
}
html:not(.dark) #chat-modal .fbtn-invite {
    background: #dcfce7 !important;
    color: #15803d !important;
}
html:not(.dark) #chat-modal .friend-footer-links {
    border-top: 1px solid #e2e8f0 !important;
}
html:not(.dark) #chat-modal .friend-footer-link {
    color: #64748b !important;
}
html:not(.dark) #chat-modal .friend-footer-link:hover {
    color: #4f46e5 !important;
}
html:not(.dark) #chat-modal .search-result-card {
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 10px !important;
}
html:not(.dark) #chat-modal .search-result-card:hover {
    background: #f8fafc !important;
    border-color: #cbd5e1 !important;
}
html:not(.dark) #chat-modal .friend-request-row-v2 {
    border-bottom: 1px solid #f1f5f9 !important;
}
/* Friend Status Dot & Search Status Indicator */
#chat-modal .friend-dot {
    position: absolute !important;
    bottom: -1px !important;
    right: -1px !important;
    width: 7px !important;
    height: 7px !important;
    border-radius: 50% !important;
    border: 1.5px solid #0f172a !important;
    z-index: 10 !important;
    box-sizing: border-box !important;
}
html:not(.dark) #chat-modal .friend-dot {
    border-color: #ffffff !important;
}
#chat-modal .friend-status-on {
    background: #22c55e !important;
    box-shadow: 0 0 5px rgba(34, 197, 94, 0.7) !important;
}
#chat-modal .friend-status-off {
    background: #94a3b8 !important;
    box-shadow: none !important;
}
html.dark #chat-modal .friend-status-off {
    background: #64748b !important;
}

/* Friend Search Status Indicator Dot */
#chat-modal .friend-status-indicator,
#chat-modal .friend-search-status-dot {
    display: inline-block !important;
    width: 6.5px !important;
    height: 6.5px !important;
    min-width: 6.5px !important;
    min-height: 6.5px !important;
    border-radius: 50% !important;
    margin-right: 5px !important;
    vertical-align: middle !important;
    margin-top: -2px !important;
    flex-shrink: 0 !important;
    box-sizing: border-box !important;
}

#chat-modal .friend-status-indicator.is-online,
#chat-modal .friend-search-status-dot.is-online {
    background: #22c55e !important;
    box-shadow: 0 0 5px rgba(34, 197, 94, 0.7) !important;
}

#chat-modal .friend-status-indicator.is-offline,
#chat-modal .friend-search-status-dot.is-offline {
    background: #94a3b8 !important;
    box-shadow: none !important;
}

html.dark #chat-modal .friend-status-indicator.is-offline,
html.dark #chat-modal .friend-search-status-dot.is-offline {
    background: #64748b !important;
}

/* Online user list */
html:not(.dark) #chat-modal .online-name {
    color: #0f172a !important;
    font-weight: 750 !important;
}
html:not(.dark) #chat-modal .online-acti {
    color: #64748b !important;
}
html:not(.dark) #chat-modal .online-row {
    border-bottom: 1px solid #f1f5f9 !important;
}
html:not(.dark) #chat-modal .online-row:hover {
    background: #f8fafc !important;
}

html.dark #chat-modal .online-name {
    color: #f8fafc !important;
    font-weight: 750 !important;
}
html.dark #chat-modal .online-acti {
    color: #94a3b8 !important;
}
html.dark #chat-modal .online-row {
    border-bottom: 1px solid rgba(51, 65, 85, 0.4) !important;
}
html.dark #chat-modal .online-row:hover {
    background: rgba(51, 65, 85, 0.5) !important;
}

html.dark #chat-modal .friend-btn {
    background: #1e293b !important;
    border: 1px solid #334155 !important;
    color: #cbd5e1 !important;
}
html.dark #chat-modal .friend-btn.dm {
    background: rgba(99, 102, 241, 0.2) !important;
    border-color: rgba(99, 102, 241, 0.4) !important;
    color: #a5b4fc !important;
}
html.dark #chat-modal .friend-btn.del {
    background: rgba(239, 68, 68, 0.2) !important;
    border-color: rgba(239, 68, 68, 0.4) !important;
    color: #fca5a5 !important;
}

/* --------------------------------------------------------------------------
   12. HỘP THOẠI TRỰC TIẾP (DM CONVERSATION LIST)
   -------------------------------------------------------------------------- */
html:not(.dark) #chat-modal .dm-row {
    border-bottom: 1px solid #f1f5f9 !important;
}
html:not(.dark) #chat-modal .dm-row:hover {
    background: #f1f5f9 !important;
}
html:not(.dark) #chat-modal .dm-name {
    color: #0f172a !important;
    font-weight: 750 !important;
}
html:not(.dark) #chat-modal .dm-preview {
    color: #64748b !important;
}
html:not(.dark) #chat-modal .dm-badge {
    background: #4f46e5 !important;
    color: #ffffff !important;
}

html.dark #chat-modal .dm-row {
    border-bottom: 1px solid rgba(51, 65, 85, 0.4) !important;
}
html.dark #chat-modal .dm-row:hover {
    background: rgba(51, 65, 85, 0.5) !important;
}
html.dark #chat-modal .dm-name {
    color: #f8fafc !important;
    font-weight: 750 !important;
}
html.dark #chat-modal .dm-preview {
    color: #94a3b8 !important;
}
html.dark #chat-modal .dm-badge {
    background: #818cf8 !important;
    color: #ffffff !important;
}

/* --------------------------------------------------------------------------
   13. TRẠNG THÁI TRỐNG & HỘP THÔNG BÁO (EMPTY STATES)
   -------------------------------------------------------------------------- */
html:not(.dark) #chat-modal .friend-empty-state {
    background: #ffffff !important;
    border: 1px dashed #cbd5e1 !important;
    color: #64748b !important;
    border-radius: 12px !important;
}
html.dark #chat-modal .friend-empty-state {
    background: rgba(30, 41, 59, 0.4) !important;
    border: 1px dashed rgba(71, 85, 105, 0.6) !important;
    color: #94a3b8 !important;
    border-radius: 12px !important;
}

/* --------------------------------------------------------------------------
   14. BẢNG PHONG THẦN (LADDER MODAL) - MODERN GLASS THEME ĐỒNG BỘ CHAT V2
   -------------------------------------------------------------------------- */

html #ladder-modal {
    position: fixed !important;
    inset: 0 !important;
    z-index: 2147483647 !important;
    display: none;
    align-items: center !important;
    justify-content: center !important;
    padding: 16px !important;
    box-sizing: border-box !important;
    backdrop-filter: blur(4px) !important;
    -webkit-backdrop-filter: blur(4px) !important;
}

html:not(.dark) #ladder-modal {
    background: rgba(15, 23, 42, 0.45) !important;
}

html.dark #ladder-modal,
html[data-theme="dark"] #ladder-modal,
body.dark #ladder-modal {
    background: rgba(0, 0, 0, 0.75) !important;
}

/* Khung chính (Modal Shell) - Bỏ blur nặng để triệt tiêu hoàn toàn lag giật khi cuộn */
#ladder-modal .ladder-shell,
#ladder-modal .cultivation-popup-shell,
#ladder-modal > div {
    width: 100% !important;
    max-width: 440px !important;
    max-height: 85vh !important;
    border-radius: 20px !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
    display: flex !important;
    flex-direction: column !important;
    position: relative !important;
    animation: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

/* Light Mode Shell */
html:not(.dark) #ladder-modal .ladder-shell,
html:not(.dark) #ladder-modal .cultivation-popup-shell,
html:not(.dark) #ladder-modal > div {
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    box-shadow: 0 20px 45px -10px rgba(15, 23, 42, 0.16), 0 0 0 1px rgba(15, 23, 42, 0.04) !important;
    color: #0f172a !important;
}

/* Dark Mode Shell */
html.dark #ladder-modal .ladder-shell,
html.dark #ladder-modal .cultivation-popup-shell,
html.dark #ladder-modal > div,
html[data-theme="dark"] #ladder-modal .ladder-shell,
html[data-theme="dark"] #ladder-modal .cultivation-popup-shell,
html[data-theme="dark"] #ladder-modal > div,
body.dark #ladder-modal .ladder-shell,
body.dark #ladder-modal .cultivation-popup-shell,
body.dark #ladder-modal > div {
    background: #0f172a !important;
    border: 1px solid rgba(51, 65, 85, 0.85) !important;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.75), 0 0 0 1px rgba(255, 255, 255, 0.08) !important;
    color: #f8fafc !important;
}

/* Header */
#ladder-modal .ladder-header {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 12px 16px !important;
    box-sizing: border-box !important;
}

html:not(.dark) #ladder-modal .ladder-header {
    background: #ffffff !important;
    border-bottom: 1px solid #f1f5f9 !important;
}

html.dark #ladder-modal .ladder-header,
html[data-theme="dark"] #ladder-modal .ladder-header,
body.dark #ladder-modal .ladder-header {
    background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%) !important;
    border-bottom: 1px solid rgba(51, 65, 85, 0.7) !important;
}

#ladder-modal .ladder-header-title {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    font-size: 13.5px !important;
    font-weight: 800 !important;
    letter-spacing: 0.03em !important;
    text-transform: uppercase !important;
    margin: 0 !important;
    padding: 0 !important;
}

html:not(.dark) #ladder-modal .ladder-header-title {
    color: #0f172a !important;
    text-shadow: none !important;
}

html.dark #ladder-modal .ladder-header-title,
html[data-theme="dark"] #ladder-modal .ladder-header-title,
body.dark #ladder-modal .ladder-header-title {
    color: #f8fafc !important;
    text-shadow: 0 0 12px rgba(129, 140, 248, 0.3) !important;
}

#ladder-modal .ladder-title-icon {
    font-size: 16px !important;
    line-height: 1 !important;
}

/* Nút đóng (Close Button) */
html #ladder-modal .ladder-btn-close-x,
html #ladder-modal button.ladder-btn-close-x {
    width: 30px !important;
    height: 30px !important;
    border-radius: 8px !important;
    border: none !important;
    background: transparent !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    font-size: 16px !important;
    font-weight: bold !important;
    line-height: 1 !important;
    padding: 0 !important;
    transition: all 0.18s ease !important;
    margin: 0 !important;
    box-shadow: none !important;
}

html:not(.dark) #ladder-modal .ladder-btn-close-x,
html:not(.dark) #ladder-modal button.ladder-btn-close-x {
    color: #64748b !important;
}
html:not(.dark) #ladder-modal .ladder-btn-close-x:hover,
html:not(.dark) #ladder-modal button.ladder-btn-close-x:hover {
    background: #f1f5f9 !important;
    color: #0f172a !important;
    transform: none !important;
}

html.dark #ladder-modal .ladder-btn-close-x,
html.dark #ladder-modal button.ladder-btn-close-x,
html[data-theme="dark"] #ladder-modal .ladder-btn-close-x,
html[data-theme="dark"] #ladder-modal button.ladder-btn-close-x,
body.dark #ladder-modal .ladder-btn-close-x,
body.dark #ladder-modal button.ladder-btn-close-x {
    color: #94a3b8 !important;
}
html.dark #ladder-modal .ladder-btn-close-x:hover,
html.dark #ladder-modal button.ladder-btn-close-x:hover,
html[data-theme="dark"] #ladder-modal .ladder-btn-close-x:hover,
html[data-theme="dark"] #ladder-modal button.ladder-btn-close-x:hover,
body.dark #ladder-modal .ladder-btn-close-x:hover,
body.dark #ladder-modal button.ladder-btn-close-x:hover {
    background: #334155 !important;
    color: #ffffff !important;
    transform: none !important;
}

/* Tabs - Thiết kế dạng Segmented Control bo tròn hiện đại, triệt tiêu hoàn toàn nền xám bẩn */
#ladder-modal .ladder-tabs {
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    padding: 6px !important;
    box-sizing: border-box !important;
    margin: 0 !important;
}

html:not(.dark) #ladder-modal .ladder-tabs {
    background: #f1f5f9 !important;
    border-bottom: 1px solid #e2e8f0 !important;
}

html.dark #ladder-modal .ladder-tabs,
html[data-theme="dark"] #ladder-modal .ladder-tabs,
body.dark #ladder-modal .ladder-tabs {
    background: #0b1120 !important;
    border-bottom: 1px solid #1e293b !important;
}

#ladder-modal .ladder-tab {
    flex: 1 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    position: relative !important;
    cursor: pointer !important;
    user-select: none !important;
    min-height: 36px !important;
    padding: 7px 12px !important;
    font-size: 12.5px !important;
    text-transform: uppercase !important;
    letter-spacing: 0.04em !important;
    border-radius: 10px !important;
    border: none !important;
    transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease !important;
    box-sizing: border-box !important;
    outline: none !important;
}

/* Ẩn hoàn toàn gạch chân/bóng đổ hextech cũ */
#ladder-modal .ladder-tab::after {
    display: none !important;
    content: none !important;
}

/* Light Mode Tabs */
html:not(.dark) #ladder-modal .ladder-tab {
    background: transparent !important;
    color: #64748b !important;
    font-weight: 700 !important;
}
html:not(.dark) #ladder-modal .ladder-tab:hover {
    background: rgba(255, 255, 255, 0.6) !important;
    color: #1e293b !important;
}
html:not(.dark) #ladder-modal .ladder-tab.active {
    color: #2563eb !important;
    background: #ffffff !important;
    font-weight: 800 !important;
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.08), 0 0 0 1px rgba(15, 23, 42, 0.04) !important;
}

/* Dark Mode Tabs */
html.dark #ladder-modal .ladder-tab,
html[data-theme="dark"] #ladder-modal .ladder-tab,
body.dark #ladder-modal .ladder-tab {
    background: transparent !important;
    color: #94a3b8 !important;
    font-weight: 700 !important;
}
html.dark #ladder-modal .ladder-tab:hover,
html[data-theme="dark"] #ladder-modal .ladder-tab:hover,
body.dark #ladder-modal .ladder-tab:hover {
    background: rgba(255, 255, 255, 0.05) !important;
    color: #f1f5f9 !important;
}
html.dark #ladder-modal .ladder-tab.active,
html[data-theme="dark"] #ladder-modal .ladder-tab.active,
body.dark #ladder-modal .ladder-tab.active {
    color: #60a5fa !important;
    background: #1e293b !important;
    font-weight: 800 !important;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.05) !important;
}

/* List Body - Tối ưu hiệu năng cuộn 60fps mượt mà */
#ladder-modal .ladder-list {
    flex: 1 !important;
    overflow-y: auto !important;
    overscroll-behavior: contain !important;
    -webkit-overflow-scrolling: touch !important;
    padding: 12px !important;
    box-sizing: border-box !important;
    text-align: left !important;
    contain: content !important;
}

html:not(.dark) #ladder-modal .ladder-list {
    background: #f8fafc !important;
    color: #0f172a !important;
}
html.dark #ladder-modal .ladder-list,
html[data-theme="dark"] #ladder-modal .ladder-list,
body.dark #ladder-modal .ladder-list {
    background: #0b0f19 !important;
    color: #f8fafc !important;
}

/* Scrollbar */
#ladder-modal .ladder-list::-webkit-scrollbar {
    width: 5px !important;
    display: block !important;
}
html:not(.dark) #ladder-modal .ladder-list::-webkit-scrollbar-thumb {
    background: rgba(203, 213, 225, 0.8) !important;
    border-radius: 4px !important;
}
html.dark #ladder-modal .ladder-list::-webkit-scrollbar-thumb,
html[data-theme="dark"] #ladder-modal .ladder-list::-webkit-scrollbar-thumb,
body.dark #ladder-modal .ladder-list::-webkit-scrollbar-thumb {
    background: rgba(51, 65, 85, 0.8) !important;
    border-radius: 4px !important;
}

/* Rows - Khử rung lắc và giật khung */
#ladder-modal .ladder-row {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    padding: 10px 12px !important;
    border-radius: 14px !important;
    margin-bottom: 8px !important;
    box-sizing: border-box !important;
    transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease !important;
    contain: layout style !important;
}

html:not(.dark) #ladder-modal .ladder-row {
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04) !important;
}
html:not(.dark) #ladder-modal .ladder-row:hover {
    background: #ffffff !important;
    border-color: #cbd5e1 !important;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.07) !important;
}

html.dark #ladder-modal .ladder-row,
html[data-theme="dark"] #ladder-modal .ladder-row,
body.dark #ladder-modal .ladder-row {
    background: rgba(30, 41, 59, 0.75) !important;
    border: 1px solid rgba(51, 65, 85, 0.6) !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25) !important;
}
html.dark #ladder-modal .ladder-row:hover,
html[data-theme="dark"] #ladder-modal .ladder-row:hover,
body.dark #ladder-modal .ladder-row:hover {
    background: rgba(30, 41, 59, 0.95) !important;
    border-color: rgba(99, 102, 241, 0.4) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4) !important;
}

/* Avatar Box */
#ladder-modal .ladder-avatar-box {
    position: relative !important;
    width: 44px !important;
    height: 44px !important;
    flex-shrink: 0 !important;
    border-radius: 50% !important;
    overflow: visible !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12) !important;
    border: 1px solid var(--game-border, rgba(255, 255, 255, 0.15)) !important;
}
html:not(.dark) #ladder-modal .ladder-avatar-box {
    background: #f1f5f9 !important;
}
html.dark #ladder-modal .ladder-avatar-box,
html[data-theme="dark"] #ladder-modal .ladder-avatar-box,
body.dark #ladder-modal .ladder-avatar-box {
    background: #0f172a !important;
}

#ladder-modal .ladder-avatar {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    border-radius: 50% !important;
}

/* Name */
#ladder-modal .ladder-name {
    font-size: 13.5px !important;
    font-weight: 750 !important;
    letter-spacing: 0.01em !important;
    display: block !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}

html:not(.dark) #ladder-modal .ladder-name {
    color: #0f172a !important;
}
html.dark #ladder-modal .ladder-name,
html[data-theme="dark"] #ladder-modal .ladder-name,
body.dark #ladder-modal .ladder-name {
    color: #f8fafc !important;
}

/* Rank Badge */
#ladder-modal .ladder-rank-name {
    font-size: 10px !important;
    font-weight: 700 !important;
    padding: 2px 8px !important;
    border-radius: 9999px !important;
    display: inline-block !important;
    white-space: nowrap !important;
    line-height: 1.3 !important;
    border-width: 1px !important;
    border-style: solid !important;
}

html:not(.dark) #ladder-modal .ladder-rank-name {
    background: rgba(241, 245, 249, 0.95) !important;
    text-shadow: none !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04) !important;
}

html.dark #ladder-modal .ladder-rank-name,
html[data-theme="dark"] #ladder-modal .ladder-rank-name,
body.dark #ladder-modal .ladder-rank-name {
    background: rgba(15, 23, 42, 0.85) !important;
    text-shadow: none !important;
}

@media (max-width: 480px) {
    #ladder-modal .ladder-rank-name {
        font-size: 9px !important;
        padding: 1.5px 6px !important;
        max-width: 210px !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
    }
}

/* Sub text - Triệt tiêu hoàn toàn hiệu ứng bóng mờ (text-shadow) */
#ladder-modal .ladder-sub {
    font-size: 11px !important;
    margin-top: 3px !important;
    line-height: 1.4 !important;
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 4px 8px !important;
    align-items: center !important;
    text-shadow: none !important;
}

#ladder-modal .ladder-sub *,
#ladder-modal .val-pwr,
#ladder-modal .val-exp {
    text-shadow: none !important;
    filter: none !important;
}

html:not(.dark) #ladder-modal .ladder-sub {
    color: #64748b !important;
}
html.dark #ladder-modal .ladder-sub,
html[data-theme="dark"] #ladder-modal .ladder-sub,
body.dark #ladder-modal .ladder-sub {
    color: #94a3b8 !important;
}

/* Sub items */
html:not(.dark) #ladder-modal .val-pwr {
    color: #d97706 !important;
    font-weight: 700 !important;
}
html.dark #ladder-modal .val-pwr,
html[data-theme="dark"] #ladder-modal .val-pwr,
body.dark #ladder-modal .val-pwr {
    color: #fbbf24 !important;
    font-weight: 700 !important;
}

html:not(.dark) #ladder-modal .val-exp {
    color: #0284c7 !important;
    font-weight: 700 !important;
}
html.dark #ladder-modal .val-exp,
html[data-theme="dark"] #ladder-modal .val-exp,
body.dark #ladder-modal .val-exp {
    color: #38bdf8 !important;
    font-weight: 700 !important;
}

html:not(.dark) #ladder-modal .ladder-squad-info {
    color: #64748b !important;
}
html.dark #ladder-modal .ladder-squad-info,
html[data-theme="dark"] #ladder-modal .ladder-squad-info,
body.dark #ladder-modal .ladder-squad-info {
    color: #94a3b8 !important;
}

/* TÔI Badge */
#ladder-modal .ladder-me {
    font-size: 10px !important;
    font-weight: 800 !important;
    padding: 3px 8px !important;
    border-radius: 6px !important;
    display: inline-block !important;
    line-height: 1 !important;
    letter-spacing: 0.5px !important;
    text-shadow: none !important;
}
html:not(.dark) #ladder-modal .ladder-me {
    background: #ecfdf5 !important;
    color: #059669 !important;
    border: 1px solid #a7f3d0 !important;
    box-shadow: 0 1px 3px rgba(5, 150, 105, 0.12) !important;
}
html.dark #ladder-modal .ladder-me,
html[data-theme="dark"] #ladder-modal .ladder-me,
body.dark #ladder-modal .ladder-me {
    background: rgba(16, 185, 129, 0.16) !important;
    color: #34d399 !important;
    border: 1px solid rgba(16, 185, 129, 0.4) !important;
}

/* Action buttons - Thiết kế lại màu sắc hài hòa cao cấp cho 2 nút (Ảnh 3) */
html #ladder-modal .ladder-btn,
#ladder-modal .ladder-btn {
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    min-height: 32px !important;
    border-radius: 9px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease !important;
    font-size: 15px !important;
    line-height: 1 !important;
    box-sizing: border-box !important;
    margin: 0 !important;
    padding: 0 !important;
    outline: none !important;
    border-width: 1px !important;
    border-style: solid !important;
    user-select: none !important;
}
html #ladder-modal .ladder-btn:hover,
#ladder-modal .ladder-btn:hover {
    transform: scale(1.08) !important;
}
html #ladder-modal .ladder-btn:active,
#ladder-modal .ladder-btn:active {
    transform: scale(0.95) !important;
}

/* Nút 1: Thách Đấu (Challenge 📚) - Tone Xanh Biển Indigo thanh lịch */
html:not(.dark) #ladder-modal .ladder-btn-challenge,
html:not(.dark) #ladder-modal div.ladder-btn:first-child,
html:not(.dark) #ladder-modal button.ladder-btn:first-child {
    background: #eff6ff !important;
    border-color: #bfdbfe !important;
    box-shadow: 0 1px 3px rgba(37, 99, 235, 0.1) !important;
}
html:not(.dark) #ladder-modal .ladder-btn-challenge:hover,
html:not(.dark) #ladder-modal div.ladder-btn:first-child:hover,
html:not(.dark) #ladder-modal button.ladder-btn:first-child:hover {
    background: #dbeafe !important;
    border-color: #93c5fd !important;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.2) !important;
}

html.dark #ladder-modal .ladder-btn-challenge,
html.dark #ladder-modal div.ladder-btn:first-child,
html.dark #ladder-modal button.ladder-btn:first-child,
html[data-theme="dark"] #ladder-modal .ladder-btn-challenge,
body.dark #ladder-modal .ladder-btn-challenge {
    background: rgba(30, 58, 138, 0.45) !important;
    border-color: rgba(96, 165, 250, 0.4) !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3) !important;
}
html.dark #ladder-modal .ladder-btn-challenge:hover,
html.dark #ladder-modal div.ladder-btn:first-child:hover,
html.dark #ladder-modal button.ladder-btn:first-child:hover,
html[data-theme="dark"] #ladder-modal .ladder-btn-challenge:hover,
body.dark #ladder-modal .ladder-btn-challenge:hover {
    background: rgba(30, 58, 138, 0.75) !important;
    border-color: rgba(96, 165, 250, 0.7) !important;
    box-shadow: 0 3px 10px rgba(37, 99, 235, 0.35) !important;
}

/* Nút 2: Cờ Tiên / TFT (Chess ♟️) - Tone Tím Quý Phái Amethyst */
html:not(.dark) #ladder-modal .ladder-btn-tft,
html:not(.dark) #ladder-modal div.ladder-btn:last-child,
html:not(.dark) #ladder-modal button.ladder-btn:last-child {
    background: #faf5ff !important;
    border-color: #e9d5ff !important;
    box-shadow: 0 1px 3px rgba(147, 51, 234, 0.1) !important;
}
html:not(.dark) #ladder-modal .ladder-btn-tft:hover,
html:not(.dark) #ladder-modal div.ladder-btn:last-child:hover,
html:not(.dark) #ladder-modal button.ladder-btn:last-child:hover {
    background: #f3e8ff !important;
    border-color: #d8b4fe !important;
    box-shadow: 0 2px 8px rgba(147, 51, 234, 0.2) !important;
}

html.dark #ladder-modal .ladder-btn-tft,
html.dark #ladder-modal div.ladder-btn:last-child,
html.dark #ladder-modal button.ladder-btn:last-child,
html[data-theme="dark"] #ladder-modal .ladder-btn-tft,
body.dark #ladder-modal .ladder-btn-tft {
    background: rgba(88, 28, 135, 0.45) !important;
    border-color: rgba(192, 132, 252, 0.4) !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3) !important;
}
html.dark #ladder-modal .ladder-btn-tft:hover,
html.dark #ladder-modal div.ladder-btn:last-child:hover,
html.dark #ladder-modal button.ladder-btn:last-child:hover,
html[data-theme="dark"] #ladder-modal .ladder-btn-tft:hover,
body.dark #ladder-modal .ladder-btn-tft:hover {
    background: rgba(88, 28, 135, 0.75) !important;
    border-color: rgba(192, 132, 252, 0.7) !important;
    box-shadow: 0 3px 10px rgba(147, 51, 234, 0.35) !important;
}

/* Unranked me */
html:not(.dark) #ladder-modal .ladder-row-me-unranked {
    border: 1px dashed #cbd5e1 !important;
    background: #f8fafc !important;
}
html.dark #ladder-modal .ladder-row-me-unranked,
html[data-theme="dark"] #ladder-modal .ladder-row-me-unranked,
body.dark #ladder-modal .ladder-row-me-unranked {
    border: 1px dashed #475569 !important;
    background: rgba(15, 23, 42, 0.6) !important;
}

/* Couples Ladder */
#ladder-modal .ladder-level-badge {
    position: absolute !important;
    bottom: -2px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    font-size: 9px !important;
    font-weight: 800 !important;
    text-align: center !important;
    padding: 1px 4px !important;
    border-radius: 4px !important;
    white-space: nowrap !important;
    line-height: 1.1 !important;
}
html:not(.dark) #ladder-modal .ladder-level-badge {
    background: #ffffff !important;
    color: #d97706 !important;
    border: 1px solid #f59e0b !important;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1) !important;
}
html.dark #ladder-modal .ladder-level-badge,
html[data-theme="dark"] #ladder-modal .ladder-level-badge,
body.dark #ladder-modal .ladder-level-badge {
    background: rgba(15, 23, 42, 0.9) !important;
    color: #ffd700 !important;
    border: 1px solid #c8aa6e !important;
}

html:not(.dark) #ladder-modal .ladder-couple-tier {
    color: #d97706 !important;
    font-weight: 700 !important;
}
html.dark #ladder-modal .ladder-couple-tier,
html[data-theme="dark"] #ladder-modal .ladder-couple-tier,
body.dark #ladder-modal .ladder-couple-tier {
    color: #fbbf24 !important;
    font-weight: 700 !important;
}

html:not(.dark) #ladder-modal .ladder-couple-pts {
    margin-left: 10px !important;
    color: #e11d48 !important;
    font-weight: 700 !important;
}
html.dark #ladder-modal .ladder-couple-pts,
html[data-theme="dark"] #ladder-modal .ladder-couple-pts,
body.dark #ladder-modal .ladder-couple-pts {
    margin-left: 10px !important;
    color: #fb7185 !important;
    font-weight: 700 !important;
}

/* Loading & Empty */
html:not(.dark) #ladder-modal .ladder-empty-state {
    color: #64748b !important;
}
html.dark #ladder-modal .ladder-empty-state,
html[data-theme="dark"] #ladder-modal .ladder-empty-state,
body.dark #ladder-modal .ladder-empty-state {
    color: #94a3b8 !important;
}

/* --------------------------------------------------------------------------
   9. LỊCH SỬ ĐẤU TRÍ (QUIZ HISTORY TAB) — HỖ TRỢ TOÀN DIỆN NỀN SÁNG & NỀN TỐI
   -------------------------------------------------------------------------- */
#chat-modal .chat-body .quiz-history-container {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    width: 100% !important;
    box-sizing: border-box !important;
    display: flex !important;
    flex-direction: column !important;
    overflow-y: auto !important;
}

#chat-modal .chat-body .quiz-history-filter-bar {
    display: flex !important;
    gap: 6px !important;
    overflow-x: auto !important;
    padding-bottom: 6px !important;
    margin-bottom: 2px !important;
    flex-shrink: 0 !important;
    min-height: 36px !important;
    align-items: center !important;
    scrollbar-width: none !important;
    -webkit-overflow-scrolling: touch !important;
}

#chat-modal .chat-body .quiz-history-filter-bar button {
    flex-shrink: 0 !important;
    white-space: nowrap !important;
    transition: all 0.2s ease !important;
}

/* ================== LIGHT THEME (GIAO DIỆN TRẮNG) ================== */
html:not(.dark) #chat-modal .chat-body {
    background: #f8fafc !important;
    color: #0f172a !important;
}

/* 1. Nút lọc danh mục */
html:not(.dark) #chat-modal .chat-body .quiz-history-filter-bar button:not(.is-active) {
    background: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    color: #334155 !important;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05) !important;
}
html:not(.dark) #chat-modal .chat-body .quiz-history-filter-bar button:not(.is-active):hover {
    background: #f1f5f9 !important;
    border-color: #94a3b8 !important;
    color: #0f172a !important;
}
html:not(.dark) #chat-modal .chat-body .quiz-history-filter-bar button.is-active:not(.is-red),
#chat-modal .chat-body .quiz-history-filter-bar button.is-active:not(.is-red),
#chat-modal .chat-body button.quiz-history-filter-btn.is-active:not(.is-red) {
    background: linear-gradient(135deg, #4f46e5, #6366f1) !important;
    border: 1px solid #4338ca !important;
    color: #ffffff !important;
    box-shadow: 0 3px 10px rgba(79, 70, 229, 0.35) !important;
}

html:not(.dark) #chat-modal .chat-body .quiz-history-filter-bar button.is-active.is-red,
#chat-modal .chat-body .quiz-history-filter-bar button.is-active.is-red,
#chat-modal .chat-body button.quiz-history-filter-btn.is-active.is-red {
    background: linear-gradient(135deg, #ef4444, #dc2626) !important;
    border: 1px solid #dc2626 !important;
    color: #ffffff !important;
    box-shadow: 0 3px 10px rgba(239, 68, 68, 0.35) !important;
}

/* 2. Thanh tổng kết số trận */
html:not(.dark) #chat-modal .chat-body .quiz-history-stats-bar {
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    color: #475569 !important;
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.04) !important;
}
html:not(.dark) #chat-modal .chat-body .quiz-history-stats-bar .quiz-stat-total {
    color: #0f172a !important;
    font-weight: 800 !important;
}
html:not(.dark) #chat-modal .chat-body .quiz-history-stats-bar .quiz-stat-win {
    color: #16a34a !important;
    font-weight: 800 !important;
}
html:not(.dark) #chat-modal .chat-body .quiz-history-stats-bar .quiz-stat-wrong {
    color: #dc2626 !important;
    font-weight: 800 !important;
}

/* 3. Banner Ôn tập câu sai */
html:not(.dark) #chat-modal .chat-body .quiz-history-wrong-banner {
    background: linear-gradient(135deg, #f5f3ff, #ede9fe) !important;
    border: 1px solid #c4b5fd !important;
    box-shadow: 0 4px 14px rgba(124, 58, 237, 0.08) !important;
}
html:not(.dark) #chat-modal .chat-body .quiz-history-wrong-banner .quiz-wrong-title {
    color: #5b21b6 !important;
}
html:not(.dark) #chat-modal .chat-body .quiz-history-wrong-banner .quiz-wrong-count {
    background: #ddd6fe !important;
    color: #5b21b6 !important;
}
html:not(.dark) #chat-modal .chat-body .quiz-history-wrong-banner .quiz-wrong-desc {
    color: #6d28d9 !important;
}

/* 4. Thẻ trận đấu (Match Card) trên nền trắng */
html:not(.dark) #chat-modal .chat-body .quiz-history-card {
    background: #ffffff !important;
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.05) !important;
}
html:not(.dark) #chat-modal .chat-body .quiz-history-card.is-win {
    border: 1.5px solid #86efac !important;
    background: linear-gradient(180deg, #f0fdf4 0%, #ffffff 50%) !important;
}
html:not(.dark) #chat-modal .chat-body .quiz-history-card.is-loss {
    border: 1.5px solid #fca5a5 !important;
    background: linear-gradient(180deg, #fef2f2 0%, #ffffff 50%) !important;
}

/* Header trận đấu */
html:not(.dark) #chat-modal .chat-body .quiz-history-card .quiz-card-date {
    color: #64748b !important;
    font-weight: 500 !important;
}
html:not(.dark) #chat-modal .chat-body .quiz-history-card .quiz-card-opponent {
    color: #0f172a !important;
    font-weight: 700 !important;
}

/* Huy hiệu Thắng/Thua */
html:not(.dark) #chat-modal .chat-body .quiz-history-card .quiz-card-badge-win {
    background: #dcfce7 !important;
    color: #15803d !important;
    border: 1px solid #86efac !important;
}
html:not(.dark) #chat-modal .chat-body .quiz-history-card .quiz-card-badge-loss {
    background: #fee2e2 !important;
    color: #b91c1c !important;
    border: 1px solid #fca5a5 !important;
}

/* Phần thưởng */
html:not(.dark) #chat-modal .chat-body .quiz-history-card .quiz-card-reward.is-win {
    background: #fef3c7 !important;
    border: 1px solid #fde68a !important;
    color: #b45309 !important;
    font-weight: 700 !important;
}
html:not(.dark) #chat-modal .chat-body .quiz-history-card .quiz-card-reward.is-loss {
    background: #f1f5f9 !important;
    border: 1px solid #e2e8f0 !important;
    color: #475569 !important;
    font-weight: 600 !important;
}

/* Câu hỏi tiếng Hàn & Dịch nghĩa tiếng Việt */
html:not(.dark) #chat-modal .chat-body .quiz-history-card .quiz-card-question {
    color: #0f172a !important;
    font-weight: 750 !important;
}
html:not(.dark) #chat-modal .chat-body .quiz-history-card .quiz-card-trans {
    color: #334155 !important;
}
html:not(.dark) #chat-modal .chat-body .quiz-history-card .quiz-card-img-hint {
    color: #64748b !important;
}

/* Nút phát âm audio */
html:not(.dark) #chat-modal .chat-body .quiz-history-card .history-audio-btn {
    background: #f0fdf4 !important;
    border: 1px solid #86efac !important;
    color: #15803d !important;
}
html:not(.dark) #chat-modal .chat-body .quiz-history-card .history-audio-btn:hover {
    background: #dcfce7 !important;
    border-color: #4ade80 !important;
}

/* Dòng Lựa chọn / Đáp án */
html:not(.dark) #chat-modal .chat-body .quiz-history-card .quiz-card-answers {
    border-top: 1px solid #e2e8f0 !important;
}
html:not(.dark) #chat-modal .chat-body .quiz-history-card .quiz-ans-label {
    color: #64748b !important;
}
html:not(.dark) #chat-modal .chat-body .quiz-history-card .quiz-ans-correct {
    color: #15803d !important;
    font-weight: 750 !important;
}
html:not(.dark) #chat-modal .chat-body .quiz-history-card .quiz-ans-wrong {
    color: #dc2626 !important;
    font-weight: 750 !important;
}

/* Khung Giải thích */
html:not(.dark) #chat-modal .chat-body .quiz-history-card .quiz-card-explain {
    background: #fffbeb !important;
    border: 1px solid #fef08a !important;
    color: #78350f !important;
}
html:not(.dark) #chat-modal .chat-body .quiz-history-card .quiz-card-explain .quiz-explain-title {
    color: #b45309 !important;
    font-weight: 800 !important;
}

/* Nút Luyện lại câu này */
html:not(.dark) #chat-modal .chat-body .quiz-history-card .quiz-card-practice-btn {
    background: #f5f3ff !important;
    border: 1px solid #c4b5fd !important;
    color: #6d28d9 !important;
}
html:not(.dark) #chat-modal .chat-body .quiz-history-card .quiz-card-practice-btn:hover {
    background: #ede9fe !important;
    color: #5b21b6 !important;
    border-color: #a78bfa !important;
}

/* Huy hiệu chuyên mục */
html:not(.dark) #chat-modal .chat-body .quiz-cat-badge {
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04) !important;
}
html:not(.dark) #chat-modal .chat-body .quiz-cat-badge[style*="#cbd5e1"] {
    color: #334155 !important;
    background: #f1f5f9 !important;
    border-color: #cbd5e1 !important;
}

/* ================== DARK THEME (GIAO DIỆN TỐI) ================== */
html.dark #chat-modal .chat-body .quiz-history-filter-bar button:not(.is-active) {
    background: rgba(255, 255, 255, 0.06) !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    color: #9ca3af !important;
}
html.dark #chat-modal .chat-body .quiz-history-filter-bar button:not(.is-active):hover {
    background: rgba(255, 255, 255, 0.1) !important;
    color: #f1f5f9 !important;
}
html.dark #chat-modal .chat-body .quiz-history-filter-bar button.is-active:not(.is-red),
html.dark #chat-modal .chat-body button.quiz-history-filter-btn.is-active:not(.is-red) {
    background: linear-gradient(135deg, #6366f1, #4f46e5) !important;
    border: 1px solid #6366f1 !important;
    color: #ffffff !important;
    box-shadow: 0 3px 12px rgba(99, 102, 241, 0.45) !important;
}
html.dark #chat-modal .chat-body .quiz-history-filter-bar button.is-active.is-red,
html.dark #chat-modal .chat-body button.quiz-history-filter-btn.is-active.is-red {
    background: linear-gradient(135deg, #ef4444, #dc2626) !important;
    border: 1px solid #ef4444 !important;
    color: #ffffff !important;
    box-shadow: 0 3px 12px rgba(239, 68, 68, 0.45) !important;
}
html.dark #chat-modal .chat-body .quiz-history-stats-bar {
    background: rgba(255, 255, 255, 0.03) !important;
    border: 1px solid rgba(255, 255, 255, 0.06) !important;
    color: #9ca3af !important;
}
html.dark #chat-modal .chat-body .quiz-history-stats-bar .quiz-stat-total {
    color: #ffffff !important;
}
html.dark #chat-modal .chat-body .quiz-history-stats-bar .quiz-stat-win {
    color: #4ade80 !important;
}
html.dark #chat-modal .chat-body .quiz-history-stats-bar .quiz-stat-wrong {
    color: #f87171 !important;
}
html.dark #chat-modal .chat-body .quiz-history-card {
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3) !important;
}
html.dark #chat-modal .chat-body .quiz-history-card.is-win {
    background: rgba(34, 197, 94, 0.05) !important;
    border: 1px solid rgba(34, 197, 94, 0.25) !important;
}
html.dark #chat-modal .chat-body .quiz-history-card.is-loss {
    background: rgba(239, 68, 68, 0.05) !important;
    border: 1px solid rgba(239, 68, 68, 0.25) !important;
}
html.dark #chat-modal .chat-body .quiz-history-card .quiz-card-date {
    color: #9ca3af !important;
}
html.dark #chat-modal .chat-body .quiz-history-card .quiz-card-opponent {
    color: #f1f5f9 !important;
}
html.dark #chat-modal .chat-body .quiz-history-card .quiz-card-question {
    color: #f3f4f6 !important;
}
html.dark #chat-modal .chat-body .quiz-history-card .quiz-card-trans {
    color: #cbd5e1 !important;
}
html.dark #chat-modal .chat-body .quiz-history-card .quiz-card-img-hint {
    color: #94a3b8 !important;
}
html.dark #chat-modal .chat-body .quiz-history-card .quiz-card-explain {
    background: rgba(234, 179, 8, 0.07) !important;
    border: 1px solid rgba(234, 179, 8, 0.22) !important;
    color: #fde68a !important;
}
html.dark #chat-modal .chat-body .quiz-history-card .quiz-card-explain .quiz-explain-title {
    color: #fbbf24 !important;
}
html.dark #chat-modal .chat-body .quiz-history-card .quiz-card-practice-btn {
    background: rgba(124, 58, 237, 0.15) !important;
    border: 1px solid rgba(124, 58, 237, 0.35) !important;
    color: #c4b5fd !important;
}
html.dark #chat-modal .chat-body .quiz-history-empty {
    color: #64748b !important;
}

/* ================== MODAL TỔNG KẾT ÔN TẬP ================== */
html:not(.dark) .pvp-quiz-dialog .pvp-summary-body {
    color: #0f172a !important;
}
html:not(.dark) .pvp-quiz-dialog .pvp-summary-subtext {
    color: #475569 !important;
}
html:not(.dark) .pvp-quiz-dialog .pvp-summary-reward-box {
    background: rgba(15, 23, 42, 0.04) !important;
    border: 1px solid #cbd5e1 !important;
}
html:not(.dark) .pvp-quiz-dialog .pvp-summary-unit {
    color: #64748b !important;
}
html.dark .pvp-quiz-dialog .pvp-summary-body {
    color: #f0e6d2 !important;
}
html.dark .pvp-quiz-dialog .pvp-summary-subtext {
    color: #9ca3af !important;
}
html.dark .pvp-quiz-dialog .pvp-summary-reward-box {
    background: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
}
html.dark .pvp-quiz-dialog .pvp-summary-unit {
    color: #888888 !important;
}

/* Nút mời vào phòng PvP trong chat */
#chat-modal button[onclick*="joinRoom"] {
    background: linear-gradient(135deg, #4f46e5, #6366f1) !important;
    border: none !important;
    color: #ffffff !important;
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.35) !important;
}

