* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; width: 100%; overflow: hidden;
  font-family: "Segoe UI", "Microsoft JhengHei", system-ui, sans-serif;
  background: #000; color: #eee;
}

#stage { display: flex; height: 100vh; width: 100vw; }

#cesiumContainer {
  flex: 1;
  height: 100%;
  position: relative;
}

/* Hide default Cesium UI we don't need for cleaner recording */
.cesium-viewer-bottom,
.cesium-viewer-toolbar,
.cesium-viewer-animationContainer,
.cesium-viewer-timelineContainer,
.cesium-viewer-fullscreenContainer { display: none !important; }

/* Right info panel */
#panel {
  width: 340px;
  height: 100%;
  padding: 20px 22px;
  background: linear-gradient(180deg, rgba(15,18,28,0.92), rgba(8,10,18,0.96));
  border-left: 1px solid rgba(255,255,255,0.08);
  overflow-y: auto;
  backdrop-filter: blur(10px);
}

#panel h1 {
  margin: 0 0 18px 0;
  font-size: 18px;
  letter-spacing: 4px;
  color: #7ad7ff;
  font-weight: 700;
}
#panel h1.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  letter-spacing: 2px;
}
#panel h1.brand .brand-icon {
  width: 48px;
  height: 48px;
  border-radius: 11px;
  flex: 0 0 auto;
  box-shadow: 0 2px 10px rgba(122,215,255,0.25);
}
#panel h1.brand span {
  display: inline-block;
  /* GPS 名稱可能很長,允許換行 */
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
  line-height: 1.2;
}

.row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.row .label { font-size: 12px; color: #9aa4b2; letter-spacing: 1px; }
.row .value { font-size: 22px; font-weight: 600; color: #fff; font-variant-numeric: tabular-nums; }
.row.coords .value { font-size: 13px; font-weight: 500; color: #b9d4ff; letter-spacing: 0.5px; }

.hr-block {
  margin-top: 20px;
  padding: 18px;
  background: linear-gradient(135deg, rgba(229,57,86,0.14), rgba(229,57,86,0.04));
  border: 1px solid rgba(229,57,86,0.35);
  border-radius: 12px;
  text-align: center;
}
.hr-label { color: #ff738b; font-size: 12px; letter-spacing: 3px; }
.hr-big {
  font-size: 64px; font-weight: 800; color: #ff4d6d;
  line-height: 1; margin: 6px 0 0 0;
  font-variant-numeric: tabular-nums;
}
.hr-unit { font-size: 12px; color: #ff738b; letter-spacing: 2px; margin-bottom: 10px; }
#hrChart { width: 100%; height: 80px; display: block; }

.timeline-block {
  margin-top: 18px;
  padding: 10px 12px;
  background: linear-gradient(135deg, rgba(122,215,255,0.08), rgba(122,215,255,0.02));
  border: 1px solid rgba(122,215,255,0.25);
  border-radius: 8px;
}
.timeline-row {
  display: flex; align-items: center; gap: 8px;
}
.timeline-row .tl-label {
  font-size: 10px; color: #9aa4b2; flex: 0 0 auto;
}
.timeline-row input[type="range"] {
  flex: 1;
  -webkit-appearance: none;
  height: 6px; border-radius: 3px;
  background: linear-gradient(to right, #7ad7ff, #ff4d6d);
  outline: none;
}
.timeline-row input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px; height: 16px;
  background: #fff;
  border: 3px solid #7ad7ff;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,0.35);
}
.timeline-row input[type="range"]::-moz-range-thumb {
  width: 16px; height: 16px;
  background: #fff;
  border: 3px solid #7ad7ff;
  border-radius: 50%;
  cursor: pointer;
}
.timeline-info {
  display: flex; justify-content: space-between;
  margin-top: 6px;
  font-size: 11px; color: #b9d4ff;
  font-variant-numeric: tabular-nums;
}

.controls {
  margin-top: 22px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.controls button {
  background: #1f6feb;
  color: white;
  border: none;
  padding: 8px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
}
.controls button:hover { background: #388bfd; }
#btn-music {
  background: #2a3a55;
  padding: 6px 10px !important;
  font-size: 14px;
}
#btn-music.muted {
  background: #3a3a3a;
  opacity: 0.6;
}
#btn-music.muted::after { content: " 🔇"; }
.controls label {
  font-size: 12px;
  color: #9aa4b2;
  display: flex;
  align-items: center;
  gap: 4px;
}
.controls select {
  background: #0d1117; color: #eee;
  border: 1px solid #30363d;
  padding: 4px 6px; border-radius: 4px;
}
.controls input[type="file"] {
  font-size: 11px; color: #9aa4b2;
  width: 100%; margin-top: 2px;
}
.controls .file-row {
  display: flex; flex-direction: column;
  width: 100%; gap: 2px;
  font-size: 11px; color: #9aa4b2;
  margin-top: 6px;
}
.controls .file-row span { color: #b9d4ff; font-weight: 500; }

.settings-block {
  margin-top: 14px;
  padding: 8px 10px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 6px;
  width: 100%;
}
.settings-block summary {
  font-size: 12px; color: #b9d4ff; cursor: pointer;
  user-select: none; padding: 2px 0;
  font-weight: 500;
}
.setting-row {
  display: flex; align-items: center; gap: 8px;
  margin-top: 6px; font-size: 11px; color: #9aa4b2;
}
.setting-row > span:first-child {
  flex: 0 0 70px; color: #b9d4ff;
}
.setting-row input[type="range"] { flex: 1; }
.setting-row input[type="number"] {
  flex: 0 0 50px;
  background: #0d1117; color: #eee;
  border: 1px solid #30363d; border-radius: 4px;
  padding: 2px 4px; font-size: 11px;
}
.setting-row .set-val {
  flex: 0 0 38px; text-align: right; color: #fff;
  font-variant-numeric: tabular-nums;
}

/* 鏡頭預設 */
.preset-block {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(255,255,255,0.08);
}
.preset-title {
  font-size: 10px; color: #b9d4ff;
  margin-bottom: 6px;
  letter-spacing: 0.3px;
}
.preset-row {
  display: flex; align-items: center; gap: 5px;
  margin-top: 4px;
  font-size: 11px;
}
.preset-row .preset-name {
  flex: 0 0 18px;
  font-weight: 700; color: #ffaa00;
  font-size: 13px; text-align: center;
}
.preset-row button {
  background: #1f6feb;
  color: white; border: none;
  padding: 3px 8px; border-radius: 4px;
  cursor: pointer; font-size: 11px;
}
.preset-row button.preset-save  { background: #3a3a55; }
.preset-row button.preset-save:hover  { background: #4d4d70; }
.preset-row button.preset-recall { background: #1f6feb; }
.preset-row button.preset-recall:hover { background: #388bfd; }
.preset-row button:disabled {
  background: #2a2a35 !important; color: #666;
  cursor: not-allowed;
}
.preset-row .preset-info {
  flex: 1;
  font-size: 10px; color: #9aa4b2;
  font-variant-numeric: tabular-nums;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.preset-row .preset-info.set { color: #b9d4ff; }

.preset-mini-btn {
  background: #2a3a55;
  color: #b9d4ff;
  border: 1px solid #3a4a6f;
  padding: 3px 8px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 10px;
  white-space: nowrap;
}
.preset-mini-btn:hover { background: #3a4a6f; }

/* API 用量區 */
.api-block {
  border-color: rgba(34,197,94,0.3) !important;
  background: linear-gradient(135deg, rgba(34,197,94,0.08), rgba(34,197,94,0.02)) !important;
}
.api-row {
  display: flex; justify-content: space-between;
  padding: 4px 0;
  font-size: 11px; color: #9aa4b2;
}
.api-row .api-val {
  color: #fff; font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.api-mini-btn {
  display: block;
  margin-top: 8px;
  background: #1f6feb;
  color: #fff !important; text-decoration: none;
  border: none; padding: 8px 12px;
  border-radius: 6px; font-size: 12px;
  text-align: center; cursor: pointer;
  font-weight: 500;
}
.api-mini-btn:hover { background: #388bfd; }
.api-bill-link {
  background: linear-gradient(135deg, #22c55e, #16a34a) !important;
}
.api-bill-link:hover {
  background: linear-gradient(135deg, #16a34a, #15803d) !important;
}
.api-note {
  margin-top: 8px;
  font-size: 10px; color: #9aa4b2;
  line-height: 1.4;
}

.record-btn {
  width: 100%; margin-top: 12px;
  background: linear-gradient(135deg, #ef4444, #dc2626) !important;
  font-size: 14px !important; padding: 10px !important;
  border-radius: 8px !important;
  box-shadow: 0 4px 12px rgba(239,68,68,0.3);
}
.record-btn.recording {
  background: linear-gradient(135deg, #6b7280, #4b5563) !important;
  animation: rec-pulse 1.5s infinite;
}
@keyframes rec-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239,68,68,0.55); }
  50%      { box-shadow: 0 0 0 10px rgba(239,68,68,0); }
}
.rec-status {
  display: flex; align-items: center; gap: 8px;
  margin-top: 6px; font-size: 12px; color: #fca5a5;
  font-variant-numeric: tabular-nums;
}
.rec-status.hidden { display: none; }
.rec-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: #ef4444;
  animation: rec-blink 1s infinite;
}
@keyframes rec-blink {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.3; }
}
.rec-codec { opacity: 0.6; font-size: 10px; }

.tip {
  margin-top: 20px;
  padding: 10px 12px;
  background: rgba(122,215,255,0.08);
  border-left: 3px solid #7ad7ff;
  font-size: 11px;
  color: #b5d4e8;
  line-height: 1.5;
  border-radius: 0 6px 6px 0;
}

/* 照片現在用 Cesium 3D Billboard 直接畫在 WebGL 場景中 */

/* HUD 2D canvas — 完全覆蓋在 Cesium WebGL canvas 上方,但不擋滑鼠互動 */
#hud-canvas {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 6;
}
