/* App frame: desktop top bar, phone tab bar, the screen host and its transitions,
   and the two page layouts (panel + map/photo, and plain scrolling page). */
.app { position: relative; height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
/* The view and each screen let the pointer through to the map underneath; their content takes it back. */
.view { position: relative; flex: 1; min-height: 0; pointer-events: none; }

/* ---------- Desktop top bar ---------- */
.topbar {
  position: relative; z-index: 20; height: 80px; flex: none;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 12px 24px;
}
.brand { display: flex; align-items: center; gap: 11px; min-width: 0; }
.brand img { width: 40px; height: 40px; }
.brand b { font-weight: 500; font-size: 27px; letter-spacing: -0.54px; color: var(--text); }
.crumbs { display: flex; align-items: center; gap: 10px; margin-left: 14px; font-size: 14px; color: var(--text-2); white-space: nowrap; overflow: hidden; }
.crumbs img { width: 16px; height: 16px; filter: var(--icon-filter); opacity: 0.8; }
.crumbs i { width: 6px; height: 6px; border-right: 1.5px solid var(--muted); border-top: 1.5px solid var(--muted); transform: rotate(45deg); }
.crumbs a:hover { color: var(--orange); }

.navpill {
  display: flex; gap: 0; height: 56px; width: calc(var(--n, 4) * var(--item, 101px) + 8px); padding: 4px; border-radius: 20px;
  background: var(--surface); filter: drop-shadow(0 4px 10px rgba(16, 24, 40, 0.1)); position: relative;
}
.navpill a {
  position: relative; z-index: 1; flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px;
  border-radius: 16px; font-weight: 500; font-size: 12px; color: #71717a; transition: color 0.3s;
}
.navpill a img { width: 24px; height: 24px; transition: filter 0.3s; filter: grayscale(1) brightness(0.45); }
/* Dark: the icons are black artwork, so paint them light grey (brightness alone keeps black black). */
:root[data-theme="dark"] .navpill a img { filter: brightness(0) invert(0.72); }
:root[data-theme="dark"] .navpill a { color: #a1a1aa; }
:root[data-theme="dark"] .navpill a.is-active { color: var(--orange); }
:root[data-theme="dark"] .navpill a.is-active img { filter: none; }
.navpill a.is-active { color: var(--orange); font-size: 14px; }
.navpill a.is-active img { filter: none; }
.navpill .glider {
  position: absolute; top: 4px; bottom: 4px; left: 4px; width: calc((100% - 8px) / var(--n, 4)); border-radius: 16px;
  background: var(--orange-light); transition: transform 0.45s var(--spring);
}
.top-actions { display: flex; gap: 8px; justify-self: end; height: 56px; }
.bell { position: relative; display: grid; place-items: center; width: 56px; height: 56px; border-radius: 16px; background: var(--surface); }
.bell > img { width: 32px; height: 32px; filter: var(--icon-filter); }
.bell .badge { position: absolute; left: 28px; top: 6px; width: 21px; height: 21px; filter: none; } /* keep the badge's own colours */
.bell:hover > img { animation: ring 0.7s var(--ease); }
/* The theme switch in the bell's place: a moon in light, a sun in dark */
.theme-btn { color: var(--text); }
.theme-btn .line { width: 26px; height: 26px; transition: transform 0.4s var(--ease); }
.theme-btn:hover .line { transform: rotate(-20deg); }
.theme-btn .is-sun, :root[data-theme="dark"] .theme-btn .is-moon { display: none; }
:root[data-theme="dark"] .theme-btn .is-sun { display: block; }
@keyframes ring { 20% { transform: rotate(14deg); } 40% { transform: rotate(-12deg); } 60% { transform: rotate(8deg); } 80% { transform: rotate(-4deg); } }
.me { width: 56px; height: 56px; border-radius: 16px; overflow: hidden; border: 1.7px solid #fff; box-shadow: 0 8px 8px rgba(0, 0, 0, 0.09), 0 2px 5px rgba(0, 0, 0, 0.1); }
.me img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- Phone tab bar ---------- */
.tabbar {
  position: absolute; z-index: 30; left: 50%; bottom: 18px; transform: translate(-50%, 140%);
  display: none; gap: 0; padding: 6px; border-radius: 24px; background: var(--surface);
  box-shadow: 0 10px 30px rgba(16, 24, 40, 0.16); transition: transform 0.5s var(--spring);
}
.tabbar a {
  position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  width: 64px; padding: 8px 0 6px; border-radius: 18px; font-size: 10px; font-weight: 500; color: #71717a;
}
.tabbar a img { width: 24px; height: 24px; filter: grayscale(1) brightness(0.45); transition: filter 0.3s; }
:root[data-theme="dark"] .tabbar a img { filter: brightness(0) invert(0.72); }
.tabbar a.is-active { color: var(--orange); }
.tabbar a.is-active img { filter: none; }
.tabbar .glider { position: absolute; top: 6px; bottom: 6px; left: 6px; width: 64px; border-radius: 18px; background: var(--orange-light); transition: transform 0.45s var(--spring); }

/* ---------- Screen host ---------- */
.screen { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.screen > * { pointer-events: auto; }
.screen.is-entering { animation: screen-in 0.5s var(--ease) both; }
.screen.is-leaving { animation: screen-out 0.25s ease both; pointer-events: none; }
@keyframes screen-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes screen-out { to { opacity: 0; } }
.scroll { height: 100%; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }

/* Page with a side panel and a map or photo stage. */
.split { display: flex; gap: 20px; height: 100%; padding: 16px 20px 16px 20px; }
.panel {
  position: relative; z-index: 5; width: 416px; flex: none; display: flex; flex-direction: column;
  background: var(--surface); border-radius: 50px; box-shadow: var(--shadow); overflow: hidden;
}
.panel--wide { width: 492px; }
.panel__body { flex: 1; min-height: 0; overflow-y: auto; padding: 32px 24px 24px; scrollbar-width: none; }
.panel__body::-webkit-scrollbar { display: none; }
.stage { flex: 1; min-width: 0; position: relative; border-radius: 50px; }
.stage--framed { border: 1px solid var(--line); padding: 12px; display: flex; align-items: center; } /* the same gap on all four sides */
.stage__inner { position: relative; width: 100%; height: 100%; border-radius: 37px; overflow: hidden; } /* stage 50 - border 1 - padding 12 */

/* Panel floating over the full-bleed map (desktop home, set location). */
.split--float .panel { height: 100%; }
.split--float { pointer-events: none; }
.split--float > * { pointer-events: auto; }

/* Phone headers */
.mhead { display: none; }
.sheet-handle { display: none; }

/* ---------- Tablet ---------- */
@media (max-width: 1100px) {
  .panel { width: 380px; }
  .panel--wide { width: 420px; }
  .navpill { --item: 91px; }
  .crumbs { display: none; }
}

/* ---------- Phone ---------- */
@media (max-width: 767px) {
  .topbar { display: none; }
  .tabbar { display: flex; }
  .app[data-tabbar="1"] .tabbar { transform: translate(-50%, 0); }
  /* After the reference: a plain bar across the foot, outline icons, a dot under the open tab. */
  .tabbar { left: 0; right: 0; bottom: 0; transform: translateY(100%); justify-content: space-around; padding: 10px 24px 18px; border-radius: 0; background: var(--bg); box-shadow: none; }
  .app[data-tabbar="1"] .tabbar { transform: none; }
  .tabbar .glider { display: none; }
  .tabbar a { width: 72px; gap: 4px; padding: 6px 0 10px; font-size: 13px; font-weight: 400; color: #8a8a8a; }
  .tabbar a .line { width: 24px; height: 24px; }
  .tabbar a.is-active { color: var(--text); }
  .tabbar a.is-active::after { content: ""; position: absolute; bottom: 0; width: 4px; height: 4px; border-radius: 50%; background: currentColor; }
  .split { display: block; padding: 0; }
  .panel, .panel--wide { width: auto; border-radius: 0; box-shadow: none; background: transparent; overflow: visible; }
  .panel__body { padding: 0; overflow: visible; }
  .stage { position: absolute; inset: 0; border-radius: 0; }
  .stage--framed { border: 0; padding: 0; }
  .stage__inner { height: 100%; border-radius: 0; }

  /* A panel over a map or photo becomes a bottom sheet. */
  .split--sheet .panel {
    position: absolute; left: 0; right: 0; bottom: 0; z-index: 6; padding: 8px;
    background: linear-gradient(to bottom, transparent, rgba(23, 23, 23, 0.12));
    animation: sheet-up 0.6s var(--ease) both;
  }
  :root[data-theme="dark"] .split--sheet .panel { background: linear-gradient(to bottom, rgba(23, 23, 23, 0), #171717); }
  .split--sheet .panel__body {
    background: var(--sheet); border-radius: 40px; padding: 16px; max-height: 72dvh; overflow-y: auto;
    box-shadow: 0 -6px 30px rgba(16, 24, 40, 0.12);
  }
  .split--sheet .sheet-handle { display: block; width: 77px; height: 5px; border-radius: 99px; margin: 0 auto; background: var(--muted-2); opacity: 0.5; }
  @keyframes sheet-up { from { transform: translateY(60%); opacity: 0; } to { transform: none; opacity: 1; } }

  .mhead {
    position: relative; z-index: 7; display: flex; align-items: center; justify-content: space-between;
    padding: 16px 16px 8px; min-height: 64px;
  }
  .mhead h1 { font-weight: 500; font-size: 24px; letter-spacing: -0.48px; text-align: center; flex: 1; }
  .mhead .icon-btn, .mhead .spacer { width: 48px; height: 48px; border-radius: 20px; }
  .mhead--over h1 { color: var(--text); }
  .mhead--over .icon-btn { background: transparent; border-color: transparent; }
  .mhead--plain .icon-btn { border: 0; background: transparent; }
  .mhead--plain h1 { font-size: 24px; }
}
