:root {
  color-scheme: dark;
  --bg: #11140f;
  --panel: rgba(15, 18, 14, 0.9);
  --panel-border: rgba(245, 226, 176, 0.18);
  --text: #f4f1e8;
  --muted: #b9c4b3;
  --green: #6fb36b;
  --ember: #ff6b2b;
  --amber: #f4b942;
  --ash: #9ba09a;
  --cyan: #78d7dc;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: "Microsoft JhengHei", "Noto Sans TC", "Segoe UI", Arial, sans-serif;
  font-weight: 600;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

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

.control-panel {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 4;
  width: min(360px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  box-sizing: border-box;
  overflow: auto;
  padding: 16px;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.36);
  backdrop-filter: blur(12px);
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.panel-header h1 {
  margin: 0 0 4px;
  font-size: 22px;
  line-height: 1.2;
  letter-spacing: 0;
}

.panel-header span,
.panel-header strong {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  color: var(--cyan);
  font-size: 12px;
  line-height: 1.2;
}

.panel-header strong {
  justify-content: center;
  min-width: 56px;
  padding: 3px 8px;
  border-radius: 4px;
  background: rgba(120, 215, 220, 0.14);
  color: #dffcff;
}

.action-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

button {
  min-height: 38px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: rgba(111, 179, 107, 0.18);
  color: var(--text);
  cursor: pointer;
}

button:hover {
  background: rgba(111, 179, 107, 0.3);
}

#pauseBtn {
  background: rgba(244, 185, 66, 0.16);
}

#pauseBtn:hover {
  background: rgba(244, 185, 66, 0.28);
}

#resetBtn {
  background: rgba(155, 160, 154, 0.16);
}

#resetBtn:hover {
  background: rgba(155, 160, 154, 0.28);
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 16px;
}

.stat {
  min-width: 0;
  padding: 9px 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
}

.stat span {
  display: block;
  color: var(--green);
  font-size: 24px;
  line-height: 1.1;
}

.stat small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
}

.stat.hot span {
  color: var(--ember);
}

.stat.ash span {
  color: var(--ash);
}

.range-control,
.select-control {
  display: grid;
  gap: 8px;
  margin: 13px 0;
}

.range-control span,
.select-control span {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.25;
}

.range-control strong {
  color: var(--text);
  white-space: nowrap;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--ember);
}

select {
  width: 100%;
  min-height: 36px;
  box-sizing: border-box;
  padding: 6px 8px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: rgba(6, 8, 6, 0.84);
  color: var(--text);
}

.toggle-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 14px;
}

.toggle-grid label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  box-sizing: border-box;
  padding: 8px 9px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.055);
  color: #dfe8dc;
  font-size: 13px;
  line-height: 1.2;
}

.toggle-grid input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--ember);
}

.status-line {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.map-caption,
.legend {
  position: absolute;
  z-index: 3;
  border: 1px solid rgba(245, 226, 176, 0.16);
  border-radius: 8px;
  background: rgba(12, 15, 11, 0.76);
  backdrop-filter: blur(10px);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.26);
}

.map-caption {
  left: 16px;
  bottom: 16px;
  max-width: min(600px, calc(100vw - 32px));
  padding: 12px 14px;
}

.map-caption strong {
  display: block;
  margin-bottom: 4px;
  color: #fff6d6;
  font-size: 15px;
  line-height: 1.25;
}

.map-caption span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.legend {
  left: 16px;
  top: 16px;
  display: grid;
  gap: 7px;
  padding: 10px 12px;
  color: #dfe8dc;
  font-size: 12px;
  line-height: 1.3;
}

.legend div {
  display: flex;
  align-items: center;
  gap: 8px;
}

.swatch {
  width: 13px;
  height: 13px;
  border-radius: 3px;
  background: var(--green);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.16) inset;
}

.swatch.flame {
  background: var(--ember);
}

.swatch.ash {
  background: var(--ash);
}

.swatch.smoke {
  background: #9ba6aa;
}

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

@media (max-width: 760px) {
  .control-panel {
    top: 12px;
    right: 12px;
    left: 12px;
    width: auto;
    max-height: 58vh;
  }

  .legend {
    display: none;
  }

  .map-caption {
    left: 12px;
    right: 12px;
    bottom: 12px;
    max-width: none;
  }
}
