/* Look up leaves the simulated sky visible around one sheet. */
.cust-wrap.lu-wrap { place-items: end end; padding: 24px; background: none; overflow: hidden; }
.cust.lu { width: min(320px, 100%); padding: 0; border: 0; border-radius: 0; background: none; box-shadow: none; overflow: visible; }
.lu-masthead {
  position: fixed; inset: 0 0 auto;
  display: flex; justify-content: space-between; align-items: baseline; gap: 8px;
  padding: calc(16px + env(safe-area-inset-top, 0px)) 20px 20px;
  color: #f3eee7; background: linear-gradient(#070b12e6, #070b1200);
}
.lu-masthead strong { font: 700 24px/28px var(--f-body); }
.lu-masthead span { font: 600 14px/20px var(--f-body); color: #adb9c9; }
.lu-sheet {
  padding: 16px; max-height: calc(100dvh - 100px); overflow-y: auto; overscroll-behavior: contain;
  border-radius: var(--r-panel); border-top: 1px solid var(--atlas-rule);
  background: var(--atlas-sheet); color: var(--atlas-ink);
  animation: na-state-in var(--motion-state) ease-out both;
}
.lu h2 { margin: 0; font: 700 20px/24px var(--f-body); }
.lu h2:focus { outline: none; }
.lu-place, .lu .cust-intro { margin: 8px 0 0; color: var(--atlas-slate); font-size: 14px; line-height: 20px; }
.lu-place time { font-variant-numeric: tabular-nums; }
.lu-list { list-style: none; margin: 8px 0 0; padding: 0; }
.lu-list .lu-item { max-width: none; display: flex; align-items: center; gap: 4px; border-top: 1px solid var(--atlas-rule); }
.lu-main {
  flex: 1; min-width: 0; min-height: 48px; padding: 4px 0;
  display: flex; align-items: center; gap: 8px; text-align: start;
  border: 0; background: none; color: inherit; font: inherit; cursor: pointer;
}
.lu-main svg { margin-inline-start: auto; width: 20px; height: 20px; flex: none; color: var(--atlas-slate); }
.lu-main:hover svg { color: var(--atlas-ember); }
.lu-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.lu-txt { min-width: 0; display: grid; }
.lu-txt b { font: 700 16px/20px var(--f-body); }
.lu-where { font: 600 14px/20px var(--f-body); color: var(--atlas-slate); }
.lu .cust-acts { display: flex; flex-wrap: wrap; gap: 4px; padding-top: 8px; border-top: 1px solid var(--atlas-rule); }
body.immersive.lu-up .chartwrap > :is(.hud, .zoom, .aimbar, #selcard, .sky-sheet, #sky-target) { visibility: hidden; }
@media (max-width: 640px) {
  .cust-wrap.lu-wrap { place-items: end stretch; padding: 0; }
  .cust.lu { width: 100%; }
  .lu-sheet { max-height: 45dvh; padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px)); border-radius: 20px 20px 0 0; }
  body.immersive .chartwrap { transition: transform var(--motion-state) var(--ease); }
  body.immersive.lu-up .chartwrap { transform: translateY(-19%); }
}

/* Shared type, surfaces and controls for the atlas screens. */
:root {
  --atlas-page: light-dark(#f5f2eb, #0b1018);
  --atlas-ink: light-dark(#16202c, #f3eee7);
  --atlas-slate: light-dark(#4d5969, #adb9c9);
  --atlas-ember: light-dark(#8e411a, #ffaa70);
  --atlas-on-ember: light-dark(#f3eee7, #0b1018);
  --atlas-rule: light-dark(#ccc6bc, #30415b);
  --atlas-sheet: color-mix(in srgb, var(--atlas-page) 92%, light-dark(#fff, #070b12));
}
body:has(.app) { background: var(--atlas-page); color: var(--atlas-ink); }
.top { gap: 4px 12px; }
.top .brand { gap: 8px; }
.top .brand svg { width: 28px; height: 28px; border-radius: 6px; box-shadow: none; }
.top .brand h1 { font: 700 24px/28px var(--f-body); letter-spacing: -.025em; }
.top :is(.ver, .brand .sub, .display-settings [data-quality-current]) { display: none; }
.top .top-ctl .display-settings { display: inline-flex; align-items: center; }
.top .display-settings svg { display: none; width: 19px; height: 19px; flex: none; }
.top .sel { background: none; border: 0; padding: 0; }
.top .sel select { min-height: 44px; color: var(--atlas-ink); }
.top .place-note { color: var(--atlas-slate); }
:is(.top, .lu, .mars-facts-scroll, .sp-facts-head, .sp-gal-facts-head, .world-directory) .btn,
.chartwrap[data-view="earth"] .ea-card .btn, #tp-learn .btn, #display-quality .btn {
  min-height: 44px; padding: 0 12px; border: 1px solid transparent; border-radius: 12px;
  background: none; color: var(--atlas-ink); font: 600 14px/20px var(--f-body); white-space: normal;
}
:is(.lu, .mars-facts-scroll, .ea-card, #tp-learn) .btn.on,
.ea-ui .ea-card .btn[data-ea="sky"].on {
  background: var(--atlas-ember); color: var(--atlas-on-ember); border-color: transparent;
}
:where(.top, .lu, .ea-card, .mars-facts-scroll, .world-directory, #tp-learn) .btn:hover:not(.on) {
  color: var(--atlas-ember);
}
.top .btn:focus-visible, .lu :focus-visible, #tp-learn :focus-visible, #display-quality :focus-visible {
  outline: 2px solid var(--atlas-ember); outline-offset: -2px;
}
.stage[data-view="earth"] > .viewbar { gap: 4px; flex-wrap: nowrap; }
.stage[data-view="earth"] > .viewbar > .vtab {
  min-height: 44px; flex: none; white-space: nowrap; border: 0; border-radius: 0;
  background: none; color: var(--atlas-slate); font: 600 14px/20px var(--f-body);
}
.stage[data-view="earth"] > .viewbar > .vtab[aria-selected="true"] {
  color: var(--atlas-ember); box-shadow: inset 0 -2px currentColor;
}
body.immersive .stage[data-view="earth"] > .viewbar {
  --atlas-slate: #f3eee7; --atlas-ember: #ffaa70;
  background: linear-gradient(#070b12eb, #070b1200); color: var(--atlas-slate);
}
.stage[data-view="earth"] > .viewbar > :is(.vb-red,.vb-full,.vb-find) {
  min-height: 44px; background: none; color: inherit; border: 0; backdrop-filter: none; -webkit-backdrop-filter: none;
}
.sp-ui:not([data-flight], [data-guided]) > .sp-top :is(.sp-mode, .btn) { background: none; border-color: transparent; box-shadow: none; }
.sp-ui:not([data-flight], [data-guided]) > .sp-top .btn { min-height: 44px; }
.sp-ui:not([data-flight], [data-guided]) > .sp-top .sp-mode .btn[aria-pressed="true"] {
  color: #ffaa70; box-shadow: inset 0 -2px #ffaa70;
}
@media (max-width: 560px) {
  .top { column-gap: 2px; }
  .top .whats-new-entry { padding-inline: 4px; font-size: var(--text-caption); white-space: nowrap; }
  .top .top-ctl-toggle {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 44px; padding-inline: 4px; margin-inline-start: auto;
  }
  .top .top-ctl { display: contents; }
  .top .top-ctl .display-settings {
    flex: none; width: 44px; padding: 0; gap: 0; font-size: 0; justify-content: center;
  }
  /* Search is a field on a row of its own, never a lone icon: wide enough that it cannot share the brand's row. */
  .top .top-ctl .find-trigger {
    flex: 1 1 calc(100% - 100px); min-width: 0; width: auto; min-height: 44px; padding-inline: 12px; gap: 8px; justify-content: flex-start;
  }
  .top .display-settings svg { display: block; }
  body:not(.controls-open) .top #observe-controls, body:not(.controls-open) .top .place-note { display: none; }
  .top #observe-controls, body.explore-own .top .place-note:not([hidden]) { flex-basis: 100%; }
  .stage[data-view="earth"] > .viewbar > .vtab { gap: 4px; padding-inline: 6px; }
  .stage[data-view="earth"] > .viewbar > .vtab svg { width: 14px; height: 14px; }
}
@media (max-width: 384px) { :is(.top .brand, .stage[data-view="earth"] > .viewbar > .vtab) svg { display: none; } }
@media (max-width: 360px) {
  .top { column-gap: 0; }
  .top .brand h1 { font-size: 20px; }
  .top .whats-new-entry { padding-inline: 0; }
}

/* Facts sit on a single sheet, with a scrollport below the fixed title and close control. */
.chartwrap[data-view="space"] > #selcard:not([hidden]) :is(h3, .sp-facts-head h3),
.ea-ui .ea-card h3 { font: 700 20px/24px var(--f-body); }
.chartwrap[data-view="space"] > #selcard[data-target="body:mars"] :is(dl, dd),
.ea-ui .ea-card .ea-rows { font: 400 16px/24px var(--f-body); font-variant-numeric: tabular-nums; }
.chartwrap[data-view="space"] > #selcard:not([hidden]) dd { font-family: var(--f-body); }
.chartwrap[data-view="space"] > #selcard[data-target="body:mars"] dl a,
.ea-ui .ea-card :is(.ea-sub, .ea-clock-label, .clock-details, .atlas-calculated) { font: 400 14px/20px var(--f-body); }
.chartwrap[data-view="space"] > #selcard[data-target="body:mars"] :is(dt, .dso-status),
.ea-ui .ea-card :is(.ea-sub, .ea-rows dt, .ea-clock-label, .atlas-calculated) { color: var(--atlas-slate); }
.chartwrap[data-view="space"] > #selcard[data-target="body:mars"]:not([hidden]),
.chartwrap[data-view="earth"] .ea-card:not([hidden]) {
  display: flex; flex-direction: column; overflow: hidden; padding: 0;
  left: 16px; right: auto; width: min(320px, calc(100% - 40px));
  border: 0; border-top: 1px solid var(--atlas-rule); border-radius: 20px;
  background: var(--atlas-sheet); color: var(--atlas-ink);
  box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none;
  animation: na-state-in var(--motion-state) ease-out both;
}
.chartwrap[data-view="space"] > #selcard[data-target="body:mars"]:not([hidden]) { bottom: 56px; max-height: min(380px, calc(100% - 132px)); }
.chartwrap[data-view="space"] > #selcard[data-target="body:mars"]:not([hidden]) :focus-visible,
.ea-card :focus-visible { outline: 2px solid var(--atlas-ember); outline-offset: -2px; }
.chartwrap[data-view="space"]:has(> #selcard[data-target="body:mars"]:not([hidden])) .sp-ui > :is(.sp-go, .sp-gal-more) { visibility: hidden; }
body.immersive.idle .chartwrap[data-view="space"] > #selcard[data-target="body:mars"]:not([hidden]) { opacity: 1; pointer-events: auto; }
#selcard[data-target="body:mars"] .sp-facts-head,
.ea-ui .ea-card .ea-ch {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  flex: none; padding: 4px 16px; border-bottom: 1px solid var(--atlas-rule);
}
.ea-ui .ea-card .ea-ch [data-ea="cardx"] { position: static; flex: none; }
.mars-facts-scroll, .ea-card .ea-card-details {
  min-height: 0; overflow: auto; overscroll-behavior: contain; touch-action: pan-y;
  padding: 8px 16px 16px;
}
.mars-facts-scroll:focus-visible, .ea-card-details:focus-visible { outline-offset: -3px; }
#selcard[data-target="body:mars"] dl, .ea-ui .ea-card .ea-rows {
  grid-template-columns: minmax(85px, .85fr) minmax(0, 1.15fr); column-gap: 12px; row-gap: 2px;
}
#selcard[data-target="body:mars"] .mars-facts-lead { margin-top: 4px; }
.mars-facts-lead dd, .ea-card dd { overflow-wrap: anywhere; }
.mars-facts-lead a { display: block; color: var(--atlas-ember); }
#selcard .mars-facts-scroll p.atlas-calculated {
  margin: 0 0 4px; color: var(--atlas-slate); font: 400 14px/20px var(--f-body);
}
.mars-facts-scroll > .btn.on, .ea-ui .ea-card .btn[data-ea="sky"] { width: 100%; margin-top: 12px; }
:is(.mars-facts-actions, .ea-facts-actions) { margin-top: 8px; border-block: 1px solid var(--atlas-rule); }
:is(.mars-facts-actions, .ea-facts-actions) > summary {
  min-height: 44px; align-content: center; color: var(--atlas-ember);
  cursor: pointer; font: 600 14px/20px var(--f-body);
}
#selcard .mars-facts-actions > .acts, .ea-ui .ea-card .ea-facts-actions { padding: 0; box-shadow: none; background: none; }
#selcard .mars-facts-actions > .acts { position: static; display: grid; gap: 0; margin: 0; }
#selcard .mars-facts-actions .btn, .ea-ui .ea-card .ea-facts-actions .btn {
  display: block; width: 100%; text-align: start; background: none; color: var(--atlas-ink);
  border: 0; border-top: 1px solid var(--atlas-rule); border-radius: 0;
}
#selcard .mars-facts-actions .btn[aria-pressed="true"]::after { content: " ✓"; color: var(--atlas-ember); }
.ea-ui .ea-card .ea-acts:empty { display: none; }
@media (max-width: 560px) {
  body.immersive .ea-card-details > [data-ea="sky"] {
    position: sticky;
    inset-block-end: 0;
    z-index: 1;
  }
}
.ea-card .ea-card-clock { margin: 0; padding: 0 0 8px; border-radius: 0; background: none; border-bottom: 1px solid var(--atlas-rule); }
.ea-card .ea-card-clock .ea-clock-value { font-size: 16px; line-height: 24px; color: var(--atlas-ink); }
.ea-card .ea-card-clock .clock-details summary { inset: 0 0 auto auto; color: var(--atlas-ember); }
.ea-framed .ea-foot { font-size: 14px; line-height: 20px; }
.ea-framed .ea-ui::before { background: linear-gradient(transparent, #0b1018 24px); border: 0; }
.ea-framed .ea-foot .ea-tt2 { display: block; }
.ea-framed .ea-foot .ea-credit { overflow-wrap: anywhere; }
.ea-framed .ea-foot .ea-not-live { white-space: normal; }
/* Keep the line's space so the globe does not jump when the readout returns below 6,500 km. */
.ea-globe .ea-foot .ea-alt { visibility: hidden; }
.ea-framed .ea-top { gap: 4px; }
.ea-framed .ea-top .btn { min-height: 44px; border: 0; background: none; color: #f3eee7; }
.ea-framed .ea-top .btn:hover, .ea-framed .ea-top .btn[aria-expanded="true"] { color: #ffaa70; }
@media (min-width: 1040px) {
  .chartwrap[data-view="space"] > #selcard[data-target="body:mars"]:not([hidden]),
  .chartwrap[data-view="earth"] .ea-card:not([hidden]) { left: auto; right: 24px; bottom: 24px; }
}
@media (max-width: 1039px) {
  .chartwrap[data-view="space"] > #selcard[data-target="body:mars"]:not([hidden]),
  .chartwrap[data-view="earth"] .ea-card:not([hidden]) {
    left: 0; right: 0; bottom: 0; width: 100%;
    max-height: min(45dvh, 44%); border-radius: 20px 20px 0 0;
  }
  .chartwrap[data-view="space"] { --mars-facts-cap: min(39dvh, 44%); }
  .chartwrap[data-view="space"] > #selcard[data-target="body:mars"]:not([hidden]) { max-height: var(--mars-facts-cap); }
  .chartwrap[data-view="space"]:has(> #selcard[data-target="body:mars"]:not([hidden])) .sp-ui:not([data-flight]) > .sp-time {
    bottom: calc(var(--mars-facts-cap) + 4px);
  }
  body:not(.immersive) .stage > .chartwrap[data-view="space"][data-spmode="explore"]:has(> #selcard[data-target="body:mars"]:not([hidden])) {
    min-height: min(640px, 74dvh);
  }
}
@media (max-width: 760px) and (orientation: portrait) {
  /* Keep the projection and its hit targets together as Facts takes the lower edge. */
  .chartwrap[data-view="space"][data-spmode="explore"]:has(> #selcard[data-target="body:mars"]:not([hidden])) > :is(.spcv, .splab) {
    transform: translateY(calc(var(--mars-facts-cap) / -2));
  }
}
.stage[data-view="earth"] > .pick-strip { display: none; }

/* The Worlds directory uses the same destinations as the Space tool panel. */
.world-directory { display: none; }
.sp-ui #sp-panel[data-section="wld"] {
  width: min(440px, calc(100% - 32px)); background: var(--atlas-page); color: var(--atlas-ink);
  border: 0; border-radius: 20px; right: auto;
}
.sp-ui:has(> #sp-panel[data-section="wld"]:not([hidden])) > :is(.sp-go, .sp-gal-more) { visibility: hidden; }
#sp-panel[data-section="wld"] .sp-ph {
  align-items: start; padding: 16px 16px 8px; border-color: var(--atlas-rule);
}
#sp-panel[data-section="wld"] .sp-ptabs { display: none; }
#sp-panel[data-section="wld"] .world-directory { display: grid; gap: 8px; flex: 1; min-width: 0; }
.world-directory h2 { font: 700 32px/36px var(--f-body); }
.world-directory select {
  width: 100%; min-height: 44px; padding-inline: 12px; border: 1px solid var(--atlas-rule);
  border-radius: 12px; background: var(--atlas-page); color: var(--atlas-ink); font: 600 14px/20px var(--f-body);
}
#sp-panel[data-section="wld"] .sp-ph > .btn {
  min-width: 44px; min-height: 44px; color: var(--atlas-ink); background: none; border: 0;
}
#sp-panel[data-section="wld"] .sp-pb { padding: 0 16px 16px; gap: 0; }
#sp-panel[data-section="wld"] :is(.sp-prow, [data-act="exoplanets"], .sp-world-unavailable, .sp-saved-flight:not(:empty)) {
  flex: none; min-height: 48px; margin: 0; padding: 12px 0; border: 0; border-bottom: 1px solid var(--atlas-rule);
  border-radius: 0; color: var(--atlas-ink); font: 600 16px/24px var(--f-body);
}
#sp-panel[data-section="wld"] :is(.sp-prow, [data-act="exoplanets"]) { align-items: center; justify-content: space-between; }
#sp-panel[data-section="wld"] [data-act="exoplanets"] {
  display: flex; text-align: start; background: transparent;
}
#sp-panel[data-section="wld"] [data-act="exoplanets"]:is(:hover, :focus-visible) {
  background: rgba(var(--scene-accent-rgb), 0.12);
}
#sp-panel[data-section="wld"] :is(.sp-prow, [data-act="exoplanets"]):not([aria-disabled="true"])::after {
  content: ""; width: 8px; height: 8px; margin-inline: 8px 4px; flex: none;
  border: solid var(--atlas-ember); border-width: 1.5px 1.5px 0 0; transform: rotate(45deg);
}
#sp-panel[data-section="wld"] .sp-pt b { font-size: inherit; }
#sp-panel[data-section="wld"] :is(.sp-pt span, .sp-world-unavailable span) {
  color: var(--atlas-slate); font: 400 14px/20px var(--f-body); font-variant-numeric: tabular-nums;
}
#sp-panel[data-section="wld"] .sp-py:empty { display: none; }
.sp-pb[data-world-category="systems"] > [data-world-group]:not([data-world-group="systems"]),
.sp-pb[data-world-category="craft"] > [data-world-group]:not([data-world-group="craft"]),
.sp-pb[data-world-category="sizes"] > [data-world-group]:not([data-world-group="sizes"]) { display: none !important; }

/* Give Notes the Course reading surface while keeping lesson sky links usable. */
.layout:has(> .stage[data-view="sky"]):has(#tp-learn:not([hidden]) #ln-nform) { grid-template-columns: minmax(0, 1fr); }
.layout:has(> .stage[data-view="sky"]):has(#tp-learn:not([hidden]) #ln-nform) > .stage { display: none; }
.layout:has(#tp-learn[data-course]:not([hidden]), #tp-learn:not([hidden]) #ln-nform) > .panel {
  width: min(100%, 728px); justify-self: center; border: 0; border-radius: 0; background: none; box-shadow: none;
}
#tp-learn:not([hidden]) { padding: 0; color: var(--atlas-ink); background: var(--atlas-page); }
#tp-learn #ln-nav {
  display: flex; margin: 8px 20px 0; padding: 0; min-width: 0; background: none;
  border-radius: 0; border-bottom: 1px solid var(--atlas-rule); overflow: visible; gap: 4px;
}
#ln-nav :is(.en-pill, .learn-sections summary) {
  min-height: 44px; padding: 0 8px; flex: 0 1 auto; border-radius: 0;
  color: var(--atlas-slate); background: none; box-shadow: none; font: 600 14px/20px var(--f-body);
}
#ln-nav .en-pill[aria-pressed="true"], #ln-nav .learn-sections:has([aria-pressed="true"]) > summary {
  color: var(--atlas-ember); box-shadow: inset 0 -2px var(--atlas-ember);
}
.learn-sections { position: relative; margin-inline-start: auto; }
.learn-sections > summary { cursor: pointer; align-content: center; }
.learn-sections > div {
  position: absolute; inset: 100% 0 auto auto; min-width: max-content; display: grid; z-index: 6;
  border: 1px solid var(--atlas-rule); border-radius: 12px; padding: 4px 8px; background: var(--atlas-page);
}
.learn-sections .en-pill { text-align: start; }
#tp-learn:not([data-course]) #ln-main { padding: 24px 20px; }
#tp-learn .course-overview h2 { font: 700 32px/36px var(--f-body); }
#tp-learn .course :is(.course-start,.course-primary) {
  border-color: transparent; border-radius: 12px; padding-inline: 12px;
  background: var(--atlas-ember); color: var(--atlas-on-ember);
}
#ln-main:has(#ln-nform) > div:first-child h2 { font: 700 20px/24px var(--f-body); }
#ln-main:has(#ln-nform) > div:first-child p {
  margin-top: 8px; color: var(--atlas-slate); font: 400 14px/20px var(--f-body); letter-spacing: normal;
}
#ln-main:has(#ln-nform) :is(.lg-form, .lg-e) {
  padding: 8px 0; border: 0; border-radius: 0; background: none; box-shadow: none;
}
#ln-main:has(#ln-nform) :is(.lg-e, .lg-form:has(> [role="status"])) { border-top: 1px solid var(--atlas-rule); }
#ln-main #ln-nform .btn[aria-pressed="true"] { background: none; color: var(--atlas-ember); }
#ln-main #ln-nform .btn[aria-pressed="true"]::after { content: " ✓"; }
#ln-main:has([data-act="ln-nresume"]) #ln-nform button[type="submit"] { background: none; color: var(--atlas-ink); }
#ln-main:has(#ln-nform) .lg-form :is(input, textarea) { background: var(--atlas-page); border-color: var(--control-line); border-radius: 12px; }

dialog#display-quality {
  width: min(320px, calc(100vw - 48px)); right: 24px; padding: 16px;
  border: 0; border-top: 1px solid var(--atlas-rule); border-radius: 20px;
  background: var(--atlas-sheet);
  color: var(--atlas-ink); animation: na-state-in var(--motion-state) ease-out both;
}
#display-quality[open] h2 { font: 700 20px/24px var(--f-body); }
#display-quality .quality-rows { gap: 0; margin-block: 8px 12px; }
#display-quality .quality-rows .quality-row {
  min-height: 48px; padding: 8px 0; border: 0; border-top: 1px solid var(--atlas-rule); border-radius: 0;
  font: 600 16px/20px var(--f-body);
}
#display-quality .quality-row:last-child { border-bottom: 1px solid var(--atlas-rule); }
#display-quality .quality-row small, #display-quality[open] p { color: var(--atlas-slate); font: 400 14px/20px var(--f-body); }
#display-quality .quality-row[aria-pressed="true"]::after { color: var(--atlas-ember); }
#display-quality .quality-status:empty { display: none; }
@media (max-width: 760px) {
  dialog#display-quality { inset: auto 0 0; width: 100%; max-height: 45dvh; border-radius: 20px 20px 0 0; }
}
@media (max-width: 560px) {
  body:not(.immersive) dialog#display-quality { bottom: var(--phone-nav-space); }
}
