* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  position: fixed;
  top: 0;
  left: 0;
}

body {
  background: #111;
  -webkit-tap-highlight-color: transparent; /* ✅ removes blue highlight on tap */
  user-select: none; /* ✅ prevents text selection */
  touch-action: none; /* ✅ disables built-in panning/zoom gestures */
}

#canvas-container {
  width: 100vw;
  height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  overflow: hidden;
}

#canvas-container canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

#info {
  position: fixed;
  top: 10px;
  left: 10px;
  color: white;
  font-family: sans-serif;
  background: rgba(0, 0, 0, 0.5);
  padding: 8px 12px;
  border-radius: 4px;
  z-index: 5;
  font-size: 14px;
  max-width: calc(100vw - 20px);
  word-wrap: break-word;
}

@media (max-width: 768px) {
  #info {
    font-size: 12px;
    padding: 6px 10px;
    top: 8px;
    left: 8px;
  }
}

/* === Bottom sheet popup styles === */
#bottom-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  background: rgba(25, 25, 25, 0.95);
  color: white;
  padding: 24px 20px;
  padding-bottom: max(24px, env(safe-area-inset-bottom));
  border-top-left-radius: 20px;
  border-top-right-radius: 20px;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.4);
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 100;
  max-height: 60vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  pointer-events: auto;
}

#bottom-sheet.show {
  transform: translateY(0);
}

#bottom-sheet h2 {
  margin: 0 0 12px;
  margin-right: 40px;
  color: #ff6b00;
  font-size: 1.5em;
  font-weight: 600;
}

#bottom-sheet p {
  margin: 0;
  font-size: 1em;
  color: #ddd;
  line-height: 1.5;
}

@media (max-width: 768px) {
  #bottom-sheet {
    padding: 20px 16px;
    padding-bottom: max(20px, env(safe-area-inset-bottom));
    max-height: 70vh;
    border-top-left-radius: 16px;
    border-top-right-radius: 16px;
  }

  #bottom-sheet h2 {
    font-size: 1.3em;
    margin-bottom: 10px;
  }

  #bottom-sheet p {
    font-size: 0.95em;
  }
}

#close-btn {
  position: absolute;
  right: 20px;
  top: 20px;
  background: none;
  border: none;
  color: white;
  font-size: 1.8em;
  cursor: pointer;
  transition: color 0.2s, background 0.2s;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  pointer-events: auto;
  z-index: 101;
}

#close-btn:hover,
#close-btn:active {
  color: #ff6b00;
  background: rgba(255, 107, 0, 0.1);
}

@media (max-width: 768px) {
  #close-btn {
    right: 16px;
    top: 16px;
    width: 40px;
    height: 40px;
    font-size: 2em;
  }
}

/* === Floor Selector UI === */
#floor-selector {
  position: fixed;
  top: 10px;
  right: 10px;
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: rgba(0, 0, 0, 0.7);
  padding: 12px;
  border-radius: 8px;
  backdrop-filter: blur(10px);
}

.floor-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(255, 255, 255, 0.2);
  color: white;
  padding: 10px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-family: sans-serif;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  min-width: 100px;
  text-align: center;
}

.floor-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.4);
}

.floor-btn.active {
  background: #ff6b00;
  border-color: #ff6b00;
  color: white;
  box-shadow: 0 2px 8px rgba(255, 107, 0, 0.4);
}

.floor-btn:active {
  transform: scale(0.95);
}

@media (max-width: 768px) {
  #floor-selector {
    top: 8px;
    right: 8px;
    padding: 8px;
    gap: 6px;
  }

  .floor-btn {
    padding: 8px 12px;
    font-size: 12px;
    min-width: 80px;
  }
}

/* Adjust info position when floor selector is present */
#info {
  max-width: calc(100vw - 140px);
}

@media (max-width: 768px) {
  #info {
    max-width: calc(100vw - 100px);
  }
}

/* === Toast Notification === */
.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: rgba(255, 68, 68, 0.95);
  color: white;
  padding: 12px 24px;
  border-radius: 8px;
  font-family: sans-serif;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 4px 12px rgba(255, 68, 68, 0.3);
  z-index: 1000;
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
  text-align: center;
  max-width: 90vw;
  word-wrap: break-word;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}
