:root {
  --bg: #0f1115;
  --panel: rgba(20, 24, 31, 0.92);
  --accent: #f0a51f;
  --accent2: #a51ff0;
  --text: #eef1f5;
  --muted: #9aa3af;
}

* {
  box-sizing: border-box;
}

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

#map {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: #1a1d23;
}

/* Top loading/processing bar */
#progress {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  z-index: 3000;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
  pointer-events: none;
}

#progress.hidden {
  display: none;
}

#progressBar {
  height: 100%;
  width: 0;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
  transition: width 0.25s ease;
}

#progress.indeterminate #progressBar {
  width: 33%;
  transition: none;
  animation: progIndet 1.1s ease-in-out infinite;
}

@keyframes progIndet {
  0% {
    transform: translateX(-110%);
  }
  100% {
    transform: translateX(330%);
  }
}

#topbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 16px;
  padding: 10px 16px 18px;
  background: linear-gradient(180deg, rgba(15, 17, 21, 0.95), rgba(15, 17, 21, 0));
  pointer-events: none;
}

#topbar .title,
#topbar .controls {
  pointer-events: auto;
}

.title strong {
  font-size: 18px;
  letter-spacing: 0.3px;
}

.title span {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 14px;
  background: var(--panel);
  padding: 8px 12px;
  border-radius: 10px;
  backdrop-filter: blur(6px);
  font-size: 13px;
}

.search {
  position: relative;
  pointer-events: auto;
  flex: 1 1 240px;
  max-width: 360px;
}

#searchInput {
  width: 100%;
  background: var(--panel);
  color: var(--text);
  border: 1px solid #333a45;
  border-radius: 10px;
  padding: 9px 14px;
  font-size: 14px;
  backdrop-filter: blur(6px);
  outline: none;
}

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

#searchInput::placeholder {
  color: var(--muted);
}

#searchResults {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  margin: 0;
  padding: 4px;
  list-style: none;
  background: var(--panel);
  border: 1px solid #333a45;
  border-radius: 10px;
  backdrop-filter: blur(6px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  max-height: 320px;
  overflow-y: auto;
}

#searchResults.hidden {
  display: none;
}

#searchResults li {
  padding: 8px 10px;
  border-radius: 7px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  line-height: 1.3;
}

#searchResults li:hover,
#searchResults li.active {
  background: #2a313d;
}

#searchResults li.muted {
  color: var(--muted);
  cursor: default;
}

#searchResults li.muted:hover {
  background: transparent;
}

.seg {
  display: flex;
  border: 1px solid #333a45;
  border-radius: 8px;
  overflow: hidden;
}

.seg button {
  background: transparent;
  color: var(--muted);
  border: 0;
  padding: 6px 12px;
  cursor: pointer;
  font-size: 13px;
}

.seg button.active {
  background: var(--accent);
  color: #1a1d23;
  font-weight: 600;
}

.seg button:first-child.active {
  background: var(--accent2);
  color: #fff;
}

.controls label {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
}

.opacity input {
  width: 90px;
}

#spotlight {
  position: absolute;
  top: 72px;
  right: 16px;
  z-index: 1100;
  width: 230px;
  background: var(--panel);
  border: 1px solid #333a45;
  border-radius: 12px;
  overflow: hidden;
  backdrop-filter: blur(6px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

#spotlight.hidden {
  display: none;
}

#spotlight .spot-head {
  font-size: 11px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--muted);
  padding: 7px 10px 5px;
}

#spotImg {
  display: block;
  width: 100%;
  height: 200px;
  object-fit: cover;
  background: #11141a;
}

#spotlight .spot-cap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 10px 9px;
  font-size: 12px;
}

#spotMeta {
  color: var(--text);
  line-height: 1.3;
}

#spotDl {
  flex: none;
  color: #1a1d23;
  background: var(--accent);
  padding: 3px 8px;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 600;
  font-size: 11px;
}

.status {
  position: absolute;
  bottom: 104px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  max-width: 92vw;
  text-align: center;
  background: var(--panel);
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 13px;
  border: 1px solid #333a45;
  backdrop-filter: blur(6px);
}

.status.hidden {
  display: none;
}

.status.loading {
  border-color: var(--accent);
}

/* Big center-bottom year shown during the cinematic timeline render */
#bigYear {
  position: absolute;
  left: 50%;
  bottom: 92px;
  z-index: 1500;
  transform: translateX(-50%);
  font-size: clamp(40px, 8vw, 84px);
  font-weight: 800;
  letter-spacing: 2px;
  color: #fff;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.85), 0 0 4px rgba(0, 0, 0, 0.6);
  pointer-events: none;
  user-select: none;
}

#bigYear.hidden {
  display: none;
}

#bigYear.anim {
  animation: yearPop 0.55s ease;
}

@keyframes yearPop {
  0% {
    opacity: 0;
    transform: translateX(-50%) translateY(10px) scale(0.94);
  }
  100% {
    opacity: 1;
    transform: translateX(-50%) translateY(0) scale(1);
  }
}

#timeline {
  position: absolute;
  bottom: 26px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--panel);
  padding: 12px 18px;
  border-radius: 14px;
  backdrop-filter: blur(6px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
  width: min(760px, 92vw);
}

#timeline button {
  background: #232936;
  color: var(--text);
  border: 1px solid #333a45;
  border-radius: 8px;
  width: 34px;
  height: 34px;
  cursor: pointer;
  font-size: 14px;
  flex: none;
}

#timeline button:hover {
  border-color: var(--accent);
}

/* Play is the only triangle and is visually set apart from the chevron
   step-buttons so the two are never confused. */
#timeline button.play {
  background: var(--accent);
  color: #1a1d23;
  border-color: var(--accent);
  font-size: 12px;
  padding-left: 2px;
}

#timeline button.play:hover {
  filter: brightness(1.1);
}

#timeline .divider {
  width: 1px;
  height: 22px;
  background: #3a4351;
  flex: none;
  margin: 0 2px;
}

#timeline button#nextBtn,
#timeline button#prevBtn {
  font-size: 16px;
  font-weight: 700;
}

#epochSlider {
  flex: 1;
  accent-color: var(--accent);
}

.epochLabel {
  flex: none;
  min-width: 96px;
  text-align: center;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

#attrib {
  position: absolute;
  bottom: 4px;
  right: 8px;
  z-index: 1000;
  font-size: 11px;
  color: var(--muted);
  background: rgba(15, 17, 21, 0.6);
  padding: 2px 8px;
  border-radius: 6px;
}

#attrib a {
  color: var(--muted);
}

.leaflet-container {
  background: #1a1d23;
}

.tile-popup b {
  color: var(--accent);
}

.tile-popup .dl {
  display: inline-block;
  margin-top: 6px;
  color: #1a1d23;
  background: var(--accent);
  padding: 4px 10px;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 600;
}

@media (max-width: 760px) {
  .title span {
    display: none;
  }
  .search {
    flex: 1 1 100%;
    max-width: none;
    order: 3;
  }
  #timeline {
    bottom: 16px;
    padding: 10px 12px;
  }
  .status {
    bottom: 92px;
  }
  /* topbar wraps tall on phones; tuck the spotlight out of its way */
  #spotlight {
    top: auto;
    bottom: 150px;
    right: 8px;
    width: 150px;
  }
  #spotlight .spot-head {
    display: none;
  }
  #spotImg {
    height: 110px;
  }
}

/* --- Info / Impressum ---------------------------------------------------- */
#aboutBtn {
  width: 28px;
  height: 28px;
  flex: none;
  border-radius: 50%;
  border: 1px solid #333a45;
  background: #232936;
  color: var(--muted);
  font-style: italic;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  line-height: 1;
}

#exportBtn {
  flex: none;
  border: 1px solid #333a45;
  background: #232936;
  color: var(--text);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 13px;
  cursor: pointer;
}

#exportBtn:hover {
  border-color: var(--accent);
}

#exportBtn.busy {
  background: var(--accent);
  color: #1a1d23;
  border-color: var(--accent);
  font-weight: 600;
}

#aboutBtn:hover {
  border-color: var(--accent);
  color: var(--text);
}

#attrib #aboutLink {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  color: var(--muted);
  cursor: pointer;
  text-decoration: underline;
}

#attrib #aboutLink:hover {
  color: var(--text);
}

#aboutOverlay {
  position: absolute;
  inset: 0;
  z-index: 4000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(8, 10, 13, 0.7);
  backdrop-filter: blur(3px);
}

#aboutOverlay.hidden {
  display: none;
}

#aboutCard {
  position: relative;
  width: min(440px, 92vw);
  background: var(--panel);
  border: 1px solid #333a45;
  border-radius: 16px;
  padding: 30px 34px 24px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  text-align: left;
}

#aboutClose {
  position: absolute;
  top: 14px;
  right: 16px;
  background: none;
  border: 0;
  color: var(--muted);
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
}

#aboutClose:hover {
  color: var(--text);
}

#aboutTitle {
  margin: 0;
  font-size: 30px;
  font-weight: 800;
  color: var(--text);
}

#aboutCard .about-sub {
  margin: 6px 0 14px;
  color: var(--muted);
  font-size: 16px;
}

#aboutCard .about-info {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.55;
}

#aboutCard .about-by {
  margin: 0 0 22px;
  color: var(--text);
  font-size: 16px;
  text-align: center;
}

#aboutCard .about-by .heart {
  color: #ff4d6d;
}

#aboutCard .about-links {
  display: flex;
  gap: 16px;
  justify-content: center;
  margin: 4px 0 24px;
}

#aboutCard .about-links a {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #2a313d;
  color: var(--text);
  transition: background 0.15s, color 0.15s;
}

#aboutCard .about-links a:hover {
  background: var(--accent);
  color: #1a1d23;
}

#aboutCard .about-foot {
  margin: 0;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}
