:root {
  --bg: #000;
  --surface: #111;
  --border: #222;
  --text: #fff;
  --muted: #9a9a9a;
  --primary: #FF7849;
  --purple: #A56CFF;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--text);
  font-family: -apple-system, system-ui, Segoe UI, Roboto, sans-serif;
  overflow: hidden;
}
#map { position: absolute; inset: 0; }

/* Barra superior */
.topbar {
  position: absolute; top: 0; left: 0; right: 0; z-index: 10;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px;
  background: linear-gradient(180deg, rgba(0,0,0,0.85), rgba(0,0,0,0));
  pointer-events: none;
}
.topbar > * { pointer-events: auto; }
.logo {
  font-size: 26px; font-style: italic; font-weight: 800; margin: 0;
  background: linear-gradient(90deg, #FF7849, #A56CFF);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.spacer { flex: 1; }
/* Botón de descarga: flecha; al pasar el ratón se despliega el texto */
.topdl {
  pointer-events: auto; text-decoration: none;
  background: rgba(20,20,20,0.9); border: 1px solid #333; border-radius: 999px;
  height: 40px; display: flex; align-items: center; gap: 0; padding: 0 11px;
  color: var(--text); font-weight: 800; font-size: 14px; white-space: nowrap;
}
.topdl-ico { font-size: 18px; line-height: 1; }
.topdl-txt { margin-left: 7px; white-space: nowrap; }

/* Selector de idioma colapsado (dropdown) */
.langsel { position: relative; }
.langbtn {
  background: rgba(20,20,20,0.9); color: var(--text); border: 1px solid #333; border-radius: 999px;
  height: 40px; padding: 0 12px; font-weight: 800; font-size: 13px; cursor: pointer; white-space: nowrap;
}
.langcaret { color: var(--muted); font-size: 11px; }
.langmenu {
  position: absolute; top: 46px; right: 0; z-index: 30;
  background: rgba(17,17,17,0.98); border: 1px solid #333; border-radius: 12px;
  display: flex; flex-direction: column; overflow: hidden; min-width: 152px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}
.langmenu[hidden] { display: none; }
.langmenu button {
  background: none; border: none; color: var(--text); text-align: left;
  padding: 11px 14px; font-size: 14px; font-weight: 700; cursor: pointer; white-space: nowrap;
}
.langmenu button:hover { background: rgba(255,255,255,0.06); }

/* Controles de Mapbox por encima de la barra flotante (que no los tape) */
.maplibregl-ctrl-bottom-left { bottom: 78px !important; }
.maplibregl-ctrl-bottom-right { bottom: 78px !important; }
.lang { display: flex; gap: 4px; }
.lang button {
  background: transparent; color: #888; border: 1px solid #333; border-radius: 999px;
  padding: 4px 10px; font-weight: 700; cursor: pointer; font-size: 12px;
}
.lang button.on { color: #000; background: var(--primary); border-color: var(--primary); }

.btn {
  border: none; border-radius: 999px; font-weight: 800; cursor: pointer;
  padding: 9px 16px; font-size: 14px; background: var(--primary); color: #000;
}
.btn.ghost { background: #1c1c1c; color: var(--text); border: 1px solid #333; }
.btn.block { display: block; width: 100%; padding: 14px; font-size: 16px; margin-top: 6px; }
.btn:disabled { opacity: 0.5; cursor: default; }

/* Botón flotante crear */
.fab {
  position: absolute; right: 18px; bottom: 26px; z-index: 10;
  width: 60px; height: 60px; border-radius: 50%; border: none; cursor: pointer;
  background: var(--primary); color: #000; font-size: 32px; font-weight: 700;
  box-shadow: 0 6px 20px rgba(0,0,0,0.5);
}

/* Modales */
.modal-bg {
  position: fixed; inset: 0; z-index: 100; display: none;
  align-items: center; justify-content: center; padding: 18px;
  background: rgba(0,0,0,0.7);
}
.modal-bg.open { display: flex; }
.modal {
  background: var(--surface); border: 1px solid var(--border); border-radius: 18px;
  padding: 22px; width: 100%; max-width: 420px; max-height: 90vh; overflow-y: auto;
}
.modal h2 { margin: 0 0 4px; font-size: 22px; }
.modal .sub { color: var(--muted); font-size: 13px; margin: 0 0 16px; }
label { display: block; color: #ccc; font-size: 12px; font-weight: 700; margin: 12px 0 4px; text-transform: uppercase; letter-spacing: .04em; }
input, textarea, select {
  width: 100%; background: #0c0c0c; border: 1px solid #2a2a2a; border-radius: 10px;
  color: var(--text); padding: 12px; font-size: 15px; font-family: inherit;
}
textarea { min-height: 80px; resize: vertical; }
.row { display: flex; gap: 10px; }
.row > div { flex: 1; }
.err { color: #ff6b6b; font-size: 13px; margin-top: 10px; min-height: 18px; }
.muted-link { color: var(--purple); cursor: pointer; text-align: center; margin-top: 16px; font-weight: 700; font-size: 14px; }
.x { float: right; cursor: pointer; color: var(--muted); font-size: 22px; font-weight: 800; line-height: 1; }
.hint { color: var(--muted); font-size: 12px; margin-top: 4px; }
.check { display: flex; align-items: center; gap: 8px; margin-top: 14px; }
.check input { width: auto; }
.check label { margin: 0; text-transform: none; letter-spacing: 0; font-size: 14px; color: var(--text); }

/* Marcadores del mapa */
.evmark {
  width: 38px; height: 38px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 19px; border: 2px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,0.5);
  cursor: pointer;
}
.me-dot {
  width: 16px; height: 16px; border-radius: 50%;
  background: #2e9bff; border: 3px solid #fff; box-shadow: 0 0 0 4px rgba(46,155,255,0.3);
}
.maplibregl-popup-content {
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px;
}
.maplibregl-popup-tip { border-top-color: var(--surface) !important; border-bottom-color: var(--surface) !important; }
.pop-title { font-weight: 800; font-size: 15px; margin-bottom: 2px; }
.pop-when { color: var(--primary); font-weight: 700; font-size: 13px; }
.pop-meta { color: var(--muted); font-size: 12px; margin-top: 2px; }
.pop-desc { color: #ccc; font-size: 12px; margin-top: 6px; line-height: 1.4; }
.maplibregl-popup-close-button { color: var(--muted); font-size: 18px; }

/* Filtros plegables: contenedor que apila botones + paneles sin solaparse */
.filters {
  position: absolute; top: 56px; left: 0; right: 0; z-index: 9;
  display: flex; flex-direction: column; gap: 6px; padding: 4px 12px;
  pointer-events: none; /* nur die Chips/Buttons sind klickbar, nicht der Zwischenraum */
}
.filters > * { pointer-events: auto; }
.filter-toggles { display: flex; gap: 6px; }
.ftoggle {
  flex: 0 0 auto; display: flex; align-items: center; gap: 6px;
  background: rgba(17,17,17,0.92); color: var(--text);
  border: 1px solid #2c2c2c; border-radius: 999px; padding: 6px 13px;
  font-size: 13px; font-weight: 700; cursor: pointer; white-space: nowrap;
}
.ftoggle.active { border-color: var(--primary); color: var(--primary); }
.ftoggle-caret { color: var(--muted); font-size: 11px; transition: transform 0.15s; }
.ftoggle.open .ftoggle-caret { transform: rotate(180deg); }

/* Panel de chips (fecha o tipo): se muestra al desplegar */
.filterbar {
  display: flex; gap: 6px; overflow-x: auto;
  -ms-overflow-style: none; scrollbar-width: none;
}
.filterbar::-webkit-scrollbar { display: none; }
.fpanel[hidden] { display: none; }
.fchip, .tchip {
  flex: 0 0 auto; background: rgba(17,17,17,0.92); color: var(--muted);
  border: 1px solid #2c2c2c; border-radius: 999px; padding: 6px 13px;
  font-size: 13px; font-weight: 700; cursor: pointer; white-space: nowrap;
}
.fchip.on, .tchip.on { background: var(--primary); color: #000; border-color: var(--primary); }
.fchip-date { display: flex; align-items: center; gap: 4px; position: relative; }
.fchip-date input { width: 18px; opacity: 0; position: absolute; inset: 0; cursor: pointer; }

/* Barra inferior flotante (redondeada, centrada → deja libres las esquinas
   donde van el logo y la atribución de Mapbox) */
.tabbar {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(14px + env(safe-area-inset-bottom, 0)); z-index: 40;
  display: flex; align-items: center; gap: 2px;
  background: rgba(12,12,12,0.95); border: 1px solid var(--border);
  border-radius: 999px; padding: 4px 6px; box-shadow: 0 6px 24px rgba(0,0,0,0.55);
}
.tab {
  position: relative;
  flex: 0 0 auto; background: none; border: none; cursor: pointer; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  padding: 6px 13px; font-size: 10px; font-weight: 700; border-radius: 999px;
}
.tabbadge {
  position: absolute; top: 0; right: 6px; min-width: 17px; height: 17px;
  background: #ff3b3b; color: #fff; border-radius: 999px; border: 2px solid #0c0c0c;
  font-size: 10px; font-weight: 800; line-height: 13px; text-align: center; padding: 0 3px;
}
.tabbadge[hidden] { display: none; }
.tab .ico { font-size: 19px; }
.tab.active { color: var(--primary); }
.tab-add { padding: 4px 8px; }
.tab-add .ico {
  background: var(--primary); color: #000; width: 42px; height: 42px;
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 26px; box-shadow: 0 4px 14px rgba(0,0,0,0.5);
}

/* Hojas inferiores */
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
  background: var(--surface); border-top: 1px solid var(--border);
  border-radius: 18px 18px 0 0; transform: translateY(110%); transition: transform .25s ease;
  max-height: 72vh; display: flex; flex-direction: column;
  padding-bottom: calc(70px + env(safe-area-inset-bottom, 0));
}
.sheet.open { transform: translateY(0); }
.sheet-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px 10px; font-size: 17px;
}
.sheet-list { overflow-y: auto; padding: 0 12px 8px; }
.sheet-body { padding: 4px 18px 18px; overflow-y: auto; }

/* Tarjeta de evento en la lista */
.ev {
  display: flex; gap: 10px; align-items: center; cursor: pointer;
  background: #0d0d0d; border: 1px solid var(--border); border-radius: 12px;
  padding: 10px 12px; margin-bottom: 8px;
}
.ev-dot { width: 38px; height: 38px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 19px; flex-shrink: 0; }
.ev-info { flex: 1; min-width: 0; }
.ev-name { font-weight: 800; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev-when { color: var(--primary); font-weight: 700; font-size: 12px; margin-top: 1px; }
.ev-meta { color: var(--muted); font-size: 11px; margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev-arrow { color: var(--primary); font-size: 20px; font-weight: 800; }
.empty { color: var(--muted); text-align: center; padding: 30px 10px; }

/* Social: segmentos */
.seg { display: flex; gap: 6px; padding: 0 16px 8px; }
.segbtn {
  flex: 1; background: #0d0d0d; color: var(--muted); border: 1px solid var(--border);
  border-radius: 999px; padding: 8px; font-weight: 800; font-size: 13px; cursor: pointer;
}
.segbtn.on { background: var(--primary); color: #000; border-color: var(--primary); }

/* Social: filas (chat / amigo / búsqueda) */
.srow { display: flex; gap: 10px; align-items: center; padding: 9px 4px; border-bottom: 1px solid var(--border); }
.srow-av {
  width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0; object-fit: cover;
  background: #222; display: flex; align-items: center; justify-content: center; font-weight: 800; color: var(--primary);
}
.srow-info { flex: 1; min-width: 0; cursor: pointer; }
.srow-name { font-weight: 800; font-size: 14px; }
.srow-sub { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.srow-badge { background: var(--primary); color: #000; border-radius: 999px; font-size: 11px; font-weight: 800; padding: 1px 8px; }
.srow-btn { background: var(--primary); color: #000; border: none; border-radius: 999px; padding: 7px 14px; font-weight: 800; font-size: 12px; cursor: pointer; white-space: nowrap; }
.srow-btn.ghost { background: #1c1c1c; color: var(--text); border: 1px solid #333; }
.srow-btn:disabled { opacity: 0.5; }
.searchbox { width: 100%; margin: 4px 0 10px; }
.sub-head { color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; margin: 14px 0 4px; }

/* Conversación (DM) a pantalla casi completa */
.conv {
  position: fixed; inset: 0; z-index: 60; background: var(--bg);
  display: none; flex-direction: column;
}
.conv.open { display: flex; }
.conv-head {
  display: flex; align-items: center; gap: 6px; padding: 12px 14px;
  border-bottom: 1px solid var(--border); background: var(--surface);
}
.conv-back { background: none; border: none; color: var(--primary); font-size: 30px; line-height: 1; cursor: pointer; padding: 0 6px 0 0; }
.conv-head b { font-size: 16px; }
/* Melde-Button rechts in der Chat-Kopfzeile */
.conv-rep { margin-left: auto; background: none; border: none; font-size: 18px; line-height: 1; cursor: pointer; padding: 4px; opacity: 0.85; }
.conv-rep:hover { opacity: 1; }

/* Gründe-Auswahl im Melde-Dialog */
.rep-motivos { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 12px; }
.rep-mot {
  flex: 0 0 auto; background: rgba(17,17,17,0.92); color: var(--muted);
  border: 1px solid #2c2c2c; border-radius: 999px; padding: 7px 12px;
  font-size: 13px; font-weight: 700; cursor: pointer;
}
.rep-mot.on { background: var(--primary); color: #000; border-color: var(--primary); }
.conv-msgs { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.msg { max-width: 78%; padding: 9px 13px; border-radius: 16px; font-size: 14px; line-height: 1.35; word-break: break-word; }
.msg.them { align-self: flex-start; background: #1c1c1c; border-bottom-left-radius: 4px; }
.msg.me { align-self: flex-end; background: var(--primary); color: #000; border-bottom-right-radius: 4px; }
.msg-time { font-size: 10px; opacity: 0.6; margin-top: 2px; display: block; }
.conv-input {
  display: flex; gap: 8px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0));
  border-top: 1px solid var(--border); background: var(--surface);
}
.conv-input input { flex: 1; }
.conv-input .btn { padding: 0 18px; font-size: 18px; }

/* Ajustes */
.set-row { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--border); }
.set-account { color: var(--muted); font-size: 14px; padding: 14px 0; }
.set-account b { color: var(--text); }

/* Pista de ubicación elegida en crear */
.loc-pill {
  margin-top: 12px; font-size: 13px; color: var(--text);
  background: rgba(255,120,73,0.12); border: 1px solid var(--primary);
  border-radius: 10px; padding: 9px 12px;
}

.gate {
  position: fixed; inset: 0; z-index: 50; display: none;
  flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  background: #000; text-align: center; padding: 24px;
}
.gate.show { display: flex; }
.gate-text { color: var(--muted); max-width: 320px; line-height: 1.5; margin: 0 0 8px; font-size: 15px; }
.gate-dl { color: var(--primary); font-weight: 700; font-size: 14px; text-decoration: none; margin-top: 10px; border-bottom: 1px solid var(--primary); padding-bottom: 2px; }

.toast {
  position: fixed; bottom: 100px; left: 50%; transform: translateX(-50%);
  background: var(--primary); color: #000; font-weight: 800; padding: 12px 20px;
  border-radius: 999px; z-index: 200; opacity: 0; transition: opacity .25s; pointer-events: none;
  max-width: 90vw; text-align: center;
}
.toast.show { opacity: 1; }

/* Modal de bienvenida (cuenta en revisión) */
.welcome { text-align: center; }
.welcome-emoji { font-size: 54px; line-height: 1; margin-bottom: 6px; }
.welcome h2 {
  background: linear-gradient(90deg, var(--primary), var(--purple));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.welcome-steps {
  text-align: left; display: flex; flex-direction: column; gap: 8px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  padding: 14px 16px; margin: 4px 0 16px;
}
.welcome-step { font-size: 14px; color: var(--text); font-weight: 600; }

/* Detalle de evento */
.detail-body { flex: 1; overflow-y: auto; padding: 0 0 24px; }
.ev-hero { width: 100%; height: 200px; background-size: cover; background-position: center; background-color: var(--surface); }
.ev-d-head { display: flex; align-items: center; gap: 12px; padding: 16px 16px 6px; }
.ev-d-head .ev-dot { width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 22px; flex: 0 0 auto; }
.ev-d-name { font-size: 20px; font-weight: 800; }
.ev-d-type { color: var(--muted); font-size: 13px; }
.ev-d-row { padding: 5px 16px; font-size: 14px; color: var(--text); }
.ev-d-desc { padding: 10px 16px; font-size: 14px; line-height: 1.5; color: #ccc; white-space: pre-wrap; }
.ev-d-actions { display: flex; flex-wrap: wrap; gap: 8px; padding: 14px 16px 0; }
.ev-d-actions .btn { flex: 1 1 calc(50% - 4px); }
/* Secciones dinámicas del detalle (participar, presencia, valoraciones) */
.ev-sec { padding: 6px 16px 0; }
.ev-sec:empty { padding: 0; }
.ev-sec-h { font-size: 13px; font-weight: 800; color: var(--text); margin: 14px 0 6px; }
.ev-sec .srow { padding: 6px 0; }
.ev-sec .btn.block { margin-top: 8px; }
/* Valoraciones */
.val-stars { font-size: 26px; letter-spacing: 4px; margin: 8px 0; cursor: pointer; }
.val-star { color: #444; }
.val-star.on { color: var(--primary); }
.val-stars-ro { color: var(--primary); letter-spacing: 2px; }
.val-item { padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.val-com-txt { color: #ccc; margin-top: 3px; }
.msg-author { display: block; font-size: 11px; color: var(--primary); margin-bottom: 2px; }

/* Einladung zum Event (hervorgehoben) */
.ev-invite {
  margin: 12px 16px 0; padding: 12px 14px; border-radius: 12px;
  background: rgba(255,120,73,0.12); border: 1px solid var(--primary); color: #ffd9c7;
  font-size: 14px; font-weight: 700;
}
.ev-invite-actions { display: flex; gap: 8px; margin-top: 10px; }
.ev-invite-actions .btn { flex: 1; }
/* Resaltado en la lista cuando te han invitado */
.ev-invited { border: 1px solid var(--primary); background: rgba(255,120,73,0.07); }
.ev-invbadge { display: inline-block; margin-top: 4px; font-size: 11px; font-weight: 800; color: var(--primary); }

/* Statistik-Panel (Besuche) */
.stat-cards { display: flex; gap: 8px; margin-bottom: 12px; }
.stat-card { flex: 1; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px; text-align: center; }
.stat-card b { display: block; font-size: 26px; color: var(--primary); }
.stat-card small { color: var(--muted); font-size: 11px; }
.stat-h { font-size: 13px; font-weight: 800; margin: 14px 0 6px; color: var(--text); }
.stat-h small { font-weight: 600; color: var(--muted); }
.stat-row { display: flex; align-items: center; gap: 8px; padding: 4px 0; font-size: 13px; }
.stat-day { width: 56px; color: var(--muted); flex: 0 0 auto; }
.stat-src { flex: 1; color: var(--text); }
.stat-bar { flex: 1; height: 10px; background: var(--surface); border-radius: 999px; overflow: hidden; }
.stat-fill { display: block; height: 100%; background: var(--primary); }
.stat-num { width: 64px; text-align: right; font-weight: 700; flex: 0 0 auto; }
.stat-num small { color: var(--muted); font-weight: 500; margin-left: 2px; }
