* { box-sizing: border-box; margin: 0; padding: 0; }

#panel-stack {
  position: fixed;
  bottom: 5.5rem;
  left: 1rem;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.5rem;
  z-index: 100;
  pointer-events: none;
  max-height: calc(50vh - 12.5rem);
  overflow-y: auto;
}

#equator-area-toggle {
  position: fixed;
  top: 50%;
  left: 1rem;
  transform: translateY(-50%);
  z-index: 100;
}

#polar-area-toggle {
  position: fixed;
  top: calc(50% + 3.5rem);
  left: 1rem;
  transform: translateY(-50%);
  z-index: 100;
}

body {
  background: #000;
  font-family: system-ui, sans-serif;
  height: 100vh;
  overflow: hidden;
}

#canvas-container {
  width: 100%;
  height: 100%;
  position: relative;
}

#canvas-container canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

/* ── Compass ── */
#compass {
  position: absolute;
  bottom: 24px;
  left: 24px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.25);
  background: rgba(0,0,0,0.55);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  transition: border-color 0.2s;
}

#compass:hover { border-color: rgba(255,255,255,0.6); }

#compass-needle {
  position: absolute;
  width: 3px;
  height: 34px;
  border-radius: 2px;
  background: linear-gradient(to bottom, #ff4444 50%, #888 50%);
  transform-origin: center center;
}

.compass-n {
  position: absolute;
  top: 3px;
  font-size: 9px;
  font-weight: bold;
  color: #ff4444;
  pointer-events: none;
}

.compass-s {
  position: absolute;
  bottom: 3px;
  font-size: 9px;
  color: #666;
  pointer-events: none;
}

/* ── Toggle groups ── */
#toggle-groups {
  position: absolute;
  top: 5.7rem;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
}

.toggle-group {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 18px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.toggle-group-label {
  font-size: 10px;
  color: rgba(255,255,255,0.38);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0 4px;
}

.toggle-group-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.toggle-group-grid .float-toggle:last-child:nth-child(odd) {
  grid-column: 1 / -1;
}

.toggle-group-grid .float-toggle {
  padding: 8px 10px;
  gap: 6px;
}

.float-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(0,0,0,0.55);
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 999px;
  padding: 10px 14px;
  cursor: pointer;
  user-select: none;
  transition: border-color 0.2s;
  color: #8b949e;
  font-size: 15px;
}

.float-toggle:hover { border-color: rgba(255,255,255,0.55); }

.float-toggle.active {
  border-color: rgba(88,166,255,0.6);
  color: #c9d1d9;
}

.toggle-track {
  width: 38px;
  height: 22px;
  background: #30363d;
  border-radius: 11px;
  position: relative;
  transition: background 0.25s;
  flex-shrink: 0;
}

.toggle-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #8b949e;
  transition: transform 0.25s, background 0.25s;
}

.float-toggle.active .toggle-track { background: #58a6ff; }
.float-toggle.active .toggle-thumb {
  transform: translateX(16px);
  background: #fff;
}

.vr-label {
  display: none;
  font-size: 11px;
  color: #c9d1d9;
  white-space: nowrap;
}
body.vr-active .vr-label { display: inline; }
body.vr-active .toggle-group-grid { grid-template-columns: 1fr; }
body.vr-active .toggle-group-grid .float-toggle:last-child:nth-child(odd) { grid-column: auto; }
