:root {
  --bg: #0d1117;
  --panel: #161b22;
  --panel-2: #1b2733;
  --border: #2b3542;
  --text: #d6e2ef;
  --muted: #8593a3;
  --accent: #4f9dde;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  display: grid;
  grid-template-rows: auto 1fr auto;
  height: 100vh;
  overflow: hidden;
}

header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
}
header h1 { font-size: 15px; margin: 0; font-weight: 600; }
header .sub { color: var(--muted); font-size: 12px; }

.tabs { display: flex; gap: 4px; margin-left: auto; }
.tab {
  background: transparent; color: var(--muted);
  border: 1px solid var(--border); border-radius: 6px;
  padding: 5px 12px; cursor: pointer; font-size: 13px;
}
.tab.active { color: var(--text); background: var(--panel-2); border-color: var(--accent); }

main { position: relative; overflow: hidden; }

/* Layer / metadata sidebar */
.sidebar {
  position: absolute; top: 12px; left: 12px; z-index: 10;
  width: 300px; max-width: calc(100% - 24px);
  max-height: calc(100% - 24px); overflow-y: auto;
  background: rgba(22, 27, 34, 0.94);
  border: 1px solid var(--border); border-radius: 10px;
  backdrop-filter: blur(3px);
}
.sidebar section { padding: 12px 14px; border-bottom: 1px solid var(--border); }
.sidebar section:last-child { border-bottom: none; }
.sidebar h2 { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 0 0 8px; }

.layer-row { display: flex; align-items: center; gap: 8px; padding: 4px 0; cursor: pointer; }
.layer-row input { accent-color: var(--accent); }
.swatch { width: 12px; height: 12px; border-radius: 3px; flex: none; }
.layer-label { flex: 1; }
.layer-status { font-size: 11px; color: var(--muted); }
.layer-status[data-status="on"] { color: var(--accent); }
.layer-status[data-status="missing"] { color: #d98c4a; }
.layer-note { margin: 0 0 4px 20px; font-size: 11px; color: var(--muted); }

.meta-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.meta-table th { text-align: left; color: var(--muted); font-weight: 500; padding: 2px 8px 2px 0; white-space: nowrap; vertical-align: top; }
.meta-table td { padding: 2px 0; word-break: break-word; color: var(--text); }
/* Group header rows within the attribute table. */
.meta-table tr.meta-group th {
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: .04em;
  font-size: 10px;
  font-weight: 600;
  padding-top: 8px;
  border-bottom: 1px solid var(--border);
}
.meta-table tr.meta-group:first-child th { padding-top: 0; }

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

/* View panes */
.pane { position: absolute; inset: 0; display: none; }
.pane.active { display: block; }
#cesiumContainer, #mapContainer { position: absolute; inset: 0; }

/* On-screen +/- zoom buttons for the Cesium view (device-independent). */
.cesium-zoom {
  position: absolute;
  right: 12px;
  bottom: 40px;
  z-index: 5;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.cesium-zoom button {
  width: 34px;
  height: 34px;
  font-size: 20px;
  line-height: 1;
  color: #e6edf3;
  background: rgba(13, 17, 23, 0.85);
  border: 1px solid rgba(158, 203, 240, 0.4);
  border-radius: 6px;
  cursor: pointer;
}
.cesium-zoom button:hover { background: rgba(31, 41, 51, 0.95); }
.cesium-zoom button:active { transform: translateY(1px); }

.lib-error {
  position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%);
  z-index: 20; max-width: 80%;
  background: #3a1e1e; border: 1px solid #7a3b3b; color: #f0c9c9;
  padding: 8px 14px; border-radius: 8px; font-size: 12px;
}

footer {
  padding: 8px 16px; border-top: 1px solid var(--border);
  background: var(--panel); font-size: 11px; color: var(--muted);
}
footer .credit-list { margin: 4px 0 0; padding-left: 18px; }
footer a { color: var(--accent); }
