/* Zenith — dark glass over an ambient sky. */
:root {
  --glass: rgba(13, 15, 31, 0.92);
  --border: rgba(255, 255, 255, 0.12);
  --cyan: #46d3f5;
  --cyan-dim: rgba(70, 211, 245, 0.16);
  --text-secondary: rgba(255, 255, 255, 0.62);
  --text-tertiary: rgba(255, 255, 255, 0.38);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  height: 100%;
  overflow: hidden;
  background: #01020a;
  color: #fff;
  font-family: -apple-system, ui-rounded, "SF Pro Rounded", system-ui, sans-serif;
  overscroll-behavior: none;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

#sky { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }

#header {
  position: fixed;
  top: calc(var(--safe-top) + 10px);
  left: 16px; right: 12px;
  display: flex; justify-content: space-between; align-items: center;
  pointer-events: none;
}
#header h1 {
  font-size: 22px; font-weight: 700; letter-spacing: 0.5px;
  color: rgba(255, 255, 255, 0.92);
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.6);
}
#topButtons { display: flex; gap: 8px; pointer-events: auto; }
#topButtons button {
  width: 40px; height: 40px; border-radius: 20px;
  border: 1px solid var(--border);
  background: rgba(13, 15, 31, 0.72);
  color: rgba(255, 255, 255, 0.8);
  font-size: 17px; line-height: 1;
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  cursor: pointer;
}
#topButtons button.on { color: var(--cyan); border-color: rgba(70, 211, 245, 0.4); }
#topButtons button svg { width: 19px; height: 19px; display: block; margin: auto; }

/* Eight buttons must fit a 390pt iPhone next to the title. */
@media (max-width: 430px) {
  #header h1 { font-size: 17px; }
  #topButtons { gap: 4px; }
  #topButtons button { width: 34px; height: 34px; border-radius: 17px; }
  #topButtons button svg { width: 16px; height: 16px; }
}

#hint {
  position: fixed;
  top: calc(var(--safe-top) + 64px);
  left: 50%; transform: translateX(-50%);
  padding: 8px 16px; border-radius: 18px;
  background: rgba(13, 15, 31, 0.7);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 13px; font-weight: 500;
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  transition: opacity 0.8s;
  pointer-events: none;
  white-space: nowrap;
}
#hint.gone { opacity: 0; }

#timeBar {
  position: fixed;
  left: 14px; right: 14px;
  bottom: calc(var(--safe-bottom) + 12px);
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; border-radius: 20px;
  background: rgba(13, 15, 31, 0.72);
  border: 1px solid var(--border);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  transition: opacity 0.3s, transform 0.3s;
}
#timeBar.hidden { opacity: 0; transform: translateY(20px); pointer-events: none; }
#timeReset {
  border: none; border-radius: 12px;
  padding: 6px 12px;
  background: var(--cyan-dim); color: var(--cyan);
  font-size: 13px; font-weight: 600; font-family: inherit;
  cursor: pointer;
}
#timeLabel {
  font-size: 13px; font-weight: 600;
  color: var(--text-secondary);
  min-width: 52px; text-align: right;
  font-variant-numeric: tabular-nums;
}
#timeSlider {
  flex: 1; appearance: none; -webkit-appearance: none;
  height: 4px; border-radius: 2px;
  background: rgba(255, 255, 255, 0.18);
  outline: none;
}
#timeSlider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px; height: 22px; border-radius: 11px;
  background: #fff;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.5);
}

.sheet {
  position: fixed;
  left: 12px; right: 12px;
  bottom: calc(var(--safe-bottom) + 10px);
  max-height: 62vh;
  overflow-y: auto;
  padding: 18px; border-radius: 22px;
  background: var(--glass);
  border: 1px solid var(--border);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  transition: opacity 0.25s, transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
  touch-action: pan-y;
}
.sheet.hidden { opacity: 0; transform: translateY(40px); pointer-events: none; }

.sheet .row-controls {
  display: flex; justify-content: flex-end; gap: 10px; margin-bottom: 6px;
}
.grab-handle {
  width: 38px; height: 5px; border-radius: 2.5px;
  background: rgba(255, 255, 255, 0.25);
  margin: -6px auto 8px;
}
#card { touch-action: none; }
#cardMini {
  position: fixed;
  left: 50%; transform: translateX(-50%);
  bottom: calc(var(--safe-bottom) + 14px);
  padding: 10px 20px;
  border-radius: 22px;
  border: 1px solid var(--border);
  background: var(--glass);
  color: #fff;
  font-size: 14px; font-weight: 600; font-family: inherit;
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  cursor: pointer;
  transition: opacity 0.25s, transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
}
#cardMini.hidden { opacity: 0; transform: translate(-50%, 30px); pointer-events: none; }
.sheet .row-controls button {
  width: 30px; height: 30px; border-radius: 15px; border: none;
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.75);
  font-size: 14px; cursor: pointer;
}
.sheet h2 { font-size: 21px; font-weight: 700; }
.sheet .kind { font-size: 12px; font-weight: 500; color: var(--text-secondary); margin-top: 1px; }
.sheet .blurb { font-size: 14px; color: var(--text-secondary); margin-top: 12px; line-height: 1.45; }

.facts {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 10px 24px; margin-top: 14px;
}
.facts .label { font-size: 11px; color: var(--text-tertiary); }
.facts .value { font-size: 14px; font-weight: 600; margin-top: 1px; }

.next-row { display: flex; gap: 8px; margin-top: 16px; }
.btn-next {
  flex: 1; border: none; border-radius: 12px;
  padding: 11px 14px;
  background: var(--cyan-dim); color: var(--cyan);
  font-size: 14px; font-weight: 600; font-family: inherit;
  cursor: pointer;
}
.btn-locate {
  width: 46px; border: none; border-radius: 12px;
  background: var(--cyan-dim); color: var(--cyan);
  font-size: 16px; cursor: pointer;
}

/* Tonight sheet */
.tonight-title { font-size: 19px; font-weight: 700; margin-bottom: 4px; }
.tonight-sub { font-size: 12px; color: var(--text-secondary); margin-bottom: 12px; }
.tonight-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  cursor: pointer;
}
.tonight-row .dot { width: 10px; height: 10px; border-radius: 5px; flex: none; }
.tonight-row .name { flex: 1; font-size: 15px; font-weight: 600; }
.tonight-row .name small { display: block; font-size: 11px; font-weight: 500; color: var(--text-tertiary); }
.tonight-row .times { font-size: 12px; color: var(--text-secondary); text-align: right; font-variant-numeric: tabular-nums; }
.badge {
  font-size: 10px; font-weight: 700;
  padding: 3px 7px; border-radius: 8px;
  background: var(--cyan-dim); color: var(--cyan);
}

/* Search */
#searchInput {
  width: 100%;
  margin: 10px 0 4px;
  padding: 11px 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  font-size: 15px; font-family: inherit;
  outline: none;
  user-select: text; -webkit-user-select: text;
}
#searchInput::placeholder { color: var(--text-tertiary); }
#searchResults { max-height: 38vh; overflow-y: auto; }
.badge.dim { background: rgba(255, 255, 255, 0.08); color: var(--text-tertiary); }

/* Stats + Milky Way slider (info sheet) */
.stats-grid {
  display: grid; grid-template-columns: 1fr 1fr 1fr;
  gap: 8px; margin: 12px 0 4px;
  text-align: center;
}
.stats-grid > div {
  padding: 10px 4px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.07);
}
.stats-grid b { display: block; font-size: 18px; color: var(--cyan); font-variant-numeric: tabular-nums; }
.stats-grid small { font-size: 11px; color: var(--text-secondary); }
.mw-row {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 4px 6px;
  font-size: 14px; font-weight: 600;
}
.mw-row input[type="range"] {
  flex: 1; appearance: none; -webkit-appearance: none;
  height: 4px; border-radius: 2px;
  background: rgba(255, 255, 255, 0.18);
  outline: none;
}
.mw-row input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px; height: 20px; border-radius: 10px;
  background: #fff;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.5);
}

/* Credits */
.credit-row {
  padding: 10px 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  font-size: 13px; line-height: 1.45;
  color: var(--text-secondary);
}
.credit-row b { color: rgba(255, 255, 255, 0.85); font-weight: 600; }
.credit-row a { color: var(--cyan); text-decoration: none; }

/* Location sheet */
.loc-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  font-size: 15px; font-weight: 500;
  cursor: pointer;
}
.loc-row.sel { color: var(--cyan); }
.loc-row .coords { margin-left: auto; font-size: 12px; color: var(--text-tertiary); font-variant-numeric: tabular-nums; }
