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

:root {
  --bg: #000;
  --surface: #0f0f0f;
  --border: #2f3336;
  --text: #e7e9ea;
  --text-secondary: #71767b;
  --accent: #1d9bf0;
  --accent-hover: #1a8cd8;
  --danger: #f4212e;
}

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ── Auth ── */
.auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
}

.auth-card {
  width: 400px;
  padding: 48px 40px;
  background: #0f0f0f;
  border: 1px solid var(--border);
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.auth-logo {
  font-size: 36px;
  font-weight: 900;
  text-align: center;
  color: var(--text);
}

.auth-title {
  font-size: 24px;
  font-weight: 700;
  text-align: center;
}

.tab-row {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
}

.tab {
  flex: 1;
  padding: 12px;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
  margin-bottom: -1px;
}
.tab.active { color: var(--text); border-bottom-color: var(--accent); }
.tab:hover { background: rgba(255,255,255,0.03); }

#auth-form { display: flex; flex-direction: column; gap: 12px; }

.input {
  width: 100%;
  padding: 14px 16px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  outline: none;
  transition: border-color 0.2s;
}
.input:focus { border-color: var(--accent); }
.input::placeholder { color: var(--text-secondary); }

.error-msg {
  font-size: 13px;
  color: var(--danger);
  padding: 10px 14px;
  background: rgba(244,33,46,0.1);
  border-radius: 8px;
  border: 1px solid rgba(244,33,46,0.2);
}

.btn-primary {
  padding: 14px;
  background: var(--text);
  color: #000;
  border: none;
  border-radius: 50px;
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.2s;
  margin-top: 4px;
}
.btn-primary:hover { opacity: 0.85; }

/* ── App Layout ── */
.app-screen {
  display: flex;
  min-height: 100vh;
  max-width: 1000px;
  margin: 0 auto;
}

/* Sidebar */
.sidebar {
  width: 260px;
  flex-shrink: 0;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-right: 1px solid var(--border);
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-logo {
  font-size: 28px;
  font-weight: 900;
  padding: 8px 12px;
  width: fit-content;
}

.sidebar-nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  border-radius: 50px;
  text-decoration: none;
  color: var(--text);
  font-size: 18px;
  font-weight: 400;
  transition: background 0.15s;
}
.nav-item svg { width: 24px; height: 24px; flex-shrink: 0; }
.nav-item:hover { background: rgba(255,255,255,0.07); }
.nav-item.active { font-weight: 700; }

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 50px;
  cursor: default;
  margin-top: auto;
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  flex-shrink: 0;
  color: #fff;
}

.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-display { font-size: 14px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-username { font-size: 13px; color: var(--text-secondary); }

.logout-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 6px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  transition: background 0.15s, color 0.15s;
}
.logout-btn:hover { background: rgba(244,33,46,0.1); color: var(--danger); }
.logout-btn svg { width: 18px; height: 18px; }

/* Main */
.main { flex: 1; border-right: 1px solid var(--border); min-width: 0; }

.main-header {
  position: sticky;
  top: 0;
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(12px);
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  z-index: 10;
}
.main-header h2 { font-size: 20px; font-weight: 700; }

/* Composer */
.composer {
  display: flex;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.composer-avatar { width: 40px; height: 40px; flex-shrink: 0; }

.composer-body { flex: 1; display: flex; flex-direction: column; gap: 12px; }

textarea {
  width: 100%;
  background: transparent;
  border: none;
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-size: 18px;
  resize: none;
  outline: none;
  line-height: 1.5;
  min-height: 54px;
}
textarea::placeholder { color: var(--text-secondary); }

.composer-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.char-count {
  font-size: 13px;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}
.char-count.warn { color: #ffd400; }
.char-count.danger { color: var(--danger); }

.btn-post {
  padding: 8px 20px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 50px;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-post:hover:not(:disabled) { background: var(--accent-hover); }
.btn-post:disabled { opacity: 0.5; cursor: default; }

/* Feed */
.feed { display: flex; flex-direction: column; }

.post-card {
  display: flex;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
  animation: fade-in 0.25s ease;
}
.post-card:hover { background: rgba(255,255,255,0.02); }
@keyframes fade-in { from { opacity:0; transform:translateY(-4px); } to { opacity:1; transform:translateY(0); } }

.post-avatar { width: 40px; height: 40px; flex-shrink: 0; }

.post-body { flex: 1; min-width: 0; }

.post-header {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 4px;
  flex-wrap: wrap;
}
.post-display { font-size: 15px; font-weight: 700; }
.post-username { font-size: 14px; color: var(--text-secondary); }
.post-dot { color: var(--text-secondary); font-size: 12px; }
.post-time { font-size: 13px; color: var(--text-secondary); }

.post-content {
  font-size: 15px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

.post-actions {
  display: flex;
  gap: 20px;
  margin-top: 10px;
}

.action-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 0;
  transition: color 0.15s;
}
.action-btn.delete:hover { color: var(--danger); }
.action-btn svg { width: 16px; height: 16px; }

/* Loading */
.loading-posts {
  display: flex;
  justify-content: center;
  padding: 48px;
}
.mini-spinner {
  width: 28px; height: 28px;
  border: 2px solid rgba(255,255,255,0.1);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.empty-feed {
  text-align: center;
  padding: 64px 20px;
  color: var(--text-secondary);
  font-size: 15px;
}
