html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
    background: #000;
    font-family: Arial, Helvetica, sans-serif;
    color: #fff;
}

#pano {
    width: 100%;
    height: 100%;
    position: absolute;
    inset: 0;
}

/* ===== Logo / tiêu đề dự án ===== */
#brand {
    position: absolute;
    top: 18px;
    left: 22px;
    z-index: 20;
    pointer-events: none;
    text-shadow: 0 2px 8px rgba(0, 0, 0, .7);
}
#brand .name {
    font-size: 22px;
    font-weight: bold;
    letter-spacing: 2px;
    color: #ffc233;
}
#brand .sub {
    font-size: 11px;
    letter-spacing: 4px;
    opacity: .85;
}

/* ===== Nhãn card kiểu Diamond Square =====
   Màu điều khiển bằng biến — đổi trong form "Giao diện & Bộ mẫu" hoặc theo THEME */
:root {
    --lb-bg: rgba(250, 246, 238, .94);   /* nền card (và mũi nhọn dưới card) */
    --lb-icon: #c69a47;                  /* màu icon */
    --lb-text: #17233e;                  /* màu chữ */
    --lb-line: rgba(255, 255, 255, .9);  /* đường nối xuống */
    --lb-dot: #ff9420;                   /* chấm neo phát sáng */
}
div.vr-label {
    cursor: default;
    pointer-events: none;
}
.vr-label__box {
    position: absolute;
    bottom: 50px;
    left: 50%;
    transform: translateX(-50%) translateY(16px);
    opacity: 0;
    transition: transform .45s ease .3s, opacity .45s ease .3s;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px 10px 14px;
    background: var(--lb-bg);
    border-radius: 8px;
    box-shadow: 0 10px 28px rgba(20, 25, 40, .35);
}
.vr-label__box::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 7px solid transparent;
    border-top: 8px solid var(--lb-bg);
}
.vr-label__icon {
    flex: none;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--lb-icon);
}
.vr-label__icon svg {
    width: 30px;
    height: 30px;
    fill: currentColor;
    stroke: currentColor;
    stroke-width: .8;
    stroke-linejoin: round;
}
.vr-label__title {
    display: block;
    font-size: 12.5px;
    font-weight: bold;
    letter-spacing: .4px;
    text-transform: uppercase;
    color: var(--lb-text);
}
.vr-label__sub {
    display: block;
    margin-top: 3px;
    font-size: 12.5px;
    font-weight: bold;
    letter-spacing: .4px;
    color: var(--lb-text);
}
.vr-label__line {
    position: absolute;
    bottom: 9px;
    left: 50%;
    width: 0;
    height: 34px;
    border-left: 1.5px solid var(--lb-line);
    transform: scaleY(0);
    transform-origin: bottom;
    transition: transform .35s ease .12s;
}
.vr-label__dot {
    position: absolute;
    bottom: -4px;
    left: 50%;
    width: 10px;
    height: 10px;
    margin-left: -5px;
    border-radius: 50%;
    background: radial-gradient(circle, #ffffff 0%, var(--lb-dot) 60%, var(--lb-dot) 100%);
    box-shadow:
        0 0 10px 3px color-mix(in srgb, var(--lb-dot) 80%, transparent),
        0 0 26px 10px color-mix(in srgb, var(--lb-dot) 40%, transparent);
    opacity: 0;
    transform: scale(.3);
    transition: transform .25s ease, opacity .25s ease;
}
div.vr-label.show { pointer-events: auto; }
div.vr-label.show .vr-label__box {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}
div.vr-label.show .vr-label__line { transform: scaleY(1); }
div.vr-label.show .vr-label__dot { transform: scale(1); opacity: 1; animation: dotglow 2s ease-in-out infinite; }
@keyframes dotglow {
    0%, 100% { box-shadow: 0 0 10px 3px color-mix(in srgb, var(--lb-dot) 80%, transparent), 0 0 26px 10px color-mix(in srgb, var(--lb-dot) 40%, transparent); }
    50%      { box-shadow: 0 0 16px 6px color-mix(in srgb, var(--lb-dot) 95%, transparent), 0 0 38px 16px color-mix(in srgb, var(--lb-dot) 60%, transparent); }
}

/* Ẩn hộp mặc định của Pannellum */
.pnlm-panorama-info { display: none !important; }
.pnlm-about-msg { display: none !important; }

/* ===== Thanh menu xanh ===== */
#menubar {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 26px;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 18px;
    pointer-events: none;
}
.mb-pill {
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 22px;
    color: #fff;   /* màu chữ + icon (đổi được trong Giao diện menu) */
    background: linear-gradient(180deg, #2a63c4 0%, #174084 100%);
    border-radius: 999px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, .45);
}
.mb-btn {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 8px 14px;
    background: none;
    border: 0;
    color: inherit;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 12px;
    font-weight: bold;
    letter-spacing: 1px;
    white-space: nowrap;
    cursor: pointer;
    opacity: .95;
    transition: opacity .15s, transform .15s;
}
.mb-btn:hover { opacity: 1; transform: translateY(-1px); }
.mb-btn .ic {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border: 1.5px solid currentColor;
    border-radius: 50%;
    flex: none;
}
.mb-pill.plain .ic { border: none; }
.mb-btn .ic svg {
    width: 15px;
    height: 15px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.mb-arrow {
    pointer-events: auto;
    color: #fff;
    font-size: 30px;
    font-weight: bold;
    letter-spacing: -8px;
    padding: 0 12px 4px 6px;
    cursor: pointer;
    text-shadow: 0 2px 8px rgba(0, 0, 0, .8);
    user-select: none;
    transition: transform .15s;
}
.mb-arrow:hover { transform: scale(1.15); }

/* ===== Popup ===== */
#modal {
    position: absolute;
    inset: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, .65);
}
#modal.hidden { display: none; }
.modal-box {
    position: relative;
    max-width: min(860px, 92vw);
    max-height: 86vh;
    background: #0b2b5e;
    border-radius: 14px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, .6);
    overflow: hidden;
}
.modal-close {
    position: absolute;
    top: 10px;
    right: 14px;
    z-index: 2;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    opacity: .8;
}
.modal-close:hover { opacity: 1; }
.modal-content {
    padding: 30px;
    color: #fff;
    font-size: 14px;
    line-height: 1.7;
    overflow: auto;
    max-height: 86vh;
    text-align: center;
}
.modal-content h2 {
    margin: 0 0 12px;
    color: #ffc233;
    letter-spacing: 1px;
}
.modal-content iframe {
    width: min(800px, 88vw);
    aspect-ratio: 16 / 9;
    border: 0;
    display: block;
}
.modal-content img { max-width: 100%; border-radius: 8px; }

/* ===== Lớp SVG tuyến đường + khu vực ===== */
#overlay {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    /* Phải nổi trên canvas ảnh 360 (render-container), nhưng đứng trước
       .pnlm-ui (cùng z-index 1, thứ tự DOM quyết định) nên nhãn vẫn nằm trên hình vẽ */
    z-index: 1;
}
#overlay path.route {
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 16 12;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, .6));
    animation: dashflow 1.1s linear infinite;
}
@keyframes dashflow {
    to { stroke-dashoffset: -28; }
}
#overlay path.zone {
    stroke-linejoin: round;
    stroke-linecap: round;
    stroke-dasharray: 10 8;
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, .45));
    animation: zonepulse 2.6s ease-in-out infinite;
}
@keyframes zonepulse {
    0%, 100% { fill-opacity: .55; }
    50%      { fill-opacity: 1; }
}
#overlay circle.vert {
    fill: #ff4757;
    stroke: #fff;
    stroke-width: 2;
    pointer-events: all;
    cursor: grab;
}
#overlay circle.vert:hover { fill: #ffc233; }

/* Đường mờ xem trước khi đang vẽ */
#overlay path.ghost {
    fill: none;
    stroke: rgba(255, 255, 255, .75);
    stroke-width: 2;
    stroke-dasharray: 6 6;
    pointer-events: none;
}

/* Con trỏ dấu + khi đang ở chế độ đặt nhãn / vẽ hình */
#pano.drawing, #pano.drawing * { cursor: crosshair !important; }

/* ===== Toast ===== */
#toast {
    position: absolute;
    left: 50%;
    bottom: 110px;
    transform: translateX(-50%);
    z-index: 60;
    padding: 10px 20px;
    background: rgba(0, 0, 0, .8);
    color: #fff;
    font-size: 13px;
    border-radius: 20px;
    opacity: 0;
    pointer-events: none;
    transition: opacity .3s;
}
#toast.show { opacity: 1; }

/* ===== BẢNG BIÊN TẬP (Studio) ===== */
#ed-panel {
    position: absolute;
    top: 70px;
    left: 16px;
    z-index: 40;
    width: 250px;
    background: rgba(10, 16, 30, .92);
    border: 1px solid #ffc23355;
    border-radius: 12px;
    padding: 12px;
    font-size: 12px;
    user-select: none;
}
.ed-head {
    font-weight: bold;
    letter-spacing: 1px;
    color: #ffc233;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.ed-back { color: #9fb6dd; font-size: 11px; text-decoration: none; font-weight: normal; }
.ed-back:hover { color: #fff; }
#ed-panel button {
    font-family: inherit;
    margin: 2px;
    padding: 6px 10px;
    background: rgba(255, 255, 255, .1);
    border: 1px solid rgba(255, 255, 255, .35);
    border-radius: 8px;
    color: #fff;
    font-size: 11px;
    font-weight: bold;
    cursor: pointer;
}
#ed-panel button:hover { background: rgba(255, 194, 51, .4); }
#ed-panel .ed-modes button.on {
    background: #ffc233;
    color: #222;
    border-color: #ffc233;
}
#ed-panel button.save {
    background: rgba(50, 170, 80, .5);
    border-color: #4caf6e;
}
/* Nút "Hoàn tất hình" nhấp nháy khi đã đủ điểm để chốt */
#ed-panel button.ready {
    background: #ffc233;
    color: #222;
    border-color: #ffc233;
    animation: readypulse 1s ease-in-out infinite;
}
@keyframes readypulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255, 194, 51, .7); }
    50%      { box-shadow: 0 0 0 6px rgba(255, 194, 51, 0); }
}
#ed-panel button.save:hover { background: rgba(50, 170, 80, .8); }
.ed-hint { margin: 8px 2px; line-height: 1.5; opacity: .85; }
.ed-sub { margin: 8px 2px 4px; opacity: .6; font-size: 11px; }
.ed-shape-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
    padding: 3px;
    margin: 2px 0;
    background: rgba(255, 255, 255, .06);
    border-radius: 6px;
}
.ed-shape-row button { padding: 4px 7px !important; }
.ed-shape-row .shape-name {
    flex: 1;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 7px;
    background: none !important;
    border: none !important;
    font-weight: normal !important;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}
.ed-shape-row .shape-name:hover { color: #ffc233; }
.ed-shape-row .sw {
    flex: none;
    width: 14px;
    height: 14px;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, .5);
}

/* Hàng chọn màu + mẫu nhanh trong form hình vẽ */
.ed-colorrow {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
}
.ed-colorrow input[type=color] {
    width: 44px;
    height: 32px;
    padding: 2px;
    background: #081c3f;
    border: 1px solid #2c4a80;
    border-radius: 8px;
    cursor: pointer;
}
.ed-colorrow input[type=range] { flex: 1; }
.ed-presets { display: flex; flex-wrap: wrap; gap: 6px; }
.ed-presets .preset {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    background: #081c3f;
    border: 1px solid #2c4a80;
    border-radius: 16px;
    color: #dfe8f5;
    font-size: 11px;
    cursor: pointer;
}
.ed-presets .preset:hover { border-color: #ffc233; }
.ed-presets .preset span {
    width: 13px;
    height: 13px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, .5);
}
.ed-presets .preset.theme {
    border-color: #ffc233aa;
    font-weight: bold;
}
.ed-presets .preset.theme span {
    width: 22px;
    border-radius: 6px;
}
.ed-actions { margin-top: 10px; display: flex; flex-direction: column; gap: 4px; }
.ed-actions button { width: 100%; }
.ed-tabs { display: flex; flex-wrap: wrap; gap: 2px; margin-bottom: 6px; }
.ed-tabs button.on { background: #2563cc; border-color: #4d8af0; }

/* Form trong modal của editor */
.ed-form { text-align: left; min-width: min(420px, 84vw); }
.ed-form h2 { text-align: center; }
.ed-form label {
    display: block;
    font-size: 11px;
    margin: 12px 0 4px;
    opacity: .75;
    text-transform: uppercase;
    letter-spacing: .5px;
}
.ed-form input[type=text], .ed-form textarea {
    width: 100%;
    box-sizing: border-box;
    padding: 9px 11px;
    background: #081c3f;
    border: 1px solid #2c4a80;
    border-radius: 8px;
    color: #fff;
    font-size: 13px;
    font-family: inherit;
}
.ed-icons { display: flex; flex-wrap: wrap; gap: 6px; }
.ed-icons button {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #081c3f;
    border: 2px solid #2c4a80;
    border-radius: 10px;
    color: #c69a47;
    cursor: pointer;
}
.ed-icons button svg { width: 24px; height: 24px; fill: currentColor; }
.ed-icons button.on { border-color: #ffc233; background: #14305e; }
/* Hàng cấu hình từng nút menu */
.ed-btnrow {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 5px 0;
}
.ed-btnrow input[type=checkbox] { width: 16px; height: 16px; }
.ed-btnrow .ed-btnicon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border: 1px solid #2c4a80;
    border-radius: 50%;
    color: #9fb6dd;
    flex: none;
}
.ed-btnrow .ed-btnicon svg {
    width: 13px;
    height: 13px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
}
.ed-btnrow input[type=text] { flex: 1; }
.ed-form select {
    padding: 8px 10px;
    background: #081c3f;
    border: 1px solid #2c4a80;
    border-radius: 8px;
    color: #fff;
    font-size: 13px;
    font-family: inherit;
}

.ed-form-actions { margin-top: 18px; display: flex; gap: 8px; justify-content: flex-end; }
.ed-form-actions button {
    padding: 9px 20px;
    border-radius: 8px;
    border: 0;
    font-weight: bold;
    font-size: 13px;
    cursor: pointer;
    font-family: inherit;
}
.ed-form-actions .save { background: #2ea35a; color: #fff; }
.ed-form-actions .save:hover { background: #37b968; }
.ed-form-actions .danger { background: #8d3040; color: #fff; }
.ed-form-actions .danger:hover { background: #a63a4d; }

@media (max-width: 760px) {
    #brand .name { font-size: 16px; }
    .vr-label__box { padding: 5px 12px 5px 6px; gap: 8px; }
    .vr-label__icon svg { width: 22px; height: 22px; }
    .vr-label__title, .vr-label__sub { font-size: 10.5px; }
    #menubar { gap: 6px; bottom: 14px; }
    .mb-pill {
        max-width: 78vw;
        overflow-x: auto;
        padding: 6px 14px;
        scrollbar-width: none;
    }
    .mb-pill::-webkit-scrollbar { display: none; }
    .mb-btn { padding: 6px 8px; font-size: 10px; }
    .mb-btn .ic { width: 24px; height: 24px; }
    #ed-panel { width: 200px; top: 60px; left: 8px; }
}
