:root {
  --bg: #14102b;
  --bg-alt: #1c1640;
  --card: #241d4f;
  --primary: #7c5cff;
  --primary-2: #b388ff;
  --accent: #ff6f6f;
  --text: #f1eefc;
  --text-dim: #b3a9d9;
  --border: #352a70;
  --radius: 18px;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: linear-gradient(160deg, var(--bg), var(--bg-alt));
  color: var(--text);
  min-height: 100vh;
}
#app { min-height: 100vh; }
.hidden { display: none !important; }
.view { min-height: 100vh; }

/* ---- Brand ---- */
.brand { display: flex; align-items: center; gap: 10px; justify-content: center; }
.brand.small { justify-content: flex-start; font-weight: 700; font-size: 18px; }
.brand-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  font-weight: 800; color: white;
}
.brand h1 { margin: 6px 0 0; font-size: 26px; }
.tagline { text-align: center; color: var(--text-dim); margin: 6px 0 20px; font-size: 14px; }

/* ---- Auth ---- */
#view-auth { display: flex; align-items: center; justify-content: center; padding: 24px; }
.auth-card {
  width: 100%; max-width: 380px; background: var(--card);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 28px 24px;
}
.tabs { display: flex; margin: 12px 0 18px; border-radius: 12px; background: var(--bg-alt); padding: 4px; }
.tab-btn {
  flex: 1; padding: 8px; border: none; background: transparent; color: var(--text-dim);
  border-radius: 10px; cursor: pointer; font-weight: 600;
}
.tab-btn.active { background: var(--primary); color: white; }
.auth-form { display: flex; flex-direction: column; gap: 10px; }
.auth-form input, .auth-form textarea {
  padding: 11px 12px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--bg-alt); color: var(--text); font-size: 14px;
}
.field-label { font-size: 13px; color: var(--text-dim); margin-top: 4px; }
.checkbox-line { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; color: var(--text-dim); }
.checkbox-line input { margin-top: 3px; }
button[type="submit"], .upload-btn {
  padding: 12px; border-radius: 12px; border: none; cursor: pointer;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: white; font-weight: 700; margin-top: 6px;
}
.form-error { color: var(--accent); font-size: 13px; min-height: 16px; }
.form-success { color: #7fe3a3; font-size: 13px; min-height: 16px; }

/* ---- Top bar ---- */
.topbar {
  display: flex; align-items: center; gap: 16px; padding: 14px 20px;
  border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--bg); z-index: 5;
}
.tabbar { display: flex; gap: 6px; flex: 1; justify-content: center; }
.nav-btn {
  background: transparent; border: none; color: var(--text-dim); padding: 8px 14px;
  border-radius: 10px; cursor: pointer; font-weight: 600;
}
.nav-btn.active { background: var(--card); color: var(--text); }
.ghost-btn {
  background: transparent; border: 1px solid var(--border); color: var(--text-dim);
  padding: 8px 12px; border-radius: 10px; cursor: pointer;
}

.panel { padding: 18px 20px 60px; }

/* ---- Discover cards: bewusst NICHT die kreisrunde Kachel-Optik anderer
   Standort-Apps, sondern abgerundete Rechteckkarten in eigener Farbwelt. ---- */
.card-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px;
}
.discover-card {
  background: var(--card); border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--border); cursor: pointer; position: relative;
  aspect-ratio: 3/4; display: flex; align-items: flex-end;
}
.discover-card img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.discover-card .no-photo {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 40px; font-weight: 800; color: var(--text-dim); background: var(--bg-alt);
}
.card-overlay {
  position: relative; z-index: 2; width: 100%; padding: 10px;
  background: linear-gradient(to top, rgba(0,0,0,.75), transparent);
}
.card-overlay .name { font-weight: 700; font-size: 14px; }
.card-overlay .distance { font-size: 12px; color: var(--primary-2); }

.banner {
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  padding: 12px 16px; margin-bottom: 16px; display: flex; align-items: center; justify-content: space-between;
  gap: 12px; font-size: 14px;
}
.banner button {
  background: var(--primary); border: none; color: white; padding: 8px 12px;
  border-radius: 10px; cursor: pointer; font-weight: 600;
}

/* ---- Conversations ---- */
.conversation-list { display: flex; flex-direction: column; gap: 8px; }
.conversation-item {
  display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 14px;
  background: var(--card); cursor: pointer; border: 1px solid var(--border);
}
.avatar-sm { width: 44px; height: 44px; border-radius: 12px; object-fit: cover; background: var(--bg-alt); }
.conversation-item .meta { flex: 1; min-width: 0; }
.conversation-item .name { font-weight: 700; font-size: 14px; }
.conversation-item .preview { font-size: 13px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---- Chat window ---- */
.chat-header { display: flex; align-items: center; gap: 10px; padding: 12px 20px; border-bottom: 1px solid var(--border); }
.chat-messages { display: flex; flex-direction: column; gap: 8px; padding: 16px 20px; min-height: 50vh; }
.msg { max-width: 70%; padding: 9px 13px; border-radius: 16px; font-size: 14px; line-height: 1.35; }
.msg.mine { align-self: flex-end; background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: white; }
.msg.theirs { align-self: flex-start; background: var(--card); border: 1px solid var(--border); }
.chat-input-row { display: flex; gap: 10px; padding: 12px 20px; border-top: 1px solid var(--border); position: sticky; bottom: 0; background: var(--bg); }
.chat-input-row input { flex: 1; padding: 12px; border-radius: 12px; border: 1px solid var(--border); background: var(--bg-alt); color: var(--text); }
.chat-input-row button { padding: 0 18px; border-radius: 12px; border: none; background: var(--primary); color: white; font-weight: 700; cursor: pointer; }

/* ---- Profile edit ---- */
.profile-edit { max-width: 480px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; }
.photo-row { display: flex; gap: 10px; flex-wrap: wrap; }
.photo-row .photo-thumb { width: 78px; height: 78px; border-radius: 14px; object-fit: cover; position: relative; }
.photo-row .photo-wrap { position: relative; }
.photo-row .remove-photo {
  position: absolute; top: -6px; right: -6px; width: 20px; height: 20px; border-radius: 50%;
  background: var(--accent); color: white; border: none; font-size: 12px; cursor: pointer;
}
#form-profile { display: flex; flex-direction: column; gap: 8px; }
#form-profile label { font-size: 13px; color: var(--text-dim); margin-top: 6px; }
#form-profile input, #form-profile textarea {
  padding: 10px; border-radius: 12px; border: 1px solid var(--border); background: var(--bg-alt); color: var(--text);
}

/* ---- Detail view ---- */
.detail-header { padding: 14px 20px; border-bottom: 1px solid var(--border); }
.detail-content { max-width: 520px; margin: 0 auto; padding: 20px; }
.detail-photos { display: flex; gap: 8px; overflow-x: auto; }
.detail-photos img { width: 140px; height: 180px; border-radius: 16px; object-fit: cover; flex-shrink: 0; }
.detail-name { font-size: 22px; font-weight: 800; margin: 14px 0 4px; }
.detail-bio { color: var(--text-dim); font-size: 14px; margin-bottom: 16px; }
.detail-actions { display: flex; gap: 10px; }
.detail-actions button {
  flex: 1; padding: 11px; border-radius: 12px; border: none; cursor: pointer; font-weight: 700;
}
.btn-chat { background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: white; }
.btn-report { background: var(--card); border: 1px solid var(--border) !important; color: var(--text-dim); }
.btn-block { background: var(--card); border: 1px solid var(--accent) !important; color: var(--accent); }

@media (min-width: 720px) {
  .panel { padding: 24px 40px 60px; }
}
