* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #0a0a0a;
  --surface: #141414;
  --surface2: #1e1e1e;
  --border: #2a2a2a;
  --text: #e0e0e0;
  --text-dim: #888;
  --accent: #00d4aa;
  --accent-hover: #33e0be;
  --green: #44ff88;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

/* Nav */
nav { background: var(--surface); border-bottom: 1px solid var(--border); padding: 0 20px; position: sticky; top: 0; z-index: 100; }
.nav-inner { max-width: 800px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; height: 56px; }
.logo { font-size: 1.4rem; font-weight: 700; color: #ffffff; }
.logo span { color: var(--accent); }
.nav-links { display: flex; align-items: center; gap: 16px; }
.nav-links a { color: var(--text-dim); font-size: 0.9rem; }
.nav-links a:hover { color: var(--text); }
#search-input { background: var(--surface2); border: 1px solid var(--border); color: var(--text); padding: 6px 12px; border-radius: 20px; font-size: 0.85rem; width: 180px; outline: none; }
#search-input:focus { border-color: var(--accent); }

.search-results { position: fixed; top: 56px; left: 50%; transform: translateX(-50%); background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 8px; z-index: 101; min-width: 300px; max-height: 300px; overflow-y: auto; }
.search-result { padding: 8px 12px; cursor: pointer; border-radius: 6px; display: flex; align-items: center; gap: 10px; }
.search-result:hover { background: var(--surface2); }

/* Main */
main { max-width: 700px; margin: 0 auto; padding: 20px; min-height: calc(100vh - 120px); }

/* Hero / Landing */
.hero { text-align: center; padding: 80px 20px; }
.hero h1 { font-size: 3.5rem; margin-bottom: 16px; }
.hero h1 span { color: var(--accent); }
.tagline { font-size: 1.3rem; color: var(--text-dim); margin-bottom: 40px; }
.hero-features { display: flex; justify-content: center; gap: 20px; margin-bottom: 40px; flex-wrap: wrap; }
.feature { background: var(--surface); border: 1px solid var(--border); padding: 12px 24px; border-radius: 8px; font-size: 0.95rem; }

/* Buttons */
.btn { padding: 10px 20px; border: none; border-radius: 8px; cursor: pointer; font-size: 0.9rem; font-weight: 600; transition: all 0.2s; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { border-color: var(--accent); }
.btn-lg { padding: 14px 40px; font-size: 1.1rem; }
.btn-sm { padding: 6px 14px; font-size: 0.8rem; }
.btn-follow { background: var(--accent); color: #fff; }
.btn-unfollow { background: var(--surface2); color: var(--text-dim); border: 1px solid var(--border); }

/* Auth forms */
.auth-form { max-width: 400px; margin: 60px auto; background: var(--surface); padding: 40px; border-radius: 12px; border: 1px solid var(--border); }
.auth-form h2 { margin-bottom: 24px; text-align: center; }
.auth-form h2 span { color: var(--accent); }
.auth-form input { width: 100%; padding: 12px; margin-bottom: 16px; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; color: var(--text); font-size: 0.95rem; outline: none; }
.auth-form input:focus { border-color: var(--accent); }
.auth-form .btn { width: 100%; margin-bottom: 16px; }
.auth-form p { text-align: center; color: var(--text-dim); font-size: 0.9rem; }

/* Compose */
.compose { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 16px; margin-bottom: 20px; }
.compose textarea { width: 100%; background: transparent; border: none; color: var(--text); font-size: 1rem; resize: none; outline: none; font-family: inherit; }
.compose-actions { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.compose-actions .btn-primary { margin-left: auto; }
#image-name { color: var(--text-dim); font-size: 0.8rem; }

/* Posts */
.post { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 16px; margin-bottom: 16px; }
.post-header { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.post-avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--surface2); object-fit: cover; }
.post-user { font-weight: 600; cursor: pointer; }
.post-user:hover { color: var(--accent); }
.post-time { color: var(--text-dim); font-size: 0.8rem; margin-left: auto; }
.post-content { margin-bottom: 12px; line-height: 1.5; white-space: pre-wrap; }
.post-image { width: 100%; border-radius: 8px; margin-bottom: 12px; }
.post-actions { display: flex; gap: 20px; color: var(--text-dim); font-size: 0.9rem; }
.post-action { cursor: pointer; display: flex; align-items: center; gap: 4px; }
.post-action:hover { color: var(--accent); }
.post-action.liked { color: var(--accent); }

/* Comments */
.comments-section { margin-top: 12px; border-top: 1px solid var(--border); padding-top: 12px; }
.comment { padding: 8px 0; border-bottom: 1px solid var(--border); }
.comment:last-child { border-bottom: none; }
.comment-user { font-weight: 600; font-size: 0.85rem; cursor: pointer; }
.comment-text { font-size: 0.9rem; margin-top: 4px; }
.comment-input { display: flex; gap: 8px; margin-top: 8px; }
.comment-input input { flex: 1; background: var(--bg); border: 1px solid var(--border); border-radius: 20px; padding: 8px 14px; color: var(--text); font-size: 0.85rem; outline: none; }

/* Profile */
.profile-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 24px; margin-bottom: 20px; display: flex; align-items: flex-start; gap: 20px; }
.profile-avatar { width: 80px; height: 80px; border-radius: 50%; background: var(--surface2); object-fit: cover; }
.profile-info h2 { margin-bottom: 4px; }
.profile-info .username { color: var(--text-dim); margin-bottom: 8px; }
.profile-stats { display: flex; gap: 20px; margin-bottom: 8px; font-size: 0.9rem; color: var(--text-dim); }
.profile-stats strong { color: var(--text); }
.profile-bio { margin-bottom: 12px; }

/* Messages */
.conversation { padding: 14px; border-bottom: 1px solid var(--border); cursor: pointer; display: flex; align-items: center; gap: 12px; }
.conversation:hover { background: var(--surface2); }
.convo-avatar { width: 44px; height: 44px; border-radius: 50%; background: var(--surface2); object-fit: cover; }
.convo-info { flex: 1; }
.convo-name { font-weight: 600; }
.convo-preview { color: var(--text-dim); font-size: 0.85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#thread-header { padding: 12px; border-bottom: 1px solid var(--border); font-weight: 600; display: flex; align-items: center; gap: 10px; }
#thread-header .back-btn { cursor: pointer; font-size: 1.2rem; }
#thread-messages { max-height: 60vh; overflow-y: auto; padding: 16px; }
.message { margin-bottom: 12px; max-width: 70%; }
.message.sent { margin-left: auto; }
.message-bubble { padding: 10px 14px; border-radius: 16px; font-size: 0.9rem; }
.message.sent .message-bubble { background: var(--accent); color: #fff; border-bottom-right-radius: 4px; }
.message.received .message-bubble { background: var(--surface2); border-bottom-left-radius: 4px; }
.message-time { font-size: 0.7rem; color: var(--text-dim); margin-top: 4px; }
.compose-message { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--border); }
.compose-message input { flex: 1; background: var(--surface2); border: 1px solid var(--border); border-radius: 20px; padding: 10px 16px; color: var(--text); outline: none; }

/* Footer */
footer { text-align: center; padding: 20px; color: var(--text-dim); font-size: 0.8rem; border-top: 1px solid var(--border); }
footer span { color: var(--accent); }

/* Toast */
.toast { position: fixed; bottom: 20px; right: 20px; background: var(--surface); border: 1px solid var(--border); padding: 12px 20px; border-radius: 8px; z-index: 200; animation: fadeIn 0.3s; }
.toast.error { border-color: var(--accent); }
.toast.success { border-color: var(--green); }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 600px) {
  .hero h1 { font-size: 2.2rem; }
  .hero-features { flex-direction: column; align-items: center; }
  .nav-links { gap: 10px; }
  #search-input { width: 120px; }
  .profile-card { flex-direction: column; align-items: center; text-align: center; }
  main { padding: 12px; }
}
.pw-rules { font-size: 0.75rem; color: var(--text-dim); margin: -8px 0 16px 0; }

/* Ads */
.ad-post { border: 1px solid #2a2a3a; background: linear-gradient(135deg, var(--surface) 0%, #1a1a2a 100%); }
.ad-label { font-size: 0.7rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 8px; }
.ad-content strong { color: var(--accent); }
.ad-content p { color: var(--text-dim); margin-top: 6px; font-size: 0.9rem; }

/* Feed layout with sidebar */
.feed-layout { position: relative; max-width: 1100px; margin: 0 auto; }
.feed-main { flex: 0 1 600px; min-width: 0; margin: 0 auto; }
.feed-sidebar { width: 200px; flex-shrink: 0; position: absolute; right: -220px; top: 0; }
.sidebar-section { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 16px; position: sticky; top: 76px; }
.sidebar-section h3 { font-size: 0.95rem; margin-bottom: 12px; color: var(--text); }
.friend-item { display: flex; align-items: center; gap: 10px; padding: 8px 0; cursor: pointer; border-bottom: 1px solid var(--border); }
.friend-item:last-child { border-bottom: none; }
.friend-item:hover { opacity: 0.8; }
.friend-item img { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; }
.friend-item span { font-size: 0.85rem; color: var(--text); }
.friend-item .friend-username { color: var(--text-dim); font-size: 0.75rem; }

@media (max-width: 768px) {
  .feed-sidebar { position: static; width: 100%; }
  .feed-layout { flex-direction: column; }
  .feed-sidebar { width: 100%; order: -1; }
  .sidebar-section { position: static; }
}

/* Consent checkbox */
.consent-check { display: flex; align-items: flex-start; gap: 8px; font-size: 0.8rem; color: var(--text-dim); margin-bottom: 16px; cursor: pointer; line-height: 1.4; }
.consent-check input { margin-top: 3px; accent-color: var(--accent); }
.consent-check a { color: var(--accent); }

/* Invites */
.invites-container { max-width: 600px; margin: 40px auto; padding: 0 20px; }
.invites-summary { font-size: 1.1rem; margin-bottom: 20px; padding: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; text-align: center; }
.invite-codes-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.invite-code-card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 16px; display: flex; align-items: center; justify-content: space-between; }
.invite-code { font-size: 1.1rem; letter-spacing: 2px; color: var(--accent); }
.invite-used { padding: 10px 0; border-bottom: 1px solid var(--border); color: var(--text-dim); font-size: 0.9rem; }
.invite-used code { color: var(--text-dim); }
.invite-user { color: var(--accent); cursor: pointer; }
.invite-user:hover { text-decoration: underline; }
