/* ========================================================
   GAME ĐẠI HỌC TÂY NGUYÊN (TNU 2D TOP-DOWN CASUAL)
   STYLESHEET & UI DESIGN SYSTEM
   ======================================================== */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-user-select: none;
}

body {
    background-color: #12161f;
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
    color: #f1faee;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    width: 100vw;
}

#game-wrapper {
    position: relative;
    width: 1280px;
    height: 720px;
    background: #000;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8), 0 0 0 3px #264653;
    border-radius: 12px;
    overflow: hidden;
}

#game-canvas {
    display: block;
    width: 1280px;
    height: 720px;
    background-color: #2b2d42;
}

/* ========================================================
   HUD (HEADS-UP DISPLAY) OVERLAY
   ======================================================== */
#hud-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none; /* Cho phép click xuyên qua canvas trừ các widget */
    padding: 16px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.hud-top-bar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    pointer-events: auto;
}

/* Bản đồ hiện tại */
.map-badge-card {
    background: rgba(18, 22, 31, 0.88);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-left: 5px solid #e76f51;
    border-radius: 8px;
    padding: 8px 16px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
}

.map-badge-card .label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #a8dadc;
    font-weight: 600;
}

.map-badge-card .map-name {
    font-size: 16px;
    font-weight: 700;
    color: #ffffff;
    margin-top: 2px;
}

/* Tiện ích âm thanh & Hướng dẫn */
.hud-quick-buttons {
    display: flex;
    gap: 8px;
}

.hud-btn {
    background: rgba(29, 53, 87, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #ffffff;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.hud-btn:hover {
    background: #457b9d;
    transform: translateY(-2px);
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.4);
}

/* ========================================================
   HUD BOTTOM PANELS (TÚI ĐỒ, THIỆN CẢM, TRANG PHỤC, QUEST)
   ======================================================== */
.hud-bottom-bar {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    pointer-events: auto;
    gap: 16px;
}

/* Panel Túi Đồ (Inventory) */
.inventory-panel {
    background: rgba(18, 22, 31, 0.92);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    padding: 10px 16px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
}

.inventory-panel .panel-title {
    font-size: 11px;
    font-weight: 700;
    color: #f4a261;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 8px;
}

.inventory-items-row {
    display: flex;
    gap: 10px;
}

.inv-slot {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 6px 10px;
    min-width: 68px;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    transition: all 0.2s ease;
}

.inv-slot:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: #ffd166;
}

.inv-slot .slot-icon {
    font-size: 20px;
    margin-bottom: 2px;
}

.inv-slot .slot-name {
    font-size: 10px;
    color: #adb5bd;
    white-space: nowrap;
}

.inv-slot .slot-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #e63946;
    color: #ffffff;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 10px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.4);
}

/* Panel Thiện Cảm & Trang Phục */
.progression-panel {
    background: rgba(18, 22, 31, 0.92);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    padding: 12px 18px;
    min-width: 310px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
}

.progression-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.prog-label {
    font-size: 12px;
    font-weight: 700;
    color: #ff758f;
    display: flex;
    align-items: center;
    gap: 4px;
}

.prog-score {
    font-size: 14px;
    font-weight: 800;
    color: #fee440;
}

.affection-progress-bar {
    width: 100%;
    height: 10px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 6px;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.affection-fill {
    height: 100%;
    background: linear-gradient(90deg, #ff4d6d, #f72585, #fee440);
    width: 0%;
    transition: width 0.4s ease;
}

.badge-locked {
    background: rgba(230, 57, 70, 0.2);
    color: #ff758f;
    border: 1px solid #e63946;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 12px;
}

.badge-unlocked {
    background: rgba(82, 183, 136, 0.2);
    color: #74c69d;
    border: 1px solid #52b788;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 12px;
    animation: pulseGlow 1.5s infinite;
}

@keyframes pulseGlow {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.85; transform: scale(1.05); }
}

.outfit-display-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 6px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 6px;
    font-size: 12px;
}

.outfit-name-val {
    color: #4cc9f0;
    font-weight: 700;
}

/* Quest Widget góc phải */
.quest-tracker-card {
    background: rgba(18, 22, 31, 0.92);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 209, 102, 0.3);
    border-left: 4px solid #ffd166;
    border-radius: 10px;
    padding: 10px 14px;
    max-width: 320px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
}

.quest-title {
    font-size: 12px;
    font-weight: 700;
    color: #ffd166;
    margin-bottom: 4px;
}

.quest-desc {
    font-size: 11px;
    color: #e0e1dd;
    line-height: 1.4;
}

.quest-tag {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 9px;
    font-weight: 700;
    margin-right: 4px;
    background: #6c757d;
    color: #fff;
}
.quest-tag.in-prog { background: #028090; }
.quest-tag.ready { background: #f77f00; animation: pulseGlow 1s infinite; }
.quest-tag.done { background: #2a9d8f; }

/* ========================================================
   THANH BALO NHỎ & THANH THIỆN CẢM NHỎ (HUD BOTTOM MINI BARS - KHUNG MÀU BE CHUẨN ẢNH 2)
   ======================================================== */
.hud-mini-bar,
.hud-beige-box {
    background: #fbf6d9;
    border: 3.5px solid #5c4731;
    border-radius: 8px;
    position: relative;
    padding: 8px 12px;
    height: 76px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45), inset 0 0 10px rgba(180, 150, 100, 0.25);
    font-family: 'Itim', 'Mali', 'Patrick Hand', cursive, sans-serif;
    color: #3b2512;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    user-select: none;
    flex-shrink: 0;
}

.hud-mini-bar::before,
.hud-beige-box::before {
    content: "";
    position: absolute;
    inset: 4px;
    border: 1.5px solid #7c6348;
    border-radius: 5px;
    pointer-events: none;
}

.hud-mini-bar:hover,
.hud-beige-box:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.55), inset 0 0 14px rgba(180, 150, 100, 0.35);
}

.backpack-bar,
.hud-backpack-beige {
    min-width: 280px;
    flex: 1 1 290px;
    max-width: 360px;
}

.affection-bar,
.hud-affection-beige {
    min-width: 310px;
    flex: 1.1 1 320px;
    max-width: 420px;
}

.mini-bar-icon-wrap {
    position: relative;
    width: 46px;
    height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.mini-bar-total-badge,
.hud-beige-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #e63946;
    color: #ffffff;
    font-size: 11px;
    font-weight: 800;
    min-width: 19px;
    height: 19px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1.5px solid #5c4731;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.4);
    font-family: 'Itim', sans-serif;
    z-index: 10;
}

/* Modal Khung Màu Be Chuẩn Phong Cách Vintage / Nhiệm Vụ */
.modal-box-beige {
    background: #fbf6d9 !important;
    border: 3.5px solid #5c4731 !important;
    border-radius: 12px !important;
    position: relative !important;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.65), inset 0 0 15px rgba(180, 150, 100, 0.25) !important;
    color: #3b2512 !important;
    font-family: 'Itim', 'Mali', 'Patrick Hand', cursive, sans-serif !important;
}

.modal-box-beige::before {
    content: "";
    position: absolute;
    inset: 5px;
    border: 1.5px solid #7c6348;
    border-radius: 8px;
    pointer-events: none;
    z-index: 2;
}

.modal-header-beige {
    background: #f4ecc4;
    padding: 12px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #7c6348;
    position: relative;
    z-index: 3;
}

.quest-modal-close-btn {
    background: #b8d6b8;
    border: 2px solid #557053;
    border-radius: 6px;
    width: 32px;
    height: 32px;
    font-size: 20px;
    font-weight: bold;
    color: #214022;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
    outline: none;
}

.quest-modal-close-btn:hover {
    background: #cbf0cb;
    transform: scale(1.08);
    color: #123013;
}

.quest-modal-close-btn:active {
    transform: scale(0.95);
    background: #a9caa9;
}

/* ========================================================
   GIAO DIỆN ĐỐI THOẠI & TRÒ CHUYỆN NPC (VINTAGE BEIGE COMIC)
   ======================================================== */
.dialogue-speech-box {
    background: #fffdf8;
    border: 2.5px solid #8c6d48;
    border-radius: 14px;
    padding: 14px 16px;
    color: #2e1d0f;
    font-size: 14px;
    line-height: 1.6;
    font-family: 'Itim', 'Mali', 'Patrick Hand', cursive, sans-serif;
    box-shadow: 0 3px 8px rgba(92, 71, 49, 0.12), inset 0 1px 2px rgba(255, 255, 255, 0.8);
    position: relative;
}

.dialogue-speech-box::before {
    content: "";
    position: absolute;
    top: -10px;
    left: 28px;
    width: 0;
    height: 0;
    border-left: 9px solid transparent;
    border-right: 9px solid transparent;
    border-bottom: 10px solid #8c6d48;
}

.dialogue-speech-box::after {
    content: "";
    position: absolute;
    top: -7px;
    left: 29px;
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 9px solid #fffdf8;
}

/* Nút tương tác và đối thoại NPC */
.btn-dialogue-card {
    width: 100%;
    padding: 10px 16px;
    border-radius: 10px;
    font-weight: 700;
    font-family: 'Itim', 'Mali', 'Patrick Hand', cursive, sans-serif;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    cursor: pointer;
    outline: none;
    position: relative;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    margin-bottom: 8px;
}

.btn-dialogue-card:hover {
    transform: translateY(-2px);
    filter: brightness(1.04);
}

.btn-dialogue-card:active {
    transform: translateY(1px) scale(0.99);
}

/* Biến thể 1: Tặng Bó Hoa Hồng (Velvet Rose) */
.btn-dialogue-rose {
    background: linear-gradient(135deg, #e65c6f, #c7384d);
    border: 2px solid #851e2e;
    color: #ffffff;
    box-shadow: 0 3px 8px rgba(199, 56, 77, 0.3);
}

.btn-dialogue-rose::before {
    content: "";
    position: absolute;
    inset: 2px;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 7px;
    pointer-events: none;
}

/* Biến thể 2: Tặng Hộp Quà Lễ Hội (Festive Ruby) */
.btn-dialogue-festive {
    background: linear-gradient(135deg, #e0533c, #c0392b);
    border: 2px solid #841b11;
    color: #ffffff;
    box-shadow: 0 3px 8px rgba(192, 57, 43, 0.3);
}

.btn-dialogue-festive::before {
    content: "";
    position: absolute;
    inset: 2px;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 7px;
    pointer-events: none;
}

/* Biến thể 3: Tặng Hộp Bánh (Honey Amber) */
.btn-dialogue-cake {
    background: linear-gradient(135deg, #e59838, #c67a18);
    border: 2px solid #7d4808;
    color: #ffffff;
    box-shadow: 0 3px 8px rgba(198, 122, 24, 0.3);
}

.btn-dialogue-cake::before {
    content: "";
    position: absolute;
    inset: 2px;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 7px;
    pointer-events: none;
}

/* Biến thể 4: Giỏ Quà Đại Tiệc Ẩm Thực (Imperial Plum) */
.btn-dialogue-banquet {
    background: linear-gradient(135deg, #884393, #5a2068);
    border: 2px solid #3c1247;
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(90, 32, 104, 0.35);
}

.btn-dialogue-banquet::before {
    content: "";
    position: absolute;
    inset: 2px;
    border: 1px solid rgba(255, 215, 0, 0.5);
    border-radius: 7px;
    pointer-events: none;
}

/* Biến thể 5: Nhận / Nộp Nhiệm Vụ (Forest Emerald) */
.btn-dialogue-quest {
    background: linear-gradient(135deg, #3d8b57, #2d6a4f);
    border: 2px solid #1b4332;
    color: #ffffff;
    box-shadow: 0 3px 8px rgba(45, 106, 79, 0.3);
}

.btn-dialogue-quest::before {
    content: "";
    position: absolute;
    inset: 2px;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 7px;
    pointer-events: none;
}

/* Biến thể 6: Cảm ơn / Tạm biệt (Vintage Parchment Wood) */
.btn-dialogue-neutral {
    background: #f4ecd0;
    border: 2px solid #8c6d48;
    color: #3b2512;
    box-shadow: 0 2px 5px rgba(92, 71, 49, 0.15);
}

.btn-dialogue-neutral:hover {
    background: #faeed0;
    color: #214022;
}

.btn-dialogue-neutral::before {
    content: "";
    position: absolute;
    inset: 2px;
    border: 1px solid #c2a87d;
    border-radius: 7px;
    pointer-events: none;
}

/* Huy hiệu điểm thiện cảm / phần thưởng bên phải nút */
.dialogue-reward-badge {
    padding: 3px 9px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.2px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.dialogue-reward-badge.rose {
    background: #fff0f3;
    color: #9f1239;
    border: 1px solid #fecdd3;
}

.dialogue-reward-badge.festive {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.dialogue-reward-badge.cake {
    background: #fffbeb;
    color: #92400e;
    border: 1px solid #fde68a;
}

.dialogue-reward-badge.banquet {
    background: #fdf4ff;
    color: #701a75;
    border: 1px solid #f5d0fe;
}

.dialogue-reward-badge.quest {
    background: #f0fdf4;
    color: #14532d;
    border: 1px solid #bbf7d0;
}

/* Thẻ vật phẩm trong Balo */
.backpack-item-card {
    background: #fffcf2;
    border: 2px solid #b89b72;
    border-radius: 12px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    position: relative;
    transition: all 0.2s ease;
    box-shadow: 0 3px 8px rgba(92, 71, 49, 0.12);
}

.backpack-item-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 14px rgba(92, 71, 49, 0.2);
}

.backpack-item-card.has-items {
    background: #fff9e6;
    border: 2px solid #c97d26;
    box-shadow: 0 4px 12px rgba(201, 125, 38, 0.25);
}

.backpack-item-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    font-size: 11px;
    font-weight: bold;
    padding: 2px 7px;
    border-radius: 9999px;
    font-family: 'Itim', sans-serif;
}

.backpack-item-badge.badge-has-item {
    background: #b8d6b8;
    border: 1.5px solid #557053;
    color: #1c3b1e;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

.backpack-item-badge.badge-no-item {
    background: #ebdcb4;
    border: 1px solid #9c7f5b;
    color: #6b5037;
}

/* Tabs Tủ Đồ Chuẩn Phong Cách Ảnh 2 */
.wardrobe-tab-btn {
    background: #fffcf2;
    border: 2px solid #8c6d48;
    border-radius: 8px;
    padding: 6px 16px;
    font-size: 13px;
    font-weight: 700;
    color: #5c4731;
    cursor: pointer;
    font-family: 'Itim', 'Mali', 'Patrick Hand', cursive, sans-serif;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 2px 5px rgba(92, 71, 49, 0.15);
    outline: none;
}

.wardrobe-tab-btn:hover {
    background: #fdf5df;
    transform: translateY(-1px);
    color: #214022;
}

.wardrobe-tab-btn.active {
    background: #b8d6b8;
    border: 2px solid #557053;
    color: #123013;
    position: relative;
    transform: scale(1.04);
    box-shadow: 0 3px 8px rgba(46, 125, 50, 0.25);
}

.wardrobe-tab-btn.active::before {
    content: "";
    position: absolute;
    inset: 2px;
    border: 1px solid #729070;
    border-radius: 5px;
    pointer-events: none;
}

/* Scrollbar màu be ấm cho Tủ Đồ */
#wardrobe-modal ::-webkit-scrollbar {
    width: 8px;
}
#wardrobe-modal ::-webkit-scrollbar-track {
    background: #f3ebd0;
    border-radius: 4px;
}
#wardrobe-modal ::-webkit-scrollbar-thumb {
    background: #b89b72;
    border-radius: 4px;
    border: 1.5px solid #f3ebd0;
}
#wardrobe-modal ::-webkit-scrollbar-thumb:hover {
    background: #8c6d48;
}

/* ========================================================
   THANH NHIỆM VỤ CHUẨN 100% THEO ẢNH 2 (VINTAGE WOOD/PARCHMENT)
   ======================================================== */
.font-quest {
    font-family: 'Itim', 'Mali', 'Patrick Hand', cursive, sans-serif;
}

.quest-image2-box {
    background: #fbf6d9;
    border: 3.5px solid #5c4731;
    border-radius: 8px;
    position: relative;
    padding: 10px 14px;
    width: 310px;
    height: 76px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5), inset 0 0 10px rgba(180, 150, 100, 0.25);
    flex-shrink: 0;
    transition: all 0.25s ease;
}

.quest-image2-box::before {
    content: "";
    position: absolute;
    inset: 4px;
    border: 1.5px solid #7c6348;
    border-radius: 5px;
    pointer-events: none;
}

.quest-image2-title {
    color: #3b2512;
    font-size: 19px;
    font-weight: 700;
    z-index: 1;
    letter-spacing: 0.3px;
    max-width: 175px;
    line-height: 1.25;
    word-break: break-word;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.6);
}

.quest-image2-btn {
    background: #b8d6b8;
    border: 2px solid #557053;
    border-radius: 6px;
    position: relative;
    padding: 6px 18px;
    font-size: 17px;
    font-weight: 700;
    color: #214022;
    cursor: pointer;
    z-index: 1;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    outline: none;
}

.quest-image2-btn::before {
    content: "";
    position: absolute;
    inset: 2px;
    border: 1px solid #729070;
    border-radius: 4px;
    pointer-events: none;
}

.quest-image2-btn:hover {
    background: #cbf0cb;
    transform: scale(1.06);
    box-shadow: 0 4px 12px rgba(46, 125, 50, 0.35);
    color: #123013;
}

.quest-image2-btn:active {
    transform: scale(0.95);
    background: #a9caa9;
}

/* Hiệu ứng thay đổi / nhận nhiệm vụ mới (Bump Animation) */
.quest-image2-bump {
    animation: questCardBump 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes questCardBump {
    0% { transform: scale(0.9) rotate(-1.5deg); box-shadow: 0 0 20px rgba(255, 215, 0, 0.8); }
    40% { transform: scale(1.07) rotate(1.5deg); }
    70% { transform: scale(0.98) rotate(-0.5deg); }
    100% { transform: scale(1) rotate(0); }
}

/* ========================================================
   MODALS & OVERLAYS
   ======================================================== */
.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
    z-index: 100;
}

.modal-overlay.active,
.modal-overlay.modal-visible {
    opacity: 1;
    pointer-events: auto;
}

.modal-box {
    background: #1e2433;
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-radius: 14px;
    width: 680px;
    max-width: 90%;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.7);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: modalPop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes modalPop {
    from { transform: scale(0.85); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.modal-header {
    background: #151a24;
    padding: 14px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-title {
    font-size: 18px;
    font-weight: 700;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-close-btn {
    background: transparent;
    border: none;
    color: #adb5bd;
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
}

.modal-close-btn:hover {
    color: #e63946;
}

.modal-body {
    padding: 20px;
    max-height: 520px;
    overflow-y: auto;
}

/* ========================================================
   HỘP THOẠI NPC (DIALOGUE MODAL)
   ======================================================== */
.dialogue-content {
    display: flex;
    gap: 18px;
    margin-bottom: 20px;
}

.dialogue-avatar {
    font-size: 52px;
    background: #151a24;
    border: 2px solid #457b9d;
    border-radius: 12px;
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.dialogue-text-box {
    flex: 1;
}

.npc-name {
    font-size: 16px;
    font-weight: 700;
    color: #f4a261;
}

.npc-title {
    font-size: 12px;
    color: #a8dadc;
    margin-bottom: 8px;
}

.dialogue-text {
    font-size: 14px;
    line-height: 1.5;
    color: #ffffff;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 12px;
    border-left: 3px solid #f4a261;
}

.dialogue-actions-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.btn-choice {
    background: #2b3a4a;
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #ffffff;
    padding: 12px 18px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s ease;
}

.btn-choice:hover {
    background: #3d5a80;
    transform: translateX(4px);
}

.btn-choice.btn-heart {
    background: #9d0208;
    border-color: #ff4d6d;
    color: #fff;
    font-weight: 700;
}

.btn-choice.btn-heart:hover {
    background: #c9184a;
}

.btn-choice.btn-success {
    background: #2a9d8f;
    border-color: #52b788;
}

.btn-choice.btn-success:hover {
    background: #21867a;
}

.dialogue-hint-text {
    font-size: 12px;
    color: #ffd166;
    background: rgba(255, 209, 102, 0.1);
    padding: 8px 12px;
    border-radius: 6px;
}

/* ========================================================
   BÀN GÓI QUÀ (CRAFTING MODAL)
   ======================================================== */
.crafting-preview {
    text-align: center;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 20px;
    border: 1px dashed rgba(255, 255, 255, 0.15);
}

.crafting-target-icon {
    font-size: 50px;
    margin-bottom: 4px;
}

.crafting-target-name {
    font-size: 18px;
    font-weight: 700;
    color: #ffd166;
}

.crafting-target-desc {
    font-size: 12px;
    color: #adb5bd;
    margin-top: 4px;
    max-width: 450px;
    margin-left: auto;
    margin-right: auto;
}

.ingredients-title {
    font-size: 13px;
    font-weight: 700;
    color: #a8dadc;
    text-transform: uppercase;
    margin-bottom: 10px;
}

.ingredients-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
}

.ingredient-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #161b26;
    padding: 10px 16px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.ingredient-row.status-met {
    border-color: #52b788;
}

.ingredient-row.status-missing {
    border-color: #e63946;
    background: rgba(230, 57, 70, 0.05);
}

.ing-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ing-icon {
    font-size: 20px;
}

.ing-name {
    font-size: 14px;
    font-weight: 600;
}

.ing-count {
    font-size: 14px;
    font-weight: 600;
}

.ing-check {
    margin-left: 10px;
    font-size: 12px;
    font-weight: 700;
}

.status-met .ing-check { color: #52b788; }
.status-missing .ing-check { color: #e63946; }

.btn-action-primary {
    width: 100%;
    background: linear-gradient(135deg, #e63946, #c9184a);
    color: #ffffff;
    border: none;
    padding: 14px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(230, 57, 70, 0.4);
    transition: all 0.2s ease;
}

.btn-action-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(230, 57, 70, 0.6);
}

.btn-action-primary:disabled {
    background: #495057;
    cursor: not-allowed;
    box-shadow: none;
    opacity: 0.6;
}

/* ========================================================
   TỦ ĐỒ & CỬA HÀNG TRANG PHỤC (WARDROBE MODAL)
   ======================================================== */
.wardrobe-unlocked-banner {
    background: rgba(82, 183, 136, 0.15);
    border: 1px solid #52b788;
    color: #74c69d;
    padding: 12px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 16px;
    text-align: center;
}

.wardrobe-locked-banner {
    background: rgba(230, 57, 70, 0.15);
    border: 1px solid #e63946;
    color: #ff758f;
    padding: 12px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 16px;
    text-align: center;
}

.wardrobe-mini-bar {
    width: 220px;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    margin: 8px auto;
    overflow: hidden;
}

.wardrobe-mini-fill {
    height: 100%;
    background: #ff4d6d;
    transition: width 0.3s;
}

.outfits-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
}

.outfit-card {
    background: #161b26;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: all 0.2s ease;
}

.outfit-card.outfit-active {
    border-color: #4cc9f0;
    box-shadow: 0 0 15px rgba(76, 201, 240, 0.3);
}

.outfit-preview-box {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 6px;
    margin-bottom: 8px;
}

.outfit-icon {
    font-size: 28px;
}

.outfit-tag {
    font-size: 10px;
    font-weight: 700;
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 8px;
    border-radius: 10px;
    color: #ffd166;
}

.outfit-name {
    font-size: 15px;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 4px;
}

.outfit-desc {
    font-size: 12px;
    color: #adb5bd;
    line-height: 1.4;
    margin-bottom: 12px;
    flex-grow: 1;
}

.btn-outfit {
    width: 100%;
    padding: 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

.btn-outfit.btn-equipped {
    background: #2a9d8f;
    color: #ffffff;
    cursor: default;
}

.btn-outfit.btn-equip-action {
    background: #4361ee;
    color: #ffffff;
}

.btn-outfit.btn-equip-action:hover {
    background: #3f37c9;
}

.btn-outfit.btn-unlock-action {
    background: #f72585;
    color: #ffffff;
}

.btn-outfit.btn-unlock-action:hover {
    background: #b5179e;
}

.btn-outfit.btn-locked {
    background: #343a40;
    color: #6c757d;
    cursor: not-allowed;
}

/* ========================================================
   MINIGAMES MODAL (CLAW & SHOOTING)
   ======================================================== */
.minigame-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.minigame-canvas {
    background: #000;
    border: 3px solid #f72585;
    border-radius: 8px;
    box-shadow: 0 0 20px rgba(247, 37, 133, 0.4);
    cursor: crosshair;
}

.minigame-controls {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.btn-arcade-ctrl {
    background: #2b3a4a;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-arcade-ctrl:hover {
    background: #4cc9f0;
    color: #000;
}

.btn-arcade-action {
    background: #f72585;
    border: 1px solid #ffd166;
    color: #fff;
    padding: 10px 28px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(247, 37, 133, 0.5);
}

.btn-arcade-action:hover {
    background: #b5179e;
    transform: scale(1.05);
}

/* ========================================================
   TOAST NOTIFICATION SYSTEM (RPG 3-SLICE GOLDEN RIBBON BANNER)
   Ghép mảnh trái + kéo giãn mảnh giữa theo chữ + mảnh phải
   ======================================================== */
#toast-container {
    position: absolute;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    pointer-events: none;
    z-index: 500;
}

.rpg-toast-banner {
    display: inline-flex;
    align-items: center;
    height: 72px;
    position: relative;
    pointer-events: none;
    filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.45));
    animation: toastBannerDropIn 0.38s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transition: opacity 0.35s ease, transform 0.35s ease;
    user-select: none;
}

.rpg-toast-left {
    width: 122px;
    height: 72px;
    background-image: url('../assets/ui/banner_toast_left.png');
    background-size: 100% 100%;
    background-repeat: no-repeat;
    flex-shrink: 0;
}

.rpg-toast-mid {
    flex: 1;
    min-width: 60px;
    max-width: 680px;
    height: 72px;
    background-image: url('../assets/ui/banner_toast_mid.png');
    background-size: 100% 100%;
    background-repeat: no-repeat;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 10px;
    box-sizing: border-box;
}

.rpg-toast-text {
    margin-top: 3px;
    font-family: 'Be Vietnam Pro', 'Quicksand', 'Nunito', sans-serif;
    font-weight: 800;
    font-size: 14.5px;
    color: #3b200b;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.85), 0 0 2px rgba(255, 235, 180, 0.5);
    white-space: nowrap;
    letter-spacing: 0.3px;
}

.rpg-toast-right {
    width: 110px;
    height: 72px;
    background-image: url('../assets/ui/banner_toast_right.png');
    background-size: 100% 100%;
    background-repeat: no-repeat;
    flex-shrink: 0;
}

/* Hiệu ứng màu viền ánh sáng theo loại thông báo */
.rpg-toast-banner.toast-success .rpg-toast-mid {
    filter: drop-shadow(0 0 4px rgba(82, 183, 136, 0.45));
}
.rpg-toast-banner.toast-error .rpg-toast-mid {
    filter: drop-shadow(0 0 4px rgba(230, 57, 70, 0.45));
}
.rpg-toast-banner.toast-info .rpg-toast-mid {
    filter: drop-shadow(0 0 4px rgba(255, 214, 10, 0.45));
}

@keyframes toastBannerDropIn {
    0% {
        opacity: 0;
        transform: translateY(-24px) scale(0.92);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.toast,
.toast-item {
    background: rgba(18, 22, 31, 0.95);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-left: 5px solid #4cc9f0;
    color: #ffffff;
    padding: 12px 18px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.6);
    animation: toastSlideIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    max-width: 380px;
}

.toast.toast-success,
.toast-item.toast-success {
    border-left-color: #52b788;
}

.toast.toast-error,
.toast-item.toast-error {
    border-left-color: #e63946;
}

.toast.toast-info,
.toast-item.toast-info {
    border-left-color: #ffd166;
}

.toast-item.fade-out {
    opacity: 0;
    transform: translateX(30px);
    transition: all 0.4s ease;
}

@keyframes toastSlideIn {
    from { opacity: 0; transform: translateX(50px); }
    to { opacity: 1; transform: translateX(0); }
}

/* Modal Trợ Giúp & Hướng Dẫn */
.help-guide-section {
    margin-bottom: 16px;
}

.help-guide-title {
    font-size: 14px;
    font-weight: 700;
    color: #ffd166;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.help-guide-body {
    font-size: 13px;
    color: #ced4da;
    line-height: 1.5;
}

.key-badge {
    background: #343a40;
    border: 1px solid #6c757d;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
    font-weight: 700;
    color: #f8f9fa;
}

/* ========================================================
   CHAT BOX (HỘP TRÒ CHUYỆN - CHUẨN ẢNH VINTAGE MMORPG)
   ======================================================== */
.hud-chat-container {
    width: 350px;
    height: 360px;
    max-height: 360px;
    background: #fbf5e6;
    border: 3.5px solid #3c2a1e;
    border-radius: 18px;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45), inset 0 0 12px rgba(180, 150, 100, 0.2);
    font-family: 'Patrick Hand', 'Itim', 'Mali', cursive, sans-serif;
    color: #3c2a1e;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: width 0.25s cubic-bezier(0.16, 1, 0.3, 1), height 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    user-select: none;
    pointer-events: auto;
    position: relative;
    z-index: 30;
}

/* Đường viền chỉ đôi bên trong chuẩn góc bo ảnh mẫu */
.hud-chat-container::before {
    content: "";
    position: absolute;
    inset: 3px;
    border: 1.5px solid rgba(140, 115, 88, 0.35);
    border-radius: 14px;
    pointer-events: none;
    z-index: 1;
}

.hud-chat-container.chat-collapsed {
    height: 54px !important;
    max-height: 54px !important;
    width: 260px !important;
    overflow: hidden;
}

.hud-chat-container.chat-collapsed .hud-chat-body,
.hud-chat-container.chat-collapsed .hud-chat-chips,
.hud-chat-container.chat-collapsed .hud-chat-tabs,
.hud-chat-container.chat-collapsed .hud-chat-input-bar {
    display: none !important;
}

.hud-chat-container.chat-collapsed #btn-chat-minimize svg {
    transform: rotate(180deg);
}

.hud-chat-container.chat-expanded {
    height: 480px !important;
    max-height: 480px !important;
    width: 420px !important;
}

/* Header Ribbon Banner - Chuẩn 100% Theo Ảnh media_1794826468754_accbb9d6.jpg */
.hud-chat-header {
    flex-shrink: 0;
    background: transparent;
    padding: 10px 10px 4px 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    border-bottom: none !important;
    z-index: 2;
}

.hud-chat-ribbon-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    min-width: 0;
}

.hud-chat-ribbon-svg {
    width: 100%;
    max-width: 282px;
    height: 40px;
    overflow: visible;
    filter: drop-shadow(0 2px 2px rgba(60, 42, 30, 0.12));
}

/* 2 Nút Hành Động Trực Tiếp (Không đóng khung viền vuông) */
.hud-chat-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-left: 6px;
    padding-right: 4px;
}

.hud-chat-icon-action {
    background: none;
    border: none;
    padding: 2px;
    cursor: pointer;
    color: #3c2a1e;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.15s ease;
    opacity: 0.85;
}

.hud-chat-icon-action:hover {
    transform: scale(1.22);
    opacity: 1;
}

.hud-chat-icon-action:active {
    transform: scale(0.92);
}

/* Tabs Bar - Phong cách Thẻ Sớ Cổ Điển MMORPG (Chuẩn 100% Theo Ảnh 2) */
.hud-chat-tabs {
    flex-shrink: 0;
    display: flex;
    gap: 7px;
    padding: 10px 12px 6px;
    background: #f4e8cc;
    border-bottom: 2px solid #e0ceaa;
    position: relative;
}

.hud-chat-tab {
    flex: 1;
    text-align: center;
    padding: 5px 4px 4px;
    font-family: 'Patrick Hand', 'Itim', 'Mali', cursive, sans-serif;
    font-size: 13px;
    font-weight: 700;
    color: #634832;
    background: #faeed4;
    border: 1.5px solid #8c7358;
    border-radius: 8px 8px 10px 10px;
    cursor: pointer;
    transition: all 0.18s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 2.5px 0 #8c7358;
    position: relative;
    user-select: none;
    letter-spacing: 0.2px;
}

/* Nơ/Dải ruy băng cuộn trên mỗi Tab như ảnh 2 */
.hud-chat-tab::before {
    content: "";
    position: absolute;
    top: -5px;
    left: 50%;
    transform: translateX(-50%);
    width: 22px;
    height: 4px;
    background: #8c7358;
    border-radius: 2px;
    transition: all 0.18s ease;
}

.hud-chat-tab::after {
    content: "";
    position: absolute;
    top: -4px;
    left: 50%;
    transform: translateX(-50%);
    width: 32px;
    height: 2px;
    background: rgba(140, 115, 88, 0.4);
    border-radius: 1px;
}

.hud-chat-tab:hover {
    background: #fff8e8;
    transform: translateY(-1.5px);
    box-shadow: 0 4px 0 #8c7358;
    color: #3c2a1e;
}

/* Tab Đang Chọn (Active) - Nổi bật màu vàng hoàng yến, viền đậm 3D chuẩn ảnh 2 */
.hud-chat-tab.active {
    background: linear-gradient(180deg, #ffe599 0%, #fedc82 100%);
    border: 2.5px solid #3c2a1e;
    color: #3c2a1e;
    font-weight: 800;
    font-size: 13.5px;
    transform: translateY(-2.5px);
    box-shadow: 0 4px 0 #3c2a1e, 0 6px 10px rgba(0, 0, 0, 0.15);
    z-index: 2;
}

.hud-chat-tab.active::before {
    background: #3c2a1e;
    height: 5px;
    width: 26px;
    top: -6px;
}

.hud-chat-tab.active::after {
    background: #fedc82;
    border: 1px solid #3c2a1e;
    height: 3px;
    width: 38px;
    top: -5px;
}

/* Quick Response Chips - Thanh gợi ý câu nói nhanh */
.hud-chat-chips {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 6px 12px;
    background: rgba(250, 243, 228, 0.95);
    border-bottom: 1.5px dashed #d8c7a6;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none !important; /* Firefox: Ẩn hoàn toàn thanh tua qua */
    -ms-overflow-style: none !important; /* IE / Edge: Ẩn thanh tua qua */
    user-select: none;
    -webkit-user-select: none;
    cursor: grab;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

/* Xóa hoàn toàn thanh tua qua trên Chrome, Safari, Edge */
.hud-chat-chips::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
}

.hud-chat-chips.is-dragging {
    cursor: grabbing !important;
    scroll-behavior: auto !important;
}

.hud-chat-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 28px;
    padding: 0 10px;
    background: #ffffff;
    border: 2px solid #3c2a1e;
    border-radius: 14px;
    font-family: 'Patrick Hand', 'Itim', 'Nunito', cursive, sans-serif;
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
    color: #3c2a1e;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    box-sizing: border-box;
    transition: all 0.15s ease;
    box-shadow: 0 2px 0 rgba(60, 42, 30, 0.4);
}

.hud-chat-chip span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    margin-top: 1px;
}

.hud-chat-chip:hover {
    background: #fedc82;
    transform: translateY(-1.5px);
    box-shadow: 0 3px 0 #3c2a1e;
}

.hud-chat-chip:active {
    transform: translateY(1px);
    box-shadow: 0 1px 0 #3c2a1e;
}

.hud-chat-chip-emoji {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #fed7aa;
    border: 2px solid #ea580c;
    color: #9a3412;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    cursor: pointer;
    flex-shrink: 0;
    box-sizing: border-box;
    box-shadow: 0 2px 0 #c2410c;
    transition: all 0.15s ease;
}

.hud-chat-chip-emoji:hover {
    transform: scale(1.12) rotate(6deg);
    background: #ffedd5;
}

.hud-chat-chip-emoji:active {
    transform: scale(0.95);
}

/* Message Feed Body - Giấy Vintage & Cuộn Tin Nhắn Chuẩn Ảnh 2 */
.hud-chat-body {
    flex: 1 1 0px;
    min-height: 0;
    overflow-y: auto !important;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    padding: 6px 12px;
    display: flex;
    flex-direction: column;
    gap: 3px;
    background: #fbf5e6;
    font-family: 'Patrick Hand', 'Itim', 'Mali', cursive, sans-serif;
    scrollbar-width: thin;
    scrollbar-color: #cbb493 rgba(140, 115, 88, 0.1);
}

.hud-chat-body::-webkit-scrollbar {
    width: 6px;
}
.hud-chat-body::-webkit-scrollbar-track {
    background: rgba(140, 115, 88, 0.08);
    border-radius: 4px;
}
.hud-chat-body::-webkit-scrollbar-thumb {
    background: #cbb493;
    border-radius: 4px;
}
.hud-chat-body::-webkit-scrollbar-thumb:hover {
    background: #a98d6c;
}

.hud-chat-msg {
    display: flex;
    align-items: flex-start;
    gap: 7px;
    padding: 5px 4px;
    border-bottom: 1px solid rgba(140, 115, 88, 0.22);
    font-size: 13.5px;
    line-height: 1.32;
    color: #302013;
    transition: background 0.15s ease;
}

.hud-chat-msg:hover {
    background: rgba(254, 220, 130, 0.22);
    border-radius: 5px;
}

.hud-chat-msg:last-child {
    border-bottom: none;
}

/* Biểu tượng ≡ và Phong thư ✉️ pixel-perfect theo ảnh 2 */
.msg-badge-group {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 2px;
    flex-shrink: 0;
}

.msg-bullet-lines {
    color: #8c7358;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: -1.5px;
    line-height: 1;
    font-family: monospace;
    opacity: 0.85;
}

.msg-envelope-icon {
    width: 16px;
    height: 12px;
    flex-shrink: 0;
    filter: drop-shadow(0 1px 1px rgba(0,0,0,0.1));
}

.hud-chat-msg-text {
    flex: 1;
    word-break: break-word;
    font-size: 13.5px;
    color: #302013;
}

.hud-chat-msg-time {
    font-size: 11.5px;
    color: #8c7358;
    white-space: nowrap;
    margin-top: 1px;
    font-family: 'Patrick Hand', 'Itim', monospace;
}

/* Bottom Input Bar */
.hud-chat-input-bar {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: #f4ecd6;
    border-top: 2px solid #5c4731;
}

.hud-chat-channel-btn {
    background: #ffffff;
    border: 1.5px solid #5c4731;
    border-radius: 14px;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 700;
    color: #5c4731;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 3px;
    white-space: nowrap;
}

.hud-chat-input {
    flex: 1;
    background: #ffffff;
    border: 1.5px solid #5c4731;
    border-radius: 16px;
    padding: 5px 12px;
    font-size: 12px;
    color: #3c2a1e;
    outline: none;
    font-family: inherit;
}

.hud-chat-input:focus {
    border-color: #8c3b12;
    box-shadow: 0 0 0 2px rgba(140, 59, 18, 0.2);
}

.hud-chat-send-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #ffffff;
    border: 1.5px solid #5c4731;
    color: #3c2a1e;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.hud-chat-send-btn:hover {
    background: #fedc82;
    transform: scale(1.08);
}

/* ========================================================
   BALO ICON BUTTON GỌN GÀNG (CHUẨN ICON BALO CHO LẠI)
   ======================================================== */
.hud-backpack-icon-box {
    background: #fbf6d9;
    border: 3.5px solid #5c4731;
    border-radius: 12px;
    position: relative;
    padding: 6px 14px;
    height: 68px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45), inset 0 0 10px rgba(180, 150, 100, 0.25);
    font-family: 'Itim', 'Mali', 'Patrick Hand', cursive, sans-serif;
    color: #3b2512;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    user-select: none;
    flex-shrink: 0;
}

.hud-backpack-icon-box::before {
    content: "";
    position: absolute;
    inset: 3px;
    border: 1.5px solid #7c6348;
    border-radius: 8px;
    pointer-events: none;
}

.hud-backpack-icon-box:hover {
    transform: translateY(-2px) scale(1.03);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.55), inset 0 0 14px rgba(180, 150, 100, 0.35);
}

/* ========================================================
   FIX BẢNG MINIGAME HỘI CHỢ & MÁY GẮP GẤU (NO SQUISHING)
   ======================================================== */
#game-board-modal .modal-box {
    max-width: 820px !important;
    width: 95vw !important;
    max-height: 96vh !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
}

#game-board-modal .modal-body {
    max-height: calc(96vh - 60px) !important;
    overflow-y: auto !important;
    padding: 10px 14px !important;
}

#game-board-desc {
    display: inline-block;
    word-break: normal;
    white-space: normal;
}

#game-board-rewards-preview {
    scrollbar-width: thin;
    scrollbar-color: #d4a373 #fffcf2;
}
#game-board-rewards-preview::-webkit-scrollbar {
    height: 5px;
}
#game-board-rewards-preview::-webkit-scrollbar-thumb {
    background: #d4a373;
    border-radius: 4px;
}

/* ========================================================
   THANH NHIỆM VỤ GỌN GÀNG (CHUẨN "GẦN TRÊN CÙNG BÊN TRÁI")
   ======================================================== */
.quest-compact-bar {
    background: #fbf6d9;
    border: 3px solid #5c4731;
    border-radius: 14px;
    position: absolute;
    top: 76px;
    left: 16px;
    z-index: 30;
    padding: 6px 12px;
    min-width: 205px;
    max-width: 250px;
    height: 52px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45), inset 0 0 8px rgba(180, 150, 100, 0.25);
    font-family: 'Patrick Hand', 'Itim', 'Mali', cursive, sans-serif;
    color: #3b2512;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    user-select: none;
    pointer-events: auto;
}

.quest-compact-bar::before {
    content: "";
    position: absolute;
    inset: 3px;
    border: 1.5px solid #7c6348;
    border-radius: 10px;
    pointer-events: none;
}

.quest-compact-bar:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.55), inset 0 0 12px rgba(180, 150, 100, 0.35);
}

.quest-badge {
    background: #e2cf9d;
    border: 1px solid #7c6348;
    color: #4a3520;
    font-size: 11px;
    font-weight: 800;
    padding: 1px 6px;
    border-radius: 9999px;
    line-height: 1;
}

/* Thẻ nhiệm vụ trong Modal Bảng Nhiệm Vụ */
.quest-card-item {
    background: #fdfaf0;
    border: 2px solid #8c6d48;
    border-radius: 14px;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
    position: relative;
}

.quest-card-item:hover {
    background: #ffffff;
    border-color: #5c4731;
    transform: translateY(-1.5px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
}

.quest-card-item.active-tracked {
    background: linear-gradient(135deg, #fff9e6 0%, #fdf0c7 100%);
    border: 2.5px solid #d48b0c;
    box-shadow: 0 4px 14px rgba(212, 139, 12, 0.25);
}

.quest-status-badge {
    font-size: 11.5px;
    font-weight: 800;
    padding: 2.5px 8px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.quest-status-active {
    background: #fedc82;
    border: 1.5px solid #d48b0c;
    color: #5c3800;
}

.quest-status-completed {
    background: #d1fae5;
    border: 1.5px solid #059669;
    color: #065f46;
}

.quest-status-ready {
    background: #fee2e2;
    border: 1.5px solid #dc2626;
    color: #991b1b;
}

.quest-status-available {
    background: #e0f2fe;
    border: 1.5px solid #0284c7;
    color: #075985;
}

/* ========================================================
   HUD MINIMAP - ĐẠI HỌC TÂY NGUYÊN (RETRO MMORPG STYLE)
   Chuẩn 100% theo ảnh tham chiếu media_1794879991369_7dcbeda1.png:
   - Ribbon Banner uốn lượn phong cách cuộn sớ
   - Khung viền bo tròn bo góc dày dặn màu nâu ấm
   - La bàn Bắc (B), huy hiệu Khu an toàn
   - Nút Zoom In, Zoom Out, Kênh 1 và Nút Bản Đồ Lớn
   ======================================================== */
.hud-minimap-card {
    width: 224px;
    height: 158px;
    background: #e8eed9;
    border: 3.5px solid #3c2a1e;
    border-radius: 20px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45), inset 0 0 0 2px #fff8eb;
    position: relative;
    overflow: hidden;
}

.hud-minimap-ribbon-wrap {
    filter: drop-shadow(0 2px 3px rgba(60, 42, 30, 0.25));
}

.hud-minimap-ribbon-svg {
    width: 196px;
    height: 32px;
    overflow: visible;
}

.hud-minimap-btn {
    width: 23px;
    height: 23px;
    border-radius: 9999px;
    background: #fbf6e0;
    border: 2px solid #3c2a1e;
    color: #3c2a1e;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
    cursor: pointer;
    transition: transform 0.15s ease, background-color 0.15s ease;
}

.hud-minimap-btn:hover {
    background: #ffffff;
    transform: scale(1.12);
}

.hud-minimap-btn:active {
    transform: scale(0.92);
}

/* Animation phóng to modal mượt mà */
.animate-scale-up {
    animation: modalPop 0.28s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

/* Thẻ giấy nhớ chúc mừng 20/11 */
.wish-sticky-note {
    position: relative;
    box-shadow: 2px 3px 8px rgba(0, 0, 0, 0.12);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.wish-sticky-note:hover {
    transform: translateY(-3px) rotate(-0.5deg);
    box-shadow: 3px 6px 14px rgba(0, 0, 0, 0.18);
}

/* ========================================================
   CHARACTER CREATION & LOGIN SETUP MODAL
   ======================================================== */
#character-setup-modal {
    z-index: 250 !important;
}

#character-setup-modal:not(.active):not(.modal-visible) {
    display: none !important;
    pointer-events: none !important;
}

#character-setup-modal .modal-box {
    max-width: 860px;
    background: #fbf6d9 !important;
    border: 3.5px solid #5c4731 !important;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.75), inset 0 0 20px rgba(180, 150, 100, 0.25) !important;
}

.starter-skin-card {
    transition: all 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    background: #fffcf2;
    border: 2px solid #b89b72;
    border-radius: 16px;
}

.starter-skin-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(92, 71, 49, 0.18);
    border-color: #7c6348;
}

.starter-skin-card.selected {
    background: #f0fdf4 !important;
    border-color: #2d6a4f !important;
    box-shadow: 0 0 0 3px rgba(45, 106, 79, 0.3), 0 8px 24px rgba(45, 106, 79, 0.2) !important;
    transform: scale(1.02);
}

#input-character-name:focus {
    box-shadow: 0 0 0 3px rgba(45, 106, 79, 0.25), inset 0 2px 4px rgba(0, 0, 0, 0.08);
}

/* ========================================================
   HỆ THỐNG ICON TƯƠNG TÁC ĐỘC QUYỀN (HAND-DRAWN INTERACTIVE ICONS)
   Khi ấn vào đổi sang icon Hàng 2 (Active/Glowing/Action)
   ======================================================== */
.interactive-icon {
    display: inline-block;
    vertical-align: middle;
    user-select: none;
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275), filter 0.2s ease;
    filter: drop-shadow(0 1.5px 3px rgba(60, 42, 30, 0.22));
}

button:hover .interactive-icon,
a:hover .interactive-icon,
.interactive-icon-box:hover .interactive-icon {
    transform: scale(1.08);
}

button:active .interactive-icon,
a:active .interactive-icon,
.interactive-icon.is-active,
.is-active .interactive-icon {
    transform: scale(1.2) rotate(-4deg);
    filter: drop-shadow(0 2px 8px rgba(234, 88, 12, 0.5)) drop-shadow(0 0 6px rgba(254, 220, 130, 0.9));
}

@keyframes iconPopSpring {
    0% { transform: scale(1); }
    35% { transform: scale(1.35) rotate(-6deg); }
    70% { transform: scale(0.92) rotate(3deg); }
    100% { transform: scale(1) rotate(0deg); }
}

.icon-pop-spring {
    animation: iconPopSpring 0.42s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
}

/* Tinh chỉnh riêng cho các nút trong HUD & Modal */
.hud-chat-tab .interactive-icon {
    width: 20px;
    height: 20px;
    margin-right: 4px;
    vertical-align: -3px;
}

/* ========================================================
   MÀN HÌNH LOADING MÀU BE TOÀN CẢNH (FULLSCREEN BEIGE PRELOADER)
   ======================================================== */
@keyframes spinSlow {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.animate-spin-slow {
    animation: spinSlow 12s linear infinite;
}

@keyframes preloaderShimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(250%); }
}

.preloader-shimmer {
    animation: preloaderShimmer 1.8s infinite ease-in-out;
}

.preloader-fade-out {
    opacity: 0 !important;
    transform: scale(1.03) !important;
    pointer-events: none !important;
}

.hud-chat-chip .interactive-icon {
    width: 16px;
    height: 16px;
    margin-right: 4px;
    vertical-align: middle;
    display: inline-block;
    flex-shrink: 0;
}

.hud-chat-send-btn .interactive-icon {
    width: 19px;
    height: 19px;
    margin-left: 1px;
}

.wardrobe-tab-btn .interactive-icon {
    width: 24px;
    height: 24px;
    margin-right: 7px;
    vertical-align: -4px;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.15));
}

.crafting-recipe-tab .interactive-icon {
    width: 22px;
    height: 22px;
    margin-right: 6px;
    vertical-align: -3px;
}


