* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Quicksand', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

button, input, select, textarea {
    font-family: inherit;
}

body {
    background: 
        radial-gradient(circle at 20% 30%, rgba(244, 114, 182, 0.22) 0%, transparent 40%), 
        radial-gradient(circle at 80% 40%, rgba(253, 224, 71, 0.22) 0%, transparent 40%), 
        #c1ebd9 !important; /* Màu nền chủ đạo xanh mint */
    background-attachment: fixed !important;
    overflow-x: hidden;
    padding-bottom: 70px !important; /* Chừa khoảng trống để thanh đất Mario không che khuất nội dung */
}

/* Phần đất Super Mario World 1-1 nguyên bản (Cỏ xanh trên cùng, đất gạch nâu nung) */
.mario-ground {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 48px;
    z-index: 10;
    pointer-events: none;
    background-color: #c84c0c;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='48' viewBox='0 0 32 48'%3E%3Crect x='0' y='0' width='100%25' height='100%25' fill='%23c84c0c'/%3E%3Crect x='0' y='12' width='100%25' height='2' fill='%23451a03'/%3E%3Crect x='0' y='30' width='100%25' height='2' fill='%23451a03'/%3E%3Crect x='15' y='12' width='2' height='18' fill='%23451a03'/%3E%3Crect x='0' y='30' width='2' height='18' fill='%23451a03'/%3E%3Crect x='30' y='30' width='2' height='18' fill='%23451a03'/%3E%3Crect x='2' y='16' width='11' height='2' fill='%23ea7c3a' opacity='0.7'/%3E%3Crect x='19' y='16' width='11' height='2' fill='%23ea7c3a' opacity='0.7'/%3E%3Crect x='4' y='34' width='24' height='2' fill='%23ea7c3a' opacity='0.7'/%3E%3Crect x='0' y='0' width='100%25' height='3' fill='%234ade80'/%3E%3Crect x='0' y='3' width='100%25' height='7' fill='%2300a800'/%3E%3Crect x='0' y='10' width='100%25' height='2' fill='%23004d00'/%3E%3C/svg%3E");
    background-repeat: repeat-x;
    background-position: bottom left;
    background-size: 32px 48px;
    box-shadow: 0 -3px 8px rgba(0, 0, 0, 0.15);
}

/* Vẽ đám mây chuẩn kiểu icon Mario (đáy phẳng, vòm tròn bên trên) dùng thuần CSS */
.cloud-retro {
    position: absolute;
    width: 120px;
    height: 45px;
    background: #ffffff;
    border-radius: 50px;
    box-shadow: 0 4px 0 rgba(0, 0, 0, 0.05);
    z-index: 0;
}

/* Tạo các vòm tròn bên trên đám mây */
.cloud-retro::before {
    content: "";
    position: absolute;
    top: -20px;
    left: 20px;
    width: 50px;
    height: 50px;
    background: #ffffff;
    border-radius: 50%;
}

.cloud-retro::after {
    content: "";
    position: absolute;
    top: -12px;
    left: 55px;
    width: 40px;
    height: 40px;
    background: #ffffff;
    border-radius: 50%;
}

/* Đặt vị trí các đám mây trên màn hình */
.cloud-1 { 
    top: 15%; 
    left: 10%; 
    transform: scale(1.2); 
    animation: floatCloud1 25s linear infinite;
}
.cloud-2 { 
    top: 25%; 
    right: 12%; 
    transform: scale(0.9); 
    animation: floatCloud2 35s linear infinite;
}
.cloud-3 { 
    top: 22%; 
    left: 10%; 
    transform: scale(0.9); 
    animation: floatCloud3 45s linear infinite;
}

body::before {
    content: "";
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.08) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.08) 1px, transparent 1px)!important;

    background-size: 16px 16px !important;
    pointer-events: none;
    z-index: 0;
}
/* Hiệu ứng cloud */
@keyframes floatCloud1 {
    0% { left: -150px; }
    100% { left: 105vw; }
}

@keyframes floatCloud2 {
    0% { right: -150px; }
    100% { right: 105vw; }
}
@keyframes floatCloud3 {
    0% { left: -150px; }
    100% { left: 105vw; }
}

/* Vùng chứa các ngôi sao ngẫu nhiên (chỉ phủ ở khoảng 40% bầu trời phía trên) */
.starry-sky {
    position: absolute;
    top: 60px;
    left: 0;
    width: 100vw;
    height: calc(100vh - 105px);
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

/* Kiểu dáng ngôi sao Pixel  */
.random-star {
    position: absolute;
    color: #ffffff;
    pointer-events: none;
    z-index: 0;
    line-height: 1;
    user-select: none;
    animation: starTwinkle 2s ease-in-out infinite alternate !important;
}

/* Hiệu ứng nhấp lánh thu phóng và phát sáng dịu nhẹ cho ngôi sao */
@keyframes starTwinkle {
    0% {
        opacity: 0.25;
        transform: scale(0.85);
    }
    100% {
        opacity: 1;
        transform: scale(1.25);
        text-shadow: 0 0 8px rgba(255, 255, 255, 0.9), 0 0 12px rgba(254, 240, 138, 0.6);
    }
}


/* Nút Bật Lại Navbar Nổi Xinh Xắn (Floating Pill Button khi Navbar thu gọn) */
.nav-reopen-pill {
    position: fixed;
    top: 10px;
    right: 14px;
    z-index: 1000;
    display: none;
    align-items: center;
    gap: 6px;
    padding: 7px 15px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.95) !important;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1.5px solid #fbcfe8 !important;
    box-shadow: 0 4px 18px rgba(219, 39, 119, 0.2) !important;
    color: #db2777 !important;
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}
.nav-reopen-pill.show {
    display: inline-flex !important;
    animation: pillBounce 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.nav-reopen-pill:hover {
    background: #fdf2f8 !important;
    transform: translateY(1px);
    border-color: #f472b6 !important;
}
.nav-reopen-pill:active {
    transform: scale(0.92);
}

@keyframes pillBounce {
    0% { transform: translateY(-25px) scale(0.8); opacity: 0; }
    100% { transform: translateY(0) scale(1); opacity: 1; }
}

/* Header Navbar Super Mario & Retro Pastel - Đồng bộ trong suốt mờ ảo (Glassmorphism) cùng Background */
header, .navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 32px;
    background: rgba(255, 255, 255, 0.4) !important;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1.5px solid rgba(244, 114, 182, 0.28) !important; 
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.03) !important;
    position: sticky;
    top: 0;
    z-index: 2000 !important; /* Luôn nổi cao hơn mọi div trên trang để dropdown hiển thị ở trên */
    transition: all 0.25s ease;
}

/* Khối bên phải Navbar chứa nút Menu 3 gạch & Dropdown menu */
.navbar-right-box {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

/* Nút 3 Gạch (Hamburger Button) - Áp dụng cho tất cả các trang, luôn nằm bên phải trên PC & Mobile */
.btn-nav-hamburger {
    display: inline-flex !important; /* Luôn hiển thị trên mọi trang */
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 6px 14px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.88);
    border: 2px solid #f472b6;
    color: #db2777;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(244, 114, 182, 0.2);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.btn-nav-hamburger:hover {
    background: #fdf2f8;
    transform: scale(1.04);
    box-shadow: 0 4px 12px rgba(244, 114, 182, 0.3);
}

.btn-nav-hamburger:active {
    transform: scale(0.94);
}

.btn-nav-hamburger.is-active {
    background: rgba(253, 242, 248, 0.98);
    border-color: #db2777;
}

.hamburger-box {
    width: 20px;
    height: 15px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
}

.hamburger-line {
    display: block;
    width: 100%;
    height: 2.5px;
    background: #e11d48;
    border-radius: 4px;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s ease;
}

/* Hiệu ứng morph 3 gạch thành dấu ✕ khi Menu mở */
.btn-nav-hamburger.is-active .line-1 {
    transform: translateY(6.25px) rotate(45deg);
}
.btn-nav-hamburger.is-active .line-2 {
    opacity: 0;
    transform: scaleX(0);
}
.btn-nav-hamburger.is-active .line-3 {
    transform: translateY(-6.25px) rotate(-45deg);
}

.hamburger-text {
    font-size: 13px;
    font-weight: 800;
    color: #db2777;
    letter-spacing: -0.2px;
}

/* Danh sách menu điều hướng: Mặc định ẩn trên tất cả các trang */
.navbar .navbar-nav {
    display: none !important;
}

/* Khi người dùng bấm nút 3 gạch: Menu bung dạng dropdown floating ở TRÊN các div bên dưới */
.navbar.menu-open .navbar-nav {
    display: flex !important;
    position: absolute !important;
    top: calc(100% + 10px) !important;
    right: 0 !important;
    flex-direction: column !important;
    min-width: 240px !important;
    gap: 8px !important;
    padding: 14px !important;
    background: rgba(255, 255, 255, 0.98) !important;
    backdrop-filter: blur(20px) !important;
    -webkit-backdrop-filter: blur(20px) !important;
    border-radius: 18px !important;
    border: 2px solid #fbcfe8 !important;
    box-shadow: 0 16px 40px rgba(244, 114, 182, 0.28), 0 4px 16px rgba(0, 0, 0, 0.08) !important;
    z-index: 2500 !important; /* Đảm bảo luôn nằm ở trên div bên dưới */
    animation: navDropdownDesktop 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.navbar.menu-open .navbar-nav li {
    width: 100% !important;
    list-style: none !important;
}

.navbar.menu-open .navbar-nav .nav-item,
.navbar.menu-open .navbar-nav .user-badge,
.navbar.menu-open .navbar-nav .btn-user-name {
    width: 100% !important;
    justify-content: flex-start !important;
    padding: 10px 14px !important;
    box-sizing: border-box !important;
}

@keyframes navDropdownDesktop {
    0% { opacity: 0; transform: translateY(-10px) scale(0.96); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes navDropdownMobile {
    0% { opacity: 0; transform: translateY(-8px); }
    100% { opacity: 1; transform: translateY(0); }
}

.navbar-header-line {
    display: flex;
    align-items: center;
    gap: 12px;
}

.btn-toggle-nav-mobile {
    display: none;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    font-size: 22px;
    font-weight: 800;
    color: #e11d48 !important;
    text-shadow: 1px 1px 0px #fde047;
    transition: transform 0.15s ease;
}

.navbar-brand:hover {
    transform: scale(1.03);
}

.navbar-brand .brand-icon {
    font-size: 26px;
    line-height: 1;
    filter: drop-shadow(0 2px 4px rgba(239, 68, 68, 0.25));
}

.navbar-brand .brand-text {
    font-weight: 800;
    letter-spacing: -0.5px;
}

.navbar-nav {
    display: flex;
    gap: 10px;
    align-items: center;
    list-style: none;
    margin: 0;
    padding: 0;
}

.navbar-nav li {
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    color: #831843 !important;
    font-size: 14px;
    font-weight: 700;
    padding: 8px 16px;
    border-radius: 12px !important;
    background: rgba(255, 255, 255, 0.45) !important;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1.5px solid rgba(255, 255, 255, 0.65) !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04) !important;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.78) !important;
    color: #9d174d !important;
    border-color: rgba(244, 114, 182, 0.65) !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 14px rgba(244, 114, 182, 0.2) !important;
}

.nav-item:active {
    transform: translateY(1px);
    box-shadow: 0 1px 4px rgba(244, 114, 182, 0.2) !important;
}

/* Nút Mario & Chat đồng bộ trong suốt pastel */
.nav-item.nav-mario {
    background: rgba(254, 240, 138, 0.5) !important;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1.5px solid rgba(245, 158, 11, 0.55) !important;
    color: #854d0e !important;
    box-shadow: 0 2px 8px rgba(217, 119, 6, 0.12) !important;
    font-weight: 800;
}

.nav-item.nav-mario:hover {
    background: rgba(254, 240, 138, 0.82) !important;
    color: #78350f !important;
    border-color: rgba(217, 119, 6, 0.7) !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 14px rgba(217, 119, 6, 0.22) !important;
}

/* Nút Admin */
.nav-item.nav-admin {
    background: rgba(241, 245, 249, 0.5) !important;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1.5px solid rgba(148, 163, 184, 0.55) !important;
    color: #334155 !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04) !important;
}

/* Đánh dấu trang hiện tại (Active Page) trên Menu Navbar */
.navbar-nav .nav-item.active,
.navbar-nav .nav-item.nav-mario.active,
.navbar-nav .nav-item.nav-admin.active {
    background: linear-gradient(135deg, #f43f5e, #db2777) !important;
    color: #ffffff !important;
    border: 2px solid #fda4af !important;
    box-shadow: 0 4px 16px rgba(225, 29, 72, 0.45) !important;
    font-weight: 800 !important;
}

.nav-active-badge {
    margin-left: auto;
    background: rgba(255, 255, 255, 0.35);
    color: #ffffff;
    font-size: 11px;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.6);
    letter-spacing: -0.2px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.nav-item.nav-admin:hover {
    background: rgba(241, 245, 249, 0.85) !important;
    border-color: rgba(100, 116, 139, 0.7) !important;
    color: #0f172a !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 14px rgba(100, 116, 139, 0.2) !important;
}

@media (max-width: 768px) {
    header, .navbar {
        padding: 8px 14px !important;
        flex-direction: row !important; /* 1 hàng duy nhất: Tên bên trái, Nút 3 gạch bên phải */
        justify-content: space-between !important;
        align-items: center !important;
        position: sticky !important;
        top: 0 !important;
        z-index: 2000 !important; /* Luôn nổi cao hơn mọi div bên dưới */
        max-height: none !important;
        transform: none !important;
        opacity: 1 !important;
        pointer-events: auto !important;
    }

    .navbar-brand {
        font-size: 16.5px !important;
        gap: 6px !important;
        max-width: calc(100% - 60px) !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
    }

    .navbar-brand .brand-icon {
        font-size: 20px !important;
        flex-shrink: 0 !important;
    }

    .navbar-brand .brand-text {
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
    }

    .navbar-right-box {
        position: relative !important;
        display: flex !important;
        align-items: center !important;
    }

    /* Trên điện thoại: Luôn hiển thị nút 3 gạch vuông vắn xinh xắn */
    .btn-nav-hamburger {
        display: inline-flex !important;
        padding: 7px 9px !important;
        border-radius: 10px !important;
        flex-shrink: 0 !important;
    }

    .btn-nav-hamburger .hamburger-text {
        display: none !important; /* Ẩn chữ Menu trên điện thoại để tiết kiệm diện tích */
    }

    /* Mặc định trên điện thoại: Toàn bộ nút điều hướng bị thu gọn hoàn toàn */
    .navbar .navbar-nav {
        display: none !important;
    }

    /* Khi người dùng bấm nút 3 gạch: Menu bung dạng floating dropdown ở TRÊN div */
    .navbar.menu-open .navbar-nav {
        display: flex !important;
        position: absolute !important;
        top: calc(100% + 8px) !important;
        right: 0 !important;
        flex-direction: column !important;
        width: auto !important;
        min-width: 230px !important;
        max-width: calc(100vw - 28px) !important;
        gap: 8px !important;
        margin-top: 0 !important;
        padding: 12px !important;
        background: rgba(255, 255, 255, 0.98) !important;
        backdrop-filter: blur(20px) !important;
        -webkit-backdrop-filter: blur(20px) !important;
        border-radius: 16px !important;
        border: 2px solid #fbcfe8 !important;
        box-shadow: 0 14px 35px rgba(244, 114, 182, 0.28), 0 4px 16px rgba(0, 0, 0, 0.08) !important;
        z-index: 2500 !important;
        animation: navDropdownMobile 0.22s cubic-bezier(0.16, 1, 0.3, 1);
    }

    .navbar.menu-open .navbar-nav li {
        width: 100% !important;
    }

    .navbar.menu-open .navbar-nav .nav-item,
    .navbar.menu-open .navbar-nav .user-badge,
    .navbar.menu-open .navbar-nav .btn-user-name {
        width: 100% !important;
        justify-content: flex-start !important;
        padding: 10px 14px !important;
        font-size: 13.5px !important;
        box-sizing: border-box !important;
    }
}

/* Main Container */
.main-container {
    max-width: 960px;
    width: 100%;
    margin: 20px auto;
    padding: 0 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
    position: relative;
    z-index: 1;
}

h1 {
    font-size: 32px;
    font-weight: 700;
    color: #2d3748;
}

/* STYLE KHUNG CHAT MỚI */

.chat-card {
    background: rgba(255, 253, 247, 0.95) !important;
    backdrop-filter: blur(10px);
    border: 4px solid #f472b6 !important;
    border-radius: 4px !important;
    box-shadow: 6px 6px 0px #fbbf24, 12px 12px 0px #38bdf8 !important;
    display: flex;
    flex-direction: column;
    height: 82vh; /* Giới hạn chiều cao tổng thể vừa vặn màn hình */
    overflow: hidden;
}

/* Khu vực cuộn tin nhắn & lựa chọn */
.message-box {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #fdfbf7;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.message {
    max-width: 80%;
    padding: 10px 14px;
    font-size: 14px;
    line-height: 1.5;
    word-break: break-word;
}

.message.user {
    align-self: flex-end;
    background: #db2777;
    color: #ffffff;
    border-radius: 16px 16px 4px 16px;
    padding: 10px 16px;
    font-size: 14px;
    max-width: 82%;
    box-shadow: 0 2px 8px rgba(219, 39, 119, 0.2);
    border: none;
    animation: fadeIn 0.15s ease;
}

.message.bot {
    align-self: flex-start;
    background: #ffffff;
    border: 1px solid #fbcfe8;
    border-radius: 16px 16px 16px 4px;
    padding: 14px 16px;
    font-size: 14px;
    color: #1e293b;
    max-width: 88%;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
    line-height: 1.5;
}

/* Khung chọn Options nằm trong Khung Dock chung dưới đáy Chat */
.options-in-chat {
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: transparent !important;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
    box-shadow: none !important;
    box-sizing: border-box;
    width: 100%;
}

.options-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 3px;
    padding: 0 2px;
}
.options-title-badge {
    font-size: 13px;
    font-weight: 800;
    color: #db2777;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.options-title-sub {
    font-size: 11px;
    font-weight: 600;
    color: #94a3b8;
}

/* Legacy Support / Chat Wrapper cũ */
.chat-wrapper {
    display: flex;
    flex-direction: column-reverse;
    gap: 20px;
    background: #ffffff;
    border: 1px solid #fce7f3;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 6px 16px rgba(244, 114, 182, 0.08);
}

/* Cột trái: Danh sách câu hỏi */
.question-section h3 {
    font-size: 16px;
    margin-bottom: 15px;
    color: #4a5568;
}

.question-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 420px;
    overflow-y: auto;
    padding-right: 5px;
}

/* Nút Câu hỏi gợi ý thiết kế mới: Sang trọng, mềm mại, dễ đọc, không chói */
.question-btn {
    background: #ffffff !important;
    border: 1.5px solid #fbcfe8 !important;
    padding: 11px 14px !important;
    border-radius: 14px !important;
    cursor: pointer;
    font-weight: 700 !important;
    color: #1e293b !important;
    text-align: left;
    width: 100%;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 10px !important;
    box-shadow: 0 2px 8px rgba(219, 39, 119, 0.05) !important;
    transition: all 0.18s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
    line-height: 1.4 !important;
    box-sizing: border-box !important;
    -webkit-tap-highlight-color: transparent !important;
}

.question-btn .q-icon-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #fdf2f8;
    border: 1px solid #fbcfe8;
    font-size: 15px;
    flex-shrink: 0;
}

.question-btn .q-text {
    flex: 1;
    min-width: 0;
    font-size: 13.5px;
    color: #334155;
    font-weight: 700;
}

.question-btn .q-arrow {
    color: #f472b6;
    font-size: 13px;
    font-weight: 800;
    flex-shrink: 0;
    transition: transform 0.15s ease, color 0.15s ease;
}

.question-btn:hover {
    background: linear-gradient(135deg, #ffffff 0%, #fff1f2 100%) !important;
    border-color: #f472b6 !important;
    transform: translateY(-2px) scale(1.006) !important;
    box-shadow: 0 6px 18px rgba(219, 39, 119, 0.14) !important;
}
.question-btn:hover .q-text {
    color: #db2777 !important;
}
.question-btn:hover .q-arrow {
    color: #db2777 !important;
    transform: translateX(3px);
}
.question-btn:active {
    transform: scale(0.985) !important;
    background: #fce7f3 !important;
    border-color: #ec4899 !important;
}

/* Cột phải: Phản hồi từ Bot */
.response-section {
    background: #fffbeb;
    border: 1px solid #fef3c7;  
    border-radius: 12px;
    padding: 20px;
    min-height: 350px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.response-section h3 {
    font-size: 16px;
    color: #92400e;
    border-bottom: 1px solid #fde68a;
    padding-bottom: 8px;
}

/* Media (Ảnh & Audio) */
.media-box img, .chat-media-img {
    max-width: 100%;
    max-height: 250px;
    border-radius: 8px;
    margin-top: 8px;
    display: block;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

.media-box audio, .chat-media-audio {
    width: 100%;
    max-width: 300px;
    margin-top: 8px;
}

.empty-text {
    color: #b45309;
    font-style: italic;
}

.chat-container{
    max-width: 600px;
    margin: 20px auto;
    background: #ffffff !important;
    padding: 20px;
    border: 3px solid #f472b6 !important;
    border-radius: 16px !important;
    box-shadow: 6px 6px 0px #fde047 !important;
    position: relative;
    z-index: 1;
}

/* Các style bổ sung cho trang Quản trị Admin */
.node-box {
    background: #fdf2f8;
    border: 1px solid #fbcfe8;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 12px;
}

.node-title {
    font-weight: bold;
    margin-bottom: 8px;
    color: #be185d;
}

.form-group {
    margin-bottom: 10px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 4px;
    color: #4a5568;
}

.form-control {
    width: 100%;
    padding: 8px;
    border: 1px solid #fbcfe8;
    border-radius: 6px;
    box-sizing: border-box;
    background: #fff;
}

/* --- PHẦN DANH SÁCH NHÂN VẬT HÌNH TRÒN LỚN SONG SONG (2 CỘT) --- */

.character-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr); /* Chia đúng 2 cột song song trên mọi thiết bị */
    gap: 20px; 
    padding: 15px;
    max-width: 450px;
    margin: 0 auto;
    justify-items: center;
}

.character-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 130px; /* Thu nhỏ kích thước một chút để 2 cái nằm gọn song song trên màn hình nhỏ */
}

/* Thẻ nhân vật dạng hình tròn lớn hoàn toàn (Avatar tràn viền) */
.char-card-round {
    position: relative;
    width: 120px;  /* Kích thước vừa vặn nằm song song trên điện thoại */
    height: 120px;
    border-radius: 50%; /* Tròn tuyệt đối */
    overflow: hidden;    /* Ẩn phần thừa để ảnh ôm trọn hình tròn */
    border: 4px solid #fbcfe8; /* Viền hồng pastel ngọt ngào */
    box-shadow: 0 4px 12px rgba(244, 114, 182, 0.2);
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    background: #fff;
}

.char-card-round:hover {
    transform: scale(1.05);
    box-shadow: 0 10px 22px rgba(96, 165, 250, 0.3);
    border-color: #60a5fa; /* Đổi màu viền xanh pastel khi di chuột vào */
}

/* Ảnh Avatar lấp đầy toàn bộ hình tròn */
.char-avatar-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 1;
}

/* Lớp phủ mờ hiển thị tên nhân vật bên trên hình tròn */
.char-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4); /* Lớp nền tối mờ giúp chữ nổi bật */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 2;
    padding: 10px;
    box-sizing: border-box;
    text-align: center;
}

/* Tên nhân vật */
.char-title {
    color: #ffffff;
    font-size: 12px;
    font-weight: bold;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Nút chọn nhắn / trò chuyện nằm ngay bên dưới hình tròn */
.btn-chat-round {
    margin-top: 8px;
    text-decoration: none;
    display: inline-block;
    background: #60a5fa; /* Xanh pastel */
    color: #ffffff;
    padding: 5px 12px;
    border-radius: 15px;
    font-size: 11px;
    font-weight: 600;
    box-shadow: 0 2px 5px rgba(96, 165, 250, 0.3);
    transition: background 0.2s, transform 0.2s;
    text-align: center;
}

.btn-chat-round:hover {
    background: #3b82f6;
    transform: scale(1.05);
}

/* Các class phụ trợ tương thích ngược */
.character-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    padding: 15px;
}

.character-card {
    background: #fff;
    border-radius: 20px;
    padding: 20px 10px;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.04);
    border: 1px solid #f1f5f9;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.character-card img {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 10px;
    border: 2px solid #fbcfe8;
}
.options-as-bubble {
    background-color: #ffffff;
    border-top: 1px solid #fbcfe8;
    border-radius: 0 0 20px 20px;
    box-sizing: border-box;
    width: 100%;
    z-index: 10;
}

.options-as-bubble .question-btn {
    background: #fdf2f8;
    border: 1px solid #fbcfe8;
    padding: 10px 14px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: #db2777;
    text-align: left;
    width: 100%;
    transition: all 0.2s ease;
}

.options-as-bubble .question-btn:hover {
    background: #f472b6;
    color: #ffffff;
    border-color: #f472b6;
    transform: translateY(-1px);
}

.options-fixed-bottom {
    flex-shrink: 0;
    background: #ffffff;
    padding: 12px 16px;
    border-top: 1px solid #fbcfe8;
    border-radius: 0 0 20px 20px;
    box-shadow: 0 -4px 12px rgba(244, 114, 182, 0.08);
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 10;
}


.btn-status {
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 12px;
    border: 1px solid #cbd5e1;
    background: #f8fafc;
    color: #64748b;
}

/* Khi nhân vật là mặc định */
.btn-status.is-default {
    background: #dcfce7;
    color: #166534;
    border-color: #86efac;
}

/* ========================================================
   FULLSCREEN MARIO ENGINE STYLES
   ======================================================== */

/* Ẩn Navbar + floating reopen button khi đang ở chế độ toàn màn hình */
body.in-mario-fullscreen-mode #main-navbar,
body.in-mario-fullscreen-mode .nav-reopen-pill,
body.in-mario-fullscreen-mode .btn-toggle-nav-mobile {
    display: none !important;
    pointer-events: none !important;
}

/* Standard Fullscreen Container */
#mario-side-panel:fullscreen,
#mario-game-container:fullscreen,
.is-mario-fullscreen {
    width: 100vw !important;
    height: 100vh !important;
    max-width: 100vw !important;
    max-height: 100vh !important;
    background: #000000 !important;
    border-radius: 0 !important;
    border: none !important;
    box-shadow: none !important;
    margin: 0 !important;
    padding: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: flex-start !important;
    align-items: center !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    z-index: 999999 !important;
    overflow: hidden !important;
}

/* WebKit Fullscreen Container */
#mario-side-panel:-webkit-full-screen,
#mario-game-container:-webkit-full-screen {
    width: 100vw !important;
    height: 100vh !important;
    max-width: 100vw !important;
    max-height: 100vh !important;
    background: #000000 !important;
    border-radius: 0 !important;
    border: none !important;
    box-shadow: none !important;
    margin: 0 !important;
    padding: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: flex-start !important;
    align-items: center !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    z-index: 999999 !important;
    overflow: hidden !important;
}

/* Fullscreen Top Header Bar: Nằm riêng biệt trên cùng, không che Canvas hay đè lên HUD */
#mario-side-panel:fullscreen .mario-panel-header,
#mario-game-container:fullscreen .mario-fs-header,
.is-mario-fullscreen .mario-panel-header,
.is-mario-fullscreen .mario-fs-header {
    display: none !important;
}

#mario-side-panel:-webkit-full-screen .mario-panel-header,
#mario-game-container:-webkit-full-screen .mario-fs-header {
    display: none !important;
}

/* Canvas / DOM Viewport trong Fullscreen: Tỉ lệ 16:9 sắc nét, căn giữa hoàn hảo - Full height vì không còn thanh header */
#mario-side-panel:fullscreen canvas,
#mario-game-container:fullscreen canvas,
.is-mario-fullscreen canvas,
#mario-side-panel:fullscreen .game-dom-viewport,
#mario-game-container:fullscreen .game-dom-viewport,
.is-mario-fullscreen .game-dom-viewport {
    width: min(100vw, calc(100vh * 16 / 9)) !important;
    height: auto !important;
    max-height: 100vh !important;
    aspect-ratio: 16 / 9 !important;
    object-fit: contain !important;
    display: block !important;
    margin: auto !important;
    border-radius: 0 !important;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.95) !important;
    image-rendering: auto !important;
    image-rendering: -webkit-optimize-contrast !important;
}

#mario-side-panel:-webkit-full-screen canvas,
#mario-game-container:-webkit-full-screen canvas,
#mario-side-panel:-webkit-full-screen .game-dom-viewport,
#mario-game-container:-webkit-full-screen .game-dom-viewport {
    width: min(100vw, calc(100vh * 16 / 9)) !important;
    height: auto !important;
    max-height: 100vh !important;
    aspect-ratio: 16 / 9 !important;
    object-fit: contain !important;
    display: block !important;
    margin: auto !important;
    border-radius: 0 !important;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.95) !important;
    image-rendering: auto !important;
    image-rendering: -webkit-optimize-contrast !important;
}

/* Ẩn footer khi fullscreen */
#mario-side-panel:fullscreen .mario-panel-footer,
#mario-side-panel:-webkit-full-screen .mario-panel-footer,
.is-mario-fullscreen .mario-panel-footer {
    display: none !important;
}

/* Nút thoát Fullscreen màu đỏ phong cách điện ảnh */
.btn-exit-fullscreen {
    background: #dc2626 !important;
    color: #ffffff !important;
    border: 1.5px solid #f87171 !important;
    padding: 6px 14px !important;
    border-radius: 8px !important;
    font-size: 12px !important;
    font-weight: 700 !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    transition: all 0.2s ease !important;
    box-shadow: 0 2px 8px rgba(220, 38, 38, 0.4) !important;
}

.btn-exit-fullscreen:hover {
    background: #b91c1c !important;
    transform: scale(1.04) !important;
}

/* ========================================================================== */
/* 🎨 EXTRACTED MODULAR COMPONENT STYLES (VIEWS REFACTORING)                   */
/* ========================================================================== */

/* --- 1. Header & Navigation Components --- */
.user-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, rgba(255,255,255,0.7) 0%, rgba(253,242,248,0.8) 100%);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1.5px solid rgba(251, 207, 232, 0.75);
    padding: 5px 13px 5px 8px;
    border-radius: 24px;
    box-shadow: 0 2px 10px rgba(219, 39, 119, 0.08), 0 1px 3px rgba(0,0,0,0.04);
    transition: box-shadow 0.2s ease, transform 0.15s ease;
}
.user-badge:hover {
    box-shadow: 0 4px 16px rgba(219, 39, 119, 0.15);
    transform: translateY(-1px);
}
.user-badge:hover .user-avatar-emoji {
    transform: scale(1.18) rotate(8deg);
}
.user-badge-name {
    font-size: 13px;
    font-weight: 700;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 5px;
}
/* Vòng tròn emoji / image avatar dễ thương (hình con vật) */
.user-avatar-emoji {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: linear-gradient(135deg, #fdf2f8 0%, #fce7f3 100%);
    border: 1.5px solid #fbcfe8;
    font-size: 15px;
    line-height: 1;
    flex-shrink: 0;
    box-shadow: 0 1px 4px rgba(219, 39, 119, 0.12);
    transition: transform 0.2s ease;
    overflow: hidden;
    padding: 0;
}
.user-avatar-emoji img,
.user-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    display: block;
}
.user-badge-logout {
    background: rgba(254, 226, 226, 0.7);
    color: #dc2626;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    text-decoration: none;
    font-weight: bold;
    border: 1px solid rgba(248, 113, 113, 0.35);
    transition: background 0.15s ease;
}
.user-badge-logout:hover {
    background: #fee2e2;
}
.btn-user-name {
    background: rgba(255, 255, 255, 0.45);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1.5px solid rgba(255, 255, 255, 0.65);
    color: #831843;
    padding: 7px 14px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    transition: all 0.15s ease;
}
.btn-user-name:hover {
    background: rgba(255, 255, 255, 0.7);
    transform: translateY(-1px);
}

/* Modal bắt buộc nhập tên */
#welcome-name-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(15, 23, 42, 0.78);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    align-items: center;
    justify-content: center;
    padding: 15px;
}
.welcome-box {
    background: #ffffff;
    border-radius: 24px;
    border: 3px solid #f472b6;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
    width: 100%;
    max-width: 440px;
    padding: 32px 28px;
    text-align: center;
    position: relative;
}
.welcome-icon-circle {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: #fdf2f8;
    border: 3px solid #fbcfe8;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 34px;
    margin: 0 auto 16px auto;
    box-shadow: 0 4px 14px rgba(244, 114, 182, 0.25);
}
.welcome-title {
    font-size: 22px;
    margin: 0 0 8px 0;
    color: #1e293b;
    font-weight: 800;
}
.welcome-desc {
    font-size: 13px;
    color: #64748b;
    margin: 0 0 20px 0;
    line-height: 1.5;
}
.welcome-error-alert {
    display: none;
    background: #fef2f2;
    border: 1.5px solid #fca5a5;
    color: #dc2626;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 16px;
    text-align: left;
}
.welcome-form-group {
    text-align: left;
    margin-bottom: 16px;
}
.welcome-label {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: #334155;
    margin-bottom: 6px;
}
.welcome-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #fbcfe8;
    border-radius: 12px;
    font-size: 15px;
    outline: none;
    transition: border-color 0.2s;
    box-sizing: border-box;
}
.welcome-input:focus {
    border-color: #db2777;
}
.welcome-hint {
    font-size: 11px;
    color: #94a3b8;
    margin-top: 4px;
    display: block;
}
.welcome-admin-group {
    display: none;
    text-align: left;
    margin-bottom: 18px;
}
.welcome-admin-label {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: #db2777;
    margin-bottom: 6px;
}
.welcome-admin-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #f43f5e;
    border-radius: 12px;
    font-size: 14px;
    outline: none;
    background: #fff1f2;
    box-sizing: border-box;
}
.welcome-admin-hint {
    font-size: 11px;
    color: #e11d48;
    margin-top: 4px;
    display: block;
}
.welcome-submit-btn {
    width: 100%;
    padding: 13px;
    background: #db2777;
    color: #ffffff;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(219, 39, 119, 0.3);
    transition: all 0.15s ease;
}
.welcome-submit-btn:hover {
    background: #be185d;
}

/* --- 2. Footer --- */
.site-footer {
    text-align: center;
    margin-top: 40px;
    color: #888;
    font-size: 13px;
}

/* --- 3. Home Page Components --- */
.home-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 65vh;
    text-align: center;
    padding: 20px 15px;
    position: relative;
    z-index: 5;
}
.home-title {
    margin-bottom: 12px;
    color: #1e293b;
    font-size: 32px;
    font-weight: 800;
    text-shadow: 2px 2px 0px #fbcfe8;
}
.home-subtitle {
    color: #64748b;
    margin-bottom: 30px;
    font-size: 16px;
    max-width: 550px;
    line-height: 1.5;
}
.home-actions {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
}
.btn-home-chat {
    background: #db2777;
    color: #fff;
    padding: 14px 28px;
    font-size: 17px;
    font-weight: 700;
    text-decoration: none;
    border-radius: 12px;
    border: 2px solid #be185d;
    box-shadow: 3px 3px 0px #9d174d;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: transform 0.15s ease;
}
.btn-home-chat:hover {
    transform: translateY(-2px);
    background: #be185d;
}
.btn-home-mario {
    background: #f59e0b;
    color: #fff;
    padding: 14px 28px;
    font-size: 17px;
    font-weight: 700;
    text-decoration: none;
    border-radius: 12px;
    border: 2px solid #b45309;
    box-shadow: 3px 3px 0px #78350f;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: transform 0.15s ease;
}
.btn-home-mario:hover {
    transform: translateY(-2px);
    background: #d97706;
}
.btn-home-icon {
    font-size: 22px;
    line-height: 1;
}

/* --- 4. Chat Page Components --- */
.chat-outer-wrapper {
    max-width: 1200px;
    margin: 20px auto 40px auto;
    padding: 0 15px;
    position: relative;
    z-index: 5;
}
.char-switcher-bar {
    max-width: 680px;
    margin: 0 auto 12px auto;
    display: flex;
    align-items: center;
    gap: 8px;
    overflow-x: auto;
    padding: 4px 0 8px 0;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}
.char-switcher-label {
    font-size: 12px;
    font-weight: 700;
    color: #831843;
    white-space: nowrap;
    margin-right: 2px;
}
.char-switcher-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
    transition: all 0.15s ease;
    border: 1.5px solid rgba(251, 207, 232, 0.8);
    background: rgba(255, 255, 255, 0.9);
    color: #334155;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}
.char-switcher-link.active {
    border-color: #db2777;
    background: #db2777;
    color: #ffffff;
}
.chat-layout-wrapper {
    max-width: 680px;
    margin: 0 auto;
    transition: all 0.3s ease;
}
.mario-side-panel,
.mario-side-panel-wrapper {
    display: none;
    position: relative;
    z-index: 105;
    align-self: start;
    width: 100%;
}
.mario-panel-header {
    background: #1e293b;
    padding: 8px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    gap: 6px;
    flex-wrap: wrap;
}
.mario-panel-title-group {
    display: flex;
    align-items: center;
    gap: 6px;
}
.mario-fps-badge {
    background: rgba(16, 185, 129, 0.2);
    border: 1px solid #10b981;
    color: #34d399;
    padding: 2px 7px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 800;
}
.mario-panel-actions {
    display: flex;
    align-items: center;
    gap: 5px;
}
.side-skin-btn {
    background: #065f46;
    border: 1.5px solid #10b981;
    color: #a7f3d0;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
}
.side-audio-btn {
    background: #334155;
    border: 1.5px solid #64748b;
    color: #fff;
    padding: 4px 7px;
    border-radius: 6px;
    font-size: 11px;
    cursor: pointer;
}
.side-restart-btn {
    background: #854d0e;
    border: 1.5px solid #facc15;
    color: #fef08a;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
}
.side-fs-btn {
    background: #1d4ed8;
    border: 1.5px solid #60a5fa;
    color: #eff6ff;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    box-shadow: 0 2px 4px rgba(29, 78, 216, 0.3);
}
.mario-panel-canvas {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    background: #5c94fc;
    cursor: pointer;
    outline: none;
}
.mario-panel-footer {
    background: #1e293b;
    padding: 8px 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #94a3b8;
    font-size: 11px;
    border-top: 1px solid #334155;
}
.side-vkey-btn {
    background: #334155;
    border: 1px solid #475569;
    color: #f8fafc;
    padding: 4px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: bold;
}
.side-vkey-jump {
    background: #ea580c;
    border: 1px solid #fb923c;
    color: #fff;
    padding: 4px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 11px;
    font-weight: bold;
}

/* Chat Main Card */
.chat-card {
    background: rgba(255, 255, 255, 0.96) !important;
    backdrop-filter: blur(10px);
    border-radius: 20px !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1) !important;
    border: 2px solid #fbcfe8 !important;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 82vh;
}
.chat-header-bar {
    background: #fff;
    padding: 10px 16px;
    border-bottom: 2px solid #fdf2f8;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    flex-wrap: nowrap;
    gap: 8px;
}
.chat-header-info {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1 1 auto;
}
.chat-avatar-img {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #fbcfe8;
    flex-shrink: 0;
}
.chat-avatar-placeholder {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: #fdf2f8;
    border: 2px solid #fbcfe8;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}
.chat-title-group {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}
.chat-character-title {
    font-size: 16px;
    margin: 0;
    color: #1e293b;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.chat-voice-btn {
    background: #fdf2f8;
    color: #db2777;
    border: 1px solid #fbcfe8;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    flex-shrink: 0;
}
.chat-online-badge {
    font-size: 11px;
    color: #22c55e;
    font-weight: 600;
    display: block;
}
.chat-header-tools {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}
.chat-tool-btn {
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    color: #475569;
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
}
.chat-toggle-mario-btn {
    background: #fef08a;
    border: 1.5px solid #facc15;
    color: #854d0e;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    box-shadow: 0 2px 5px rgba(234, 179, 8, 0.25);
    transition: all 0.2s ease;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    white-space: nowrap;
}
.chat-toggle-mario-btn:hover {
    background: #fde047;
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(234, 179, 8, 0.35);
}
.chat-toggle-mario-btn:active {
    transform: translateY(1px);
}
.chat-game-btn-icon {
    font-size: 13px;
    line-height: 1;
}
.chat-game-btn-text {
    font-size: inherit;
    font-weight: 700;
}

/* Chat Message Box */
.message-box {
    flex: 1;
    padding: 18px;
    overflow-y: auto;
    background: #fdfbf7;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.message.bot {
    align-self: flex-start;
    background: #ffffff;
    border: 1px solid #fbcfe8;
    border-radius: 16px 16px 16px 4px;
    padding: 14px 16px;
    font-size: 14px;
    color: #1e293b;
    max-width: 88%;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
    line-height: 1.5;
}
.message-author-bot {
    color: #db2777;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
}
.chat-media-img {
    max-width: 100%;
    border-radius: 10px;
    border: 1px solid #fbcfe8;
    margin-top: 10px;
}
.voice-bubble {
    margin-top: 10px;
    background: #fdf2f8;
    border: 1.5px solid #fbcfe8;
    border-radius: 12px;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: 280px;
}
.btn-play-voice {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #db2777;
    color: #fff;
    border: none;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(219, 39, 119, 0.3);
    flex-shrink: 0;
}
.voice-bubble-title {
    font-size: 11px;
    font-weight: 700;
    color: #db2777;
    margin-bottom: 2px;
}
.voice-wave-container {
    display: flex;
    align-items: center;
    gap: 3px;
    height: 12px;
}
.voice-bar {
    width: 3px;
    background: #f472b6;
    border-radius: 2px;
}
.voice-bar.active {
    background: #db2777;
}

/* Khung Dock chung dưới đáy Chat: Gồm câu hỏi gợi ý và ô nhập tin nhắn trong CÙNG 1 KHUNG LIỀN MẠCH */
.chat-bottom-dock {
    flex-shrink: 0;
    background: #ffffff;
    border-top: 2px solid #fdf2f8;
    padding: 10px 16px 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    border-radius: 0 0 20px 20px;
    box-shadow: 0 -4px 16px rgba(219, 39, 119, 0.04);
    z-index: 5;
    box-sizing: border-box;
}

/* Question Options */
.options-in-chat {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: transparent !important;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
    box-shadow: none !important;
    max-height: none !important;
    overflow: visible;
    transition: all 0.2s ease;
}
.options-in-chat.is-collapsed {
    padding: 0 !important;
    gap: 0 !important;
}
.options-in-chat.is-collapsed .options-buttons-list {
    display: none !important;
}
.options-buttons-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: none;
    overflow-y: visible;
}
.options-title {
    font-size: 12px;
    font-weight: 700;
    color: #db2777;
    margin-bottom: 2px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.options-title-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.options-title-sub {
    font-size: 11px;
    color: #94a3b8;
    font-weight: 600;
}
/* Chat Finished & Voice helpers */
.char-switcher-icon {
    font-size: 15px;
}
.mario-panel-game-title {
    color: #f8fafc;
    font-weight: 700;
    font-size: 13px;
}
.mario-side-vkeys {
    display: flex;
    gap: 6px;
}
.voice-wave-wrapper {
    flex: 1;
}
.voice-bar-1 { height: 5px; }
.voice-bar-2 { height: 11px; }
.voice-bar-3 { height: 7px; }
.voice-bar-4 { height: 12px; }
.voice-bar-5 { height: 6px; }
.chat-finished-box {
    text-align: center;
    padding: 6px;
}
.chat-finished-text {
    font-size: 13px;
    color: #64748b;
    margin: 0 0 6px 0;
}
.btn-chat-restart {
    background: #22c55e;
    color: #fff;
    border: none;
    padding: 7px 16px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 12px;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(34, 197, 94, 0.25);
    transition: background 0.15s ease;
}
.btn-chat-restart:hover {
    background: #16a34a;
}
.welcome-error-msg {
    margin-bottom: 8px;
}
.welcome-override-btn {
    width: 100%;
    background: #22c55e;
    color: #ffffff;
    border: none;
    padding: 9px 12px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(34, 197, 94, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
.welcome-override-btn:hover {
    background: #16a34a;
}
.admin-login-group-last {
    margin-bottom: 22px;
}
.mario-header-title-flex {
    display: flex;
    align-items: center;
    gap: 8px;
}
.mario-fs-icon {
    font-size: 16px;
}
.mario-fs-text-title {
    font-size: 14px;
    font-weight: 700;
}
.mario-fs-fps-badge {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
    font-size: 10px;
}
.mario-fs-guide-text {
    font-size: 11px;
    color: #94a3b8;
    margin-left: 6px;
}
.controls-guide-highlight {
    font-weight: 700;
    color: #db2777;
}
.mario-chat-header-info {
    display: flex;
    align-items: center;
    gap: 10px;
}
.mario-chat-status {
    font-size: 11px;
    color: #22c55e;
    font-weight: 600;
}

/* Chat Form Bottom */
.chat-input-bar {
    padding: 6px 0 0 0;
    background: transparent;
    border-top: 1px dashed #fce7f3;
    flex-shrink: 0;
}
.chat-free-form {
    display: flex;
    gap: 8px;
}
.chat-free-input {
    flex: 1;
    padding: 11px 16px;
    border: 2px solid #fbcfe8;
    border-radius: 12px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
    box-sizing: border-box;
}
.chat-free-input:focus {
    border-color: #db2777;
}
.chat-send-btn {
    background: #db2777;
    color: #ffffff;
    border: none;
    padding: 11px 20px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    box-shadow: 0 3px 0 #be185d;
    transition: all 0.15s ease;
    white-space: nowrap;
}
.chat-send-btn:hover {
    background: #be185d;
}

/* --- 5. MarioChat Page Components --- */
.mario-play-chat-wrapper {
    width: 100%;
    max-width: 1080px;
    margin: 14px auto 30px auto;
    padding: 0 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 10;
    box-sizing: border-box;
}
.mario-header-bar {
    width: 100%;
    max-width: 1000px;
    box-sizing: border-box;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    padding: 10px 20px;
    border-radius: 14px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    border: 2px solid #fbcfe8;
    box-shadow: 0 3px 10px rgba(244, 114, 182, 0.12);
    position: relative;
    z-index: 10;
}

.mario-header-title-box {
    display: flex;
    align-items: center;
    gap: 10px;
}

.mario-header-icon {
    font-size: 22px;
    line-height: 1;
}

.mario-header-h1 {
    font-size: 16px;
    margin: 0;
    color: #1e293b;
    font-weight: 800;
    letter-spacing: -0.2px;
}

.side-panel-close-btn {
    background: rgba(239, 68, 68, 0.12);
    color: #ef4444;
    border: 1.5px solid rgba(239, 68, 68, 0.35);
    border-radius: 10px;
    padding: 4px 10px;
    font-weight: 800;
    cursor: pointer;
    font-size: 13px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: all 0.15s ease;
    flex-shrink: 0;
}
.side-panel-close-btn:hover {
    background: rgba(239, 68, 68, 0.22);
    border-color: #ef4444;
    transform: translateY(-1px);
}

/* Thanh công cụ điều khiển nhanh NẰM TRONG KHUNG CHƠI GAME */
.game-hud-toolbar {
    position: absolute;
    top: 14px;
    left: 14px;
    display: flex !important;
    align-items: center;
    gap: 8px;
    z-index: 999 !important; /* Luôn nổi trên cùng bên trong khung game */
    pointer-events: auto !important;
    transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1), transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.25s ease !important;
}

/* Trên Desktop: Làm mờ nhẹ thanh công cụ khi đang bay để không cản trở góc nhìn, rê chuột vào sẽ rõ lại */
body.is-playing .game-hud-toolbar {
    opacity: 0.35;
    transition: opacity 0.3s ease;
}
body.is-playing .game-hud-toolbar:hover {
    opacity: 1;
}

/* Trong chế độ toàn màn hình: vẫn hiện 3 nút arcade pill góc trên bên trái */
#mario-game-container:fullscreen .game-hud-toolbar,
#mario-game-container:-webkit-full-screen .game-hud-toolbar,
#mario-side-container:fullscreen .game-hud-toolbar,
#mario-side-container:-webkit-full-screen .game-hud-toolbar,
.is-mario-fullscreen .game-hud-toolbar {
    display: flex !important;
    top: 14px !important;
    left: 14px !important;
    z-index: 100000 !important;
}

/* Nút thoát toàn màn hình nổi góc trên bên phải */
.game-hud-exit-btn {
    display: none;
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 100000;
    background: rgba(220, 38, 38, 0.88);
    color: #ffffff;
    border: 1.5px solid rgba(248, 113, 113, 0.8);
    padding: 8px 14px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    display: none;
    align-items: center;
    gap: 6px;
    box-shadow: 0 4px 14px rgba(220, 38, 38, 0.45);
    transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
    user-select: none;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.game-hud-exit-btn:hover {
    background: rgba(185, 28, 28, 0.95);
    transform: translateY(-1px) scale(1.03);
    box-shadow: 0 6px 18px rgba(220, 38, 38, 0.6);
}

.game-hud-exit-btn:active {
    transform: scale(0.95);
}

/* Chỉ hiện nút thoát khi đang ở chế độ toàn màn hình */
#mario-game-container:fullscreen .game-hud-exit-btn,
#mario-game-container:-webkit-full-screen .game-hud-exit-btn,
#mario-side-container:fullscreen .game-hud-exit-btn,
#mario-side-container:-webkit-full-screen .game-hud-exit-btn,
.is-mario-fullscreen .game-hud-exit-btn {
    display: flex !important;
}

.game-hud-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: #ffffff;
    border: 1.5px solid rgba(255, 255, 255, 0.45);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
    transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.game-hud-btn:hover {
    background: rgba(15, 23, 42, 0.95);
    border-color: #ffffff;
    transform: translateY(-1px) scale(1.03);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
}

.game-hud-btn:active {
    transform: scale(0.95);
}

.game-hud-btn.btn-hud-sound {
    border-color: rgba(244, 114, 182, 0.85);
    background: rgba(190, 24, 93, 0.82);
    color: #ffffff;
}

.game-hud-btn.btn-hud-restart {
    border-color: rgba(250, 204, 21, 0.95);
    background: rgba(202, 138, 4, 0.9);
    color: #ffffff;
}

.game-hud-btn.btn-hud-fs {
    border-color: rgba(56, 189, 248, 0.9);
    background: rgba(2, 132, 199, 0.85);
    color: #ffffff;
}

.mario-header-title-box {
    display: flex;
    align-items: center;
    gap: 12px;
}
.mario-header-icon {
    font-size: 28px;
    line-height: 1;
}
.mario-header-h1 {
    font-size: 19px;
    margin: 0;
    color: #1e293b;
    font-weight: 800;
}
.mario-header-subtitle {
    font-size: 12px;
    margin: 0;
    color: #64748b;
}
.mario-header-tools {
    display: flex;
    align-items: center;
    gap: 8px;
}
.btn-mario-skin {
    background: #ecfdf5;
    border: 2px solid #10b981;
    color: #047857;
    padding: 8px 14px;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}
.btn-mario-sound {
    background: #fdf2f8;
    border: 2px solid #f472b6;
    color: #db2777;
    padding: 8px 14px;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
}
.btn-mario-restart {
    background: #fef08a;
    border: 2px solid #facc15;
    color: #854d0e;
    padding: 8px 14px;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
}
.btn-mario-fs {
    background: #eff6ff;
    border: 2px solid #3b82f6;
    color: #1d4ed8;
    padding: 8px 14px;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}
.mario-grid-container {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(360px, 1fr);
    gap: 20px;
    align-items: start;
    position: relative;
    z-index: 105;
}
.game-column {
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    position: relative;
    z-index: 105;
    box-sizing: border-box;
}
.game-card {
    background: #0f172a;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
    border: 4px solid #38bdf8;
    position: relative;
    z-index: 105;
    width: 100%;
}
.game-canvas,
.game-dom-viewport {
    display: block;
    width: 100% !important;
    height: auto !important;
    aspect-ratio: 16 / 9;
    max-height: 80vh;
    background: #4ec0ca;
    cursor: pointer;
    outline: none;
    position: relative;
    z-index: 1 !important; /* z-index thấp để các nút điều khiển nổi ở trên */
    margin: 0 auto;
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

/* ========================================================
   DOM-BASED FLAPPY BANGBOO ENGINE (ZERO CANVAS / 100% GPU)
   ======================================================== */
.flappy-dom-stage {
    position: absolute;
    width: 800px;
    height: 450px;
    left: 50%;
    top: 50%;
    transform-origin: center center;
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
    pointer-events: auto;
    /* GPU isolation: Toàn bộ stage được vẽ trên 1 compositor layer riêng
       giúp tránh repaint lan ra ngoài và loại bỏ hoàn toàn layout thrashing */
    will-change: transform;
    contain: layout style;
    isolation: isolate;
}

/* 1. Bầu trời */
.flappy-sky {
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, #4ec0ca 0%, #70c5ce 70%, #b0e5eb 100%);
    pointer-events: none;
}

/* 2. Mây bồng bềnh */
.flappy-clouds-layer {
    position: absolute;
    inset: 0;
    pointer-events: none;
}
.flappy-cloud {
    position: absolute;
    background: rgba(255, 255, 255, 0.86);
    border-radius: 40px;
    pointer-events: none;
}
.flappy-cloud::before,
.flappy-cloud::after {
    content: '';
    position: absolute;
    background: rgba(255, 255, 255, 0.86);
    border-radius: 50%;
}
.flappy-cloud.c1 {
    width: 110px;
    height: 38px;
    top: 45px;
    left: 80px;
}
.flappy-cloud.c1::before {
    width: 48px;
    height: 48px;
    top: -24px;
    left: 18px;
}
.flappy-cloud.c1::after {
    width: 38px;
    height: 38px;
    top: -16px;
    left: 54px;
}
.flappy-cloud.c2 {
    width: 140px;
    height: 44px;
    top: 90px;
    left: 360px;
    opacity: 0.9;
}
.flappy-cloud.c2::before {
    width: 60px;
    height: 60px;
    top: -30px;
    left: 24px;
}
.flappy-cloud.c2::after {
    width: 48px;
    height: 48px;
    top: -20px;
    left: 70px;
}
.flappy-cloud.c3 {
    width: 100px;
    height: 34px;
    top: 55px;
    left: 640px;
}
.flappy-cloud.c3::before {
    width: 42px;
    height: 42px;
    top: -20px;
    left: 16px;
}
.flappy-cloud.c3::after {
    width: 34px;
    height: 34px;
    top: -14px;
    left: 48px;
}

/* 3. Dãy thành phố retro */
.flappy-city-layer {
    position: absolute;
    left: 0;
    bottom: 68px;
    width: 100%;
    height: 120px;
    pointer-events: none;
}

/* 4. Hàng cây xanh chân thành phố */
.flappy-trees-layer {
    position: absolute;
    left: 0;
    bottom: 68px;
    width: 100%;
    height: 26px;
    background: #4ea452;
    border-top: 3.5px solid #63be67;
    pointer-events: none;
}

/* 5. Mặt đất cỏ và sọc caro retro */
.flappy-ground-layer {
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 68px;
    overflow: hidden;
    pointer-events: none;
    z-index: 15;
}
.flappy-ground-track {
    position: absolute;
    left: 0;
    top: 0;
    width: 1200px;
    height: 68px;
    will-change: transform;
}
.flappy-ground-grass {
    height: 14px;
    background: #73bf2e;
    border-top: 3px solid #9ce659;
    border-bottom: 2.5px solid #2b3d17;
}
.flappy-ground-dirt {
    height: 54px;
    background: #ded895;
    background-image: repeating-linear-gradient(90deg, #ded895 0px, #ded895 14px, #cbb86e 14px, #cbb86e 28px);
    background-size: 28px 100%;
}

/* 6. Cột ống nước retro */
.flappy-pipes-layer {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 5;
}
.flappy-pipe-pair {
    position: absolute;
    top: 0;
    left: 0;
    width: 68px;
    height: 382px;
    pointer-events: none;
    will-change: transform;
}
.flappy-pipe-top, .flappy-pipe-bottom {
    position: absolute;
    left: 0;
    width: 68px;
    background: linear-gradient(to right, #558022 0%, #73bf2e 18%, #9ce659 35%, #73bf2e 65%, #558022 90%, #2b3d17 100%);
    border: 2.5px solid #2b3d17;
    box-sizing: border-box;
}
.flappy-pipe-top {
    top: 0;
    border-top: none;
}
.flappy-pipe-bottom {
    border-bottom: none;
}
.flappy-pipe-cap {
    position: absolute;
    left: -4px;
    width: 76px;
    height: 26px;
    background: linear-gradient(to right, #558022 0%, #73bf2e 18%, #9ce659 35%, #73bf2e 65%, #558022 90%, #2b3d17 100%);
    border: 2.5px solid #2b3d17;
    box-sizing: border-box;
    box-shadow: 0 3px 6px rgba(0,0,0,0.15);
}
.flappy-pipe-top .flappy-pipe-cap {
    bottom: 0;
}
.flappy-pipe-bottom .flappy-pipe-cap {
    top: 0;
}

/* 7. Chú Bangboo Mô Tô (Zenless Zone Zero) */
.flappy-bird-hero {
    position: absolute;
    top: 0;
    left: 0;
    width: 52px;
    height: 58px;
    pointer-events: none;
    will-change: transform;
    z-index: 12;
}
.flappy-bird-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
    /* drop-shadow trên img gây rasterize mỗi frame → thay bằng box-shadow cố định trên wrapper
       box-shadow không tham gia repaint loop nên 0 chi phí GPU mỗi frame */
}

/* 8. Khói pô */
.flappy-particles-layer {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 11;
}
.flappy-smoke {
    position: absolute;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.85);
    pointer-events: none;
    animation: flappySmokePuff 0.35s ease-out forwards;
}
@keyframes flappySmokePuff {
    0% { transform: scale(0.6); opacity: 0.9; }
    100% { transform: translate(-22px, -8px) scale(1.6); opacity: 0; }
}

.flappy-floating-text {
    position: absolute;
    font-family: "Quicksand", sans-serif;
    font-size: 20px;
    font-weight: 900;
    color: #f59e0b;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
    pointer-events: none;
    animation: flappyFloatUp 0.6s ease-out forwards;
}
@keyframes flappyFloatUp {
    0% { transform: translateY(0); opacity: 1; }
    100% { transform: translateY(-30px); opacity: 0; }
}

/* 9. HUD Điểm số */
.flappy-hud-score {
    position: absolute;
    top: 24px;
    left: 50%;
    transform: translateX(-50%);
    font-family: "Quicksand", sans-serif;
    font-size: 52px;
    font-weight: 900;
    color: #ffffff;
    text-shadow: 0 4px 0 #1e293b, 0 -2px 0 #1e293b, 2px 0 0 #1e293b, -2px 0 0 #1e293b, 0 8px 16px rgba(0,0,0,0.4);
    z-index: 20;
    pointer-events: none;
}
.flappy-hud-best {
    position: absolute;
    top: 20px;
    right: 24px;
    font-family: "Quicksand", sans-serif;
    font-size: 14px;
    font-weight: 800;
    color: #ffffff;
    background: rgba(15, 23, 42, 0.68);
    /* Bỏ backdrop-filter: blur — tốn GPU không cần thiết trong HUD */
    padding: 6px 14px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.4);
    z-index: 20;
    pointer-events: none;
}

/* 10. Màn hình GET READY */
.flappy-ready-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    z-index: 30;
    pointer-events: none;
}
.flappy-ready-title {
    font-family: "Quicksand", sans-serif;
    font-size: 44px;
    font-weight: 900;
    color: #facc15;
    text-shadow: 0 4px 0 #1e293b, 0 -2px 0 #1e293b, 2px 0 0 #1e293b, -2px 0 0 #1e293b, 0 8px 20px rgba(0,0,0,0.35);
    letter-spacing: 1px;
}
.flappy-ready-guide {
    font-family: "Quicksand", sans-serif;
    font-size: 16px;
    font-weight: 700;
    color: #ffffff;
    background: rgba(15, 23, 42, 0.72);
    /* Đã loại bỏ backdrop-filter: blur — cực kỳ tốn GPU trên mobile */
    padding: 8px 20px;
    border-radius: 30px;
    border: 1.5px solid rgba(255, 255, 255, 0.6);
    animation: flappyReadyBlink 1.4s ease-in-out infinite;
}
@keyframes flappyReadyBlink {
    0%, 100% { opacity: 0.95; transform: scale(1); }
    50% { opacity: 0.65; transform: scale(0.97); }
}
.flappy-ready-best-badge {
    font-family: "Quicksand", sans-serif;
    font-size: 14px;
    font-weight: 800;
    color: #db2777;
    background: #ffffff;
    padding: 6px 18px;
    border-radius: 20px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* 11. Màn hình GAMEOVER - Tấm thiệp động viên */
.flappy-gameover-overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.72);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 40;
    animation: flappyFadeIn 0.2s ease;
}
@keyframes flappyFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
.flappy-card-body {
    width: 520px;
    max-width: 90%;
    background: linear-gradient(135deg, #fffdfa 0%, #fff1f2 100%);
    border: 3px dashed #fbcfe8;
    border-radius: 20px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.15s ease;
}
.flappy-card-body:hover {
    transform: scale(1.02);
}
.flappy-card-ribbon {
    background: linear-gradient(135deg, #f43f5e, #db2777);
    color: #ffffff;
    font-family: "Quicksand", sans-serif;
    font-size: 16px;
    font-weight: 800;
    text-align: center;
    padding: 12px 16px;
    letter-spacing: 0.5px;
}
.flappy-card-content {
    padding: 18px 24px 14px 24px;
    text-align: center;
}
.flappy-card-quote {
    font-family: "Quicksand", sans-serif;
    font-size: 13.5px;
    font-style: italic;
    font-weight: 600;
    color: #334155;
    line-height: 1.5;
    margin-bottom: 14px;
}
.flappy-card-badge {
    display: inline-block;
    background: #ffffff;
    border: 1.5px solid #fbcfe8;
    border-radius: 20px;
    padding: 6px 18px;
    font-family: "Quicksand", sans-serif;
    font-size: 13px;
    font-weight: 800;
    color: #db2777;
    margin-bottom: 10px;
}
.flappy-card-hint {
    font-family: "Quicksand", sans-serif;
    font-size: 11.5px;
    font-weight: 600;
    color: #94a3b8;
}
.controls-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    padding: 12px 18px;
    border-radius: 16px;
    border: 2px solid #fbcfe8;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    position: relative;
    z-index: 105;
}
.gamepad-dpad-left {
    display: flex;
    align-items: center;
    gap: 8px;
}
.gamepad-action-right {
    display: flex;
    align-items: center;
    gap: 8px;
}
.virtual-key {
    background: #f1f5f9;
    border: 2px solid #cbd5e1;
    width: 56px;
    height: 48px;
    border-radius: 12px;
    font-weight: bold;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 3px 0 #94a3b8;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
}
.virtual-key-jump {
    background: #fed7aa;
    border: 2px solid #fb923c;
    color: #c2410c;
    padding: 0 20px;
    height: 48px;
    border-radius: 12px;
    font-weight: 800;
    font-size: 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 3px 0 #ea580c;
    width: auto;
}
.controls-guide-text {
    font-size: 12px;
    color: #64748b;
    text-align: center;
    flex: 1;
    min-width: 160px;
    line-height: 1.4;
}

/* Mario Chat column */
.chat-column {
    display: flex;
    flex-direction: column;
}
.mario-chat-card {
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    border: 2px solid #fbcfe8;
    display: flex;
    flex-direction: column;
    height: 580px;
    overflow: hidden;
}
.mario-chat-header {
    background: #fff;
    padding: 14px 18px;
    border-bottom: 2px solid #fdf2f8;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}
.mario-chat-hero-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #dbeafe;
    border: 2px solid #38bdf8;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}
.mario-chat-hero-name {
    font-size: 15px;
    margin: 0;
    color: #1e293b;
    font-weight: 700;
}
.mario-chat-tag {
    font-size: 11px;
    background: #fdf2f8;
    color: #db2777;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 12px;
    border: 1px solid #fbcfe8;
}
.mario-quick-questions {
    padding: 10px 14px;
    background: #ffffff;
    border-top: 1px dashed #fbcfe8;
    flex-shrink: 0;
    max-height: 120px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.quick-btn {
    text-align: left;
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 12px;
    color: #047857;
    cursor: pointer;
    transition: background 0.1s ease;
}
.quick-btn:hover {
    background: #d1fae5;
}

/* Fullscreen Top Header and HUD controls */
.mario-fs-header {
    display: none;
}
.mario-fs-title-box {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #fff;
}
.mario-fs-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}
.fs-skin-btn {
    background: #065f46;
    border: 1.5px solid #10b981;
    color: #a7f3d0;
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
}
.fs-sound-btn {
    background: #334155;
    border: 1.5px solid #64748b;
    color: #fff;
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
}
.fs-restart-btn {
    background: #854d0e;
    border: 1.5px solid #facc15;
    color: #fef08a;
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}
.mario-touch-hud {
    display: none;
    position: absolute;
    bottom: 12px;
    left: 14px;
    right: 14px;
    justify-content: space-between;
    align-items: flex-end;
    pointer-events: none;
    z-index: 50;
}
.mario-hud-group {
    display: flex;
    gap: 10px;
    pointer-events: auto;
}
.hud-key {
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
}
.hud-key-nav {
    width: 58px;
    height: 50px;
    border-radius: 14px;
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(8px);
    border: 2px solid rgba(255, 255, 255, 0.45);
    color: #ffffff;
    font-size: 22px;
    font-weight: bold;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}
.hud-key-jump {
    min-width: 86px;
    height: 50px;
    padding: 0 18px;
    border-radius: 14px;
    background: rgba(234, 88, 12, 0.88);
    backdrop-filter: blur(8px);
    border: 2px solid rgba(255, 255, 255, 0.6);
    color: #ffffff;
    font-size: 15px;
    font-weight: 800;
    box-shadow: 0 4px 14px rgba(234, 88, 12, 0.5);
}
.mario-message-box {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    background: #fdfbf7;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.mario-welcome-bot-msg {
    background: #ffffff;
    border: 1px solid #fbcfe8;
    border-radius: 14px 14px 14px 4px;
    padding: 12px 14px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    font-size: 14px;
    color: #1e293b;
    line-height: 1.5;
    max-width: 90%;
}
.chat-welcome-bot-title {
    color: #0284c7;
    display: flex;
    align-items: center;
    gap: 5px;
    margin-bottom: 4px;
}
.mario-quick-title {
    font-size: 11px;
    font-weight: 700;
    color: #0284c7;
}
.mario-chat-input-bar {
    padding: 12px 14px;
    background: #ffffff;
    border-top: 1px solid #f0eae1;
    flex-shrink: 0;
}
.mario-chat-form {
    display: flex;
    gap: 8px;
}
.mario-chat-input {
    flex: 1;
    padding: 10px 14px;
    border: 2px solid #fbcfe8;
    border-radius: 10px;
    font-size: 13px;
    outline: none;
    transition: border-color 0.2s;
}
.mario-chat-input:focus {
    border-color: #db2777;
}
.mario-chat-send-btn {
    background: #db2777;
    color: #fff;
    border: none;
    padding: 10px 18px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.15s ease;
}
.mario-chat-send-btn:hover {
    background: #be185d;
}

/* Select Character Page Components */
.select-char-container {
    text-align: center;
}
.select-char-title {
    font-size: 24px;
    font-weight: 800;
    color: #1e293b;
    margin-bottom: 8px;
}
.select-char-subtitle {
    color: #64748b;
    margin-bottom: 25px;
    font-size: 14px;
}
.select-char-empty {
    grid-column: span 2;
    text-align: center;
    color: #64748b;
    width: 100%;
}

/* --- 6. Admin Login Components --- */
.admin-login-wrapper {
    max-width: 480px;
    margin: 40px auto;
    padding: 0 15px;
    position: relative;
    z-index: 5;
}
.admin-login-card {
    background: rgba(255, 255, 255, 0.97);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    border: 2px solid #fbcfe8;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
    padding: 32px 28px;
    text-align: center;
}
.admin-login-icon {
    width: 68px;
    height: 68px;
    border-radius: 50%;
    background: #fef2f2;
    border: 2px solid #fca5a5;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    margin: 0 auto 16px auto;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.15);
}
.admin-login-title {
    font-size: 21px;
    margin: 0 0 8px 0;
    color: #1e293b;
    font-weight: 800;
}
.admin-login-desc {
    font-size: 13px;
    color: #64748b;
    margin: 0 0 24px 0;
    line-height: 1.5;
}
.admin-login-group {
    text-align: left;
    margin-bottom: 16px;
}
.admin-login-label {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: #334155;
    margin-bottom: 6px;
}
.admin-login-input {
    width: 100%;
    padding: 11px 14px;
    border: 2px solid #fbcfe8;
    border-radius: 10px;
    font-size: 14px;
    background: #fff;
    outline: none;
    transition: border-color 0.2s;
    box-sizing: border-box;
}
.admin-login-input:focus {
    border-color: #db2777;
}
.btn-admin-submit {
    width: 100%;
    padding: 13px;
    background: #db2777;
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(219, 39, 119, 0.25);
    transition: background 0.15s ease;
}
.btn-admin-submit:hover {
    background: #be185d;
}
.admin-login-back {
    margin-top: 20px;
    font-size: 13px;
}
.admin-login-back a {
    color: #64748b;
    text-decoration: none;
    font-weight: 600;
}
.admin-badge-protected {
    background: #f1f5f9;
    color: #475569;
    font-size: 11px;
    font-weight: 700;
    padding: 5px 12px;
    border-radius: 8px;
    border: 1.5px solid #cbd5e1;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    user-select: none;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}
.admin-badge-viewonly {
    background: #f8fafc;
    color: #64748b;
    font-size: 11px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    user-select: none;
}

/* Custom Admin Modal Dialogs (Change Password, Delete Admin) */
.admin-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 999999;
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    align-items: center;
    justify-content: center;
    padding: 16px;
    animation: fadeIn 0.15s ease;
}
.admin-modal-box {
    background: #ffffff;
    border-radius: 20px;
    border: 3px solid #fbcfe8;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.25);
    width: 100%;
    max-width: 420px;
    padding: 26px 24px;
    text-align: center;
    position: relative;
    animation: popIn 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
@keyframes popIn {
    from {
        opacity: 0;
        transform: scale(0.92);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}
.admin-modal-close {
    position: absolute;
    top: 14px;
    right: 14px;
    background: transparent;
    border: none;
    font-size: 20px;
    color: #94a3b8;
    cursor: pointer;
    line-height: 1;
    padding: 4px;
    border-radius: 6px;
    transition: color 0.15s;
}
.admin-modal-close:hover {
    color: #db2777;
}
.admin-modal-icon {
    width: 62px;
    height: 62px;
    border-radius: 50%;
    background: #fdf2f8;
    border: 2px solid #fbcfe8;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    margin: 0 auto 14px auto;
    box-shadow: 0 4px 12px rgba(244, 114, 182, 0.2);
}
.admin-modal-icon.danger {
    background: #fef2f2;
    border-color: #fca5a5;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.2);
}
.admin-modal-title {
    font-size: 19px;
    margin: 0 0 6px 0;
    color: #1e293b;
    font-weight: 800;
}
.admin-modal-desc {
    font-size: 13px;
    color: #64748b;
    margin: 0 0 18px 0;
    line-height: 1.5;
}
.admin-modal-group {
    text-align: left;
    margin-bottom: 16px;
    position: relative;
}
.admin-modal-label {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: #334155;
    margin-bottom: 6px;
}
.admin-modal-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}
.admin-modal-input {
    width: 100%;
    padding: 10px 42px 10px 14px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
    box-sizing: border-box;
}
.admin-modal-input:focus {
    border-color: #db2777;
}
.admin-modal-eye-btn {
    position: absolute;
    right: 10px;
    background: none;
    border: none;
    font-size: 16px;
    cursor: pointer;
    color: #94a3b8;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.admin-modal-eye-btn:hover {
    color: #334155;
}
.admin-modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 18px;
}
.admin-modal-btn-cancel {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #cbd5e1;
    padding: 9px 18px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s;
}
.admin-modal-btn-cancel:hover {
    background: #e2e8f0;
}
.admin-modal-btn-submit {
    background: #22c55e;
    color: #ffffff;
    border: none;
    padding: 9px 22px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(34, 197, 94, 0.3);
    transition: background 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.admin-modal-btn-submit:hover {
    background: #16a34a;
}
.admin-modal-btn-danger {
    background: #dc2626;
    color: #ffffff;
    border: none;
    padding: 9px 22px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(220, 38, 38, 0.3);
    transition: background 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.admin-modal-btn-danger:hover {
    background: #b91c1c;
}

/* ========================================================================== */
/* 📱 ADVANCED MOBILE & TOUCH RESPONSIVE STYLES (iOS & Android)               */
/* ========================================================================== */

/* --- Tối ưu hóa cảm ứng & chuyển 2 cột thành 1 cột trên màn hình nhỏ --- */
@media (max-width: 900px) {
    /* Mario & Chat bố cục 2 cột tự động chuyển thành 1 cột dọc */
    .mario-grid-container {
        grid-template-columns: 1fr !important;
        gap: 16px !important;
    }
    #chat-layout-wrapper.has-mario-side {
        grid-template-columns: 1fr !important;
        gap: 16px !important;
    }
}

@media (max-width: 768px) {
    /* 1. Ngăn chặn triệt để iOS Safari tự động phóng to (zoom in) khi chạm vào ô nhập liệu */
    input[type="text"],
    input[type="password"],
    input[type="email"],
    input[type="search"],
    textarea,
    select {
        font-size: 16px !important;
    }

    /* 2. Căn chỉnh khoảng cách đáy màn hình & thanh cỏ Mario */
    body {
        padding-bottom: 54px !important;
    }
    .mario-ground {
        height: 36px !important;
        background-size: 24px 36px !important;
    }

    /* 3. Đám mây Retro thu nhỏ vừa tầm nhìn */
    .cloud-retro {
        transform: scale(0.65) !important;
        opacity: 0.8 !important;
    }
    .cloud-1 { top: 10% !important; }
    .cloud-2 { top: 18% !important; }
    .cloud-3 { top: 14% !important; }

    /* 4. Khung Header / Navbar */
    /* Đã tối ưu hóa đồng bộ với hệ thống menu hamburger floating ở trên */

    /* 5. Modal bắt buộc nhập tên */
    #welcome-name-modal {
        padding: 12px !important;
    }
    .welcome-box {
        padding: 22px 18px !important;
        border-radius: 18px !important;
        max-width: 95% !important;
    }
    .welcome-box h2 {
        font-size: 18px !important;
        margin-bottom: 6px !important;
    }
    .welcome-box p {
        font-size: 12px !important;
        margin-bottom: 16px !important;
    }

    /* 6. Trang chủ (Home Page) */
    .container {
        padding: 15px 10px !important;
        min-height: auto !important;
    }
    .container h1 {
        font-size: 22px !important;
        line-height: 1.3 !important;
        margin-bottom: 8px !important;
    }
    .container p {
        font-size: 14px !important;
        margin-bottom: 18px !important;
    }
    .container .btn {
        width: 100% !important;
        max-width: 380px !important;
        justify-content: center !important;
        font-size: 15px !important;
        padding: 11px 18px !important;
    }

    /* 7. Khung Chat chính (Chat.ejs) - Tối ưu toàn diện để hiển thị tối đa vùng đọc tin nhắn trên điện thoại */
    .chat-outer-wrapper {
        margin: 4px auto 14px auto !important;
        padding: 0 6px !important;
    }
    .char-switcher-bar {
        gap: 6px !important;
        padding: 2px 0 6px 0 !important;
        -webkit-overflow-scrolling: touch !important;
    }
    .char-switcher-bar a {
        padding: 4px 10px !important;
        font-size: 11px !important;
        flex-shrink: 0 !important;
    }
    #chat-main-card {
        height: calc(100vh - 75px) !important;
        height: calc(100dvh - 75px) !important;
        border-radius: 16px !important;
        border-width: 2px !important;
    }
    .chat-header-bar {
        padding: 6px 10px !important;
        flex-wrap: nowrap !important;
        gap: 6px !important;
        justify-content: space-between !important;
    }
    .chat-header-info {
        gap: 8px !important;
        min-width: 0 !important;
        flex: 1 1 auto !important;
    }
    .chat-avatar-img,
    .chat-avatar-placeholder {
        width: 36px !important;
        height: 36px !important;
        font-size: 18px !important;
        flex-shrink: 0 !important;
    }
    .chat-character-title {
        font-size: 14px !important;
        line-height: 1.2 !important;
        max-width: 135px !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }
    .chat-voice-btn {
        padding: 2px 6px !important;
        font-size: 10px !important;
        flex-shrink: 0 !important;
    }
    .chat-online-badge {
        font-size: 10px !important;
        line-height: 1.2 !important;
        display: block !important;
    }
    .chat-header-tools {
        flex-shrink: 0 !important;
        margin-left: auto !important;
    }
    .chat-toggle-mario-btn {
        padding: 5px 10px !important;
        font-size: 11px !important;
        font-weight: 700 !important;
        border-radius: 20px !important;
        white-space: nowrap !important;
        gap: 4px !important;
        box-shadow: 0 2px 4px rgba(234, 179, 8, 0.25) !important;
    }
    .chat-game-btn-icon {
        font-size: 12px !important;
    }
    .chat-game-btn-text {
        font-size: 11px !important;
    }
    .message-box {
        flex: 1 1 auto !important;
        min-height: 220px !important;
        padding: 10px 8px !important;
        gap: 8px !important;
    }
    .message.user, .message.bot {
        max-width: 92% !important;
        padding: 8px 12px !important;
        font-size: 13.5px !important;
        border-radius: 14px !important;
        line-height: 1.4 !important;
    }
    /* Khung Dock chung dưới đáy trên Mobile: Chung 1 khung, thấy cả 3 câu hỏi */
    .chat-bottom-dock {
        padding: 8px 10px 10px 10px !important;
        gap: 6px !important;
        border-radius: 0 0 16px 16px !important;
        border-top: 1.5px solid #fdf2f8 !important;
        background: #ffffff !important;
    }
    .options-in-chat {
        max-height: none !important;
        padding: 0 !important;
        margin: 0 !important;
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
        gap: 4px !important;
    }
    .options-in-chat.is-collapsed {
        max-height: 24px !important;
        padding: 0 !important;
    }
    .options-title {
        font-size: 11px !important;
        margin-bottom: 2px !important;
    }
    .options-buttons-list {
        gap: 5px !important;
        max-height: none !important; /* Đảm bảo thấy trọn vẹn cả 3 câu hỏi không bị thanh cuộn cắt mất */
        overflow-y: visible !important;
    }
    .question-btn {
        padding: 6px 10px !important;
        font-size: 12px !important;
        min-height: 30px !important;
        line-height: 1.25 !important;
        border-radius: 12px !important;
        gap: 6px !important;
        background: #ffffff !important;
        border: 1px solid #fbcfe8 !important;
        box-shadow: 0 1px 4px rgba(219, 39, 119, 0.04) !important;
    }
    .question-btn .q-icon-pill {
        width: 22px !important;
        height: 22px !important;
        font-size: 12px !important;
    }
    .question-btn .q-text {
        font-size: 12px !important;
        line-height: 1.25 !important;
    }
    .question-btn .q-arrow {
        font-size: 11px !important;
    }
    .chat-input-bar {
        padding: 4px 0 0 0 !important;
        margin: 0 !important;
        border-top: 1px dashed #fce7f3 !important;
        background: transparent !important;
    }
    #chat-free-form input {
        font-size: 16px !important;
        padding: 8px 12px !important;
    }
    #chat-free-form button {
        padding: 8px 14px !important;
        font-size: 12.5px !important;
    }

    /* 8. Trang Mario & Chat (MarioChat.ejs / FlappyChat.ejs) */
    .mario-play-chat-wrapper {
        margin: 4px auto 12px auto !important;
        padding: 0 4px !important;
        width: 100% !important;
        max-width: 100vw !important;
    }
    .game-column {
        width: 100% !important;
        max-width: 100% !important;
        gap: 8px !important;
    }
    .game-card {
        border-radius: 14px !important;
        border-width: 2.5px !important;
    }
    .game-canvas,
    .game-dom-viewport {
        border-radius: 12px !important;
        aspect-ratio: 4 / 3 !important; /* Tỉ lệ 4:3 cao hơn, to hơn rõ rệt 33% trên màn hình điện thoại */
        max-height: 65vh !important;
        min-height: 290px !important;
    }
    .mario-header-bar {
        padding: 6px 12px !important;
        margin-bottom: 6px !important;
        border-radius: 10px !important;
    }
    .mario-header-icon {
        font-size: 18px !important;
    }
    .mario-header-h1 {
        font-size: 14px !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }
    .game-hud-toolbar {
        top: 8px !important;
        left: 8px !important;
        gap: 6px !important;
        z-index: 999 !important;
    }
    .game-hud-btn {
        padding: 6px 10px !important;
        font-size: 12px !important;
        border-radius: 10px !important;
        gap: 4px !important;
    }
    .game-hud-btn .hud-btn-label {
        display: inline !important; /* Trên điện thoại: hiển thị rõ chữ Âm thanh, Chơi lại, Toàn màn */
        font-size: 11px !important;
        font-weight: 700 !important;
    }

    /* Khi chơi game trên điện thoại: Tự động ẩn toàn bộ các nút điều khiển để màn hình sạch sẽ, không che tầm nhìn */
    body.is-playing .game-hud-toolbar,
    .is-playing .game-hud-toolbar,
    #mario-game-container.is-playing .game-hud-toolbar,
    body.is-playing .game-hud-exit-btn,
    .is-playing .game-hud-exit-btn,
    #mario-game-container.is-playing .game-hud-exit-btn,
    body.is-playing #chatflex-music-widget {
        opacity: 0 !important;
        visibility: hidden !important;
        pointer-events: none !important;
        transform: translateY(-12px) !important;
        transition: opacity 0.22s ease, transform 0.22s ease, visibility 0.22s ease !important;
    }
    .chat-card {
        height: 480px !important;
        border-radius: 16px !important;
    }

    /* Bàn phím ảo cảm ứng (Virtual D-pad) siêu mượt trên điện thoại */
    .controls-card {
        padding: 10px 12px !important;
        justify-content: center !important;
    }
    .controls-guide-text {
        display: none !important;
    }
    .virtual-keys-group {
        width: 100% !important;
        justify-content: center !important;
        gap: 12px !important;
    }
    .virtual-key {
        touch-action: manipulation !important;
        -webkit-touch-callout: none !important;
        -webkit-user-select: none !important;
        user-select: none !important;
        -webkit-tap-highlight-color: transparent !important;
    }
    #vkey-left, #vkey-right {
        width: 58px !important;
        height: 48px !important;
        font-size: 22px !important;
        border-radius: 10px !important;
    }
    #vkey-jump {
        height: 48px !important;
        font-size: 15px !important;
        padding: 0 20px !important;
        font-weight: 800 !important;
        border-radius: 10px !important;
    }
    .virtual-key:active {
        transform: scale(0.92) !important;
        background: #e2e8f0 !important;
    }
    #vkey-jump:active {
        transform: scale(0.92) !important;
        background: #fdba74 !important;
    }

    /* Phím ảo trong Mario Side Panel (khi mở trong trang Chat) */
    .mario-panel-footer {
        padding: 6px 10px !important;
        flex-direction: column !important;
        gap: 6px !important;
    }
    .mario-panel-footer > span {
        display: none !important;
    }

    /* 9. Trang Quản trị Admin (Admin.ejs & EditCharacter.ejs) */
    .admin-card {
        padding: 16px 14px !important;
        border-radius: 16px !important;
    }
    .admin-studio-grid {
        grid-template-columns: 1fr !important;
        gap: 16px !important;
        padding: 14px !important;
    }
    .admin-music-grid-2, .admin-music-grid-3 {
        grid-template-columns: 1fr !important;
        gap: 10px !important;
    }
    .character-item-card {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 12px !important;
        padding: 14px !important;
    }
    .character-actions {
        width: 100% !important;
        margin-left: 0 !important;
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        gap: 8px !important;
    }
    .character-actions a, .character-actions button {
        width: 100% !important;
        justify-content: center !important;
        text-align: center !important;
        padding: 8px 10px !important;
    }
}

/* --- Màn hình điện thoại nhỏ (< 480px) --- */
@media (max-width: 480px) {
    .navbar-brand .brand-text {
        font-size: 16px !important;
    }
    .nav-item {
        padding: 5px 8px !important;
        font-size: 11px !important;
    }
    #chat-main-card {
        height: calc(100vh - 110px) !important;
        height: calc(100dvh - 110px) !important;
    }
    #vkey-left, #vkey-right {
        width: 52px !important;
        height: 46px !important;
        font-size: 20px !important;
    }
    #vkey-jump {
        height: 46px !important;
        font-size: 14px !important;
        padding: 0 14px !important;
    }
}

/* Card nhân vật mặc định do Admin chọn trên Trang Chủ */
.hero-character-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 16px 36px rgba(244, 114, 182, 0.24) !important;
}

@media (max-width: 640px) {
    .hero-character-card {
        padding: 22px 16px !important;
        border-radius: 20px !important;
        margin-bottom: 20px !important;
    }
}

/* HUD phím ảo cảm ứng nổi trong chế độ Fullscreen */
#mario-game-container:fullscreen .mario-touch-hud,
#mario-game-container:-webkit-full-screen .mario-touch-hud,
.is-mario-fullscreen .mario-touch-hud {
    display: flex !important;
}

.hud-key:active {
    transform: scale(0.92);
    filter: brightness(1.25);
}

@media (max-width: 640px) {
    .controls-card {
        padding: 10px 12px !important;
        gap: 8px !important;
    }
    .controls-guide-text {
        order: -1;
        width: 100% !important;
        margin-bottom: 2px !important;
    }
    .gamepad-dpad-left button {
        width: 58px !important;
        height: 50px !important;
        font-size: 22px !important;
    }
    .gamepad-action-right button {
        height: 50px !important;
        font-size: 15px !important;
        padding: 0 20px !important;
    }
}

/* Modal Kho Emoji & Biểu Tượng */
.emoji-cat-btn {
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    color: #475569;
    padding: 4px 10px;
    border-radius: 16px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s ease;
    user-select: none;
}
.emoji-cat-btn.active, .emoji-cat-btn:hover {
    background: #fdf2f8 !important;
    border-color: #fbcfe8 !important;
    color: #db2777 !important;
    font-weight: 700 !important;
}
.emoji-grid-item {
    font-size: 20px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    border: 1px solid #f1f5f9;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.1s ease, background 0.1s ease, border-color 0.1s ease;
    user-select: none;
}
.emoji-grid-item:hover {
    transform: scale(1.22);
    background: #fdf2f8;
    border-color: #fbcfe8;
    z-index: 2;
    box-shadow: 0 2px 6px rgba(219, 39, 119, 0.15);
}

/* ========================================================================== */
/* ✨ IMPECCABLE UI/UX UPGRADES & POLISH                                      */
/* ========================================================================== */

/* 1. Custom Pastel Smooth Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: rgba(253, 242, 248, 0.6);
    border-radius: 10px;
}
::-webkit-scrollbar-thumb {
    background: #fbcfe8;
    border-radius: 10px;
    border: 2px solid transparent;
    background-clip: padding-box;
    transition: background 0.2s ease;
}
::-webkit-scrollbar-thumb:hover {
    background: #f472b6;
    background-clip: padding-box;
}

/* 2. Impeccable Input Focus Glow Ring */
input[type="text"]:focus,
input[type="password"]:focus,
textarea:focus,
select:focus,
.chat-free-input:focus,
.mario-chat-input:focus,
.admin-modal-input:focus,
#emoji-search-input:focus,
#iconInput:focus {
    outline: none !important;
    border-color: #db2777 !important;
    box-shadow: 0 0 0 3.5px rgba(219, 39, 119, 0.18) !important;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

/* 3. Primary Button Spring Micro-interaction */
.btn-home-chat,
.btn-home-mario,
.chat-send-btn,
.welcome-submit-btn,
.btn-admin-submit,
.mario-chat-send-btn,
.admin-modal-btn-submit {
    transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.18s ease, background 0.15s ease !important;
}
.btn-home-chat:hover,
.btn-home-mario:hover,
.chat-send-btn:hover,
.welcome-submit-btn:hover,
.btn-admin-submit:hover,
.mario-chat-send-btn:hover,
.admin-modal-btn-submit:hover {
    transform: translateY(-2px) scale(1.01) !important;
    box-shadow: 0 6px 18px rgba(219, 39, 119, 0.28) !important;
}
.btn-home-chat:active,
.btn-home-mario:active,
.chat-send-btn:active,
.welcome-submit-btn:active,
.btn-admin-submit:active,
.mario-chat-send-btn:active,
.admin-modal-btn-submit:active {
    transform: translateY(1px) scale(0.99) !important;
    box-shadow: 0 2px 6px rgba(219, 39, 119, 0.15) !important;
}

/* 4. Modal Close (✕) Rotate Micro-interaction */
.admin-modal-close {
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), color 0.15s ease, background 0.15s ease !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 32px !important;
    height: 32px !important;
    border-radius: 50% !important;
    cursor: pointer !important;
}
.admin-modal-close:hover {
    transform: rotate(90deg) scale(1.15) !important;
    color: #e11d48 !important;
    background: #fee2e2 !important;
}

/* 5. Skeleton Shimmer Loading Effect */
@keyframes shimmerLoading {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}
.skeleton-shimmer {
    background: linear-gradient(90deg, #fdf2f8 25%, #fce7f3 50%, #fdf2f8 75%) !important;
    background-size: 200% 100% !important;
    animation: shimmerLoading 1.6s infinite ease-in-out !important;
}

/* 6. Question / Quick-reply Polish */
.question-btn {
    border-radius: 12px !important;
    transition: all 0.18s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
}
.question-btn:hover {
    transform: translateY(-2px) scale(1.008) !important;
    box-shadow: 0 4px 14px rgba(219, 39, 119, 0.14) !important;
}
.question-btn:active {
    transform: translateY(0) scale(0.99) !important;
}

/* 7. Enhanced Card & Modal Elevation */
.admin-modal-box {
    box-shadow: 0 20px 45px -10px rgba(219, 39, 119, 0.2), 0 0 0 1px rgba(251, 207, 232, 0.8) !important;
}

/* 8. Text Contrast & Readability (WCAG AA Compliant) */
.welcome-hint, .welcome-admin-hint, .form-hint {
    color: #64748b !important;
}

/* ========================================================================== */
/* 💌 MODAL BỨC THIỆP ĐỘNG VIÊN GAME OVER                                    */
/* ========================================================================== */

.game-card-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999999;
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    animation: fadeIn 0.2s ease;
}

.game-card-wrapper {
    position: relative;
    max-width: 520px;
    width: 95%;
    animation: popInCard 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes popInCard {
    0% {
        opacity: 0;
        transform: scale(0.85) translateY(20px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.game-card-close-btn {
    position: absolute;
    top: -12px;
    right: -12px;
    z-index: 10;
    background: #ffffff;
    border: 2px solid #fbcfe8;
    color: #94a3b8;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 16px;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: flex;
    align-items: center;
    justify-content: center;
}
.game-card-close-btn:hover {
    color: #e11d48;
    background: #fee2e2;
    border-color: #fda4af;
    transform: rotate(90deg) scale(1.1);
}

.game-card-inner {
    background: linear-gradient(145deg, #fffdfa 0%, #fff1f2 100%);
    border-radius: 24px;
    border: 3px solid #fbcfe8;
    box-shadow: 0 25px 60px -10px rgba(219, 39, 119, 0.35), 0 0 0 6px rgba(253, 242, 248, 0.9);
    padding: 28px 24px 22px 24px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.game-card-seal-row {
    margin-bottom: 10px;
}

.game-card-seal {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f43f5e 0%, #be123c 100%);
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    box-shadow: 0 4px 14px rgba(190, 18, 60, 0.4);
    border: 3px solid #ffe4e6;
    animation: sealPulse 2.5s infinite ease-in-out;
}

@keyframes sealPulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 4px 14px rgba(190, 18, 60, 0.4);
    }
    50% {
        transform: scale(1.08);
        box-shadow: 0 6px 20px rgba(219, 39, 119, 0.6);
    }
}

.game-card-title {
    font-size: 21px;
    font-weight: 800;
    color: #db2777;
    margin: 0 0 4px 0;
    letter-spacing: -0.3px;
    font-family: 'Quicksand', sans-serif;
}

.game-card-ribbon {
    color: #f472b6;
    font-size: 13px;
    margin-bottom: 10px;
    letter-spacing: 4px;
    opacity: 0.8;
}

.game-card-message {
    font-size: 15px;
    color: #334155;
    line-height: 1.75;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.8);
    border: 1.5px dashed #fbcfe8;
    border-radius: 16px;
    padding: 16px 18px;
    margin: 10px 0 14px 0;
    white-space: pre-line;
    text-align: center;
    font-style: italic;
    box-shadow: inset 0 2px 6px rgba(219, 39, 119, 0.04);
}

/* Toggle Switch Pastel */
.admin-toggle-switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 26px;
    cursor: pointer;
    flex-shrink: 0;
}
.admin-toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.admin-toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background-color: #cbd5e1;
    transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 26px;
}
.admin-toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
.admin-toggle-switch input:checked + .admin-toggle-slider {
    background-color: #db2777;
}
.admin-toggle-switch input:checked + .admin-toggle-slider:before {
    transform: translateX(22px);
}

.game-card-stats-badge {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: #ffffff;
    border: 1.5px solid #fbcfe8;
    border-radius: 20px;
    padding: 6px 16px;
    font-size: 12px;
    font-weight: 700;
    color: #475569;
    margin-bottom: 12px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

.game-card-sender {
    font-size: 13px;
    font-weight: 700;
    color: #be185d;
    margin-bottom: 18px;
}

.game-card-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.game-card-btn-restart {
    background: linear-gradient(135deg, #db2777, #be185d);
    color: #ffffff;
    font-weight: 800;
    border: none;
    border-radius: 14px;
    padding: 11px 24px;
    font-size: 14px;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(219, 39, 119, 0.35);
    transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.game-card-btn-restart:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 8px 22px rgba(219, 39, 119, 0.45);
}
.game-card-btn-restart:active {
    transform: translateY(1px) scale(0.98);
}

.game-card-btn-close {
    background: #f8fafc;
    color: #475569;
    font-weight: 700;
    border: 1px solid #cbd5e1;
    border-radius: 14px;
    padding: 11px 20px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.15s ease;
}
.game-card-btn-close:hover {
    background: #e2e8f0;
    color: #1e293b;
}

/* Các hoa và sticker bay nhẹ quanh thiệp */
.card-floating-deco {
    position: absolute;
    font-size: 22px;
    pointer-events: none;
    z-index: 5;
    animation: floatDeco 3.2s infinite ease-in-out;
}
.card-deco-1 { top: -8px; left: 16px; animation-delay: 0s; font-size: 24px; }
.card-deco-2 { top: 30px; right: 12px; animation-delay: 0.8s; font-size: 20px; }
.card-deco-3 { bottom: 20px; left: 12px; animation-delay: 1.6s; font-size: 22px; }
.card-deco-4 { bottom: -6px; right: 28px; animation-delay: 2.2s; font-size: 20px; }

@keyframes floatDeco {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
    }
    50% {
        transform: translateY(-8px) rotate(8deg);
    }
}

/* Nút gợi ý bật nhạc trên Mobile */
@keyframes pulse {
    0%, 100% { transform: translateX(-50%) scale(1); box-shadow: 0 4px 16px rgba(244,63,94,0.5); }
    50% { transform: translateX(-50%) scale(1.06); box-shadow: 0 6px 24px rgba(244,63,94,0.75); }
}

/* ========================================================
   TỐI ƯU HÓA HIỆU NĂNG & GIAO DIỆN DI ĐỘNG (MOBILE OPTIMIZATION)
   ======================================================== */
@media (max-width: 680px) {
    /* 1. Header Toàn màn hình trên Mobile: Đã ẩn hoàn toàn, chỉ dùng arcade pill buttons */
    #mario-side-panel:fullscreen .mario-panel-header,
    #mario-game-container:fullscreen .mario-fs-header,
    .is-mario-fullscreen .mario-panel-header,
    .is-mario-fullscreen .mario-fs-header,
    #mario-side-panel:-webkit-full-screen .mario-panel-header,
    #mario-game-container:-webkit-full-screen .mario-fs-header {
        display: none !important;
    }

    /* Nút thoát fullscreen nhỏ hơn trên điện thoại */
    .game-hud-exit-btn {
        padding: 6px 10px !important;
        font-size: 12px !important;
    }
    .game-hud-exit-btn .hud-btn-label {
        display: none !important;
    }

    .mario-fs-title-box {
        gap: 6px !important;
        min-width: 0 !important;
    }

    .mario-fs-text-title {
        font-size: 13px !important;
        font-weight: 800 !important;
        max-width: 130px !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }

    .mario-fs-actions {
        gap: 6px !important;
        flex-shrink: 0 !important;
    }

    .mario-fs-actions button {
        padding: 5px 9px !important;
        font-size: 13px !important;
        height: 32px !important;
        min-width: 32px !important;
        line-height: 1 !important;
        border-radius: 8px !important;
    }

    /* 2. Đĩa nhạc góc phải: Nâng cao lên khỏi nút BAY LÊN trên mobile */
    #chatflex-music-widget {
        bottom: 95px !important;
        right: 12px !important;
        z-index: 9999 !important; /* Đảm bảo luôn nằm trên cùng và bấm ăn ngay */
    }

    #music-min-disc {
        width: 44px !important;
        height: 44px !important;
    }

    /* 3. Tối ưu phản hồi cảm ứng cho nút bay và Canvas */
    .virtual-key-jump,
    .hud-key-jump {
        touch-action: manipulation !important;
        -webkit-tap-highlight-color: transparent !important;
        user-select: none !important;
        -webkit-user-select: none !important;
    }

    .game-canvas,
    .game-dom-viewport {
        touch-action: manipulation !important;
        -webkit-tap-highlight-color: transparent !important;
    }

    /* 4. Tấm thiệp động viên Game Over trên màn hình nhỏ (Tối ưu gọn gàng không bị dài, cuộn mượt mà) */
    .game-card-wrapper {
        width: 92vw !important;
        max-width: 92vw !important;
        max-height: 90vh !important;
        padding: 0 !important;
        margin: auto !important;
        display: flex !important;
        flex-direction: column !important;
    }

    .game-card-inner {
        padding: 16px 14px 14px 14px !important;
        border-radius: 20px !important;
        max-height: 88vh !important;
        display: flex !important;
        flex-direction: column !important;
    }

    .game-card-seal-row {
        margin-bottom: 6px !important;
    }

    .game-card-seal {
        width: 42px !important;
        height: 42px !important;
        font-size: 20px !important;
        border-width: 2px !important;
    }

    .game-card-title {
        font-size: 17px !important;
        margin: 0 0 2px 0 !important;
    }

    .game-card-ribbon {
        font-size: 11px !important;
        margin-bottom: 6px !important;
        letter-spacing: 2px !important;
    }

    .game-card-message {
        font-size: 13px !important;
        line-height: 1.55 !important;
        padding: 10px 12px !important;
        margin: 6px 0 8px 0 !important;
        border-radius: 12px !important;
        max-height: 38vh !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
        scrollbar-width: thin;
        scrollbar-color: #f472b6 #fdf2f8;
    }

    .game-card-message::-webkit-scrollbar {
        width: 4px;
    }
    .game-card-message::-webkit-scrollbar-thumb {
        background: #f472b6;
        border-radius: 4px;
    }
    .game-card-message::-webkit-scrollbar-track {
        background: #fdf2f8;
    }

    .game-card-stats-badge {
        font-size: 11.5px !important;
        padding: 3px 8px !important;
        margin-bottom: 6px !important;
    }

    .game-card-sender {
        font-size: 12px !important;
        margin-bottom: 8px !important;
    }

    .game-card-actions {
        gap: 6px !important;
    }

    .game-card-btn-restart {
        padding: 8px 14px !important;
        font-size: 13px !important;
    }

    .game-card-btn-close {
        padding: 8px 12px !important;
        font-size: 12px !important;
    }

    .game-card-quote {
        font-size: 13px !important;
        line-height: 1.5 !important;
    }

    /* 5. Khung Dock chung dưới đáy tối ưu trên Mobile - Chung 1 khung, thấy trọn vẹn cả 3 câu hỏi */
    .chat-bottom-dock {
        padding: 8px 10px 10px 10px !important;
        gap: 6px !important;
        background: #ffffff !important;
    }
    .options-in-chat {
        padding: 0 !important;
        margin: 0 !important;
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
        max-height: none !important;
        gap: 4px !important;
    }
    .options-in-chat.is-collapsed {
        max-height: 24px !important;
        padding: 0 !important;
    }
    .options-title {
        font-size: 11px !important;
        margin-bottom: 2px !important;
    }
    .options-buttons-list {
        gap: 5px !important;
        max-height: none !important; /* Đảm bảo đủ chiều cao hiển thị trọn vẹn CẢ 3 CÂU HỎI mà không bị thanh cuộn cắt */
        overflow-y: visible !important;
    }
    .question-btn {
        padding: 6px 10px !important;
        border-radius: 12px !important;
        gap: 6px !important;
        min-height: 30px !important;
        background: #ffffff !important;
        border: 1px solid #fbcfe8 !important;
    }
    .question-btn .q-icon-pill {
        width: 22px !important;
        height: 22px !important;
        font-size: 12px !important;
    }
    .question-btn .q-text {
        font-size: 12px !important;
        line-height: 1.25 !important;
    }
    .question-btn .q-arrow {
        font-size: 11px !important;
    }
}

/* ============================================================
   GAME PAGE PERFORMANCE MODE
   Khi trang có class "game-page-active" trên body:
   → Đóng băng toàn bộ animation phông nền để giải phóng
     GPU Compositor Thread hoàn toàn cho game loop
   ============================================================ */
body.game-page-active .cloud-retro,
body.game-page-active .cloud-1,
body.game-page-active .cloud-2,
body.game-page-active .cloud-3,
body.game-page-active .random-star,
body.game-page-active .starry-sky,
body.game-page-active .mario-ground {
    animation-play-state: paused !important;
    animation: none !important;
    display: none !important;
}

/* Tắt grid pattern body::before tốn kém trên trang game */
body.game-page-active::before {
    display: none !important;
}

/* Tắt background gradient phức tạp – thay bằng màu đơn giản */
body.game-page-active {
    background: #c1ebd9 !important;
}

/* Loại bỏ backdrop-filter của controls-card khi đang chơi game */
body.game-page-active .controls-card {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    background: rgba(255, 255, 255, 0.98) !important;
}

/* Tắt box-shadow nặng của game-card khi đang render game loop */
body.game-page-active .game-card {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
}

/* Seamless SPA Router View Container */
.app-router-view {
    width: 100%;
    flex: 1 0 auto;
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 120px);
}


/* ========================================================
   FLAPPY BANGBOO - BỐ CỤC TO RÕ ĐÃ MẮT TRÊN MÁY TÍNH (PC)
   Giữ nguyên 100% bố cục di động dưới 768px, chỉ mở rộng trên PC
   ======================================================== */
@media (min-width: 769px) {
    .mario-play-chat-wrapper {
        width: 100% !important;
        max-width: 1080px !important;
        margin: 14px auto 32px auto !important;
        padding: 0 16px !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        box-sizing: border-box !important;
    }

    .mario-header-bar {
        width: 100% !important;
        max-width: min(1000px, calc((100vh - 175px) * 16 / 9)) !important;
        margin-bottom: 12px !important;
        padding: 10px 20px !important;
        box-sizing: border-box !important;
    }

    .mario-header-h1 {
        font-size: 17px !important;
    }

    .mario-header-icon {
        font-size: 24px !important;
    }

    .game-column {
        width: 100% !important;
        max-width: min(1000px, calc((100vh - 175px) * 16 / 9)) !important;
        margin: 0 auto !important;
        display: flex !important;
        flex-direction: column !important;
        gap: 14px !important;
        box-sizing: border-box !important;
    }

    .game-card {
        width: 100% !important;
        border-radius: 20px !important;
        box-shadow: 0 12px 36px rgba(0, 0, 0, 0.3) !important;
    }

    .game-card:not(:fullscreen) .game-canvas,
    .game-card:not(:fullscreen) .game-dom-viewport {
        width: 100% !important;
        height: auto !important;
        aspect-ratio: 16 / 9 !important;
        min-height: 480px !important;
        max-height: calc(100vh - 175px) !important;
    }
}
