/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:      #0d0d0d;
  --bg2:     #111111;
  --bg3:     #1a1a1a;
  --border:  #2a2a2a;
  --text:    #ffffff;
  --muted:   #888888;
  --accent:  #4d8bff;
  --danger:  #ef5350;
  --online:  #00e676;
  --radius:  10px;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

#app {
  height: 100dvh;
  overflow: hidden;
  position: relative;
}

a { color: var(--accent); text-decoration: none; }

img { display: block; }

/* ============================================================
   TOPBAR
   ============================================================ */
.topbar {
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar-title {
  font-size: 17px;
  font-weight: 900;
  letter-spacing: -0.3px;
  background: linear-gradient(90deg, #a78bfa, #f472b6, #fb923c);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.chat-partner-btn {
  background: linear-gradient(90deg, #a78bfa, #f472b6, #fb923c);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-size: 17px;
  font-weight: 900;
  letter-spacing: -0.3px;
  border: none;
  padding: 0;
  cursor: pointer;
  text-decoration: none;
  line-height: 1;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 2px;
}

.topbar-btn {
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 5px;
  -webkit-tap-highlight-color: transparent;
}

.topbar-btn:active { background: var(--bg3); }

.topbar-btn--back {
  padding: 6px 10px;
  min-width: 44px;
  justify-content: center;
  line-height: 0;
}
.topbar-btn--back svg { display: block; filter: drop-shadow(0 1px 3px rgba(0,0,0,.35)); }

.topbar-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border);
}

.ham {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  flex-shrink: 0;
}

.ham-btn {
  flex-direction: column;
  gap: 5px;
  position: relative;
}

.ham-badge {
  position: absolute;
  top: 5px;
  right: 3px;
  background: var(--danger);
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  min-width: 15px;
  height: 15px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
  line-height: 1;
  pointer-events: none;
}

.menu-item {
  display: flex;
  align-items: center;
}

.menu-badge {
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 10px;
  margin-left: auto;
}

.filter-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

/* ============================================================
   GRID SCREEN
   ============================================================ */
.grid-screen {
  display: flex;
  flex-direction: column;
  height: 100dvh;
}

.loc-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: rgba(77, 139, 255, 0.08);
  border-bottom: 1px solid rgba(77, 139, 255, 0.18);
  font-size: 13px;
  color: var(--text);
  flex-shrink: 0;
}
.loc-banner-icon { font-size: 15px; flex-shrink: 0; }
.loc-banner-text { flex: 1; color: var(--muted); line-height: 1.3; }
.loc-banner-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
  white-space: nowrap;
}
.loc-banner-dismiss {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
  padding: 4px;
  flex-shrink: 0;
  line-height: 1;
}

.user-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  /* iOS Safari ignores aspect-ratio on grid children for row sizing;
     grid-auto-rows with vw units is the reliable fix */
  grid-auto-rows: calc(33.334vw - 1px);
  align-content: start;
  gap: 2px;
  overflow-y: auto;
  scrollbar-gutter: stable both-edges;
  max-width: 900px;
  margin: 0 auto;
  width: 100%;
  flex: 1;
  -webkit-overflow-scrolling: touch;
}

.card {
  position: relative;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  cursor: pointer;
  background: var(--bg3);
  -webkit-tap-highlight-color: transparent;
}

.card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.2s;
}

.card:active img { transform: scale(0.97); }

.card.online::after {
  content: '';
  position: absolute;
  inset: 0;
  box-shadow: inset 0 0 0 3px var(--online);
  pointer-events: none;
  z-index: 2;
}

.card-info {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(transparent, rgba(0,0,0,.82));
  padding: 16px 5px 5px;
  z-index: 1;
}

.card-name {
  display: block;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}

.card-dist {
  display: block;
  font-size: 11px;
  color: #ccc;
  margin-top: 2px;
}

.grid-status {
  text-align: center;
  padding: 20px;
  color: var(--muted);
  font-size: 14px;
}

/* ============================================================
   AUTH SCREEN
   ============================================================ */
.auth-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  padding: 32px 24px;
  background: linear-gradient(160deg, #1a1a35 0%, #0d0d0d 55%);
}

.auth-logo {
  text-align: center;
  margin-bottom: 36px;
}

.auth-logo-text {
  font-size: 48px;
  font-weight: 900;
  letter-spacing: -1px;
  background: linear-gradient(90deg, #a78bfa, #f472b6, #fb923c);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  display: inline-block;
  line-height: 1.1;
}

.auth-logo-sub {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: #a78bfa;
  margin-top: 6px;
}

.auth-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
  width: 100%;
  max-width: 380px;
}

.tab {
  flex: 1;
  padding: 12px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}

.tab.active {
  color: var(--text);
  border-bottom-color: var(--accent);
}

.auth-form {
  width: 100%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.auth-lang-switcher {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 24px;
  padding-bottom: 12px;
}

.auth-lang-btn {
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.auth-lang-btn:hover {
  border-color: var(--accent);
  color: var(--text);
}

.auth-lang-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ============================================================
   FORM ELEMENTS
   ============================================================ */
.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.field label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.field-hint {
  font-size: 12px;
  color: var(--muted);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="datetime-local"],
input[type="tel"],
input[type="search"],
textarea,
select {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 15px;
  padding: 13px 14px;
  width: 100%;
  outline: none;
  transition: border-color 0.2s;
  font-family: inherit;
  -webkit-appearance: none;
}

input:focus, textarea:focus, select:focus {
  border-color: var(--accent);
}

textarea { resize: vertical; min-height: 80px; }

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23888' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
  cursor: pointer;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn-primary {
  background: var(--accent);
  color: #000;
  border: none;
  border-radius: var(--radius);
  padding: 14px 20px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
}

.btn-primary:active { opacity: 0.85; transform: scale(0.98); }

.btn-secondary {
  background: var(--bg3);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 18px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.btn-ghost {
  background: none;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 13px 18px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}

.btn-ghost:active { border-color: var(--text); color: var(--text); }

.btn-danger {
  background: var(--danger);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 13px 20px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}

.btn-send {
  background: var(--accent);
  color: #000;
  border: none;
  border-radius: 50%;
  width: 44px;
  height: 44px;
  font-size: 17px;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.15s;
}

.btn-send:active { opacity: 0.8; }

.full { width: 100%; }

/* ============================================================
   ONBOARDING
   ============================================================ */
.onboarding-screen {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  padding: 28px 22px 32px;
  overflow-y: auto;
  box-sizing: border-box;
}

.on-progress {
  display: flex;
  gap: 6px;
  margin-bottom: 32px;
  flex-shrink: 0;
}

.on-dot {
  flex: 1;
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  transition: background 0.3s;
}

.on-dot.active { background: var(--accent); }

.on-step {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-height: calc(100dvh - 100px);
}

.on-step h2 {
  font-size: 26px;
  font-weight: 800;
  line-height: 1.2;
}

.on-hint { color: var(--muted); font-size: 14px; }

.on-nav {
  display: flex;
  gap: 12px;
  margin-top: auto;
  padding-top: 24px;
}

.on-nav .btn-ghost  { flex: 1; }
.on-nav .btn-primary { flex: 2; }

.on-upload-area {
  display: flex;
  align-items: center;
  gap: 14px;
}

.upload-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.on-avatar-preview {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--accent);
}

.avatar-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

.avatar-option {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 12px;
  object-fit: cover;
  cursor: pointer;
  border: 3px solid transparent;
  transition: border-color 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.avatar-option.selected { border-color: var(--accent); }

/* ============================================================
   CHIPS
   ============================================================ */
.chips-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  background: var(--bg3);
  border: 1px solid var(--border);
  color: #fff;
  border-radius: 20px;
  padding: 8px 14px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
  font-family: inherit;
}

.chip.selected {
  background: var(--accent);
  border-color: var(--accent);
  color: #000;
  font-weight: 700;
}

/* "＋ N" expand button — looks like a chip but muted */
.interests-show-more {
  background: var(--bg3);
  border: 1px dashed var(--border);
  color: var(--muted);
  font-weight: 600;
  cursor: pointer;
}
.interests-show-more:hover,
.interests-show-more:active {
  border-color: var(--accent);
  color: var(--accent);
}

/* ============================================================
   RADIO GROUPS
   ============================================================ */
.radio-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.radio-opt {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 8px 14px;
  font-size: 13px;
  color: var(--muted);
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.radio-opt input[type="radio"] { display: none; }

.radio-opt.selected,
.radio-opt:has(input:checked) {
  background: var(--accent);
  border-color: var(--accent);
  color: #000;
  font-weight: 700;
}

.range-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.range-row input { flex: 1; }
.range-row span { color: var(--muted); }

.toggle-field {
  flex-direction: row;
  align-items: flex-start;
  justify-content: space-between;
}

/* ============================================================
   TOGGLE SWITCH
   ============================================================ */
.toggle {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 28px;
  flex-shrink: 0;
}

.toggle input { opacity: 0; width: 0; height: 0; }

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 14px;
  cursor: pointer;
  transition: background 0.25s;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 22px;
  height: 22px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.25s;
}

.toggle input:checked + .toggle-slider { background: var(--accent); }
.toggle input:checked + .toggle-slider::before { transform: translateX(22px); }

/* ============================================================
   OVERLAY, POPUP & SIDE MENU
   ============================================================ */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.72);
  z-index: 100;
  display: flex;
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}

.overlay.hidden { display: none; }
.hidden { display: none !important; }

/* Side menu slides from left */
.side-menu {
  width: min(300px, 85vw);
  background: var(--bg2);
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  box-shadow: 4px 0 24px rgba(0,0,0,.5);
}

.menu-close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 22px;
  padding: 18px 18px 8px;
  cursor: pointer;
  align-self: flex-end;
}

.menu-avatar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 20px 20px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
  width: 100%;
  text-align: left;
  color: var(--text);
  transition: background 0.15s;
}
.menu-avatar:hover { background: var(--bg3); }

.menu-avatar img {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border);
}

.menu-avatar span {
  font-size: 15px;
  font-weight: 700;
}

.side-menu nav {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 8px 0;
}

.menu-item {
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  color: var(--text);
  font-size: 16px;
  padding: 16px 22px;
  cursor: pointer;
  transition: background 0.15s;
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
}

.menu-item:active { background: var(--bg3); }
.menu-item.danger { color: var(--danger); margin-top: auto; }

/* Filter popup — bottom sheet en móvil, centrado en escritorio */
#filter-popup { align-items: flex-end; }

/* Avatar modal — siempre centrado */
#avatar-modal { justify-content: center; align-items: center; }

.popup {
  background: var(--bg2);
  border-radius: 18px 18px 0 0;
  width: 100%;
  max-height: 88dvh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 -8px 40px rgba(0,0,0,.6);
}

.popup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.popup-header h3 { font-size: 17px; font-weight: 700; }

.popup-close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
}

.popup-body {
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  flex: 1;
  -webkit-overflow-scrolling: touch;
}

.popup-footer {
  display: flex;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  padding-bottom: max(14px, env(safe-area-inset-bottom));
}

.popup-footer .btn-ghost  { flex: 1; }
.popup-footer .btn-primary { flex: 2; }

/* ============================================================
   PROFILE SCREEN (other user)
   ============================================================ */
.profile-screen {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  overflow-y: auto;
}

.profile-hero {
  position: relative;
  width: 100%;
  height: 75dvh;
  flex-shrink: 0;
  max-height: 75dvh;
  flex-shrink: 0;
}

.profile-avatar {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  pointer-events: none;
  right: 0;
  background: linear-gradient(transparent, rgba(0,0,0,.88));
  padding: 32px 18px 18px;
}

.profile-overlay h2 {
  font-size: 22px;
  font-weight: 800;
}

.profile-dist { font-size: 13px; color: #bbb; margin-top: 4px; }

.online-badge {
  display: inline-block;
  background: var(--online);
  color: #000;
  font-size: 11px;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 12px;
  margin-top: 6px;
}

.profile-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.profile-body section h3 {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-weight: 700;
  margin-bottom: 10px;
}

.profile-body section p {
  font-size: 15px;
  line-height: 1.6;
  color: #ddd;
}

.profile-actions {
  padding-top: 4px;
  display: flex;
  gap: 10px;
  align-items: center;
}
.profile-actions .btn-primary { flex: 1; }

/* Profile plans section */
.profile-plans { display: flex; flex-direction: column; gap: 8px; }
.profile-plan-item {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 10px;
  background: var(--bg3);
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s;
}
.profile-plan-item:hover { background: var(--border); }
.profile-plan-img {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--bg2);
}
.profile-plan-noimg {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}
.profile-plan-name { font-weight: 600; font-size: 14px; }
.profile-plan-date { font-size: 12px; color: var(--muted); margin-top: 2px; }

.btn-star {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid #f5c518;
  background: transparent;
  color: #f5c518;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background .15s, color .15s, transform .15s;
  -webkit-tap-highlight-color: transparent;
}
.btn-star.active {
  background: #f5c518;
  color: #000;
}
.btn-star:active { transform: scale(0.9); }

.btn-star.pop { animation: star-pop .35s ease; }
@keyframes star-pop {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.5); }
  70%  { transform: scale(0.9); }
  100% { transform: scale(1); }
}

.btn-block {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: border-color .15s, background .15s;
  -webkit-tap-highlight-color: transparent;
}
.btn-block.blocked {
  border-color: var(--danger);
  background: rgba(239,83,80,.12);
  color: var(--danger);
}
.btn-block:active { transform: scale(0.9); }

/* Friends screen tabs */
.friends-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.friends-tab {
  flex: 1;
  padding: 11px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.friends-tab.active {
  color: var(--text);
  border-bottom-color: var(--accent);
}

/* Blocked card — dimmed + unblock overlay */
.blocked-card { opacity: 0.7; }
.blocked-card img { filter: grayscale(40%); }
.btn-unblock-card {
  position: absolute;
  bottom: 6px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--danger);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 4px 12px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  z-index: 3;
}

/* Leaflet popup profile link */
.popup-profile-btn {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  padding: 0;
  font-size: 15px;
  font-weight: 700;
  font-family: inherit;
  text-decoration: underline;
}
.popup-profile-btn:hover { opacity: 0.8; }

/* ============================================================
   CHAT SCREEN
   ============================================================ */
.chat-screen {
  display: flex;
  flex-direction: column;
  height: 100dvh;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  -webkit-overflow-scrolling: touch;
}

.msg {
  display: flex;
  flex-direction: column;
  max-width: 78%;
}

.msg-out { align-self: flex-end; align-items: flex-end; }
.msg-in  { align-self: flex-start; align-items: flex-start; }

.msg-bubble {
  display: inline-block;
  padding: 10px 14px;
  border-radius: 18px;
  font-size: 17px;
  line-height: 1.45;
  word-break: break-word;
}

.msg-out .msg-bubble {
  background: var(--accent);
  color: #000;
  border-bottom-right-radius: 4px;
}

.msg-in .msg-bubble {
  background: var(--bg3);
  color: var(--text);
  border-bottom-left-radius: 4px;
}

.msg-time {
  font-size: 10px;
  color: var(--muted);
  margin-top: 3px;
}

.chat-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  padding-bottom: max(10px, env(safe-area-inset-bottom));
  background: var(--bg2);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.chat-bar input {
  flex: 1;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 10px 16px;
  color: var(--text);
  font-size: 15px;
  outline: none;
}

.chat-bar input:focus { border-color: var(--accent); }

.system-chat-notice {
  padding: 12px 16px;
  background: var(--bg2);
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--muted);
  text-align: center;
  line-height: 1.5;
}

/* ============================================================
   MY PROFILE
   ============================================================ */
.my-profile-screen {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  overflow-y: auto;
}

.my-profile-body {
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.my-avatar-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding-bottom: 4px;
}

.my-avatar {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--border);
}

.change-photo-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 8px;
  padding: 8px 18px;
  cursor: pointer;
  font-size: 14px;
  font-family: inherit;
}

.profile-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.my-profile-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  padding-bottom: max(0px, env(safe-area-inset-bottom));
}

/* ============================================================
   MAP SCREEN
   ============================================================ */
.map-screen {
  display: flex;
  flex-direction: column;
  height: 100dvh;
}

.leaflet-map {
  flex: 1;
  z-index: 0;
}

.map-marker {
  width: 40px !important;
  height: 40px !important;
  border-radius: 50%;
  overflow: hidden;
  box-shadow: 0 0 0 3px var(--accent), 0 2px 8px rgba(0,0,0,.5);
}
.map-marker img {
  width: 100%;
  height: 100%;
  border-radius: 0;
  object-fit: cover;
  display: block;
}

/* ============================================================
   SETTINGS SCREEN
   ============================================================ */
.settings-screen {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  overflow-y: auto;
}

.settings-body {
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 26px;
}

/* ============================================================
   EVENT FORM
   ============================================================ */
.event-form-screen {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  overflow-y: auto;
}

.event-form {
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* ============================================================
   EVENT PROMO FORM
   ============================================================ */
.event-form-screen {
  display: flex;
  flex-direction: column;
  height: 100dvh;
}

.event-form-body {
  overflow-y: auto;
  flex: 1;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 0;
  -webkit-overflow-scrolling: touch;
}

.promo-intro {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 20px;
}

.promo-intro p {
  font-size: 14px;
  line-height: 1.65;
  color: #ccc;
}

.promo-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-bottom: max(24px, env(safe-area-inset-bottom));
}

.form-section-title {
  font-size: 11px;
  font-weight: 800;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.7px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  margin-top: 6px;
}

.map-picker {
  width: 100%;
  height: 240px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}

.price-display {
  background: var(--bg3);
  border: 2px solid var(--accent);
  border-radius: var(--radius);
  padding: 14px;
  text-align: center;
  font-size: 28px;
  font-weight: 900;
  color: var(--accent);
}

.promo-preview-img {
  width: 100%;
  max-height: 180px;
  object-fit: contain;
  border-radius: var(--radius);
  margin-top: 10px;
  border: 1px solid var(--border);
  display: block;
}

/* ============================================================
   ADMIN PANEL
   ============================================================ */
.admin-panel-screen,
.event-broadcast-screen {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  overflow-y: auto;
}

.admin-panel-body {
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.admin-action-btn {
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius);
  padding: 18px 20px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  width: 100%;
  transition: background 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.admin-action-btn:active { background: var(--border); }

.broadcast-body {
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-bottom: max(24px, env(safe-area-inset-bottom));
}

.menu-item.admin-item {
  color: var(--accent);
  font-weight: 700;
  border-top: 1px solid var(--border);
  margin-top: 4px;
}

/* ============================================================
   CHAT IMAGE ATTACHMENTS
   ============================================================ */
.chat-attach-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 22px;
  cursor: pointer;
  padding: 0 6px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  -webkit-tap-highlight-color: transparent;
}

.chat-attach-preview {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--bg2);
  border-top: 1px solid var(--border);
}

.chat-attach-preview.hidden { display: none; }

.chat-attach-thumb {
  width: 52px;
  height: 52px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.chat-attach-remove {
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 50%;
  width: 26px;
  height: 26px;
  cursor: pointer;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.msg-image-link { display: block; margin-bottom: 4px; }

.msg-image {
  max-width: 220px;
  max-height: 220px;
  border-radius: 12px;
  object-fit: cover;
  display: block;
  cursor: pointer;
}

/* ============================================================
   CONVERSATIONS SCREEN
   ============================================================ */
.conversations-screen {
  display: flex;
  flex-direction: column;
  height: 100dvh;
}

.conv-list {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.conv-item {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 14px 18px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  -webkit-tap-highlight-color: transparent;
  transition: background 0.12s;
}

.conv-item:active { background: var(--bg3); }

.conv-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 2px solid var(--border);
}

.conv-info {
  flex: 1;
  overflow: hidden;
}

.conv-name {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.conv-last {
  font-size: 13px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conv-last.unread { color: var(--text); font-weight: 600; }

.conv-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
  flex-shrink: 0;
}

.conv-time {
  font-size: 11px;
  color: var(--muted);
}

.conv-unread {
  background: var(--accent);
  color: #000;
  font-size: 11px;
  font-weight: 800;
  min-width: 20px;
  height: 20px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
}

.conv-empty {
  text-align: center;
  padding: 48px 20px;
  color: var(--muted);
  font-size: 15px;
}

/* ============================================================
   HELP SCREEN
   ============================================================ */
.help-screen {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  overflow-y: auto;
}

.help-body {
  padding: 28px 22px;
}

.help-body p {
  font-size: 16px;
  line-height: 1.75;
  color: #ccc;
}

/* ============================================================
   LOADING SCREEN
   ============================================================ */
.loading-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100dvh;
  color: var(--muted);
}

/* ============================================================
   TOAST
   ============================================================ */
.toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  background: var(--bg3);
  color: var(--text);
  padding: 12px 22px;
  border-radius: 24px;
  font-size: 14px;
  font-weight: 600;
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.25s, transform 0.25s;
  pointer-events: none;
  white-space: nowrap;
  max-width: 88vw;
  overflow: hidden;
  text-overflow: ellipsis;
  border: 1px solid var(--border);
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast-error   { background: #7f1a1a; border-color: var(--danger); }
.toast-success { background: #1a3d1a; border-color: var(--accent); }

/* ============================================================
   SAFE AREAS (iPhone notch / home bar)
   ============================================================ */
.topbar {
  padding-top: env(safe-area-inset-top);
  height: calc(54px + env(safe-area-inset-top));
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 320px) {
  .user-grid { grid-template-columns: repeat(2, 1fr); grid-auto-rows: calc(50vw - 1px); }
  .avatar-grid { grid-template-columns: repeat(4, 1fr); }
}

@media (min-width: 600px) {
  .auth-screen { background: var(--bg2); }
  .user-grid { grid-template-columns: repeat(4, 1fr); grid-auto-rows: calc(25vw - 1px); }
}

@media (min-width: 900px) {
  .user-grid { grid-template-columns: repeat(5, 1fr); grid-auto-rows: 180px; }
  .side-menu { width: 320px; }

  /* Centrar popups en escritorio usando flexbox del overlay */
  #filter-popup { align-items: center; justify-content: center; }

  #filter-popup .popup,
  #avatar-modal .popup {
    max-width: 480px;
    width: 100%;
    border-radius: 18px;
  }
}

/* Scrollbar */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* ============================================================
   SELF CARD IN GRID
   ============================================================ */
.card-self {
  outline: 3px solid var(--accent);
  outline-offset: -3px;
}
.card-self .card-info { background: linear-gradient(transparent, rgba(0,200,100,.7)); }

/* ============================================================
   PHOTO CAROUSEL (profile view)
   ============================================================ */
.photo-carousel {
  position: relative;
  width: 100%;
  height: 75dvh;
  flex-shrink: 0;
  overflow: hidden;
}
.photo-carousel-track {
  display: flex;
  height: 100%;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.photo-carousel-track::-webkit-scrollbar { display: none; }
.photo-slide {
  flex: 0 0 100%;
  height: 100%;
  scroll-snap-align: start;
  position: relative;
  cursor: zoom-in;
}
.photo-slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Carousel nav arrows (desktop) */
.carousel-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 4;
  background: rgba(0,0,0,.5);
  color: #fff;
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity .2s;
  -webkit-tap-highlight-color: transparent;
}
.photo-carousel:hover .carousel-arrow { opacity: 1; }
.carousel-arrow-prev { left: 10px; }
.carousel-arrow-next { right: 10px; }
@media (hover: none) { .carousel-arrow { display: none; } }

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.97);
  z-index: 9000;
  display: flex;
  flex-direction: column;
}
.lightbox-track {
  flex: 1;
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}
.lightbox-track::-webkit-scrollbar { display: none; }
.lightbox-slide {
  flex: 0 0 100%;
  scroll-snap-align: start;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 56px 8px 48px;
}
.lightbox-slide img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 4px;
  user-select: none;
}
.lightbox-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  background: rgba(255,255,255,.18);
  border: none;
  color: #fff;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lightbox-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  background: rgba(255,255,255,.18);
  border: none;
  color: #fff;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
}
.lightbox-btn-prev { left: 8px; }
.lightbox-btn-next { right: 8px; }
.lightbox-counter {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255,255,255,.7);
  font-size: 13px;
  pointer-events: none;
}

/* Grid skeleton cards */
@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position:  200% 0; }
}
.card-skeleton {
  pointer-events: none;
  background: var(--bg2);
}
.card-skeleton .sk-img {
  width: 100%;
  aspect-ratio: 1;
  background: linear-gradient(90deg, var(--bg3) 25%, var(--bg2) 50%, var(--bg3) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
}
.card-skeleton .sk-line {
  height: 13px;
  margin: 8px 10px;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--bg3) 25%, var(--bg2) 50%, var(--bg3) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  animation-delay: .15s;
}
.carousel-counter {
  position: absolute;
  top: 10px;
  right: 12px;
  background: rgba(0,0,0,.55);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 12px;
  z-index: 3;
  pointer-events: none;
}

/* ============================================================
   PHOTO SLOTS (my profile / onboarding)
   ============================================================ */
.photo-slots {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}
.photo-slot {
  aspect-ratio: 1 / 1;
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
  background: var(--bg3);
  border: 2px dashed var(--border);
}
.photo-slot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.photo-slot-del {
  position: absolute;
  top: 4px;
  right: 4px;
  background: rgba(0,0,0,.65);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  line-height: 1;
}
.add-slot {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 4px;
  font-size: 24px;
  color: var(--muted);
  cursor: pointer;
  border-radius: var(--radius);
  background: var(--bg3);
  border: 2px dashed var(--border);
  aspect-ratio: 1 / 1;
  transition: border-color 0.2s;
}
.add-slot:active { border-color: var(--accent); color: var(--accent); }
.add-slot span { font-size: 11px; }

.photo-no-adult-hint {
  font-size: 12px;
  color: var(--muted);
  text-align: center;
  margin-top: -6px;
  margin-bottom: 12px;
  line-height: 1.5;
}

/* ============================================================
   INTEREST CATEGORIES
   ============================================================ */

/* Cuando chips-container tiene intereses agrupados, apilar categorías en vertical */
.chips-container.grouped {
  flex-direction: column;
  align-items: stretch;
  gap: 0;
}

.interest-category {
  margin-bottom: 20px;
  width: 100%;
}
.interest-cat-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 10px;
  padding-top: 4px;
}
.interest-category > div {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-bottom: 4px;
}

/* ============================================================
   AVATAR PICKER COLAPSABLE
   ============================================================ */
.avatar-picker-details {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 16px;
}

.avatar-picker-details summary {
  padding: 12px 16px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.avatar-picker-details summary::-webkit-details-marker { display: none; }

.avatar-picker-details summary::after {
  content: '▸';
  font-size: 12px;
  transition: transform 0.2s;
}

.avatar-picker-details[open] summary::after {
  transform: rotate(90deg);
}

.avatar-picker-details .avatar-grid {
  padding: 12px;
  border-top: 1px solid var(--border);
}
.more-section { margin-top: 8px; }
.more-section-body {
  padding: 16px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.more-section-body .profile-form { padding: 0; }
.more-section-body .my-profile-actions { display: flex; flex-direction: column; gap: 8px; }

.btn-delete-account {
  background: none;
  border: none;
  color: var(--danger);
  opacity: 0.45;
  font-size: 12px;
  padding: 6px 0;
  cursor: pointer;
  text-align: center;
  width: 100%;
  letter-spacing: 0.3px;
  transition: opacity 0.2s;
}
.btn-delete-account:active { opacity: 1; }

/* ============================================================
   ADMIN STATS
   ============================================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin: 16px 0;
}
.stat-card {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
}
.stat-card .stat-val {
  font-size: 28px;
  font-weight: 800;
  color: var(--accent);
  display: block;
}
.stat-card .stat-label {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
  display: block;
}

/* ============================================================
   ADMIN STATS SCREEN
   ============================================================ */
.admin-stats-screen {
  display: flex;
  flex-direction: column;
  height: 100dvh;
}
.admin-stats-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 16px;
}

/* ============================================================
   CONFIRM MODAL (switch avatar)
   ============================================================ */
#confirm-avatar-modal .popup-body p {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}
#confirm-avatar-modal .popup-footer {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

/* ============================================================
   HELP CONTACT FORM
   ============================================================ */
.help-contact-section {
  margin-top: 28px;
  border-top: 1px solid var(--border);
  padding-top: 20px;
}
.help-contact-section h3 {
  font-size: 16px;
  margin-bottom: 12px;
}

/* ============================================================
   DELETE CONVERSATION
   ============================================================ */
.conv-item {
  position: relative;
}
.conv-delete-btn {
  flex-shrink: 0;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 16px;
  cursor: pointer;
  padding: 8px 10px;
  border-radius: 8px;
  line-height: 1;
  margin-left: 4px;
}
.conv-delete-btn:active { color: var(--danger); }

/* ============================================================
   MAP FIRST-TIME POPUP
   ============================================================ */
#map-firsttime-popup {
  position: fixed;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg2);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 16px 20px;
  max-width: 320px;
  width: calc(100% - 32px);
  z-index: 9999;
  box-shadow: 0 4px 24px rgba(0,0,0,.5);
  pointer-events: all;
}
#map-firsttime-popup p {
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  margin-bottom: 12px;
}
#map-firsttime-popup .btn-primary { width: 100%; }
#map-firsttime-popup.hidden { display: none; }

.map-vis-fab {
  position: fixed;
  bottom: 24px;
  right: 20px;
  border: none;
  border-radius: 28px;
  padding: 13px 18px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0,0,0,.45);
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: background 0.2s, color 0.2s, opacity 0.2s;
}
.map-vis-fab:disabled { opacity: 0.5; pointer-events: none; }
.map-vis-fab--on {
  background: var(--online);
  color: #000;
}
.map-vis-fab--off {
  background: var(--bg3);
  color: var(--muted);
  border: 1px solid var(--border);
}

/* ============================================================
   MAP SELF MARKER
   ============================================================ */
.map-marker-self {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px #000, 0 2px 10px rgba(0,0,0,.6);
}
.map-self-label {
  position: absolute;
  bottom: -18px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  font-weight: 700;
  color: var(--accent);
  white-space: nowrap;
  text-shadow: 0 1px 3px #000;
}

@media (min-width: 900px) {
  #confirm-avatar-modal { align-items: center; justify-content: center; }
  #confirm-avatar-modal .popup { max-width: 400px; width: 100%; border-radius: 18px; }
}

/* ============================================================
   CROP MODAL
   ============================================================ */
.crop-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.94);
  z-index: 9002;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 16px;
}
.crop-modal-overlay.hidden { display: none; }
.crop-modal-title {
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  text-align: center;
}
.crop-hint {
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  margin-top: -8px;
}
.crop-container {
  position: relative;
  overflow: hidden;
  user-select: none;
  touch-action: none;
  background: #000;
  max-width: calc(100vw - 32px);
  max-height: calc(100dvh - 220px);
  display: flex;
  align-items: center;
  justify-content: center;
}
.crop-image {
  display: block;
  max-width: calc(100vw - 32px);
  max-height: calc(100dvh - 220px);
  object-fit: contain;
  pointer-events: none;
  -webkit-user-drag: none;
}
.crop-box {
  position: absolute;
  border: 2px solid var(--accent);
  box-shadow: 0 0 0 9999px rgba(0,0,0,.55);
  cursor: move;
  touch-action: none;
  box-sizing: border-box;
}
.crop-handle {
  position: absolute;
  width: 20px;
  height: 20px;
  background: var(--accent);
  border-radius: 3px;
  touch-action: none;
  z-index: 2;
}
.crop-handle[data-corner="nw"] { top: -5px; left: -5px; cursor: nw-resize; }
.crop-handle[data-corner="ne"] { top: -5px; right: -5px; cursor: ne-resize; }
.crop-handle[data-corner="se"] { bottom: -5px; right: -5px; cursor: se-resize; }
.crop-handle[data-corner="sw"] { bottom: -5px; left: -5px; cursor: sw-resize; }
.crop-actions {
  display: flex;
  gap: 12px;
  width: 100%;
  max-width: 360px;
}
.crop-actions .btn-ghost,
.crop-actions .btn-primary { flex: 1; }

/* ============================================================
   STATUS BUBBLE
   ============================================================ */
.status-bubble {
  position: absolute;
  top: 3px;
  right: 3px;
  background: #fff;
  color: #111;
  border-radius: 10px;
  font-size: 10px;
  line-height: 1.3;
  padding: 3px 6px;
  max-width: 65%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: 0 1px 5px rgba(0,0,0,.45);
  z-index: 3;
  pointer-events: none;
}

/* Status bubble — larger version for profile hero */
.status-bubble--profile {
  top: 12px;
  right: 12px;
  font-size: 13px;
  padding: 5px 10px;
  border-radius: 14px;
  max-width: 70%;
  white-space: normal;
  line-height: 1.4;
}

/* Profile overlay meta row (distance + online + gender/orientation chips) */
.profile-overlay-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
  align-items: center;
}

.profile-dist-chip {
  font-size: 13px;
  color: #ddd;
}

.profile-meta-chip {
  font-size: 12px;
  background: rgba(255,255,255,.18);
  color: #eee;
  border-radius: 20px;
  padding: 2px 10px;
  border: 1px solid rgba(255,255,255,.28);
}

/* ============================================================
   PLANS SCREENS
   ============================================================ */
.plans-screen {
  display: flex;
  flex-direction: column;
  height: 100dvh;
}
.plans-accordion {
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.plans-accordion-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 14px;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
  text-align: left;
}
.plans-accordion-chevron {
  transition: transform 0.2s;
  display: inline-block;
}
.plans-accordion-chevron.open { transform: rotate(180deg); }
.plans-accordion-body {
  border-top: 1px solid var(--border);
  max-height: 50dvh;
  overflow-y: auto;
}
.plans-search-bar {
  display: flex;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg2);
}
.plans-search-input {
  flex: 1;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 12px;
  color: var(--text);
  font-size: 14px;
}
.plans-search-input:focus { outline: none; border-color: var(--accent); }
.plans-filter-panel {
  padding: 0 12px 12px;
  background: var(--bg2);
}
.plans-loc-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 6px;
}
.plans-tabs {
  display: flex;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.plans-tab {
  flex: 1;
  padding: 10px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.plans-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.range-input { width: 100%; accent-color: var(--accent); }
.plan-card-interests { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 5px; }
.plan-chip {
  font-size: 10px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 2px 7px;
  color: var(--muted);
}
.plans-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.plans-empty {
  padding: 40px 24px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}
.plans-fab {
  position: fixed;
  bottom: 24px;
  right: 20px;
  background: var(--accent);
  color: #000;
  border: none;
  border-radius: 28px;
  padding: 14px 20px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0,0,0,.45);
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 6px;
}
.plan-card {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
  align-items: flex-start;
}
.plan-card:hover { background: var(--bg2); }
.plan-card-img {
  width: 62px;
  height: 62px;
  border-radius: 10px;
  object-fit: cover;
  flex-shrink: 0;
}
.plan-card-no-img {
  width: 62px;
  height: 62px;
  border-radius: 10px;
  background: var(--bg3);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
}
.plan-card-info { flex: 1; min-width: 0; }
.plan-card-name {
  font-weight: 700;
  font-size: 15px;
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.plan-card-date { color: var(--muted); font-size: 12px; margin-bottom: 4px; }
.plan-card-meta { display: flex; gap: 10px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.plan-card-joined { color: var(--accent); font-weight: 600; }

/* Plan detail */
.plan-detail-screen {
  display: flex;
  flex-direction: column;
  height: 100dvh;
}
.plan-detail-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  -webkit-overflow-scrolling: touch;
}
.plan-detail-img {
  width: 100%;
  aspect-ratio: 5 / 4;
  object-fit: cover;
  border-radius: 12px;
  margin-bottom: 16px;
}
.plans-edit-fab {
  position: fixed;
  bottom: 24px;
  right: 20px;
  background: var(--accent);
  color: #000;
  border: none;
  border-radius: 28px;
  padding: 14px 20px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0,0,0,.45);
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 6px;
}
.plan-detail-name {
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 6px;
}
.plan-detail-date {
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 12px;
}
.plan-detail-desc {
  font-size: 14px;
  line-height: 1.65;
  color: #ccc;
  margin-bottom: 16px;
}
.plan-organizer {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  background: var(--bg2);
  border-radius: var(--radius);
  margin-bottom: 16px;
  cursor: pointer;
}
.plan-organizer img {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
}
.plan-organizer-info { font-size: 13px; }
.plan-organizer-label { color: var(--muted); font-size: 11px; }
.plan-attendees-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 10px;
  margin-top: 16px;
}
.plan-attendees-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 20px;
}
.plan-attendee {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  width: 56px;
}
.plan-attendee img {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border);
}
.plan-attendee-name {
  font-size: 10px;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 56px;
  color: var(--muted);
}
.plan-map-mini {
  height: 160px;
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 16px;
}
.plan-join-btn { margin-top: 8px; }

/* New plan form */
.new-plan-screen {
  display: flex;
  flex-direction: column;
  height: 100dvh;
}
.new-plan-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  gap: 0;
}
.plan-map-picker {
  height: 200px;
  border-radius: 10px;
  overflow: hidden;
  margin: 8px 0;
  border: 1px solid var(--border);
}
.status-save-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.status-save-row input {
  flex: 1;
}
.btn-icon-sm {
  flex-shrink: 0;
  background: var(--accent);
  color: #000;
  border: none;
  border-radius: 8px;
  width: 38px;
  height: 38px;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.status-emoji-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 8px;
  margin-top: 6px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.status-emoji-picker.hidden { display: none; }
.status-emoji-btn {
  background: none;
  border: none;
  border-radius: 8px;
  width: 38px;
  height: 38px;
  font-size: 22px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.status-emoji-btn:hover,
.status-emoji-btn:active {
  background: var(--accent-dim, rgba(120,80,255,0.15));
}
.change-password-section {
  margin-top: 8px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.change-password-section h3 {
  font-size: 14px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 12px;
}

/* ============================================================
   ADMIN – delete-user view
   ============================================================ */
.admin-delete-user-screen {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  overflow: hidden;
}
.admin-delete-user-screen .admin-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.admin-action-btn--danger {
  color: var(--danger);
  border-color: var(--danger);
  opacity: 0.85;
}
.admin-action-btn--danger:hover,
.admin-action-btn--danger:active {
  background: rgba(239,83,80,.12);
  opacity: 1;
}
.admin-user-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.admin-user-row:last-child { border-bottom: none; }
.admin-user-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.admin-user-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.admin-user-name {
  font-weight: 600;
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.admin-user-meta {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.btn-admin-delete {
  flex-shrink: 0;
  background: none;
  border: 1px solid var(--danger);
  color: var(--danger);
  border-radius: 8px;
  width: 38px;
  height: 38px;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.7;
  transition: opacity 0.15s, background 0.15s;
}
.btn-admin-delete:hover,
.btn-admin-delete:active {
  opacity: 1;
  background: rgba(239,83,80,.15);
}
