/* ========== Base ========== */
* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  height: 100%;
  width: 100%;
  font-family: 'Inter', ui-sans-serif, system-ui, sans-serif;
  color: #e8ecf4;
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(124,92,255,0.25), transparent 60%),
    radial-gradient(800px 500px at 100% 0%, rgba(0,201,255,0.18), transparent 60%),
    linear-gradient(180deg, #0b1020 0%, #0a0f1e 100%);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  overscroll-behavior-x: none;
}
button, input { font-family: inherit; }
button { border: 0; background: transparent; color: inherit; cursor: pointer; }
input { color: inherit; }

.app-shell {
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr auto;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

/* ========== Glass ========== */
.glass {
  background: rgba(18, 23, 44, 0.55);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  border: 1px solid rgba(255,255,255,0.06);
}

/* ========== Top bar ========== */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(env(safe-area-inset-top, 0px) + 10px) 14px 10px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  position: relative;
  z-index: 20;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.logo-dot {
  width: 34px; height: 34px; border-radius: 12px;
  background: conic-gradient(from 210deg, #7c5cff, #00c9ff, #ff5ea2, #7c5cff);
  box-shadow: 0 8px 24px rgba(124,92,255,0.45), inset 0 0 0 2px rgba(255,255,255,0.15);
  flex-shrink: 0;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-name { font-weight: 800; letter-spacing: -0.01em; font-size: 16px; }
.city-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #cfd6ea;
  font-size: 12.5px;
  padding: 3px 8px 3px 0;
  border-radius: 8px;
  margin-left: -2px;
  transition: background 0.15s;
  max-width: 200px;
}
.city-btn:hover { background: rgba(255,255,255,0.05); }
.city-btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 160px; }
.city-btn svg { width: 12px; height: 12px; opacity: 0.7; flex-shrink: 0; }

.top-actions { display: flex; gap: 8px; }
.icon-btn {
  position: relative;
  width: 40px; height: 40px; border-radius: 12px;
  display: inline-flex; align-items: center; justify-content: center;
  color: #cfd6ea;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.06);
  transition: background 0.2s;
}
.icon-btn:hover { background: rgba(255,255,255,0.08); }
.icon-btn svg { width: 20px; height: 20px; }
.dot-indicator {
  position: absolute;
  top: 8px; right: 8px;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #22d3ee;
  box-shadow: 0 0 0 2px rgba(18,23,44,0.8);
}

/* ========== Search overlay ========== */
.search-overlay {
  position: fixed;
  inset: 0;
  z-index: 150;
  background: rgba(5,8,18,0.6);
  backdrop-filter: blur(8px);
  padding: 14px;
  padding-top: calc(env(safe-area-inset-top, 0px) + 14px);
  animation: fadeIn 0.2s ease;
}
.search-box {
  border-radius: 18px;
  overflow: hidden;
  animation: slideDown 0.25s cubic-bezier(.2,.8,.2,1);
}
@keyframes slideDown { from { transform: translateY(-20px); opacity: 0 } to { transform: translateY(0); opacity: 1 } }
.search-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 6px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  background: rgba(255,255,255,0.02);
}
.search-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 8px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  color: #9aa4bf;
  transition: all 0.15s;
}
.search-tab svg { width: 14px; height: 14px; }
.search-tab:hover { color: #e8ecf4; background: rgba(255,255,255,0.04); }
.search-tab.active {
  color: #fff;
  background: linear-gradient(135deg, rgba(124,92,255,0.6), rgba(0,201,255,0.5));
  box-shadow: 0 4px 12px rgba(124,92,255,0.3);
}

.search-input-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.search-input-wrap svg { width: 18px; height: 18px; color: #9aa4bf; flex-shrink: 0; }
#search-input {
  flex: 1;
  background: transparent;
  border: 0;
  outline: 0;
  font-size: 16px;
  color: #fff;
}
#search-input::placeholder { color: #7b8299; }
.search-close {
  width: 30px; height: 30px; border-radius: 50%;
  background: rgba(255,255,255,0.06);
  color: #cfd6ea; font-size: 20px; line-height: 1;
}
.search-results { max-height: 50vh; overflow-y: auto; }
.search-result {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  cursor: pointer;
  transition: background 0.1s;
}
.search-result:hover { background: rgba(255,255,255,0.04); }
.search-result:last-child { border-bottom: 0; }
.search-result-icon {
  width: 32px; height: 32px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(124,92,255,0.2);
  color: #a78bfa;
  flex-shrink: 0;
}
.search-result-icon svg { width: 16px; height: 16px; }
.search-result-text { min-width: 0; }
.search-result-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 14px; }
.search-result-sub { font-size: 12px; color: #9aa4bf; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-hint {
  padding: 16px;
  color: #9aa4bf;
  font-size: 13px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.chip-btn {
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12.5px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
  color: #e8ecf4;
  transition: all 0.15s;
}
.chip-btn:hover { background: rgba(124,92,255,0.25); border-color: rgba(124,92,255,0.4); }
.loading {
  padding: 16px; text-align: center; color: #9aa4bf; font-size: 13px;
}
.search-count {
  padding: 10px 16px;
  font-size: 11.5px;
  color: #67e8f9;
  font-weight: 600;
  letter-spacing: 0.02em;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  background: rgba(34,211,238,0.05);
}

/* ========== Segmented (inside Profils view only) ========== */
#view-users .segmented {
  position: absolute;
  top: 10px;
  left: 14px;
  right: 14px;
  padding: 6px;
  border-radius: 14px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  z-index: 15;
}
.segmented {
  position: relative;
  padding: 6px;
  border-radius: 14px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
}
.seg-btn {
  position: relative;
  padding: 10px 0;
  font-weight: 600;
  font-size: 13px;
  color: #9aa4bf;
  z-index: 1;
  border-radius: 10px;
  transition: color 0.2s;
}
.seg-btn.active { color: #fff; }
.seg-indicator {
  position: absolute;
  top: 6px; left: 6px;
  width: calc((100% - 12px - 8px) / 3);
  height: calc(100% - 12px);
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(124,92,255,0.6), rgba(0,201,255,0.5));
  box-shadow: 0 6px 18px rgba(124,92,255,0.35);
  transition: transform 0.25s cubic-bezier(.2,.8,.2,1);
  z-index: 0;
}
.segmented[data-pos="1"] .seg-indicator { transform: translateX(calc(100% + 4px)); }
.segmented[data-pos="2"] .seg-indicator { transform: translateX(calc(200% + 8px)); }
.segmented[hidden] { display: none !important; }

/* ========== Views ========== */
.view-container { position: relative; overflow: hidden; }
.view {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.view.active {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

/* ========== Map ========== */
#map { position: absolute; inset: 0; background: #0a0f1e; }
.leaflet-container { background: #0a0f1e !important; font-family: inherit !important; }
.leaflet-control-zoom { display: none !important; }
.leaflet-control-attribution {
  background: rgba(10,15,30,0.6) !important;
  color: #7b8299 !important;
  backdrop-filter: blur(8px);
  border-radius: 8px !important;
  font-size: 10px !important;
}
.leaflet-control-attribution a { color: #9aa4bf !important; }

.fab {
  position: absolute;
  right: 18px;
  bottom: 18px;
  width: 58px; height: 58px;
  border-radius: 50%;
  background: linear-gradient(135deg, #7c5cff, #00c9ff);
  color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 18px 40px rgba(124,92,255,0.45), 0 6px 16px rgba(0,201,255,0.35);
  z-index: 1000;
  transition: transform 0.15s ease;
}
.fab:hover { transform: translateY(-2px) scale(1.03); }
.fab:active { transform: scale(0.97); }
.fab svg { width: 22px; height: 22px; }

/* Geolocation permission banner */
.geo-banner {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  max-width: calc(100% - 28px);
  width: 420px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 14px;
  z-index: 1100;
  background: rgba(18,23,44,0.9);
  border-color: rgba(251,191,36,0.4);
  animation: slideDown 0.3s cubic-bezier(.2,.8,.2,1);
}
.geo-banner[hidden] { display: none !important; }
.geo-banner > svg {
  width: 20px; height: 20px;
  color: #fbbf24;
  flex-shrink: 0;
}
.geo-banner-text { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.geo-banner-text strong { font-size: 13px; font-weight: 700; color: #fff; }
.geo-banner-text span { font-size: 11.5px; color: #cfd6ea; }
.geo-banner-btn {
  padding: 8px 14px;
  border-radius: 10px;
  background: linear-gradient(135deg, #7c5cff, #00c9ff);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
  box-shadow: 0 6px 16px rgba(124,92,255,0.4);
}
.geo-banner-close {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
  color: #cfd6ea;
  font-size: 16px;
  line-height: 1;
  flex-shrink: 0;
}

/* Radius control (top-left) */
.radius-control {
  position: absolute;
  left: 14px;
  top: 14px;
  padding: 10px 14px 12px;
  border-radius: 18px;
  width: 220px;
  max-width: calc(100% - 76px);
  z-index: 1000;
  color: #cfd6ea;
  font-size: 12.5px;
}
.radius-top {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 6px;
}
.radius-top .radius-text { flex: 1; }
.radius-text b { color: #fff; font-weight: 700; }
.radius-refresh {
  width: 28px; height: 28px; border-radius: 50%;
  background: rgba(255,255,255,0.08);
  color: #cfd6ea;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background 0.15s, transform 0.4s;
  flex-shrink: 0;
}
.radius-refresh:hover { background: rgba(124,92,255,0.3); color: #fff; }
.radius-refresh svg { width: 14px; height: 14px; }
.radius-refresh.spinning svg { animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.search-here {
  position: absolute;
  left: 14px;
  bottom: 92px;
  padding: 10px 16px;
  border-radius: 999px;
  color: #fff;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  z-index: 1000;
  background: rgba(18,23,44,0.85);
  border: 1px solid rgba(124,92,255,0.4);
  box-shadow: 0 14px 30px rgba(0,0,0,0.5);
  animation: popIn 0.25s cubic-bezier(.2,.8,.2,1);
  max-width: calc(100% - 84px);
}
.search-here svg { width: 14px; height: 14px; color: #22d3ee; flex-shrink: 0; }
.search-here span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-here:hover { background: rgba(28,36,72,0.95); }
@keyframes popIn { from { transform: translateY(12px); opacity: 0 } to { transform: translateY(0); opacity: 1 } }

.map-btn {
  position: absolute;
  width: 44px; height: 44px;
  border-radius: 14px;
  background: rgba(18,23,44,0.75);
  backdrop-filter: blur(12px);
  color: #cfd6ea;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid rgba(255,255,255,0.06);
  z-index: 1000;
  box-shadow: 0 8px 20px rgba(0,0,0,0.4);
  transition: background 0.15s;
}
.map-btn:hover { background: rgba(28,36,72,0.85); color: #fff; }
.map-btn svg { width: 20px; height: 20px; }
.map-locate { right: 18px; bottom: 90px; }
.dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #22d3ee;
  box-shadow: 0 0 0 4px rgba(34,211,238,0.15);
  flex-shrink: 0;
}
.dot.pulse { animation: pulse 2s infinite; }
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0   rgba(34,211,238,0.45); }
  70%  { box-shadow: 0 0 0 10px rgba(34,211,238,0);   }
  100% { box-shadow: 0 0 0 0   rgba(34,211,238,0);   }
}
#radius-slider {
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  height: 20px;
  margin: 0;
}
#radius-slider::-webkit-slider-runnable-track {
  height: 6px;
  background: linear-gradient(90deg, #7c5cff, #00c9ff);
  border-radius: 999px;
}
#radius-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  height: 18px; width: 18px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid rgba(0,201,255,0.8);
  margin-top: -6px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.4);
  cursor: pointer;
}
#radius-slider::-moz-range-track {
  height: 6px;
  background: linear-gradient(90deg, #7c5cff, #00c9ff);
  border-radius: 999px;
  border: 0;
}
#radius-slider::-moz-range-thumb {
  height: 16px; width: 16px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid rgba(0,201,255,0.8);
  cursor: pointer;
}

/* Custom map markers */
.post-pin {
  width: 36px; height: 36px;
  border-radius: 50% 50% 50% 8px;
  transform: rotate(-45deg);
  background: linear-gradient(135deg, #7c5cff, #00c9ff);
  box-shadow: 0 8px 18px rgba(0,0,0,0.45);
  border: 2px solid rgba(255,255,255,0.25);
  display: flex; align-items: center; justify-content: center;
}
.post-pin span {
  transform: rotate(45deg);
  font-weight: 800; font-size: 14px; color: #fff;
}
/* Own user pins : color-customizable via --mine-c1 / --mine-c2.
   Default values are pink ; overridden inline when the user picks a style. */
.post-pin.mine {
  --mine-c1: #ec4899;
  --mine-c2: #f472b6;
  width: 42px; height: 42px;
  background: linear-gradient(135deg, var(--mine-c1), var(--mine-c2));
  border: 2.5px solid rgba(255,255,255,0.95);
  box-shadow: 0 14px 28px color-mix(in srgb, var(--mine-c1) 60%, transparent),
              0 0 0 4px color-mix(in srgb, var(--mine-c1) 30%, transparent);
}
.post-pin.mine span { font-size: 15px; }

/* Precise-GPS shouldn't override mine's color with a green outline */
.post-pin.mine.precise {
  border-color: rgba(255,255,255,0.95);
  box-shadow: 0 14px 28px color-mix(in srgb, var(--mine-c1) 60%, transparent),
              0 0 0 4px color-mix(in srgb, var(--mine-c1) 30%, transparent);
}

/* Level tiers : keep color but amp the glow/animation */
.post-pin.mine.level-1 {
  animation: mine-glow 3s ease-in-out infinite;
}
.post-pin.mine.level-2 {
  box-shadow: 0 16px 30px color-mix(in srgb, var(--mine-c1) 70%, transparent),
              0 0 0 5px color-mix(in srgb, var(--mine-c2) 35%, transparent);
  animation: mine-glow 2.5s ease-in-out infinite;
}
.post-pin.mine.level-3 {
  background: conic-gradient(from 180deg, var(--mine-c1), var(--mine-c2), var(--mine-c1));
  animation: mine-spin-bg 6s linear infinite;
}
.post-pin.mine.level-4 {
  width: 46px; height: 46px;
  background: conic-gradient(from 0deg, var(--mine-c1), #facc15, var(--mine-c2), #a78bfa, var(--mine-c1));
  border-color: #fef3c7;
  animation: mine-spin-bg 4s linear infinite;
}
.post-pin.mine.level-4 span { font-size: 17px; }
@keyframes mine-glow {
  0%, 100% { filter: drop-shadow(0 0 4px color-mix(in srgb, var(--mine-c1) 60%, transparent)); }
  50%      { filter: drop-shadow(0 0 14px color-mix(in srgb, var(--mine-c2) 95%, transparent)); }
}
@keyframes mine-spin-bg { to { background-position: 100% 0; } }

/* Gamification panel (account sheet) */
.gamify-panel {
  padding: 14px;
  border-radius: 18px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  margin-bottom: 14px;
}
.gamify-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.gamify-level {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid currentColor;
  letter-spacing: 0.02em;
}
.gamify-points { font-size: 13px; color: #9aa4bf; }
.gamify-points b { color: #e8ecf4; font-size: 15px; font-weight: 800; }
.gamify-bar {
  height: 8px;
  background: rgba(255,255,255,0.06);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 8px;
}
.gamify-fill {
  height: 100%;
  background: linear-gradient(90deg, #9aa4bf, #10b981);
  border-radius: 999px;
  transition: width 0.5s cubic-bezier(.2,.8,.2,1);
}
.gamify-next {
  font-size: 11.5px;
  color: #9aa4bf;
  text-align: center;
  margin-bottom: 10px;
}
.gamify-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid rgba(255,255,255,0.06);
  text-align: center;
  font-size: 11px;
  color: #9aa4bf;
}
.gamify-stats b { display: block; font-size: 16px; font-weight: 800; color: #e8ecf4; margin-bottom: 2px; }

/* Streak chip */
.streak-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(251,146,60,0.25), rgba(239,68,68,0.25));
  border: 1px solid rgba(251,146,60,0.5);
  font-size: 12px;
  font-weight: 700;
  color: #fbbf24;
  letter-spacing: 0.01em;
  animation: streak-pulse 2.5s ease-in-out infinite;
}
.streak-chip[hidden] { display: none !important; }
.streak-chip b { color: #fff; font-size: 13px; }
.streak-chip.danger {
  background: linear-gradient(135deg, rgba(239,68,68,0.3), rgba(153,27,27,0.3));
  border-color: rgba(239,68,68,0.6);
  color: #fda4af;
  animation: streak-warn 1.2s ease-in-out infinite;
}
@keyframes streak-pulse {
  0%, 100% { filter: drop-shadow(0 0 2px rgba(251,146,60,0.3)); }
  50%      { filter: drop-shadow(0 0 8px rgba(251,146,60,0.8)); }
}
@keyframes streak-warn {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.05); }
}

/* Pin customization picker */
.pin-picker-panel {
  padding: 14px;
  border-radius: 18px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  margin-bottom: 14px;
}
.pin-picker-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.pin-picker-header h4 { margin: 0; font-size: 14px; color: #cfd6ea; font-weight: 700; letter-spacing: -0.01em; }
.pin-picker-hint { font-size: 12px; color: #9aa4bf; font-weight: 600; }

.pin-preview {
  --mine-c1: #ec4899;
  --mine-c2: #f472b6;
  width: 44px; height: 44px;
  border-radius: 50% 50% 50% 8px;
  transform: rotate(-45deg);
  background: linear-gradient(135deg, var(--mine-c1), var(--mine-c2));
  border: 2.5px solid rgba(255,255,255,0.95);
  box-shadow: 0 6px 16px color-mix(in srgb, var(--mine-c1) 60%, transparent);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.pin-preview span {
  transform: rotate(45deg);
  font-weight: 800;
  font-size: 16px;
  color: #fff;
}
.pin-preview span.emoji { font-weight: 400; font-size: 20px; }

.pin-picker-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  border-radius: 10px;
  background: rgba(255,255,255,0.04);
  margin-bottom: 10px;
}
.pin-tab {
  padding: 7px 0;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  color: #9aa4bf;
  transition: all 0.15s;
}
.pin-tab.active {
  background: linear-gradient(135deg, rgba(124,92,255,0.5), rgba(0,201,255,0.4));
  color: #fff;
}

.pin-icon-grid[hidden] { display: none !important; }
.pin-picker-grid[hidden] { display: none !important; }

.icon-swatch {
  aspect-ratio: 1;
  border-radius: 12px;
  padding: 0;
  background: rgba(255,255,255,0.04);
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}
.icon-swatch:hover { background: rgba(255,255,255,0.08); transform: translateY(-2px); }
.icon-swatch.active {
  border-color: #fff;
  background: linear-gradient(135deg, rgba(124,92,255,0.25), rgba(236,72,153,0.25));
}
.icon-swatch .icon-preview { display: inline-flex; align-items: center; justify-content: center; }
.icon-swatch .icon-preview { font-size: 20px; line-height: 1; }

/* Emoji rendering inside map pins */
.post-pin .pin-emoji {
  transform: rotate(45deg);
  font-size: 17px;
  line-height: 1;
  font-weight: 400;
}
.post-pin.mine .pin-emoji { font-size: 18px; }
.post-pin.mine.level-4 .pin-emoji { font-size: 20px; }

.pin-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(44px, 1fr));
  gap: 8px;
}
.pin-swatch {
  aspect-ratio: 1;
  border-radius: 12px;
  padding: 0;
  background: transparent;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.pin-swatch:hover { transform: translateY(-2px); }
.pin-swatch.active { border-color: #fff; box-shadow: 0 0 0 2px rgba(255,255,255,0.2); }
.pin-swatch.locked {
  opacity: 0.3;
  filter: grayscale(100%) blur(0.3px);
  cursor: help;
  position: relative;
}
.pin-swatch.locked:hover { opacity: 0.55; transform: none; }
.icon-swatch.locked {
  opacity: 0.3;
  filter: grayscale(100%);
  cursor: help;
  position: relative;
}
.icon-swatch.locked:hover { opacity: 0.55; transform: none; background: rgba(255,255,255,0.04); }
.lock-badge {
  position: absolute;
  bottom: -2px; right: -2px;
  font-size: 10px;
  background: rgba(0,0,0,0.8);
  border-radius: 50%;
  width: 16px; height: 16px;
  display: flex; align-items: center; justify-content: center;
  filter: grayscale(0);
}
.unlock-summary {
  margin-top: 10px;
  padding: 6px 10px;
  border-radius: 8px;
  background: rgba(124,92,255,0.1);
  color: #c4b5fd;
  font-size: 11.5px;
  font-weight: 600;
  text-align: center;
}
.swatch-preview {
  width: 70%;
  height: 70%;
  border-radius: 50% 50% 50% 8px;
  transform: rotate(-45deg);
  border: 2px solid rgba(255,255,255,0.4);
  box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

/* Badges panel */
.badges-panel {
  padding: 14px;
  border-radius: 18px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  margin-bottom: 14px;
}
.badges-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.badges-header h4 { margin: 0; font-size: 14px; color: #cfd6ea; font-weight: 700; letter-spacing: -0.01em; }
.badges-count {
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(124,92,255,0.15);
  color: #c4b5fd;
  font-size: 11.5px;
  font-weight: 600;
}
.badges-count b { color: #fff; }
.badges-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: 8px;
}
.badge {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px 4px;
  border-radius: 14px;
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.04);
  opacity: 0.35;
  filter: grayscale(100%);
  transition: all 0.2s;
  cursor: help;
}
.badge.unlocked {
  opacity: 1;
  filter: none;
  background: linear-gradient(135deg, rgba(124,92,255,0.15), rgba(0,201,255,0.1));
  border-color: rgba(124,92,255,0.3);
  box-shadow: 0 4px 12px rgba(124,92,255,0.2);
}
.badge.unlocked:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 18px rgba(124,92,255,0.35);
}
.badge-icon {
  font-size: 24px;
  line-height: 1;
  margin-bottom: 4px;
}
.badge-name {
  font-size: 10px;
  font-weight: 600;
  color: #cfd6ea;
  text-align: center;
  line-height: 1.2;
}
.badge.unlocked .badge-name { color: #fff; }
.post-card.mine {
  background: linear-gradient(135deg, rgba(16,185,129,0.13), rgba(18,23,44,0.6));
  border-color: rgba(52,211,153,0.35);
  box-shadow: 0 4px 18px rgba(16,185,129,0.12);
}
.me-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  background: linear-gradient(135deg, #10b981, #34d399);
  color: #022c22;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.04em;
  margin-left: 4px;
  text-transform: uppercase;
  box-shadow: 0 4px 10px rgba(16,185,129,0.35);
}
.post-pin.precise {
  box-shadow: 0 10px 22px rgba(34,197,94,0.45), 0 0 0 3px rgba(34,197,94,0.3);
  border-color: rgba(134,239,172,0.85);
}
.post-geo.precise {
  color: #6ee7b7;
  background: rgba(16,185,129,0.12);
  border-color: rgba(16,185,129,0.3);
}
.post-pin.gold {
  background: linear-gradient(135deg, #fde68a, #f59e0b);
  border-color: rgba(255,255,255,0.55);
  box-shadow: 0 10px 22px rgba(250,204,21,0.55), 0 0 0 3px rgba(250,204,21,0.25);
}
.post-pin.silver {
  background: linear-gradient(135deg, #f3f4f6, #9ca3af);
  border-color: rgba(255,255,255,0.6);
  box-shadow: 0 10px 22px rgba(156,163,175,0.55), 0 0 0 3px rgba(229,231,235,0.25);
}
.post-pin.bronze {
  background: linear-gradient(135deg, #f5a97f, #b45309);
  border-color: rgba(255,255,255,0.5);
  box-shadow: 0 10px 22px rgba(180,83,9,0.55), 0 0 0 3px rgba(205,127,50,0.25);
}
.pin-medal {
  position: absolute;
  top: -8px; right: -8px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: rgba(10,15,30,0.95);
  color: #facc15;
  font-size: 11px;
  display: flex; align-items: center; justify-content: center;
  border: 1.5px solid rgba(255,255,255,0.6);
  transform: rotate(45deg);
  z-index: 3;
  box-shadow: 0 2px 6px rgba(0,0,0,0.4);
}
.post-pin.silver .pin-medal { color: #e5e7eb; }
.post-pin.bronze .pin-medal { color: #fdba74; }

/* Pins from other Pinfluence users (posts carrying #pinfluence).
   Placed late in the file so it wins over generic .precise / default background. */
.post-pin.pinfluence {
  background: linear-gradient(135deg, #ec4899, #f472b6) !important;
  border-color: rgba(253,242,248,0.4) !important;
  box-shadow: 0 10px 22px rgba(236,72,153,0.55), 0 0 0 3px rgba(236,72,153,0.3) !important;
}
.post-pin.pinfluence.precise {
  box-shadow: 0 12px 26px rgba(236,72,153,0.6), 0 0 0 4px rgba(236,72,153,0.35) !important;
}

.popup-rank {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  margin: 4px 0 8px;
}
.popup-rank.rank-gold   { color: #78350f; background: linear-gradient(135deg, #fde68a, #f59e0b); }
.popup-rank.rank-silver { color: #1f2937; background: linear-gradient(135deg, #f9fafb, #d1d5db); }
.popup-rank.rank-bronze { color: #fff;    background: linear-gradient(135deg, #f5a97f, #b45309); }
.screen-crosshair {
  position: absolute;
  left: 50%; top: 50%;
  width: 64px; height: 64px;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 900;
  filter: drop-shadow(0 0 8px rgba(34,211,238,0.7));
  transition: opacity 0.2s ease;
}
.screen-crosshair.dim { opacity: 0; }
.screen-crosshair svg { width: 100%; height: 100%; display: block; }
.crosshair-halo {
  position: absolute;
  left: 50%; top: 50%;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: rgba(34,211,238,0.35);
  transform: translate(-50%, -50%);
  animation: crosshair-pulse 2s infinite;
  z-index: -1;
}

/* Small GPS position marker (user's real location) */
.gps-pin {
  width: 14px; height: 14px;
  border-radius: 50%;
  background: #ec4899;
  border: 3px solid #fff;
  box-shadow: 0 0 0 2px rgba(236,72,153,0.6), 0 4px 10px rgba(0,0,0,0.5);
}

.me-pin {
  position: relative;
  width: 48px; height: 48px;
  cursor: grab;
}
.me-pin:active { cursor: grabbing; }
.me-pin svg {
  width: 100%; height: 100%;
  display: block;
  position: relative; z-index: 2;
  filter: drop-shadow(0 0 6px rgba(34,211,238,0.7));
}
.me-pulse {
  position: absolute;
  left: 50%; top: 50%;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: rgba(34,211,238,0.4);
  transform: translate(-50%, -50%);
  animation: crosshair-pulse 2s infinite;
  z-index: 1;
}
@keyframes crosshair-pulse {
  0%   { box-shadow: 0 0 0 0   rgba(34,211,238,0.5); }
  70%  { box-shadow: 0 0 0 16px rgba(34,211,238,0);   }
  100% { box-shadow: 0 0 0 0   rgba(34,211,238,0);   }
}

/* Search radius circle styling (Leaflet) */
.leaflet-interactive.radius-circle {
  stroke: #22d3ee !important;
  fill: #22d3ee !important;
  fill-opacity: 0.05 !important;
  stroke-opacity: 0.6 !important;
  stroke-width: 2 !important;
  stroke-dasharray: 6 4 !important;
}

/* Popup */
.leaflet-popup-content-wrapper {
  background: rgba(18,23,44,0.95) !important;
  color: #e8ecf4 !important;
  border-radius: 16px !important;
  box-shadow: 0 20px 50px rgba(0,0,0,0.5) !important;
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.08);
}
.leaflet-popup-content { margin: 12px 14px !important; font-size: 13px; line-height: 1.45; }
.leaflet-popup-tip { background: rgba(18,23,44,0.95) !important; }
.popup-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.popup-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: linear-gradient(135deg, #7c5cff, #ff5ea2);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 12px;
  object-fit: cover;
}
.popup-handle { font-weight: 700; font-size: 13px; }
.popup-time { font-size: 11px; color: #9aa4bf; }

/* ========== Feed ========== */
.feed-list {
  position: absolute; inset: 0;
  padding: 10px 14px 120px;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: none;
  scrollbar-width: none;
}
.feed-list::-webkit-scrollbar { display: none; }

.feed-filter {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  margin-bottom: 10px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(124,92,255,0.18), rgba(0,201,255,0.12));
  border: 1px solid rgba(124,92,255,0.35);
  font-size: 13px;
}
.feed-filter span { color: #cfd6ea; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; }
.feed-filter strong { color: #fff; font-weight: 700; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed-filter button {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
  color: #fff;
  font-size: 16px;
  line-height: 1;
  flex-shrink: 0;
  transition: background 0.15s;
}
.feed-filter button:hover { background: rgba(255,255,255,0.2); }
.post-card {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 12px;
  padding: 14px;
  border-radius: 18px;
  background: rgba(18,23,44,0.55);
  border: 1px solid rgba(255,255,255,0.06);
  margin-bottom: 10px;
  backdrop-filter: blur(10px);
  transition: background 0.15s;
  max-width: 100%;
  overflow: hidden;
}
.post-card > div { min-width: 0; }
.post-card:hover { background: rgba(22,28,52,0.7); }
.avatar {
  width: 42px; height: 42px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: #fff;
  background: linear-gradient(135deg, #7c5cff, #ff5ea2);
  font-size: 15px;
  object-fit: cover;
  overflow: hidden;
}
.avatar.a2 { background: linear-gradient(135deg, #00c9ff, #22d3ee); }
.avatar.a3 { background: linear-gradient(135deg, #f59e0b, #ef4444); }
.avatar.a4 { background: linear-gradient(135deg, #10b981, #34d399); }
.avatar.a5 { background: linear-gradient(135deg, #ec4899, #8b5cf6); }
.post-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.post-handle { font-weight: 700; }
.post-meta { font-size: 11.5px; color: #9aa4bf; display: flex; gap: 8px; align-items: center; }
.post-text {
  margin-top: 4px;
  font-size: 14.5px;
  line-height: 1.45;
  color: #e8ecf4;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  max-width: 100%;
}
.post-head { min-width: 0; flex-wrap: wrap; }
.post-handle { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.post-geo {
  margin-top: 8px; display: inline-flex; gap: 6px;
  font-size: 11.5px; color: #22d3ee; align-items: center;
  padding: 4px 8px; border-radius: 999px;
  background: rgba(34,211,238,0.08);
  border: 1px solid rgba(34,211,238,0.15);
}
.post-geo svg { width: 12px; height: 12px; }
.post-actions {
  display: flex; gap: 16px; margin-top: 10px;
  font-size: 12px; color: #9aa4bf;
}
.post-action {
  display: inline-flex; gap: 5px; align-items: center;
  transition: color 0.15s, background 0.15s;
  cursor: pointer; text-decoration: none; color: inherit;
  background: transparent; border: 0; padding: 4px 8px; border-radius: 8px;
  font-size: 12px; font-family: inherit;
}
.post-action:hover { color: #e8ecf4; background: rgba(255,255,255,0.04); }
.post-action svg { width: 14px; height: 14px; transition: transform 0.15s, fill 0.15s; }
.post-action.active-fav { color: #f472b6; }
.post-action.active-fav svg { fill: currentColor; transform: scale(1.08); }
.post-action.active-reblog { color: #10b981; }
.post-action.active-reblog svg { transform: scale(1.08); }

/* ========== Users ========== */
.users-list {
  position: absolute;
  top: 64px; left: 0; right: 0; bottom: 0;
  padding: 10px 14px 120px;
  overflow-y: auto;
  scrollbar-width: none;
}
.users-list::-webkit-scrollbar { display: none; }
.user-row {
  display: grid;
  grid-template-columns: 28px 52px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border-radius: 18px;
  background: rgba(18,23,44,0.55);
  border: 1px solid rgba(255,255,255,0.06);
  margin-bottom: 10px;
  backdrop-filter: blur(10px);
}
.rank-num { font-weight: 800; font-size: 18px; color: #9aa4bf; text-align: center; }
.rank-num.top1 { color: #facc15; text-shadow: 0 0 14px rgba(250,204,21,0.5); }
.rank-num.top2 { color: #e5e7eb; }
.rank-num.top3 { color: #f97316; }
.user-av {
  width: 52px; height: 52px; border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: #fff; font-size: 18px;
  object-fit: cover;
  overflow: hidden;
}
.user-info { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.user-handle { font-weight: 700; display: flex; align-items: center; gap: 6px; }
.verified {
  display: inline-flex; align-items: center; justify-content: center;
  width: 14px; height: 14px; border-radius: 50%;
  background: linear-gradient(135deg, #7c5cff, #00c9ff);
  color: #fff; font-size: 9px;
}
.user-name { font-size: 12.5px; color: #9aa4bf; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-stats { display: flex; gap: 10px; margin-top: 4px; font-size: 11px; color: #9aa4bf; }
.user-stats b { color: #e8ecf4; }
.user-actions { display: flex; gap: 6px; align-items: center; }
.follow-btn {
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.1);
  color: #e8ecf4;
  transition: all 0.15s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.follow-btn.following {
  background: linear-gradient(135deg, #10b981, #059669);
  border-color: transparent;
  color: #fff;
}
.follow-btn:hover { background: rgba(255,255,255,0.12); }
.follow-btn.following:hover { background: linear-gradient(135deg, #059669, #047857); }
.follow-btn.ghost { padding: 7px 10px; background: rgba(255,255,255,0.04); font-size: 13px; }
.follow-btn:disabled { opacity: 0.5; cursor: wait; }

/* ========== Topics ========== */
.topics-wrap {
  position: absolute; inset: 0;
  overflow-y: auto;
  padding: 10px 14px 120px;
  scrollbar-width: none;
}
.topics-wrap::-webkit-scrollbar { display: none; }
.topics-header h2 { margin: 8px 0 2px; font-size: 20px; letter-spacing: -0.02em; }
.topics-header p { margin: 0 0 14px; color: #9aa4bf; font-size: 13px; }
.topics-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.topic-card {
  padding: 14px;
  border-radius: 18px;
  background: rgba(18,23,44,0.55);
  border: 1px solid rgba(255,255,255,0.06);
  backdrop-filter: blur(10px);
  position: relative;
  overflow: hidden;
  min-height: 110px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.15s, box-shadow 0.15s;
  color: inherit;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}
.topic-card:hover { transform: translateY(-2px); box-shadow: 0 10px 22px rgba(124,92,255,0.25); }
.topic-card:active { transform: translateY(0); }
.topic-card.pinned {
  border-color: rgba(251,191,36,0.5);
  box-shadow: 0 4px 14px rgba(251,191,36,0.25);
}
.pin-toggle {
  position: absolute;
  top: 10px; right: 10px;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: rgba(0,0,0,0.3);
  color: #9aa4bf;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
  z-index: 2;
}
.pin-toggle svg { width: 14px; height: 14px; }
.pin-toggle:hover { background: rgba(251,191,36,0.25); color: #fbbf24; }
.pin-toggle.on { color: #fbbf24; background: rgba(251,191,36,0.2); }

/* Pinned chips row in Feed */
.pinned-tags {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 4px 6px;
  margin-bottom: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.pinned-tags::-webkit-scrollbar { display: none; }
.pinned-label { font-size: 14px; color: #fbbf24; flex-shrink: 0; }
.pin-chip {
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(251,191,36,0.1);
  border: 1px solid rgba(251,191,36,0.3);
  color: #fde68a;
  font-size: 12.5px;
  font-weight: 700;
  white-space: nowrap;
  transition: all 0.15s;
  flex-shrink: 0;
}
.pin-chip:hover { background: rgba(251,191,36,0.2); }
.pin-chip.active {
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  color: #422006;
  border-color: transparent;
  box-shadow: 0 4px 10px rgba(251,191,36,0.4);
}

/* Live event pin */
.event-pin {
  position: relative;
  width: 46px; height: 46px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ef4444, #b91c1c);
  border: 3px solid rgba(255,255,255,0.9);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800;
  font-size: 16px;
  box-shadow: 0 14px 28px rgba(239,68,68,0.55), 0 0 0 5px rgba(239,68,68,0.2);
}
.event-pin::before {
  content: "LIVE";
  position: absolute;
  bottom: -14px; left: 50%;
  transform: translateX(-50%);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.1em;
  background: #dc2626;
  color: #fff;
  padding: 2px 7px;
  border-radius: 999px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.4);
}
.event-ring {
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px solid rgba(239,68,68,0.6);
  animation: event-pulse 2s ease-out infinite;
}
@keyframes event-pulse {
  0%   { transform: scale(0.9); opacity: 1; }
  100% { transform: scale(1.6); opacity: 0; }
}

/* Event popup */
.event-popup { min-width: 220px; }
.event-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.event-badge {
  padding: 3px 9px;
  border-radius: 999px;
  background: #dc2626;
  color: #fff;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.08em;
}
.event-tag {
  font-size: 11.5px;
  color: #22d3ee;
  font-weight: 700;
}
.event-count { font-size: 12px; color: #cfd6ea; margin-bottom: 10px; }
.event-count b { color: #fff; font-size: 14px; font-weight: 800; }
.event-post { padding: 6px 0; border-top: 1px solid rgba(255,255,255,0.06); }
.event-handle { font-size: 12px; font-weight: 700; color: #e8ecf4; margin-bottom: 2px; }
.event-text { font-size: 11.5px; color: #cfd6ea; line-height: 1.3; }
.event-focus {
  width: 100%;
  margin-top: 10px;
  padding: 8px 12px;
  border-radius: 10px;
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  border: 0;
  cursor: pointer;
}
.topic-card::before {
  content: "";
  position: absolute;
  top: -30%; right: -30%;
  width: 120px; height: 120px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--tcolor, #7c5cff), transparent 70%);
  opacity: 0.45;
  filter: blur(20px);
}
.topic-tag { font-weight: 800; letter-spacing: -0.01em; position: relative; font-size: 15px; }
.topic-card.hashtag .topic-tag { color: #22d3ee; }
.topic-card.word .topic-tag::first-letter { text-transform: uppercase; }
.topic-count { font-size: 12px; color: #9aa4bf; position: relative; }
.topic-count b { color: #e8ecf4; font-size: 13px; }
.topic-bar {
  margin-top: 8px;
  height: 4px;
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
  position: relative;
  overflow: hidden;
}
.topic-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--tcolor, #7c5cff), rgba(255,255,255,0.3));
  border-radius: 999px;
  transition: width 0.4s ease;
}

/* ========== Tab bar ========== */
.tabbar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding: 8px 10px calc(env(safe-area-inset-bottom, 0px) + 8px);
  border-top: 1px solid rgba(255,255,255,0.05);
  z-index: 20;
}
.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 0;
  font-size: 10.5px;
  color: #7b8299;
  border-radius: 12px;
  transition: color 0.15s, background 0.15s;
}
.tab svg { width: 22px; height: 22px; }
.tab.active { color: #fff; background: rgba(255,255,255,0.06); }
.tab.active svg { color: #22d3ee; }

/* ========== Compose sheet ========== */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(6px);
  z-index: 200;
  animation: fadeIn 0.2s ease;
}
.sheet {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  background: rgba(14,18,36,0.96);
  backdrop-filter: blur(24px);
  border-top: 1px solid rgba(255,255,255,0.08);
  border-radius: 24px 24px 0 0;
  z-index: 210;
  padding: 10px 18px calc(env(safe-area-inset-bottom, 0px) + 18px);
  animation: slideUp 0.3s cubic-bezier(.2,.8,.2,1);
  max-height: 92vh;
  overflow-y: auto;
}
@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }
@keyframes slideUp { from { transform: translateY(100%) } to { transform: translateY(0) } }
.sheet-handle {
  width: 44px; height: 4px; border-radius: 999px;
  background: rgba(255,255,255,0.15);
  margin: 4px auto 14px;
}
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.sheet-head h3 { margin: 0; font-size: 17px; letter-spacing: -0.01em; }
.sheet-close {
  width: 32px; height: 32px; border-radius: 50%;
  background: rgba(255,255,255,0.06);
  color: #cfd6ea; font-size: 20px; line-height: 1;
}

.compose-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; }
.compose-label strong { font-size: 14px; display: block; }
.compose-label small { font-size: 12px; color: #9aa4bf; }

.switch { position: relative; display: inline-block; width: 42px; height: 24px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute; inset: 0;
  background: rgba(255,255,255,0.12);
  border-radius: 999px;
  transition: 0.2s;
}
.slider::before {
  content: "";
  position: absolute;
  left: 3px; top: 3px;
  width: 18px; height: 18px;
  background: #fff;
  border-radius: 50%;
  transition: 0.2s;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}
.switch input:checked + .slider {
  background: linear-gradient(135deg, #7c5cff, #00c9ff);
}
.switch input:checked + .slider::before { transform: translateX(18px); }

.compose-card {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 12px;
  padding: 14px;
  border-radius: 18px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.06);
  margin: 6px 0 14px;
}
.compose-body { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
#post-text {
  background: transparent;
  border: 0;
  color: #e8ecf4;
  font-family: inherit;
  font-size: 15px;
  line-height: 1.4;
  resize: none;
  width: 100%;
  outline: none;
  min-height: 70px;
}
#post-text::placeholder { color: #7b8299; }
.compose-meta {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 12px;
}
.geo-chip {
  display: inline-flex; align-items: center; gap: 6px;
  color: #22d3ee;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(34,211,238,0.08);
  border: 1px solid rgba(34,211,238,0.2);
  max-width: 70%;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.counter { color: #9aa4bf; font-variant-numeric: tabular-nums; }
.counter.warn { color: #f59e0b; }
.counter.danger { color: #ef4444; }

/* Compose media */
.meta-left { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.compose-tool {
  width: 34px; height: 34px;
  border-radius: 10px;
  background: rgba(124,92,255,0.18);
  color: #a78bfa;
  display: inline-flex; align-items: center; justify-content: center;
  transition: all 0.15s;
  flex-shrink: 0;
}
.compose-tool:hover { background: rgba(124,92,255,0.35); color: #fff; }
.compose-tool svg { width: 18px; height: 18px; }
.compose-tool.disabled { opacity: 0.4; pointer-events: none; }

.auto-tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 6px 0;
  font-size: 11px;
}
.auto-tags-label { color: #7b8299; font-weight: 500; }
.auto-tag {
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(34,211,238,0.1);
  color: #67e8f9;
  border: 1px solid rgba(34,211,238,0.2);
  font-weight: 600;
}
.auto-tag.pf {
  background: conic-gradient(from 210deg, rgba(124,92,255,0.3), rgba(0,201,255,0.3), rgba(255,94,162,0.3), rgba(124,92,255,0.3));
  color: #fff;
  border-color: rgba(124,92,255,0.4);
}
.auto-tag.geo {
  background: rgba(16,185,129,0.1);
  color: #6ee7b7;
  border-color: rgba(16,185,129,0.25);
}

.compose-media {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 6px;
}
.compose-media:empty { display: none; }
.compose-thumb {
  position: relative;
  aspect-ratio: 1;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(0,0,0,0.3);
}
.compose-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.compose-thumb .remove-thumb {
  position: absolute;
  top: 4px; right: 4px;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: rgba(0,0,0,0.75);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  line-height: 1;
  backdrop-filter: blur(4px);
}

/* Post media in feed */
.post-media {
  margin-top: 8px;
  display: grid;
  gap: 3px;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.05);
  width: 100%;
  max-width: 100%;
}
.post-media.n1 { grid-template-columns: 1fr; aspect-ratio: 16 / 10; }
.post-media.n2 { grid-template-columns: 1fr 1fr; aspect-ratio: 2 / 1; }
.post-media.n3 {
  grid-template-columns: 2fr 1fr;
  grid-template-rows: 1fr 1fr;
  aspect-ratio: 16 / 10;
}
.post-media.n3 .media-item:first-child { grid-row: 1 / 3; }
.post-media.n4 {
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  aspect-ratio: 1 / 1;
}
.media-item {
  position: relative;
  overflow: hidden;
  cursor: zoom-in;
  background: rgba(0,0,0,0.4);
  min-width: 0;
  min-height: 0;
}
.media-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s;
}
.media-item:hover img { transform: scale(1.04); }

/* POI pin on map */
.poi-pin {
  width: 32px; height: 32px;
  border-radius: 50% 50% 50% 8px;
  transform: rotate(-45deg);
  background: linear-gradient(135deg, #f97316, #ec4899);
  box-shadow: 0 8px 18px rgba(236,72,153,0.45);
  border: 2px solid rgba(255,255,255,0.3);
  display: flex; align-items: center; justify-content: center;
}
.poi-pin span { transform: rotate(45deg); font-size: 14px; line-height: 1; }

.search-result-icon.poi { background: rgba(236,72,153,0.2); color: #f9a8d4; }

/* Pinfluence badge */
.pf-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 999px;
  background: conic-gradient(from 210deg, #7c5cff, #00c9ff, #ff5ea2, #7c5cff);
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
  margin-left: 6px;
  letter-spacing: 0.02em;
  box-shadow: 0 4px 10px rgba(124,92,255,0.35);
  white-space: nowrap;
}
.pf-badge::before { content: "✦"; }

/* Popup media thumb */
.popup-media {
  margin-top: 6px;
  border-radius: 10px;
  overflow: hidden;
  max-height: 160px;
  background: rgba(0,0,0,0.3);
}
.popup-media img { width: 100%; height: 100%; object-fit: cover; display: block; max-height: 160px; }

/* Camera modal */
.camera-modal {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 600;
  display: flex;
  flex-direction: column;
  animation: fadeIn 0.2s ease;
}
.camera-modal[hidden] { display: none !important; }
#camera-video {
  flex: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000;
}
#camera-video::-webkit-media-controls { display: none !important; }
#camera-video::-webkit-media-controls-panel { display: none !important; }
#camera-video::-webkit-media-controls-start-playback-button { display: none !important; -webkit-appearance: none; }
.camera-top {
  position: absolute;
  top: calc(env(safe-area-inset-top, 0px) + 12px);
  left: 0; right: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 16px;
  z-index: 2;
}
.camera-ctrl {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(10px);
  color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid rgba(255,255,255,0.1);
}
.camera-ctrl svg { width: 20px; height: 20px; }
.camera-hint {
  padding: 8px 16px;
  border-radius: 999px;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(10px);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid rgba(255,255,255,0.1);
}
.camera-bottom {
  position: absolute;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 24px);
  left: 0; right: 0;
  display: flex;
  justify-content: center;
  z-index: 2;
}
.camera-snap {
  width: 78px; height: 78px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  backdrop-filter: blur(8px);
  padding: 0;
  display: flex; align-items: center; justify-content: center;
  border: 3px solid rgba(255,255,255,0.9);
  transition: transform 0.1s;
}
.camera-snap:active { transform: scale(0.92); }
.snap-ring {
  width: 58px; height: 58px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(0,0,0,0.2);
  transition: transform 0.15s;
}
.camera-snap.flash .snap-ring { transform: scale(0.85); background: #22d3ee; }

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.94);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
  animation: fadeIn 0.2s ease;
  padding: 20px;
}
.lightbox img {
  max-width: 95vw;
  max-height: 90vh;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.8);
}
.lightbox-close {
  position: absolute;
  top: calc(env(safe-area-inset-top, 0px) + 14px); right: 14px;
  width: 40px; height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
  backdrop-filter: blur(8px);
  color: #fff;
  font-size: 24px;
  display: flex; align-items: center; justify-content: center;
}

.sheet-actions { display: flex; gap: 10px; justify-content: flex-end; }
.sheet-note { font-size: 11.5px; color: #9aa4bf; margin-top: 10px; text-align: center; }
.btn-ghost {
  padding: 11px 18px;
  border-radius: 12px;
  color: #cfd6ea;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  font-weight: 600;
  font-size: 14px;
}
.btn-ghost.block { width: 100%; }
.btn-primary {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  padding: 11px 20px;
  border-radius: 12px;
  color: #fff;
  background: linear-gradient(135deg, #7c5cff, #00c9ff);
  font-weight: 700;
  font-size: 14px;
  box-shadow: 0 10px 24px rgba(124,92,255,0.45);
  transition: transform 0.15s;
}
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary svg { width: 16px; height: 16px; }
.btn-primary:active:not(:disabled) { transform: scale(0.97); }
.btn-primary.block { width: 100%; }

/* Account sheet */
.account-intro { font-size: 13.5px; color: #cfd6ea; line-height: 1.5; margin: 0 0 14px; }
.field-label { display: block; font-size: 12px; color: #9aa4bf; margin-bottom: 6px; font-weight: 600; }
.field-input {
  display: flex; align-items: center;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  padding: 0 12px;
  margin-bottom: 14px;
}
.field-prefix { color: #7b8299; font-size: 13px; }
#mastodon-instance {
  flex: 1;
  background: transparent;
  border: 0;
  outline: 0;
  padding: 12px 6px;
  font-size: 14px;
  color: #fff;
}
.account-actions { margin-bottom: 14px; }
.account-quick {
  font-size: 12px;
  color: #9aa4bf;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  padding: 10px 0 4px;
}
.account-quick span { width: 100%; margin-bottom: 4px; }

.account-card {
  display: flex; align-items: center; gap: 14px;
  padding: 14px;
  border-radius: 18px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  margin-bottom: 14px;
}
.account-avatar {
  width: 56px; height: 56px; border-radius: 16px;
  object-fit: cover;
}
.account-name { font-weight: 700; font-size: 15px; }
.account-handle { font-size: 13px; color: #9aa4bf; }

/* PWA install banner */
.install-banner {
  position: fixed;
  left: 14px; right: 14px;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 82px);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-radius: 18px;
  z-index: 1200;
  animation: slideUp 0.3s cubic-bezier(.2,.8,.2,1);
  border: 1px solid rgba(124,92,255,0.4);
  box-shadow: 0 14px 32px rgba(0,0,0,0.5);
  max-width: 520px;
  margin: 0 auto;
}
.install-banner[hidden] { display: none !important; }
.install-logo {
  width: 44px; height: 44px;
  border-radius: 12px;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(124,92,255,0.4);
}
.install-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.3;
}
.install-text strong { font-size: 13.5px; font-weight: 700; color: #fff; }
.install-text span { font-size: 11.5px; color: #cfd6ea; }
.install-btn {
  padding: 8px 16px;
  border-radius: 10px;
  background: linear-gradient(135deg, #7c5cff, #00c9ff);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
  box-shadow: 0 6px 16px rgba(124,92,255,0.4);
}
.install-close {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
  color: #cfd6ea;
  font-size: 16px;
  line-height: 1;
  flex-shrink: 0;
}
.install-banner.ios .install-text span b { color: #fff; font-weight: 700; }

/* Toast */
.toast {
  position: fixed;
  bottom: 100px;
  left: 50%; transform: translateX(-50%) translateY(20px);
  background: rgba(18,23,44,0.95);
  color: #e8ecf4;
  padding: 12px 20px;
  border-radius: 999px;
  border: 1px solid rgba(34,211,238,0.3);
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 14px 30px rgba(0,0,0,0.5);
  backdrop-filter: blur(14px);
  z-index: 300;
  opacity: 0;
  transition: all 0.3s ease;
  pointer-events: none;
  max-width: 90vw;
  text-align: center;
}
.toast.visible { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.error { border-color: rgba(239,68,68,0.5); }
