/* Observatory-instrument look: dark, calm, precise. One accent colour, system fonts, no glow. */

:root {
  --bg: #05070b;
  --panel: rgba(12, 15, 21, 0.9);
  --panel-weak: rgba(10, 13, 19, 0.66);
  --panel-solid: #0e121a;
  --line: rgba(255, 255, 255, 0.1);
  --line-strong: rgba(255, 255, 255, 0.2);
  --hover: rgba(255, 255, 255, 0.05);
  --fill: rgba(255, 255, 255, 0.06);
  --text: #eef1f5;
  --muted: #a9b2bf;
  --faint: #8590a0;
  --accent: #e8b765;
  --accent-ink: #1c1406;
  --accent-soft: rgba(232, 183, 101, 0.14);
  --ok: #96d4ad;
  --danger: #f2948a;
  --radius: 14px;
  --panel-w: 420px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --gutter: 12px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
  overscroll-behavior: none;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--text); text-decoration-color: var(--faint); text-underline-offset: 2px; }
a:hover { text-decoration-color: var(--accent); }
p { margin: 0 0 10px; }
h2, h3 { margin: 0; font-weight: 600; letter-spacing: 0.005em; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.muted { color: var(--muted); }
.small { font-size: 13px; }
.icon { display: inline-flex; width: 22px; height: 22px; flex: none; }
.icon svg { width: 100%; height: 100%; }
.icon-inline { width: 16px; height: 16px; vertical-align: -3px; margin-right: 4px; }

/* ——— stage ——— */
#sky { position: fixed; inset: 0; width: 100%; height: 100%; display: block; background: var(--bg); touch-action: none; }
.label-layer { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 1; }
.ui { position: fixed; inset: 0; pointer-events: none; z-index: 2; }
.ui > * { pointer-events: auto; }
.ui > .hud, .ui > .toasts { pointer-events: none; }

/* Engine labels (created by src/render/engine.js or the fallback engine). */
.sw-label {
  position: absolute; left: 0; top: 0;
  pointer-events: auto;
  font: 500 12px/1.2 var(--font);
  letter-spacing: 0.01em;
  color: rgba(238, 241, 245, 0.86);
  background: rgba(5, 7, 11, 0.42);
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 3px 7px;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}
.sw-label::after { content: ""; position: absolute; inset: -10px -4px; } /* bigger touch target */
.sw-label:hover { color: var(--text); border-color: var(--line-strong); }
.sw-label--target { color: var(--accent); border-color: rgba(232, 183, 101, 0.45); background: rgba(5, 7, 11, 0.6); }
.sw-reticle {
  position: absolute; left: 0; top: 0;
  width: 44px; height: 44px;
  border: 1.5px solid var(--accent);
  border-radius: 50%;
  pointer-events: none;
  opacity: 0.9;
}
.sw-reticle::before, .sw-reticle::after {
  content: ""; position: absolute; background: var(--accent);
}
.sw-reticle::before { left: 50%; top: -7px; width: 1.5px; height: 58px; transform: translateX(-50%); clip-path: polygon(0 0, 100% 0, 100% 12%, 0 12%, 0 88%, 100% 88%, 100% 100%, 0 100%); }
.sw-reticle::after { top: 50%; left: -7px; height: 1.5px; width: 58px; transform: translateY(-50%); clip-path: polygon(0 0, 12% 0, 12% 100%, 0 100%, 88% 0, 100% 0, 100% 100%, 88% 100%); }
.sw-reticle--offscreen { width: 28px; height: 28px; opacity: 0.7; }

/* ——— boot ——— */
.boot {
  position: fixed; inset: 0; z-index: 50;
  display: grid; place-items: center;
  background: var(--bg);
  padding: calc(24px + var(--safe-t)) 24px calc(24px + var(--safe-b));
  transition: opacity 0.5s ease;
}
.boot.is-done { opacity: 0; pointer-events: none; }
.boot-inner { text-align: center; max-width: 360px; }
.boot-name { font-size: 30px; font-weight: 600; letter-spacing: 0.04em; margin: 0 0 2px; min-height: 1.2em; }
.boot-tagline { color: var(--muted); margin: 0 0 22px; min-height: 1.3em; }
.boot-bar { width: 160px; height: 2px; margin: 0 auto 14px; background: var(--line); overflow: hidden; border-radius: 1px; }
.boot-bar span { display: block; width: 40%; height: 100%; background: var(--accent); animation: boot-slide 1.4s ease-in-out infinite; }
@keyframes boot-slide { from { transform: translateX(-100%); } to { transform: translateX(250%); } }
.boot-msg { color: var(--muted); font-size: 14px; }
.boot.is-error .boot-bar { display: none; }
.boot.is-error .boot-msg { color: var(--text); }
.boot-detail { color: var(--faint); font-size: 12px; word-break: break-word; }
.noscript { position: fixed; inset: auto 0 40% 0; text-align: center; color: var(--muted); z-index: 60; }

/* ——— buttons ——— */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px;
  border-radius: 12px; border: 1px solid transparent;
  font-size: 15px; font-weight: 600; line-height: 1.1;
  background: var(--fill); color: var(--text);
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}
.btn:disabled { opacity: 0.5; cursor: default; }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.primary:hover:not(:disabled) { background: #f1c47a; }
.btn.ghost { background: var(--fill); border-color: var(--line); }
.btn.ghost:hover:not(:disabled) { border-color: var(--line-strong); background: rgba(255, 255, 255, 0.09); }
.btn.danger { background: transparent; border-color: rgba(242, 148, 138, 0.5); color: var(--danger); }
.btn.danger:hover { background: rgba(242, 148, 138, 0.1); }
.btn-small { padding: 0 12px; font-size: 14px; font-weight: 500; }
.btn-block { width: 100%; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; margin-top: 14px; }
.btn-row .btn { flex: 1 1 140px; }
.btn-meta { font-weight: 500; opacity: 0.75; font-variant-numeric: tabular-nums; }
.link { background: none; border: 0; padding: 6px 2px; min-height: 44px; color: var(--accent); text-decoration: underline; text-underline-offset: 3px; font-weight: 500; }
.icon-btn {
  display: inline-grid; place-items: center;
  width: 44px; height: 44px; padding: 0;
  border-radius: 12px; border: 1px solid var(--line);
  background: var(--panel-weak); color: var(--text);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.icon-btn:hover { border-color: var(--line-strong); }

/* ——— HUD ——— */
.hud { position: absolute; inset: 0; }
.hud > * { pointer-events: auto; }
.hud-top {
  position: absolute; top: 0; left: 0; right: 0;
  display: flex; justify-content: space-between; align-items: flex-start; gap: 10px;
  padding: calc(var(--gutter) + var(--safe-t)) calc(var(--gutter) + var(--safe-r)) 0 calc(var(--gutter) + var(--safe-l));
  pointer-events: none;
  transition: right 0.25s ease;
}
.hud-top > * { pointer-events: auto; }
.hud-actions { display: flex; gap: 8px; flex: none; }
.loc-card {
  display: flex; flex-direction: column; align-items: flex-start;
  min-width: 0; max-width: min(62vw, 360px);
  padding: 8px 14px 10px;
  border-radius: var(--radius);
  background: var(--panel-weak);
  border: 1px solid var(--line);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.eyebrow { font-size: 11px; font-weight: 600; letter-spacing: 0.09em; text-transform: uppercase; color: var(--muted); }
.loc-name {
  background: none; border: 0; padding: 2px 0; margin: 0;
  font-size: 20px; font-weight: 600; text-align: left; line-height: 1.2;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  min-height: 32px;
}
.loc-name:hover { text-decoration: underline; text-decoration-color: var(--faint); text-underline-offset: 3px; }
.loc-sub, .flight-from { color: var(--muted); font-size: 13px; }
.flight-from { color: var(--faint); }

.hud-bottom {
  position: absolute; left: 0; right: 0; bottom: 0;
  display: flex; flex-direction: column; gap: 10px;
  padding: 0 calc(var(--gutter) + var(--safe-r)) calc(var(--gutter) + var(--safe-b)) calc(var(--gutter) + var(--safe-l));
  pointer-events: none;
  transition: left 0.25s ease, right 0.25s ease;
}
.hud-bottom > * { pointer-events: auto; }
.rank-card {
  display: flex; flex-direction: column; gap: 6px;
  width: 100%; padding: 10px 14px;
  border-radius: var(--radius); border: 1px solid var(--line);
  background: var(--panel-weak); text-align: left;
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.rank-line { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.rank-title { font-weight: 600; }
.rank-xp { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.btn-go { min-height: 54px; font-size: 17px; width: 100%; }

/* Flight */
.flight-panel {
  border-radius: 16px; border: 1px solid var(--line);
  background: var(--panel-weak);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  padding: 10px 14px 14px;
}
.flight-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 6px; }
.phase-pill { font-size: 11px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent); }
.hud-flight .readouts { grid-template-columns: 1fr 1fr; }
.hud-flight .readout:first-child { grid-column: 1 / -1; }
.hud-flight .readout { background: none; padding: 4px 0; }
.hud-flight .readout:first-child .readout-value { font-size: 22px; }
.flight-progress { display: flex; align-items: center; gap: 12px; margin-top: 8px; }
.flight-progress .progress { flex: 1; }
.flight-time-wrap { flex: none; min-width: 7.5em; text-align: right; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.flight-time { color: var(--text); font-weight: 600; }

/* ——— readouts, progress ——— */
.readouts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0; }
.readout { display: flex; flex-direction: column; gap: 2px; min-width: 0; background: rgba(255, 255, 255, 0.04); border-radius: 10px; padding: 10px 12px; }
.readout-wide { grid-column: 1 / -1; }
.readout-label { font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.readout-value { font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.readout-big { font-size: 21px; }
.readout-note { color: var(--muted); font-size: 13px; }
.progress { height: 6px; border-radius: 3px; background: rgba(255, 255, 255, 0.1); overflow: hidden; }
.progress-fill { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 3px; }
.progress-flight .progress-fill { transition: width 0.25s linear; }

/* ——— panel (bottom sheet / side panel) ——— */
.panel {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  display: flex; flex-direction: column;
  max-height: 88vh; max-height: 88dvh;
  background: var(--panel);
  border-top: 1px solid var(--line);
  border-radius: 18px 18px 0 0;
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  padding: 0 var(--safe-r) var(--safe-b) var(--safe-l);
  animation: sheet-in 0.22s ease-out;
}
@keyframes sheet-in { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.panel-grip { width: 36px; height: 4px; border-radius: 2px; background: var(--line-strong); margin: 8px auto 0; }
.panel-head {
  display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; gap: 6px;
  padding: 4px 8px 6px;
}
.panel-head .icon-btn { background: transparent; border-color: transparent; -webkit-backdrop-filter: none; backdrop-filter: none; }
.panel-head .icon-btn:hover { border-color: var(--line); }
.panel-head .icon-btn[hidden] { display: block !important; visibility: hidden; }
.panel-title { font-size: 17px; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; outline: none; }
.panel-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 4px 16px 20px; -webkit-overflow-scrolling: touch; }
/* Pinned footer (outside the scroll area, so it never covers content). The panel's own bottom padding
   already clears env(safe-area-inset-bottom) on phones. */
.panel-foot { flex: none; }
.place-launch { padding: 10px 16px 12px; border-top: 1px solid var(--line); background: var(--panel-solid); }
.place-launch .form-error { margin: 0 0 8px; }
.place-launch .btn-launch { flex-wrap: wrap; column-gap: 10px; row-gap: 0; }

/* ——— sections, rows, tabs ——— */
.section { margin-top: 18px; }
.section-title { font-size: 13px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.section-note { color: var(--muted); font-size: 14px; }
.note { color: var(--muted); background: rgba(255, 255, 255, 0.04); border-radius: 10px; padding: 12px; margin: 12px 0; }
.empty { padding: 12px 0; }
.rows { list-style: none; margin: 0; padding: 0; }
.row-item + .row-item .row { border-top: 1px solid var(--line); }
.row {
  display: flex; align-items: center; gap: 12px;
  width: 100%; min-height: 56px; padding: 8px 6px;
  background: none; border: 0; border-radius: 0; text-align: left;
}
.row:hover { background: var(--hover); }
.row-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; opacity: 0.9; }
.row-icon { color: var(--muted); }
.row-text { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.row-title { font-weight: 500; overflow: hidden; text-overflow: ellipsis; }
.row-sub { color: var(--muted); font-size: 13px; }
.row-text .progress { margin-top: 6px; height: 4px; }
.row-tick { width: 22px; height: 22px; color: var(--accent); flex: none; display: inline-grid; place-items: center; }
.row-tick .icon { width: 20px; height: 20px; }
.row-chevron { color: var(--faint); width: 18px; height: 18px; }
.more { width: 100%; margin-top: 8px; }
.tabs-wrap { margin-top: 12px; }
.tabs { display: flex; gap: 4px; background: rgba(255, 255, 255, 0.05); border-radius: 12px; padding: 4px; }
.tab { flex: 1; min-height: 40px; border: 0; border-radius: 9px; background: none; color: var(--muted); font-size: 14px; font-weight: 500; padding: 0 6px; }
.tab[aria-selected="true"] { background: rgba(255, 255, 255, 0.12); color: var(--text); }
.tab-panel { outline: none; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.chip { min-height: 36px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--fill); font-size: 13px; }
.chip:hover { border-color: var(--line-strong); }
.tag {
  display: inline-flex; align-items: center; gap: 2px;
  font-size: 12px; font-weight: 600; padding: 3px 9px;
  border-radius: 999px; border: 1px solid var(--line-strong); color: var(--muted);
}
.tag-visited { color: var(--accent); border-color: rgba(232, 183, 101, 0.4); background: var(--accent-soft); }
.tag-here { color: var(--ok); border-color: rgba(150, 212, 173, 0.4); }
.tag-inline { margin-left: 8px; vertical-align: 1px; }

/* ——— search ——— */
.search { position: relative; margin-top: 4px; }
.search-icon { position: absolute; left: 12px; top: 13px; color: var(--muted); pointer-events: none; }
.search-input {
  width: 100%; height: 48px; padding: 0 48px 0 42px;
  border-radius: 12px; border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.06);
  font-size: 16px;
}
.search-input::placeholder { color: var(--faint); }
.search-input::-webkit-search-cancel-button { display: none; }
.search-input:focus { border-color: var(--line-strong); outline: none; box-shadow: 0 0 0 2px var(--accent); }
.search-clear { position: absolute; right: 2px; top: 2px; width: 44px; height: 44px; border: 0; background: none; color: var(--muted); display: grid; place-items: center; }
.search-results { margin-top: 8px; }

/* ——— kinds: search groups, browse filters, place page ——— */
.kind-group { margin: 12px 0 18px; padding: 4px 12px 10px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255, 255, 255, 0.03); }
.kind-group-title { margin: 0; font-size: 17px; font-weight: 600; }
.kind-group-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  width: 100%; min-height: 48px; padding: 4px 0; border: 0; background: none; text-align: left; font: inherit; color: var(--text);
}
.kind-group-head:hover { color: var(--accent); }
.kind-group-about { color: var(--muted); font-size: 14px; margin: 0 0 6px; }
/* One scrolling strip (the panel is narrow even on desktop; 19 wrapped chips would push the list off screen). */
.kind-chips { flex-wrap: nowrap; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: thin; padding-bottom: 6px; margin: 10px 0 6px; }
.chip-filter { flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 40px; white-space: nowrap; color: var(--text); }
.chip-filter[aria-pressed="true"] { background: var(--accent-soft); border-color: rgba(232, 183, 101, 0.6); color: var(--accent); }
.chip-count { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 12px; }
.chip-filter[aria-pressed="true"] .chip-count { color: inherit; }
.kind-about { margin: 8px 0; padding: 10px 12px; border-radius: 10px; background: rgba(255, 255, 255, 0.04); }
.kind-about-title { margin: 0 0 2px; font-weight: 600; }
.kind-about-text { margin: 0; color: var(--muted); font-size: 14px; }
.list-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; margin: 8px 0 2px; }
.check { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; font-size: 15px; cursor: pointer; }
.check-input { width: 20px; height: 20px; margin: 0; accent-color: var(--accent); }
.sort { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; font-size: 14px; color: var(--muted); }
.select {
  height: 40px; max-width: 62vw; padding: 0 10px; border-radius: 10px; border: 1px solid var(--line-strong);
  background: var(--panel-solid, #151a22); color: var(--text); font-size: 15px;
}
.select:focus-visible, .check-input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.browse-status { margin: 4px 0 6px; }
.kind-source { margin-top: 12px; }
.place-kind { margin: 8px 0 10px; padding: 10px 12px; border-radius: 10px; background: rgba(255, 255, 255, 0.04); }
.place-kind-name { margin: 0 0 2px; font-weight: 600; }
.place-kind-about { margin: 0; color: var(--muted); font-size: 14px; }
.place-kind-more { margin-top: 8px; min-height: 40px; padding: 0 14px; font-size: 14px; }

.collection-progress { display: flex; flex-direction: column; gap: 6px; margin: 8px 0 4px; color: var(--muted); font-size: 14px; }

/* ——— photos ——— */
.photo { margin: 6px 0 12px; }
.photo-frame { position: relative; aspect-ratio: 16 / 10; overflow: hidden; border-radius: 12px; background: #10141b; }
.photo-card { aspect-ratio: 16 / 9; border-radius: 0; }
.photo-frame img { display: block; width: 100%; height: 100%; object-fit: cover; }
.photo-frame.is-loading { background: linear-gradient(100deg, #10141b 30%, #161b24 50%, #10141b 70%); background-size: 200% 100%; animation: shimmer 1.6s linear infinite; }
.photo-frame.is-loading img { opacity: 0; }
.photo-frame img { transition: opacity 0.3s; }
@keyframes shimmer { to { background-position: -200% 0; } }
.photo-placeholder {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  background: radial-gradient(circle at 50% 45%, color-mix(in srgb, var(--tint) 55%, transparent) 0%, transparent 38%), #0d1118;
  color: var(--muted);
}
.photo-placeholder-type { font-size: 12px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; margin-top: 70px; }
.photo-placeholder-note { font-size: 12px; color: var(--faint); }
.photo-none {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; border-radius: 12px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--tint) 16%, transparent), rgba(255, 255, 255, 0.03) 70%);
  border: 1px solid color-mix(in srgb, var(--tint) 22%, transparent);
}
.photo-none-swatch {
  width: 28px; height: 28px; border-radius: 50%; flex: none;
  background: radial-gradient(circle at 40% 38%, #fff 0%, var(--tint) 38%, color-mix(in srgb, var(--tint) 30%, transparent) 72%, transparent 100%);
}
.photo-none-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.photo-none-type { font-size: 12px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.photo-none-note { font-size: 12px; color: var(--faint); }
.modal-arrival .photo-card-none { padding: 18px 18px 0; }
.photo-credit { margin-top: 6px; font-size: 12px; color: var(--muted); line-height: 1.35; }
.photo-credit a { color: var(--muted); }
.modal-arrival .photo { margin: 0; }
.modal-arrival .photo-credit { padding: 0 18px; }

/* ——— place detail ——— */
.place-head { margin-bottom: 4px; }
.place-sub { color: var(--muted); margin: 0 0 2px; display: block; }
.place-dist { margin: 0 0 8px; font-variant-numeric: tabular-nums; }
.place-status { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 6px 0; }
.status-note { color: var(--muted); font-size: 13px; }
.blurb { color: var(--text); }
.facts { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: 0; margin: 12px 0; font-size: 14px; }
.facts dt, .facts dd { margin: 0; padding: 7px 0; border-top: 1px solid var(--line); }
.facts dt { color: var(--muted); padding-right: 10px; }
.facts dd { font-variant-numeric: tabular-nums; }
.more-link a { display: inline-flex; align-items: center; min-height: 44px; gap: 4px; }
.more-link .icon-inline { margin: 0; }
/* An inline link to another place inside a line of text: a 44 px tap target without a taller line. */
.inline-link { display: inline; min-height: 0; padding: 12px 2px; margin: -12px 0; font: inherit; color: var(--accent); }
.place-partof, .place-where { color: var(--muted); margin: 0 0 2px; font-size: 14px; }
.place-where { font-variant-numeric: tabular-nums; }
.place-flags { margin: 6px 0 4px; }
.tag-crew { color: var(--accent); border-color: rgba(232, 183, 101, 0.4); }
.position-note { margin: 12px 0; padding: 12px; border-radius: 10px; background: rgba(255, 255, 255, 0.04); }
.position-note p { margin: 0; }
.position-note p + p { margin-top: 6px; }
.view-source-credit { font-size: 13px; overflow-wrap: anywhere; }
.view-source-credit a { color: var(--muted); }
.nearby-world { margin: 8px 0 4px; }

/* gallery strip: fixed-height boxes, scrolls sideways; a larger view opens in a modal */
.gallery {
  list-style: none; margin: 0 -16px; padding: 2px 16px 8px;
  display: flex; gap: 8px; overflow-x: auto; overscroll-behavior-x: contain;
  scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch; scrollbar-width: thin;
}
.gallery-item { flex: none; scroll-snap-align: start; }
.gallery-btn { display: block; padding: 0; border: 0; background: none; border-radius: 10px; }
.gallery-thumb {
  position: relative; display: grid; place-items: center; overflow: hidden;
  width: 132px; height: 96px; border-radius: 10px; background: #10141b; border: 1px solid var(--line);
}
.gallery-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; transition: opacity 0.3s; }
.gallery-thumb.is-loading img { opacity: 0; }
.gallery-item.is-loading .gallery-thumb, .gallery-thumb.is-loading {
  background: linear-gradient(100deg, #10141b 30%, #161b24 50%, #10141b 70%); background-size: 200% 100%; animation: shimmer 1.6s linear infinite;
}
.gallery-failed { font-size: 12px; color: var(--faint); padding: 6px; text-align: center; }
.gallery-btn:hover .gallery-thumb { border-color: var(--line-strong); }
.gallery-status { font-size: 14px; margin: 4px 0 0; }

.modal.modal-viewer { max-width: 980px; padding: 12px 14px 16px; }
.viewer-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.viewer-head .eyebrow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer-count { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.viewer-stage { position: relative; }
.viewer-frame {
  display: grid; place-items: center; overflow: hidden;
  height: min(62vh, 72vw); min-height: 180px; border-radius: 12px; background: #080b10;
}
.viewer-frame.is-loading { background: linear-gradient(100deg, #080b10 30%, #121721 50%, #080b10 70%); background-size: 200% 100%; animation: shimmer 1.6s linear infinite; }
.viewer-frame.is-loading .viewer-img { opacity: 0; }
.viewer-img { max-width: 100%; max-height: 100%; object-fit: contain; transition: opacity 0.25s; }
.viewer-failed { color: var(--muted); padding: 16px; text-align: center; max-width: 30em; }
.viewer-prev, .viewer-next { position: absolute; top: 50%; transform: translateY(-50%); background: rgba(10, 13, 19, 0.7); }
.viewer-prev { left: 8px; }
.viewer-next { right: 8px; }
.viewer-caption { margin: 10px 0 2px; font-weight: 500; overflow-wrap: anywhere; }
.viewer-credit { margin: 0; color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.viewer-credit a { color: var(--muted); display: inline-flex; align-items: center; gap: 2px; min-height: 32px; }

/* About: credits grouped, long groups folded */
.credit-group { margin: 6px 0; border-top: 1px solid var(--line); }
.credit-group > summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; font-weight: 500; }
.credit-group > summary .muted { margin-left: 6px; font-weight: 400; font-size: 13px; }
.credits a { overflow-wrap: anywhere; }

/* travel picker */
.travel { margin-top: 4px; }
.travel-row { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.label { font-size: 14px; font-weight: 600; }
.travel-time { font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.presets { display: flex; gap: 6px; margin: 10px 0 4px; }
.preset {
  flex: 1; min-height: 44px; min-width: 0; padding: 0 4px;
  border-radius: 10px; border: 1px solid var(--line); background: var(--fill);
  font-size: 14px; font-weight: 500; font-variant-numeric: tabular-nums; white-space: nowrap;
}
.preset[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.slider { width: 100%; height: 44px; accent-color: var(--accent); margin: 0; background: transparent; }
.hint { color: var(--faint); font-size: 13px; margin: 0 0 4px; }
.btn-launch { width: 100%; min-height: 54px; font-size: 17px; }
.form-error { color: var(--danger); font-size: 14px; margin: 8px 0; }

/* ——— modals ——— */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 20;
  display: flex; align-items: center; justify-content: center;
  padding: calc(16px + var(--safe-t)) calc(16px + var(--safe-r)) calc(16px + var(--safe-b)) calc(16px + var(--safe-l));
  background: rgba(2, 4, 8, 0.6);
  animation: fade-in 0.18s ease-out;
}
.modal-backdrop.is-leaving { opacity: 0; transition: opacity 0.15s; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.modal {
  width: 100%; max-width: 440px; max-height: 100%;
  overflow-y: auto; overscroll-behavior: contain;
  background: var(--panel-solid);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 20px;
  animation: modal-in 0.22s ease-out;
  outline: none;
}
@keyframes modal-in { from { transform: translateY(12px) scale(0.98); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-small { max-width: 400px; }
.modal-title { font-size: 21px; margin-bottom: 8px; }
.confirm-body { color: var(--muted); }
.welcome p { color: var(--muted); }
.welcome .eyebrow { display: block; margin-bottom: 6px; color: var(--accent); }
.welcome .btn-row { margin-top: 18px; }

/* arrival */
.modal-arrival { max-width: 560px; padding: 0; display: flex; flex-direction: column; overflow: hidden; }
.arrival { display: flex; flex-direction: column; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.arrival-body { padding: 14px 18px 4px; }
.arrival-head { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; margin-bottom: 12px; }
.arrival-title { font-size: 26px; margin: 2px 0 0; }
.arrival-actions {
  position: sticky; bottom: 0; margin: 0;
  padding: 12px 18px calc(14px);
  background: linear-gradient(to bottom, rgba(14, 18, 26, 0), var(--panel-solid) 30%);
}
.stamp {
  display: inline-block; margin-top: 10px;
  padding: 4px 10px; border: 2px solid var(--accent); border-radius: 6px;
  color: var(--accent); font-size: 12px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase;
  transform: rotate(-2.5deg);
}
.stamp-repeat { border-color: var(--line-strong); color: var(--muted); transform: none; }
.rewards { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.reward { display: flex; gap: 10px; align-items: baseline; background: rgba(255, 255, 255, 0.04); border-radius: 10px; padding: 10px 12px; }
.reward-xp { flex-direction: column; gap: 0; }
.reward-big { font-size: 26px; font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; }
.reward-note { color: var(--muted); font-size: 13px; display: block; }
.reward-rank { flex-direction: column; gap: 0; border: 1px solid rgba(232, 183, 101, 0.4); }
.reward-rank-title { font-size: 18px; font-weight: 600; }
.reward-ach { align-items: flex-start; }
.reward-icon { color: var(--accent); width: 20px; height: 20px; margin-top: 1px; }
.reward-ach-title { font-weight: 600; display: block; }
.trip-line { color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; }

/* ——— toasts ——— */
.toasts {
  position: fixed; z-index: 15;
  top: calc(var(--safe-t) + 104px); left: 50%; transform: translateX(-50%);
  width: min(92vw, 380px);
  display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
}
.toast {
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 12px;
  padding: 10px 14px;
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  animation: toast-in 0.25s ease-out;
  transition: opacity 0.3s, transform 0.3s;
}
.toast.is-leaving { opacity: 0; transform: translateY(-6px); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
.toast-title { font-weight: 600; }
.toast-body { color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; }
.toast-badge { color: var(--accent); font-size: 13px; font-weight: 600; margin-top: 2px; }

/* ——— logbook ——— */
.rank-hero { display: flex; flex-direction: column; gap: 4px; padding: 14px; border-radius: 12px; background: rgba(255, 255, 255, 0.04); margin: 12px 0; }
.rank-hero-title { font-size: 22px; font-weight: 600; }
.rank-hero-xp { color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; margin-bottom: 6px; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.stat { display: flex; flex-direction: column-reverse; gap: 2px; padding: 10px 12px; border-radius: 10px; background: rgba(255, 255, 255, 0.04); min-width: 0; }
.stat-value { font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.stat-label { font-size: 12px; color: var(--muted); }
.realm-progress { margin-bottom: 10px; }
.realm-line { display: flex; justify-content: space-between; font-size: 14px; margin-bottom: 4px; font-variant-numeric: tabular-nums; }
.ladder { list-style: none; margin: 0; padding: 0; }
.ladder-step { display: flex; justify-content: space-between; padding: 8px 0 8px 14px; border-left: 2px solid var(--line); color: var(--faint); font-variant-numeric: tabular-nums; }
.ladder-step.is-done { color: var(--muted); border-left-color: rgba(232, 183, 101, 0.4); }
.ladder-step.is-current { color: var(--accent); border-left-color: var(--accent); font-weight: 600; }
.achs { list-style: none; margin: 0; padding: 0; }
.ach { display: flex; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.ach:first-child { border-top: 0; }
.ach-mark { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; flex: none; border: 1px solid var(--line-strong); color: var(--faint); }
.ach-mark .icon { width: 16px; height: 16px; }
.ach.is-unlocked .ach-mark { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.ach-text { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.ach-title { font-weight: 600; }
.ach:not(.is-unlocked) .ach-title { color: var(--muted); }
.ach-desc { color: var(--muted); font-size: 13px; }
.ach-when { color: var(--faint); font-size: 12px; }
.ach-progress { display: flex; align-items: center; gap: 10px; margin-top: 4px; font-size: 12px; font-variant-numeric: tabular-nums; }
.ach-progress .progress { flex: 1; height: 4px; }

/* ——— account, about ——— */
.intro { margin: 8px 0 16px; }
.form { display: flex; flex-direction: column; gap: 14px; margin-top: 10px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.input {
  width: 100%; height: 48px; padding: 0 12px;
  border-radius: 10px; border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.05);
  font-size: 16px;
}
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.input[aria-invalid="true"] { border-color: var(--danger); }
.field-error { color: var(--danger); font-size: 13px; margin: 0; }
.pw-wrap { display: flex; gap: 8px; }
.pw-wrap .input { flex: 1; }
.pw-toggle { min-width: 64px; }
.switch { margin-top: 14px; color: var(--muted); }
.notice { border: 1px solid var(--line-strong); border-radius: 12px; padding: 14px; margin: 8px 0; }
.account-card { display: flex; flex-direction: column; padding: 14px; border-radius: 12px; background: rgba(255, 255, 255, 0.04); margin: 12px 0; }
.account-name { font-size: 18px; font-weight: 600; }
.sync-status { display: flex; align-items: center; gap: 6px; color: var(--muted); }
.sync-status[data-status="idle"] { color: var(--ok); }
.sync-status[data-status="error"] { color: var(--danger); }
.about .lead { font-size: 17px; }
.credits { margin: 0; padding-left: 18px; }
.credits li { margin-bottom: 8px; }
.version { margin-top: 24px; }

/* ——— discovery: first voyage, today's destination, surprise, shelves ——— */
.tour-eyebrow, .daily-eyebrow { color: var(--accent); }
.tour-steps { display: flex; gap: 3px; margin-top: 6px; }
.tour-step { width: 18px; height: 3px; border-radius: 2px; background: rgba(255, 255, 255, 0.16); }
.tour-step.is-done { background: var(--accent); }
.tour-step.is-next { background: rgba(232, 183, 101, 0.45); }

/* place sheet banners */
.place-banners { display: flex; flex-direction: column; gap: 8px; margin: -2px 0 10px; }
.tour-note { border: 1px solid rgba(232, 183, 101, 0.35); border-radius: 12px; padding: 12px 14px 4px; background: var(--accent-soft); }
.tour-note-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tour-reason { margin: 6px 0 6px; }
.tour-hint { color: var(--muted); font-size: 13px; margin: 0 0 2px; }
.tour-note-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.tour-note-foot .tour-steps { margin: 0; }
.tour-leave { font-size: 14px; color: var(--muted); }
.origin-note { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border-radius: 12px; background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line); }
.origin-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; color: var(--muted); font-size: 14px; }
.origin-why { color: var(--text); }
.origin-note .btn { flex: none; }

/* navigator Discover tab */
.discover { padding-top: 2px; }
.tour-card { display: flex; align-items: stretch; gap: 6px; margin-top: 4px; border: 1px solid rgba(232, 183, 101, 0.35); border-radius: 14px; background: var(--accent-soft); }
.tour-card-main { flex: 1; display: flex; align-items: center; gap: 10px; min-width: 0; min-height: 56px; padding: 12px 6px 12px 14px; background: none; border: 0; border-radius: 14px; text-align: left; }
.tour-card-main:hover { background: rgba(232, 183, 101, 0.08); }
.tour-card-text { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.tour-card-title { font-weight: 600; font-size: 16px; }
.tour-card-sub { color: var(--muted); font-size: 13px; }
.tour-card-action { display: inline-flex; align-items: center; gap: 2px; color: var(--accent); font-weight: 600; font-size: 14px; flex: none; }
.tour-card-action .icon-inline { margin: 0; }
.tour-card-hide { align-self: center; margin-right: 6px; background: transparent; border-color: transparent; -webkit-backdrop-filter: none; backdrop-filter: none; color: var(--muted); }
.daily-wrap { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.daily-card {
  display: flex; gap: 12px; align-items: stretch; width: 100%; padding: 0; overflow: hidden;
  border-radius: 14px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.04); text-align: left;
}
.daily-card:hover { border-color: var(--line-strong); }
.daily-photo { flex: none; width: 112px; min-height: 112px; background: #10141b; }
.daily-photo img { display: block; width: 100%; height: 100%; object-fit: cover; }
.daily-text { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 10px 12px 12px 0; min-width: 0; }
.daily-name { font-size: 17px; font-weight: 600; }
.daily-sub { color: var(--muted); font-size: 13px; }
.daily-why { font-size: 14px; margin-top: 2px; }
.daily-done { margin-top: 6px; }
.surprise-btn { width: 100%; justify-content: flex-start; flex-wrap: wrap; column-gap: 8px; row-gap: 0; padding: 8px 14px; }
.surprise-btn .btn-meta { font-size: 13px; }
.shelf-row { align-items: center; }
.shelf-progress { display: flex; align-items: center; gap: 10px; margin-top: 6px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.shelf-progress .progress { flex: 1; margin: 0; height: 4px; }
.shelf-count { flex: none; min-width: 8.5em; }
.row-hook { font-size: 14px; color: var(--text); opacity: 0.88; }

/* docked HUD extras */
.hud-extra { display: flex; flex-direction: column; gap: 8px; }
.tour-strip, .daily-chip {
  display: flex; align-items: center; gap: 4px; width: 100%;
  border-radius: var(--radius); border: 1px solid var(--line);
  background: var(--panel-weak);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.tour-strip { border-color: rgba(232, 183, 101, 0.35); }
.tour-strip-main, .daily-chip-main {
  flex: 1; display: flex; align-items: center; gap: 10px; min-width: 0; min-height: 52px;
  padding: 6px 4px 6px 14px; background: none; border: 0; border-radius: var(--radius); text-align: left;
}
.daily-chip-main { padding-left: 6px; }
.tour-strip-text, .daily-chip-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.tour-strip-title, .daily-chip-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tour-strip-text .eyebrow { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tour-strip-steps .tour-steps { margin: 0; }
.tour-strip-steps .tour-step { width: 10px; }
.tour-strip-leave, .daily-chip-close { flex: none; margin-right: 4px; background: transparent; border-color: transparent; -webkit-backdrop-filter: none; backdrop-filter: none; color: var(--muted); }
.daily-chip-thumb { flex: none; width: 40px; height: 40px; border-radius: 9px; overflow: hidden; background: #10141b; }
.daily-chip-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }

/* arrival + welcome + finish */
.arrival-tour { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 12px; margin: 0 0 8px; }
.arrival-other { font-size: 14px; color: var(--muted); }
.welcome-tour { border: 1px solid rgba(232, 183, 101, 0.35); background: var(--accent-soft); border-radius: 12px; padding: 12px 14px 4px; margin-top: 4px; }
.welcome .welcome-tour p { color: var(--text); margin: 4px 0 6px; }
.welcome .welcome-tour .welcome-tour-note { color: var(--muted); font-size: 13px; }
.welcome-stops { display: flex; flex-wrap: wrap; gap: 4px 0; margin: 0 0 6px; padding: 0; list-style: none; font-size: 13px; color: var(--muted); counter-reset: stop; }
.welcome-stops li { counter-increment: stop; }
.welcome-stops li + li::before { content: "→"; margin: 0 6px; color: var(--faint); }
.tour-finish .eyebrow { display: block; margin-bottom: 6px; }
.tour-finish .rows { margin-top: 6px; }

/* guided tours: list and one tour's screen */
.tours-entry { margin-top: 8px; }
.tag-following { border-color: rgba(232, 183, 101, 0.5); color: var(--accent); }
.tour-blurb { margin: 0 0 4px; }
.tour-action { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin: 12px 0 4px; }
.tour-action .btn { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tour-complete { display: flex; align-items: center; gap: 6px; margin: 12px 0 4px; color: var(--ok, #96d4ad); }
.tour-stops { counter-reset: none; }
.tour-stop { align-items: flex-start; }
.tour-stop-num { flex: none; width: 24px; height: 24px; margin-top: 1px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 13px; font-weight: 600; color: var(--muted); border: 1px solid var(--line-strong); }
.tour-stops .is-next .tour-stop-num { color: var(--accent); border-color: var(--accent); }
.tour-stop .row-tick { margin-top: 1px; }
.tour-stop-text { display: block; margin-top: 4px; }

/* logbook reach card */
.reach-card { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 10px 12px 14px; margin: 0 0 12px; border-radius: 12px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.04); text-align: left; }
.reach-card:hover { border-color: var(--line-strong); }
.reach-icon { color: var(--accent); }
.reach-text { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.reach-title { font-weight: 600; }
.reach-sub { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }

/* ——— scale ladder ——— */
.scale-summary { display: flex; flex-direction: column; gap: 2px; padding: 14px; border-radius: 12px; background: rgba(255, 255, 255, 0.04); margin: 12px 0 10px; }
.scale-far { display: flex; flex-direction: column; align-items: flex-start; background: none; border: 0; padding: 2px 0; min-height: 44px; text-align: left; }
.scale-far-name { font-size: 20px; font-weight: 600; }
.scale-far-name:hover { text-decoration: underline; text-decoration-color: var(--faint); text-underline-offset: 3px; }
.scale-far-dist { color: var(--accent); font-variant-numeric: tabular-nums; }
.scale-far-none { color: var(--muted); margin: 4px 0; }
.scale-count { color: var(--muted); font-size: 13px; margin: 4px 0 0; font-variant-numeric: tabular-nums; }
.scale-next { display: flex; align-items: center; gap: 10px; width: 100%; padding: 12px 14px; border-radius: 12px; border: 1px solid rgba(232, 183, 101, 0.35); background: var(--accent-soft); text-align: left; }
.scale-next:hover { background: rgba(232, 183, 101, 0.2); }
.scale-next-text { display: flex; flex-direction: column; gap: 1px; flex: 1; min-width: 0; }
.scale-next-eyebrow { color: var(--accent); }
.scale-next-name { font-weight: 600; }
.scale-next-dist { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.scale-next-go { display: inline-flex; align-items: center; color: var(--accent); font-weight: 600; font-size: 14px; flex: none; }
.scale-next-go .icon-inline { margin: 0; }
.scale-explain { margin: 12px 0 8px; font-size: 13px; }
.scale-list { list-style: none; margin: 0 0 8px; padding: 0; }
.scale-rung, .scale-band { display: grid; grid-template-columns: 34px minmax(0, 1fr); }
.scale-rail { position: relative; display: block; }
.scale-rail::before { content: ""; position: absolute; left: 16px; top: 0; bottom: 0; width: 2px; background: var(--line); }
.scale-band .scale-rail::before { background: repeating-linear-gradient(to bottom, var(--line-strong) 0 3px, transparent 3px 7px); }
.scale-fill { position: absolute; left: 16px; top: 0; width: 2px; background: var(--accent); }
.scale-rung.is-reached .scale-rail::before { background: var(--accent); }
.scale-rung.is-reached:has(+ .scale-band .scale-fill) .scale-rail::before,
.scale-rung.is-home .scale-rail::before { top: 50%; }
.scale-rung.is-home .scale-rail::before { background: var(--accent); }
.scale-rung:not(.is-reached) .scale-rail::before { background: var(--line); }
.scale-rung:last-child .scale-rail::before { bottom: 50%; }
.scale-node { position: absolute; left: 10px; top: 50%; width: 14px; height: 14px; margin-top: -7px; border-radius: 50%; border: 2px solid var(--line-strong); background: var(--panel-solid); }
.scale-rung.is-reached .scale-node { border-color: var(--accent); }
.scale-rung.is-visited .scale-node, .scale-rung.is-home .scale-node { background: var(--accent); border-color: var(--accent); }
.scale-rung.is-next .scale-node { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.scale-decade { position: absolute; left: 12px; width: 10px; height: 1px; background: var(--faint); }
.scale-density { position: absolute; left: 22px; height: 2px; margin-top: -1px; border-radius: 1px; background: var(--muted); }
.scale-mark { position: absolute; left: 13px; width: 8px; height: 8px; margin-top: -4px; border-radius: 50%; background: var(--accent); }
.scale-mark.is-far { left: 10px; width: 14px; height: 14px; margin-top: -7px; background: var(--panel-solid); border: 3px solid var(--accent); }
.scale-rung-body { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; min-height: 56px; padding: 8px 6px; background: none; border: 0; text-align: left; border-radius: 10px; justify-content: center; }
button.scale-rung-body:hover { background: var(--hover); }
.scale-rung-label { font-weight: 600; display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.scale-rung-note { color: var(--muted); font-size: 13px; }
.scale-rung-dist { font-size: 13px; font-variant-numeric: tabular-nums; color: var(--text); opacity: 0.85; }
.scale-tick { display: inline-flex; width: 18px; height: 18px; color: var(--accent); }
.scale-tick .icon { width: 18px; height: 18px; }
.scale-tag { font-size: 11px; padding: 1px 7px; }
.scale-band-body { display: flex; flex-direction: column; justify-content: center; gap: 2px; padding: 6px 6px 6px 18px; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.scale-band-visited { color: var(--text); opacity: 0.85; }
.scale-band-empty { color: var(--faint); }

/* ——— hidden UI ——— */
.show-ui {
  position: fixed; z-index: 4;
  right: calc(var(--gutter) + var(--safe-r)); bottom: calc(var(--gutter) + var(--safe-b));
  min-height: 44px; padding: 0 16px;
  border-radius: 12px; border: 1px solid var(--line);
  background: rgba(10, 13, 19, 0.5); color: var(--muted);
  font-size: 14px;
  display: none;
}
body.ui-hidden .show-ui { display: block; }
body.ui-hidden .hud, body.ui-hidden .panel, body.ui-hidden .toasts, body.ui-hidden .label-layer { display: none !important; }

/* ——— universe map (src/ui/mapview.js hosts src/map/universe-map.js) ———
   The map sits above the HUD and below panels (z 5), toasts and modals. While it is open the sky, its
   labels and the HUD step aside; the map draws its own opaque background. */
.map-host { position: absolute; inset: 0; z-index: 3; background: var(--bg); overflow: hidden; }
body.map-open #sky { visibility: hidden; }
body.map-open .label-layer, body.map-open .hud, body.map-open .show-ui { display: none !important; }
.map-loading {
  position: absolute; inset: 0; z-index: 1;
  display: grid; place-content: center; justify-items: center; gap: 14px;
  padding: 24px; background: var(--bg); outline: none;
}
.map-loading-bar { width: 160px; height: 2px; background: var(--line); overflow: hidden; border-radius: 1px; }
.map-loading-bar span { display: block; width: 40%; height: 100%; background: var(--accent); animation: boot-slide 1.4s ease-in-out infinite; }
.map-loading-text { margin: 0; color: var(--muted); font-size: 14px; }
/* Trip status, appended to the map's title card while flying. */
.map-flight { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); }
.map-flight-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 8px; font-size: 14px; }
.map-flight-eyebrow { color: var(--accent); }
.map-flight-dest { font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.map-flight-time { margin-left: auto; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.map-flight-progress { height: 4px; margin-top: 6px; }
.map-flight-progress .progress-fill { transition: width 0.25s linear; }
.map-flight.is-floating {
  position: absolute; z-index: 2; left: 50%; bottom: calc(76px + var(--safe-b)); transform: translateX(-50%);
  width: min(360px, calc(100% - 2 * var(--gutter))); margin: 0;
  padding: 8px 14px 10px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--panel-weak); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}

/* Credit for the docked view (photo or surface map; licence attribution): legible, quiet, one line.
   It never sets the card's width (contain), and its tap target reaches past its line without adding
   height to the card. Tapping shows the whole credit and the source link. */
.view-credit {
  align-self: stretch; contain: inline-size; min-width: min(210px, 100%);
  margin: 2px 0 0; font-size: 12px; line-height: 1.35; color: var(--faint);
}
.view-credit-line {
  display: block; width: 100%; margin: -13px 0; padding: 13px 0;
  background: none; border: 0; border-radius: 4px; color: inherit; font: inherit; text-align: left;
  position: relative; cursor: pointer;
}
.view-credit-text { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.view-credit-line:hover .view-credit-text { color: var(--muted); }
.view-credit.is-open .view-credit-text { white-space: normal; overflow-wrap: anywhere; }
.view-credit-more { display: block; margin-top: 2px; }
.view-credit-more[hidden] { display: none; }
.view-credit a { color: var(--muted); display: inline-flex; align-items: center; gap: 2px; min-height: 32px; }

/* Narrow phones: four buttons beside the place name leave it too little room. "Hide interface" stays
   in the menu and on the H key. */
@media (max-width: 479px) {
  .hud-actions .hud-hide { display: none; }
}

/* ——— wider screens and phones in landscape: side panel ——— */
@media (min-width: 900px), (orientation: landscape) and (max-height: 540px) {
  .panel {
    top: calc(12px + var(--safe-t)); right: calc(12px + var(--safe-r)); bottom: calc(12px + var(--safe-b)); left: auto;
    width: min(var(--panel-w), 58vw);
    max-height: none;
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 0;
    animation-name: panel-in;
  }
  @keyframes panel-in { from { transform: translateX(16px); opacity: 0; } to { transform: none; opacity: 1; } }
  .panel-grip { display: none; }
  .panel-head { padding-top: 8px; }
  .place-launch { border-radius: 0 0 15px 15px; }
  body.panel-open .hud-top { right: calc(min(var(--panel-w), 58vw) + 12px); }
  body.panel-open .hud-bottom { right: calc(min(var(--panel-w), 58vw) + 12px); }
  /* A sheet opened from the map sits beside it: the map shrinks rather than hiding its controls. */
  body.panel-open .map-host { right: calc(min(var(--panel-w), 58vw) + 12px + var(--safe-r)); }
}

@media (min-width: 900px) {
  :root { --gutter: 20px; }
  .hud-bottom { flex-direction: row; flex-wrap: wrap; align-items: stretch; justify-content: center; }
  .hud-flight .hud-bottom .flight-panel { width: min(680px, 100%); }
  .hud-flight .readouts { grid-template-columns: 1.4fr 1fr 1fr; }
  .hud-flight .readout:first-child { grid-column: auto; }
  .loc-name { font-size: 22px; }
  .toasts { top: calc(var(--safe-t) + 24px); }
  .modal-arrival { max-height: min(88vh, 860px); }
}

@media (orientation: landscape) and (max-height: 540px) {
  :root { --gutter: 10px; }
  .hud-bottom { flex-direction: row; flex-wrap: wrap; align-items: stretch; justify-content: flex-start; }
  .hud-docked .hud-bottom { --hud-extra-w: 240px; --hud-rank-w: 220px; --hud-go-w: 240px; }
  .hud-docked .hud-bottom .btn-go { min-height: 48px; }
  .hud-flight .hud-bottom { right: 0; }
  .hud-flight .flight-panel { width: min(560px, 100%); padding: 8px 12px 10px; }
  .hud-flight .readouts { grid-template-columns: 1.4fr 1fr 1fr; margin: 4px 0; }
  .hud-flight .readout:first-child { grid-column: auto; }
  .hud-flight .readout:first-child .readout-value { font-size: 17px; }
  .toasts { top: calc(var(--safe-t) + 12px); }
  .modal-backdrop { align-items: stretch; }
  .photo-card, .photo-wide { aspect-ratio: 21 / 9; }
  .hud-docked .hud-bottom .btn-go { font-size: 15px; }
}

/* ——— docked/flight HUD bottom row (side-by-side layouts) ———
   The row is a size container, so it adapts to the width actually left beside an open side panel
   rather than to the viewport. Nothing is squashed: with too little room the first-voyage strip or
   today's destination takes its own line above the row, and the rank card drops its XP figures. While
   a side panel is open the strip/chip is hidden altogether: the same card is at the top of Discover. */
@media (min-width: 900px), (orientation: landscape) and (max-height: 540px) {
  .hud-bottom { container: hudrow / inline-size; }
  /* Share the row and shrink together (basis 0) up to their natural widths. */
  .hud-docked .hud-bottom > .hud-extra { flex: 1 1 0; max-width: var(--hud-extra-w, 300px); min-width: 0; justify-content: center; }
  .hud-docked .hud-bottom > .rank-card { flex: 1 1 0; max-width: var(--hud-rank-w, 280px); min-width: 0; }
  .hud-docked .hud-bottom > .btn-go { flex: 1 1 0; max-width: var(--hud-go-w, 300px); min-width: 0; white-space: nowrap; }
  .rank-line { flex-wrap: nowrap; min-width: 0; }
  .rank-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
  .rank-xp { white-space: nowrap; flex: none; }
  body.panel-open .hud-docked .hud-extra { display: none; }
}
/* Three items no longer fit on one line: the strip/chip gets its own line above the row. */
@container hudrow (max-width: 919px) {
  /* A full-width flex item forces the line break; its card stays a comfortable width, centred. */
  .hud-docked .hud-bottom > .hud-extra { flex: 1 1 100%; max-width: none; align-items: center; }
  .hud-docked .hud-extra > * { max-width: 600px; }
}
/* Tight: compact rank card (title only), smaller go button text. */
@container hudrow (max-width: 520px) {
  .hud-docked .rank-xp { display: none; }
  .hud-docked .btn-go { font-size: 15px; padding: 0 12px; }
  .hud-flight .readouts { grid-template-columns: 1fr 1fr; }
  .hud-flight .readout:first-child { grid-column: 1 / -1; }
}
/* Too narrow for rank and button side by side: stack them, full width. */
@container hudrow (max-width: 440px) {
  .hud-docked .hud-bottom > .rank-card, .hud-docked .hud-bottom > .btn-go { flex: 1 1 100%; max-width: none; }
  .hud-docked .rank-xp { display: inline; }
}

/* Phones: the arrival card rises from the bottom like the panels. */
@media (max-width: 599px) {
  .modal-backdrop:has(.modal-arrival) { align-items: flex-end; padding: calc(12px + var(--safe-t)) 0 0; }
  .modal-arrival { border-radius: 18px 18px 0 0; max-height: 100%; }
  .arrival-actions { padding-bottom: calc(14px + var(--safe-b)); }
  .presets { gap: 4px; }
  .presets .preset { font-size: 13px; padding: 0 2px; }
}

/* ——— share your journey (src/ui/share.js) ——— */
.modal.modal-share { max-width: 620px; }
.share-preview { border-radius: 12px; overflow: hidden; border: 1px solid var(--line); background: #03050a; aspect-ratio: 1200 / 630; }
.share-canvas { display: block; width: 100%; height: auto; }
.share-bg-note { font-size: 13px; margin: 6px 0 14px; overflow-wrap: anywhere; }
.share-name-row { display: flex; align-items: center; gap: 10px; }
.share-name-row .input { flex: 1; min-width: 0; }
.share-name-count { flex: none; font-size: 13px; font-variant-numeric: tabular-nums; }
.share-hint { font-size: 13px; margin: 0; }
.share-actions .btn .icon-inline { margin-right: 6px; }
.share-link { margin-top: 16px; }
.share-link-input { font-size: 14px; color: var(--muted); }
.share .field label { font-weight: 600; font-size: 14px; }
@media (max-width: 599px) {
  .modal.modal-share { padding: 16px; }
  .share-actions .btn { flex: 1 1 100%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
  .boot-bar span, .map-loading-bar span { animation: none; width: 100%; opacity: 0.5; }
}
