:root {
  --accent: #ffffff;
  --bg: #000000;
  --panel: #0a0a0a;
  --panel-2: #141414;
  --line: #2a2a2a;
  --text: #f5f5f5;
  --muted: #8a8a8a;
  --font-display: 'Space Grotesk', 'Segoe UI', sans-serif;
  --font-body: 'Inter', 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 28px;
  border-bottom: 1px solid var(--line);
}

.brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 20px;
  letter-spacing: 0.5px;
}
.brand span { color: var(--accent); }

.nav { display: flex; gap: 18px; align-items: center; }
.nav a { color: var(--muted); font-size: 14px; transition: color .15s; }
.nav a:hover { color: var(--text); }

.container { max-width: 920px; margin: 0 auto; padding: 32px 20px 80px; }
.profile-page-bg { border-radius: 0; margin-top: -1px; }

.auth-wrap {
  max-width: 380px;
  margin: 90px auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 34px 30px;
}
.auth-wrap h1 { font-family: var(--font-display); font-size: 24px; margin-bottom: 4px; }
.auth-wrap p.sub { color: var(--muted); font-size: 14px; margin-bottom: 24px; }

label { display: block; font-size: 13px; color: var(--muted); margin: 14px 0 6px; }
input[type=text], input[type=password], textarea, input[type=color] {
  width: 100%;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text);
  font-size: 14px;
  font-family: var(--font-body);
}
textarea { resize: vertical; min-height: 80px; }

button, .btn {
  background: var(--text);
  color: #000;
  border: none;
  padding: 11px 18px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  font-size: 14px;
  display: inline-block;
}
button:hover, .btn:hover { filter: brightness(0.85); }
.btn-secondary { background: transparent; color: var(--text); border: 1px solid var(--line); }
.btn-secondary:hover { filter: none; border-color: var(--text); }

.error { color: #ff6b81; font-size: 13px; margin-top: 10px; }
.switch { margin-top: 18px; font-size: 13px; color: var(--muted); }

/* profile card */
.profile-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
}
.banner {
  height: 180px;
  background-size: cover;
  background-position: center;
  position: relative;
}
.avatar {
  width: 92px; height: 92px;
  border-radius: 50%;
  border: 4px solid var(--panel);
  object-fit: cover;
  position: absolute;
  bottom: -46px; left: 28px;
  background: var(--panel-2);
}
.profile-body { padding: 60px 28px 28px; }
.display-name { font-family: var(--font-display); font-size: 22px; font-weight: 700; }
.username { color: var(--muted); font-size: 14px; margin-bottom: 14px; }
.bio { line-height: 1.5; color: #cfccdf; }

/* discover grid */
.search-bar { display: flex; gap: 10px; margin-bottom: 24px; }
.search-bar input { flex: 1; }
.user-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px,1fr)); gap: 14px; }
.user-tile {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  transition: border-color .15s, transform .15s;
}
.user-tile:hover { border-color: var(--accent); transform: translateY(-2px); }
.user-tile img { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; background: var(--panel-2); }
.user-tile .row { display: flex; gap: 10px; align-items: center; margin-bottom: 8px; }
.user-tile .name { font-weight: 600; font-size: 14px; }
.user-tile .uname { color: var(--muted); font-size: 12px; }
.user-tile .bio-preview { color: var(--muted); font-size: 12.5px; line-height: 1.4; }

/* chat */
.thread-list { display: flex; flex-direction: column; gap: 8px; }
.thread-item {
  display: flex; gap: 12px; align-items: center;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; padding: 12px 14px;
}
.thread-item img { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; background: var(--panel-2); }
.thread-item .prev { color: var(--muted); font-size: 12.5px; }

.chat-wrap { display: flex; flex-direction: column; height: 70vh; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.chat-header { padding: 14px 18px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.chat-header img { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; }
.chat-messages { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 8px; }
.msg { max-width: 65%; padding: 9px 13px; border-radius: 14px; font-size: 14px; line-height: 1.4; }
.msg.mine { align-self: flex-end; background: var(--text); color: #000; border-bottom-right-radius: 4px; }
.msg.theirs { align-self: flex-start; background: var(--panel-2); border-bottom-left-radius: 4px; }
.chat-input { display: flex; gap: 10px; padding: 14px; border-top: 1px solid var(--line); }
.chat-input input { flex: 1; }

.color-row { display: flex; gap: 16px; }
.color-row > div { flex: 1; }

.field-row { display: flex; gap: 16px; }
.field-row > div { flex: 1; }

.badge-early {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px; height: 16px;
  background: #e11d3f;
  border-radius: 50%;
  margin-left: 5px;
  vertical-align: middle;
  box-shadow: 0 0 0 2px rgba(225,29,63,0.25);
}
.badge-early svg { width: 10px; height: 10px; }

/* ---- mobile ---- */
@media (max-width: 640px) {
  .topbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
  }
  .nav {
    width: 100%;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 13px;
  }
  .container { padding: 20px 14px 60px; }
  .auth-wrap { margin: 40px auto; padding: 26px 20px; max-width: 100%; }
  .banner { height: 130px; }
  .avatar { width: 76px; height: 76px; bottom: -38px; left: 18px; }
  .profile-body { padding: 48px 18px 20px; }
  .user-grid { grid-template-columns: 1fr; }
  .search-bar { flex-direction: column; }
  .search-bar button { width: 100%; }
  .color-row, .field-row { flex-direction: column; gap: 10px; }
  .chat-wrap { height: 78vh; border-radius: 10px; }
  .msg { max-width: 82%; }
  table { font-size: 13px; }
  td, th { padding: 6px !important; }
}
