#sky-atlas {
  color-scheme: dark;
  --panel: #191724;
  --line: #393545;
  --muted: #b2aebe;
  background: #171521;
  color: #f6f2f8;
  border-radius: 18px;
  overflow: hidden;
  font-family: Barlow, "Microsoft YaHei", sans-serif;
}
#sky-atlas button,
#sky-atlas select {
  font: inherit;
  color: inherit;
  background: #282532;
  border: 0;
  border-radius: 7px;
  cursor: pointer;
  padding: 6px 10px;
}
#sky-atlas button:hover,
#sky-atlas button:focus-visible {
  background: #433c50;
}
#sky-atlas button[aria-pressed="true"] {
  background: #454051;
  color: #fff;
  box-shadow: inset 0 0 0 1px #9992a2;
}
.atlas-stage {
  position: relative;
  isolation: isolate;
  background: #202333;
}
#atlas-map {
  width: 100%;
  height: clamp(360px, 55vh, 680px);
  background: #202432;
  z-index: 0;
}
.atlas-base {
  filter: grayscale(1) invert(1) brightness(0.7) contrast(0.86) sepia(0.25)
    hue-rotate(193deg);
}
.atlas-head,
.atlas-tools,
#atlas-source,
#atlas-status {
  position: absolute;
  z-index: 2;
}
.atlas-head {
  left: 12px;
  top: 12px;
  max-width: calc(100% - 76px);
  display: grid;
  gap: 6px;
  justify-items: start;
}
.atlas-legend,
.atlas-clock,
.atlas-tools,
#atlas-source,
#atlas-status {
  background: rgba(23, 21, 35, 0.94);
  border: 1px solid #484154;
  border-radius: 12px;
  box-shadow: 0 3px 15px #0003;
}
.atlas-legend {
  width: min(270px, 100%);
  padding: 9px 11px;
}
.atlas-legend i {
  display: block;
  height: 6px;
  border-radius: 6px;
  background: linear-gradient(
    90deg,
    #fad469,
    #fba53b,
    #f06a30,
    #df422f,
    #bb2a45,
    #992a6e,
    #5d1f7c
  );
}
.atlas-legend div {
  display: flex;
  justify-content: space-between;
  margin-top: 4px;
  font-size: 12px;
  color: #ece6f3;
}
.atlas-clock {
  padding: 4px;
  max-width: 100%;
}
.atlas-clock div {
  display: flex;
  align-items: center;
  gap: 2px;
}
#sky-atlas .atlas-clock button,
#sky-atlas .atlas-clock select {
  font-size: 13px;
  padding: 6px;
  background: transparent;
}
#sky-atlas .atlas-clock select {
  max-width: 115px;
  color: #f0e9f6;
}
#sky-atlas .atlas-clock option {
  background: #262333;
}
#atlas-range {
  width: calc(100% - 12px);
  display: block;
  height: 14px;
  margin: 1px auto;
  accent-color: #dfae74;
}
.atlas-tools {
  top: 12px;
  right: 10px;
  overflow: hidden;
  display: grid;
}
#sky-atlas .atlas-tools button {
  width: 38px;
  height: 38px;
  border-radius: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  font-size: 22px;
  line-height: 1;
}
#sky-atlas #atlas-cloud[aria-pressed="true"] {
  color: #9edbff;
  background: #373947;
}
#atlas-source,
#atlas-status {
  left: 12px;
  bottom: 32px;
  padding: 5px 9px;
  font-size: 11px;
  max-width: 78%;
}
#atlas-source {
  bottom: 62px;
}
#atlas-source:empty,
#atlas-status:empty {
  display: none;
}
.atlas-bearing {
  white-space: nowrap;
  color: #ffdc97;
  font-size: 11px;
  text-shadow: 0 1px 3px black;
}
.atlas-bearing b {
  display: inline-block;
  font-size: 23px;
  vertical-align: middle;
}
.atlas-sheet {
  padding: 13px 15px 12px;
  background: #191724;
  border-top: 1px solid var(--line);
}
#sky-atlas .atlas-sheet header {
  position: static;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: transparent;
  color: inherit;
  padding: 0;
  height: auto;
  border: 0;
  box-shadow: none;
  backdrop-filter: none;
}
.atlas-sheet header strong {
  font-size: 18px;
}
.atlas-sheet header div {
  display: flex;
  gap: 3px;
}
#atlas-choices {
  display: grid;
  grid-template-columns: repeat(6, minmax(52px, 1fr));
  gap: 4px;
  overflow-x: auto;
  margin: 9px 0;
}
#sky-atlas #atlas-choices button {
  font-size: 12px;
  color: #c6c0cf;
  padding: 5px 2px;
}
#atlas-choices b {
  display: block;
  font-size: 17px;
  color: #ffd08b;
}
.atlas-detail {
  border: 1px solid var(--line);
  padding: 9px 12px;
  border-radius: 12px;
  background: #25222f;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 12px;
  align-items: center;
}
#atlas-value {
  background: #373342;
  border-radius: 9px;
  color: #ffcd86;
  font-size: 24px;
  padding: 7px;
}
#atlas-grade {
  font-size: 18px;
}
#atlas-where,
#atlas-updated {
  display: block;
  color: var(--muted);
  font-size: 12px;
}
.atlas-detail p {
  grid-column: 1/-1;
  margin: 3px 0 0;
  color: #ece5ef;
  font-size: 13px;
}
#atlas-updated {
  margin: 6px 0;
}
.atlas-sheet nav {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
#sky-atlas .atlas-sheet nav button {
  font-size: 12px;
  padding: 4px 7px;
}
#sky-atlas .leaflet-control-scale-line {
  border-color: #e1dbe9;
  color: #fff;
  background: #211e2cc9;
  text-shadow: none;
}
@media (max-width: 500px) {
  .atlas-sheet {
    padding: 10px;
  }
  .atlas-head {
    left: 8px;
    top: 8px;
  }
  .atlas-tools {
    top: 8px;
    right: 8px;
  }
  #atlas-choices {
    grid-template-columns: repeat(6, minmax(42px, 1fr));
  }
  #atlas-map {
    height: clamp(365px, 49svh, 520px);
  }
}

#sky-atlas #atlas-provider {
  position: absolute;
  right: 10px;
  bottom: 22px;
  background: #201d2d;
  color: #ece6f2;
  border: 1px solid #544e60;
  font-size: 12px;
  z-index: 2;
  max-width: 134px;
}
#sky-atlas #atlas-choices button {
  display: block;
  white-space: nowrap;
  text-align: center;
  padding: 5px 1px;
}
#sky-atlas .atlas-legend {
  width: min(270px, calc(100vw - 120px));
  box-sizing: border-box;
}

#atlas-map { background: white; }
.atlas-legend div { gap: 1px; margin: 0; }
.atlas-legend span { flex: 1; text-align: center; font-size: clamp(8px, 2.4vw, 11px); white-space: nowrap; }
.atlas-legend span i { margin-bottom: 4px; border-radius: 2px; }
.atlas-pin { display: grid; place-items: center; cursor: grab; }
.atlas-pin:active { cursor: grabbing; }
.atlas-pin::after { content: ""; width: 13px; height: 13px; border: 3px solid white; border-radius: 50%; background: #914970; box-shadow: 0 0 0 1px #593046, 0 2px 5px #5559; }

/* Dedicated observation screen. Home keeps its own chrome and search controls. */
body.view-atlas { margin:0; padding:0; background:#16151f; }
body.view-atlas > header,body.view-atlas > #bottomnav,
body.view-atlas main > :not(#map-page){display:none!important}
body.view-atlas main {width:100%;max-width:none;margin:0;padding:0}
body.view-atlas #sky-atlas {border-radius:0; min-height:100vh;min-height:100dvh;}
.atlas-bar {height:44px;display:flex;align-items:center;gap:8px;padding:0 12px;background:#111019;color:#f7f4fa}
.atlas-bar strong{font-size:16px;font-weight:600}
#sky-atlas .atlas-bar button {background:transparent;font-size:27px;line-height:1;min-width:40px}
#atlas-reload {margin-left:auto}
#atlas-wrap {display:flex;flex-direction:column;min-height:calc(100vh - 44px);min-height:calc(100dvh - 44px)}
#atlas-wrap .atlas-stage {flex:1;min-height:54vh;min-height:54dvh}
#atlas-wrap #atlas-map {position:absolute;inset:0;height:100%;width:100%}
#sky-atlas .atlas-sheet {padding:10px max(12px,calc((100vw - 960px)/2)) max(10px,env(safe-area-inset-bottom));border-radius:16px 16px 0 0;background:#191823}
#sky-atlas .atlas-sheet header {gap:12px}
#sky-atlas #atlas-choices {grid-template-columns:repeat(4,minmax(0,1fr));gap:6px}
#atlas-choices button[aria-pressed="true"] {outline:1px solid #b3acbd}
#atlas-time {font:600 13px system-ui;color:#ffddaa}
.atlas-sheet summary {cursor:pointer;font-size:13px;margin:8px 0;color:#ddd7e3}
#atlas-metrics {color:#ddd9e5;line-height:1.8;font-size:13px;margin:5px 0}
.province-label {text-align:center;color:#353b46;font:bold 10px/14px system-ui;text-shadow:0 1px 2px white,1px 0 2px white,-1px 0 2px white;white-space:nowrap}
.atlas-place {border:0;border-radius:5px;background:#201f2d;color:white;padding:4px 6px;font-size:11px}
#atlas-source{bottom:22px} #atlas-status{bottom:46px}
#sky-atlas .atlas-head {max-width:calc(100% - 70px)}
#sky-atlas .atlas-legend {width: min(275px,calc(100vw - 85px))}
#sky-atlas .atlas-legend span{font-size:11px}

#atlas-map .atlas-pin {display:grid;place-items:center}
#atlas-map .atlas-pin::after {display:block;box-sizing:border-box;width:16px;height:16px;border:3px solid #fff;border-radius:50%;background:#54374b;box-shadow:0 0 0 2px #493b49}
#atlas-map .atlas-bearing {font-weight:700;color:#623c0c;text-shadow:0 1px 2px white,0 -1px 2px white}
#atlas-map .atlas-place {background:#282433;color:#fff;border:0;font-size:11px}

.atlas-settings{position:absolute;top:174px;right:10px;z-index:3;border:1px solid #555165;border-radius:9px;background:#1b1925ec;color:#f1eef5;padding:6px;font-size:12px}
.atlas-settings summary{cursor:pointer}.atlas-settings label{display:block;padding:5px}.atlas-settings input{width:85px;vertical-align:middle}
.admin-label{color:white;text-align:center;text-shadow:0 1px 3px black,1px 0 3px black;font:11px/14px system-ui;white-space:nowrap}
.province-label{color:white;text-shadow:0 1px 3px #222,1px 0 3px #222}

#atlas-map:not([data-admin-level="province"]) .province-label,
#atlas-map:not([data-admin-level="city"]) .admin-city,
#atlas-map:not([data-admin-level="district"]) .admin-district {display:none}

#atlas-map[data-base="dark"] {background:#252a34}
#atlas-map[data-base="heat"] {background:#fff}
.atlas-dark-tiles {filter:sepia(.18) hue-rotate(175deg) brightness(1.25)}
.atlas-road-overlay {mix-blend-mode:screen}
#sky-atlas .atlas-legend div {gap:0}
#sky-atlas .atlas-legend i {border-radius:0}
#sky-atlas .atlas-legend span:first-child i {border-radius:5px 0 0 5px}
#sky-atlas .atlas-legend span:last-child i {border-radius:0 5px 5px 0}

#atlas-compass {font-size:12px!important; margin-left:auto}
#atlas-reload {margin-left:0}
.atlas-needle {pointer-events:none}
.atlas-needle span {display:block;width:34px;height:34px;filter:drop-shadow(0 1px 2px #17131c)}
.atlas-needle span::after {content:"";position:absolute;left:11px;top:-10px;width:12px;height:16px;background:#ffcb69;clip-path:polygon(50% 0,100% 100%,50% 75%,0 100%)}

#atlas-map[data-base="dark"] {background:#192532}
#atlas-map[data-base="road"] {background:#c1daea}
#atlas-map .atlas-needle span {will-change:transform}
#atlas-map .atlas-needle span::after {height:20px;width:14px;left:10px;top:-14px}
.compass-actions {display:flex;justify-content:flex-end;gap:10px;margin-top:16px}

#atlas-prompt {width:min(310px,calc(100vw - 36px));box-sizing:border-box;border:1px solid #575161;border-radius:14px;background:#211e2b;color:#f4f1f5;padding:18px}
#atlas-prompt::backdrop {background:#11121c88}
#atlas-prompt h2 {font-size:18px;margin:0 0 8px}
#atlas-prompt p {font-size:14px;line-height:1.5;margin:0}
#sky-atlas #atlas-allow {background:#f7ce64;color:#26212a}
