:root {
  --bg: #000000;
  --surface: #16181C;
  --elevated: #1D1F23;
  --border: #2F3336;
  --text: #E7E9EA;
  --text-2: #71767B;
  --text-3: #536471;
  --blue: #1D9BF0;
  --blue-hover: #1A8CD8;
  --green: #00BA7C;
  --pink: #F91880;
  --red: #F4212E;
  --gold: #E2B719;
}

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

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 20px;
  -webkit-font-smoothing: antialiased;
}

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

button { font-family: inherit; cursor: pointer; }

.app {
  display: flex;
  justify-content: center;
  width: 100%;
  max-width: 1300px;
  margin: 0 auto;
}

/* ============ LEFT SIDEBAR ============ */
.sidebar-left {
  width: 275px;
  padding: 0 8px;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  flex-shrink: 0;
}
.logo {
  width: 50px; height: 50px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 9999px;
  margin: 4px;
  transition: background-color .2s;
}
.logo:hover { background: rgba(231,233,234,.1); }
.logo svg { width: 30px; height: 30px; fill: var(--text); }

.nav { margin-top: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 20px;
  padding: 12px; margin: 2px 0;
  border-radius: 9999px;
  font-size: 20px; font-weight: 400;
  color: var(--text);
  width: fit-content;
  transition: background-color .2s;
}
.nav-item:hover { background: rgba(231,233,234,.1); text-decoration: none; }
.nav-item.active { font-weight: 700; }
.nav-item svg { width: 26px; height: 26px; fill: currentColor; }

.btn-post {
  background: var(--blue);
  color: #fff;
  font-size: 17px; font-weight: 700;
  height: 52px;
  border: none;
  border-radius: 9999px;
  width: 90%;
  margin: 16px auto;
  display: block;
}
.btn-post:hover { background: var(--blue-hover); }

.me {
  display: flex; align-items: center; gap: 12px;
  padding: 12px; margin-bottom: 12px;
  border-radius: 9999px;
  transition: background-color .2s;
}
.me:hover { background: rgba(231,233,234,.1); cursor: pointer; }
.me .meta { line-height: 18px; }
.me .name { font-weight: 700; }
.me .handle { color: var(--text-2); }
.me .dots { margin-left: auto; color: var(--text); }

/* ============ MAIN FEED ============ */
.main {
  width: 600px;
  min-height: 100vh;
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  flex-shrink: 0;
}
.header {
  position: sticky; top: 0; z-index: 200;
  background: rgba(0,0,0,.65);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.header h1 { font-size: 20px; font-weight: 800; padding: 16px; }
.tabs { display: flex; }
.tab {
  flex: 1; text-align: center;
  padding: 16px 0;
  font-size: 15px; font-weight: 500;
  color: var(--text-2);
  position: relative;
  transition: background-color .2s;
}
.tab:hover { background: rgba(231,233,234,.1); cursor: pointer; }
.tab.active { color: var(--text); font-weight: 700; }
.tab.active::after {
  content: ''; position: absolute; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 56px; height: 4px; background: var(--blue); border-radius: 9999px;
}

/* compose */
.compose {
  display: flex; gap: 12px; padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.compose .avatar { width: 40px; height: 40px; border-radius: 9999px; }
.compose .grow { flex: 1; }
.compose textarea {
  width: 100%; background: transparent; border: none; outline: none;
  color: var(--text); font-size: 20px; font-family: inherit; resize: none;
  padding: 12px 0; min-height: 28px;
}
.compose textarea::placeholder { color: var(--text-2); }
.compose .actions { display: flex; justify-content: space-between; align-items: center; border-top: 1px solid var(--border); padding-top: 12px; }
.compose .icons { display: flex; gap: 8px; color: var(--blue); }
.compose .btn-primary { }

/* post card */
.post-card {
  display: flex; gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  transition: background-color .2s;
  cursor: pointer;
}
.post-card:hover { background: rgba(255,255,255,.03); }
.post-card .avatar { width: 40px; height: 40px; border-radius: 9999px; flex-shrink: 0; }
.post-body { flex: 1; min-width: 0; }
.post-head { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.post-head .name { font-weight: 700; color: var(--text); }
.post-head .handle, .post-head .time { color: var(--text-2); }
.post-head .dot { color: var(--text-2); }
.verified { width: 18px; height: 18px; fill: var(--blue); margin-left: 1px; }
.verified.gold { fill: var(--gold); }
.post-text { margin: 2px 0 12px; color: var(--text); white-space: pre-wrap; word-wrap: break-word; }

.post-actions { display: flex; justify-content: space-between; max-width: 425px; color: var(--text-2); }
.act { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.act .ic { width: 34.75px; height: 34.75px; border-radius: 9999px; display: flex; align-items: center; justify-content: center; transition: background-color .2s, color .2s; margin: -6px; }
.act svg { width: 18px; height: 18px; fill: currentColor; }
.act.reply:hover, .act.reply:hover .ic { color: var(--blue); }
.act.reply:hover .ic { background: rgba(29,155,240,.1); }
.act.repost:hover, .act.repost:hover .ic { color: var(--green); }
.act.repost:hover .ic { background: rgba(0,186,124,.1); }
.act.like:hover, .act.like:hover .ic { color: var(--pink); }
.act.like:hover .ic { background: rgba(249,24,128,.1); }
.act.share:hover, .act.share:hover .ic { color: var(--blue); }
.act.share:hover .ic { background: rgba(29,155,240,.1); }
.act.reposted { color: var(--green); }

/* ============ RIGHT SIDEBAR ============ */
.sidebar-right {
  width: 350px;
  padding: 12px 24px;
  flex-shrink: 0;
}
.search-wrap { position: sticky; top: 0; z-index: 100; background: var(--bg); padding-bottom: 12px; }
.search-box {
  width: 100%; background: #202327; border: 1px solid transparent;
  border-radius: 9999px; padding: 12px 16px 12px 44px;
  font-size: 15px; color: var(--text); outline: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%2371767B' width='18' height='18'%3E%3Cpath d='M10 4a6 6 0 104.472 10.03l4.749 4.75 1.414-1.415-4.75-4.749A6 6 0 0010 4zm-4 6a4 4 0 118 0 4 4 0 01-8 0z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: 14px center;
}
.search-box:focus { background-color: #000; border-color: var(--blue); }

.widget {
  background: var(--surface);
  border-radius: 16px;
  margin-bottom: 16px;
  overflow: hidden;
}
.widget h2 { font-size: 20px; font-weight: 800; padding: 12px 16px; }
.widget-row { padding: 12px 16px; transition: background-color .2s; cursor: pointer; }
.widget-row:hover { background: var(--elevated); }
.widget-row .cat { font-size: 15px; font-weight: 700; }
.widget-row .sub { font-size: 13px; color: var(--text-2); }
.widget-row .num { font-size: 13px; color: var(--text-2); }
.show-more { padding: 12px 16px; color: var(--blue); }
.show-more:hover { background: var(--elevated); cursor: pointer; }

.follow-row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; transition: background-color .2s; }
.follow-row:hover { background: var(--elevated); }
.follow-row .avatar { width: 40px; height: 40px; border-radius: 9999px; }
.follow-row .meta { flex: 1; min-width: 0; line-height: 18px; }
.follow-row .meta .name { font-weight: 700; }
.follow-row .meta .handle { color: var(--text-2); }
.btn-secondary { background: var(--text); color: #000; font-weight: 700; font-size: 14px; padding: 0 16px; height: 32px; border-radius: 9999px; border: none; }
.btn-secondary:hover { opacity: .9; }

/* premium widget */
.premium-widget { padding: 16px; }
.premium-widget h2 { font-size: 20px; font-weight: 800; padding: 0 0 4px; }
.premium-widget p { color: var(--text-2); font-size: 13px; margin-bottom: 12px; }
.btn-primary { background: var(--blue); color: #fff; font-weight: 700; font-size: 15px; padding: 0 16px; height: 36px; border-radius: 9999px; border: none; }
.btn-primary:hover { background: var(--blue-hover); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }

/* newsletter */
.newsletter { padding: 4px 0 24px; }
.newsletter h3 { font-size: 15px; font-weight: 700; margin-bottom: 4px; }
.newsletter p { color: var(--text-2); font-size: 13px; margin-bottom: 8px; }
.newsletter form { display: flex; gap: 8px; }
.newsletter input {
  flex: 1; background: transparent; border: 1px solid #333639; border-radius: 4px;
  padding: 10px 12px; color: var(--text); font-size: 14px; outline: none; min-width: 0;
}
.newsletter input:focus { border-color: var(--blue); box-shadow: 0 0 0 1px var(--blue); }
.newsletter .result { font-size: 12px; color: var(--text-2); margin-top: 8px; white-space: pre-wrap; word-break: break-word; }

.footer-links { padding: 8px 16px; color: var(--text-2); font-size: 13px; }
.footer-links a { color: var(--text-2); margin-right: 12px; }

/* ============ MESSAGES VIEW ============ */
.dm { display: none; }
.dm.open { display: block; }
.dm-list { border-bottom: 1px solid var(--border); }
.dm-convo { display: flex; gap: 12px; padding: 12px 16px; transition: background-color .2s; cursor: pointer; }
.dm-convo:hover { background: var(--elevated); }
.dm-convo.active { background: rgba(29,155,240,.1); border-right: 2px solid var(--blue); }
.dm-convo .avatar { width: 40px; height: 40px; border-radius: 9999px; }
.dm-thread { padding: 16px; display: flex; flex-direction: column; gap: 8px; min-height: 300px; }
.bubble { max-width: 70%; padding: 12px 16px; border-radius: 20px; font-size: 15px; word-wrap: break-word; }
.bubble.them { align-self: flex-start; background: var(--surface); border-bottom-left-radius: 4px; }
.bubble.me { align-self: flex-end; background: var(--blue); color: #fff; border-bottom-right-radius: 4px; }
.bubble .t { display: block; font-size: 11px; color: var(--text-2); margin-top: 4px; }
.bubble.me .t { color: rgba(255,255,255,.7); }
.dm-compose { display: flex; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--border); position: sticky; bottom: 0; background: var(--bg); }
.dm-compose input {
  flex: 1; background: #202327; border: 1px solid transparent; border-radius: 9999px;
  padding: 10px 16px; color: var(--text); font-size: 15px; outline: none;
}
.dm-compose input:focus { background: #000; border-color: var(--blue); }
.dm-send { background: transparent; border: none; color: var(--blue); font-weight: 700; }
.dm-send:disabled { opacity: .5; }

/* categories explore */
.explore { display: none; }
.explore.open { display: block; }
.cat-search { padding: 12px 16px; border-bottom: 1px solid var(--border); }
.cat-search input {
  width: 100%; background: #202327; border: 1px solid transparent; border-radius: 9999px;
  padding: 12px 16px; color: var(--text); font-size: 15px; outline: none;
}
.cat-search input:focus { background: #000; border-color: var(--blue); }
.cat-result { padding: 12px 16px; border-bottom: 1px solid var(--border); transition: background-color .2s; }
.cat-result:hover { background: rgba(255,255,255,.03); }
.cat-result .cat { font-weight: 700; font-size: 15px; }
.cat-result .sub { color: var(--text-2); font-size: 13px; }
.cat-error { padding: 16px; color: var(--red); font-size: 13px; white-space: pre-wrap; }

.hidden { display: none !important; }

/* modal */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(91,112,131,.4);
  display: none; align-items: center; justify-content: center; z-index: 500;
}
.modal-overlay.open { display: flex; }
.modal {
  background: #000; border-radius: 16px; max-width: 420px; width: 90%;
  box-shadow: 0 0 0 1px rgba(255,255,255,.15); padding: 32px;
}
.modal h2 { font-size: 23px; font-weight: 800; margin-bottom: 8px; }
.modal p { color: var(--text-2); margin-bottom: 20px; }
.modal .price { font-size: 31px; font-weight: 800; margin-bottom: 16px; }
.modal .btn-primary { width: 100%; height: 44px; font-size: 15px; }
.modal .close { float: right; color: var(--text); font-size: 20px; cursor: pointer; margin-top: -12px; }
.modal .status { margin-top: 12px; font-size: 13px; color: var(--green); }

@media (max-width: 1100px) {
  .sidebar-right { display: none; }
}
@media (max-width: 700px) {
  .sidebar-left { width: 68px; }
  .sidebar-left .label, .btn-post span { display: none; }
  .me .meta, .me .dots { display: none; }
  .main { width: 100%; }
}

/* ============ PROFILE ============ */
.profile-banner { height: 200px; background: linear-gradient(135deg, #16181C, #2F3336); }
.profile-head { padding: 0 16px 16px; position: relative; }
.profile-head .avatar-profile {
  width: 134px; height: 134px; border-radius: 9999px; border: 4px solid #000;
  object-fit: cover; margin-top: -67px; background: #16181C;
}
.profile-name { font-size: 20px; font-weight: 800; margin-top: 12px; display: flex; align-items: center; gap: 4px; }
.profile-handle { color: var(--text-2); font-size: 15px; }
.profile-bio { margin: 12px 0; font-size: 15px; }
.profile-meta { color: var(--text-2); font-size: 15px; margin-bottom: 12px; }
.profile-stats { display: flex; gap: 20px; font-size: 14px; color: var(--text-2); }
.profile-stats b { color: var(--text); }
.profile-flag {
  margin-top: 16px; padding: 12px 16px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  color: var(--gold); font-size: 14px; word-break: break-word;
}
