:root {
  color-scheme: dark;
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  background: #111511;
  color: #f5f2e9;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  overflow: hidden;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
}

#app {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  grid-template-rows: 78px minmax(0, 1fr) 184px;
  min-height: 100vh;
  background: #141914;
}

.topbar {
  grid-column: 1 / 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 22px;
  background: #f4efe2;
  color: #182018;
  border-bottom: 1px solid rgba(23, 31, 23, 0.16);
}

.topbar p,
.rail-head p {
  margin: 0 0 4px;
  color: #6d745e;
  font-size: 12px;
  text-transform: uppercase;
}

.topbar h1 {
  margin: 0;
  font-size: 25px;
  line-height: 1.1;
  letter-spacing: 0;
}

.top-actions,
.video-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.top-actions button {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: #1f2b22;
  color: #f6f0de;
  cursor: pointer;
  font-size: 19px;
}

.top-actions button.active,
.video-actions button.active {
  background: #d9472b;
  color: white;
}

.map-shell {
  position: relative;
  min-width: 0;
  min-height: 0;
}

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

.mission-card {
  position: absolute;
  left: 20px;
  top: 20px;
  display: grid;
  gap: 6px;
  width: min(430px, calc(100% - 40px));
  padding: 14px 16px;
  border-left: 4px solid #d9472b;
  background: rgba(244, 239, 226, 0.92);
  color: #182018;
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.25);
  pointer-events: none;
}

.mission-card span {
  color: #676e5c;
  font-size: 13px;
}

.mission-card strong {
  font-size: 18px;
  line-height: 1.3;
}

.hud {
  position: absolute;
  left: 20px;
  right: 20px;
  bottom: 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  pointer-events: none;
}

.hud span {
  padding: 8px 10px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: rgba(19, 24, 19, 0.78);
  color: #f5f2e9;
  font-size: 12px;
}

.right-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px;
  overflow-y: auto;
  background: #20261f;
  border-left: 1px solid rgba(244, 239, 226, 0.12);
}

.video-panel,
.control-grid,
.switches,
.input-stack,
.right-panel > section:not(.video-panel):not(.control-grid):not(.switches):not(.input-stack) {
  border: 1px solid rgba(244, 239, 226, 0.12);
  border-radius: 8px;
  background: rgba(244, 239, 226, 0.06);
}

.video-panel {
  overflow: hidden;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px;
}

.panel-heading span,
.section-title,
.asset-status {
  color: #b7b19c;
  font-size: 12px;
}

.panel-heading strong {
  max-width: 230px;
  overflow: hidden;
  color: #f5f2e9;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

video {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #070807;
  object-fit: cover;
}

.video-actions {
  padding: 10px;
}

.video-actions button,
#applyLiveBtn {
  min-height: 36px;
  padding: 0 12px;
  border-radius: 8px;
  background: #e6dbbd;
  color: #172018;
  cursor: pointer;
}

.control-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 12px;
}

.control {
  display: grid;
  gap: 8px;
}

.control label,
.switches label,
.input-stack label {
  color: #eee7d4;
  font-size: 13px;
}

input[type="range"] {
  width: 100%;
  accent-color: #d9472b;
}

.switches {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 12px;
}

.switches label {
  display: flex;
  align-items: center;
  gap: 8px;
}

.input-stack {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.input-stack label {
  display: grid;
  gap: 6px;
}

.input-stack input {
  width: 100%;
  height: 36px;
  padding: 0 10px;
  border: 1px solid rgba(244, 239, 226, 0.18);
  border-radius: 8px;
  background: #111711;
  color: #f5f2e9;
}

.video-list {
  display: grid;
  gap: 8px;
  max-height: 240px;
  overflow: auto;
  padding: 12px;
}

.video-item {
  display: grid;
  gap: 4px;
  padding: 10px;
  border-radius: 8px;
  background: rgba(244, 239, 226, 0.07);
  color: #f5f2e9;
  cursor: pointer;
}

.video-item span:last-child {
  color: #b7b19c;
  font-size: 12px;
}

.asset-rail {
  grid-column: 1 / 3;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 14px;
  padding: 14px 16px;
  background: #f4efe2;
  color: #182018;
  border-top: 1px solid rgba(23, 31, 23, 0.16);
}

.rail-head {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
}

.rail-head strong {
  display: block;
  font-size: 18px;
  line-height: 1.25;
}

.rail-head span {
  color: #626a59;
  font-size: 13px;
  line-height: 1.35;
}

.asset-list {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(230px, 300px);
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.asset-button {
  min-height: 130px;
  padding: 13px;
  border: 1px solid rgba(24, 32, 24, 0.14);
  border-radius: 8px;
  background: white;
  color: #182018;
  text-align: left;
  cursor: pointer;
}

.asset-button:hover,
.asset-button.active {
  border-color: #d9472b;
  box-shadow: 0 10px 24px rgba(111, 58, 36, 0.16);
}

.asset-button:disabled {
  cursor: not-allowed;
  opacity: 0.68;
}

.asset-name {
  display: block;
  min-height: 38px;
  font-weight: 700;
  line-height: 1.35;
}

.asset-meta {
  display: block;
  margin-top: 8px;
  color: #646b5d;
  font-size: 12px;
  line-height: 1.45;
}

.asset-status {
  display: inline-flex;
  margin-top: 10px;
  padding: 4px 8px;
  border-radius: 999px;
  background: #edf0df;
  color: #394137;
}

.asset-status.ready {
  background: #dff1d9;
  color: #23502e;
}

.asset-status.archive {
  background: #f0dfcd;
  color: #74401f;
}

.cesium-viewer-bottom,
.cesium-viewer-animationContainer,
.cesium-viewer-timelineContainer,
.cesium-viewer-fullscreenContainer {
  display: none !important;
}

@media (max-width: 980px) {
  body {
    overflow: auto;
  }

  #app {
    grid-template-columns: 1fr;
    grid-template-rows: auto 70vh auto auto;
  }

  .topbar,
  .asset-rail {
    grid-column: 1;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .right-panel {
    border-left: 0;
  }

  .asset-rail {
    grid-template-columns: 1fr;
  }

  .asset-list {
    grid-auto-columns: minmax(220px, 85vw);
  }
}
