/* Mô hình 3D và các lớp phủ: nhãn phòng, thông báo, bản đồ nhỏ, joystick. */
#model-viewport { background: #dfe8eb; }
#model-viewport canvas { display: block; width: 100%; height: 100%; touch-action: none; outline: none; }
#model-viewport .viewport-hint { color: #3f4a48; background: #ffffffd9; border-color: #d5dcda; }
@media (min-width: 1200px) { #model-toolbar { flex-wrap: wrap; overflow: visible; } }

.walk-only, .night-only { display: none; }
.app.is-walking .walk-only, .app.is-night .night-only { display: inline-flex; }

#room-labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 1; }
.room-label-3d {
  position: absolute; left: 0; top: 0; transform: translate(-50%, -50%); pointer-events: auto; will-change: transform;
  border: 0; border-radius: 6px; padding: 3px 8px; background: #1b2425d9; color: #fff;
  font-size: 11.5px; font-weight: 600; letter-spacing: .02em; cursor: pointer; white-space: nowrap;
}
.room-label-3d:hover, .room-label-3d.is-active { background: #9c5c26; }

.viewer-toast {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 6; pointer-events: none;
  background: #1b2425eb; color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums;
}
.viewer-error { position: absolute; inset: 0; display: grid; place-items: center; padding: 24px; text-align: center; color: #3f4a48; font-size: 14px; }

/* vị trí các lớp phủ dưới thanh công cụ (chiều cao thanh được đo bằng JS) */
#model-viewport .location-badge, #model-viewport .minimap { top: calc(20px + var(--toolbar-height, 34px)); }
.location-badge {
  position: absolute; left: max(12px, env(safe-area-inset-left, 0px)); z-index: 2; pointer-events: none;
  font-size: 12.5px; padding: 5px 10px; border-radius: 8px; background: #1b2425d9; color: #fff;
}
.location-badge b { font-weight: 600; }
.minimap {
  position: absolute; right: max(12px, env(safe-area-inset-right, 0px)); width: 92px; padding: 6px; z-index: 2;
  border-radius: 10px; background: #fbfcfbeb; border: 1px solid #cfd6d3; box-shadow: 0 2px 10px #0000001a;
}
.minimap svg { display: block; width: 100%; height: auto; cursor: crosshair; touch-action: none; }
.minimap small { display: block; text-align: center; font-size: 10px; color: #58635f; margin-top: 4px; line-height: 1.2; }

.joystick {
  position: absolute; left: max(18px, env(safe-area-inset-left, 0px)); bottom: 18px; width: 124px; height: 124px; z-index: 4;
  border-radius: 50%; background: #ffffff4d; border: 1.5px solid #ffffffcc; box-shadow: 0 4px 18px #00000026;
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); touch-action: none; user-select: none; -webkit-user-select: none;
}
.joystick::after { content: ""; position: absolute; inset: 28%; border-radius: 50%; border: 1px dashed #ffffffb3; pointer-events: none; }
.joystick-knob {
  position: absolute; left: 50%; top: 50%; width: 54px; height: 54px; margin: -27px 0 0 -27px; pointer-events: none;
  border-radius: 50%; background: #1b2425d9; border: 2px solid #fff; box-shadow: 0 2px 8px #0004;
}

@media (max-width: 820px) {
  .joystick { width: 112px; height: 112px; bottom: 14px; }
  .minimap { width: 64px; padding: 4px; }
  .minimap small { display: none; }
  .location-badge { font-size: 12px; }
  .app.is-walking .room-card { display: none; }
}
