/* Cesium 效果精选画廊（体渲染等场景） */
:root {
  --bg: #0a0e17;
  --panel: #121826;
  --panel-2: #1a2130;
  --line: #243044;
  --text: #e6ecf5;
  --muted: #8a99b3;
  --accent: #35d0ba;
  --accent-2: #4f8cff;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
}

#app {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

#sidebar {
  width: 320px;
  flex: 0 0 320px;
  background: var(--panel);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
}

.sidebar-header {
  padding: 18px 16px 12px;
  border-bottom: 1px solid var(--line);
}

.sidebar-back {
  display: inline-block;
  margin-bottom: 10px;
  color: var(--accent);
  text-decoration: none;
  font-size: 13px;
}

.sidebar-back:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 2px;
}

.sidebar-header h1 {
  margin: 0;
  font-size: 18px;
  letter-spacing: 0.5px;
}

.tagline {
  margin: 4px 0 12px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

#search {
  width: 100%;
  padding: 9px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  outline: none;
  font-size: 13px;
}

#search:focus {
  border-color: var(--accent-2);
}

#demo-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.cat-group {
  margin-bottom: 6px;
}

.cat-title {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 8px 6px;
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.06em;
}

.cat-title .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}

.demo-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid transparent;
  margin-bottom: 4px;
  transition: background 0.12s ease, border-color 0.12s ease;
  background: transparent;
  color: inherit;
  font: inherit;
}

.demo-item:hover {
  background: var(--panel-2);
}

.demo-item.active {
  background: linear-gradient(90deg, rgba(53, 208, 186, 0.16), transparent);
  border-color: var(--accent);
}

.demo-item .di-title {
  font-size: 14px;
  font-weight: 600;
}

.demo-item .di-desc {
  font-size: 12px;
  color: var(--muted);
  margin-top: 3px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.demo-item .di-id {
  font-size: 10px;
  color: var(--muted);
  opacity: 0.6;
}

.sidebar-footer {
  padding: 10px 16px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
}

#demo-count {
  color: var(--accent);
  font-weight: 700;
}

#stage {
  position: relative;
  flex: 1;
  min-width: 0;
}

#cesiumContainer {
  position: absolute;
  inset: 0;
}

#info-panel {
  position: absolute;
  left: 16px;
  bottom: 16px;
  max-width: 420px;
  background: rgba(18, 24, 38, 0.86);
  backdrop-filter: blur(10px);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
  z-index: 3;
}

.info-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

#info-title {
  margin: 0;
  font-size: 16px;
}

#info-desc {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.badge {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(79, 140, 255, 0.18);
  color: var(--accent-2);
  border: 1px solid rgba(79, 140, 255, 0.35);
  white-space: nowrap;
}

#info-toggle {
  position: absolute;
  top: 10px;
  right: 12px;
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
}

#info-panel.collapsed #info-desc {
  display: none;
}

#loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: center;
  justify-content: center;
  background: rgba(10, 14, 23, 0.6);
  z-index: 5;
  color: var(--muted);
  font-size: 13px;
}

#loading[hidden] {
  display: none !important;
}

.spinner {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 3px solid var(--line);
  border-top-color: var(--accent);
  animation: spin 1s linear infinite;
}

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

.demo-controls {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 4;
  background: rgba(18, 24, 38, 0.86);
  backdrop-filter: blur(10px);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  min-width: 200px;
  max-width: min(360px, calc(100vw - 48px));
  font-size: 13px;
}

.demo-controls-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.demo-controls h3 {
  margin: 0;
  font-size: 13px;
  color: var(--accent);
  flex: 1;
  min-width: 0;
  line-height: 1.3;
}

.demo-controls-toggle {
  flex: 0 0 auto;
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 3px 8px;
  cursor: pointer;
  font-size: 11px;
  line-height: 1.4;
}

.demo-controls-toggle:hover {
  color: var(--text);
  border-color: var(--accent);
}

.demo-controls-body {
  margin-top: 10px;
  max-height: min(48vh, 420px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 2px;
}

.demo-controls.collapsed {
  min-width: 0;
  max-width: 280px;
}

.demo-controls.collapsed .demo-controls-body {
  display: none;
  margin-top: 0;
}

.demo-controls label {
  display: block;
  margin: 8px 0 4px;
  color: var(--muted);
  font-size: 12px;
}

.demo-controls input[type="range"] {
  width: 100%;
}

.demo-controls .row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 6px 0;
}

.demo-controls button {
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 10px;
  cursor: pointer;
  font-size: 12px;
}

.demo-controls button:hover {
  border-color: var(--accent);
}

@media (max-width: 720px) {
  #app {
    flex-direction: column;
  }

  #sidebar {
    width: 100%;
    flex: 0 0 auto;
    max-height: 42vh;
  }

  #stage {
    flex: 1;
    min-height: 0;
  }
}