/* ==========================================================================
   mapchat.at – App-Styles (mobile first)
   Farben/Schrift kommen als CSS-Variablen aus dem Admin-Portal (theme_head()).
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; height: 100%; }
body {
  margin: 0; min-height: 100%;
  font-family: var(--font); font-size: 16px; line-height: 1.45;
  background: var(--bg); color: var(--text);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
img, video, svg { max-width: 100%; }
a { color: var(--accent); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; }
button, input, textarea, select { font: inherit; color: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.ic { width: 22px; height: 22px; flex: none; }
.ic.big { width: 56px; height: 56px; opacity: .5; }
.ic.flip { transform: rotate(180deg); }
.gsvg { display: block; width: 100%; height: 100%; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  padding: .75em 1.25em; border: 0; border-radius: calc(var(--radius) * .75);
  font-weight: 700; text-decoration: none; cursor: pointer;
  background: var(--surface); color: var(--text);
  transition: transform .1s, filter .15s, opacity .15s;
  touch-action: manipulation;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .6; pointer-events: none; }
.btn.primary { background: linear-gradient(135deg, var(--primary), color-mix(in srgb, var(--primary) 70%, var(--accent))); color: var(--on-primary); box-shadow: 0 8px 24px -8px var(--primary); }
.btn.ghost { background: transparent; border: 1.5px solid var(--line); }
.btn.danger { color: #ef4444; border-color: rgba(239, 68, 68, .4); }
.btn.big { width: 100%; padding: 1em 1.25em; font-size: 1.05rem; }
.btn.small { padding: .4em .9em; font-size: .85rem; }
.btn.loading { position: relative; color: transparent !important; }
.btn.loading::after { content: ""; position: absolute; width: 22px; height: 22px; border: 3px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.link { background: none; border: 0; color: var(--accent); text-decoration: underline; cursor: pointer; padding: 0; }

.icon-btn {
  display: inline-grid; place-items: center; position: relative;
  width: 44px; height: 44px; border: 0; border-radius: 50%;
  background: transparent; color: var(--text); cursor: pointer; flex: none;
  text-decoration: none;
}
.icon-btn:active { background: var(--line); }
.round-btn {
  display: grid; place-items: center; position: relative;
  width: 48px; height: 48px; border-radius: 50%; border: 0;
  background: var(--surface); color: var(--text); cursor: pointer;
  box-shadow: 0 6px 20px rgba(0,0,0,.25); text-decoration: none;
}
.badge {
  position: absolute; top: -2px; right: -2px; min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: 10px; background: #ef4444; color: #fff; font-size: 12px; font-weight: 800;
  display: grid; place-items: center; line-height: 1; border: 2px solid var(--surface);
}

/* ---------- Karten / Formulare ---------- */
.card {
  background: var(--surface); border-radius: var(--radius);
  padding: 20px; box-shadow: 0 10px 30px -12px rgba(0,0,0,.35);
}
.card h2 { font-size: 1.15rem; }
.form { display: grid; gap: 16px; }
.field { display: grid; gap: 6px; border: 0; padding: 0; margin: 0; min-width: 0; }
.field > span, .field > legend { font-weight: 700; font-size: .9rem; padding: 0; }
input[type=text], input[type=number], input[type=password], textarea, select {
  width: 100%; padding: 14px 16px; border-radius: calc(var(--radius) * .7);
  border: 1.5px solid var(--line); background: var(--bg); color: var(--text);
  font-size: 16px; /* verhindert Zoom auf iOS */
  outline: none; transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; }
input:focus, textarea:focus, select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 30%, transparent); }
.invalid, .invalid:focus { border-color: #ef4444 !important; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: .85rem; color: var(--muted); }
.check input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--primary); flex: none; }
.alert { padding: 12px 14px; border-radius: calc(var(--radius) * .6); margin: 12px 0; font-size: .92rem; }
.alert.error { background: rgba(239, 68, 68, .15); color: var(--text); border: 1px solid rgba(239, 68, 68, .35); }
.alert.ok { background: rgba(34, 197, 94, .15); color: var(--text); border: 1px solid rgba(34, 197, 94, .35); }
.row2 { display: grid; grid-template-columns: 1fr 96px; gap: 12px; }

/* Geschlecht wählen */
.gender-pick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; border-radius: var(--radius); }
.gender-pick.invalid { outline: 2px solid #ef4444; outline-offset: 3px; }
.gp {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 16px 8px; border-radius: var(--radius); cursor: pointer;
  border: 2px solid var(--line); background: var(--bg); transition: all .15s;
}
.gp input { position: absolute; opacity: 0; pointer-events: none; }
.gp svg { width: 52px; height: 52px; filter: grayscale(.6); opacity: .7; transition: all .15s; }
.gp span { font-weight: 700; }
.gp.m:has(input:checked) { border-color: var(--male); background: color-mix(in srgb, var(--male) 15%, var(--bg)); }
.gp.w:has(input:checked) { border-color: var(--female); background: color-mix(in srgb, var(--female) 15%, var(--bg)); }
.gp.d:has(input:checked) { border-color: var(--diverse); background: color-mix(in srgb, var(--diverse) 15%, var(--bg)); }
.gp:has(input:checked) svg { filter: none; opacity: 1; transform: scale(1.08); }
.gp:has(input:focus-visible) { box-shadow: 0 0 0 3px var(--primary); }

/* Chips (Sucht nach) */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span {
  display: inline-block; padding: 8px 14px; border-radius: 999px; cursor: pointer;
  border: 1.5px solid var(--line); font-size: .9rem; font-weight: 600; transition: all .15s;
}
.chip input:checked + span { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.chip input:focus-visible + span { box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 40%, transparent); }

.seg { display: grid; grid-template-columns: 1fr 1fr; background: var(--bg); padding: 4px; border-radius: calc(var(--radius) * .75); }
.seg input { position: absolute; opacity: 0; }
.seg span { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 10px; border-radius: calc(var(--radius) * .6); cursor: pointer; font-weight: 700; color: var(--muted); }
.seg input:checked + span { background: var(--surface); color: var(--text); box-shadow: 0 2px 8px rgba(0,0,0,.2); }
.seg .ic { width: 18px; height: 18px; }

.readonly { display: flex; align-items: center; gap: 10px; color: var(--muted); }
.readonly svg { width: 28px; height: 28px; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); z-index: 9999;
  transform: translate(-50%, 20px); opacity: 0; transition: all .25s;
  background: #111827; color: #fff; padding: 12px 18px; border-radius: 12px;
  max-width: calc(100% - 32px); box-shadow: 0 10px 30px rgba(0,0,0,.4); font-weight: 600; font-size: .92rem;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }
.toast.error { background: #b91c1c; }
.toast.warn { background: #b45309; }

/* Fortschrittsbalken */
.progress { height: 4px; background: var(--line); border-radius: 2px; overflow: hidden; margin-top: 6px; }
.progress span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .15s; }

/* ==========================================================================
   Startseite
   ========================================================================== */
.landing { max-width: 560px; margin: 0 auto; padding: 0 16px calc(24px + env(safe-area-inset-bottom)); }
.landing-top { padding: calc(14px + env(safe-area-inset-top)) 0 10px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.2rem; letter-spacing: -.01em; }
.brand img { border-radius: 9px; }

.hero { margin-top: 6px; }
.hero-map {
  position: relative; height: 290px; border-radius: calc(var(--radius) * 1.5); overflow: hidden;
  box-shadow: 0 20px 50px -20px color-mix(in srgb, var(--primary) 70%, transparent), inset 0 0 0 1px var(--line);
}
.hero-roads { position: absolute; inset: 0; width: 100%; height: 100%; }
.hm-land { fill: var(--map-land, #e4e4e9); }
.hm-park { fill: var(--map-park, #95d67e); }
.hm-water { fill: var(--map-water, #9fd1f6); }
.hm-road { stroke: var(--map-road, #fff); stroke-width: 6; fill: none; }
.hm-road.big { stroke: var(--map-road, #fff); stroke-width: 10; }
.hero-me { position: absolute; left: 50%; top: 54%; width: 22px; height: 22px; transform: translate(-50%, -50%); }
.hero-me span, .hero-me::before {
  position: absolute; inset: 0; border-radius: 50%; content: "";
}
.hero-me span { background: var(--accent); border: 4px solid #fff; box-shadow: 0 2px 8px rgba(0,0,0,.3); z-index: 1; }
.hero-me::before { background: var(--accent); animation: pulse 2s ease-out infinite; }
@keyframes pulse { 0% { transform: scale(1); opacity: .6; } 100% { transform: scale(5); opacity: 0; } }

.hero-pin { position: absolute; width: 42px; height: 42px; animation: bob 3s ease-in-out infinite; filter: drop-shadow(0 4px 6px rgba(0,0,0,.3)); }
.hero-pin.p1 { left: 16%; top: 22%; }
.hero-pin.p2 { left: 66%; top: 66%; animation-delay: -1s; }
.hero-pin.p3 { left: 72%; top: 18%; animation-delay: -2s; }
.hero-pin.p4 { left: 24%; top: 70%; animation-delay: -.5s; }
.hero-pin.p5 { left: 46%; top: 82%; width: 34px; height: 34px; animation: none; opacity: .85; }
@keyframes bob { 50% { transform: translateY(-6px); } }
.bubble {
  position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-20%);
  white-space: nowrap; background: #fff; color: #111827; font-size: .8rem; font-weight: 700;
  padding: 7px 11px; border-radius: 14px 14px 14px 4px; box-shadow: 0 6px 16px rgba(0,0,0,.2);
  animation: pop 4s ease-in-out infinite;
}
.bubble.right { left: auto; right: 50%; transform: translateX(20%); border-radius: 14px 14px 4px 14px; animation-delay: -2s; }
.bubble.below { bottom: auto; top: calc(100% + 8px); border-radius: 4px 14px 14px 14px; }
@keyframes pop { 0%, 10% { opacity: 0; scale: .8; } 20%, 80% { opacity: 1; scale: 1; } 90%, 100% { opacity: 0; scale: .8; } }

.hero-text { padding: 22px 4px 10px; }
.hero-text h1 { font-size: clamp(1.7rem, 7vw, 2.3rem); font-weight: 800; letter-spacing: -.02em; }
.grad { background: linear-gradient(90deg, var(--primary), var(--accent)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero-text p { color: var(--muted); margin: 0 0 14px; }
.hero-points { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.hero-points li { display: flex; align-items: center; gap: 12px; font-weight: 600; font-size: .95rem; }
.hero-points .ic { color: var(--accent); width: 34px; height: 34px; padding: 7px; border-radius: 10px; background: color-mix(in srgb, var(--accent) 15%, transparent); }

.join { margin-top: 18px; scroll-margin-top: 16px; }
.join h2 { font-size: 1.4rem; }
.landing-foot { text-align: center; color: var(--muted); font-size: .8rem; padding-top: 20px; }

/* ==========================================================================
   Standortfreigabe
   ========================================================================== */
.center-screen { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.locate-card { max-width: 440px; width: 100%; text-align: center; display: grid; gap: 14px; justify-items: center; }
.locate-card p { color: var(--muted); margin: 0; }
.locate-anim { position: relative; width: 140px; height: 140px; display: grid; place-items: center; margin: 6px 0; }
.locate-anim .ring { position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--accent); animation: ring 2.4s ease-out infinite; opacity: 0; }
.locate-anim .r2 { animation-delay: .8s; } .locate-anim .r3 { animation-delay: 1.6s; }
@keyframes ring { 0% { transform: scale(.3); opacity: .9; } 100% { transform: scale(1); opacity: 0; } }
.locate-pin { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; background: linear-gradient(135deg, var(--primary), var(--accent)); color: #fff; box-shadow: 0 10px 30px -6px var(--primary); }
.locate-pin .ic { width: 32px; height: 32px; }
.help { text-align: left; font-size: .9rem; background: var(--bg); padding: 14px; border-radius: calc(var(--radius) * .7); }
.help h3 { font-size: 1rem; }
.help ul { padding-left: 18px; margin: 0 0 12px; display: grid; gap: 8px; }

/* ==========================================================================
   Karte
   ========================================================================== */
.page-map { overflow: hidden; height: 100%; }
#map { position: fixed; inset: 0; z-index: 0; background: var(--map-land, #e4e4e9); }
.leaflet-container { font-family: var(--font); }
.map-top {
  position: fixed; z-index: 500; left: 0; right: 0; top: 0;
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: calc(10px + env(safe-area-inset-top)) 12px 10px;
  pointer-events: none;
}
.map-top > * { pointer-events: auto; }
.brand-chip {
  display: flex; align-items: center; gap: 8px; padding: 6px 14px 6px 6px; border-radius: 999px;
  background: var(--surface); color: var(--text); text-decoration: none; font-weight: 800;
  box-shadow: 0 6px 20px rgba(0,0,0,.25);
}
.brand-chip img { border-radius: 50%; }
.map-actions { display: flex; gap: 10px; }
.map-status {
  position: fixed; z-index: 500; left: 50%; transform: translateX(-50%);
  top: calc(70px + env(safe-area-inset-top));
  display: flex; align-items: center; gap: 8px; white-space: nowrap; max-width: calc(100% - 24px);
  background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(8px);
  padding: 6px 14px; border-radius: 999px; font-size: .82rem; font-weight: 700;
  box-shadow: 0 4px 14px rgba(0,0,0,.2);
}
.map-status .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--offline); }
.map-status.live .dot { background: #22c55e; box-shadow: 0 0 0 0 #22c55e; animation: live 1.6s infinite; }
@keyframes live { 70% { box-shadow: 0 0 0 8px rgba(34,197,94,0); } 100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); } }
.fab-locate { position: fixed; z-index: 500; right: 14px; bottom: calc(28px + env(safe-area-inset-bottom)); width: 54px; height: 54px; color: var(--accent); }
.leaflet-bottom.leaflet-right .leaflet-control-attribution { margin-bottom: env(safe-area-inset-bottom); font-size: 10px; }

/* eigener Standort */
.me-marker { position: relative; }
.me-marker .core { position: absolute; inset: 3px; border-radius: 50%; background: var(--accent); border: 3px solid #fff; box-shadow: 0 2px 8px rgba(0,0,0,.35); }
.me-marker .pulse { position: absolute; inset: 0; border-radius: 50%; background: var(--accent); animation: pulse 2s ease-out infinite; }
.acc-circle { fill: var(--accent); fill-opacity: .08; stroke: var(--accent); stroke-opacity: .3; stroke-width: 1; }

/* andere Personen */
.pm-wrap { background: none; border: 0; }
.person-marker {
  position: relative; width: var(--s); height: var(--s); cursor: pointer;
  filter: drop-shadow(0 3px 5px rgba(0,0,0,.35)); transition: transform .15s;
  animation: appear .35s ease-out;
}
@keyframes appear { from { transform: scale(0); } to { transform: scale(1); } }
.person-marker:hover { transform: scale(1.12); }
.person-marker img { width: 100%; height: 100%; object-fit: contain; display: block; }
.person-marker img.av { object-fit: cover; border-radius: 50%; border: 3px solid var(--male); }
.person-marker.w img.av { border-color: var(--female); }
.person-marker .sym, .person-marker .emo {
  display: grid; place-items: center; width: 100%; height: 100%; border-radius: 50%;
  border: 3px solid #fff; color: #fff; font-weight: 800; font-size: calc(var(--s) * .55); line-height: 1;
  background: var(--male);
}
.person-marker.w .sym, .person-marker.w .emo { background: var(--female); }
.person-marker.d .sym, .person-marker.d .emo { background: var(--diverse); }
.person-marker.d img.av { border-color: var(--diverse); }
.person-marker .emo { font-size: calc(var(--s) * .55); }
.person-marker.off { opacity: .85; }
.person-marker.off .sym, .person-marker.off .emo { background: var(--offline); }
.person-marker.off img, .person-marker.off .emo { filter: grayscale(1); }
.person-marker.off img.av { border-color: var(--offline); }
.person-marker .on {
  position: absolute; right: 0; bottom: 0; width: 28%; height: 28%; min-width: 10px; min-height: 10px;
  border-radius: 50%; background: #22c55e; border: 2px solid #fff;
}

/* Profil-Popup (Bottom-Sheet) */
.sheet-backdrop { position: fixed; inset: 0; z-index: 900; background: rgba(0,0,0,.35); opacity: 0; transition: opacity .25s; }
.sheet-backdrop.open { opacity: 1; }
.sheet {
  position: fixed; z-index: 1000; left: 0; right: 0; bottom: 0;
  max-width: 520px; margin: 0 auto;
  background: var(--surface); border-radius: calc(var(--radius) * 1.4) calc(var(--radius) * 1.4) 0 0;
  padding: 10px 18px calc(18px + env(safe-area-inset-bottom));
  box-shadow: 0 -10px 40px rgba(0,0,0,.35);
  transform: translateY(100%); transition: transform .25s cubic-bezier(.2,.8,.2,1);
  max-height: 85vh; overflow-y: auto;
}
.sheet.open { transform: translateY(0); }
.sheet-handle { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 12px; }
.sheet-close { position: absolute; right: 10px; top: 10px; width: 38px; height: 38px; border-radius: 50%; border: 0; background: var(--bg); color: var(--text); display: grid; place-items: center; cursor: pointer; }
.sheet-close .ic { width: 18px; height: 18px; }
.sheet-offline {
  display: flex; gap: 10px; align-items: flex-start;
  background: color-mix(in srgb, var(--offline) 18%, transparent); color: var(--text);
  border: 1px solid color-mix(in srgb, var(--offline) 40%, transparent);
  padding: 10px 12px; border-radius: calc(var(--radius) * .6); font-size: .88rem; margin: 6px 40px 14px 0;
}
.sheet-offline .ic { width: 20px; height: 20px; color: var(--offline); }
.sheet-head { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; padding-right: 40px; }
.sheet-avatar { width: 84px; height: 84px; border-radius: 50%; overflow: hidden; flex: none; background: var(--bg); box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--primary); }
.sheet-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sheet-avatar.off { box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--offline); }
.sheet-avatar.off img { filter: grayscale(1); }
.sheet-head h2 { font-size: 1.35rem; margin: 0 0 4px; word-break: break-word; }
.sheet-sub { color: var(--muted); font-size: .9rem; display: flex; align-items: center; gap: 6px; }
.status { width: 9px; height: 9px; border-radius: 50%; background: var(--offline); display: inline-block; }
.status.on { background: #22c55e; }
.sheet-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0 0 16px; }
.sheet-facts > div { background: var(--bg); border-radius: calc(var(--radius) * .6); padding: 9px 12px; }
.sheet-facts .wide { grid-column: 1 / -1; }
.sheet-facts dt { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; }
.sheet-facts dd { margin: 2px 0 0; font-weight: 700; word-break: break-word; }
.sheet.is-off .btn.primary { background: var(--offline); box-shadow: none; color: #fff; }

/* ==========================================================================
   Kopfzeile (Unterseiten)
   ========================================================================== */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 6px;
  padding: calc(6px + env(safe-area-inset-top)) 8px 6px;
  background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar h1 { flex: 1; font-size: 1.15rem; margin: 0; text-align: center; }

/* Chat-Liste */
.list-wrap { max-width: 640px; margin: 0 auto; padding: 8px 0 24px; }
.conv-list { list-style: none; margin: 0; padding: 0; }
.conv { display: flex; align-items: center; gap: 12px; padding: 12px 16px; text-decoration: none; color: var(--text); border-bottom: 1px solid var(--line); }
.conv:active { background: var(--surface); }
.conv-av { position: relative; width: 52px; height: 52px; flex: none; border-radius: 50%; }
.conv-av img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; }
.conv-av.sm { width: 40px; height: 40px; }
.conv-av.off img, .conv-av.off svg { filter: grayscale(1); opacity: .8; }
.conv-av .on { position: absolute; right: 1px; bottom: 1px; width: 13px; height: 13px; border-radius: 50%; background: #22c55e; border: 2px solid var(--bg); }
.conv-main { flex: 1; min-width: 0; }
.conv-top { display: flex; justify-content: space-between; gap: 8px; }
.conv-top small { color: var(--muted); flex: none; }
.conv-prev { display: block; color: var(--muted); font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv.unread .conv-prev { color: var(--text); font-weight: 700; }
.conv .badge { position: static; border: 0; }
.skeleton { height: 76px; margin: 0 16px; border-bottom: 1px solid var(--line); background: linear-gradient(90deg, transparent, var(--line), transparent); background-size: 200% 100%; animation: sk 1.2s infinite; }
@keyframes sk { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.empty { text-align: center; padding: 60px 24px; display: grid; justify-items: center; gap: 4px; }
.empty p { margin: 0; }
.empty .btn { margin-top: 16px; }

/* ==========================================================================
   Chat
   ========================================================================== */
.page-chat { height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
.chat-top { flex: none; }
.chat-who { flex: 1; display: flex; align-items: center; gap: 10px; min-width: 0; }
.chat-who-txt { display: grid; min-width: 0; }
.chat-who-txt b, .chat-who-txt small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-who-txt small { color: var(--muted); font-size: .78rem; }
.menu-wrap { position: relative; }
.menu {
  position: absolute; right: 4px; top: 48px; min-width: 220px; z-index: 60;
  background: var(--surface); border-radius: calc(var(--radius) * .7); padding: 6px;
  box-shadow: 0 12px 40px rgba(0,0,0,.4); border: 1px solid var(--line);
}
.menu a, .menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 12px; border: 0; background: none; color: var(--text); text-decoration: none; border-radius: 10px; cursor: pointer; text-align: left; font-weight: 600; }
.menu a:active, .menu button:active { background: var(--line); }
.chat-note { flex: none; display: flex; gap: 8px; align-items: center; padding: 8px 14px; font-size: .82rem; background: color-mix(in srgb, var(--offline) 18%, var(--bg)); color: var(--muted); }
.chat-note .ic { width: 16px; height: 16px; }

.chat-scroll { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 12px 10px; overscroll-behavior: contain; display: flex; flex-direction: column; }
#btn-older { align-self: center; margin-bottom: 10px; }
.chat-msgs { display: flex; flex-direction: column; gap: 4px; margin-top: auto; }
.day { align-self: center; font-size: .75rem; font-weight: 700; color: var(--muted); background: var(--surface); padding: 4px 12px; border-radius: 999px; margin: 10px 0 6px; }
.msg {
  max-width: 80%; padding: 8px 12px 6px; border-radius: 18px; position: relative;
  word-wrap: break-word; overflow-wrap: anywhere; animation: msgin .2s ease-out;
}
@keyframes msgin { from { opacity: 0; transform: translateY(6px); } }
.msg.them { align-self: flex-start; background: var(--surface); border-bottom-left-radius: 6px; }
.msg.me { align-self: flex-end; background: var(--primary); color: var(--on-primary); border-bottom-right-radius: 6px; }
.msg.me a { color: inherit; }
.msg.has-media { padding: 4px 4px 6px; }
.msg.has-media .txt { padding: 4px 8px 0; }
.msg img, .msg video { display: block; border-radius: 14px; max-width: 100%; max-height: 360px; width: auto; background: rgba(0,0,0,.2); }
.msg img { cursor: zoom-in; min-height: 80px; min-width: 80px; object-fit: cover; }
.msg video { width: 260px; max-width: 100%; }
.txt.big-emoji { font-size: 2.4rem; line-height: 1.15; }
.meta { font-size: .68rem; opacity: .7; text-align: right; margin-top: 2px; display: flex; justify-content: flex-end; gap: 4px; padding: 0 4px; }
.ticks { letter-spacing: -3px; padding-right: 3px; }
.ticks.read { color: var(--accent); opacity: 1; font-weight: 800; }
.msg.me .ticks.read { color: #a5f3fc; }
.chat-empty { text-align: center; margin: auto; padding: 40px 20px; color: var(--muted); }
.chat-empty p { margin: 4px 0; }
.wave { font-size: 3rem; animation: wave 2s ease-in-out infinite; transform-origin: 70% 70%; display: inline-block; }
@keyframes wave { 0%, 60%, 100% { transform: rotate(0); } 10%, 30% { transform: rotate(14deg); } 20% { transform: rotate(-8deg); } 40% { transform: rotate(-4deg); } 50% { transform: rotate(10deg); } }

.composer { flex: none; background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); position: relative; }
.composer-row { display: flex; align-items: flex-end; gap: 2px; padding: 8px 8px; }
.composer-row .icon-btn { width: 40px; height: 44px; color: var(--muted); cursor: pointer; }
.composer-row textarea {
  flex: 1; min-height: 44px; max-height: 120px; resize: none; padding: 11px 14px; margin: 0 4px;
  border-radius: 22px; line-height: 1.3; overflow-y: auto;
}
.send-btn { width: 44px; height: 44px; flex: none; border-radius: 50%; border: 0; display: grid; place-items: center; background: var(--primary); color: var(--on-primary); cursor: pointer; }
.send-btn:disabled { opacity: .5; }
.send-btn .ic { width: 20px; height: 20px; margin-left: -2px; }
.blocked-bar { padding: 14px; text-align: center; color: var(--muted); font-size: .9rem; }

.emoji-panel { border-bottom: 1px solid var(--line); }
.emoji-tabs { display: flex; gap: 2px; padding: 6px 8px 0; overflow-x: auto; }
.emoji-tabs button { border: 0; background: none; font-size: 1.3rem; padding: 6px 10px; border-radius: 10px 10px 0 0; cursor: pointer; opacity: .55; }
.emoji-tabs button.on { opacity: 1; background: var(--bg); }
.emoji-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(42px, 1fr)); height: 220px; overflow-y: auto; padding: 6px; background: var(--bg); }
.emo-btn { border: 0; background: none; font-size: 1.6rem; height: 44px; border-radius: 10px; cursor: pointer; padding: 0; }
.emo-btn:active { background: var(--line); transform: scale(1.2); }

.camera-menu { display: grid; padding: 6px; gap: 2px; border-bottom: 1px solid var(--line); }
.camera-menu label { display: flex; gap: 10px; align-items: center; padding: 14px; border-radius: 12px; cursor: pointer; font-weight: 700; }
.camera-menu label:active { background: var(--line); }

.attach-preview { display: flex; gap: 12px; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.ap-media { width: 64px; height: 64px; border-radius: 12px; overflow: hidden; flex: none; background: var(--bg); }
.ap-media img, .ap-media video { width: 100%; height: 100%; object-fit: cover; display: block; }
.ap-info { flex: 1; font-weight: 700; font-size: .9rem; }

.lightbox { position: fixed; inset: 0; z-index: 2000; background: rgba(0,0,0,.92); display: grid; place-items: center; padding: 16px; }
.lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; }
.lightbox .icon-btn { position: absolute; right: 12px; top: calc(12px + env(safe-area-inset-top)); color: #fff; background: rgba(255,255,255,.15); }

/* ==========================================================================
   Einstellungen
   ========================================================================== */
.settings { max-width: 640px; margin: 0 auto; padding: 16px 16px calc(32px + env(safe-area-inset-bottom)); display: grid; gap: 16px; }
.avatar-edit { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.avatar-big { position: relative; width: 120px; height: 120px; border-radius: 50%; overflow: hidden; flex: none; box-shadow: 0 0 0 4px var(--primary); }
.avatar-big img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar-big .progress { position: absolute; left: 12px; right: 12px; bottom: 50%; height: 6px; }
.avatar-btns { display: grid; gap: 8px; flex: 1; min-width: 180px; }
.avatar-btns .btn { cursor: pointer; }

@media (min-width: 900px) {
  .landing { max-width: 1080px; display: grid; grid-template-columns: 1.2fr 1fr; gap: 0 40px; align-items: start; }
  .landing-top, .landing-foot { grid-column: 1 / -1; }
  .hero-map { height: 380px; }
  .join { margin-top: 6px; position: sticky; top: 20px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Abmelden / Profil fortsetzen ---------- */
.login-user { max-width: 420px; width: 100%; display: grid; gap: 12px; }
.login-user h1 { font-size: 1.5rem; margin: 6px 0 0; }
.login-user p { margin: 0; }
.login-user .brand { color: var(--text); text-decoration: none; }
.pin-input { letter-spacing: .5em; font-size: 1.4rem !important; text-align: center; font-variant-numeric: tabular-nums; }
.pin-fields { display: grid; gap: 14px; }
.big-check { font-size: .95rem; color: var(--text); font-weight: 600; }
.nick { color: var(--text); }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; }
.center { text-align: center; }
.legal-links { text-align: center; color: var(--muted); padding: 4px 0 8px; }
.legal-links a { color: var(--muted); }

/* ==========================================================================
   Öffentliche Seiten: SEO-Inhalte, Rechtliches, Städte
   ========================================================================== */
.landing-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.landing-top .brand { color: var(--text); text-decoration: none; }
.join-login { margin: 14px 0 0; }
.full { grid-column: 1 / -1; }
.seo-block { margin-top: 40px; }
.seo-block h2 { font-size: 1.45rem; letter-spacing: -.01em; }
.steps { list-style: none; padding: 0; margin: 16px 0 0; display: grid; gap: 12px; }
.steps li { background: var(--surface); border-radius: var(--radius); padding: 18px; position: relative; }
.steps h3 { font-size: 1.05rem; margin: 8px 0 4px; }
.steps p, .features p { margin: 0; color: var(--muted); font-size: .95rem; }
.step-n { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: linear-gradient(135deg, var(--primary), var(--accent)); color: #fff; font-weight: 800; }
.features { display: grid; gap: 12px; margin-top: 16px; }
.features article { background: var(--surface); border-radius: var(--radius); padding: 18px; }
.features .ic { color: var(--accent); width: 28px; height: 28px; }
.features h3 { font-size: 1.05rem; margin: 10px 0 4px; }
.city-links { list-style: none; padding: 0; margin: 14px 0 0; display: flex; flex-wrap: wrap; gap: 8px; }
.city-links a { display: inline-block; padding: 9px 14px; border-radius: 999px; background: var(--surface); color: var(--text); text-decoration: none; font-weight: 600; font-size: .9rem; border: 1px solid var(--line); }
.city-links a:hover { border-color: var(--primary); }
.faq { display: grid; gap: 8px; margin: 16px 0 24px; }
.faq details { background: var(--surface); border-radius: calc(var(--radius) * .75); padding: 0 16px; }
.faq summary { cursor: pointer; font-weight: 700; padding: 14px 0; list-style: none; display: flex; justify-content: space-between; gap: 10px; }
.faq summary::after { content: "+"; font-size: 1.3rem; line-height: 1; color: var(--accent); }
.faq details[open] summary::after { content: "–"; }
.faq summary::-webkit-details-marker { display: none; }
.faq details p { margin: 0 0 14px; color: var(--muted); }
.site-foot { max-width: 1080px; margin: 40px auto 0; padding: 24px 16px calc(24px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); text-align: center; color: var(--muted); font-size: .85rem; }
.site-foot nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 18px; margin-bottom: 8px; }
.site-foot a { color: var(--muted); text-decoration: none; }
.site-foot a:hover { color: var(--text); text-decoration: underline; }
.crumbs { color: var(--muted); margin: 6px 0 12px; }
.crumbs a { color: var(--muted); }
.lead { font-size: 1.08rem; color: var(--muted); }
.city h1 { font-size: clamp(1.6rem, 6.5vw, 2.4rem); letter-spacing: -.02em; margin-top: 6px; }
.city-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 18px 0; }
.city-stats div { background: var(--surface); border-radius: var(--radius); padding: 16px; text-align: center; }
.city-stats b { display: block; font-size: 2rem; color: #22c55e; }
.city-stats span { color: var(--muted); font-size: .85rem; font-weight: 600; }
.cta { max-width: 420px; margin: 8px auto 0; }

.legal-top { max-width: 820px; margin: 0 auto; padding: calc(14px + env(safe-area-inset-top)) 16px 4px; display: flex; justify-content: space-between; align-items: center; }
.legal-top .brand { color: var(--text); text-decoration: none; }
.legal { max-width: 820px; margin: 0 auto; padding: 0 16px; }
.legal h1 { font-size: clamp(1.6rem, 6vw, 2.2rem); }
.legal h2 { font-size: 1.2rem; margin-top: 28px; }
.legal p, .legal li { color: color-mix(in srgb, var(--text) 88%, transparent); }
.legal ul { padding-left: 20px; display: grid; gap: 6px; }
.legal-dl { display: grid; grid-template-columns: minmax(140px, 220px) 1fr; gap: 6px 16px; }
.legal-dl dt { font-weight: 700; color: var(--muted); }
.legal-dl dd { margin: 0; }
.toc { background: var(--surface); border-radius: var(--radius); padding: 14px 18px; }
.toc ol { margin: 0; padding-left: 20px; columns: 2; column-gap: 24px; }
.toc a { color: var(--text); }
mark.missing { background: rgba(239, 68, 68, .2); color: #ef4444; padding: 0 4px; border-radius: 4px; font-weight: 700; }
@media (max-width: 560px) { .toc ol { columns: 1; } .legal-dl { grid-template-columns: 1fr; } .legal-dl dd { margin-bottom: 8px; } }
@media (min-width: 700px) {
  .steps { grid-template-columns: repeat(3, 1fr); }
  .features { grid-template-columns: repeat(2, 1fr); }
}

/* Dunkler OSM-Stil: Standardkarte per Filter abgedunkelt (kein Fremdanbieter nötig) */
.leaflet-tile-pane .tiles-dark { filter: invert(1) hue-rotate(180deg) brightness(.95) contrast(.9) saturate(.6); }
