/* Thêm đoạn này vào đầu file style.css */
html, body {
    margin: 0;         /* Xóa lề mặc định của trình duyệt */
    padding: 0;        /* Xóa đệm mặc định của trình duyệt */
    overflow: hidden;  /* Ẩn thanh cuộn nếu có */
    height: 100%;      /* Đảm bảo body cao 100% */
    width: 100%;       /* Đảm bảo body rộng 100% */
}

body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f0f0f0;
    color: #333;
    text-align: center;
}

h1 {
    margin-top: 20px;
}

/* Định dạng cho khung chứa ảnh 360 */
#panorama-container {
    width: 100vw; /* Chiếm 90% chiều rộng của cửa sổ xem */
    height: 100vh; /* Chiếm 80% chiều cao của cửa sổ xem */
    margin: 20px auto; /* Căn giữa */
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}
/* --- CSS chung --- */
body {
    font-family: 'Nunito', sans-serif; /* Font chữ tròn, thân thiện */
    margin: 0;
    color: #333;
}

/* --- CSS cho Trang chủ (index.html) --- */
.welcome-container {
    height: 100vh;
    background-image: linear-gradient(rgba(0,0,0,0.3), rgba(0,0,0,0.3)), url('images/background.jpg');
    background-size: cover;
    background-position: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    color: white;
}

.welcome-header h1 {
    font-size: 3.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 8px rgba(0,0,0,0.7);
}

.welcome-header p {
    font-size: 1.2rem;
    font-style: italic;
    text-shadow: 1px 1px 4px rgba(0,0,0,0.7);
}

.enter-button {
    display: inline-block;
    margin-top: 40px;
    padding: 15px 35px;
    background-color: #4CAF50; /* Màu xanh lá cây thân thiện */
    color: white;
    font-size: 1.2rem;
    font-weight: bold;
    text-decoration: none;
    border-radius: 50px; /* Bo tròn mềm mại */
    border: 2px solid white;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    transition: transform 0.2s ease, background-color 0.2s ease;
}

.enter-button:hover {
    transform: scale(1.05);
    background-color: #45a049;
}

/* --- CSS cho Hướng dẫn viên ảo --- */
.guide-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 200px; /* Điều chỉnh kích thước của GIF */
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.guide-container img {
    width: 100%;
    border-radius: 10px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

.toggle-guide-btn {
    position: fixed;
    bottom: 20px;
    left: 20px;
    padding: 10px 15px;
    background-color: rgba(0, 0, 0, 0.6);
    color: white;
    border: 1px solid white;
    border-radius: 20px;
    cursor: pointer;
    font-family: 'Nunito', sans-serif;
}

/* Class để ẩn/hiện hướng dẫn viên */
.hidden {
    opacity: 0;
    transform: translateY(20px);
    pointer-events: none; /* Không cho phép click khi đã ẩn */
}

/* --- (Bạn giữ lại CSS cho trang tour 360 ở đây) --- */
/* Ví dụ: */
#panorama-container {
    width: 100vw;
    height: 100vh;
}

/* --- MÀN HÌNH CHỜ TẢI ẢNH NỀN --- */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #1a2b45; /* Nền tối, tránh chớp trắng khi ảnh chưa tải */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 20px;
    z-index: 2000; /* Trên cả start-overlay */
    transition: opacity 0.5s ease;
}

.loading-screen.hidden {
    opacity: 0;
    pointer-events: none;
}

.loading-spinner {
    width: 56px;
    height: 56px;
    border: 5px solid rgba(255, 255, 255, 0.25);
    border-top-color: #4CAF50;
    border-radius: 50%;
    animation: loading-spin 0.9s linear infinite;
}

@keyframes loading-spin {
    to { transform: rotate(360deg); }
}

.loading-text {
    color: white;
    font-family: 'Nunito', sans-serif;
    font-size: 1.1rem;
    margin: 0;
}

/* --- MỚI: CSS cho Lớp phủ Bắt đầu --- */
.start-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7); /* Nền đen mờ */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000; /* Luôn nằm trên cùng */
    transition: opacity 0.5s ease;
}

.start-btn {
    background-color: #4CAF50;
    border: 3px solid white;
    border-radius: 50%; /* Nút tròn */
    width: 100px;
    height: 100px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    transition: transform 0.2s ease;
}

.start-btn:hover {
    transform: scale(1.1);
}

.start-btn svg {
    margin-left: 8px; /* Căn chỉnh icon play cho đẹp */
}

/* Class để ẩn lớp phủ đi sau khi click */
.start-overlay.hidden {
    opacity: 0;
    pointer-events: none; /* Không cho click xuyên qua */
}

/* --- 1. HEADER HIỆN ĐẠI --- */
.main-header {
    position: fixed; /* Luôn hiển thị */
    top: 20px;
    left: 50%;
    transform: translateX(-50%); /* Căn giữa tuyệt đối */
    z-index: 100; /* Nằm trên các nội dung khác */
    background-color: rgba(45, 108, 223, 0.95); /* Nền thanh công cụ - đã đổi thành xanh dương */
    border-radius: 50px;
    padding: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    backdrop-filter: blur(10px); /* Hiệu ứng kính mờ cho đẹp */
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.main-nav {
    display: flex;
    gap: 8px; /* Khoảng cách giữa các nút */
}

.nav-button {
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 30px;
    cursor: pointer;
    font-family: 'Nunito', sans-serif;
    font-size: 1rem;
    font-weight: bold;
    text-decoration: none;
    transition: background-color 0.3s ease;
}

.nav-button:hover {
    background-color: rgba(255, 255, 255, 0.3);
}

/* --- 2. KHUNG BẢN ĐỒ (MODAL) --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1001;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.modal-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.modal-content {
    background-color: white;
    padding: 30px;
    border-radius: 15px;
    width: 80%;
    max-width: 800px;
    position: relative;
    box-shadow: 0 5px 20px rgba(0,0,0,0.4);
}

.modal-content h2 {
    margin-top: 0;
    color: #333;
    text-align: center;
}

.modal-close-btn {
    position: absolute;
    top: 10px;
    right: 15px;
    background: none;
    border: none;
    font-size: 2.5rem;
    color: #888;
    cursor: pointer;
}

.map-container {
    border-radius: 10px;
    overflow: hidden; /* Bo tròn cả iframe bên trong */
}


/* --- 3. DÀNH CHO CÁC THÀNH PHẦN KHÁC --- */
.guide-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 250px;
    transition: opacity 0.5s ease, transform 0.5s ease;
}


/* --- 5. MŨI TÊN ĐIỀU HƯỚNG (CUSTOM HOTSPOT) --- */
.arrow-hotspot {
    width: 50px;
    height: 50px;
    background-color: rgba(0, 0, 0, 0.6);
    border-radius: 50%;
    border: 2px solid white;
    transition: transform 0.2s ease, background-color 0.2s ease;
    /* Dùng伪元素để vẽ mũi tên */
    position: relative;
}

.arrow-hotspot:hover {
    background-color: rgba(0, 0, 0, 0.8);
    transform: scale(1.1);
}

.arrow-hotspot::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 10px;
    height: 10px;
    border-top: 3px solid white;
    border-right: 3px solid white;
    transform: translate(-75%, -50%) rotate(45deg);
}

/* Ẩn icon + mặc định của Pannellum */
.pnlm-hotspot.pnlm-info,
.pnlm-hotspot.pnlm-scene {
    background-image: none !important;
}

/* CSS cho tooltip của hotspot (chữ hiện khi rê chuột vào mũi tên).
   Lưu ý: Pannellum đặt nội dung trong thẻ <span> bên trong .pnlm-tooltip */
.pnlm-tooltip span {
    background-color: rgba(0, 0, 0, 0.85) !important;
    color: white !important;
    border: none !important;
    border-radius: 8px !important;
    font-family: 'Nunito', sans-serif !important;
    font-size: 0.95rem !important;
    font-weight: bold !important;
    padding: 8px 16px !important;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45) !important;

    /* Tên phòng dài không bị cắt cụt hay xuống dòng giữa chừng */
    max-width: none !important;
    white-space: nowrap !important;

    /* Tự căn giữa theo mũi tên, thay cho margin-left cố định của thư viện */
    margin-left: 0 !important;
    left: 50% !important;
    transform: translateX(-50%);
}

/* Mũi nhọn nhỏ bên dưới tooltip - căn lại cho khớp vị trí mới */
.pnlm-tooltip:hover span:after {
    border-top-color: rgba(0, 0, 0, 0.85) !important;
    left: 50% !important;
    margin: 0 !important;
    transform: translateX(-50%);
}


/* Hotspot mũi tên chung (chuyển cảnh) */
.pnlm-hotspot-arrow {
    width: 60px;
    height: 60px;
    background-image: url('images/arrow_up.png'); /* Mũi tên tiến tới */
    background-size: cover;
    background-repeat: no-repeat;
    background-position: center;
    background-color: transparent !important;
    border: none !important;
    box-shadow: none !important;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.pnlm-hotspot-arrow:hover {
    transform: scale(1.1);
    opacity: 0.8;
}

/* CSS cho hotspot thông tin mặc định (hiện vật) */
.pnlm-info-hotspot {
    background-color: #fff !important; /* Màu trắng */
    border: 2px solid #333 !important; /* Viền đen */
    border-radius: 50% !important; /* Hình tròn */
    width: 25px !important;
    height: 25px !important;
    transition: transform 0.2s ease !important;
}

.pnlm-info-hotspot:hover {
    transform: scale(1.2) !important;
}

/* CSS cho hotspot ra ngoài (chỉ thay đổi icon) */
.pnlm-hotspot-arrow-up {
    /* Đảm bảo hình dạng của nó giống hotspot thông tin */
    background-color: #fff !important;
    border-radius: 50% !important;
    width: 35px !important;
    height: 35px !important;
    
    /* Ghi đè bằng hình mũi tên */
    background-image: url('images/arrow_up.png') !important;
    background-size: 100% !important;
    background-repeat: no-repeat !important;
    background-position: center !important;
}

.pnlm-hotspot-arrow-down {
    /* Đảm bảo hình dạng của nó giống hotspot thông tin */
    background-color: #fff !important;
    border-radius: 50% !important;
    width: 35px !important;
    height: 35px !important;
    
    /* Ghi đè bằng hình mũi tên */
    background-image: url('images/arrow_down.png') !important;
    background-size: 100% !important;
    background-repeat: no-repeat !important;
    background-position: center !important;
}

.pnlm-hotspot-arrow-left {
    /* Đảm bảo hình dạng của nó giống hotspot thông tin */
    background-color: #fff !important;
    border-radius: 50% !important;
    width: 25px !important;
    height: 25px !important;
    
    /* Ghi đè bằng hình mũi tên */
    background-image: url('images/arrow_left.png') !important;
    background-size: 100% !important;
    background-repeat: no-repeat !important;
    background-position: center !important;
}

.pnlm-hotspot-arrow-right {
    /* Đảm bảo hình dạng của nó giống hotspot thông tin */
    background-color: #fff !important;
    border-radius: 50% !important;
    width: 25px !important;
    height: 25px !important;
    
    /* Ghi đè bằng hình mũi tên */
    background-image: url('images/arrow_right.png') !important;
    background-size: 100% !important;
    background-repeat: no-repeat !important;
    background-position: center !important;
}

.pulsating-hotspot {
    width: 20px !important;
    height: 20px !important;
    border-radius: 50% !important;
    background-color: rgba(255, 255, 255, 0.2) !important;
    
    /* DÒNG ĐƯỢC SỬA: BỎ !important ở đây */
    box-shadow: 0 0 0 rgba(255, 255, 255, 0.4); 
    
    animation: pulsate 1.5s ease-out infinite !important;
}

/* Định nghĩa animation */
@keyframes pulsate {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.4);
    }
    100% {
        box-shadow: 0 0 0 20px rgba(255, 255, 255, 0);
    }
}

/* --- CSS CHO MODAL HIỆN VẬT --- */

/* Ghi đè để modal có thể nhỏ hơn */
.artifact-modal-content {
    width: 80%;
    max-width: 900px; /* Tăng chiều rộng tối đa */
    transform: scale(0); /* Trạng thái ban đầu: co lại = 0 */
    opacity: 0;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease; /* Hiệu ứng zoom đàn hồi */
}

/* Khi modal được hiện, nó sẽ zoom ra */
.modal-overlay:not(.hidden) .artifact-modal-content {
    transform: scale(1);
    opacity: 1;
}

.artifact-info {
    display: flex;
    gap: 25px;
}

.artifact-image-container {
    flex: 1; /* Chiếm 1/2 không gian */
}

#artifact-image {
    width: 100%;
    height: auto;
    border-radius: 10px;
    object-fit: cover;
}

.artifact-text-container {
    flex: 1; /* Chiếm 1/2 không gian */
    text-align: left;
}

#artifact-name {
    margin-top: 0;
    font-size: 2rem;
    color: #000;
}

#artifact-period {
    font-style: italic;
    color: #555;
    margin-top: -15px;
    margin-bottom: 20px;
}

#artifact-description {
    font-size: 1rem;
    line-height: 1.6;
    color: #333;
    white-space: pre-wrap;
}

.artifact-caption {
    font-size: 0.85rem;
    color: #666;
    font-style: italic;
    text-align: center;
    margin: 4px 0 0;
    min-height: 1.2em;
}

/* ===== RESPONSIVE - MOBILE ===== */
@media (max-width: 768px) {

    /* --- Trang chủ --- */
    .welcome-header h1 {
        font-size: 2rem;
        padding: 0 15px;
    }

    .welcome-header p {
        font-size: 1rem;
        padding: 0 15px;
    }

    .enter-button {
        font-size: 1rem;
        padding: 12px 25px;
    }

    /* --- Header / Nav --- */
    .main-header {
        top: 10px;
        width: calc(100% - 20px);
        left: 10px;
        transform: none;
        border-radius: 12px;
        padding: 5px;
        box-sizing: border-box;
    }

    .main-nav {
        flex-wrap: wrap;
        gap: 5px;
        justify-content: center;
    }

    .nav-button {
        font-size: 0.8rem;
        padding: 7px 12px;
    }

    /* --- Modal (Bản đồ & Hiện vật) --- */
    .modal-content {
        width: 92%;
        padding: 20px 15px;
        box-sizing: border-box;
        max-height: 90vh;
        overflow-y: auto;
    }

    /* --- Modal hiện vật --- */
    .artifact-info {
        flex-direction: column;
    }

    #artifact-name {
        font-size: 1.5rem;
    }

    #artifact-description {
        font-size: 0.95rem;
    }

    .thumbnail-img {
        width: 60px;
        height: 60px;
    }

    /* --- Hướng dẫn viên ảo --- */
    .guide-container {
        width: 120px;
        bottom: 70px;
        right: 10px;
    }

    .toggle-guide-btn {
        bottom: 15px;
        left: 10px;
        font-size: 0.8rem;
        padding: 7px 12px;
    }

    /* --- Tên phòng phía dưới (pnlm-title-box) --- */
    .pnlm-title-box {
        white-space: normal !important;
        font-size: 0.85rem !important;
        padding: 8px 15px !important;
        max-width: 80vw !important;
        text-align: center !important;
    }

    /* --- Dev Tool (ẩn trên mobile) --- */
    .dev-tool,
    .dev-tool-open {
        display: none !important;
    }
}

.pnlm-title-box {
    /* --- 1. Vị trí --- */
    position: fixed !important;
    top: auto !important;
    bottom: 25px !important;
    left: 50% !important;
    transform: translateX(-50%);

    /* THÊM DÒNG NÀY ĐỂ CHỮ KHÔNG BỊ XUỐNG DÒNG */
    white-space: nowrap !important;

    /* --- 2. Phong cách --- */
    background-color: rgba(10, 255, 79, 0.5) !important;
    border-radius: 12px !important;
    padding: 12px 25px !important;
    font-size: 1.1rem !important;
    font-family: 'Nunito', sans-serif !important;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.7);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

/* --- 6. CÔNG CỤ BIÊN TẬP (EDITOR TOOL) --- */
.dev-tool {
    position: fixed;
    top: 80px;
    right: 20px;
    bottom: 20px; /* Kéo dài xuống gần đáy màn hình */
    background-color: rgba(0, 0, 0, 0.88);
    color: white;
    padding: 15px;
    border-radius: 12px;
    font-family: 'Consolas', monospace;
    font-size: 0.9rem;
    z-index: 2000;
    border: 1px solid rgba(255, 255, 255, 0.2);
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 420px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
    backdrop-filter: blur(5px);
    /* Nội dung dài thì cuộn bên trong, không tràn ra ngoài màn hình */
    overflow-y: auto;
    overflow-x: hidden;
}

/* Thanh cuộn mảnh, hợp tông tối */
.dev-tool::-webkit-scrollbar,
.editor-list::-webkit-scrollbar {
    width: 8px;
}

.dev-tool::-webkit-scrollbar-track,
.editor-list::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

.dev-tool::-webkit-scrollbar-thumb,
.editor-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.25);
    border-radius: 4px;
}

.dev-tool::-webkit-scrollbar-thumb:hover,
.editor-list::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.4);
}

.dev-tool h4 {
    margin: 0 0 5px 0;
    color: #4CAF50;
    font-size: 1rem;
    border-bottom: 1px solid #444;
    padding-bottom: 5px;
}

.dev-tool select, .dev-tool input {
    background: #222;
    color: #eee;
    border: 1px solid #444;
    padding: 8px;
    border-radius: 4px;
    width: 100%;
}

.dev-tool .coords-info {
    background: #111;
    padding: 10px;
    border-radius: 6px;
    font-size: 0.85rem;
    color: #00ff00;
    white-space: pre-wrap;
    border: 1px dashed #333;
}

.dev-tool .btn-group {
    display: flex;
    gap: 8px;
}

.dev-tool button {
    flex: 1;
    padding: 8px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.2s;
}

#copy-coords-btn {
    background-color: #4CAF50;
    color: white;
}

#copy-coords-btn:hover {
    background-color: #45a049;
}

#clear-coords-btn {
    background-color: #f44336;
    color: white;
}

.dev-tool .hint {
    font-size: 0.75rem;
    color: #aaa;
    font-style: italic;
}

/* Nút ✕ đóng panel (nằm trong header) */
.dev-tool-header button {
    margin-left: auto;
    background: transparent;
    color: #aaa;
    border: none;
    font-size: 1rem;
    cursor: pointer;
    padding: 0 2px;
    line-height: 1;
}

.dev-tool-header button:hover {
    color: white;
}

/* Nút 🛠️ mở lại panel (góc màn hình) */
.dev-tool-open {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 2001;
    display: none;
    background: rgba(0, 0, 0, 0.85);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 1rem;
    cursor: pointer;
    backdrop-filter: blur(5px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}

.dev-tool-open:hover {
    background: rgba(76, 175, 80, 0.3);
    border-color: #4CAF50;
}

.dev-tool-header {
    display: flex;
    align-items: center;
    font-weight: bold;
    color: #4CAF50;
    border-bottom: 1px solid rgba(255,255,255,0.15);
    padding-bottom: 8px;
}

.dev-tool-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.dev-tool-label {
    color: #aaa;
    white-space: nowrap;
    font-size: 0.8rem;
}

.dev-tool-row select {
    flex: 1;
    background: #222;
    color: #eee;
    border: 1px solid #444;
    border-radius: 4px;
    padding: 4px 6px;
    font-size: 0.8rem;
}

.dev-tool-row button {
    padding: 6px 12px;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
}

.dev-tool-row button:hover {
    background: #45a049;
}

#copy-json-status {
    font-size: 0.8rem;
    color: #4CAF50;
}

/* --- CSS CHO GALLERY ẢNH TRONG MODAL --- */

.thumbnail-container {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    flex-wrap: wrap;
    /* Cho phép xuống dòng nếu có quá nhiều ảnh */
}

.thumbnail-img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    /* Đảm bảo ảnh không bị méo */
    border-radius: 8px;
    border: 3px solid transparent;
    /* Viền trong suốt ban đầu */
    cursor: pointer;
    opacity: 0.6;
    transition: all 0.2s ease;
}

.thumbnail-img:hover {
    opacity: 1;
}

/* Định dạng cho thumbnail đang được chọn */
.thumbnail-img.active {
    opacity: 1;
    border-color: #007bff;
    /* Viền màu xanh để làm nổi bật */
}
/* --- [TẠM] Nút quay lại góc nhìn cũ sau khi zoom vào hiện vật --- */
/* Xóa cả khối này khi khôi phục modal hiện vật như cũ */
.zoom-back-btn {
    position: fixed;
    top: 90px; /* Ngay dưới thanh navbar (navbar: top 20px + cao ~58px) */
    left: 50%;
    transform: translateX(-50%);
    z-index: 900;
    background-color: rgba(0, 0, 0, 0.65);
    color: #fff;
    border: 2px solid rgba(255, 255, 255, 0.5);
    padding: 12px 28px;
    border-radius: 30px;
    cursor: pointer;
    font-family: 'Nunito', sans-serif;
    font-size: 1rem;
    font-weight: bold;
    backdrop-filter: blur(4px);
    transition: opacity 0.3s ease, transform 0.3s ease, background-color 0.3s ease;
}

.zoom-back-btn:hover {
    background-color: rgba(0, 0, 0, 0.85);
}

/* Ghi đè .hidden để giữ đúng vị trí căn giữa khi ẩn */
/* Trượt lên trên khi ẩn (nút nằm ở đỉnh màn hình) */
.zoom-back-btn.hidden {
    opacity: 0;
    transform: translateX(-50%) translateY(-20px);
    pointer-events: none;
}

/* Trên điện thoại: navbar ở top 10px và có thể xuống 2 hàng do flex-wrap */
@media (max-width: 768px) {
    .zoom-back-btn {
        top: 80px;
        padding: 9px 20px;
        font-size: 0.85rem;
    }
}

/* ============================================================
   TRÌNH BIÊN TẬP TOUR - Giao diện quản lý hotspot & phòng
   ============================================================ */

/* Thanh trạng thái kết nối máy chủ */
.editor-status {
    font-size: 0.78rem;
    padding: 8px 10px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.08);
    line-height: 1.5;
}

.editor-status.ok {
    background: rgba(76, 175, 80, 0.2);
    color: #A5D6A7;
}

.editor-status.error {
    background: rgba(244, 67, 54, 0.2);
    color: #EF9A9A;
}

/* Thẻ chuyển tab */
.editor-tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid #444;
    padding-bottom: 8px;
}

.editor-tab {
    flex: 1;
    background: rgba(255, 255, 255, 0.08);
    color: #bbb;
    border: none;
    padding: 8px 6px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.82rem;
    font-family: inherit;
    transition: background 0.2s ease, color 0.2s ease;
}

.editor-tab:hover {
    background: rgba(255, 255, 255, 0.15);
}

.editor-tab.active {
    background: #2d6cdf;
    color: #fff;
    font-weight: bold;
}

/* Dòng gợi ý thao tác */
.editor-hint {
    font-size: 0.78rem;
    color: #ccc;
    background: rgba(255, 193, 7, 0.12);
    border-left: 3px solid #FFC107;
    padding: 8px 10px;
    border-radius: 4px;
    line-height: 1.5;
}

/* Tiêu đề từng khu vực */
.editor-section-title {
    font-size: 0.82rem;
    font-weight: bold;
    color: #4CAF50;
    border-bottom: 1px solid #444;
    padding-bottom: 5px;
    margin-top: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.editor-badge {
    background: #2d6cdf;
    color: #fff;
    border-radius: 10px;
    padding: 1px 8px;
    font-size: 0.75rem;
}

/* Danh sách hotspot / phòng */
.editor-list {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 190px;
    overflow-y: auto;
}

.editor-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    padding: 6px 8px;
    border-radius: 5px;
    font-size: 0.8rem;
    background: rgba(255, 255, 255, 0.05);
    margin-bottom: 4px;
}

.editor-list-item:hover {
    background: rgba(255, 255, 255, 0.12);
}

.editor-list-item.active {
    background: rgba(45, 108, 223, 0.35);
    border-left: 3px solid #2d6cdf;
}

.editor-item-label {
    flex: 1;
    cursor: pointer;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.editor-item-del {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    padding: 2px 4px;
    border-radius: 4px;
    opacity: 0.6;
    transition: opacity 0.2s ease, background 0.2s ease;
}

.editor-item-del:hover {
    opacity: 1;
    background: rgba(244, 67, 54, 0.3);
}

.editor-empty {
    font-size: 0.78rem;
    color: #888;
    font-style: italic;
    padding: 10px 4px;
    line-height: 1.5;
}

/* Khu vực nút Lưu */
.editor-save-area {
    border-top: 1px solid #444;
    padding-top: 10px;
    margin-top: 4px;
}

.editor-save-btn {
    width: 100%;
    background: #388E3C;
    color: #fff;
    border: none;
    padding: 11px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: bold;
    font-family: inherit;
    transition: background 0.2s ease;
}

.editor-save-btn:hover {
    background: #43A047;
}

/* Nút chuyển sang màu cam nhấp nháy khi có thay đổi chưa lưu */
.editor-save-btn.unsaved {
    background: #E65100;
    animation: unsavedPulse 1.6s ease-in-out infinite;
}

.editor-save-btn.unsaved:hover {
    background: #F57C00;
}

@keyframes unsavedPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(230, 81, 0, 0.6); }
    50%      { box-shadow: 0 0 0 7px rgba(230, 81, 0, 0); }
}

.editor-save-status {
    font-size: 0.8rem;
    margin-top: 6px;
    text-align: center;
    min-height: 16px;
}

.editor-save-status.ok { color: #A5D6A7; }
.editor-save-status.error { color: #EF9A9A; }

/* Khu vực công cụ phụ (thu gọn được) */
.editor-details {
    border-top: 1px solid #444;
    padding-top: 8px;
    font-size: 0.8rem;
}

.editor-details summary {
    cursor: pointer;
    color: #aaa;
    padding: 4px 0;
}

.editor-details summary:hover {
    color: #fff;
}

/* Ô nhập văn bản trong bảng biên tập */
.dev-tool input[type="text"] {
    background: #222;
    color: #eee;
    border: 1px solid #444;
    padding: 8px;
    border-radius: 4px;
    width: 100%;
    font-family: inherit;
    font-size: 0.85rem;
    box-sizing: border-box;
}

.dev-tool input[type="text"]:focus {
    outline: none;
    border-color: #2d6cdf;
}

/* --- Khu vực chỉnh độ zoom cho điểm hiện vật --- */
.zoom-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: rgba(255, 255, 255, 0.04);
    padding: 10px;
    border-radius: 6px;
}

/* Khi đang sửa zoom của một điểm đã đặt thì đổi màu viền cho dễ nhận biết */
.zoom-row.editing {
    background: rgba(255, 152, 0, 0.12);
    border: 1px solid rgba(255, 152, 0, 0.5);
}

.zoom-edit-label {
    font-size: 0.78rem;
    color: #FFB74D;
    font-weight: bold;
    padding-bottom: 4px;
}

.zoom-label-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.zoom-value {
    background: #2d6cdf;
    color: #fff;
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 0.8rem;
    font-weight: bold;
}

/* Thanh trượt */
#zoom-slider {
    width: 100%;
    margin: 0;
    accent-color: #2d6cdf;
    cursor: pointer;
}

.zoom-scale {
    display: flex;
    justify-content: space-between;
    font-size: 0.7rem;
    color: #888;
}

.zoom-preview-btn,
.zoom-done-btn {
    width: 100%;
    border: none;
    padding: 8px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.8rem;
    font-family: inherit;
    transition: background 0.2s ease;
}

.zoom-preview-btn {
    background: rgba(255, 255, 255, 0.12);
    color: #ddd;
}

.zoom-preview-btn:hover {
    background: rgba(255, 255, 255, 0.22);
}

.zoom-done-btn {
    background: #F57C00;
    color: #fff;
    font-weight: bold;
}

.zoom-done-btn:hover {
    background: #FB8C00;
}

/* Nút kính lúp chỉnh zoom trong danh sách điểm */
.editor-item-zoom {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 0.85rem;
    padding: 2px 4px;
    border-radius: 4px;
    opacity: 0.6;
    transition: opacity 0.2s ease, background 0.2s ease;
}

.editor-item-zoom:hover {
    opacity: 1;
    background: rgba(45, 108, 223, 0.4);
}

/* --- Góc nhìn xuất phát của phòng --- */
/* Chữ xanh lá = đã đặt, chữ xám = chưa đặt */
.startview-set {
    color: #A5D6A7;
    font-weight: bold;
}

/* Nút phụ nhỏ, ít nổi bật (VD: nút Xóa góc xuất phát) */
.btn-subtle {
    background: rgba(255, 255, 255, 0.08) !important;
    color: #aaa !important;
    flex: 0 0 auto !important;
    padding: 8px 12px !important;
}

.btn-subtle:hover {
    background: rgba(244, 67, 54, 0.3) !important;
    color: #fff !important;
}

/* ============================================================
   MỞ RỘNG BẢNG BIÊN TẬP - Tận dụng chiều rộng 420px
   ============================================================ */

/* Nhãn rộng cố định để các ô nhập thẳng hàng nhau */
.dev-tool-label {
    min-width: 92px;
    display: inline-block;
}

/* Danh sách điểm/phòng cao hơn vì panel đã dài */
.editor-list {
    max-height: 260px;
}

/* Ghim nút Lưu ở đáy panel, luôn nhìn thấy dù đang cuộn */
.editor-save-area {
    position: sticky;
    bottom: -15px; /* Bù lại padding của panel */
    background: rgba(0, 0, 0, 0.95);
    padding: 12px 0 4px 0;
    margin-top: auto;
    z-index: 5;
}

/* Header cũng ghim ở trên cho dễ đóng bảng */
/* Ghim tiêu đề ở trên khi cuộn, để lúc nào cũng bấm được nút đóng */
.dev-tool-header {
    position: sticky;
    top: -15px; /* Bù lại padding 15px của panel */
    background: rgba(0, 0, 0, 0.95);
    padding-top: 15px;
    z-index: 5;
}

/* Nút đóng bảng: nổi rõ hơn khi rê chuột */
.dev-tool-header button {
    padding: 2px 8px;
    border-radius: 4px;
}

.dev-tool-header button:hover {
    background: rgba(244, 67, 54, 0.3);
    color: #fff;
}

/* Hai nút cùng hàng thì chia đều chiều ngang */
.dev-tool-row button {
    flex: 1;
}

/* Chữ trong danh sách to hơn một chút cho dễ đọc */
.editor-list-item {
    font-size: 0.84rem;
    padding: 8px 10px;
}

/* Màn hình thấp: giảm bớt chiều cao danh sách để vẫn thấy nút Lưu */
@media (max-height: 800px) {
    .editor-list {
        max-height: 170px;
    }
}

/* Màn hình hẹp: panel co lại theo bề ngang cửa sổ */
@media (max-width: 900px) {
    .dev-tool {
        width: calc(100vw - 40px);
        max-width: 420px;
    }
}

/* ============================================================
   QUẢN LÝ KHO HIỆN VẬT TRONG PANEL
   ============================================================ */

/* Ảnh thu nhỏ trong danh sách kho hiện vật */
.artifact-row-thumb {
    width: 34px;
    height: 34px;
    object-fit: cover;
    border-radius: 4px;
    background: #333;
    flex: 0 0 auto;
}

/* Biểu mẫu soạn thảo hiện vật */
.artifact-form {
    background: rgba(45, 108, 223, 0.1);
    border: 1px solid rgba(45, 108, 223, 0.4);
    border-radius: 8px;
    padding: 12px;
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.artifact-form-actions {
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    padding-top: 10px;
}

/* Danh sách ảnh trong biểu mẫu */
.af-image-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.af-image-item {
    display: flex;
    gap: 8px;
    background: rgba(0, 0, 0, 0.35);
    padding: 8px;
    border-radius: 6px;
    align-items: flex-start;
}

.af-image-preview {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 4px;
    background: #333;
    flex: 0 0 auto;
}

.af-image-fields {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 0;
}

.af-image-fields input,
.af-image-fields textarea {
    background: #222;
    color: #eee;
    border: 1px solid #444;
    border-radius: 4px;
    padding: 6px;
    font-family: inherit;
    font-size: 0.78rem;
    width: 100%;
    box-sizing: border-box;
    resize: vertical;
}

.af-image-fields input:focus,
.af-image-fields textarea:focus {
    outline: none;
    border-color: #2d6cdf;
}

.af-image-tools {
    display: flex;
    flex-direction: column;
    gap: 3px;
    flex: 0 0 auto;
}

.af-image-tools button {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #ccc;
    cursor: pointer;
    border-radius: 4px;
    padding: 3px 6px;
    font-size: 0.7rem;
}

.af-image-tools button:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.25);
    color: #fff;
}

.af-image-tools button:disabled {
    opacity: 0.25;
    cursor: default;
}

/* --- HỘP CHỌN ẢNH --- */
.image-picker-content {
    max-width: 900px;
    width: 90%;
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.image-picker-search input {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-family: 'Nunito', sans-serif;
    font-size: 1rem;
    box-sizing: border-box;
}

.image-picker-search input:focus {
    outline: none;
    border-color: #2d6cdf;
}

/* Lưới ảnh để bấm chọn */
.image-picker-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 10px;
    overflow-y: auto;
    flex: 1;
    min-height: 200px;
    padding: 4px;
}

.image-picker-cell {
    cursor: pointer;
    border: 3px solid transparent;
    border-radius: 8px;
    overflow: hidden;
    background: #f4f4f4;
    transition: border-color 0.15s ease, transform 0.15s ease;
    display: flex;
    flex-direction: column;
}

.image-picker-cell:hover {
    border-color: #2d6cdf;
    transform: scale(1.03);
}

.image-picker-cell img {
    width: 100%;
    height: 100px;
    object-fit: cover;
    display: block;
}

.image-picker-cell span {
    font-size: 0.7rem;
    color: #555;
    padding: 5px 6px;
    word-break: break-all;
    line-height: 1.3;
}

.image-picker-empty {
    grid-column: 1 / -1;
    text-align: center;
    color: #888;
    padding: 40px 20px;
    line-height: 1.6;
}

/* Khu vực dán link ảnh ngoài */
.image-picker-url {
    border-top: 1px solid #ddd;
    padding-top: 12px;
}

.image-picker-url label {
    display: block;
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 6px;
}

.image-picker-url-row {
    display: flex;
    gap: 8px;
}

.image-picker-url-row input {
    flex: 1;
    padding: 9px 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-family: 'Nunito', sans-serif;
    font-size: 0.9rem;
}

.image-picker-url-row input:focus {
    outline: none;
    border-color: #2d6cdf;
}

.image-picker-url-row button {
    background: #2d6cdf;
    color: white;
    border: none;
    padding: 9px 18px;
    border-radius: 8px;
    cursor: pointer;
    font-family: 'Nunito', sans-serif;
    font-weight: bold;
    white-space: nowrap;
}

.image-picker-url-row button:hover {
    background: #1e5bc6;
}

/* ============================================================
   TRANG CHỌN ĐỊA ĐIỂM (index.html)
   ============================================================ */
/* Trang bia can cuon duoc, ghi de overflow:hidden cua html,body o dau file */
html:has(.hub-body), body.hub-body {
    overflow-y: auto !important;
    height: auto !important;
    min-height: 100%;
}

.hub-body {
    background: linear-gradient(160deg, #1f2b3e 0%, #2c3e50 100%);
    min-height: 100vh;
}

.hub-container {
    padding: 120px 30px 60px 30px;
    max-width: 1400px;
    margin: 0 auto;
    text-align: center;
}

.hub-header h1 {
    color: white;
    font-size: 3rem;
    font-weight: bold;
    letter-spacing: 1px;
    margin: 0 0 14px 0;
    text-shadow: 2px 2px 12px rgba(0, 0, 0, 0.5);
}

.hub-header p {
    color: rgba(255, 255, 255, 0.75);
    font-size: 1.1rem;
    margin: 0 0 50px 0;
}

/* Lưới các thẻ địa điểm */
.location-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 28px;
}

.hub-loading {
    grid-column: 1 / -1;
    color: rgba(255, 255, 255, 0.6);
    padding: 60px 20px;
    line-height: 1.7;
}

/* Một thẻ địa điểm */
.location-card {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 16px;
    overflow: hidden;
    text-decoration: none;
    text-align: left;
    display: flex;
    flex-direction: column;
    transition: transform 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
}

.location-card:hover {
    transform: translateY(-6px);
    background: rgba(255, 255, 255, 0.14);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
}

.location-thumb {
    width: 100%;
    height: 210px;
    background: rgba(255, 255, 255, 0.06);
    overflow: hidden;
}

.location-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease;
}

.location-card:hover .location-thumb img {
    transform: scale(1.06);
}

/* Khi địa điểm chưa đặt ảnh bìa */
.location-thumb.no-cover {
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.35);
    font-size: 0.95rem;
    font-style: italic;
}

.location-body {
    padding: 20px 22px 24px 22px;
}

.location-body h2 {
    color: #FFD54F;
    font-size: 1.45rem;
    margin: 0 0 10px 0;
    font-weight: bold;
}

.location-body p {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.98rem;
    line-height: 1.55;
    margin: 0;
}

/* Màn hình nhỏ */
@media (max-width: 700px) {
    .hub-container {
        padding: 110px 18px 40px 18px;
    }

    .hub-header h1 {
        font-size: 2rem;
    }

    .location-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
}

/* Ô xem trước ảnh bìa địa điểm trong Panel */
.pf-cover-preview {
    width: 100%;
    height: 120px;
    border: 2px dashed rgba(255, 255, 255, 0.25);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #888;
    font-size: 0.8rem;
    font-style: italic;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.25);
}

.pf-cover-preview.has-image {
    border-style: solid;
    border-color: rgba(45, 108, 223, 0.5);
    padding: 0;
}

.pf-cover-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Ô xem trước nhân vật hướng dẫn viên (nền kẻ ô để thấy phần trong suốt của GIF) */
.pf-cover-preview.guide-preview {
    height: 140px;
    background-color: #2a2a2a;
    background-image:
        linear-gradient(45deg, #333 25%, transparent 25%),
        linear-gradient(-45deg, #333 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #333 75%),
        linear-gradient(-45deg, transparent 75%, #333 75%);
    background-size: 16px 16px;
    background-position: 0 0, 0 8px, 8px -8px, -8px 0;
}

/* Ảnh nhân vật giữ nguyên tỉ lệ, không bị cắt như ảnh nền */
.pf-cover-preview.guide-preview img {
    object-fit: contain;
}

/* =================================================================
   BẢNG BIÊN TẬP CHỈ HIỆN KHI CHẠY TRÊN MÁY MÌNH (xem common.js)
   Đưa lên mạng thì tự ẩn, khách không nhìn thấy.
   ================================================================= */
html:not(.editor-on) .dev-tool,
html:not(.editor-on) .dev-tool-open {
    display: none !important;
}

/* Bảng biên tập dài thì cuộn, không được ép co các mục bên trong
   (nếu không, danh sách địa điểm/phòng bị co mất, không thấy nút ✏️ 🗑️) */
.dev-tool > * {
    flex-shrink: 0;
}

/* Nút nhỏ trong danh sách (✏️ 🔗 🔍 🗑️) giữ đúng cỡ, nhường chỗ cho tên */
.editor-list-item button {
    flex: 0 0 auto;
}

.editor-list-item .editor-item-label {
    text-align: left;
}

/* Nút "📤 Tải từ máy tính lên" trong hộp chọn ảnh */
.image-picker-upload {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.image-picker-upload button {
    background: #2e7d32;
    color: white;
    border: none;
    padding: 10px 18px;
    border-radius: 8px;
    cursor: pointer;
    font-family: 'Nunito', sans-serif;
    font-weight: bold;
    font-size: 0.95rem;
}

.image-picker-upload button:hover { background: #1b5e20; }
.image-picker-upload button:disabled { background: #999; cursor: wait; }

.image-picker-upload span {
    font-size: 0.85rem;
    color: #666;
}

/* Ảnh có tên file dễ lỗi (có dấu, khoảng trắng) */
.image-picker-cell.bad-name span {
    color: #c62828;
}

/* Hộp danh sách để bấm chọn (gắn hiện vật, lấy lại bản sao lưu...) */
.list-picker {
    z-index: 3000; /* Nổi lên trên cả bảng biên tập */
}

.list-picker-content {
    max-width: 560px;
    width: 90%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    gap: 10px;
    font-family: 'Nunito', sans-serif;
}

.list-picker-hint {
    margin: 0;
    color: #666;
    text-align: center;
}

.list-picker-list {
    list-style: none;
    margin: 0;
    padding: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.list-picker-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    color: #333;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.list-picker-item:hover {
    border-color: #2d6cdf;
    background: #f0f5ff;
}

.list-picker-item.current {
    border-color: #2e7d32;
    background: #f1f8e9;
}

.list-picker-item img {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 6px;
    background: #eee;
    flex-shrink: 0;
}

/* ============================================================
   TỰ ĐỘNG THAM QUAN (autotour.js)
   ============================================================ */
.nav-button.autotour-btn.active {
    background-color: #f59e0b;
    color: #1f1300;
}

/* Bảng điều khiển: góc dưới bên trái (tên phòng ở giữa, hướng dẫn viên bên phải) */
.autotour-panel {
    position: fixed;
    left: 20px;
    bottom: 20px;
    z-index: 950;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px 12px;
    background: rgba(15, 23, 42, 0.82);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 14px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(8px);
    font-family: 'Nunito', sans-serif;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.autotour-row {
    display: flex;
    gap: 6px;
}

.autotour-ctl {
    flex: 1;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    border: none;
    border-radius: 20px;
    padding: 7px 12px;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: bold;
    cursor: pointer;
    white-space: nowrap;
    transition: background-color 0.2s ease;
}

.autotour-ctl:hover {
    background: rgba(255, 255, 255, 0.28);
}


.autotour-speed {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
}

.autotour-speed input {
    flex: 1;
    min-width: 90px;
    accent-color: #f59e0b;
}

.autotour-speed b {
    min-width: 42px;
    text-align: right;
}

/* Chú thích hiện vật đang ngắm — ngay dưới thanh menu */
.autotour-caption {
    position: fixed;
    top: 90px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 940;
    max-width: 80vw;
    padding: 10px 22px;
    background: rgba(0, 0, 0, 0.65);
    color: #fff;
    border-radius: 30px;
    font-family: 'Nunito', sans-serif;
    font-size: 1.05rem;
    font-weight: bold;
    text-align: center;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    pointer-events: none;
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.autotour-caption.hidden {
    opacity: 0;
    transform: translateX(-50%) translateY(-10px);
}

@media (max-width: 768px) {
    .autotour-panel {
        left: 10px;
        bottom: 80px; /* chừa chỗ cho tên phòng ở đáy màn hình */
        padding: 8px;
        gap: 6px;
    }

    .autotour-ctl {
        font-size: 0.78rem;
        padding: 6px 9px;
    }

    .autotour-speed input {
        min-width: 70px;
    }

    .autotour-caption {
        top: 110px; /* thanh menu trên điện thoại có thể xuống 2 hàng */
        font-size: 0.88rem;
        padding: 8px 16px;
    }
}

/* Thanh menu nằm ở left:50% nên chỉ có nửa màn hình để giãn —
   giữ chữ mỗi nút trên một dòng để menu tự rộng ra cho đủ */
.main-nav .nav-button {
    white-space: nowrap;
}
