/* ================================
   基本設定
================================ */
body {
  margin: 0;
  background: #111;
  overflow: hidden;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

canvas {
  width: 100%;
  height: 100%;
  display: block;
}

#loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: #fff;
  background: rgba(35, 35, 35, 0.48);
  font-size: 16px;
  pointer-events: none;
}

#loading-overlay[hidden] {
  display: none;
}

.loading-indicator {
  width: 22px;
  height: 22px;
  border: 3px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: loading-spin 0.8s linear infinite;
}

@keyframes loading-spin {
  to {
    transform: rotate(360deg);
  }
}

#memory-label-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  width: 176px;
  padding: 10px 14px;
  box-sizing: border-box;
  justify-content: space-between;
  border: 1px solid rgba(235, 245, 245, 0.35);
  border-radius: 6px;
  color: #f4f7f7;
  background: rgba(25, 32, 35, 0.88);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
  transition: background-color 160ms ease, border-color 160ms ease;
}

#memory-label-toggle:hover {
  background: rgba(49, 65, 69, 0.96);
  border-color: rgba(235, 245, 245, 0.65);
}

#memory-label-toggle:focus-visible {
  outline: 2px solid #d7eeee;
  outline-offset: 3px;
}

.memory-label-toggle-state {
  color: #b8d9d6;
  font-size: 12px;
}

#adjustments-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  width: 176px;
  padding: 10px 14px;
  box-sizing: border-box;
  justify-content: space-between;
  border: 1px solid rgba(235, 245, 245, 0.35);
  border-radius: 6px;
  color: #f4f7f7;
  background: rgba(25, 32, 35, 0.88);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
  transition: background-color 160ms ease, border-color 160ms ease;
}

#adjustments-toggle:hover {
  background: rgba(49, 65, 69, 0.96);
  border-color: rgba(235, 245, 245, 0.65);
}

#adjustments-toggle:focus-visible {
  outline: 2px solid #d7eeee;
  outline-offset: 3px;
}

.adjustments-toggle-state {
  color: #b8d9d6;
  font-size: 12px;
}

#utility-panel {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 25;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#utility-panel[hidden] {
  display: none;
}

#utility-drawer-toggle {
  position: fixed;
  top: 50%;
  right: 0;
  z-index: 26;
  width: 28px;
  height: 54px;
  transform: translateY(-50%);
  border: 1px solid rgba(235, 245, 245, 0.4);
  border-right: 0;
  border-radius: 6px 0 0 6px;
  color: #f4f7f7;
  background: rgba(25, 32, 35, 0.9);
  font: inherit;
  font-size: 20px;
  cursor: pointer;
}

#utility-drawer-toggle:hover {
  background: rgba(49, 65, 69, 0.98);
}

#utility-drawer-toggle:focus-visible {
  outline: 2px solid #d7eeee;
  outline-offset: -3px;
}

/* ================================
   ICON + 滑桿區塊（底部中間）
================================ */
#icon-row {
  position: fixed;
  left: 50%;
  bottom: 30px;
  transform: translateX(-50%);
  display: flex;
  gap: 20px;
  z-index: 20;
}

#icon-row[hidden] {
  display: none;
}

.top-icon {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.icon-cube,
.icon-light,
.icon-camera {
  width: 60px;
  height: 60px;
  color: #fff;
  opacity: 0.9;
}

/* ================================
   滑桿底線樣式
================================ */
.top-icon input[type="range"] {
  width: 80px;
  height: 12px;
  appearance: none;
  background: rgba(255,255,255,0.3);
  border-radius: 8px;
}

.top-icon input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 22px;
  height: 22px;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  box-shadow: 0 0 6px rgba(255, 255, 255, 0.6);
}

/* ================================
   左下角 UI（模型切換）
================================ */
#ui-bar {
  position: fixed;
  left: 28px;
  bottom: 28px;
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 10;
}

.model-btn {
  padding: 24px;
  border-radius: 6px;
  background: rgba(255,255,255,0.20);
  border: 3px solid rgba(255,255,255,0.35);
  color: #fff;
  cursor: pointer;
  font-size: 18px;
  transition: 0.2s;
}

.model-btn.active {
  background: rgba(255,255,255,0.35);
  border-color: rgba(255,255,255,0.8);
}

/* ================================
   ✅ 手機版排版（寬度小於 768px）
================================ */
@media (max-width: 768px) {

  /* ✅ 模型切換按鈕移到底部左側 */
  #ui-bar {
    position: absolute;
    bottom: 100px;   /* ✅ 在 icon-row 上方 */
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
  }

  .model-btn {
    padding: 12px 16px;
    font-size: 16px;
  }

  /* ✅ icon + 滑桿區塊固定在最底部 */
  #icon-row {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
  }

  #utility-panel {
    top: 12px;
    right: 36px;
    gap: 8px;
  }

  #memory-label-toggle,
  #adjustments-toggle {
    width: 140px;
    padding: 9px 10px;
    font-size: 13px;
  }

  #utility-drawer-toggle {
    width: 26px;
    height: 50px;
  }

  .icon-cube,
  .icon-light,
  .icon-camera {
    width: 48px;
    height: 48px;
  }
}

  /* ✅ icon + 滑桿區塊移到底部中央 */
  #icon-row {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
  }

  .icon-cube,
  .icon-light,
  .icon-camera {
    width: 48px;
    height: 48px;
  }

 /* ✅ 正確結束 RWD 區塊 */
