/* ---------- AR / VR: bảng chọn cách xem ---------- */
.xr-sheet {
  position: absolute; z-index: 7; right: max(12px, env(safe-area-inset-right, 0px)); top: calc(20px + var(--toolbar-height, 34px));
  width: min(360px, calc(100% - 24px)); max-height: calc(100% - 32px - var(--toolbar-height, 34px)); overflow: auto;
  background: var(--color-sheet); color: var(--color-ink); border: 1px solid var(--color-rule); border-radius: 14px;
  box-shadow: 0 12px 32px #0000002e; padding: 12px;
}
.xr-sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 2px 8px; }
.xr-sheet-head h2 { margin: 0; font-size: 14px; font-weight: 700; }
.xr-sheet-close {
  border: 1px solid var(--color-chip-border); background: transparent; color: var(--color-ink); border-radius: 999px;
  font: inherit; font-size: 12px; font-weight: 600; padding: 4px 10px; cursor: pointer;
}
.xr-options { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.xr-options > li { margin: 0; }
.xr-option {
  position: relative; width: 100%; display: flex; align-items: flex-start; gap: 10px; text-align: left;
  padding: 10px 12px; border: 1px solid var(--color-rule); border-radius: 10px; background: transparent;
  color: var(--color-ink); font: inherit; cursor: pointer;
}
.xr-option:hover, .xr-option:focus-within { border-color: var(--color-ink-muted); }
.xr-option[aria-pressed="true"] { border-color: var(--color-oak); background: var(--color-oak-soft); }
.xr-option[aria-disabled="true"] { opacity: .6; cursor: progress; }
.xr-option-icon { flex: 0 0 auto; margin-top: 1px; color: var(--color-oak); }
.xr-option-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.xr-option-text b { font-size: 13px; font-weight: 600; }
.xr-option-text small { font-size: 12px; color: var(--color-ink-muted); line-height: 1.4; }
/* Thẻ <a rel="ar"> phủ cả ô để chạm chỗ nào cũng mở được AR Quick Look. */
.xr-option-link { position: absolute; inset: 0; border-radius: inherit; }
.xr-option-link img { display: block; width: 100%; height: 100%; opacity: 0; }
.xr-option-link:focus-visible { outline: 2px solid var(--color-oak); outline-offset: 2px; }
.xr-sheet-note { margin: 10px 2px 0; font-size: 12px; color: var(--color-ink-muted); }

@media (max-width: 760px) {
  .xr-sheet {
    top: auto; right: 0; left: 0; bottom: 0; width: auto; max-height: 78%;
    border-radius: 16px 16px 0 0; border-bottom: 0;
    padding: 12px max(12px, env(safe-area-inset-right, 0px)) max(14px, env(safe-area-inset-bottom, 0px)) max(12px, env(safe-area-inset-left, 0px));
  }
}

/* ---------- AR qua camera (WebXR dom-overlay) ---------- */
.xr-ar-overlay {
  position: fixed; inset: 0; z-index: 50; pointer-events: none; font-family: var(--font-ui); color: #fff;
  display: flex; flex-direction: column; justify-content: space-between;
  padding: max(16px, env(safe-area-inset-top, 0px)) 16px max(20px, env(safe-area-inset-bottom, 0px));
}
.xr-ar-hint { align-self: center; margin: 0; max-width: 340px; text-align: center; background: #1b2425cc; border-radius: 10px; padding: 8px 12px; font-size: 13px; font-weight: 600; }
.xr-ar-actions { display: flex; justify-content: center; gap: 10px; }
.xr-ar-actions button {
  pointer-events: auto; border: 0; border-radius: 999px; padding: 11px 18px; font: inherit; font-size: 14px; font-weight: 600;
  background: #ffffffeb; color: #1b2425;
}
.xr-ar-actions .xr-ar-exit { background: #1b2425e6; color: #fff; }

/* ---------- kính Cardboard: chỉ còn khung 3D toàn màn hình ---------- */
.app.is-stereo .app-header, .app.is-stereo .side-panel, .app.is-stereo #model-toolbar, .app.is-stereo #model-hint,
.app.is-stereo .minimap, .app.is-stereo .location-badge, .app.is-stereo .joystick, .app.is-stereo #room-labels,
.app.is-stereo .xr-sheet, .app.is-stereo .selection-bar { display: none !important; }
.app.is-stereo .stage { position: fixed; inset: 0; z-index: 40; background: #000; }
.xr-stereo-touch { position: absolute; inset: 0; z-index: 5; touch-action: none; }
.xr-stereo-divider { position: absolute; top: 0; bottom: 0; left: 50%; width: 2px; margin-left: -1px; background: #000; z-index: 6; pointer-events: none; }
.xr-stereo-exit {
  position: absolute; z-index: 8; top: max(10px, env(safe-area-inset-top, 0px)); left: 50%; transform: translateX(-50%);
  border: 0; border-radius: 999px; padding: 7px 14px; font: inherit; font-size: 12.5px; font-weight: 600;
  background: #1b2425d9; color: #fff; cursor: pointer;
}

/* ---------- mô hình 3D của người dùng ---------- */
.custom-model-only { display: none; }
.app.has-custom-model .custom-model-only { display: inline-flex; }
/* Các nút dành cho ngôi nhà không dùng được với mô hình người dùng mở. */
.app.has-custom-model #model-toolbar > :not(#xr-button):not(#model-open-button):not(#model-house-button),
.app.has-custom-model #room-labels, .app.has-custom-model .minimap, .app.has-custom-model .location-badge,
.app.has-custom-model .joystick { display: none !important; }
#model-open-button[aria-busy="true"] { opacity: .6; cursor: progress; }
#model-viewport.is-drop-target::after {
  content: ""; position: absolute; inset: 8px; z-index: 9; pointer-events: none;
  border: 2px dashed var(--color-oak); border-radius: 14px; background: color-mix(in srgb, var(--color-oak) 10%, transparent);
}
