/* mewter — dark theme */

:root {
  --bg: #000;
  --hover: #16181c;
  --solid: #16181c;
  --text: #e7e9ea;
  --muted: #71767b;
  --accent: #1d9bf0;
  --accent-hover: #1a8cd8;
  --pink: #f91880;
  --green: #00ba7c;
  --border: #2f3336;
  --danger: #f4212e;
  --input-bg: #202327;
}

* { box-sizing: border-box; }

html { height: 100%; }

body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

button { font: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: none; }
h1, h2, h3 { margin: 0; }
::selection { background: rgba(29, 155, 240, .35); }

::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-thumb { background: #333639; border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }

.muted { color: var(--muted); }

/* ---------- icons ---------- */

.icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  display: block;
}

/* ---------- buttons ---------- */

.btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 9999px;
  padding: 10px 20px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s ease, opacity .15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:disabled { opacity: .45; cursor: default; }
.btn-primary:disabled:hover { background: var(--accent); }

.btn-outline {
  background: none;
  border: 1px solid var(--muted);
  color: var(--text);
  border-radius: 9999px;
  padding: 8px 16px;
  font-weight: 700;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.btn-outline:hover { border-color: var(--text); }

.btn-ghost {
  background: none;
  border: none;
  color: var(--accent);
  padding: 10px 18px;
  border-radius: 9999px;
  font-weight: 700;
  cursor: pointer;
}
.btn-ghost:hover { background: rgba(29, 155, 240, .1); }

.btn-follow {
  background: var(--accent);
  color: #fff;
  border: 1px solid var(--accent);
  border-radius: 9999px;
  padding: 8px 18px;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.btn-follow:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-follow.is-following { background: none; border-color: var(--muted); color: var(--text); }
.btn-follow.is-following:hover {
  border-color: var(--danger);
  color: var(--danger);
  background: rgba(244, 33, 46, .1);
}
.btn-follow.small { padding: 6px 14px; font-size: 14px; }

.icon-btn {
  background: none;
  border: none;
  color: var(--text);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background .15s ease;
}
.icon-btn:hover { background: var(--hover); }

/* ---------- avatars ---------- */

.avatar {
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  user-select: none;
  line-height: 1;
}
.avatar.md { width: 46px; height: 46px; font-size: 26px; }
.avatar.sm { width: 34px; height: 34px; font-size: 19px; }
.avatar.xl { width: 110px; height: 110px; font-size: 58px; border: 4px solid var(--bg); }

/* ---------- auth ---------- */

.auth-wrap {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.auth-card { width: 100%; max-width: 400px; }
.wordmark { font-size: 22px; font-weight: 800; letter-spacing: -.4px; color: var(--text); }
.wordmark.big { font-size: 30px; text-align: center; margin-bottom: 4px; }
.auth-sub { text-align: center; color: var(--muted); margin: 0 0 20px; font-size: 14px; }
.auth-foot { color: var(--muted); font-size: 13px; margin-top: 18px; text-align: center; }

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 18px;
}
.tab {
  padding: 11px;
  border-radius: 9999px;
  border: 1px solid var(--border);
  background: none;
  cursor: pointer;
  font-weight: 600;
  transition: background .15s ease, border-color .15s ease;
}
.tab:hover { background: var(--hover); }
.tab.active { background: var(--accent); border-color: var(--accent); color: #fff; }

.field { margin-bottom: 14px; display: grid; gap: 6px; }
.field > label { font-size: 14px; color: var(--muted); }
.field input,
.field textarea {
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  color: var(--text);
  font: inherit;
  width: 100%;
  resize: vertical;
  transition: border-color .15s ease;
}
.field input:focus,
.field textarea:focus { outline: none; border-color: var(--accent); }
.field .hint { font-size: 12px; color: var(--muted); }

.auth-error {
  background: rgba(244, 33, 46, .08);
  border: 1px solid rgba(244, 33, 46, .45);
  color: #fca5a5;
  border-radius: 12px;
  padding: 10px 14px;
  margin-bottom: 14px;
  font-size: 14px;
}

/* emoji picker */
.emoji-picker { display: flex; gap: 6px; flex-wrap: wrap; }
.emoji-opt {
  font-size: 24px;
  background: none;
  border: 2px solid transparent;
  border-radius: 10px;
  padding: 5px 7px;
  cursor: pointer;
  transition: border-color .12s ease, background .12s ease;
  line-height: 1.2;
}
.emoji-opt:hover { background: var(--hover); }
.emoji-opt.sel { border-color: var(--accent); background: rgba(29, 155, 240, .12); }

/* ---------- layout ---------- */

.layout {
  max-width: 1265px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 275px minmax(0, 600px) 350px;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px 16px;
}
.sidebar .wordmark {
  display: inline-block;
  padding: 12px 16px;
  font-size: 24px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 12px 16px;
  border-radius: 9999px;
  color: var(--text);
  font-size: 19px;
  transition: background .15s ease;
}
.nav-item:hover { background: var(--hover); }
.nav-item .icon { width: 26px; height: 26px; }
.nav-item.active { font-weight: 800; }

.new-mew {
  width: 92%;
  margin: 14px auto 0;
  padding: 15px 0;
  font-size: 17px;
}

.sidebar-foot { margin-top: auto; }
.user-chip-wrap { position: relative; }
.user-chip {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  background: none;
  border: none;
  padding: 10px 12px;
  border-radius: 16px;
  cursor: pointer;
  text-align: left;
  transition: background .15s ease;
}
.user-chip:hover { background: var(--hover); }
.chip-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.chip-text b { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip-text span { font-size: 14px; }
.user-chip .icon { width: 16px; height: 16px; color: var(--muted); }

.main {
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  min-height: 100vh;
  min-height: 100dvh;
}

.main-head {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 16px;
  background: rgba(0, 0, 0, .65);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.main-head h1 { font-size: 20px; font-weight: 800; }
.main-head .count-pill { color: var(--muted); font-size: 13px; font-weight: 600; }

.rail { padding: 12px 24px 24px; }
.rail-sticky {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-height: 100vh;
  max-height: 100dvh;
  overflow-y: auto;
  scrollbar-width: none;
  padding-bottom: 16px;
}
.rail-sticky::-webkit-scrollbar { display: none; }

/* search box */
.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--input-bg);
  border: 1px solid transparent;
  border-radius: 9999px;
  padding: 10px 16px;
  transition: border-color .15s ease, background .15s ease;
}
.search-box:focus-within { border-color: var(--accent); background: #000; }
.search-box .icon { width: 18px; height: 18px; color: var(--muted); }
.search-box input {
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font: inherit;
  width: 100%;
  padding: 0;
}
.search-box input::placeholder { color: var(--muted); }
.search { display: block; }

/* rail cards */
.rail-card {
  background: var(--solid);
  border-radius: 16px;
  overflow: hidden;
}
.rail-title { font-size: 20px; font-weight: 800; padding: 14px 16px 8px; }
.rail-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 16px;
  cursor: pointer;
  transition: background .15s ease;
}
.rail-row:hover { background: rgba(255, 255, 255, .04); }
.trend-meta { flex: 1; min-width: 0; }
.trend-meta .tag { font-weight: 700; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.trend-meta .sub { font-size: 13px; color: var(--muted); }
.wtw-text { flex: 1; min-width: 0; }
.wtw-text b { display: block; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wtw-text span { font-size: 13px; color: var(--muted); }

/* ---------- composer ---------- */

.composer {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
}
.composer-box { border-bottom: 1px solid var(--border); }
.composer-main { flex: 1; min-width: 0; }
.composer textarea {
  width: 100%;
  background: none;
  border: none;
  outline: none;
  resize: none;
  color: var(--text);
  font: inherit;
  line-height: 1.5;
  padding: 8px 0 4px;
  overflow-y: auto;
  max-height: 220px;
}
.composer textarea::placeholder { color: var(--muted); }
.composer-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 6px;
  border-top: 1px solid var(--border);
}
.counter { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.counter.over { color: var(--danger); font-weight: 800; }

/* ---------- feed / tweets ---------- */

.feed { padding: 10px 0 20px; }
.feed-item { animation: fadeIn .18s ease; }

.tweet {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 8px 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: transparent;
  transition: background .13s ease;
}
.tweet:hover { background: var(--hover); }
.tweet-body { display: flex; gap: 12px; cursor: pointer; }
.tweet-main { flex: 1; min-width: 0; }
.tweet-head {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px;
  font-size: 15px;
}
.tweet-head .name { font-weight: 800; color: var(--text); }
.tweet-head .name:hover { text-decoration: underline; }
.tweet-head .handle,
.tweet-head .dot,
.tweet-head .time { color: var(--muted); font-size: 14px; }
.tweet-text {
  margin-top: 2px;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  word-break: break-word;
}

.repost-line {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 16px 0;
  color: var(--muted);
  font-size: 14px;
}
.repost-line .icon { width: 16px; height: 16px; color: var(--green); margin-right: 2px; }

/* actions */
.tweet-actions {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 430px;
  margin-left: 58px;
}
.taction {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  padding: 7px 8px;
  border-radius: 9999px;
  transition: color .13s ease, background .13s ease;
}
.taction .icon { width: 18px; height: 18px; }
.taction .count { font-variant-numeric: tabular-nums; }
.taction.reply:hover { color: var(--accent); }
.taction.reply:hover svg { fill: rgba(29, 155, 240, .1); }
.taction.repost:hover { color: var(--green); }
.taction.repost.on { color: var(--green); }
.taction.like:hover { color: var(--pink); }
.taction.like:hover svg { fill: rgba(249, 24, 128, .1); }
.taction.like.on { color: var(--pink); }
.taction.like.on .icon { fill: var(--pink); }
.taction.more { padding: 7px; }
.taction.more:hover { color: var(--accent); background: rgba(29, 155, 240, .1); }

@keyframes heartPop {
  0% { transform: scale(1); }
  40% { transform: scale(1.45); }
  100% { transform: scale(1); }
}
.taction.like.pop .icon { animation: heartPop .35s cubic-bezier(.2, .8, .3, 1.2); }

/* feed more / empty / loading */
.feed-more { display: flex; justify-content: center; padding: 4px 0 32px; }
.empty {
  padding: 56px 24px;
  text-align: center;
  color: var(--muted);
  font-size: 15px;
}
.empty .big { font-size: 34px; display: block; margin-bottom: 10px; }
.loading {
  padding: 48px 24px;
  text-align: center;
  color: var(--muted);
  animation: pulse 1.2s ease infinite;
}
@keyframes pulse { 50% { opacity: .45; } }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } }

/* ---------- dropdown menu ---------- */

.menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  min-width: 200px;
  background: var(--solid);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 6px;
  z-index: 60;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .6);
  animation: menuIn .12s ease;
}
@keyframes menuIn { from { opacity: 0; transform: translateY(-4px); } }
.menu-item {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 12px 14px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 15px;
  white-space: nowrap;
}
.menu-item:hover { background: rgba(255, 255, 255, .05); }
.menu-item.danger { color: var(--danger); font-weight: 700; }
.menu-hr { border: none; border-top: 1px solid var(--border); margin: 6px 4px; }
.menu-label { padding: 8px 14px 4px; font-size: 13px; color: var(--muted); }

/* ---------- explore ---------- */

.explore-search { padding: 12px 16px 4px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px 16px 16px; }
.chip {
  background: var(--solid);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 9999px;
  padding: 8px 14px;
  cursor: pointer;
  font-size: 14px;
  transition: border-color .13s ease, color .13s ease;
}
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip .muted { font-weight: 600; }
.page-sub { font-size: 16px; font-weight: 800; padding: 14px 16px 4px; }

/* ---------- notifications ---------- */

.notif {
  display: flex;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background .13s ease;
}
.notif:hover { background: var(--hover); }
.notif-main { flex: 1; min-width: 0; }
.notif-line { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.notif-line .time { margin-left: auto; font-size: 13px; color: var(--muted); }
.notif-quote { color: var(--muted); margin-top: 4px; overflow-wrap: break-word; }

/* ---------- profile ---------- */

.profile-banner { height: 160px; }
.profile-head { padding: 0 16px 14px; }
.profile-top {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-top: -54px;
  gap: 12px;
}
.profile-name { font-size: 19px; font-weight: 800; margin-top: 10px; }
.profile-handle { color: var(--muted); font-size: 15px; }
.profile-bio { margin-top: 10px; white-space: pre-wrap; overflow-wrap: break-word; }
.profile-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; color: var(--muted); font-size: 14px; margin-top: 10px; }
.profile-counts { display: flex; gap: 18px; margin-top: 10px; font-size: 14px; }
.profile-counts b { color: var(--text); font-size: 15px; }
.profile-actions { display: flex; gap: 8px; }

/* edit profile */
.edit-form {
  margin: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--hover);
  padding: 18px;
  display: grid;
  gap: 16px;
  animation: fadeIn .15s ease;
}
.edit-form .field { margin: 0; }
.edit-form label.title { font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.edit-actions { display: flex; gap: 8px; justify-content: flex-end; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  padding: 0;
  transition: transform .1s ease;
}
.swatch:hover { transform: scale(1.1); }
.swatch.sel { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--text); }

/* ---------- tweet detail ---------- */

.replying-note { padding: 12px 16px 0; font-size: 14px; color: var(--muted); }
.reply-box { border-bottom: 1px solid var(--border); }
.replies { padding-bottom: 32px; }

/* ---------- toast ---------- */

#toast {
  position: fixed;
  bottom: 76px;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: #22262b;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 20px;
  border-radius: 9999px;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
  z-index: 100;
  max-width: 90vw;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- mobile ---------- */

.bottom-bar { display: none; }

@media (max-width: 900px) {
  .layout { grid-template-columns: 240px minmax(0, 1fr); }
  .rail { display: none; }
}

@media (max-width: 767px) {
  .layout { grid-template-columns: 1fr; max-width: none; }
  .sidebar { display: none; }
  .main { border: none; min-height: 100dvh; padding-bottom: 64px; }
  .tweet-actions { margin-left: 0; }
  #toast { bottom: 76px; }
  .bottom-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 58px;
    background: rgba(0, 0, 0, .92);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-top: 1px solid var(--border);
    display: flex;
    z-index: 50;
  }
  .btab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    color: var(--muted);
    font-size: 10px;
    border: none;
    background: none;
    cursor: pointer;
  }
  .btab.active { color: var(--text); }
  .btab .icon { width: 24px; height: 24px; }
}
