/* ============ Cash Bot — X clone ============ */
:root {
  --text: #0F1419;
  --muted: #536471;
  --border: #EFF3F4;
  --banner: #CFD9DE;
  --blue: #1D9BF0;
  --green: #00BA7C;
  --red: #F4212E;
  --dot: #829AAB;
  --hover: rgba(15, 20, 25, 0.03);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { height: 100%; }
body {
  font-family: var(--font);
  color: var(--text);
  background: #fff;
  min-height: 100%;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
button { font-family: var(--font); background: none; border: none; cursor: pointer; color: inherit; }
a { cursor: pointer; text-decoration: none; color: inherit; }
input { font-family: var(--font); }

body.shake { animation: shake 0.55s linear; }
@keyframes shake {
  0%, 100% { transform: translate(0, 0); }
  10% { transform: translate(-8px, 4px) rotate(-0.4deg); }
  25% { transform: translate(7px, -5px) rotate(0.5deg); }
  40% { transform: translate(-6px, 6px); }
  55% { transform: translate(6px, 3px) rotate(-0.3deg); }
  70% { transform: translate(-4px, -4px); }
  85% { transform: translate(3px, 2px); }
}

/* ============ ticker ============ */
.ticker {
  position: sticky; top: 0; z-index: 60;
  background: #0F1419; color: #fff;
  height: 26px; overflow: hidden;
  font-size: 12px; line-height: 26px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  cursor: default;
}
.ticker-track {
  display: inline-block; white-space: nowrap;
  animation: tick 30s linear infinite;
  will-change: transform;
}
.ticker:hover .ticker-track { animation-play-state: paused; }
@keyframes tick { from { transform: translateX(0); } to { transform: translateX(-50%); } }
.ticker b { color: #7CFFB2; font-weight: 600; }
.ticker .tick-red { color: #FF8A8A; }

/* ============ layout ============ */
.layout {
  display: flex;
  justify-content: center;
  max-width: 1310px;
  margin: 0 auto;
}

/* ============ left nav ============ */
.nav { width: 275px; flex-shrink: 0; }
.nav-inner {
  position: sticky; top: 26px;
  height: calc(100vh - 26px);
  display: flex; flex-direction: column;
  padding: 0 8px;
  overflow-y: auto;
  scrollbar-width: none;
}
.nav-inner::-webkit-scrollbar { display: none; }
.nav-logo {
  width: 50px; height: 50px; margin: 2px 0 2px 2px;
  border-radius: 9999px;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.2s, transform 0.5s cubic-bezier(0.2, 0.9, 0.3, 1.4);
}
.nav-logo:hover { background: var(--hover); }
.nav-logo.spin { transform: rotate(360deg) scale(1.15); }
.nav-item {
  display: flex; align-items: center; gap: 16px;
  padding: 10px 12px; margin: 1px 0;
  border-radius: 9999px;
  font-size: 20px; line-height: 24px;
  width: fit-content;
  transition: background 0.15s;
  user-select: none;
}
.nav-item:hover { background: rgba(15, 20, 25, 0.07); }
.nav-item:active { transform: scale(0.97); }
.nav-item svg { width: 26px; height: 26px; flex-shrink: 0; }
.badge-anchor { position: relative; display: flex; flex-shrink: 0; }
.notif-badge {
  position: absolute; top: -5px; left: 11px;
  background: var(--blue); color: #fff;
  font-size: 10.5px; font-weight: 700; line-height: 1;
  padding: 3px 5px; border-radius: 9999px;
  border: 1px solid #fff;
}
.post-btn {
  margin: 14px 0 6px;
  width: 90%; height: 52px;
  border-radius: 9999px;
  background: #0F1419; color: #fff;
  font-size: 17px; font-weight: 700;
  transition: transform 0.1s, background 0.2s;
}
.post-btn-icon { display: none; }
.post-btn:hover { background: #272c30; }
.post-btn:active { transform: scale(0.97); }
.account-chip {
  margin-top: auto; margin-bottom: 12px;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 9999px;
  transition: background 0.15s;
  text-align: left;
}
.account-chip:hover { background: rgba(15, 20, 25, 0.07); }
.account-av {
  width: 40px; height: 40px; border-radius: 9999px;
  background: linear-gradient(135deg, #1a1f26, #3c4652);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; flex-shrink: 0;
}
.account-meta { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.account-name { font-size: 15px; font-weight: 700; display: flex; align-items: center; gap: 2px; white-space: nowrap; }
.blue-check { width: 18px; height: 18px; }
.account-handle { font-size: 15px; color: var(--muted); }
.account-dots { color: var(--text); flex-shrink: 0; }

/* ============ center column ============ */
.timeline {
  width: 600px; max-width: 600px; flex-shrink: 0;
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  min-height: 100vh;
  position: relative;
}
.tl-header {
  position: sticky; top: 26px; z-index: 40;
  height: 53px;
  display: flex; align-items: center; gap: 12px;
  padding: 0 16px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.icon-btn {
  width: 36px; height: 36px; border-radius: 9999px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s;
}
.icon-btn:hover { background: rgba(15, 20, 25, 0.1); }
.tl-header-title { flex: 1; min-width: 0; }
.tl-header-name {
  display: flex; align-items: center; gap: 3px;
  font-size: 20px; font-weight: 700; line-height: 24px;
}
.gold-check { width: 20px; height: 20px; flex-shrink: 0; }
.gold-check.lg { width: 22px; height: 22px; }
.xai-badge {
  width: 17px; height: 17px; border-radius: 4px;
  border: 1px solid var(--banner);
  margin-left: 4px;
  cursor: pointer;
}
.xai-badge.lg { width: 20px; height: 20px; }
.tl-header-sub { font-size: 13px; line-height: 16px; color: var(--muted); }

.banner {
  height: 200px;
  background: var(--banner);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

/* profile */
.profile { padding: 12px 16px 0; margin-bottom: 16px; }
.profile-row { display: flex; justify-content: space-between; align-items: flex-start; }
.avatar-wrap {
  width: 141px; height: 141px;
  margin-top: -76px;
  border-radius: 18px;
  background: #fff;
  padding: 4px;
  cursor: pointer;
  position: relative;
}
.avatar {
  width: 100%; height: 100%;
  border-radius: 14px;
  display: block;
  box-shadow: inset 0 0 2px rgba(0, 0, 0, 0.03);
  transition: transform 0.2s;
}
.avatar-wrap:active .avatar { transform: scale(0.96); }
.extra-tear {
  position: absolute;
  width: 7px; height: 11px;
  border-radius: 50% 50% 60% 60%;
  background: linear-gradient(160deg, #fff, #aebfca 55%, #dfe9ef);
  border: 1px solid rgba(95, 114, 128, 0.35);
  pointer-events: none;
  animation: tear-fall linear forwards;
}
@keyframes tear-fall {
  from { transform: translateY(0) scale(0.7); opacity: 0; }
  15% { opacity: 1; }
  to { transform: translateY(120px) scale(1.1); opacity: 0; }
}
.profile-actions { display: flex; gap: 8px; margin-top: 12px; align-items: center; position: relative; }
.round-btn {
  width: 36px; height: 36px; border-radius: 9999px;
  border: 1px solid var(--banner);
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s;
}
.round-btn:hover { background: var(--hover); }
.follow-btn {
  height: 36px; padding: 0 16px;
  border-radius: 9999px;
  background: #0F1419; color: #fff;
  font-size: 15px; font-weight: 700;
  transition: background 0.2s, transform 0.1s;
}
.follow-btn:hover { background: #272c30; }
.follow-btn:active { transform: scale(0.96); }
.follow-btn.following { background: #fff; color: var(--text); border: 1px solid var(--banner); }
.follow-btn.following:hover { background: #fde8e9; color: var(--red); border-color: #f8c4c8; }

.profile-id { margin-top: 6px; }
.profile-name {
  display: flex; align-items: center; gap: 3px;
  font-size: 20px; line-height: 24px; font-weight: 800;
}
.profile-handle { font-size: 15px; line-height: 20px; color: var(--muted); }
.profile-bio { font-size: 15px; line-height: 20px; margin-top: 12px; }
.profile-meta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 12px; color: var(--muted); font-size: 15px; }
.meta-item { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; }
.meta-item svg { width: 18.75px; height: 18.75px; }
.profile-counts { display: flex; gap: 20px; margin-top: 12px; font-size: 15px; line-height: 20px; color: var(--muted); }
.count-item { cursor: pointer; }
.count-item:hover { text-decoration: underline; }
.count-item b { color: var(--text); font-weight: 700; }
.profile-social { margin-top: 12px; font-size: 13px; line-height: 16px; color: var(--muted); }

/* CA as native profile link + pinned-post mono */
.meta-item.ca-link { color: var(--blue); }
.meta-item.ca-link:hover { text-decoration: underline; }
.ca-mono {
  display: inline-block;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 14px; line-height: 19px;
  word-break: break-all;
  cursor: pointer;
  border-radius: 4px;
  padding: 1px 2px;
  margin: 0 -2px;
  transition: background 0.15s;
}
.ca-mono:hover { background: var(--border); }

/* tabs */
.tabs { display: flex; border-bottom: 1px solid var(--border); }
.tab {
  flex: 1; height: 53px;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 500; color: var(--muted);
  position: relative;
  transition: background 0.15s;
}
.tab:hover { background: var(--hover); }
.tab.active { font-weight: 700; color: var(--text); }
.tab i {
  display: none;
  position: absolute; bottom: 0;
  width: 56px; height: 4px;
  border-radius: 9999px;
  background: var(--blue);
}
.tab.active i { display: block; }

/* panels */
.panel { display: none; }
.panel.active { display: block; }

/* ============ chat ============ */
#panel-chat { position: relative; min-height: 420px; }
#panel-chat.active { display: flex; flex-direction: column; }
.chat-hero { padding: 32px 32px 8px; max-width: 400px; margin: 0 auto; text-align: left; width: 100%; }
.chat-hero.gone { display: none; }
.chat-hero h1 { font-size: 31px; line-height: 36px; font-weight: 800; margin-bottom: 8px; }
.chat-hero p { font-size: 15px; line-height: 20px; color: var(--muted); }
.chat-feed { flex: 1 1 auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; overflow-y: auto; }
/* once messages exist the feed grows with its content up to a cap, then scrolls
   internally — the newest message stays inside it and the page never chases the stream */
.chat-feed:not(:empty) { flex: 0 0 auto; max-height: min(58vh, 560px); }
.msg { max-width: 78%; font-size: 15px; line-height: 20px; animation: msg-in 0.18s ease-out; }
@keyframes msg-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.msg.user {
  align-self: flex-end;
  background: var(--blue); color: #fff;
  padding: 10px 14px;
  border-radius: 18px 18px 2px 18px;
}
.msg.bot { align-self: flex-start; display: flex; gap: 10px; }
.msg.bot .bot-av {
  width: 36px; height: 36px; border-radius: 9px;
  flex-shrink: 0;
  border: 1px solid var(--border);
}
.msg.bot .bot-body { min-width: 0; }
.msg.bot .bot-name { font-size: 13px; color: var(--muted); margin-bottom: 2px; display: flex; align-items: center; gap: 3px; }
.msg.bot .bot-name b { color: var(--text); font-weight: 700; }
.msg.bot .bot-name .gold-check { width: 14px; height: 14px; }
.msg.bot .bot-text {
  background: var(--border);
  padding: 10px 14px;
  border-radius: 2px 18px 18px 18px;
  white-space: pre-wrap;
  word-break: break-word;
}
.msg.bot .bot-text .cursor {
  display: inline-block; width: 2px; height: 15px;
  background: var(--text); vertical-align: text-bottom;
  animation: blink 0.8s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }
.thinking { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); font-style: italic; }
.thinking .dots { display: inline-flex; gap: 3px; }
.thinking .dots span {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--muted);
  animation: bounce 1.2s infinite;
}
.thinking .dots span:nth-child(2) { animation-delay: 0.15s; }
.thinking .dots span:nth-child(3) { animation-delay: 0.3s; }
@keyframes bounce { 0%, 60%, 100% { transform: translateY(0); opacity: 0.4; } 30% { transform: translateY(-4px); opacity: 1; } }

.chat-suggest { display: flex; flex-wrap: wrap; gap: 8px; padding: 4px 16px 12px; }
.chip {
  border: 1px solid var(--banner);
  border-radius: 9999px;
  padding: 7px 14px;
  font-size: 14px; font-weight: 500;
  transition: background 0.15s, transform 0.1s;
}
.chip:hover { background: var(--hover); }
.chip:active { transform: scale(0.95); }
.chat-composer { padding: 8px 16px 20px; border-top: 1px solid var(--border); background: #fff; position: sticky; bottom: 0; }
.chat-input-wrap {
  display: flex; align-items: center; gap: 4px;
  background: var(--border);
  border-radius: 9999px;
  padding: 4px 6px 4px 18px;
  border: 1px solid transparent;
  transition: border-color 0.15s, background 0.15s;
}
.chat-input-wrap:focus-within { border-color: var(--blue); background: #fff; }
#chatInput { flex: 1; border: none; outline: none; background: transparent; font-size: 15px; height: 38px; color: var(--text); }
#chatInput::placeholder { color: var(--muted); }
#chatSend {
  width: 36px; height: 36px; border-radius: 9999px;
  display: flex; align-items: center; justify-content: center;
  color: var(--blue);
  transition: background 0.15s, opacity 0.15s;
}
#chatSend:hover { background: rgba(29, 155, 240, 0.1); }
#chatSend:disabled { opacity: 0.4; cursor: default; }

/* ============ posts ============ */
.repost-line {
  display: flex; align-items: center; gap: 6px;
  padding: 10px 16px 0 42px;
  font-size: 13px; font-weight: 700; color: var(--muted);
}
.repost-line svg { width: 16px; height: 16px; }
.repost-line + .reply { padding-top: 6px; }
.reply { display: flex; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); cursor: pointer; transition: background 0.15s; }
.reply:hover { background: rgba(0, 0, 0, 0.015); }
.reply-av {
  width: 40px; height: 40px; border-radius: 9999px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; color: #fff;
  overflow: hidden;
}
.reply-av img { width: 100%; height: 100%; object-fit: cover; display: block; }
.reply-body { flex: 1; min-width: 0; }
.reply-head { font-size: 15px; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.reply-head b { font-weight: 700; }
.reply-head span { color: var(--muted); }
.reply-text { font-size: 15px; line-height: 20px; margin-top: 2px; white-space: pre-wrap; }
.reply-img { margin-top: 10px; border-radius: 16px; border: 1px solid var(--border); overflow: hidden; display: block; }
.reply-img svg { display: block; width: 100%; height: auto; }
.reply-actions { display: flex; justify-content: space-between; max-width: 420px; margin-top: 10px; color: var(--muted); font-size: 13px; }
.r-act { display: flex; align-items: center; gap: 5px; border-radius: 9999px; padding: 4px 8px; transition: background 0.15s, color 0.15s; }
.r-act svg { width: 17px; height: 17px; }
.r-act:hover { background: rgba(29, 155, 240, 0.1); color: var(--blue); }
.r-act.liked { color: var(--red); }
.r-act.liked:hover { background: rgba(244, 33, 46, 0.1); color: var(--red); }
.r-act.rted { color: var(--green); }

/* ============ sidebar ============ */
.sidebar { width: 350px; flex-shrink: 0; margin-left: 30px; padding-bottom: 60px; }
.search-wrap { position: sticky; top: 26px; z-index: 45; padding: 6px 0; background: #fff; }
.search-bar {
  display: flex; align-items: center; gap: 10px;
  height: 42px;
  border: 1px solid var(--banner);
  border-radius: 9999px;
  padding: 0 16px;
  background: #fff;
  transition: border-color 0.15s;
}
.search-bar:focus-within { border-color: var(--blue); }
#searchInput { flex: 1; border: none; outline: none; font-size: 15px; color: var(--text); background: transparent; }
#searchInput::placeholder { color: #757575; }
.search-drop {
  display: none;
  position: absolute; top: 54px; left: 0; right: 0;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 0 15px rgba(101, 119, 134, 0.2), 0 0 3px 1px rgba(101, 119, 134, 0.15);
  padding: 12px 0;
  font-size: 14px;
  max-height: 400px; overflow-y: auto;
}
.search-drop.open { display: block; }
.search-drop .sd-row { padding: 10px 16px; cursor: pointer; }
.search-drop .sd-row:hover { background: var(--hover); }
.search-drop .sd-note { padding: 10px 16px; color: var(--muted); font-size: 13px; }

.card {
  border: 1px solid var(--border);
  border-radius: 16px;
  margin-top: 16px;
  overflow: hidden;
  background: #fff;
}
.card-title { font-size: 20px; font-weight: 800; padding: 12px 16px; display: flex; align-items: center; gap: 8px; }
.trend { padding: 12px 16px; position: relative; cursor: pointer; transition: background 0.15s; }
.trend:hover { background: #f7f9f9; }
.trend-top { font-size: 13px; line-height: 16px; color: var(--muted); }
.trend-title { font-size: 15px; line-height: 20px; font-weight: 700; margin-top: 2px; }
.trend-sub { font-size: 13px; line-height: 16px; color: var(--muted); margin-top: 2px; }
.trend-dots {
  position: absolute; top: 10px; right: 10px;
  width: 30px; height: 30px; border-radius: 9999px;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted);
}
.trend-dots:hover { background: rgba(29, 155, 240, 0.1); color: var(--blue); }
.trend-dots svg { width: 18.75px; height: 18.75px; }
.show-more { display: block; width: 100%; text-align: left; padding: 16px; font-size: 15px; color: var(--blue); transition: background 0.15s; }
.show-more:hover { background: #f7f9f9; }

.market-card .card-title { padding-bottom: 8px; }
.live-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #FFAD1F;
  display: inline-block;
  animation: pulse-dot 1.6s infinite;
}
.live-dot.live { background: var(--green); }
@keyframes pulse-dot { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }
.chart-box { position: relative; margin: 0 16px; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: #fafcfc; }
.chart-box canvas { display: block; width: 100%; height: 120px; }
.chart-watermark {
  position: absolute; top: 6px; right: 8px;
  font-size: 10px; font-weight: 700; letter-spacing: 0.12em;
  color: rgba(83, 100, 113, 0.55);
  pointer-events: none;
}
.market-rows { padding: 8px 16px 4px; }
.market-row {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 7px 0;
  font-size: 15px;
  border-bottom: 1px solid #f7f9f9;
}
.market-row:last-child { border-bottom: none; }
.market-row .mk-label { color: var(--muted); font-size: 13px; }
.market-row .mk-value { font-weight: 700; font-variant-numeric: tabular-nums; }
.market-row .mk-value.shimmer {
  color: transparent;
  background: linear-gradient(90deg, #eff3f4 25%, #e1e8ed 50%, #eff3f4 75%);
  background-size: 200% 100%;
  animation: shimmer 1.6s infinite;
  border-radius: 6px;
  min-width: 72px;
  display: inline-block;
}
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.market-row .mk-joke { font-size: 11px; color: var(--dot); font-weight: 400; margin-left: 6px; }
.market-row .mk-value.pos { color: var(--green); }
.market-row .mk-value.neg { color: var(--red); }
.market-note { padding: 8px 16px 14px; font-size: 12px; color: var(--muted); }
.chart-box iframe { display: block; width: 100%; height: 320px; border: 0; }
.tk-neg { color: #FF8A8A !important; }

.sb-footer {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: 4px 8px;
  padding: 16px 8px;
  font-size: 13px; line-height: 16px;
  color: var(--muted);
}
.sb-footer a:hover { text-decoration: underline; }
.sb-footer > span { color: var(--dot); }
.sb-copy { width: 100%; margin-top: 4px; color: var(--muted); }

/* ============ toasts ============ */
.toasts {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%);
  z-index: 100;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  pointer-events: none;
}
.toast {
  background: var(--blue); color: #fff;
  font-size: 14px; font-weight: 500;
  padding: 10px 18px;
  border-radius: 8px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
  animation: toast-in 0.25s ease-out, toast-out 0.3s ease-in forwards;
  animation-delay: 0s, var(--ttl, 3.2s);
  max-width: 80vw;
}
.toast.dark { background: #0F1419; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(6px); } }

/* ============ modals ============ */
.modal-root:empty { display: none; }
.modal-back {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(0, 0, 0, 0.4);
  display: flex; align-items: center; justify-content: center;
  animation: fade 0.15s ease-out;
}
@keyframes fade { from { opacity: 0; } }
.modal {
  background: #fff;
  border-radius: 16px;
  width: min(420px, 88vw);
  padding: 28px 32px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.3);
  animation: modal-in 0.18s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
@keyframes modal-in { from { opacity: 0; transform: scale(0.94); } }
.modal h3 { font-size: 20px; font-weight: 800; margin-bottom: 8px; }
.modal p { font-size: 15px; line-height: 20px; color: var(--muted); white-space: pre-line; }
.modal-btns { display: flex; flex-direction: column; gap: 10px; margin-top: 22px; }
.modal-btn {
  height: 44px; border-radius: 9999px;
  font-size: 15px; font-weight: 700;
  background: #0F1419; color: #fff;
  transition: background 0.15s;
}
.modal-btn:hover { background: #272c30; }
.modal-btn.ghost { background: #fff; color: var(--text); border: 1px solid var(--banner); }
.modal-btn.ghost:hover { background: var(--hover); }

/* crash dialog */
.modal.crash { border: 1px solid #c9c9c9; border-radius: 12px; padding: 22px 24px; font-family: var(--font); }
.modal.crash h3 { display: flex; align-items: center; gap: 10px; font-size: 16px; }
.modal.crash h3::before { content: "⚠️"; font-size: 24px; }
.modal.crash p { font-size: 13px; color: #444; margin-top: 6px; }
.modal.crash .modal-btns { flex-direction: row; justify-content: flex-end; }
.modal.crash .modal-btn { height: 34px; padding: 0 18px; font-size: 13px; border-radius: 8px; }

/* dropdown menu (profile ... ) */
.menu {
  position: absolute; top: 0; right: 0; z-index: 80;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 0 15px rgba(101, 119, 134, 0.25), 0 0 3px 1px rgba(101, 119, 134, 0.15);
  min-width: 260px;
  overflow: hidden;
  animation: modal-in 0.12s ease-out;
}
.menu-item {
  display: block; width: 100%; text-align: left;
  padding: 12px 16px;
  font-size: 15px; font-weight: 700;
  transition: background 0.12s;
}
.menu-item:hover { background: var(--hover); }
.menu-item.danger { color: var(--red); }

/* ============ glitch ============ */
.glitch-overlay { position: fixed; inset: 0; z-index: 85; pointer-events: none; display: none; }
.glitch-overlay.on { display: block; }
.glitch-bar {
  position: absolute; left: 0; right: 0;
  background: rgba(29, 155, 240, 0.25);
  mix-blend-mode: difference;
  animation: glitch-slide 0.5s steps(3) forwards;
}
.glitch-bar.g2 { background: rgba(244, 33, 46, 0.3); }
.glitch-bar.g3 { background: rgba(0, 186, 124, 0.28); }
@keyframes glitch-slide {
  0% { transform: translateX(-30%); }
  50% { transform: translateX(15%) scaleY(1.6); }
  100% { transform: translateX(-5%); opacity: 0; }
}

/* money rain */
.money {
  position: fixed; top: -40px; z-index: 65;
  font-size: 24px;
  pointer-events: none;
  animation: money-fall linear forwards;
}
@keyframes money-fall {
  to { transform: translateY(110vh) rotate(340deg); opacity: 0.7; }
}

/* lightbox */
.lightbox {
  position: fixed; inset: 0; z-index: 95;
  background: rgba(0, 0, 0, 0.85);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 16px;
  animation: fade 0.15s;
  cursor: zoom-out;
}
.lightbox > div { width: min(560px, 90vw); border-radius: 16px; overflow: hidden; }
.lightbox svg { display: block; width: 100%; height: auto; }
.lightbox-cap { color: #fff; font-size: 15px; width: 100%; text-align: center; }

/* responsive-ish (desktop-first meme site, keep it usable when narrow) */
@media (max-width: 1254px) {
  .sidebar { display: none; }
}
@media (max-width: 1000px) {
  .nav { width: 76px; }
  .nav-item > span:last-child, .post-btn, .account-meta, .account-dots { display: none; }
  .nav-item > span.badge-anchor { display: flex; }
  .account-chip { padding: 6px; }
  .post-btn { display: none; }
}
/* ============ mobile: X's phone layout ============ */
@media (max-width: 700px) {
  :root { --bar: 53px; --safe: env(safe-area-inset-bottom, 0px); }

  body { padding-bottom: calc(var(--bar) + var(--safe)); }
  .layout { flex-direction: column; max-width: 100%; }

  /* left nav becomes the bottom tab bar */
  .nav {
    width: 100%;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 70;
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--border);
    padding-bottom: var(--safe);
  }
  .nav-inner {
    position: static;
    height: var(--bar);
    flex-direction: row; align-items: center;
    padding: 0; overflow: visible;
  }
  .nav-logo, .account-chip { display: none; }
  .nav-items { display: flex; flex: 1; align-items: center; }
  .nav-item {
    flex: 1; width: auto;
    height: var(--bar);
    padding: 0; margin: 0;
    justify-content: center;
    border-radius: 0;
  }
  .nav-item:active { transform: none; background: var(--hover); }
  .nav-item svg { width: 25px; height: 25px; }
  /* five tabs, like the real thing — Bags and Rug Studio fold away */
  .nav-item:nth-child(5), .nav-item:nth-child(6) { display: none; }
  .notif-badge { top: -3px; left: 12px; }

  /* Post becomes the floating compose button */
  .post-btn {
    display: flex; align-items: center; justify-content: center;
    position: fixed; right: 16px;
    bottom: calc(var(--bar) + var(--safe) + 16px);
    z-index: 71;
    width: 54px; height: 54px; margin: 0;
    border-radius: 9999px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  }
  .post-btn-label { display: none; }
  .post-btn-icon { display: block; width: 24px; height: 24px; }
  body.chat-view .post-btn { display: none; }

  /* center column */
  .timeline { width: 100%; max-width: 100%; border: none; min-height: auto; }
  .tl-header { padding: 0 8px; gap: 6px; }
  .tl-header-name { font-size: 17px; line-height: 20px; }
  .tl-header-sub { font-size: 12px; }
  .banner { height: 33vw; max-height: 180px; }
  .profile { padding: 10px 14px 0; margin-bottom: 12px; }
  .avatar-wrap { width: 86px; height: 86px; margin-top: -46px; border-radius: 15px; padding: 3px; }
  .avatar { border-radius: 12px; }
  .profile-actions { margin-top: 8px; }
  .profile-name { font-size: 18px; line-height: 22px; }
  .profile-meta { gap: 6px 12px; }
  @keyframes tear-fall {
    from { transform: translateY(0) scale(0.7); opacity: 0; }
    15% { opacity: 1; }
    to { transform: translateY(70px) scale(1.05); opacity: 0; }
  }

  /* tabs pin under the header like the app */
  .tabs {
    position: sticky; top: 79px; z-index: 35;
    scroll-margin-top: 79px;
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
  }
  .tab { height: 48px; }

  /* posts */
  .repost-line { padding: 8px 14px 0 40px; }
  .reply { padding: 10px 14px; gap: 10px; }
  .reply-actions { max-width: 100%; margin-top: 8px; }
  .r-act { padding: 6px 4px; min-height: 32px; }

  /* chat */
  #panel-chat { min-height: 0; }
  .chat-hero { padding: 24px 16px 8px; }
  .chat-hero h1 { font-size: 26px; line-height: 31px; }
  .chat-feed { padding: 12px 14px; }
  .chat-feed:empty { padding: 0; }
  .chat-feed:not(:empty) { max-height: min(52vh, 440px); }
  .msg { max-width: 85%; }
  .chat-suggest { padding: 4px 14px 10px; gap: 6px; }
  .chip { font-size: 13.5px; padding: 7px 12px; }
  .chat-composer {
    padding: 8px 14px 10px;
    bottom: calc(var(--bar) + var(--safe));
  }
  /* 16px keeps iOS from zooming the page on focus */
  #chatInput, #searchInput { font-size: 16px; }

  /* sidebar stacks under the timeline instead of vanishing —
     the market card is the point of a coin site */
  .sidebar { display: block; width: 100%; margin-left: 0; padding: 0 14px 20px; }
  .search-wrap { display: none; }
  .card { margin-top: 12px; }
  .chart-box iframe { height: 260px; }
  .sb-footer { padding: 14px 2px; }

  .toasts { bottom: calc(var(--bar) + var(--safe) + 16px); }
  .toast { max-width: calc(100vw - 32px); text-align: center; }
}

/* touch devices: no sticky hover states left behind by a tap */
@media (hover: none) {
  .nav-item:hover, .tab:hover, .reply:hover, .trend:hover,
  .r-act:hover, .icon-btn:hover, .chip:hover, .show-more:hover { background: none; }
  .r-act:hover { color: var(--muted); }
  .count-item:hover { text-decoration: none; }
}
