/* Trang Cảnh quan 3D Tràng An: dùng chung banner, khung, ký hiệu và nút của trang Bản đồ (map.css);
   tệp này thêm phần riêng: một panel trái chia thẻ, bản đồ rộng, chú giải, chọn kỳ. Giao diện phẳng, màu đơn. */

/* ---- Banner ---- */
.l3d-period {
  display: inline-flex; align-items: center; gap: 7px; margin: 0; padding: 6px 12px; border-radius: 999px;
  background: #ffffffe6; color: #0c1930; font-size: 12.5px; font-weight: 500;
}
.l3d-period[hidden] { display: none; }
.l3d-period.wait { background: #fffbeb; color: #92400e; }
.l3d-period .icon { width: 15px; height: 15px; }
.l3d-page .map-hero-text { flex: 1 1 380px; }
.l3d-page .map-categories button { cursor: pointer; border: 0; background: none; font: inherit; min-width: 64px; max-width: 92px; }
.l3d-page .map-categories strong { display: block; max-width: 92px; overflow: hidden; text-overflow: ellipsis; }

/* ---- Khung 2 cột: panel trái chia thẻ, bản đồ rộng ---- */
@media (min-width: 761px) {
  .map-page.l3d-page .map-layout { grid-template-columns: clamp(300px, 23vw, 370px) minmax(0, 1fr); }
}
.l3d-page .l3d-side { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.l3d-page .l3d-tabs { flex: none; display: grid; grid-template-columns: repeat(3, 1fr); }
.l3d-page .l3d-tabs button { display: inline-flex; align-items: center; justify-content: center; gap: 5px; white-space: nowrap; }
.l3d-page .l3d-tabs .icon { width: 15px; height: 15px; opacity: .75; }
.l3d-page .l3d-tabs button.active .icon { opacity: 1; }
.l3d-tab { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 10px 4px 8px; display: grid; align-content: start; gap: 12px; scrollbar-width: thin; }
.l3d-tab[hidden] { display: none; }
/* Công tắc gạt trong panel (cùng kiểu trang Bản đồ): ẩn ô chọn gốc, vẽ bằng .mx-tog. */
.l3d-side .mx-switch { appearance: auto; position: absolute; width: 1px; height: 1px; margin: 0; padding: 0; opacity: 0; overflow: hidden; clip: rect(0 0 0 0); }
.l3d-side .mx-switch::after { content: none; }
.l3d-side .mx-sec h3 { margin-bottom: 6px; }
.l3d-side #l3d-layers { grid-auto-rows: auto; align-content: start; }
.l3d-side .mx-row { padding: 5px 6px; }
.l3d-chips { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.l3d-chips .mx-chip { flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 8px 4px; text-align: center; font-size: 11.5px; }
.l3d-grp { margin: 8px 6px 2px; font-size: 11px; font-weight: 700; letter-spacing: .3px; text-transform: uppercase; color: #94a3b8; }
.l3d-grp:first-child { margin-top: 0; }
.l3d-range { display: flex; align-items: center; gap: 8px; padding: 4px 6px 0; font-size: 12px; color: #334155; }
.l3d-range input { flex: 1; min-width: 0; accent-color: #0f766e; }
.l3d-range b { min-width: 34px; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---- Thẻ Số liệu ---- */
.l3d-status { display: grid; gap: 6px; padding: 10px 12px; border-radius: 12px; border: 1px solid #bbf7d0; background: #f0fdf4; }
.l3d-status.wait { border-color: #fde68a; background: #fffbeb; }
.l3d-status p { margin: 0; font-size: 12px; line-height: 1.5; color: #334155; }
.l3d-badge { justify-self: start; display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 700; color: #fff; background: #16a34a; }
.l3d-status.wait .l3d-badge { background: #d97706; }
.l3d-badge .icon { width: 13px; height: 13px; filter: brightness(0) invert(1); }
.l3d-kpis { display: grid; gap: 8px; }
.l3d-kpi { display: flex; gap: 10px; align-items: flex-start; padding: 10px; border-radius: 12px; border: 1px solid #e3ebe8; background: #fff; }
.l3d-kpi .mx-ico { width: 32px; height: 32px; border-radius: 10px; }
.l3d-kpi .mx-ico .icon { width: 17px; height: 17px; }
.l3d-kpi > div { min-width: 0; display: grid; gap: 1px; }
.l3d-kpi small { font-size: 11.5px; color: #64748b; }
.l3d-kpi b { font-size: 17px; line-height: 1.25; color: #0c1930; font-variant-numeric: tabular-nums; }
.l3d-kpi span:not(.mx-ico) { font-size: 11.5px; line-height: 1.4; color: #64748b; }
.l3d-empty { display: flex; gap: 8px; align-items: flex-start; margin: 0; padding: 10px 12px; border-radius: 12px; border: 1px solid #fde68a; background: #fffbeb; color: #92400e; font-size: 12.5px; line-height: 1.5; }
.l3d-empty .icon { width: 16px; height: 16px; flex: none; margin-top: 2px; }
.l3d-text { margin: 0; font-size: 12.5px; line-height: 1.6; color: #475569; }

/* ---- Bản đồ: chọn kỳ ---- */
.l3d-page .map-floating-tools { top: 112px; }
.l3d-page .map-canvas-shell:fullscreen { border: 0; border-radius: 0; }
.l3d-seg { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); z-index: 2; display: inline-flex; padding: 3px; border-radius: 999px; background: #fff; box-shadow: 0 2px 10px #0a2a2530; }
.l3d-seg[hidden] { display: none; }
.l3d-seg button { border: 0; background: none; padding: 6px 14px; border-radius: 999px; font: inherit; font-size: 12.5px; color: #334155; cursor: pointer; }
.l3d-seg button.on { background: #0f766e; color: #fff; font-weight: 600; }

/* ---- Chú giải (luôn hiện, thu gọn được) ---- */
.l3d-legend {
  position: absolute; right: 10px; bottom: 34px; z-index: 2; width: 236px; max-height: calc(100% - 120px); display: flex; flex-direction: column;
  border-radius: 12px; background: #fffffff5; box-shadow: 0 4px 16px #0a2a2533; font-size: 11.5px; color: #334155; overflow: hidden;
}
.l3d-legend-head { display: flex; align-items: center; gap: 7px; width: 100%; padding: 8px 10px; border: 0; background: none; font: inherit; color: #0c1930; cursor: pointer; text-align: left; }
.l3d-legend-head strong { flex: 1; font-size: 12.5px; }
.l3d-legend-head .icon { width: 15px; height: 15px; }
.l3d-legend-head .icon:last-child { transition: transform .15s; }
.l3d-legend.closed .l3d-legend-head .icon:last-child { transform: rotate(180deg); }
.l3d-legend.closed .l3d-legend-body { display: none; }
.l3d-legend-body { overflow-y: auto; padding: 0 10px 10px; display: grid; gap: 8px; border-top: 1px solid #eef2f4; scrollbar-width: thin; }
.lg-sec { display: grid; gap: 4px; padding-top: 8px; }
.lg-sec > small { font-size: 10.5px; font-weight: 700; letter-spacing: .3px; text-transform: uppercase; color: #94a3b8; }
.lg-sec ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.lg-sec li { display: flex; align-items: center; gap: 7px; line-height: 1.3; }
.lg-sec li > i { flex: none; width: 14px; height: 10px; border-radius: 2px; border: 1px solid #0000001f; }
.lg-sym { flex: none; display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--c); border: 2px solid #fff; box-shadow: 0 1px 3px #0003; }
.lg-sym .icon { width: 11px; height: 11px; filter: brightness(0) invert(1); }
.lg-cluster { flex: none; display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: #007f78; border: 3px solid #b5eee4; color: #fff; font-size: 9px; font-weight: 700; box-sizing: border-box; }
.lg-dot { flex: none; width: 12px; height: 12px; margin: 0 4px; border-radius: 50%; background: var(--c); border: 2px solid #fff; box-shadow: 0 0 0 1px #0002; }
.lg-sec li > i.lg-poly { background: color-mix(in srgb, var(--c) 22%, #fff); border: 2px solid var(--c); }
.lg-sec li > i.lg-line { height: 0; border: 0; border-top: 2px dashed #fff; outline: 1px solid #47556966; background: none; }
.lg-empty { margin: 8px 0 0; color: #94a3b8; }

/* ---- Thẻ popup riêng ---- */
.tp-media-sm { height: 120px; }
.tp-badges { display: flex; flex-wrap: wrap; gap: 5px; }

@media (max-width: 760px) {
  .l3d-seg { top: auto; bottom: 10px; }
  .l3d-legend { right: 8px; bottom: 54px; width: 200px; }
  .l3d-page .l3d-side { overflow: visible; }
}
/* Quy tắc chung cho nhãn biểu mẫu thêm lề 13px: bỏ trong panel. */
.l3d-side label.mx-row, .l3d-side label.mx-chip, .l3d-side label.l3d-range { margin: 0; }
/* Chú giải đặt góc dưới trái để không đè nút Hỏi trợ lý. */
.l3d-legend { right: auto; left: 10px; bottom: 30px; }
@media (max-width: 760px) { .l3d-legend { left: 8px; bottom: 54px; } }
/* Khối giải thích mốc năm của số liệu (thẻ Giới thiệu). */
.l3d-years { display: grid; gap: 6px; margin-bottom: 12px; padding: 10px 12px; border-radius: 12px; background: #f0f9ff; border: 1px solid #bae6fd; }
.l3d-years strong { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: #0c4a6e; }
.l3d-years strong .icon { width: 15px; height: 15px; }
.l3d-years ul { margin: 0; padding-left: 16px; display: grid; gap: 5px; }
.l3d-years li { font-size: 12px; line-height: 1.5; color: #334155; }
.l3d-years b { color: #0f172a; }

/* ---- Dòng thời gian các năm (thay cho công tắc hai kỳ) ---- */
.l3d-timeline { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); z-index: 3; display: flex; align-items: center; gap: 6px; max-width: calc(100% - 140px); padding: 4px; border-radius: 999px; background: #fff; box-shadow: 0 2px 10px #0a2a2530; }
.l3d-timeline[hidden] { display: none; }
.l3d-play { flex: none; display: grid; place-items: center; width: 30px; height: 30px; border: 0; border-radius: 50%; background: #e6f4f1; cursor: pointer; }
.l3d-play[hidden] { display: none; }
.l3d-play .icon { width: 15px; height: 15px; }
.l3d-play.on { background: #0f766e; }
.l3d-play.on .icon { filter: brightness(0) invert(1); }
.l3d-yearbar { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.l3d-yearbar button { flex: none; border: 0; background: none; padding: 6px 11px; border-radius: 999px; font: inherit; font-size: 12.5px; font-variant-numeric: tabular-nums; color: #334155; cursor: pointer; }
.l3d-yearbar button:hover { background: #f1f5f9; }
.l3d-yearbar button.on { background: #0f766e; color: #fff; font-weight: 600; }
@media (max-width: 760px) { .l3d-timeline { top: auto; bottom: 10px; max-width: calc(100% - 20px); } }

/* ---- Thẻ Số liệu: diễn biến theo năm, thời gian dữ liệu ---- */
.l3d-series, .l3d-when { display: grid; gap: 8px; padding: 10px 12px; border-radius: 12px; border: 1px solid #e3ebe8; background: #fff; }
.l3d-series[hidden], .l3d-when[hidden] { display: none; }
.l3d-series h3, .l3d-when h3 { display: flex; align-items: center; gap: 6px; margin: 0; font-size: 12.5px; color: #0c1930; }
.l3d-series h3 .icon, .l3d-when h3 .icon { width: 15px; height: 15px; }
.l3d-series table { width: 100%; border-collapse: collapse; font-size: 11.5px; font-variant-numeric: tabular-nums; }
.l3d-series th { padding: 4px 3px; text-align: right; font-size: 10.5px; font-weight: 600; color: #64748b; border-bottom: 1px solid #e2e8f0; line-height: 1.25; }
.l3d-series td { padding: 4px 3px; text-align: right; color: #334155; border-bottom: 1px solid #f1f5f9; }
.l3d-series th:first-child, .l3d-series td:first-child { text-align: left; }
.l3d-series td i { color: #d97706; font-style: normal; margin-left: 2px; }
.l3d-series tbody tr { cursor: pointer; }
.l3d-series tbody tr:hover td { background: #f8fafc; }
.l3d-series tbody tr.on td { background: #e6f4f1; color: #0f172a; font-weight: 600; }
.l3d-series p { margin: 0; font-size: 11px; color: #94a3b8; }
.l3d-when dl { display: grid; grid-template-columns: minmax(0, 42%) minmax(0, 1fr); gap: 5px 10px; margin: 0; font-size: 11.5px; line-height: 1.45; }
.l3d-when dt { color: #64748b; }
.l3d-when dd { margin: 0; color: #0f172a; }
.lg-when { margin: 8px 0 0; font-size: 10.5px; color: #94a3b8; }
/* Không để bảng làm rộng cột: mọi khối trong thẻ co theo bề rộng panel. */
.l3d-tab { grid-template-columns: minmax(0, 1fr); }
.l3d-series table { table-layout: fixed; }
.l3d-series th:first-child, .l3d-series td:first-child { width: 17%; white-space: nowrap; }
.l3d-kpi > div, .l3d-when dd { overflow-wrap: anywhere; }
/* Dòng thời gian và nguồn dưới tên mỗi lớp. */
.l3d-time { display: block; margin-top: 1px; font-size: 10.5px; line-height: 1.35; color: #64748b; font-weight: 400; }
.l3d-side .mx-row:has(.l3d-time) { padding-top: 4px; padding-bottom: 4px; }
.lg-sec li > i.lg-bld { background: #d8d1c4; border: 1px solid #a8a090; box-shadow: 2px -2px 0 #c3b9a8; }
/* Chú giải ở góc trên bên phải, dưới thanh thời gian: không đè các nút nổi bên trái và nút trợ lý ở góc dưới. */
.l3d-legend { left: auto; right: 10px; top: 60px; bottom: auto; max-height: calc(100% - 150px); }
@media (max-width: 760px) { .l3d-legend { right: 8px; top: 10px; left: auto; bottom: auto; max-height: calc(100% - 80px); } }

/* ---- Thuyết minh khi bay tham quan: khung giới thiệu ở cuối bản đồ, phụ đề ngay phía trên ---- */
.l3d-narr {
  position: absolute; left: 50%; bottom: 30px; transform: translateX(-50%); z-index: 4; width: min(640px, calc(100% - 40px));
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 10px 12px 14px;
  border-radius: 14px; background: #fff; box-shadow: 0 8px 26px #0a2a2540; overflow: hidden;
}
.l3d-narr[hidden] { display: none; }
.l3d-narr-img { width: 64px; height: 64px; border-radius: 10px; object-fit: cover; background: #e2e8f0; }
.l3d-narr-img[hidden] { display: none; }
.l3d-narr-body { display: grid; gap: 2px; min-width: 0; }
.l3d-narr-body small { font-size: 11px; font-weight: 700; letter-spacing: .3px; text-transform: uppercase; color: #0f766e; }
.l3d-narr-body strong { font-size: 16px; line-height: 1.3; color: #0c1930; }
.l3d-narr-body span { font-size: 12px; line-height: 1.4; color: #64748b; }
.l3d-narr-body span:empty { display: none; }
.l3d-narr-actions { display: flex; gap: 6px; align-items: center; }
.l3d-narr-btn { display: inline-flex; align-items: center; justify-content: center; gap: 5px; min-width: 34px; height: 34px; padding: 0 8px; border: 1px solid #e2e8f0; border-radius: 10px; background: #fff; color: #0f172a; font: 600 12px 'Be Vietnam Pro', sans-serif; text-decoration: none; cursor: pointer; }
.l3d-narr-btn:hover { background: #f1f5f9; }
.l3d-narr-btn .icon { width: 16px; height: 16px; }
.l3d-narr-btn.wide { background: #7c3aed; border-color: #7c3aed; color: #fff; }
.l3d-narr-btn.wide .icon { filter: brightness(0) invert(1); }
.l3d-narr-btn[hidden] { display: none; }
#l3d-narr-sound[aria-pressed="false"] { background: #fef2f2; border-color: #fecaca; }
.l3d-narr-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: #e2e8f0; }
.l3d-narr-bar i { display: block; height: 100%; width: 0; background: #0f766e; transition: width .25s linear; }
.l3d-sub {
  position: absolute; left: 50%; bottom: 128px; transform: translateX(-50%); z-index: 4; max-width: min(760px, calc(100% - 60px)); margin: 0;
  padding: 8px 14px; border-radius: 10px; background: #0f172ad9; color: #fff; font-size: 15.5px; line-height: 1.5; text-align: center;
  text-shadow: 0 1px 2px #0008;
}
.l3d-sub[hidden] { display: none; }
@media (max-width: 760px) {
  .l3d-narr { grid-template-columns: minmax(0, 1fr) auto; bottom: 56px; }
  .l3d-narr-img { display: none; }
  .l3d-sub { bottom: 150px; font-size: 14px; }
}
/* Âm thanh bị trình duyệt chặn: nút loa nhấp nháy, dòng nhắc thay cho dòng tài nguyên. */
#l3d-narr-sound.blocked { background: #fef3c7; border-color: #f59e0b; animation: l3d-pulse 1.2s ease-in-out infinite; }
@keyframes l3d-pulse { 50% { box-shadow: 0 0 0 5px #f59e0b40; } }
#l3d-narr-res[data-blocked]:not([data-blocked=""])::after { content: attr(data-blocked); display: block; color: #b45309; font-weight: 600; }
@media (prefers-reduced-motion: reduce) { #l3d-narr-sound.blocked { animation: none; } }
