/* ПОПУТКА — каркас экрана: карта на весь экран, верхняя панель, шторка снизу, оверлеи, всплывашки. */

#map { position: fixed; inset: 0; z-index: 0; background: #EEF0F4; }

.topbar {
  position: fixed; z-index: 20; left: 12px; right: 12px;
  top: calc(var(--safe-top) + var(--tg-content-top, 0px) + 10px);
  display: flex; align-items: center; justify-content: space-between; gap: 10px; pointer-events: none;
}
.topbar > * { pointer-events: auto; }
.seg {
  display: flex; padding: 4px; gap: 2px; border-radius: var(--r-pill);
  background: var(--bg); box-shadow: var(--shadow-sm);
}
.seg button {
  min-height: 42px; padding: 0 18px; border-radius: var(--r-pill);
  font-weight: 600; font-size: 15px; color: var(--icon-idle); display: inline-flex; align-items: center; gap: 6px;
  transition: background .15s ease, color .15s ease;
}
.seg button.on { background: var(--graphite); color: #fff; }
.round {
  width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center;
  background: var(--bg); box-shadow: var(--shadow-sm); color: var(--graphite); overflow: hidden;
}
.round img { width: 100%; height: 100%; object-fit: cover; }
.round:active { transform: scale(.95); }
.round.danger { color: var(--danger); }

.fab {
  position: fixed; z-index: 15; right: 14px; bottom: calc(var(--sheet-h, 220px) + 14px);
  transition: bottom .22s ease;
}
.fab.on { color: var(--accent); }

/* ---------- шторка ---------- */
.sheet {
  position: fixed; z-index: 10; left: 0; right: 0; bottom: 0;
  max-height: 80vh; overflow-y: auto; overscroll-behavior: contain;
  background: var(--bg); border-radius: var(--r-sheet) var(--r-sheet) 0 0; box-shadow: 0 -10px 30px rgba(30, 34, 48, .12);
  padding: 8px 16px calc(var(--safe-bottom) + 18px);
  transition: transform .25s ease;
}
.sheet-inner { max-width: 560px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; padding-top: 2px; }
.grab { width: 38px; height: 5px; border-radius: 3px; background: var(--border); margin: 2px auto 6px; flex-shrink: 0; }
.sheet.min .when-open { display: none; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 36px; }

/* ---------- оверлей (профиль, чат, поиск) ---------- */
.over {
  position: fixed; z-index: 40; inset: 0; background: var(--bg);
  display: flex; flex-direction: column; animation: over-in .2s ease;
  padding-top: calc(var(--safe-top) + var(--tg-content-top, 0px));
}
@keyframes over-in { from { transform: translateY(16px); opacity: 0; } to { transform: none; opacity: 1; } }
.over-head {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px 10px 16px; min-height: 60px;
  border-bottom: 1px solid var(--line);
}
.over-head .title { flex: 1; font-size: 16px; }
.over-body { flex: 1; overflow-y: auto; padding: 16px 16px calc(var(--safe-bottom) + 24px); }
.over-body > .stack { max-width: 560px; margin: 0 auto; }
.icon-btn { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; color: var(--icon-idle); }
.icon-btn:active { background: var(--bg-elevated); }

/* ---------- всплывашка ---------- */
.toast {
  position: fixed; z-index: 60; left: 50%; transform: translateX(-50%);
  top: calc(var(--safe-top) + var(--tg-content-top, 0px) + 66px);
  max-width: calc(100% - 32px); width: max-content;
  padding: 12px 16px; border-radius: var(--r-md); background: var(--graphite); color: #fff;
  font-size: 14px; font-weight: 500; box-shadow: var(--shadow); animation: toast-in .2s ease;
}
.toast.err { background: var(--danger); }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, -8px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ---------- заставка ---------- */
.splash {
  position: fixed; inset: 0; z-index: 80; background: var(--bg);
  display: grid; place-items: center; transition: opacity .3s ease;
}
.splash .logo { font-family: var(--font-display); font-size: 30px; letter-spacing: .06em; }
.splash .slogan { margin-top: 8px; color: var(--text-secondary); font-size: 14px; text-align: center; }
.splash.gone { opacity: 0; pointer-events: none; }

/* ---------- выбор точки на карте ---------- */
.pick-pin {
  position: fixed; z-index: 12; left: 50%; top: 50%; transform: translate(-50%, -100%);
  color: var(--graphite); pointer-events: none; filter: drop-shadow(0 6px 8px rgba(30, 34, 48, .3));
}
.pick-pin.up { animation: pin-up .2s ease forwards; }
@keyframes pin-up { to { transform: translate(-50%, -112%); } }
.pick-bar { position: fixed; z-index: 13; left: 0; right: 0; bottom: 0; }

.spinner { width: 22px; height: 22px; border-radius: 50%; border: 2.5px solid var(--line); border-top-color: var(--accent);
  animation: spin .8s linear infinite; margin: 8px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
