:root {
  --bg: #14161a;
  --panel-bg: #1c1f26;
  --border: #2c3038;
  --text: #eceef1;
  --text-dim: #9aa1ad;
  --accent: #ffcc66;
  --controlbar-h: 64px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* ===== Control bar ===== */

.controlbar {
  height: var(--controlbar-h);
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 20px;
  background: var(--panel-bg);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.controlbar-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.controlbar-search {
  position: relative;
  flex: 1 1 260px;
  min-width: 200px;
}

#location-search {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: 8px 10px;
  font-size: 14px;
}

.search-results {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 20;
  list-style: none;
  margin: 0;
  padding: 4px;
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  max-height: 240px;
  overflow-y: auto;
}

.search-results li {
  padding: 8px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
}

.search-results li:hover,
.search-results li.is-active {
  background: var(--border);
}

.controlbar-numeric label {
  font-size: 12px;
  color: var(--text-dim);
  white-space: nowrap;
}

.controlbar-numeric input {
  width: 72px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: 8px 8px;
  font-size: 14px;
}

.controlbar-numeric .unit {
  font-size: 12px;
  color: var(--text-dim);
}

.controlbar-time {
  margin-left: auto;
}

.time-btn {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: 8px 12px;
  font-size: 13px;
  cursor: pointer;
}

.time-btn.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #1a1a1a;
  font-weight: 600;
}

.time-custom {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: 7px 8px;
  font-size: 13px;
}

/* ===== Layout ===== */

.layout {
  display: flex;
  height: calc(100vh - var(--controlbar-h));
}

.map-pane {
  flex: 2 1 0;
  min-width: 0;
}

.panel-pane {
  flex: 1 1 0;
  min-width: 280px;
  max-width: 420px;
  padding: 20px;
  overflow-y: auto;
  background: var(--panel-bg);
  border-left: 1px solid var(--border);
}

/* ===== Moon panel ===== */

.panel-title {
  font-size: 18px;
  margin: 0 0 16px;
}

.panel-row--phase {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 16px;
}

.panel-phase-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--accent);
}

.panel-phase-pct {
  font-size: 13px;
  color: var(--text-dim);
}

.panel-facts {
  margin: 0;
}

.panel-fact {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.panel-fact dt { color: var(--text-dim); }
.panel-fact dd { margin: 0; }

.panel-facts--secondary .panel-fact { font-size: 12px; }

.panel-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 16px 0;
}

.panel-path-status {
  margin-top: 16px;
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.5;
}

/* ===== Responsive ===== */

@media (max-width: 720px) {
  .layout {
    flex-direction: column;
    height: auto;
  }
  .map-pane {
    height: 60vh;
  }
  .panel-pane {
    max-width: none;
    border-left: none;
    border-top: 1px solid var(--border);
  }
  .controlbar {
    height: auto;
    padding: 12px;
  }
  .controlbar-time {
    margin-left: 0;
  }
}
