:root {
  --bg: #ffffff;
  --ink: #0f1419;
  --muted: #536471;
  --accent: #1d9bf0;
  --accent-hover: #1a8cd8;
  --line: #eff3f4;
  --hover: #f7f9f9;
  --bubble: #eff3f4;
  --danger: #f4212e;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* top bar */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 0 16px; height: 53px;
  background: rgba(255,255,255,0.85); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  max-width: 600px; margin: 0 auto;
}
.brand { color: var(--accent); font-weight: 800; font-size: 20px; }
.brand:hover { text-decoration: none; }
nav { display: flex; align-items: center; gap: 4px; }
nav a { color: var(--ink); font-weight: 600; padding: 8px 12px; border-radius: 9999px; }
nav a:hover { background: var(--hover); text-decoration: none; }
nav .who { color: var(--muted); font-weight: 400; padding: 0 4px; }

main { max-width: 600px; margin: 0 auto; border-left: 1px solid var(--line);
  border-right: 1px solid var(--line); min-height: calc(100% - 53px); }
.page-title { font-size: 20px; font-weight: 800; padding: 14px 16px; margin: 0;
  position: sticky; top: 53px; background: rgba(255,255,255,0.85); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line); }

/* timeline of posts */
.tweet { display: flex; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line);
  cursor: default; }
.tweet:hover { background: var(--hover); }
.tweet-main { flex: 1; min-width: 0; }
.tweet-head { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.name { font-weight: 700; color: var(--ink); }
.name:hover { text-decoration: underline; }
.dot { color: var(--muted); }
.handle, .time { color: var(--muted); font-weight: 400; }
a.handle:hover { text-decoration: none; }
.tweet-body { margin: 2px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }

.avatar { flex: none; width: 40px; height: 40px; border-radius: 9999px;
  color: #fff; font-weight: 700; font-size: 18px;
  display: flex; align-items: center; justify-content: center; user-select: none; }
.avatar.big { width: 68px; height: 68px; font-size: 30px; }

/* profile */
.profile-head { padding: 16px; border-bottom: 1px solid var(--line); }
.profile-top { display: flex; align-items: flex-start; justify-content: space-between; }
.follow-btn { border: 1px solid #cfd9de; background: var(--ink); color: #fff;
  font-weight: 700; padding: 8px 16px; border-radius: 9999px; }
.profile-head h1 { font-size: 20px; font-weight: 800; margin: 12px 0 0; }
.profile-head .handle { display: block; margin-bottom: 8px; }
.bio { margin: 8px 0; color: var(--ink); }
.contact { color: var(--muted); }
.badge { color: var(--accent); font-size: 15px; margin-left: 4px; }

/* forms (search, login) */
.pad { padding: 16px; }
.search { display: flex; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.search input { flex: 1; }
input { padding: 12px 14px; border-radius: 9999px; border: 1px solid #cfd9de;
  background: var(--bg); color: var(--ink); font-size: 15px; width: 100%; }
input:focus { outline: none; border-color: var(--accent); }
button { padding: 9px 18px; border-radius: 9999px; border: none;
  background: var(--accent); color: #fff; font-size: 15px; font-weight: 700; cursor: pointer; }
button:hover { background: var(--accent-hover); }

.results { width: 100%; border-collapse: collapse; }
.results th, .results td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--line);
  vertical-align: top; }
.results th { color: var(--muted); font-weight: 600; }
.results td { overflow-wrap: anywhere; }
.error { color: var(--danger); padding: 12px 16px; font-family: ui-monospace, Menlo, monospace;
  white-space: pre-wrap; }

.login-wrap { padding: 24px 16px; max-width: 400px; margin: 0 auto; }
.login-form { display: grid; gap: 16px; }
.login-form label { display: grid; gap: 6px; font-weight: 600; }
.login-form button { justify-self: stretch; }

/* messages */
.threads { list-style: none; padding: 0; margin: 0; }
.threads li a { display: flex; align-items: center; gap: 12px; padding: 14px 16px;
  border-bottom: 1px solid var(--line); color: var(--ink); font-weight: 600; }
.threads li a:hover { background: var(--hover); text-decoration: none; }
.threads .muted { padding: 16px; color: var(--muted); }

.dm { padding: 12px 16px; display: flex; flex-direction: column; gap: 4px; }
.back { padding: 12px 16px; display: inline-block; }
.dm-row { display: flex; }
.dm-row.mine { justify-content: flex-end; }
.bubble { max-width: 75%; padding: 10px 14px; border-radius: 20px; background: var(--bubble);
  overflow-wrap: anywhere; }
.dm-row.mine .bubble { background: var(--accent); color: #fff; }
.dm-time { font-size: 12px; color: var(--muted); margin: 2px 4px 8px; }
.dm-row.mine + .dm-time { text-align: right; }

.muted { color: var(--muted); }
.footer { color: var(--muted); font-size: 13px; padding: 20px 16px; border-top: 1px solid var(--line); }

@media (max-width: 620px) {
  main, .topbar { border-left: none; border-right: none; }
}
