/* ===== 基础与变量 ===== */
:root {
  --bg-0: #0A0E1A;
  --bg-1: #0D1117;
  --bg-2: #111827;
  --primary: #00E5FF;
  --primary-dim: #0288D1;
  --text: #E0E0E0;
  --text-dim: #9CA3AF;
  --ok: #00C853;
  --err: #FF1744;
  --warn: #FFC107;
  --font-mono: "Roboto Mono", "JetBrains Mono", "Consolas", monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: radial-gradient(circle at 50% 30%, #131c2e 0%, var(--bg-0) 70%);
  color: var(--text);
  font-family: var(--font-mono);
}

#scene {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

/* ===== 玻璃拟态面板通用 ===== */
.panel.glass {
  position: fixed;
  background: rgba(17, 24, 39, 0.55);
  backdrop-filter: blur(12px) saturate(140%);
  -webkit-backdrop-filter: blur(12px) saturate(140%);
  border: 1px solid rgba(0, 229, 255, 0.18);
  border-radius: 12px;
  padding: 14px 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255,255,255,0.04);
  z-index: 10;
  min-width: 168px;
}

.panel-title {
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--primary);
  text-transform: uppercase;
  margin-bottom: 10px;
  font-weight: 600;
  border-bottom: 1px solid rgba(0, 229, 255, 0.12);
  padding-bottom: 6px;
}

/* ===== 顶部状态栏 ===== */
#topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  background: linear-gradient(to bottom, rgba(10,14,26,0.85), rgba(10,14,26,0));
  z-index: 20;
  font-size: 12px;
}
#topbar .title {
  letter-spacing: 3px;
  color: var(--primary);
  font-weight: 600;
  font-size: 13px;
}
.status { display: flex; align-items: center; gap: 8px; color: var(--text-dim); }
.server-addr { color: var(--text-dim); }

.dot {
  width: 9px; height: 9px; border-radius: 50%;
  display: inline-block;
}
.dot.connected {
  background: var(--ok);
  box-shadow: 0 0 8px var(--ok);
  animation: pulse 1.6s infinite;
}
.dot.disconnected {
  background: var(--err);
  box-shadow: 0 0 6px var(--err);
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(0,200,83,0.6); }
  70% { box-shadow: 0 0 0 8px rgba(0,200,83,0); }
  100% { box-shadow: 0 0 0 0 rgba(0,200,83,0); }
}

/* ===== 数值行 ===== */
.att-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 4px 0;
  font-size: 13px;
  color: var(--text-dim);
}
.att-row .val {
  color: var(--text);
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  transition: color 0.3s, text-shadow 0.3s;
}
.att-row .val.flash {
  color: var(--primary);
  text-shadow: 0 0 6px rgba(0,229,255,0.6);
}
.axis.roll { color: #FF5252; }
.axis.pitch { color: #FFC107; }
.axis.yaw { color: #00E5FF; }

/* ===== 控制面板 ===== */
#controls { top: 56px; right: 18px; }
.ctrl-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 6px 0;
  font-size: 12px;
  color: var(--text-dim);
}
.seg { display: flex; gap: 4px; }
.seg-btn {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(0,229,255,0.2);
  color: var(--text-dim);
  padding: 3px 8px;
  border-radius: 6px;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 11px;
  transition: all 0.2s;
}
.seg-btn:hover { color: var(--primary); border-color: var(--primary); }
.seg-btn.active {
  background: rgba(0,229,255,0.15);
  color: var(--primary);
  border-color: var(--primary);
}
.btn {
  width: 100%;
  margin-top: 8px;
  background: rgba(0,229,255,0.1);
  border: 1px solid rgba(0,229,255,0.3);
  color: var(--primary);
  padding: 6px;
  border-radius: 6px;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 12px;
  transition: all 0.2s;
}
.btn:hover { background: rgba(0,229,255,0.2); }

input[type="checkbox"] {
  width: 36px; height: 18px;
  appearance: none;
  background: rgba(255,255,255,0.1);
  border-radius: 10px;
  position: relative;
  cursor: pointer;
  transition: background 0.2s;
}
input[type="checkbox"]::after {
  content: "";
  position: absolute;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--text-dim);
  top: 2px; left: 2px;
  transition: all 0.2s;
}
input[type="checkbox"]:checked { background: rgba(0,229,255,0.3); }
input[type="checkbox"]:checked::after { left: 20px; background: var(--primary); }

/* ===== 面板定位 ===== */
#attitude-panel { bottom: 18px; left: 18px; }
#info-panel { bottom: 18px; right: 18px; }

/* ===== 响应式 ===== */
@media (max-width: 640px) {
  #controls { right: 10px; top: 50px; min-width: 140px; }
  #attitude-panel, #info-panel { min-width: 130px; padding: 10px 12px; }
  #topbar .title { display: none; }
}
