/* 修改背景为深色渐变 */
body {
  margin: 0;
  overflow: hidden;
  background: radial-gradient(circle at center, #0f2027 0%, #203a43 50%, #2c5364 100%);
  background-color: #050d1a;
  font-family: "Times New Roman", serif;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
#canvas-container {
  width: 100vw;
  height: 100vh;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
  cursor: grab;
}
#canvas-container:active {
  cursor: grabbing;
}

/* UI Overlay */
#ui-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 40px;
  box-sizing: border-box;
  transition: opacity 0.5s ease;
}

.ui-hidden {
  opacity: 0 !important;
  pointer-events: none !important;
}

/* Loading */
#loader {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #050d1a;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: opacity 0.8s ease-out;
}
.loader-text {
  color: #d4af37;
  font-size: 14px;
  letter-spacing: 4px;
  margin-top: 20px;
  text-transform: uppercase;
  font-weight: 100;
}
.spinner {
  width: 40px;
  height: 40px;
  border: 1px solid rgba(212, 175, 55, 0.2);
  border-top: 1px solid #d4af37;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Typography */
h1 {
  color: #fceea7;
  font-size: 8vw;
  max-size: 56px;
  margin: 0;
  font-weight: 400;
  letter-spacing: 6px;
  text-shadow: 0 0 50px rgba(252, 238, 167, 0.6);
  background: linear-gradient(to bottom, #fff, #eebb66);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  font-family: "Cinzel", "Times New Roman", serif;
  opacity: 0.9;
  transition: opacity 0.5s ease;
  text-align: center;
  pointer-events: none;
}
@media (min-width: 768px) {
  h1 {
    font-size: 56px;
  }
}

/* Controls */
.controls-wrapper {
  position: absolute;
  top: 100px;
  right: 20px;
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  z-index: 20;
  transition: opacity 0.5s ease;
}

.btn-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-end;
}

.control-btn {
  background: rgba(20, 20, 20, 0.6);
  border: 1px solid rgba(212, 175, 55, 0.4);
  color: #d4af37;
  padding: 10px 20px;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 2px;
  font-size: 10px;
  transition: all 0.4s;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(5px);
  min-width: 50px;
}

/* 平板及以上 */
@media (min-width: 768px) {
  .control-btn {
    min-width: 120px;
  }
}

.control-btn.active {
  background: rgba(212, 175, 55, 0.8);
  color: #000;
  box-shadow: 0 0 15px rgba(212, 175, 55, 0.6);
}
.control-btn:hover {
  background: #d4af37;
  color: #000;
  box-shadow: 0 0 20px rgba(212, 175, 55, 0.5);
}

.hint-text {
  color: rgba(212, 175, 55, 0.5);
  font-size: 9px;
  letter-spacing: 1px;
  text-transform: uppercase;
  text-align: right;
  margin-top: 5px;
  max-width: 200px;
}

input[type="file"] {
  display: none;
}

/* Mode Buttons (Bottom) */
#mode-bar {
  position: absolute;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 15px;
  z-index: 20;
  pointer-events: auto;
}
.mode-btn {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid #d4af37;
  color: #d4af37;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s;
  backdrop-filter: blur(4px);
}
.mode-btn:active {
  transform: scale(0.9);
  background: #d4af37;
  color: #000;
}

/* Webcam feedback */
#webcam-wrapper {
  position: absolute;
  /* bottom: 100px; */
  top: 40px;
  left: 20px;
  width: 60px;
  height: 45px;
  border: 1px solid rgba(212, 175, 55, 0.5);
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.9);
  border-radius: 4px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  z-index: 50;
  background: #000;
  transition: opacity 0.5s ease;
}

/* 平板及以上 */
@media (min-width: 768px) {
  #webcam-wrapper {
    width: 120px;
    height: 90px;
  }
}

#webcam {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
}

#debug-info {
  position: absolute;
  bottom: 5px;
  left: 5px;
  color: rgba(212, 175, 55, 0.6);
  font-size: 10px;
  font-family: monospace;
  pointer-events: none;
  z-index: 51;
  width: 100%;
  text-align: center;
}

#msg-box {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.9);
  border: 1px solid #d4af37;
  padding: 20px;
  color: #d4af37;
  z-index: 200;
  text-align: center;
  display: none;
  border-radius: 8px;
  min-width: 200px;
}

/* -------------------------------------------
           【全新升级】Luxury Stats Dashboard 样式
           ------------------------------------------- */
#footer-stats {
  position: absolute;
  bottom: 25px;
  right: 25px;
  z-index: 40;
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  /* 整体磨砂玻璃面板效果 */
  background: rgba(8, 15, 25, 0.75);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 15px;
  border-radius: 12px;
  border: 1px solid rgba(212, 175, 55, 0.25);
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.5);
  width: 200px; /* 固定宽度，确保整齐 */
  transition: all 0.3s ease;

  /* 【修改】确保动画过渡自然 */
  opacity: 1;
  transform: translateY(0);
}

/* 专门优化地图容器 */
.map-container {
  width: 100%;
  height: 100px; /* 控制高度 */
  overflow: hidden;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  position: relative;
  background: #000; /* 地图加载前的背景 */
}

.map-container script,
.map-container iframe,
.map-container img {
  filter: opacity(0.9) contrast(1.1);
  transition: filter 0.3s;
}
.map-container:hover script,
.map-container:hover iframe {
  filter: opacity(1) contrast(1);
}

.stats-title {
  font-family: "Cinzel", serif;
  color: rgba(212, 175, 55, 0.9);
  font-size: 10px;
  letter-spacing: 2px;
  text-align: center;
  margin-bottom: 5px;
  border-bottom: 1px solid rgba(212, 175, 55, 0.15);
  padding-bottom: 5px;
}

.stats-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: #ccc;
}

.stats-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.stats-value {
  font-family: "Cinzel", serif; /* 使用高级衬线体 */
  color: #fff;
  font-weight: bold;
  font-size: 14px;
  text-shadow: 0 0 5px rgba(255, 255, 255, 0.3);
}
