/* Sembunyikan UI saat loading */
body.is-loading #mobile-controls,
body.is-loading #floor-controls,
body.is-loading #btn-back,
body.is-loading #btn-fullscreen,
body.is-loading #crosshair {
  display: none !important;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
 
}

canvas {
  display: block;
  width: 100vw !important;
  height: 100vh !important;
  position: fixed;
}

/* ─── LOADING SCREEN ─── */
#loading-screen {
  position: fixed;
  inset: 0;
  background: #111;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  color: white;
  font-family: sans-serif;
}

.loader-box { text-align: center; }

.progress-bar {
  width: 300px;
  height: 6px;
  background: #333;
  border-radius: 4px;
  margin-top: 12px;
  overflow: hidden;
}

#progress {
  height: 100%;
  width: 0%;
  background: #f0a500;
  transition: width 0.2s;
}

/* ─── FADE OVERLAY ─── */
#fade-overlay {
  position: fixed;
  inset: 0;
  background: black;
  opacity: 0;
  transition: opacity 0.5s;
  pointer-events: none;
  z-index: 50;
}

/* ─── TOMBOL LANTAI ─── */
#floor-controls {
  position: fixed;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  gap: 4px;
  z-index: 10;
}

.btn-lantai {
  background: rgba(40, 40, 40, 0.7);
  color: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 6px 14px;
  border-radius: 12px;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
  backdrop-filter: blur(4px);
  transition: all 0.2s;
}

.btn-lantai:hover {
  background: rgba(255, 255, 255, 0.15);
  color: white;
}

.btn-lantai.aktif {
  background: #f0a500 !important;
  border-color: #f0a500 !important;
  color: #111 !important;
  font-weight: bold;
  box-shadow: 0 0 8px rgba(240, 165, 0, 0.6);
  cursor: default;
}

@media (max-width: 768px) {
  .btn-lantai {
    padding: 3px 8px;
    font-size: 11px;
    border-radius: 10px;
  }
}

@media (max-height: 500px) {
  .btn-lantai {
    padding: 3px 8px;
    font-size: 11px;
  }
}

/* ─── PANEL INFO ─── */
#info-panel {
  display: none;
  position: fixed;
  inset: 0;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.5);
  z-index: 20;
  padding: 16px;
}

#panel-konten {
  background: white;
  border-radius: 12px;
  padding: 24px;
  width: 480px;
  max-width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
  font-family: sans-serif;
}

#panel-tutup {
  position: absolute;
  top: 12px;
  right: 12px;
  background: #f0f0f0;
  border: none;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

#panel-tutup:hover { background: #ddd; }

#panel-konten h2 {
  margin: 0 30px 12px 0;
  font-size: clamp(16px, 3vw, 22px);
  color: #222;
}

#panel-konten p {
  margin-bottom: 8px;
  color: #444;
  line-height: 1.6;
  font-size: clamp(13px, 2vw, 15px);
}

#panel-konten hr {
  margin: 12px 0;
  border: none;
  border-top: 1px solid #eee;
}

@media (max-width: 768px) {
  #info-panel {
    align-items: flex-end;
    padding: 0;
  }
  #panel-konten {
    width: 100%;
    max-height: 70vh;
    padding: 16px;
    border-radius: 16px 16px 0 0;
  }
}

/* ─── MARKER OBJEK ─── */
.marker-objek {
  position: fixed;
  transform: translate(-50%, -100%);
  z-index: 15;
  pointer-events: auto;
  cursor: pointer;
  overflow: visible;
}

/* Desktop */
.marker-icon {
  width: 20px;
  height: 20px;
  background: rgba(255, 255, 255, 0.6);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  border: 1px solid rgba(255, 255, 255, 0.8);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  transition: transform 0.2s;
}

.marker-icon img {
  width: 23px;  /* hampir sama dengan parent */
  height: 23px;
  opacity: 0.85;
}
.marker-objek:hover .marker-icon {
  transform: scale(1.2);
}

/* Mobile - lebih kecil & transparan */
@media (hover: none) and (pointer: coarse) {
  .marker-icon {
    width: 18px;
    height: 18px;
    background: rgba(255, 255, 255, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
  }

  .marker-icon img {
    width: 18px;
    height: 18px;
    opacity: 0.75;
  }
}

.marker-card {
  position: absolute;
  bottom: 35px;
  left: 50%;
  transform: translateX(-50%);
  display: none;
  background: rgba(20, 20, 20, 0.92);
  color: white;
  border-radius: 10px;
  padding: 12px 16px;
  width: 220px;
  max-width: 80vw;
  font-family: sans-serif;
  font-size: 13px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(200, 169, 110, 0.4);
  z-index: 30;
}

.marker-card strong {
  font-size: 15px;
  color: #c8a96e;
  display: block;
  margin-bottom: 6px;
}

.marker-card p {
  color: #ccc;
  line-height: 1.5;
  margin-bottom: 10px;
  font-size: 13px;
}

.marker-btn {
  background: #c8a96e;
  color: #111;
  border: none;
  padding: 6px 14px;
  border-radius: 6px;
  font-weight: bold;
  cursor: pointer;
  width: 100%;
}

.marker-btn:hover { background: #e0c080; }

.marker-objek:hover .marker-card { display: block; }

@media (max-width: 768px) {
  .marker-card {
    bottom: auto;
    top: 25px;
    max-width: 70vw;
  }
}

/* ─── TOMBOL NAVIGASI MOBILE ─── */
#mobile-controls {
  display: none;
  position: fixed;
  bottom: 40px;
  left: 50px;
  z-index: 999;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

#btn-row-top {
  display: flex;
  justify-content: center;
  margin-bottom: 4px;
}

#btn-row-mid {
  display: flex;
  gap: 4px;
}

#mobile-controls button {
  width: 48px;
  height: 48px;
  background: rgba(0, 0, 0, 0.5);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 10px;
  font-size: 18px;
  cursor: pointer;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

#mobile-controls button:active {
  background: rgba(255, 255, 255, 0.3);
}

/* Tampil di layar sentuh */
@media (hover: none) and (pointer: coarse) {
  #mobile-controls { display: block; }
}

/* Fallback lebar layar */
@media (max-width: 1024px) {
  #mobile-controls { display: block; }
}

/* ─── PESAN ROTASI ─── */
#rotate-screen {
  display: none;
  position: fixed;
  inset: 0;
  background: #111;
  z-index: 9999;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  color: white;
  font-family: sans-serif;
  text-align: center;
  padding: 20px;
}

#rotate-box { max-width: 280px; }

#rotate-icon {
  font-size: 60px;
  margin-bottom: 20px;
  animation: rotatePhone 1.5s infinite;
}

#rotate-box p {
  font-size: 16px;
  line-height: 1.6;
  color: #ccc;
}

@keyframes rotatePhone {
  0%   { transform: rotate(0deg); }
  50%  { transform: rotate(90deg); }
  100% { transform: rotate(0deg); }
}

@media (max-width: 768px) and (orientation: portrait) {
  #rotate-screen { display: flex; }
}

/* ─── TOMBOL FULLSCREEN ─── */
#btn-fullscreen {
  position: fixed;
  top: 10px;
  right: 10px;
  background: rgba(0, 0, 0, 0.6);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 8px;
  width: 36px;
  height: 36px;
  font-size: 18px;
  cursor: pointer;
  z-index: 10;
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Sembunyikan fullscreen di iOS */
@supports (-webkit-touch-callout: none) {
  #btn-fullscreen { display: none; }
}

/* ─── TOMBOL KEMBALI ─── */
#btn-back {
  position: fixed;
  top: 10px;
  left: 10px;
  background: rgba(0, 0, 0, 0.6);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.3);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  cursor: pointer;
  z-index: 10;
  backdrop-filter: blur(4px);
  transition: background 0.2s;
}

#btn-back:hover { background: rgba(255, 255, 255, 0.2); }