/* ─────────────────────────────────────────────────────────────
   Tokens
   ───────────────────────────────────────────────────────────── */
@property --ang { syntax: '<angle>'; inherits: false; initial-value: 0deg; }
@property --pill-a { syntax: '<color>'; inherits: true; initial-value: #0a84ff; }
@property --pill-b { syntax: '<color>'; inherits: true; initial-value: #5e5ce6; }

:root {
  --bg: #000;
  --fg: #f5f5f7;
  --fg2: rgba(235, 235, 245, .72);
  --muted: rgba(235, 235, 245, .5);
  --hair: rgba(255, 255, 255, .09);
  --fill: rgba(120, 120, 128, .22);
  --fill2: rgba(120, 120, 128, .14);
  --glass: rgba(22, 22, 24, .58);
  --glass-strong: rgba(28, 28, 30, .78);
  --glass-edge: rgba(255, 255, 255, .12);
  --shadow: 0 24px 60px -12px rgba(0, 0, 0, .55), 0 2px 8px rgba(0, 0, 0, .25);
  --accent: #0a84ff;
  --veil: radial-gradient(ellipse 70% 60% at 50% 42%, rgba(0,0,0,.72) 0%, rgba(0,0,0,.35) 55%, rgba(0,0,0,.1) 100%);
  --hero-grad: linear-gradient(100deg, #64d2ff 0%, #0a84ff 22%, #5e5ce6 44%, #bf5af2 62%, #ff375f 80%, #ff9f0a 100%);

  --sans: "SF Pro Display", -apple-system, BlinkMacSystemFont, "Inter", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei UI", system-ui, sans-serif;
  --num: "SF Pro Display", -apple-system, BlinkMacSystemFont, "Inter", system-ui, sans-serif;

  /* overwritten from JS with real spring curves via linear() when supported */
  --spring: cubic-bezier(.34, 1.36, .4, 1);
  --spring-soft: cubic-bezier(.22, 1, .36, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  color-scheme: dark;
}
:root:lang(zh-HK) {
  --sans: "SF Pro Display", -apple-system, BlinkMacSystemFont, "Inter", "PingFang HK", "PingFang TC", "Microsoft JhengHei UI", system-ui, sans-serif;
}
@media (prefers-color-scheme: light) {
  :root {
    --bg: #f5f5f7;
    --fg: #1d1d1f;
    --fg2: rgba(29, 29, 31, .78);
    --muted: rgba(60, 60, 67, .6);
    --hair: rgba(0, 0, 0, .08);
    --fill: rgba(120, 120, 128, .14);
    --fill2: rgba(120, 120, 128, .08);
    --glass: rgba(255, 255, 255, .62);
    --glass-strong: rgba(255, 255, 255, .84);
    --glass-edge: rgba(255, 255, 255, .7);
    --shadow: 0 24px 60px -16px rgba(0, 0, 0, .22), 0 2px 8px rgba(0, 0, 0, .06);
    --accent: #0071e3;
    --veil: radial-gradient(ellipse 70% 60% at 50% 42%, rgba(245,245,247,.82) 0%, rgba(245,245,247,.45) 55%, rgba(245,245,247,.1) 100%);
    color-scheme: light;
  }
}

/* ─────────────────────────────────────────────────────────────
   Base
   ───────────────────────────────────────────────────────────── */
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--fg);
  font: 15px/1.47 var(--sans);
  letter-spacing: -.01em;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; padding: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 10px; }
.num { font-family: var(--num); font-variant-numeric: tabular-nums; font-feature-settings: "tnum", "ss01"; }
[hidden] { display: none !important; }

.glass {
  background: var(--glass);
  -webkit-backdrop-filter: saturate(180%) blur(28px);
  backdrop-filter: saturate(180%) blur(28px);
  border: .5px solid var(--glass-edge);
  box-shadow: var(--shadow);
}

/* ─────────────────────────────────────────────────────────────
   Stage: aurora → map → veil
   ───────────────────────────────────────────────────────────── */
.aurora { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.aurora i {
  position: absolute; width: 60vmax; height: 60vmax; border-radius: 50%;
  filter: blur(90px); opacity: .32; mix-blend-mode: screen;
  animation: drift 22s ease-in-out infinite alternate;
}
.aurora i:nth-child(1) { background: #0a84ff; left: -15vmax; top: -20vmax; }
.aurora i:nth-child(2) { background: #bf5af2; right: -20vmax; top: 10vmax; animation-duration: 28s; animation-delay: -6s; }
.aurora i:nth-child(3) { background: #ff375f; left: 20vmax; bottom: -35vmax; animation-duration: 34s; animation-delay: -12s; opacity: .2; }
@media (prefers-color-scheme: light) { .aurora i { mix-blend-mode: multiply; opacity: .16; } }
.aurora .halo {
  position: absolute; left: 50%; top: 40vh; width: 170vmax; height: 120vh; translate: -50% 0;
  background: radial-gradient(ellipse 50% 50% at 50% 100%, rgba(100, 210, 255, .55), rgba(10, 132, 255, .25) 45%, transparent 70%);
  filter: blur(30px); transition: opacity 1.2s var(--ease-out);
}
body[data-view="dash"] .aurora .halo { opacity: 0; }
@keyframes drift {
  0%   { transform: translate3d(0, 0, 0) scale(1); }
  50%  { transform: translate3d(8vmax, 6vmax, 0) scale(1.15); }
  100% { transform: translate3d(-6vmax, 10vmax, 0) scale(.92); }
}

#map {
  position: fixed; left: 0; right: 0; top: 0; height: 160vh; z-index: 1;
  opacity: 0; transform: scale(1.08);
  transition: opacity 1.6s var(--ease-out), transform 2.2s var(--ease-out);
}
body.map-ready #map { opacity: 1; transform: none; }

.veil {
  position: fixed; inset: 0; z-index: 2; pointer-events: none;
  background: var(--veil);
  transition: opacity 1.2s var(--ease-out);
}
body[data-view="dash"] .veil { opacity: 0; }

/* ─────────────────────────────────────────────────────────────
   Landing
   ───────────────────────────────────────────────────────────── */
.landing {
  position: fixed; inset: 0; z-index: 3;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 32px 16px calc(32px + env(safe-area-inset-bottom));
  text-align: center;
  pointer-events: none;
  transition: opacity .7s var(--ease-out), transform 1s var(--spring-soft), filter .8s var(--ease-out);
}
.landing > * { pointer-events: auto; }
body[data-view="dash"] .landing {
  opacity: 0; transform: scale(1.08); filter: blur(24px); pointer-events: none;
}
body.sheet-open .landing { transform: scale(.96); filter: blur(6px); opacity: .5; }

.brand {
  position: absolute; top: max(24px, env(safe-area-inset-top)); left: 50%; translate: -50% 0;
  display: flex; align-items: center; gap: 8px;
  font-weight: 600; font-size: 15px; letter-spacing: -.01em; color: var(--fg2);
}
.brand svg { width: 22px; height: 22px; fill: currentColor; }

.hero {
  margin: 0; font-weight: 700;
  font-size: clamp(44px, 8.4vw, 104px);
  line-height: 1.04; letter-spacing: -.045em;
}
.hero span { display: block; }
.grad {
  background: var(--hero-grad); background-size: 200% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: shimmer 9s ease-in-out infinite alternate;
  padding-bottom: .06em;
}
@keyframes shimmer { to { background-position: 100% 0; } }

.lede {
  max-width: 600px; margin: 26px auto 0;
  font-size: clamp(16px, 1.6vw, 20px); line-height: 1.5; color: var(--fg2); letter-spacing: -.012em;
}
@media (max-width: 560px) { .lede .br { display: none; } }

.reveal {
  opacity: 0; transform: translateY(32px) scale(.97); filter: blur(16px);
  animation: rise 1.3s var(--spring-soft) forwards;
  animation-delay: calc(var(--d, 0) * 110ms + 250ms);
}
@keyframes rise { to { opacity: 1; transform: none; filter: blur(0); } }

/* Drop zone with Apple-Intelligence edge glow */
.drop {
  position: relative; display: block; cursor: pointer;
  width: min(560px, 100%); margin-top: 44px;
  border-radius: 28px;
  transition: transform .7s var(--spring), box-shadow .5s var(--ease-out);
}
.drop-inner {
  position: relative; z-index: 1;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 34px 24px 30px; border-radius: inherit;
  background: var(--glass);
  -webkit-backdrop-filter: saturate(180%) blur(30px); backdrop-filter: saturate(180%) blur(30px);
  border: .5px solid var(--glass-edge);
  box-shadow: var(--shadow);
}
.drop-icon {
  width: 54px; height: 54px; border-radius: 16px; display: grid; place-items: center; margin-bottom: 6px;
  background: linear-gradient(145deg, #0a84ff, #5e5ce6 60%, #bf5af2);
  box-shadow: 0 10px 30px -8px rgba(94, 92, 230, .7), inset 0 1px 0 rgba(255,255,255,.35);
  transition: transform .8s var(--spring);
}
.drop-icon svg { width: 26px; height: 26px; fill: none; stroke: #fff; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.drop-title { font-size: 19px; font-weight: 600; letter-spacing: -.02em; }
.drop-title u { text-decoration: none; color: var(--accent); }
.drop-hint { font-size: 13px; color: var(--muted); }
.drop:hover { transform: translateY(-3px) scale(1.012); }
.drop:hover .drop-icon { transform: translateY(-3px) rotate(-6deg) scale(1.06); }
.drop:active { transform: scale(.985); transition-duration: .2s; }
.drop.over { transform: scale(1.04); }
.drop.over .drop-icon { transform: translateY(-6px) scale(1.12); }
.drop.over .glow, .drop:hover .glow { opacity: 1; }

.glow {
  position: absolute; inset: -1.5px; border-radius: inherit; z-index: 0; pointer-events: none;
  opacity: 0; transition: opacity .8s var(--ease-out);
}
.glow::before, .glow::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit;
  background: conic-gradient(from var(--ang), #0a84ff, #5e5ce6, #bf5af2, #ff375f, #ff9f0a, #ffd60a, #30d158, #64d2ff, #0a84ff);
  animation: spin 4.5s linear infinite;
}
.glow::before {
  padding: 2px;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
}
.glow::after { filter: blur(26px); opacity: .55; inset: 6px; }
@keyframes spin { to { --ang: 360deg; } }
.drop .glow { opacity: .35; }

.ghost {
  margin-top: 22px; font-size: 15px; color: var(--accent); padding: 8px 14px; border-radius: 999px;
  transition: background .3s, transform .5s var(--spring);
}
.ghost:hover { background: var(--fill2); }
.ghost b { font-weight: inherit; }
.ghost span { display: inline-block; transition: transform .5s var(--spring); }
.ghost:hover span { transform: translateX(4px); }

.loading { display: flex; flex-direction: column; align-items: center; gap: 18px; color: var(--fg2); font-size: 17px; }
.landing.is-loading > :not(.loading):not(.brand) { display: none; }
.spinner {
  width: 44px; height: 44px; border-radius: 50%;
  background: conic-gradient(from var(--ang), transparent 0 20%, #0a84ff, #bf5af2, #ff375f);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #000 calc(100% - 3px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #000 calc(100% - 3px));
  animation: spin 1.1s linear infinite;
}

/* ─────────────────────────────────────────────────────────────
   Sheet (modal)
   ───────────────────────────────────────────────────────────── */
.scrim {
  position: fixed; inset: 0; z-index: 20;
  background: rgba(0, 0, 0, .35);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  opacity: 0; transition: opacity .5s var(--ease-out);
}
.scrim.open { opacity: 1; }

.sheet {
  position: fixed; z-index: 21; left: 50%; top: 50%;
  width: min(580px, calc(100% - 32px));
  border-radius: 34px;
  translate: -50% -50%;
  opacity: 0; transform: scale(.9) translateY(30px); filter: blur(10px);
  transition: opacity .45s var(--ease-out), transform .8s var(--spring), filter .5s var(--ease-out);
}
.sheet.open { opacity: 1; transform: none; filter: none; }
.sheet.busy .glow { opacity: 1; }
.sheet-body {
  position: relative; z-index: 1; border-radius: inherit; padding: 30px 28px 26px;
  background: var(--glass-strong);
  -webkit-backdrop-filter: saturate(180%) blur(40px); backdrop-filter: saturate(180%) blur(40px);
  border: .5px solid var(--glass-edge);
  box-shadow: 0 40px 100px -20px rgba(0, 0, 0, .6);
  overflow: hidden;
}
.sheet-body > * { animation: fadeUp .7s var(--spring-soft) both; }
.sheet-body > :nth-child(2) { animation-delay: 60ms; }
.sheet-body > :nth-child(3) { animation-delay: 120ms; }
.sheet-body > :nth-child(4) { animation-delay: 180ms; }
.sheet-body > :nth-child(5) { animation-delay: 240ms; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(14px); filter: blur(6px); } }

.file-row { display: flex; align-items: center; gap: 14px; }
.file-ico {
  flex: none; width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center;
  background: linear-gradient(145deg, #30d158, #0a84ff);
  box-shadow: 0 8px 24px -8px rgba(10, 132, 255, .6), inset 0 1px 0 rgba(255,255,255,.3);
  color: #fff; font: 700 11px/1 var(--num); letter-spacing: .04em;
}
.file-row h3 { margin: 0; font-size: 20px; font-weight: 700; letter-spacing: -.025em; overflow-wrap: anywhere; }
.file-row p { margin: 2px 0 0; color: var(--muted); font-size: 14px; }

.stat-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 22px 0 6px; }
.stat-strip div { background: var(--fill2); border-radius: 16px; padding: 12px 14px; }
.stat-strip b { display: block; font: 700 24px/1.1 var(--num); letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.stat-strip span { font-size: 12px; color: var(--muted); }

.sheet h4 { margin: 22px 0 12px; font-size: 15px; font-weight: 600; color: var(--fg2); }
.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.choice {
  position: relative; text-align: left; border-radius: 22px; padding: 18px 18px 16px;
  background: var(--fill2); border: .5px solid var(--hair);
  display: flex; flex-direction: column; gap: 6px;
  transition: transform .6s var(--spring), background .3s, box-shadow .4s;
}
.choice:hover { transform: translateY(-3px); background: var(--fill); box-shadow: 0 18px 40px -18px rgba(0,0,0,.5); }
.choice:active { transform: scale(.97); transition-duration: .15s; }
.choice .ci { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; margin-bottom: 6px; color: #fff; }
.choice .ci svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.choice.local .ci { background: linear-gradient(145deg, #64d2ff, #0a84ff); }
.choice.share .ci { background: linear-gradient(145deg, #bf5af2, #ff375f); }
.choice b { font-size: 17px; letter-spacing: -.02em; }
.choice span { font-size: 13px; color: var(--muted); line-height: 1.4; }
.sheet .cancel { display: block; margin: 18px auto 0; color: var(--muted); font-size: 14px; padding: 6px 12px; border-radius: 999px; }
.sheet .cancel:hover { color: var(--fg); background: var(--fill2); }

.center { text-align: center; }
.big-ico { width: 76px; height: 76px; margin: 6px auto 14px; display: block; }
.sheet h3.t { margin: 0; font-size: 24px; font-weight: 700; letter-spacing: -.03em; }
.sheet p.s { margin: 6px auto 0; color: var(--muted); font-size: 15px; max-width: 420px; }

.check circle { fill: none; stroke: #30d158; stroke-width: 3; stroke-dasharray: 220; stroke-dashoffset: 220; animation: draw .9s var(--ease-out) .1s forwards; }
.check path { fill: none; stroke: #30d158; stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 60; stroke-dashoffset: 60; animation: draw .6s var(--spring-soft) .6s forwards; }
.check { animation: pop .9s var(--spring) both; }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes pop { from { transform: scale(.6); opacity: 0; } }

.link-field {
  display: flex; align-items: center; gap: 6px; margin: 22px 0 0; padding: 6px 6px 6px 16px;
  background: var(--fill2); border-radius: 18px; border: .5px solid var(--hair);
}
.link-field input {
  flex: 1; min-width: 0; border: 0; background: none; color: var(--fg); font: 500 15px/1.4 var(--num); outline: none;
  text-overflow: ellipsis;
}
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 40px; padding: 0 18px; border-radius: 999px; font-weight: 600; font-size: 15px; letter-spacing: -.01em;
  white-space: nowrap;
  transition: transform .5s var(--spring), background .25s, opacity .25s;
}
.btn:active { transform: scale(.95); transition-duration: .12s; }
.btn.primary { background: var(--accent); color: #fff; }
.btn.primary:hover { background: color-mix(in srgb, var(--accent) 88%, #fff); }
.btn.tonal { background: var(--fill); }
.btn.tonal:hover { background: color-mix(in srgb, var(--fill) 100%, var(--fg) 6%); }
.btn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn-row { display: flex; gap: 10px; justify-content: center; margin-top: 18px; flex-wrap: wrap; }
.fine { margin: 14px 0 0; font-size: 12.5px; color: var(--muted); text-align: center; }

.progress { height: 6px; border-radius: 3px; background: var(--fill); overflow: hidden; margin: 26px 0 4px; }
.progress i {
  display: block; height: 100%; width: 40%; border-radius: inherit;
  background: linear-gradient(90deg, #0a84ff, #bf5af2, #ff375f);
  animation: indet 1.4s var(--ease-out) infinite;
}
@keyframes indet { from { transform: translateX(-100%); } to { transform: translateX(260%); } }

/* ─────────────────────────────────────────────────────────────
   Dashboard
   ───────────────────────────────────────────────────────────── */
.dash { position: fixed; inset: 0; z-index: 4; pointer-events: none; }
.dash > * { pointer-events: auto; }
.dash .topbar { pointer-events: none; }
.dash .topbar > * { pointer-events: auto; }

/* entrance choreography */
.dash .enter {
  opacity: 0; filter: blur(12px);
  transition: opacity .7s var(--ease-out), transform 1s var(--spring), filter .7s var(--ease-out);
  transition-delay: calc(var(--d, 0) * 80ms + 350ms);
}
body:not([data-view="dash"]) .dash { visibility: hidden; transition: visibility 0s .8s; }
body:not([data-view="dash"]) .dash .enter { transition-delay: 0s; }
body[data-view="dash"] .dash .enter { opacity: 1; transform: none; filter: none; }

.topbar {
  position: absolute; top: max(16px, env(safe-area-inset-top)); left: 16px; right: 16px;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px;
}
.title {
  justify-self: start; display: flex; align-items: center; gap: 10px;
  padding: 6px 16px 6px 6px; border-radius: 999px; min-width: 0; max-width: 100%;
  transform: translateY(-24px);
}
.home {
  flex: none; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center;
  background: linear-gradient(145deg, #0a84ff, #5e5ce6 60%, #bf5af2); color: #fff;
  transition: transform .6s var(--spring);
}
.home:hover { transform: rotate(-12deg) scale(1.06); }
.home svg { width: 20px; height: 20px; fill: currentColor; }
.title-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.title-text b { font-size: 15px; letter-spacing: -.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.title-text span { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.seg {
  position: relative; display: flex; padding: 4px; border-radius: 999px; transform: translateY(-24px);
}
.seg button {
  position: relative; z-index: 1; padding: 8px 22px; border-radius: 999px; font-size: 14px; font-weight: 600;
  color: var(--fg2); transition: color .35s;
}
.seg button[aria-selected="true"] { color: #fff; }
.seg-pill {
  position: absolute; top: 4px; bottom: 4px; left: 0; width: var(--w, 0); border-radius: 999px;
  transform: translateX(var(--x, 0));
  background: linear-gradient(145deg, var(--pill-a, #0a84ff), var(--pill-b, #5e5ce6));
  box-shadow: 0 6px 20px -6px var(--pill-a, #0a84ff);
  transition: transform .7s var(--spring), width .7s var(--spring), --pill-a .6s, --pill-b .6s;
}

.actions { justify-self: end; display: flex; gap: 8px; transform: translateY(-24px); }
.actions .btn { height: 44px; padding: 0 18px; }
.actions .btn.glass { background: var(--glass); }
.actions .btn.glass:hover { background: var(--glass-strong); }

.panel {
  position: absolute; left: 16px; top: 84px; bottom: 16px; width: 348px;
  border-radius: 28px; padding: 22px 20px 18px;
  overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none;
  transform: translateX(-40px);
}
.panel::-webkit-scrollbar { display: none; }
.handle { display: none; }

.kpi-label { font-size: 13px; color: var(--muted); font-weight: 500; }
.kpi-big { display: flex; align-items: baseline; gap: 8px; margin-top: 2px; }
.kpi-big b {
  font-size: 68px; line-height: 1; font-weight: 700; letter-spacing: -.05em;
  background: linear-gradient(180deg, var(--fg) 30%, color-mix(in srgb, var(--fg) 55%, transparent));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.kpi-big small { font-size: 17px; color: var(--muted); font-weight: 600; }
.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-top: 16px; }
.kpis div { background: var(--fill2); border-radius: 16px; padding: 10px 12px; }
.kpis b { display: block; font: 700 22px/1.15 var(--num); letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.kpis b small { font-size: 12px; color: var(--muted); font-weight: 600; margin-left: 3px; letter-spacing: 0; }
.kpis span { font-size: 12px; color: var(--muted); }

.group { margin-top: 24px; }
.group h2 { margin: 0 0 10px; font-size: 12px; font-weight: 600; color: var(--muted); letter-spacing: .02em; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 7px; padding: 6px 13px; border-radius: 999px;
  font-size: 13.5px; font-weight: 600; color: var(--muted); background: var(--fill2);
  border: .5px solid transparent;
  transition: transform .5s var(--spring), background .3s, color .3s, border-color .3s;
}
.chip:hover { color: var(--fg2); }
.chip:active { transform: scale(.92); transition-duration: .12s; }
.chip[aria-pressed="true"] { color: var(--fg); background: var(--fill); border-color: var(--hair); }
.chip i { width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--muted)); transition: transform .5s var(--spring), opacity .3s; }
.chip[aria-pressed="false"] i { transform: scale(.5); opacity: .5; }
.chip small { font-weight: 500; color: var(--muted); font-size: 12px; }

.bars { display: flex; flex-direction: column; gap: 12px; }
.bar-row { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: baseline; }
.bar-row .lbl { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; }
.bar-row .lbl i { width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.bar-row .lbl small { color: var(--muted); font-weight: 500; font-size: 12px; }
.bar-row .val { font: 600 15px/1 var(--num); font-variant-numeric: tabular-nums; }
.bar-row .val small { color: var(--muted); font-size: 11px; margin-left: 2px; }
.bar-row .track { grid-column: 1 / -1; height: 6px; border-radius: 3px; background: var(--fill2); overflow: hidden; }
.bar-row .track i {
  display: block; height: 100%; border-radius: inherit; width: var(--p, 0%);
  background: linear-gradient(90deg, color-mix(in srgb, var(--c) 55%, transparent), var(--c));
  transition: width 1s var(--spring);
}
.bar-row .sub { grid-column: 1 / -1; font-size: 12px; color: var(--muted); margin-top: -1px; }

.cities { list-style: none; margin: 0; padding: 0; }
.cities li + li { border-top: .5px solid var(--hair); }
.city {
  width: 100%; display: grid; grid-template-columns: 22px 1fr auto; gap: 2px 10px; align-items: center;
  padding: 9px 8px; border-radius: 12px; text-align: left;
  transition: background .25s, transform .5s var(--spring);
}
.city:hover { background: var(--fill2); }
.city:active { transform: scale(.98); transition-duration: .12s; }
.city .rk { font: 600 12px/1 var(--num); color: var(--muted); text-align: center; }
.city .nm { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.city .nm small { color: var(--muted); font-weight: 500; font-size: 12px; margin-left: 6px; }
.city .v { font: 600 14px/1 var(--num); font-variant-numeric: tabular-nums; text-align: right; }
.city .mini { grid-column: 2 / -1; height: 3px; border-radius: 2px; background: var(--fill2); overflow: hidden; }
.city .mini i { display: block; height: 100%; width: var(--p); background: var(--c); border-radius: inherit; transition: width 1s var(--spring), background .5s; }
.more { width: 100%; margin-top: 6px; padding: 8px; border-radius: 12px; color: var(--accent); font-size: 13.5px; font-weight: 600; }
.more:hover { background: var(--fill2); }

.foot { margin: 22px 2px 0; font-size: 12px; line-height: 1.5; color: var(--muted); }

.legend {
  position: absolute; left: 380px; bottom: 22px; padding: 12px 16px 10px; border-radius: 18px; min-width: 260px;
  transform: translateY(30px);
}
.legend b { display: block; font-size: 12px; font-weight: 600; color: var(--fg2); margin-bottom: 8px; }
.legend .ramp { height: 8px; border-radius: 4px; background: var(--ramp); transition: background .6s; }
.legend .ticks { display: flex; justify-content: space-between; margin-top: 5px; font: 500 11px/1 var(--num); color: var(--muted); font-variant-numeric: tabular-nums; }

.zoom {
  position: absolute; right: 16px; bottom: 44px; display: flex; flex-direction: column; border-radius: 18px; overflow: hidden;
  transform: translateX(30px);
}
.zoom button { width: 44px; height: 44px; font-size: 22px; font-weight: 400; display: grid; place-items: center; transition: background .2s; }
.zoom button + button { border-top: .5px solid var(--hair); }
.zoom button:hover { background: var(--fill2); }
.zoom svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; }

/* Detail card */
.detail {
  position: absolute; right: 16px; top: 84px; width: 400px; max-height: calc(100vh - 84px - 200px);
  border-radius: 28px; display: flex; flex-direction: column; overflow: hidden;
  opacity: 0; transform: translateX(40px) scale(.96); filter: blur(10px); pointer-events: none;
  transition: opacity .4s var(--ease-out), transform .8s var(--spring), filter .4s var(--ease-out);
}
.detail.show { opacity: 1; transform: none; filter: none; pointer-events: auto; }
.detail header { display: flex; gap: 12px; align-items: flex-start; padding: 20px 20px 4px; }
.detail header div { flex: 1; min-width: 0; }
.detail h3 { margin: 0; font-size: 22px; font-weight: 700; letter-spacing: -.03em; }
.detail header p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.close {
  flex: none; width: 30px; height: 30px; border-radius: 50%; background: var(--fill); display: grid; place-items: center;
  transition: transform .5s var(--spring), background .2s;
}
.close:hover { transform: rotate(90deg); }
.close svg { width: 12px; height: 12px; stroke: var(--fg2); stroke-width: 2.4; stroke-linecap: round; }
.dkpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 12px 20px 4px; }
.dkpis div { background: var(--fill2); border-radius: 14px; padding: 9px 11px; }
.dkpis b { display: block; font: 700 20px/1.15 var(--num); letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.dkpis span { font-size: 11.5px; color: var(--muted); }
.spark { padding: 12px 20px 2px; }
.spark svg { display: block; width: 100%; height: auto; overflow: visible; }
.spark circle { animation: dotIn .7s var(--spring) both; transform-box: fill-box; transform-origin: center; }
@keyframes dotIn { from { transform: scale(0); opacity: 0; } }
.spark .axis { font: 500 10px var(--num); fill: var(--muted); }
.tests { overflow-y: auto; padding: 6px 12px 14px; scrollbar-width: thin; }
.test {
  display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 10px 8px; border-radius: 12px;
  animation: fadeUp .6s var(--spring-soft) both; animation-delay: calc(var(--i, 0) * 25ms);
}
.test + .test { border-top: .5px solid var(--hair); }
.test .when { font-size: 13px; color: var(--fg2); font-variant-numeric: tabular-nums; display: flex; align-items: center; gap: 8px; }
.tag { font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 6px; color: var(--c); background: color-mix(in srgb, var(--c) 16%, transparent); }
.test .sp { font: 600 14px/1.2 var(--num); font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.test .sp span { color: var(--muted); font-weight: 500; }
.test .srv { grid-column: 1 / -1; font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Tooltip & toast */
.tip {
  position: fixed; z-index: 30; pointer-events: none; padding: 10px 12px; border-radius: 14px; min-width: 150px;
  font-size: 13px; transform-origin: 0 100%;
  animation: tipIn .35s var(--spring) both;
}
@keyframes tipIn { from { opacity: 0; transform: scale(.9); } }
.tip b { display: block; font-size: 14px; letter-spacing: -.02em; }
.tip .row { display: flex; justify-content: space-between; gap: 16px; color: var(--muted); }
.tip .row span:last-child { color: var(--fg); font-weight: 600; font-variant-numeric: tabular-nums; }

.toast {
  position: fixed; left: 50%; bottom: calc(28px + env(safe-area-inset-bottom)); z-index: 40;
  translate: -50% 0; padding: 12px 20px; border-radius: 999px;
  background: var(--glass-strong); -webkit-backdrop-filter: blur(30px) saturate(180%); backdrop-filter: blur(30px) saturate(180%);
  border: .5px solid var(--glass-edge); box-shadow: var(--shadow);
  font-weight: 600; font-size: 14px;
  opacity: 0; transform: translateY(30px) scale(.9); pointer-events: none;
  transition: opacity .3s var(--ease-out), transform .7s var(--spring);
}
.toast.show { opacity: 1; transform: none; }

/* MapLibre chrome */
.maplibregl-ctrl-bottom-right, .maplibregl-ctrl-bottom-left { bottom: 60vh; }
.maplibregl-ctrl-attrib { background: var(--glass) !important; -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); border-radius: 10px !important; font-size: 10.5px; }
.maplibregl-ctrl-attrib a { color: var(--muted) !important; }
.maplibregl-ctrl-attrib-button { filter: invert(var(--inv, 1)); }
@media (prefers-color-scheme: light) { .maplibregl-ctrl-attrib-button { --inv: 0; } }
body:not([data-view="dash"]) .maplibregl-ctrl-bottom-right { opacity: .5; }
.maplibregl-canvas:focus-visible { outline: none; }

/* ─────────────────────────────────────────────────────────────
   Compact layout
   ───────────────────────────────────────────────────────────── */
@media (max-width: 860px) {
  .topbar { grid-template-columns: 1fr auto; row-gap: 10px; left: 12px; right: 12px; top: max(12px, env(safe-area-inset-top)); }
  .seg { grid-column: 1 / -1; grid-row: 2; justify-self: stretch; }
  .seg button { flex: 1; padding: 8px 0; }
  .actions .btn { height: 44px; padding: 0 14px; }
  .actions .btn .lbl { display: none; }
  .title { padding-right: 14px; }

  .panel {
    left: 0; right: 0; top: auto; bottom: 0; width: auto; height: min(78vh, 680px);
    border-radius: 28px 28px 0 0; padding: 8px 18px calc(18px + env(safe-area-inset-bottom));
    transform: translateY(calc(100% - 172px));
    transition: opacity .7s var(--ease-out), transform .8s var(--spring), filter .7s var(--ease-out);
  }
  body[data-view="dash"] .dash .panel.enter { transform: translateY(calc(100% - 172px)); }
  body[data-view="dash"] .dash .panel.enter.expanded { transform: none; }
  .panel:not(.expanded) { overflow: hidden; }
  .handle { display: grid; place-items: center; width: 100%; height: 22px; margin-bottom: 4px; }
  .handle i { width: 38px; height: 5px; border-radius: 3px; background: var(--fill); }
  .kpi-big b { font-size: 52px; }
  .kpi-hero { display: flex; flex-direction: column; }

  .legend { left: 12px; right: auto; bottom: auto; top: 128px; min-width: 0; width: 210px; padding: 9px 12px 8px; }
  :root:lang(en) .legend { width: 236px; }
  .zoom { display: none; }

  .detail {
    left: 0; right: 0; top: auto; bottom: 0; width: auto; max-height: 72vh; z-index: 5;
    border-radius: 28px 28px 0 0; padding-bottom: env(safe-area-inset-bottom);
    transform: translateY(100%);
  }
  .detail.show { transform: none; }
  .choices { grid-template-columns: 1fr; }
  .stat-strip b { font-size: 20px; }
  .sheet-body { padding: 24px 20px 20px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .reveal { opacity: 1; transform: none; filter: none; }
}
body[data-view="dash"] .landing > * { pointer-events: none; }

/* ─────────────────────────────────────────────────────────────
   Panel tabs
   ───────────────────────────────────────────────────────────── */
.tabs { position: relative; display: flex; margin-top: 18px; padding: 3px; border-radius: 12px; background: var(--fill2); }
.tabs button { position: relative; z-index: 1; flex: 1; padding: 7px 0; border-radius: 9px; font-size: 13.5px; font-weight: 600; color: var(--muted); transition: color .3s; }
.tabs button[aria-selected="true"] { color: var(--fg); }
.tabs-pill {
  position: absolute; top: 3px; bottom: 3px; left: 0; width: var(--w, 50%); border-radius: 9px;
  transform: translateX(var(--x, 3px)); background: var(--fill);
  box-shadow: 0 3px 10px -3px rgba(0, 0, 0, .35), inset 0 .5px 0 rgba(255, 255, 255, .12);
  transition: transform .65s var(--spring), width .65s var(--spring);
}
#ov, #tl { animation: fadeUp .6s var(--spring-soft) both; }

/* ─────────────────────────────────────────────────────────────
   Timeline
   ───────────────────────────────────────────────────────────── */
.tl-head { display: flex; align-items: center; gap: 8px; margin-top: 22px; }
.tl-title { flex: 1; min-width: 0; text-align: center; }
.tl-title b { display: block; font-size: 22px; letter-spacing: -.03em; }
.tl-title span { font-size: 12px; color: var(--muted); }
.tl-nav {
  flex: none; width: 34px; height: 34px; border-radius: 50%; background: var(--fill2); font-size: 20px; line-height: 1; color: var(--fg2);
  transition: transform .5s var(--spring), background .2s, opacity .2s;
}
.tl-nav:hover:not(:disabled) { background: var(--fill); }
.tl-nav:active:not(:disabled) { transform: scale(.88); transition-duration: .12s; }
.tl-nav:disabled { opacity: .25; cursor: default; }

.months { display: grid; grid-template-columns: repeat(12, 1fr); gap: 3px; height: 74px; margin-top: 14px; }
.months button { display: flex; flex-direction: column; justify-content: flex-end; align-items: stretch; gap: 4px; border-radius: 6px; padding: 0 1px; }
.months button i {
  display: block; height: max(3px, calc(var(--h) * .52)); border-radius: 4px; background: var(--fill);
  transition: background .3s, height .9s var(--spring);
  animation: growBar .9s var(--spring) backwards;
}
.months button span { font: 600 10px/1 var(--num); color: var(--muted); text-align: center; }
.months button:hover:not(:disabled) i { background: color-mix(in srgb, var(--accent) 55%, var(--fill)); }
.months button[aria-pressed="true"] i { background: var(--accent); box-shadow: 0 4px 14px -4px var(--accent); }
.months button[aria-pressed="true"] span { color: var(--fg); }
.months button:disabled { cursor: default; opacity: .5; }
@keyframes growBar { from { height: 3px; } }

.play-btn {
  width: 100%; margin-top: 14px; height: 42px; gap: 8px;
  background: linear-gradient(145deg, #0a84ff, #5e5ce6); color: #fff;
  box-shadow: 0 8px 22px -10px rgba(10, 132, 255, .9);
}
.play-btn svg { width: 15px; height: 15px; }
.play-btn.on { background: var(--fill); color: var(--fg); box-shadow: none; }
.play-btn:disabled { opacity: .4; }

.stays { list-style: none; margin: 18px 0 0; padding: 0; position: relative; }
.stays::before {
  content: ""; position: absolute; left: 13px; top: 14px; bottom: 14px; width: 2px; border-radius: 1px;
  background: linear-gradient(var(--fill), var(--fill2));
}
.stay {
  position: relative; width: 100%; display: grid; grid-template-columns: 28px 1fr auto; align-items: center; gap: 8px;
  padding: 9px 8px 9px 0; border-radius: 14px; text-align: left;
  animation: fadeUp .6s var(--spring-soft) backwards; animation-delay: calc(var(--i, 0) * 30ms);
  transition: background .25s, transform .5s var(--spring);
}
.stay:hover { background: var(--fill2); }
.stay:active { transform: scale(.98); transition-duration: .12s; }
.stay .node {
  justify-self: center; width: 14px; height: 14px; border-radius: 50%; background: var(--c);
  border: 2.5px solid var(--bg); box-shadow: 0 0 0 1.5px var(--c);
  transition: transform .5s var(--spring), box-shadow .4s;
}
.stay.on { background: var(--fill); }
.stay.on .node { transform: scale(1.35); box-shadow: 0 0 0 1.5px var(--c), 0 0 16px 2px var(--c); }
.st-main { min-width: 0; display: flex; flex-direction: column; }
.st-main b { font-size: 14.5px; letter-spacing: -.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-main span { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.st-v { font-size: 15px; font-weight: 700; letter-spacing: -.02em; }
.st-v small { font-size: 10.5px; color: var(--muted); margin-left: 2px; font-weight: 600; }
.move {
  display: flex; align-items: center; gap: 10px; padding: 3px 0 3px 4px;
  font: 500 12px/1 var(--num); color: var(--muted); font-variant-numeric: tabular-nums;
}
.move .mi {
  width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; background: var(--bg);
  box-shadow: 0 0 0 1.5px var(--fill); position: relative; z-index: 1;
}
.move .mi svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.stays .empty { padding: 20px 0; text-align: center; color: var(--muted); font-size: 13px; }

/* Playback chip */
.playchip {
  position: absolute; left: 50%; top: 84px; translate: -50% 0; z-index: 3;
  display: flex; align-items: baseline; gap: 10px; padding: 10px 18px; border-radius: 999px; white-space: nowrap;
  opacity: 0; transform: translateY(-14px) scale(.92); pointer-events: none;
  transition: opacity .35s var(--ease-out), transform .7s var(--spring);
}
.playchip.show { opacity: 1; transform: none; }
.playchip span { font: 600 13px/1 var(--num); color: var(--muted); font-variant-numeric: tabular-nums; }
.playchip b { font-size: 18px; letter-spacing: -.03em; }
.playchip.tick b, .playchip.tick span { animation: fadeUp .55s var(--spring-soft) both; }

/* Detail: Photos-style grid. Rows size to their content — the list scrolls, it never squeezes. */
.tests.grid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: max-content;
  gap: 6px; padding: 0 14px 16px; align-content: start;
  flex: 1 1 auto; min-height: 0;
}
.mh {
  grid-column: 1 / -1; position: sticky; top: 0; z-index: 3; margin: 0 -14px; padding: 12px 18px 6px;
  font-size: 13px; font-weight: 700; letter-spacing: -.01em;
  background: var(--glass-strong); -webkit-backdrop-filter: blur(24px); backdrop-filter: blur(24px);
}
.tile {
  position: relative; min-width: 0; border-radius: 14px; padding: 9px 10px 8px;
  display: flex; flex-direction: column; gap: 5px;
  background:
    radial-gradient(120% 90% at 0% 0%, color-mix(in srgb, var(--c) 30%, transparent), transparent 70%),
    color-mix(in srgb, var(--c) 10%, var(--fill2));
  border: .5px solid color-mix(in srgb, var(--c) 32%, transparent);
  animation: tileIn .55s var(--spring) backwards; animation-delay: calc(var(--i, 0) * 18ms);
  transition: transform .45s var(--spring);
}
.tile:hover { transform: translateY(-2px); z-index: 1; }
.tile .tt { display: flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 700; color: var(--fg2); }
.tile .tt i { width: 6px; height: 6px; border-radius: 50%; background: var(--tc); flex: none; }
.tile .tt em { margin-left: auto; font-style: normal; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.tile .tv { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.tile .m { display: inline-flex; align-items: baseline; gap: 1px; color: var(--fg2); white-space: nowrap; }
.tile .m b { font-size: 14px; font-weight: 600; letter-spacing: -.02em; }
.tile .m small { font-size: 10.5px; color: var(--muted); font-weight: 600; }
.tile .m.on { color: var(--fg); }
.tile .m.on b { font-size: 22px; font-weight: 700; letter-spacing: -.04em; line-height: 1; }
.tile .srv { font-size: 10.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.more-note { grid-column: 1 / -1; text-align: center; }
@keyframes tileIn { from { opacity: 0; transform: scale(.82); } }

@media (max-width: 860px) {
  .playchip { top: 128px; }
}

/* Landing: secondary actions, footer, help sheet */
.ghost-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; margin-top: 22px; }
.ghost-row .ghost { margin-top: 0; }
.site-foot {
  position: absolute; left: 50%; bottom: max(18px, env(safe-area-inset-bottom)); translate: -50% 0;
  display: flex; align-items: center; gap: 10px; white-space: nowrap;
  font-size: 12.5px; color: var(--fg2); padding: 7px 16px; border-radius: 999px;
  background: var(--glass); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  border: .5px solid var(--glass-edge);
}
.site-foot a, .site-foot button, .foot.links a, .foot.links button {
  color: inherit; text-decoration: none; display: inline-flex; align-items: center; gap: 5px;
  font: inherit; transition: color .2s;
}
.site-foot a:hover, .site-foot button:hover, .foot.links a:hover, .foot.links button:hover { color: var(--fg); }
.site-foot svg { width: 14px; height: 14px; fill: currentColor; }
.foot.links { margin-top: 10px; }

/* Language switcher: a tiny segmented control in the footers */
.lang { display: inline-flex; align-items: center; gap: 1px; padding: 2px; border-radius: 999px; background: var(--fill2); vertical-align: middle; }
.site-foot .lang button, .foot.links .lang button {
  min-width: 26px; height: 20px; padding: 0 7px; border-radius: 999px; justify-content: center;
  font-size: 11.5px; font-weight: 600; color: var(--muted); transition: color .2s, background .25s;
}
.site-foot .lang button[aria-pressed="true"], .foot.links .lang button[aria-pressed="true"] { background: var(--fill); color: var(--fg); }
/* Too narrow for one line: the switcher drops to its own row inside the footer */
@media (max-width: 480px) {
  .site-foot { flex-wrap: wrap; justify-content: center; row-gap: 5px; width: max-content; max-width: calc(100% - 32px); border-radius: 20px; padding: 7px 14px; }
  .site-foot .lang-sep { display: none; }
  .site-foot .lang { flex-basis: 100%; justify-content: center; background: none; padding: 0; }
}
@media (max-height: 700px) { .site-foot { position: static; translate: none; margin-top: 22px; } }

.steps { list-style: none; counter-reset: step; margin: 20px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.steps li {
  counter-increment: step; display: grid; grid-template-columns: 30px 1fr; gap: 12px; align-items: start;
  padding: 12px 14px; border-radius: 16px; background: var(--fill2); font-size: 14.5px; line-height: 1.5;
}
.steps li::before {
  content: counter(step); width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  background: linear-gradient(145deg, #0a84ff, #5e5ce6); color: #fff; font: 700 13px/1 var(--num);
}
.steps a { color: var(--accent); text-decoration: none; overflow-wrap: anywhere; }
.steps a:hover { text-decoration: underline; }
.steps kbd {
  font: 600 12.5px/1 var(--num); padding: 3px 7px; border-radius: 6px; background: var(--fill); border: .5px solid var(--hair);
}
.privacy { margin: 18px 0 0; padding: 0 0 0 18px; color: var(--fg2); font-size: 13.5px; line-height: 1.6; }
.privacy li + li { margin-top: 4px; }
.sheet h4.sub { margin: 22px 0 0; }
body:not([data-view="dash"]) .maplibregl-canvas-container.maplibregl-interactive { cursor: default; }
.privacy a { color: var(--accent); text-decoration: none; }

/* Landing hero is just the name; the small brand label only appears on the shared-link loading screen. */
.hero { font-size: clamp(64px, 12vw, 148px); line-height: 1.02; letter-spacing: -.05em; }
.hero .grad { padding: 0 .04em .08em; }
.landing:not(.is-loading) .brand { display: none; }

/* ─────────────────────────────────────────────────────────────
   Space backdrop (dark) — stars instead of colour blobs, like the Apple Maps globe
   ───────────────────────────────────────────────────────────── */
#stars { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; transition: opacity .8s var(--ease-out); }
#stars.off { opacity: 0; }
#stars i { position: absolute; left: 0; top: 0; height: 100%; background-repeat: repeat-x; will-change: transform; }
#stars i:nth-child(2) { animation: twinkle 3.2s ease-in-out infinite alternate; }
#stars i:nth-child(3) { animation: twinkle 4.4s ease-in-out -2.2s infinite alternate; }
@keyframes twinkle { from { opacity: .15; } to { opacity: 1; } }
@media (prefers-color-scheme: dark) {
  .aurora i { display: none; }
  .aurora .halo { opacity: .55; background: radial-gradient(ellipse 50% 50% at 50% 100%, rgba(100, 180, 255, .5), rgba(10, 132, 255, .18) 45%, transparent 70%); }
}
@media (prefers-color-scheme: light) { #stars { display: none; } }

/* ─────────────────────────────────────────────────────────────
   Map markers — after Apple Maps: a compact lit circle with a short white glyph and the
   place name beneath; the selected one springs up into a balloon on a stem over its spot.
   ───────────────────────────────────────────────────────────── */
.pm {
  /* MapLibre positions the element absolutely; keep that and only size it */
  width: var(--s, 36px); height: var(--s, 36px);
  padding: 0; border: 0; background: none; cursor: pointer; border-radius: 50%;
  --fill: color-mix(in oklch, var(--c) 86%, #000);
}
.pm:focus-visible { outline: none; }
.pm:focus-visible .pm-card { box-shadow: 0 0 0 3px var(--accent), 0 8px 18px -6px rgba(0, 0, 0, .6); }
.pm-in {
  position: absolute; inset: 0; display: block; transform-origin: 50% 100%;
  animation: pmIn .8s var(--spring) backwards; animation-delay: var(--delay, 0ms);
  transition: transform .6s var(--spring);
}
.pm-card {
  position: absolute; inset: 0; border-radius: 50%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: #fff; text-shadow: 0 1px 1.5px rgba(0, 0, 0, .35);
  background:
    radial-gradient(120% 70% at 50% 0%, rgba(255, 255, 255, .55), rgba(255, 255, 255, 0) 55%),
    linear-gradient(180deg, color-mix(in oklch, var(--fill) 80%, #fff), var(--fill) 55%, color-mix(in oklch, var(--fill) 80%, #000));
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, .28),
    inset 0 -2px 4px rgba(0, 0, 0, .18),
    0 0 0 2px rgba(255, 255, 255, .95),
    0 8px 18px -6px color-mix(in srgb, var(--fill) 70%, #000),
    0 2px 5px rgba(0, 0, 0, .35);
  transition: box-shadow .4s;
}
.pm-card b { font: 700 calc(var(--s, 36px) * .34)/1 ui-rounded, "SF Pro Rounded", var(--num); letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.pm-card small { font: 700 6.5px/1 var(--num); letter-spacing: .04em; opacity: .8; margin-top: 2px; }
/* balloon tail, hidden until selected */
.pm-card::after {
  content: ""; position: absolute; left: 50%; top: calc(100% - 3px); width: 12px; height: 12px;
  background: var(--fill); border-right: 2px solid #fff; border-bottom: 2px solid #fff; border-radius: 0 0 4px 0;
  transform: translateX(-50%) rotate(45deg) scale(.2); opacity: 0; z-index: -1;
  transition: transform .5s var(--spring), opacity .2s;
}
/* the exact spot, revealed when the marker lifts */
.pm-dot {
  position: absolute; left: 50%; top: 50%; width: 8px; height: 8px; margin: -4px 0 0 -4px; border-radius: 50%;
  background: var(--fill); box-shadow: 0 0 0 2px #fff, 0 2px 6px rgba(0, 0, 0, .5);
  transform: scale(0); transition: transform .45s var(--spring);
}
.pm-label {
  position: absolute; left: 50%; top: calc(100% + 5px); translate: -50% 0;
  display: flex; flex-direction: column; align-items: center; gap: 1px; max-width: 120px;
  pointer-events: none; white-space: nowrap; text-align: center;
  color: #fff; text-shadow: 0 0 3px rgba(0, 0, 0, .9), 0 0 1px rgba(0, 0, 0, .9), 0 1px 2px rgba(0, 0, 0, .6);
  animation: fadeUp .6s var(--spring-soft) backwards; animation-delay: calc(var(--delay, 0ms) + 120ms);
  transition: opacity .3s, transform .6s var(--spring);
}
.pm-label b { font-size: 11.5px; font-weight: 700; letter-spacing: -.01em; max-width: 120px; overflow: hidden; text-overflow: ellipsis; }
.pm-label span { font-size: 10px; font-weight: 600; opacity: .8; font-variant-numeric: tabular-nums; }
.pm-label b:empty { display: none; }
@media (prefers-color-scheme: light) {
  .pm-label { color: #1d1d1f; text-shadow: 0 0 3px #fff, 0 0 2px #fff, 0 0 1px #fff; }
}

.pm:hover { z-index: 9998 !important; }
.pm:hover .pm-in { transform: scale(1.14); }
.pm:active .pm-in { transform: scale(.92); transition-duration: .12s; }

/* selected: lift into a balloon, show the stem tip and the dot on the location */
.pm.on { z-index: 9999 !important; }
.pm.on .pm-in { transform: translateY(calc(var(--s, 36px) * -.95)) scale(1.28); }
.pm.on .pm-card::after { opacity: 1; transform: translateX(-50%) rotate(45deg) scale(1); }
.pm.on .pm-card { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .28), inset 0 -2px 4px rgba(0, 0, 0, .18), 0 0 0 2.5px #fff, 0 16px 28px -8px color-mix(in srgb, var(--fill) 70%, #000), 0 4px 10px rgba(0, 0, 0, .35); }
.pm.on .pm-dot { transform: scale(1); transition-delay: .08s; }
.pm.on .pm-label { transform: translateY(6px); }

.pm.out .pm-in, .pm.out .pm-label { animation: pmOut .22s var(--ease-out) forwards; }
@keyframes pmIn { from { transform: translateY(10px) scale(0); opacity: 0; } }
@keyframes pmOut { to { transform: scale(.3); opacity: 0; } }
body:not([data-view="dash"]) .pm { pointer-events: none; }
.pm.nolabel .pm-label { opacity: 0; }

/* ─────────────────────────────────────────────────────────────
   Liquid Glass — light catches two opposite corners of the rim, the body is lit from inside, and a soft
   specular spot follows the pointer. glass.js adds real refraction (Chromium) on top of this.
   ───────────────────────────────────────────────────────────── */
.title, .actions .btn.glass { position: relative; }
.glass { isolation: isolate; }
.glass {
  background: linear-gradient(160deg, color-mix(in srgb, var(--glass) 80%, rgba(255,255,255,.08)), var(--glass));
  -webkit-backdrop-filter: saturate(180%) blur(22px);
  backdrop-filter: saturate(180%) blur(22px);
  border: 0;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .22),
    inset 0 0 0 .5px rgba(255, 255, 255, .1),
    inset 0 -10px 24px -18px rgba(255, 255, 255, .25),
    0 14px 40px -12px rgba(0, 0, 0, .55), 0 2px 6px rgba(0, 0, 0, .18);
}
.glass::before {
  /* rim light: bright at top-left and bottom-right, fading across */
  content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1px; pointer-events: none; z-index: 2;
  background: linear-gradient(135deg, rgba(255,255,255,.65), rgba(255,255,255,.08) 28%, rgba(255,255,255,0) 50%, rgba(255,255,255,.06) 72%, rgba(255,255,255,.4));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
}
.glass::after {
  /* specular spot under the pointer */
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; z-index: 2;
  background: radial-gradient(180px circle at var(--mx, 20%) var(--my, -40%), rgba(255, 255, 255, .16), transparent 60%);
  mix-blend-mode: plus-lighter; opacity: 0; transition: opacity .5s var(--ease-out);
}
.glass:hover::after { opacity: 1; }
@media (prefers-color-scheme: light) {
  .glass::before { background: linear-gradient(135deg, rgba(255,255,255,1), rgba(255,255,255,.3) 30%, rgba(255,255,255,0) 50%, rgba(0,0,0,.04) 75%, rgba(255,255,255,.8)); }
  .glass { box-shadow: inset 0 1px 0 rgba(255,255,255,.9), inset 0 0 0 .5px rgba(0,0,0,.05), 0 14px 40px -14px rgba(0,0,0,.28), 0 2px 6px rgba(0,0,0,.06); }
}


/* the side panel scrolls, so a pseudo-element rim would scroll away with it */
.panel::before, .panel::after { display: none; }

/* three.js Liquid Glass (glass.js) is live: the WebGL layer under the page draws the glass, so these
   elements drop their CSS background, blur and rim and keep only an outer shadow. */
.gl-live .gl-glass {
  background: transparent !important;
  -webkit-backdrop-filter: none !important; backdrop-filter: none !important;
  border-color: transparent !important;
  box-shadow: 0 18px 44px -16px rgba(0, 0, 0, .5), 0 2px 6px rgba(0, 0, 0, .14) !important;
}
.gl-live .gl-glass::before, .gl-live .gl-glass::after { display: none !important; }
.gl-live .drop-inner.gl-glass { box-shadow: 0 24px 60px -20px rgba(0, 0, 0, .6) !important; }
.pm.under { pointer-events: none; }
.pm.under .pm-in, .pm.under .pm-label, .pm.under .pm-dot { opacity: 0 !important; transition: opacity .2s; }
