/* Moonset shell (v2: Apple-style palette).
   Layout: #home (scrolling story with the hero) is the default route; the app views (Map | Site | Plan) fill
   the stage between a 56px glass bar and the time dock. Maps, sky and 3D stay dark "windows" in both themes. */
:root {
  color-scheme: light;
  --bg: #f5f5f7;
  --bg-2: #e8e8ed;
  --panel: rgba(255, 255, 255, 0.84);
  --panel-solid: #ffffff;
  --panel-2: #fbfbfd;
  --line: #d2d2d7;
  --line-2: #b9b9bf;
  --fg: #1d1d1f;
  --fg-2: #6e6e73;
  --fg-3: #86868b;
  --hover: rgba(0, 0, 0, 0.04);
  --active: rgba(0, 0, 0, 0.07);
  /* data inks (fills, lines, text on paper) and the bright versions used inside dark sky windows */
  --sun: #b8862b;
  --earth: #3f7f95;
  --both: #4d8f6b;
  --risk: #d4473d;
  --sun-sky: #f2b64a;
  --earth-sky: #7fb8c9;
  --both-sky: #8fcfa8;
  --risk-sky: #ff6b5e;
  --sky: #000000;
  --sky-2: #0b0b0d;
  --sky-fg: #f5f5f7;
  --sky-fg-2: #a1a1a6;
  --sky-line: rgba(255, 255, 255, 0.14);
  --shadow: 0 2px 6px rgba(0, 0, 0, 0.04), 0 12px 32px rgba(0, 0, 0, 0.07);
  --font-ui: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", Inter, "Helvetica Neue", Helvetica,
    Arial, sans-serif;
  --font-mono: "SF Mono", ui-monospace, Menlo, "Roboto Mono", Consolas, monospace;
  --t12: 12px;
  --t15: 15px;
  --t19: 19px;
  --t24: 24px;
  --t30: 30px;
  --t48: 48px;
  --bar-h: 56px;
  --dock-h: 64px;
  --r: 12px;
  --r-card: 18px;
  --ease: cubic-bezier(0.25, 0.1, 0.25, 1);
  /* shell surfaces and extras shared with modules */
  --bar-bg: rgba(245, 245, 247, 0.8);
  --dock-bg: rgba(245, 245, 247, 0.88);
  --pop-bg: rgba(255, 255, 255, 0.98);
  --sheet-bg: rgba(255, 255, 255, 0.98);
  --pop-shadow: 0 12px 40px rgba(0, 0, 0, 0.12);
  --big-shadow: 0 24px 70px rgba(0, 0, 0, 0.18);
  --scrim: rgba(0, 0, 0, 0.28);
  --accent: #1d1d1f;
  --accent-fg: #ffffff;
  --accent-soft: rgba(0, 0, 0, 0.06);
  --psr: #5b5fc7;
  --psr-sky: #8c95ff;
  --sun-soft: rgba(184, 134, 43, 0.13);
  --earth-soft: rgba(63, 127, 149, 0.13);
  --both-soft: rgba(77, 143, 107, 0.13);
  --risk-soft: rgba(212, 71, 61, 0.12);
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #000000;
  --bg-2: #161617;
  --panel: rgba(29, 29, 31, 0.84);
  --panel-solid: #1d1d1f;
  --panel-2: #161617;
  --line: #424245;
  --line-2: #5a5a5e;
  --fg: #f5f5f7;
  --fg-2: #a1a1a6;
  --fg-3: #86868b;
  --hover: rgba(255, 255, 255, 0.06);
  --active: rgba(255, 255, 255, 0.1);
  --sun: #f2b64a;
  --earth: #7fb8c9;
  --both: #8fcfa8;
  --risk: #ff6b5e;
  --sun-sky: #f2b64a;
  --earth-sky: #7fb8c9;
  --both-sky: #8fcfa8;
  --risk-sky: #ff6b5e;
  --shadow: 0 2px 6px rgba(0, 0, 0, 0.4), 0 12px 32px rgba(0, 0, 0, 0.45);
  --bar-bg: rgba(22, 22, 23, 0.8);
  --dock-bg: rgba(22, 22, 23, 0.88);
  --pop-bg: rgba(29, 29, 31, 0.98);
  --sheet-bg: rgba(29, 29, 31, 0.98);
  --pop-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
  --big-shadow: 0 24px 70px rgba(0, 0, 0, 0.7);
  --scrim: rgba(0, 0, 0, 0.55);
  --accent: #f5f5f7;
  --accent-fg: #000000;
  --accent-soft: rgba(255, 255, 255, 0.1);
  --psr: #8c95ff;
  --psr-sky: #8c95ff;
  --sun-soft: rgba(242, 182, 74, 0.15);
  --earth-soft: rgba(127, 184, 201, 0.15);
  --both-soft: rgba(143, 207, 168, 0.15);
  --risk-soft: rgba(255, 107, 94, 0.15);
}
/* calm cross-fade while the theme switches (class added by app.js for ~0.45 s) */
html.theme-anim *,
html.theme-anim *::before,
html.theme-anim *::after {
  transition:
    background-color 0.35s var(--ease),
    border-color 0.35s var(--ease),
    color 0.35s var(--ease),
    fill 0.35s var(--ease),
    stroke 0.35s var(--ease),
    box-shadow 0.35s var(--ease) !important;
}
html,
body {
  height: 100%;
}
[hidden] {
  display: none !important;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 400 var(--t15) / 1.45 var(--font-ui);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
* {
  box-sizing: border-box;
}
button,
input {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
}
:focus-visible {
  outline: 1.5px solid var(--fg-2);
  outline-offset: 2px;
  border-radius: 6px;
}
.num,
kbd,
.kbd {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.app {
  position: relative;
  height: 100%;
  display: grid;
  grid-template-rows: var(--bar-h) 1fr var(--dock-h);
}

/* ---------- top bar ---------- */
.bar {
  position: relative;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 12px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  border-bottom: 1px solid var(--line);
  background: var(--bar-bg);
  backdrop-filter: blur(14px) saturate(1.2);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
}
.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--fg);
  text-decoration: none;
  flex: none;
}
.brand-mark {
  width: 22px;
  height: 22px;
}
.brand-word {
  font: 600 17px/1 var(--font-ui);
  letter-spacing: -0.01em;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  background: var(--panel-solid);
  color: var(--fg);
  min-width: 0;
  transition:
    background 0.15s var(--ease),
    border-color 0.15s var(--ease);
}
.chip:hover {
  background: var(--hover);
  border-color: var(--fg-3);
}
.chip-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chip-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--fg-2);
  flex: none;
}
.kbd {
  font-size: var(--t12);
  color: var(--fg-3);
  border: 1px solid var(--line-2);
  border-radius: 5px;
  padding: 1px 5px;
  line-height: 1.3;
}
.when {
  position: relative;
}
.when-chip {
  font-family: var(--font-ui);
  font-variant-numeric: tabular-nums;
  font-size: var(--t12);
  color: var(--fg-2);
}
.when-pop {
  top: 40px;
  left: 0;
  width: 300px;
}
.when-row {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}
.lbl {
  font-size: var(--t12);
  color: var(--fg-2);
}
.lbl-sub {
  color: var(--fg-3);
}
.btn {
  height: 32px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: var(--accent);
  color: var(--accent-fg);
  transition: opacity 0.2s var(--ease);
  font-weight: 500;
  font-size: var(--t12);
}
.btn:hover {
  opacity: 0.86;
}
.btn.ghost {
  background: transparent;
  color: var(--fg);
  border-color: var(--line-2);
}
.btn.ghost:hover {
  background: var(--hover);
}

.bar-break {
  display: none;
}
.tabs {
  display: flex;
  gap: 2px;
  margin-left: auto;
  padding: 3px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg-2);
}
.tab {
  height: 28px;
  display: inline-flex;
  align-items: center;
  padding: 0 14px;
  border-radius: 999px;
  color: var(--fg-2);
  text-decoration: none;
  font-size: var(--t12);
  font-weight: 500;
  letter-spacing: 0.02em;
  transition:
    color 0.15s,
    background 0.15s;
}
.tab:hover {
  color: var(--fg);
}
.tab[aria-selected="true"] {
  background: var(--panel-solid);
  color: var(--fg);
  box-shadow:
    0 0 0 1px var(--line),
    0 1px 2px var(--line);
}
.bar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}
.seg {
  display: flex;
  padding: 3px;
  border-radius: 999px;
  border: 1px solid var(--line);
}
.seg-b {
  height: 26px;
  padding: 0 11px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--fg-3);
  font-size: var(--t12);
  font-weight: 500;
}
.seg-b[aria-checked="true"] {
  background: var(--panel-solid);
  color: var(--fg);
  box-shadow:
    0 0 0 1px var(--line),
    0 1px 2px var(--line);
}
.icon-btn {
  width: 32px;
  height: 32px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--fg-2);
  flex: none;
}
.icon-btn:hover {
  color: var(--fg);
  background: var(--hover);
}
.icon-btn svg {
  width: 18px;
  height: 18px;
}
#themeBtn .ico-sun {
  display: none;
}
:root[data-theme="dark"] #themeBtn .ico-sun {
  display: block;
}
:root[data-theme="dark"] #themeBtn .ico-moon {
  display: none;
}

/* ---------- stage ---------- */
.stage {
  position: relative;
  overflow: hidden;
  min-height: 0;
}
.view {
  position: absolute;
  inset: 0;
  overflow: hidden;
}
.view[hidden] {
  display: none !important;
}
.view.enter {
  animation: viewIn 0.35s var(--ease);
}
@keyframes viewIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ---------- search (one box: sites, coordinates, questions) ---------- */
.search {
  position: relative;
  flex: 1 1 360px;
  max-width: 460px;
  min-width: 0;
  height: 36px;
  margin-left: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 8px 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  background: var(--panel-solid);
  transition:
    border-color 0.15s var(--ease),
    box-shadow 0.15s var(--ease);
}
.search:hover {
  border-color: var(--fg-3);
}
.search:focus-within {
  border-color: var(--fg-2);
  box-shadow: 0 0 0 3px var(--active);
}
.search-ico {
  width: 17px;
  height: 17px;
  color: var(--fg-3);
  flex: none;
}
.search input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  background: transparent;
  font-size: var(--t15);
  outline: none;
  color: var(--fg);
  text-overflow: ellipsis;
}
.search input::placeholder {
  color: var(--fg-3);
}
.search-clear {
  flex: none;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--fg-3);
  padding: 0;
}
.search-clear:hover {
  background: var(--hover);
  color: var(--fg);
}
.search-clear svg {
  width: 14px;
  height: 14px;
}
.search-kbd {
  flex: none;
}
.search:focus-within .search-kbd {
  display: none;
}
.suggest {
  position: absolute;
  z-index: 50;
  top: 44px;
  left: -1px;
  width: min(560px, calc(100vw - 32px));
  max-height: min(560px, calc(100vh - var(--bar-h) - 40px));
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line-2);
  border-radius: 14px;
  background: var(--pop-bg);
  box-shadow: var(--big-shadow);
  overflow: hidden;
  animation: sugIn 0.18s var(--ease);
}
@keyframes sugIn {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
.sug-list {
  overflow: auto;
  padding: 6px;
  overscroll-behavior: contain;
}
.sug-group {
  padding: 10px 10px 4px;
  font-size: var(--t12);
  color: var(--fg-3);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.sug-item {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  text-align: left;
  color: var(--fg);
}
.sug-item:hover,
.sug-item[aria-selected="true"] {
  background: var(--hover);
}
.sug-ic {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  color: var(--fg-3);
}
.sug-ic svg {
  width: 17px;
  height: 17px;
}
.sug-txt {
  display: grid;
  min-width: 0;
}
.sug-name {
  font-size: var(--t15);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sug-name u {
  text-decoration: none;
  box-shadow: inset 0 -2px 0 var(--line-2);
}
.sug-meta {
  font-size: var(--t12);
  color: var(--fg-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sug-tag {
  font-size: var(--t12);
  color: var(--fg-3);
  font-family: var(--font-ui);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.sug-item[aria-current="true"] .sug-name::after {
  content: "  ✓";
  color: var(--fg-3);
}
.sug-empty {
  padding: 20px 12px;
  color: var(--fg-3);
  font-size: var(--t15);
}
.sug-foot {
  flex: none;
  display: flex;
  gap: 16px;
  padding: 8px 14px;
  border-top: 1px solid var(--line);
  font-size: var(--t12);
  color: var(--fg-3);
}
.sug-foot .kbd {
  margin-right: 3px;
}
.when-chip svg {
  width: 15px;
  height: 15px;
  color: var(--fg-3);
  flex: none;
}

/* ---------- popovers ---------- */
.pop {
  position: absolute;
  z-index: 45;
  padding: 14px;
  border: 1px solid var(--line-2);
  border-radius: var(--r);
  background: var(--pop-bg);
  box-shadow: var(--pop-shadow);
  display: grid;
  gap: 10px;
}
.pop input {
  width: 100%;
  height: 36px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid var(--line-2);
  background: var(--bg);
  font-family: var(--font-ui);
  font-variant-numeric: tabular-nums;
  font-size: var(--t15);
  color: var(--fg);
}
.pop-title {
  font-size: var(--t15);
  font-weight: 500;
}
.pop-note {
  margin: 0;
  font-size: var(--t12);
  color: var(--fg-2);
  line-height: 1.45;
}

/* ---------- dock (time) ---------- */
.dock {
  position: relative;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 16px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  border-top: 1px solid var(--line);
  background: var(--dock-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.dk-k {
  display: block;
  font-size: var(--t12);
  line-height: 1.1;
  color: var(--fg-3);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}
.dk-win {
  position: relative;
  flex: none;
}
.dk-winbtn {
  display: grid;
  gap: 3px;
  text-align: left;
  height: 44px;
  padding: 5px 30px 5px 12px;
  border-radius: var(--r);
  border: 1px solid var(--line-2);
  background: var(--panel-solid);
  position: relative;
}
.dk-winbtn::after {
  content: "";
  position: absolute;
  right: 12px;
  top: 50%;
  width: 6px;
  height: 6px;
  margin-top: -5px;
  border-right: 1.4px solid var(--fg-3);
  border-bottom: 1.4px solid var(--fg-3);
  transform: rotate(45deg);
}
.dk-winbtn:hover {
  border-color: var(--fg-3);
}
.dk-winbtn[aria-expanded="true"] {
  border-color: var(--fg-2);
}
.dk-v {
  font-size: var(--t15);
  line-height: 1.15;
  color: var(--fg);
  white-space: nowrap;
}
.win-pop {
  bottom: 54px;
  left: 0;
  width: 300px;
}
.win-len {
  justify-self: start;
}
.win-len .seg-b {
  padding: 0 10px;
}
.dk-play {
  flex: none;
  display: flex;
  align-items: center;
  gap: 6px;
}
.play {
  width: 38px;
  height: 38px;
  border-color: var(--line-2);
  color: var(--fg);
  background: var(--panel-solid);
}
.speed {
  height: 28px;
  min-width: 52px;
  padding: 0 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--fg-2);
  font: 500 var(--t12) / 1 var(--font-ui);
  font-variant-numeric: tabular-nums;
}
.speed:hover {
  color: var(--fg);
  background: var(--hover);
}
.dk-tl {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}
.tl {
  position: relative;
  flex: 1;
  min-width: 0;
  height: 46px;
}
.tl-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.tl-range {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: ew-resize;
}
.tl:focus-within {
  outline: 1.5px solid var(--fg-2);
  outline-offset: 3px;
  border-radius: 6px;
}
.tl-legend {
  flex: none;
  display: grid;
  gap: 3px;
  font-size: var(--t12);
  line-height: 1.1;
  color: var(--fg-3);
  text-align: right;
  padding-bottom: 12px;
}
.lg-sun {
  color: var(--sun);
}
.lg-earth {
  color: var(--earth);
}
.tl-read {
  flex: none;
  width: 200px;
  display: grid;
  justify-items: end;
  gap: 2px;
  line-height: 1.2;
}
.tl-stamp {
  white-space: nowrap;
  font-family: var(--font-ui);
  font-variant-numeric: tabular-nums;
  font-size: var(--t12);
  color: var(--fg);
}
.tl-rel {
  font-size: var(--t12);
  color: var(--fg-2);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
:root[data-lens="planner"] .tl-stamp,
:root[data-lens="planner"] .when-chip {
  font-family: var(--font-mono);
}
.hint {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 10px);
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: calc(100% - 24px);
  padding: 8px 8px 8px 14px;
  border-radius: 999px;
  background: var(--fg);
  color: var(--bg);
  font-size: var(--t12);
  box-shadow: var(--pop-shadow);
  animation: sugIn 0.25s var(--ease);
}
.hint b {
  font-weight: 600;
}
.hint .icon-btn {
  width: 24px;
  height: 24px;
  border: 0;
  color: var(--bg);
  opacity: 0.75;
}
.hint .icon-btn:hover {
  background: transparent;
  opacity: 1;
  color: var(--bg);
}
.hint .icon-btn svg {
  width: 14px;
  height: 14px;
}

@keyframes sheetUp {
  from {
    transform: translateY(24px);
    opacity: 0;
  }
  to {
    transform: none;
    opacity: 1;
  }
}
.view-missing {
  display: grid;
  place-items: center;
  height: 100%;
  color: var(--fg-3);
  font-size: var(--t15);
}

/* ---------- method sheet ---------- */
.sheet {
  position: fixed;
  z-index: 50;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(520px, 100%);
  display: flex;
  flex-direction: column;
  background: var(--sheet-bg);
  border-left: 1px solid var(--line-2);
  box-shadow: var(--big-shadow);
  animation: sheetIn 0.25s var(--ease);
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
@keyframes sheetIn {
  from {
    transform: translateX(24px);
    opacity: 0;
  }
  to {
    transform: none;
    opacity: 1;
  }
}
.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  padding: 0 max(16px, env(safe-area-inset-right, 0px)) 0 20px;
  border-bottom: 1px solid var(--line);
}
.sheet-title {
  margin: 0;
  font-size: var(--t15);
  font-weight: 500;
}
.sheet-body {
  overflow: auto;
  padding: 20px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 22px;
  align-content: start;
}
.m-sec h3 {
  margin: 0 0 8px;
  font-size: var(--t12);
  font-weight: 500;
  color: var(--fg-3);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.m-sec p {
  margin: 0 0 8px;
  color: var(--fg-2);
  max-width: 62ch;
}
.m-kv {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 16px;
  font-size: var(--t12);
}
.m-kv dt {
  color: var(--fg-3);
}
.m-kv dd {
  margin: 0;
  color: var(--fg);
  min-width: 0;
  overflow-wrap: anywhere;
}
.m-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: var(--t12);
}
.m-table th,
.m-table td {
  text-align: right;
  padding: 5px 6px;
  border-bottom: 1px solid var(--line);
}
.m-table th:first-child,
.m-table td:first-child {
  text-align: left;
}
.m-table th {
  color: var(--fg-3);
  font-weight: 400;
}
.m-wrap {
  overflow-x: auto;
  min-width: 0;
}
.m-card {
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
  background: var(--bg);
}
.m-card svg {
  display: block;
  width: 100%;
  height: auto;
}
.m-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ---------- loading / toast ---------- */
.loading {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 14px;
  background: var(--bg);
  transition: opacity 0.5s var(--ease);
}
.loading.out {
  opacity: 0;
  pointer-events: none;
}
.loading-mark {
  width: 120px;
  height: 120px;
}
.loading-word {
  font-size: var(--t12);
  letter-spacing: 0.32em;
  color: var(--fg);
}
.loading-text {
  font-size: var(--t12);
  color: var(--fg-3);
}
.opener-host {
  position: fixed;
  inset: 0;
  z-index: 55;
}
.toast {
  position: fixed;
  z-index: 70;
  left: 50%;
  bottom: calc(var(--dock-h) + 16px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  padding: 9px 14px;
  border-radius: 999px;
  background: var(--fg);
  color: var(--bg);
  font-size: var(--t12);
  font-weight: 500;
  box-shadow: var(--pop-shadow);
}

/* ---------- ask ---------- */
.ask-btn svg {
  width: 16px;
  height: 16px;
}
.ask-btn {
  font-size: var(--t12);
  font-weight: 500;
}
.ask-btn[aria-expanded="true"] {
  background: var(--fg);
  color: var(--bg);
  border-color: var(--fg);
}
.ask {
  position: fixed;
  z-index: 45;
  right: calc(max(16px, env(safe-area-inset-right, 0px)) + var(--panel-right, 0px));
  bottom: calc(var(--dock-h) + 12px + env(safe-area-inset-bottom, 0px));
  width: min(420px, calc(100% - 32px));
  max-height: min(620px, calc(100% - var(--bar-h) - var(--dock-h) - 36px));
  display: flex;
  flex-direction: column;
  background: var(--panel-solid);
  border: 1px solid var(--line-2);
  border-radius: 14px;
  box-shadow: var(--big-shadow);
  animation: palIn2 0.2s var(--ease);
}
@keyframes palIn2 {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
.ask-head {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 48px;
  padding: 0 8px 0 16px;
  border-bottom: 1px solid var(--line);
}
.ask-title {
  font-size: var(--t15);
  font-weight: 500;
}
.ask-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  overflow-x: hidden;
  padding: 14px 16px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  align-content: start;
}
.ask-intro {
  margin: 0;
  font-size: var(--t12);
  color: var(--fg-2);
}
.ask-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.ask-chip {
  border: 1px solid var(--line-2);
  background: var(--bg);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: var(--t12);
  color: var(--fg);
  text-align: left;
}
.ask-chip:hover {
  background: var(--hover);
}
.ask-log {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}
.ask-msg {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: var(--t15);
  line-height: 1.45;
}
.ask-msg.user {
  justify-self: end;
  max-width: 85%;
  background: var(--bg-2);
  border-radius: 12px 12px 4px 12px;
  padding: 8px 12px;
}
.ask-msg.bot {
  color: var(--fg);
  background: color-mix(in srgb, var(--fg) 4%, var(--panel-solid));
  border-radius: 12px 12px 12px 4px;
  padding: 10px 12px;
  line-height: 1.55;
}
.ask-msg.pending {
  color: var(--fg-3);
}
.ask-act {
  font-size: var(--t12);
  color: var(--fg-3);
  font-family: var(--font-ui);
  padding-left: 14px;
  position: relative;
}
.ask-act::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 0.55em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--fg-3);
}
.ask-engine {
  margin-left: auto;
  margin-right: 4px;
  height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  background: var(--bg);
  color: var(--fg-2);
  font-size: var(--t12);
  font-weight: 500;
}
.ask-engine::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: 1px;
  background: var(--both);
}
.ask-engine[data-engine="offline"]::before {
  background: var(--fg-3);
}
.ask-engine:hover {
  color: var(--fg);
}
.ask-set {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  min-width: 0;
  gap: 8px;
  padding: 12px;
  border-radius: 12px;
  background: var(--bg-2);
}
.ask-set[hidden] {
  display: none;
}
.ask-set-row {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.ask-set-row button {
  height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  background: var(--bg);
  color: var(--fg-2);
  font-size: var(--t12);
}
.ask-set-row button[aria-pressed="true"] {
  background: var(--fg);
  color: var(--bg);
  border-color: var(--fg);
}
.ask-set-row button[hidden] {
  display: none;
}
.ask-set-note {
  margin: 0;
  font-size: var(--t12);
  line-height: 1.4;
  color: var(--fg-2);
}
.ask-key {
  display: flex;
  gap: 6px;
}
.ask-key input {
  flex: 1;
  min-width: 0;
  height: 32px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  background: var(--bg);
  font-size: 16px;
}
.ask-key .btn {
  height: 32px;
  flex: none;
  padding: 0 12px;
}
.ask-note {
  margin-top: 6px;
  font-size: var(--t12);
  color: var(--fg-3);
}
.ask-form {
  flex: none;
  display: flex;
  gap: 8px;
  padding: 10px;
  border-top: 1px solid var(--line);
}
.ask-form input {
  flex: 1;
  min-width: 0;
  height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  background: var(--bg);
  font-size: var(--t15);
  outline: none;
}
.ask-form input:focus {
  border-color: var(--fg-3);
}
.ask-form .btn {
  height: 36px;
}
.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- global terrain loading status ---------- */
.bar-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 28px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--hover);
  color: var(--fg-2);
  font-size: var(--t12);
  white-space: nowrap;
}
.spin {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1.5px solid var(--line-2);
  border-top-color: var(--fg-2);
  animation: spin 0.9s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.app[data-view="home"] .bar-status {
  display: none;
}
/* narrower: float just under the bar (the bar's backdrop-filter makes it the containing block) */
@media (max-width: 1180px) {
  .bar-status {
    position: absolute;
    z-index: 25;
    left: 50%;
    top: calc(100% + 8px);
    transform: translateX(-50%);
    box-shadow: var(--pop-shadow);
    background: var(--pop-bg);
  }
}

/* ---------- dock glance chips ---------- */
.dk-glance {
  flex: none;
  display: grid;
  gap: 4px;
  justify-items: start;
}
.gl {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 22px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: var(--t12);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.gl::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.gl-sun {
  color: var(--sun);
  background: var(--sun-soft);
}
.gl-earth {
  color: var(--earth);
  background: var(--earth-soft);
}
.gl.down {
  opacity: 0.75;
}
.gl.down::before {
  background: transparent;
  box-shadow: inset 0 0 0 1.4px currentColor;
}
.gl:empty {
  display: none;
}

/* ---------- #home: hero + story (space theme in both themes) ---------- */
.app[data-view="home"] {
  grid-template-rows: var(--bar-h) 1fr 0;
  background: #000;
}
.app[data-view="home"] .dock {
  display: none;
}
.app[data-view="home"] .search,
.app[data-view="home"] .when,
.app[data-view="home"] .ask-btn,
.app[data-view="home"] .seg {
  display: none;
}
.app[data-view="home"] .bar,
.view-home {
  --bg: #000;
  --bg-2: #161617;
  --panel-solid: #1d1d1f;
  --panel-2: #161617;
  --fg: #f5f5f7;
  --fg-2: #a1a1a6;
  --fg-3: #86868b;
  --line: #424245;
  --line-2: #5a5a5e;
  --hover: rgba(255, 255, 255, 0.06);
  --active: rgba(255, 255, 255, 0.1);
  --accent: #f5f5f7;
  --accent-fg: #000;
  --sun: #f2b64a;
  --earth: #7fb8c9;
  --both: #8fcfa8;
  --risk: #ff6b5e;
  color-scheme: dark;
}
.app[data-view="home"] .bar {
  background: rgba(0, 0, 0, 0.72);
  border-bottom-color: rgba(255, 255, 255, 0.08);
  color: var(--fg);
}
.app[data-view="home"] .tabs {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.08);
}
.view-home {
  overflow-y: auto;
  overflow-x: hidden;
  background: #000;
  color: var(--fg);
  scroll-behavior: smooth;
  overscroll-behavior: contain;
}
.hero {
  position: relative;
  height: 100%;
  min-height: 520px;
  overflow: hidden;
  background: radial-gradient(1200px 700px at 70% 30%, rgba(242, 182, 74, 0.07), transparent 60%), #000;
}
.hero > .hero-stage,
.hero > .hero-stage.in-host {
  position: absolute;
  inset: 0;
}
.hero-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  text-align: center;
  gap: 18px;
  padding: 24px;
}
.hf-moon {
  width: min(36vh, 280px);
  aspect-ratio: 1;
  border-radius: 50%;
  margin-bottom: 8px;
  background: radial-gradient(circle at 30% 35%, #d9d6cf 0, #a19d94 38%, #4a4844 70%, #111 100%);
  box-shadow: -30px -10px 80px rgba(242, 182, 74, 0.12);
  animation: hfIn 1.2s var(--ease) both;
}
.hf-title {
  margin: 0;
  font-size: clamp(48px, 9vw, 80px);
  line-height: 1.02;
  font-weight: 600;
  letter-spacing: -0.025em;
  animation: hfIn 1s 0.15s var(--ease) both;
}
.hf-line {
  margin: 0;
  max-width: 34ch;
  font-size: clamp(19px, 2.4vw, 24px);
  line-height: 1.3;
  color: var(--fg-2);
  animation: hfIn 1s 0.3s var(--ease) both;
}
.hero-fallback .pill {
  animation: hfIn 1s 0.45s var(--ease) both;
}
@keyframes hfIn {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
.pill {
  height: 44px;
  padding: 0 24px;
  border-radius: 999px;
  border: 0;
  background: var(--accent);
  color: var(--accent-fg);
  font-size: 17px;
  font-weight: 500;
  letter-spacing: -0.01em;
  transition:
    transform 0.3s var(--ease),
    opacity 0.3s var(--ease);
}
.pill:hover {
  transform: scale(1.03);
}
.pill.big {
  height: 52px;
  padding: 0 30px;
  font-size: 19px;
}
.hero-scroll {
  position: absolute;
  z-index: 4;
  right: max(20px, env(safe-area-inset-right, 0px));
  bottom: 18px;
  display: grid;
  justify-items: center;
  gap: 2px;
  border: 0;
  background: transparent;
  color: var(--fg-3);
  font-size: var(--t12);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.hero-scroll svg {
  width: 20px;
  height: 20px;
  animation: bob 2.4s var(--ease) infinite;
}
.hero-scroll:hover {
  color: var(--fg);
}
@keyframes bob {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(5px);
  }
}
.story {
  position: relative;
  padding: 0 max(24px, env(safe-area-inset-left, 0px)) 40px;
  background: #000;
  isolation: isolate;
}
.st-sec {
  max-width: 1080px;
  margin: 0 auto;
  padding: 120px 0 40px;
  position: relative;
}
.eyebrow {
  margin: 0 0 12px;
  font-size: var(--t15);
  font-weight: 600;
  color: var(--sun);
  letter-spacing: -0.005em;
}
.st-h {
  margin: 0 0 20px;
  font-size: clamp(36px, 5.6vw, 64px);
  line-height: 1.05;
  font-weight: 600;
  letter-spacing: -0.025em;
  text-wrap: balance;
}
.hero::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 180px;
  background: linear-gradient(180deg, transparent, #000);
  pointer-events: none;
  z-index: 3;
}
.st-lede {
  margin: 0 0 40px;
  max-width: 680px;
  font-size: clamp(17px, 1.8vw, 21px);
  line-height: 1.45;
  color: var(--fg-2);
}
.cards {
  display: grid;
  gap: 16px;
  margin-top: 40px;
}
.cards.c4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.cards.c3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.cards.c2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.card {
  position: relative;
  padding: 26px 24px;
  border-radius: var(--r-card);
  background: #161617;
  border: 1px solid rgba(255, 255, 255, 0.06);
  overflow: hidden;
}
.card h3 {
  margin: 0 0 8px;
  font-size: var(--t19);
  line-height: 1.25;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.card p {
  margin: 0;
  font-size: var(--t15);
  line-height: 1.45;
  color: var(--fg-2);
}
.card.big {
  padding: 34px 30px;
  min-height: 240px;
  display: flex;
  flex-direction: column;
}
.card.big h3 {
  font-size: var(--t24);
}
.card.big .link {
  margin-top: auto;
  padding-top: 18px;
}
.q-num {
  font: 600 var(--t12) / 1 var(--font-ui);
  font-variant-numeric: tabular-nums;
  color: var(--fg-3);
  margin-bottom: 22px;
}
.card-ic {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  margin-bottom: 18px;
}
.ic-sun {
  background: radial-gradient(circle, var(--sun) 0 30%, rgba(242, 182, 74, 0.18) 32% 100%);
}
.ic-night {
  background: radial-gradient(circle at 65% 40%, #161617 0 34%, transparent 36%),
    radial-gradient(circle, #a1a1a6 0 48%, rgba(161, 161, 166, 0.15) 50% 100%);
}
.ic-earth {
  background: radial-gradient(circle, var(--earth) 0 32%, rgba(127, 184, 201, 0.18) 34% 100%);
}
.ic-slip {
  background: conic-gradient(from 0deg, var(--risk) 0 25%, rgba(255, 107, 94, 0.15) 25% 100%);
}
.link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--fg);
  font-size: var(--t15);
  font-weight: 500;
}
.link svg {
  width: 14px;
  height: 14px;
  transition: transform 0.3s var(--ease);
}
.link:hover svg {
  transform: translateX(3px);
}
.live {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 28px;
  padding: 10px 16px;
  border-radius: 999px;
  background: #161617;
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: var(--t15);
  color: var(--fg-2);
}
.live b {
  color: var(--fg);
  font-weight: 600;
}
.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--both);
  box-shadow: 0 0 0 0 rgba(143, 207, 168, 0.6);
  animation: pulse 2s infinite;
  flex: none;
}
@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(143, 207, 168, 0.5);
  }
  70% {
    box-shadow: 0 0 0 9px rgba(143, 207, 168, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(143, 207, 168, 0);
  }
}
.pipe {
  list-style: none;
  margin: 40px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  position: relative;
}
.pipe-step {
  padding: 26px 22px;
  border-radius: var(--r-card);
  background: #161617;
  border: 1px solid rgba(255, 255, 255, 0.06);
  position: relative;
}
.pipe-step:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 44px;
  right: -17px;
  width: 18px;
  height: 1.5px;
  background: linear-gradient(90deg, var(--line-2), var(--sun));
}
.pipe-step h3 {
  margin: 14px 0 8px;
  font-size: var(--t19);
  font-weight: 600;
}
.pipe-step p {
  margin: 0;
  font-size: var(--t15);
  color: var(--fg-2);
  line-height: 1.45;
}
.pipe-n,
.step-n {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--fg);
  color: #000;
  font-weight: 600;
  font-size: var(--t15);
}
.stat .stat-v {
  font-size: clamp(36px, 4.4vw, 48px);
  line-height: 1.05;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 12px;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(180deg, #fff, #a1a1a6);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.src {
  list-style: none;
  margin: 40px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 32px;
}
.src li {
  display: grid;
  gap: 4px;
  padding: 20px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}
.src b {
  font-size: var(--t19);
  font-weight: 600;
}
.src span {
  color: var(--fg-2);
  font-size: var(--t15);
}
.steps {
  list-style: none;
  margin: 40px 0 0;
  padding: 0;
  display: grid;
  gap: 12px;
}
.step {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 20px;
  padding: 22px 26px;
  border-radius: var(--r-card);
  background: #161617;
  border: 1px solid rgba(255, 255, 255, 0.06);
}
.step h3 {
  margin: 0 0 4px;
  font-size: var(--t19);
  font-weight: 600;
}
.step p {
  margin: 0;
  color: var(--fg-2);
  font-size: var(--t15);
}
.team .card {
  text-align: center;
}
.avatar {
  display: grid;
  place-items: center;
  font-size: var(--t24);
  font-weight: 600;
  color: var(--fg-2);
}
.team .card.is-todo {
  border: 1px dashed rgba(242, 182, 74, 0.5);
}
.team .card.is-todo h3,
.team .card.is-todo p {
  color: var(--sun);
}
.avatar {
  width: 72px;
  height: 72px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2c2c2e, #1d1d1f);
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.st-end {
  max-width: 1080px;
  margin: 0 auto;
  padding: 140px 0 60px;
  display: grid;
  justify-items: center;
  text-align: center;
  gap: 10px;
}
.st-foot {
  margin: 60px 0 0;
  color: var(--fg-3);
  font-size: var(--t12);
}

/* ---------- home: parallax ---------- */
.px-sky {
  position: sticky;
  top: 0;
  height: 100vh;
  margin: 0 calc(-1 * max(24px, env(safe-area-inset-left, 0px))) -100vh;
  overflow: hidden;
  pointer-events: none;
  z-index: -1;
}
.px-l {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: calc(100vh + 520px);
  will-change: translate;
}
/* far layer: the real NASA SVS star map (same file the globe uses), drifting slowest */
.px-l.l1 {
  height: calc(100vh + 1024px);
  background: url(../data/stars.jpg) 0 0 / 2048px 1024px repeat;
  opacity: 0.6;
}
.px-l.l2 {
  background: radial-gradient(1.2px 1.2px at 22% 32%, rgba(255, 255, 255, 0.55), transparent),
    radial-gradient(1.2px 1.2px at 74% 14%, rgba(255, 255, 255, 0.5), transparent),
    radial-gradient(1.2px 1.2px at 51% 88%, rgba(220, 230, 255, 0.45), transparent);
  background-size: 380px 380px;
}
.px-l.l3 {
  background: radial-gradient(1.6px 1.6px at 30% 60%, rgba(255, 255, 255, 0.8), transparent),
    radial-gradient(1.8px 1.8px at 81% 35%, rgba(255, 240, 220, 0.7), transparent);
  background-size: 260px 260px;
  opacity: 0.7;
}
.px-body {
  position: absolute;
  pointer-events: none;
  border-radius: 50%;
  z-index: -1;
  will-change: translate;
}
/* Moon and Earth turn slowly: the NASA texture (2:1, one full turn = 200 % of the disc) slides behind a round mask */
.px-moon {
  width: min(46vw, 520px);
  aspect-ratio: 1;
  right: -14%;
  top: 40px;
  background: url(../data/moon_color.jpg) 0% 50%/200% 100% repeat-x;
  animation: pxTurn 240s linear infinite;
  filter: grayscale(1) brightness(0.75) contrast(1.1);
  opacity: 0.55;
  box-shadow:
    inset -70px -30px 120px 40px #000,
    inset 10px 6px 40px rgba(255, 236, 200, 0.18);
  -webkit-mask: radial-gradient(circle, #000 69%, transparent 71%);
  mask: radial-gradient(circle, #000 69%, transparent 71%);
}
.px-earth {
  width: min(22vw, 230px);
  aspect-ratio: 1;
  left: -12%;
  top: 300px;
  background: url(../data/earth.jpg) 0% 50%/200% 100% repeat-x;
  animation: pxTurn 90s linear infinite;
  opacity: 0.5;
  box-shadow:
    inset 40px 10px 60px 10px #000,
    0 0 60px rgba(127, 184, 201, 0.25);
  -webkit-mask: radial-gradient(circle, #000 69%, transparent 71%);
  mask: radial-gradient(circle, #000 69%, transparent 71%);
}
@keyframes pxTurn {
  from {
    background-position-x: 200%;
  }
  to {
    background-position-x: 0%;
  }
}
/* "How it works": the skyline ray-traced over the real relief, then unrolled */
.rt {
  margin: 36px 0 28px;
  padding: 0;
}
.rt-cv {
  display: block;
  width: 100%;
  aspect-ratio: 2.3;
  border-radius: 18px;
  background: #0b0b0c;
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.rt-cap {
  margin: 10px 2px 0;
  max-width: 820px;
  font-size: var(--t12);
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.55);
}
@media (max-width: 640px) {
  .rt-cv {
    aspect-ratio: 0.82;
  }
}
@media (prefers-reduced-motion: reduce) {
  .px-moon,
  .px-earth {
    animation: none;
  }
}
.px-sunglow {
  width: 640px;
  height: 640px;
  right: -200px;
  top: -120px;
  background: radial-gradient(circle, rgba(242, 182, 74, 0.22), rgba(242, 182, 74, 0.06) 35%, transparent 65%);
}
.px-horizon {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 100vw;
  height: 340px;
  transform: translateX(-50%);
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
  background: radial-gradient(120% 90% at 50% 120%, #1d1d1f 0 45%, transparent 46%);
}
.px-hz-sun {
  position: absolute;
  left: 50%;
  top: 110px;
  width: 420px;
  height: 420px;
  margin-left: -210px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 240, 210, 0.9) 0 3%, rgba(242, 182, 74, 0.35) 6%, transparent 55%);
  will-change: translate;
}
.st-end {
  position: relative;
}
/* card spotlight + lift */
.card,
.pipe-step,
.step {
  transition:
    transform 0.45s var(--ease),
    border-color 0.3s var(--ease),
    background 0.3s var(--ease);
}
.card::before,
.pipe-step::before,
.step::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s;
  background: radial-gradient(
    360px circle at var(--mx, 50%) var(--my, 50%),
    rgba(255, 255, 255, 0.07),
    transparent 60%
  );
}
.step {
  position: relative;
  overflow: hidden;
}
.card:hover::before,
.pipe-step:hover::before,
.step:hover::before {
  opacity: 1;
}
.card.rv.in:hover,
.pipe-step.rv.in:hover {
  transform: translateY(-4px);
  border-color: rgba(255, 255, 255, 0.14);
}
.step.rv.in:hover {
  transform: translateX(4px);
  border-color: rgba(255, 255, 255, 0.14);
}
/* headings: soft gradient that settles in as they reveal */
.st-h.rv {
  background: linear-gradient(100deg, #fff 0 45%, #8e8e93 60%, #fff 75%);
  background-size: 260% 100%;
  background-position: 100% 0;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  transition:
    opacity 0.7s var(--ease) var(--d, 0ms),
    transform 0.7s var(--ease) var(--d, 0ms),
    background-position 1.6s var(--ease) 0.1s;
}
.st-h.rv.in {
  background-position: 0 0;
}
.pipe-step:not(:last-child)::after {
  transform-origin: left;
  transform: scaleX(0);
  transition: transform 0.8s var(--ease) 0.5s;
}
.pipe-step.in:not(:last-child)::after {
  transform: scaleX(1);
}
/* ---------- home: scroll scene ---------- */
.scrolly {
  position: relative;
  height: 280vh;
  margin: 0 calc(-1 * max(24px, env(safe-area-inset-left, 0px)));
}
.sy-pin {
  position: sticky;
  top: 0;
  /* the home scroller's own height (it sits below the top bar); home.js keeps --home-h current */
  height: var(--home-h, 100vh);
  overflow: hidden;
}
.sy-cv {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}
.sy-foot {
  position: absolute;
  left: max(24px, 6vw);
  right: max(24px, 6vw);
  bottom: 18px;
}
.sy-strip {
  display: block;
  width: 100%;
  height: 12px;
  border-radius: 3px;
}
.sy-cap {
  margin: 8px 0 0;
  font-size: var(--t12);
  line-height: 1.4;
  color: rgba(255, 255, 255, 0.55);
}
.sy-copy {
  position: absolute;
  left: max(24px, 6vw);
  top: 11vh;
  width: min(640px, calc(100% - 48px));
}
.sy-h {
  position: relative;
  min-height: 2.25em;
  font-size: clamp(30px, 4.4vw, 56px);
}
.sy-t {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  opacity: 0;
  transform: translateY(18px);
  transition:
    opacity 0.6s var(--ease),
    transform 0.6s var(--ease);
}
.sy-t.on {
  opacity: 1;
  transform: none;
}
.sy-hud {
  position: absolute;
  right: max(24px, 6vw);
  top: calc(11vh + 26px);
  display: grid;
  gap: 8px;
  padding: 14px 16px;
  width: 250px;
  border-radius: 14px;
  background: rgba(22, 22, 23, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: var(--t15);
}
.sy-row {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--fg-2);
}
.sy-row b {
  margin-left: auto;
  color: var(--fg);
  font-weight: 600;
  transition: color 0.3s;
}
.sy-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.sy-dot.sun {
  background: var(--sun);
}
.sy-dot.earth {
  background: var(--earth);
}
.is-night .sy-row b.sy-sun-v {
  color: var(--risk);
}
.sy-when-v {
  font-variant-numeric: tabular-nums;
}
@media (max-width: 900px) {
  .sy-hud {
    top: auto;
    bottom: 92px;
    right: max(24px, 6vw);
    left: max(24px, 6vw);
    width: auto;
    gap: 4px;
    padding: 10px 14px;
  }
}
@media (max-width: 600px) {
  .scrolly {
    height: 240vh;
  }
  .sy-copy {
    top: 9vh;
  }
  .sy-hud {
    font-size: 12px;
    bottom: 100px;
    padding: 9px 12px;
  }
  .sy-row b {
    white-space: nowrap;
  }
  .px-moon {
    opacity: 0.35;
  }
  .px-earth {
    display: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  .st-h.rv {
    background: none;
    color: var(--fg);
  }
  .card,
  .pipe-step,
  .step {
    transition: none;
  }
}
/* scroll reveal */
.rv {
  opacity: 0;
  transform: translateY(28px) scale(0.985);
  transition:
    opacity 0.7s var(--ease) var(--d, 0ms),
    transform 0.7s var(--ease) var(--d, 0ms);
}
.rv.in {
  opacity: 1;
  transform: none;
}
@media (max-width: 900px) {
  .cards.c4,
  .cards.c3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .pipe {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .pipe-step::after {
    display: none;
  }
}
@media (max-width: 600px) {
  .hero-scroll {
    display: none;
  }
  .cards.c4,
  .cards.c3,
  .cards.c2,
  .pipe,
  .src {
    grid-template-columns: minmax(0, 1fr);
  }
  .st-sec {
    padding-top: 80px;
  }
  .step {
    grid-template-columns: auto minmax(0, 1fr);
  }
  .step .link {
    grid-column: 2;
  }
  .live {
    border-radius: 16px;
    align-items: flex-start;
  }
  .card.big {
    min-height: 0;
  }
}

/* ---------- narrower desktops ---------- */
@media (max-width: 1180px) {
  .brand-word {
    display: none;
  }
  .when-chip {
    padding: 0 10px;
  }
}
@media (max-width: 1000px) {
  .search-kbd {
    display: none;
  }
  .when {
    display: none;
  }
  .tl-legend {
    display: none;
  }
  .dk-glance {
    display: none;
  }
  .tl-read {
    width: auto;
  }
}

/* ---------- phone ---------- */
@media (max-width: 820px) {
  :root {
    --bar-h: 112px;
    --dock-h: 88px;
  }
  .app[data-view="home"] {
    --bar-h: 56px;
  }
  .app[data-view="home"] .bar-break {
    display: none !important;
  }
  .app[data-view="home"] .brand {
    display: flex !important;
  }
  .app[data-view="home"] .tabs {
    flex: 0 1 auto;
    margin-left: auto;
  }
  .dk-glance {
    display: none;
  }
  .bar {
    flex-wrap: wrap;
    align-content: center;
    row-gap: 8px;
    column-gap: 8px;
  }
  .search {
    order: 0;
    flex: 1 1 0;
    max-width: none;
    margin-left: 0;
    height: 38px;
  }
  /* .bar has backdrop-filter, so it is the containing block of this "fixed" box: place it under the bar's first row
     and size it from the viewport, not from the bar (that gave max-height ≤ 0 = invisible on phones) */
  .search {
    position: static;
  }
  .sug-foot {
    display: none;
  }
  .suggest {
    position: absolute;
    top: 58px;
    left: 8px;
    right: 8px;
    width: auto;
    max-height: calc(100dvh - 58px - 16px - env(safe-area-inset-top, 0px));
  }
  .ask-btn {
    order: 1;
    padding: 0 10px;
    height: 38px;
  }
  .ask-btn span {
    display: none;
  }
  .bar-break {
    display: block;
    order: 3;
    flex-basis: 100%;
    height: 0;
  }
  .tabs {
    order: 4;
    margin-left: 0;
    flex: 1 1 0;
    min-width: 0;
  }
  .tab {
    flex: 1;
    justify-content: center;
    padding: 0 6px;
    white-space: nowrap;
  }
  /* 44 px tap targets: row 1 = search + theme + info, row 2 = tabs + lens */
  .bar-right {
    display: contents;
  }
  #themeBtn {
    order: 1;
  }
  #methodBtn {
    order: 2;
  }
  .ask-btn {
    order: 1;
  }
  .seg {
    order: 5;
  }
  .search,
  .ask-btn {
    height: 44px;
  }
  .icon-btn {
    width: 44px;
    height: 44px;
  }
  .tabs,
  .seg {
    padding: 0;
  }
  .tab {
    height: 44px;
  }
  .seg-b {
    height: 44px;
    padding: 0 10px;
  }
  .brand {
    display: none;
  }
  .dock {
    display: grid;
    grid-template-columns: auto auto minmax(0, 1fr);
    grid-template-rows: 34px 40px;
    grid-template-areas: "win play read" "tl tl tl";
    align-content: center;
    gap: 4px 8px;
    padding-left: max(10px, env(safe-area-inset-left, 0px));
    padding-right: max(10px, env(safe-area-inset-right, 0px));
  }
  .dk-win {
    grid-area: win;
    align-self: center;
  }
  .dk-winbtn {
    display: flex;
    align-items: baseline;
    gap: 6px;
    height: 32px;
    padding: 0 24px 0 10px;
    border-radius: 999px;
  }
  .dk-winbtn::after {
    right: 10px;
  }
  .dk-k {
    font-size: 11px;
    letter-spacing: 0.04em;
  }
  .no-phone {
    display: none;
  }
  .dk-v {
    font-size: var(--t12);
    font-family: var(--font-ui);
    font-variant-numeric: tabular-nums;
  }
  .dk-play {
    grid-area: play;
    gap: 2px;
  }
  .play {
    width: 32px;
    height: 32px;
  }
  .speed {
    height: 28px;
    min-width: 0;
    padding: 0 6px;
    border: 0;
    font-size: var(--t12);
  }
  .dk-tl {
    grid-area: tl;
  }
  .tl {
    height: 40px;
  }
  .tl-read {
    grid-area: read;
    width: auto;
    max-width: none;
    min-width: 0;
    justify-items: end;
    align-self: center;
  }
  .tl-read .dk-k {
    display: none;
  }
  .tl-stamp,
  .tl-rel {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .tl-rel {
    font-size: 11px;
  }
  .win-pop {
    position: fixed;
    left: 8px;
    right: 8px;
    width: auto;
    bottom: calc(var(--dock-h) + 8px + env(safe-area-inset-bottom, 0px));
  }
  .hint {
    border-radius: 12px;
    width: calc(100% - 16px);
  }
  .ask {
    left: 0;
    right: 0;
    width: auto;
    top: calc(var(--bar-h) + 8px);
    bottom: 0;
    max-height: none;
    border-radius: 18px 18px 0 0;
    border-bottom: 0;
    z-index: 60;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
