/* ============================================================
   DerAdel App – Apple-Stil. Tokens wie Landing: Ink · Grau · Gold · Nachtblau
   ============================================================ */
:root {
  --ink: #1d1d1f; --ink-soft: #6e6e73; --ink-faint: #a1a1a6;
  --bg: #f5f5f7; --card: #ffffff; --line: rgba(0,0,0,.08); --line-strong: rgba(0,0,0,.14);
  --gold: #b8933f; --gold-soft: #d8bc77; --gold-bg: rgba(184,147,63,.10);
  --night: #14192b; --night-2: #1c2340;
  --accent: #b8933f;
  --ok: #2e9e5b; --danger: #d92d3a; --warn: #e8a317; --info: #2f6fed; --violet: #7369e4;
  --radius: 22px; --radius-s: 14px; --maxw: 760px; --side: 232px;
  --tabs-h: calc(58px + env(safe-area-inset-bottom));
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 8px 24px rgba(0,0,0,.06);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #f5f5f7; --ink-soft: #a1a1a6; --ink-faint: #6e6e73;
    --bg: #000000; --card: #1c1c1e; --line: rgba(255,255,255,.10); --line-strong: rgba(255,255,255,.18);
    --gold-bg: rgba(184,147,63,.16); --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --ink: #f5f5f7; --ink-soft: #a1a1a6; --ink-faint: #6e6e73;
  --bg: #000000; --card: #1c1c1e; --line: rgba(255,255,255,.10); --line-strong: rgba(255,255,255,.18);
  --gold-bg: rgba(184,147,63,.16); --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35);
  color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  overflow-x: clip;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg); color: var(--ink); line-height: 1.5; font-size: 15px; -webkit-font-smoothing: antialiased;
  min-height: 100vh; overscroll-behavior-y: none;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
h1 { font-size: 26px; font-weight: 700; letter-spacing: -.02em; line-height: 1.15; }
h2 { font-size: 17px; font-weight: 600; letter-spacing: -.01em; }
h3 { font-size: 15px; font-weight: 600; }
p { margin: 0; }
.muted { color: var(--ink-soft); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.gold { color: var(--gold); }
.danger { color: var(--danger); }
.ok { color: var(--ok); }
.center { text-align: center; }
.mt { margin-top: 12px; } .mt2 { margin-top: 20px; } .mb { margin-bottom: 12px; }
.hidden, [hidden] { display: none !important; }
.ic { width: 20px; height: 20px; flex: none; vertical-align: -4px; }
.ic--s { width: 16px; height: 16px; }
.crown { width: 20px; height: 20px; fill: var(--gold); flex: none; }
.crown--xs { width: 12px; height: 12px; vertical-align: -1px; }

/* ---------- Layout ---------- */
#app { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr auto; min-height: 100vh; }
.top {
  position: sticky; top: 0; z-index: 40; height: calc(52px + env(safe-area-inset-top)); padding-top: env(safe-area-inset-top);
  display: flex; align-items: center; gap: 12px; padding-left: 16px; padding-right: 12px;
  background: rgba(20,25,43,.86); color: #fff; backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 3px solid var(--accent);
}
.top__brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 17px; letter-spacing: -.02em; }
.top__right { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.top .iconbtn { color: #fff; position: relative; }
.badge-dot { position: absolute; top: 4px; right: 4px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--danger); color: #fff; font-size: 10px; font-weight: 700; line-height: 16px; text-align: center; }
.view { width: 100%; min-width: 0; max-width: var(--maxw); margin: 0 auto; padding: 16px 14px calc(var(--tabs-h) + 16px); }
.view > * { min-width: 0; }
.tabs {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 40; height: var(--tabs-h); padding-bottom: env(safe-area-inset-bottom);
  display: grid; grid-template-columns: repeat(5, 1fr); background: var(--card); border-top: 1px solid var(--line);
  backdrop-filter: blur(20px);
}
.tabs a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 10.5px; color: var(--ink-faint); position: relative; }
.tabs a.active { color: var(--accent); }
.tabs .ic { width: 24px; height: 24px; }
.tabs .badge-dot { top: 6px; right: calc(50% - 20px); }
.side { display: none; }
@media (min-width: 900px) {
  #app { grid-template-columns: var(--side) minmax(0, 1fr); grid-template-rows: auto 1fr; }
  .top { grid-column: 1 / -1; }
  .side { display: block; position: sticky; top: 55px; align-self: start; padding: 20px 12px; height: calc(100vh - 55px); overflow: auto; }
  .side a { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 12px; color: var(--ink-soft); font-weight: 500; position: relative; }
  .side a:hover { background: var(--card); color: var(--ink); }
  .side a.active { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }
  .side .sep { height: 1px; background: var(--line); margin: 10px 8px; }
  .side .badge-dot { position: static; margin-left: auto; }
  .tabs { display: none; }
  .view { padding: 24px 24px 48px; --tabs-h: 0px; }
}
body:not(.authed) .side, body:not(.authed) .tabs { display: none; }
body:not(.authed) #app { grid-template-columns: 1fr; }
body:not(.authed) .view { padding-bottom: 32px; }

/* ---------- Karten / Listen ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 14px; overflow: hidden; }
.card--pad { padding: 18px; }
.card--gold { background: linear-gradient(135deg, rgba(184,147,63,.14), rgba(216,188,119,.06)); border: 1px solid rgba(184,147,63,.25); }
.card--night { background: var(--night); color: #fff; }
.card--night .muted { color: rgba(255,255,255,.65); }
.sec { display: flex; align-items: baseline; justify-content: space-between; padding: 14px 18px 6px; }
.sec h2 { font-size: 15px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-soft); font-weight: 600; }
.sec span, .sec a { font-size: 13px; color: var(--accent); font-weight: 600; }
.list { display: flex; flex-direction: column; }
.list > * { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 12px; }
.list > *:first-child { border-top: 0; }
.list a:active { background: var(--gold-bg); }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row--end { justify-content: flex-end; margin-top: 16px; }
.row--between { justify-content: space-between; }
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.grid > * { min-width: 0; }
.grid--2 { grid-template-columns: 1fr 1fr; }
.grid--photos { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 4px; }
.grid--photos a { aspect-ratio: 1; overflow: hidden; border-radius: 10px; background: var(--line); }
.grid--photos img { width: 100%; height: 100%; object-fit: cover; }
.empty { padding: 32px 18px; text-align: center; color: var(--ink-faint); }
.empty .ic { width: 32px; height: 32px; margin-bottom: 8px; }
.loading { display: flex; justify-content: center; padding: 60px; }
.spinner { width: 28px; height: 28px; border: 3px solid var(--line-strong); border-top-color: var(--gold); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.ph { display: flex; align-items: center; gap: 10px; margin: 4px 0 16px; }
.ph__t { flex: 1; min-width: 0; }
.ph__back { display: inline-flex; padding: 6px; margin-left: -6px; border-radius: 50%; color: var(--ink-soft); }
.ph__r { display: flex; gap: 6px; }

/* ---------- Avatare / Chips ---------- */
.avatar { display: inline-block; position: relative; flex: none; border-radius: 50%; overflow: hidden; background: var(--line); width: 44px; height: 44px; }
.avatar img, .avatar span { width: 100%; height: 100%; object-fit: cover; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: 15px; }
.avatar--sm { width: 30px; height: 30px; } .avatar--sm span { font-size: 11px; }
.avatar--lg { width: 96px; height: 96px; } .avatar--lg span { font-size: 32px; }
.avatar--xl { width: 132px; height: 132px; border: 4px solid var(--card); box-shadow: var(--shadow); } .avatar--xl span { font-size: 44px; }
.avatar.is-online::after { content: ""; position: absolute; right: 0; bottom: 0; width: 26%; height: 26%; border-radius: 50%; background: var(--ok); border: 2px solid var(--card); }
.chip { display: inline-flex; align-items: center; gap: 10px; min-width: 0; }
.chip__text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.chip__text b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip__text small { color: var(--ink-soft); font-size: 12px; }
.chip__right { margin-left: auto; }
.stack { display: inline-flex; align-items: center; }
.stack .avatar { margin-left: -8px; border: 2px solid var(--card); }
.stack > :first-child .avatar { margin-left: 0; }
.stack__more { margin-left: 6px; font-size: 12px; color: var(--ink-soft); font-weight: 600; }
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--line); }
.pill--gold { background: var(--gold-bg); color: var(--gold); }
.pill--violet { background: rgba(115,105,228,.14); color: var(--violet); }
.pill--ok { background: rgba(46,158,91,.14); color: var(--ok); }
.pill--danger { background: rgba(217,45,58,.12); color: var(--danger); }
.cat { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 700; color: #fff; background: var(--c, #888); letter-spacing: .02em; }

/* ---------- Buttons / Formulare ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 11px 20px; border-radius: 999px; font-weight: 600; font-size: 15px; background: var(--line); color: var(--ink); transition: transform .12s, opacity .2s; white-space: nowrap; }
.btn:active { transform: scale(.97); }
.btn--primary { background: var(--ink); color: var(--bg); }
.btn--gold { background: var(--gold); color: #fff; }
.btn--ghost { background: transparent; border: 1px solid var(--line-strong); }
.btn--danger { background: var(--danger); color: #fff; }
.btn--ok { background: var(--ok); color: #fff; }
.btn--violet { background: var(--violet); color: #fff; }
.btn--sm { padding: 7px 14px; font-size: 13px; }
.btn--block { width: 100%; }
.btn--big { padding: 15px 28px; font-size: 17px; }
.btn[disabled], .btn.is-busy { opacity: .55; pointer-events: none; }
.btn .ic { width: 18px; height: 18px; }
.iconbtn { display: inline-flex; padding: 8px; border-radius: 50%; color: var(--ink-soft); }
.iconbtn:hover { background: var(--line); }
.input, select.input, textarea.input { width: 100%; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--card); color: var(--ink); font-size: 16px; outline: none; }
.input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-bg); }
.input.is-invalid { border-color: var(--danger); }
textarea.input { resize: vertical; min-height: 90px; }
label.f { display: block; margin-bottom: 14px; }
label.f > span, .f__label { display: block; font-size: 13px; font-weight: 600; color: var(--ink-soft); margin-bottom: 6px; }
.f__hint { font-size: 12px; color: var(--ink-faint); margin-top: 5px; }
.form-error { background: rgba(217,45,58,.1); color: var(--danger); padding: 10px 14px; border-radius: 12px; margin-bottom: 14px; font-size: 14px; }
.check { display: flex; align-items: center; gap: 10px; padding: 10px 0; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--gold); }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 18px; border-top: 1px solid var(--line); }
.switch input { width: 44px; height: 26px; appearance: none; background: var(--line-strong); border-radius: 13px; position: relative; cursor: pointer; transition: background .2s; flex: none; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.switch input:checked { background: var(--ok); }
.switch input:checked::after { transform: translateX(18px); }
.seg { display: inline-flex; background: var(--line); border-radius: 999px; padding: 3px; gap: 2px; max-width: 100%; overflow: auto; }
.seg button { padding: 7px 14px; border-radius: 999px; font-size: 13px; font-weight: 600; color: var(--ink-soft); white-space: nowrap; }
.seg button.active { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }
.prog { height: 8px; background: var(--line); border-radius: 4px; overflow: hidden; }
.prog__bar { height: 100%; background: linear-gradient(90deg, var(--gold), var(--gold-soft)); border-radius: 4px; transition: width .4s; }
.crowns { display: inline-flex; gap: 2px; }
.crowns__c .crown { fill: var(--line-strong); width: 22px; height: 22px; }
.crowns__c.on .crown { fill: var(--gold); }
.crowns--i .crowns__c { cursor: pointer; }

/* ---------- Spezielle Blöcke ---------- */
.hero-user { display: flex; align-items: center; gap: 14px; padding: 18px; }
.quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; padding: 0 14px 16px; }
.quick a { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 4px; border-radius: 14px; background: var(--bg); font-size: 11.5px; font-weight: 600; color: var(--ink-soft); text-align: center; }
.quick a .ic { width: 22px; height: 22px; color: var(--gold); }
.event-row { display: flex; gap: 14px; align-items: center; padding: 12px 18px; border-top: 1px solid var(--line); }
.event-row:first-child { border-top: 0; }
.date-box { flex: none; width: 52px; text-align: center; background: var(--bg); border-radius: 12px; padding: 6px 0; line-height: 1.1; }
.date-box b { display: block; font-size: 20px; }
.date-box small { font-size: 11px; text-transform: uppercase; color: var(--ink-soft); font-weight: 600; }
.date-box.today { background: var(--danger); color: #fff; } .date-box.today small { color: #fff; }
.event-row__t { flex: 1; min-width: 0; }
.event-row__t b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.event-row__meta { display: flex; gap: 8px; align-items: center; font-size: 12.5px; color: var(--ink-soft); flex-wrap: wrap; }
.event-row.cancelled b { text-decoration: line-through; color: var(--danger); }
.feed-item { display: flex; gap: 12px; padding: 10px 18px; border-top: 1px solid var(--line); font-size: 14px; }
.feed-item:first-child { border-top: 0; }
.feed-item time { display: block; font-size: 11.5px; color: var(--ink-faint); }
.comment { display: flex; gap: 10px; padding: 10px 18px; border-top: 1px solid var(--line); }
.comment__b { flex: 1; min-width: 0; }
.comment__b .bubble { display: inline-block; padding: 8px 12px; border-radius: 16px; border-top-left-radius: 4px; background: var(--line); font-size: 14.5px; border-left: 3px solid var(--uc, var(--gold)); word-break: break-word; }
.comment__meta { font-size: 12px; color: var(--ink-faint); margin-top: 3px; }
.stat { text-align: center; padding: 12px 4px; min-width: 0; overflow: hidden; }
.stat b { display: block; font-size: 28px; font-weight: 700; letter-spacing: -.02em; }
.stat small { color: var(--ink-soft); font-size: 11px; text-transform: uppercase; letter-spacing: .03em; white-space: nowrap; }
.map { height: 220px; border-radius: 14px; overflow: hidden; z-index: 0; background: var(--line); }
.map--tall { height: 60vh; min-height: 360px; }
.map--edit { height: 300px; }
.leaflet-container { font: inherit; }
.big-points { font-size: 56px; font-weight: 700; letter-spacing: -.04em; line-height: 1; color: var(--gold); }
.badge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 12px; padding: 0 18px 18px; }
.badge-grid div { text-align: center; font-size: 11.5px; color: var(--ink-soft); }
.badge-grid img { width: 72px; height: 72px; margin: 0 auto 6px; border-radius: 50%; }
.badge-grid .locked img { filter: grayscale(1); opacity: .45; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 6px; }
.gallery a { aspect-ratio: 4 / 3; overflow: hidden; border-radius: 10px; background: var(--line); position: relative; }
.gallery img { width: 100%; height: 100%; object-fit: cover; }
.gallery .tags { position: absolute; left: 6px; bottom: 6px; }
.lightbox { position: fixed; inset: 0; z-index: 100; background: rgba(0,0,0,.97); display: flex; flex-direction: column; color: #fff; }
.lightbox__img { flex: 1; display: flex; align-items: center; justify-content: center; min-height: 0; }
.lightbox__img img { max-width: 100%; max-height: 100%; object-fit: contain; }
.lightbox__bar { padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.lightbox .iconbtn { color: #fff; }
.chat { display: flex; flex-direction: column; gap: 6px; padding: 12px 14px; min-height: 40vh; }
.msg { max-width: 78%; padding: 9px 13px; border-radius: 18px; font-size: 15px; word-break: break-word; position: relative; }
.msg--me { align-self: flex-end; background: var(--me, var(--gold)); color: #fff; border-bottom-right-radius: 5px; }
.msg--you { align-self: flex-start; background: var(--line); border-bottom-left-radius: 5px; border-left: 3px solid var(--you, var(--violet)); }
.msg time { display: block; font-size: 10.5px; opacity: .7; margin-top: 2px; text-align: right; }
.chat-form { position: sticky; bottom: var(--tabs-h); display: flex; gap: 8px; padding: 10px 0; background: var(--bg); }
.chat-form .input { flex: 1; border-radius: 22px; }
.color-swatches { display: grid; grid-template-columns: repeat(8, 1fr); gap: 8px; }
.color-swatches button { aspect-ratio: 1; border-radius: 50%; border: 3px solid transparent; }
.color-swatches button.active { border-color: var(--ink); }
.tree { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.tree .arrow { color: var(--ink-faint); font-size: 18px; }
.status-bar { display: flex; gap: 6px; flex-wrap: wrap; }
.legal h2 { margin: 18px 0 6px; } .legal p, .legal li { color: var(--ink-soft); margin-bottom: 8px; font-size: 14px; } .legal ul { padding-left: 20px; }
.blur-bg { position: absolute; inset: 0; background-size: cover; background-position: center; filter: blur(18px) brightness(.55); transform: scale(1.1); }
.profile-hero { position: relative; overflow: hidden; padding: 28px 18px 18px; text-align: center; background: var(--night); color: #fff; }
.profile-hero > * { position: relative; }
.notif { display: flex; gap: 12px; padding: 12px 18px; border-top: 1px solid var(--line); align-items: flex-start; }
.notif.unread { background: var(--gold-bg); }
.notif .ic { color: var(--gold); margin-top: 2px; }
.sticky-actions { position: sticky; bottom: calc(var(--tabs-h) + 8px); display: flex; gap: 8px; padding: 8px 0; z-index: 5; }
.sticky-actions .btn { flex: 1; box-shadow: var(--shadow); }

/* ---------- Auth-Seiten ---------- */
.auth { max-width: 420px; margin: 24px auto; }
.auth__logo { text-align: center; margin-bottom: 22px; }
.auth__logo .crown { width: 52px; height: 52px; }
.auth__logo h1 { margin-top: 8px; }

/* ---------- Toast / Modal ---------- */
.toasts { position: fixed; left: 0; right: 0; bottom: calc(var(--tabs-h) + 12px); z-index: 90; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast { background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 999px; font-size: 14px; font-weight: 500; opacity: 0; transform: translateY(10px); transition: all .25s; max-width: 90vw; }
.toast.in { opacity: 1; transform: none; }
.toast--error { background: var(--danger); color: #fff; } .toast--success { background: var(--ok); color: #fff; }
.modal { position: fixed; inset: 0; z-index: 80; background: rgba(0,0,0,.45); display: flex; align-items: flex-end; justify-content: center; opacity: 0; transition: opacity .2s; }
.modal.in { opacity: 1; }
.modal__box { background: var(--card); width: 100%; max-width: 480px; border-radius: 22px 22px 0 0; max-height: 92vh; overflow: auto; transform: translateY(20px); transition: transform .2s; padding-bottom: env(safe-area-inset-bottom); }
.modal.in .modal__box { transform: none; }
.modal__box--wide { max-width: 720px; }
.modal__head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px 0; }
.modal__body { padding: 18px; }
@media (min-width: 600px) { .modal { align-items: center; padding: 20px; } .modal__box { border-radius: 22px; } }
.notice-bar { position: fixed; top: calc(52px + env(safe-area-inset-top)); left: 0; right: 0; z-index: 39; background: var(--card); border-bottom: 3px solid var(--gold); padding: 10px 16px; box-shadow: var(--shadow); display: flex; gap: 10px; align-items: center; font-size: 14px; transform: translateY(-120%); transition: transform .3s; }
.notice-bar.in { transform: none; }
.notice-bar a { flex: 1; }
.geo-results { position: relative; z-index: 5; margin: 4px 0 10px; max-height: 220px; overflow: auto; }
.geo-result { display: flex; gap: 8px; width: 100%; text-align: left; padding: 10px 12px; border-top: 1px solid var(--line); font-size: 13.5px; align-items: flex-start; }
.geo-result:first-child { border-top: 0; }
.geo-result .ic { color: var(--gold); margin-top: 2px; }
.crown-marker { background: none; border: 0; }
