:root {
  --bg:            #ffffff;
  --bg-hover:      #f1f3f3;
  --bg-modal:      rgba(0,0,0,0.5);
  --surface:       #ffffff;
  --border:        #eff3f4;
  --ink:           #0f1419;
  --ink-2:         #536471;
  --ink-3:         #8899a6;
  --accent:        #1d9bf0;
  --accent-hover:  #1a8cd8;
  --accent-bg:     #e8f5fd;
  --like:          #f91880;
  --like-bg:       #fde8f0;
  --rt:            #00ba7c;
  --rt-bg:         #d9f4ea;
  --bg-rgb:        255, 255, 255;
  --sidebar-w:     275px;
  --feed-w:        600px;
  --right-w:       350px;
  --nav-icon-size: 26px;
  --radius-pill:   999px;
  --radius-card:   1rem;
  --font:          -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

[data-theme="dark"] {
  --bg:        #000000;
  --bg-rgb:    0, 0, 0;
  --bg-hover:  #1a1a1a;
  --surface:   #16181c;
  --border:    #2f3336;
  --ink:       #e7e9ea;
  --ink-2:     #71767b;
  --ink-3:     #555b61;
  --accent-bg: #031827;
  --like-bg:   #200414;
  --rt-bg:     #00260f;
}

/* ---- Dark-mode icon fix ----
   Our icon SVGs are flat black shapes rendered via <img>, so they can't
   be recolored the normal CSS way (color/fill only work on inline <svg>
   or CSS masks, not on an <img> tag). Inverting them in dark mode flips
   black to white so they stay visible, without needing a second set of
   icon files. Avatars, profile photos, the verified badge, and the
   Explore story illustrations are intentionally excluded since they're
   already colored on purpose. */
[data-theme="dark"] .nav-item img,
[data-theme="dark"] .nav-logo img,
[data-theme="dark"] .mobile-logo,
[data-theme="dark"] .btn-tweet-icon,
[data-theme="dark"] .nav-icon,
[data-theme="dark"] .action-btn img,
[data-theme="dark"] .tool-btn img,
[data-theme="dark"] .tweet-more img,
[data-theme="dark"] .trend-more img,
[data-theme="dark"] .more-btn img,
[data-theme="dark"] .audience-btn img,
[data-theme="dark"] .search-icon,
[data-theme="dark"] .explore-search-icon,
[data-theme="dark"] .mob-nav-item img,
[data-theme="dark"] .fab-compose img,
[data-theme="dark"] .modal-close img,
[data-theme="dark"] .profile-mini-more,
[data-theme="dark"] #themeIcon {
  filter: invert(1) brightness(1.7);
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html  { scroll-behavior: smooth; }
body  {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  min-height: 100dvh;
}
a     { text-decoration: none; color: inherit; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
img   { display: block; max-width: 100%; }
textarea { font-family: inherit; resize: none; border: none; outline: none; }

/* Visually hidden (a11y) */
.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap;
}

/* ============================================================
   PAGE LAYOUT — 3-col sticky
   ============================================================ */
.page-wrap {
  display: flex;
  justify-content: center;
  min-height: 100dvh;
  max-width: 100%;
  margin: 0 auto;
}

/* ============================================================
   LEFT SIDEBAR
   ============================================================ */

.sidebar-left {
  width: var(--sidebar-w);
  height: 100vh;
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  padding-top: 10px;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
}

.sidebar-left::-webkit-scrollbar {
  width: 8px;
}

.sidebar-left::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar-left::-webkit-scrollbar-thumb {
  background: var(--ink-3);
  border-radius: 999px;
}

.sidebar-left::-webkit-scrollbar-thumb:hover {
  background: var(--ink-2);
}

/* Logo */

.nav-logo {
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  transition: 0.2s;
}

.nav-logo:hover {
  background: var(--bg-hover);
}

.nav-logo img {
  width: 30px;
  height: 30px;
}

/* Navigation */

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 12px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 12px 18px;
  border-radius: 999px;
  text-decoration: none;
  color: inherit;
  position: relative;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: background 0.2s ease;
}

.nav-item:hover {
  background: var(--bg-hover);
}

.nav-item.active {
  font-weight: 700;
}

.nav-btn {
  width: 100%;
  font: inherit;
  text-align: left;
}

/* Icon images */

.nav-item img,
.btn-tweet-icon,
.nav-icon {
  width: var(--nav-icon-size);
  height: var(--nav-icon-size);
  object-fit: contain;
  flex-shrink: 0;
}

.nav-label {
  font-size: 1.25rem;
  white-space: nowrap;
}

/* Notification badge */

.nav-badge {
  position: absolute;
  top: 8px;
  left: 32px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: #1d9bf0;
  color: #fff;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Dark mode button — now lives at the top of the right sidebar.
   Icon-only: just the moon/sun swapping, no text label. */

.theme-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin-top: 10px;
  border-radius: 50%;
  background: var(--surface);
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.theme-toggle-btn:hover { background: var(--bg-hover); border-color: var(--accent-bg); }
.theme-toggle-btn:active img { transform: scale(.5) rotate(-20deg); }
.theme-toggle-btn img {
  width: 22px;
  height: 22px;
  object-fit: contain;
  flex-shrink: 0;
  transition: transform .25s ease;
}

/* Post button */

.btn-tweet {
  width: 215px;
  height: 52px;
  padding: 10px;
  border: none;
  border-radius: 999px;
  background: #0c0c0c;
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: 0.2s;
}

.btn-tweet:hover {
  background: #212425;
}

.btn-tweet-icon {
  display: none;
}

/* Smaller inline icons (toolbar / action / meta icons) */
.tool-btn img,
.action-btn img,
.tweet-more img,
.audience-btn img,
.verified {
  object-fit: contain;
}

.action-btn img,
.tool-btn img {
  width: 20px;
  height: 20px;
}

.tweet-more img {
  width: 18px;
  height: 18px;
}

.verified {
  width: 18px;
  height: 18px;
  margin-left: 4px;
  vertical-align: middle;
}

.audience-btn img {
  width: 16px;
  height: 16px;
}

/* Profile mini */

.profile-mini {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.2s;
}

.profile-mini:hover {
  background: var(--bg-hover);
}

.profile-mini-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
}

.profile-mini-info {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.profile-mini-name {
  font-weight: 700;
  font-size: 15px;
}

.profile-mini-handle {
  font-size: 14px;
  color: var(--ink-2);
}

.profile-mini-more {
  width: 20px;
  height: 20px;
}

/* ============================================================
   MAIN FEED
   ============================================================ */
.feed-col {
  width: var(--feed-w);
  border-left:  1px solid var(--border);
  border-right: 1px solid var(--border);
  min-height: 100dvh;
  flex-shrink: 0;
}

/* Feed header / tabs */
.feed-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(var(--bg-rgb), 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.feed-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
}

.feed-tab {
  flex: 1;
  padding: 16px;
  font-size: .95rem;
  font-weight: 500;
  color: var(--ink-2);
  border-bottom: 2px solid transparent;
  transition: color .18s, border-color .18s, background .18s;
}
.feed-tab:hover  { background: var(--bg-hover); color: var(--ink); }
.feed-tab.active { color: var(--ink); font-weight: 700; border-bottom-color: var(--accent); }

/* ---- Compose box ---- */
.compose-box {
  display: flex;
  gap: 12px;
  padding: 12px 16px 4px;
  border-bottom: 8px solid var(--border);
}

.compose-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  margin-top: 4px;
}

.compose-right { flex: 1; display: flex; flex-direction: column; }

.compose-audience { margin-bottom: 8px; }

.audience-btn {
  background: none;
  border: 1px solid var(--accent);
  color: var(--accent);
  border-radius: var(--radius-pill);
  padding: 3px 12px;
  font-size: .83rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: background .15s;
}
.audience-btn:hover { background: var(--accent-bg); }

.compose-input {
  background: transparent;
  color: var(--ink);
  font-size: 1.2rem;
  width: 100%;
  padding: 4px 0;
  min-height: 52px;
  overflow: hidden;
}
.compose-input::placeholder { color: var(--ink-3); }

.compose-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0 4px;
  border-top: 1px solid var(--border);
  margin-top: 8px;
}

.compose-tools { display: flex; gap: 0; }

.tool-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  color: var(--accent);
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s;
}
.tool-btn:hover { background: var(--accent-bg); }

.compose-right-tools { display: flex; align-items: center; gap: 12px; }

.char-counter {
  font-size: .88rem;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}
.char-counter.counter-warn   { color: #f4af00; }
.char-counter.counter-danger { color: #e0245e; }

.compose-divider {
  width: 1px;
  height: 28px;
  background: var(--border);
}

.btn-post {
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius-pill);
  padding: 8px 18px;
  font-size: .93rem;
  font-weight: 700;
  transition: background .15s, opacity .15s;
}
.btn-post:hover:not(:disabled) { background: var(--accent-hover); }
.btn-post:disabled { opacity: .5; cursor: not-allowed; }

/* ---- Tweet cards ---- */
.tweet {
  display: flex;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background .15s;
}
.tweet:hover { background: var(--bg-hover); }

.tweet-avatar-col { flex-shrink: 0; }
.tweet-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  transition: opacity .15s;
}
.tweet-avatar:hover { opacity: .85; }

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

.tweet-header {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 2px;
}

.tweet-name {
  font-weight: 700;
  font-size: .95rem;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 3px;
}
.tweet-handle, .tweet-time { color: var(--ink-2); font-size: .92rem; }
.tweet-dot { color: var(--ink-2); font-size: .92rem; }

/* ---- Shared "more options" drop-up menu system ----
   Used by: tweet-more-wrap (tweets), trend-more-wrap (trending widget),
   widget-more-wrap (widget "Show more" buttons). Each wrapper carries the
   generic .more-wrap class; opening one toggles .open on that wrapper. */
.more-wrap { position: relative; }

.tweet-more-wrap {
  margin-left: auto;
}

.tweet-more {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s;
}
.tweet-more:hover { background: var(--accent-bg); }

/* Drop-UP menu: anchored to bottom of the button, opens upward */
.more-menu {
  display: none;
  position: absolute;
  right: 0;
  bottom: calc(100% + 6px);
  min-width: 240px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 6px;
  z-index: 30;
}
.more-menu.align-left { right: auto; left: 0; }
.more-wrap.open .more-menu { display: block; }

.menu-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: .93rem;
  font-weight: 600;
  color: var(--ink);
  transition: background .12s;
}
.menu-item:hover { background: var(--bg-hover); }
.menu-item-danger { color: var(--like); }
.menu-item-danger:hover { background: var(--like-bg); }

.tweet-text {
  font-size: .97rem;
  line-height: 1.55;
  color: var(--ink);
  margin-bottom: 12px;
}

.tweet-link { color: var(--accent); }
.tweet-link:hover { text-decoration: underline; }

/* Tweet image */
.tweet-image-wrap {
  border-radius: var(--radius-card);
  overflow: hidden;
  margin-bottom: 12px;
  border: 1px solid var(--border);
}
.tweet-img { width: 100%; object-fit: cover; }

/* Tweet action buttons */
.tweet-actions {
  display: flex;
  gap: 0;
  margin: -4px -8px;
}

.action-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 8px;
  border-radius: var(--radius-pill);
  font-size: .88rem;
  color: var(--ink-2);
  transition: color .15s, background .15s;
  flex-shrink: 0;
}
/* Reply */
.reply-btn:hover  { color: var(--accent); background: var(--accent-bg); }
/* Retweet */
.retweet-btn:hover       { color: var(--rt); background: var(--rt-bg); }
.retweet-btn.retweeted   { color: var(--rt); }
.retweet-btn.retweeted:hover { color: var(--rt); }
/* Like */
.like-btn:hover        { color: var(--like); background: var(--like-bg); }
.like-btn.liked        { color: var(--like); }
.like-btn.liked:hover  { background: var(--like-bg); }
/* Views */
.view-btn:hover  { color: var(--accent); background: var(--accent-bg); }
/* Bookmark */
.bookmark-btn:hover      { color: var(--accent); background: var(--accent-bg); }
.bookmark-btn.bookmarked { color: var(--accent); }
/* Share */
.share-btn { margin-left: auto; }
.share-btn:hover { color: var(--accent); background: var(--accent-bg); }

/* ============================================================
   RIGHT SIDEBAR
   ============================================================ */
.sidebar-right {
  width: var(--right-w);
  padding: 0 16px;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100dvh;
  overflow-y: auto;
}

/* Search */
.search-wrap {
  position: sticky;
  top: 0;
  padding: 12px 0;
  background: var(--bg);
  z-index: 5;
}
.search-inner {
  position: relative;
  display: flex;
  align-items: center;
}
.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  object-fit: contain;
  pointer-events: none;
}
.search-input {
  width: 100%;
  background: var(--bg-hover);
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  padding: 11px 16px 11px 44px;
  font-size: .95rem;
  color: var(--ink);
  outline: none;
  transition: border-color .18s, background .18s;
}
[data-theme="light"]
.search-input::placeholder { color: var(--ink-2); }
.search-input:focus {
  background: var(--bg);
  border-color: var(--accent);
}

/* Widgets */
.widget {
  background: var(--surface);
  border-radius: var(--radius-card);
  padding: 16px;
  margin-bottom: 16px;
  border: 1px solid var(--border);
}

.widget-title {
  font-size: 1.2rem;
  font-weight: 800;
  margin-bottom: 12px;
  color: var(--ink);
}

.widget-body {
  font-size: .9rem;
  color: var(--ink-2);
  margin-bottom: 14px;
  line-height: 1.5;
}

.btn-subscribe {
  background: var(--ink);
  color: var(--bg);
  border-radius: var(--radius-pill);
  padding: 9px 18px;
  font-size: .9rem;
  font-weight: 700;
  transition: opacity .18s;
}
.btn-subscribe:hover { opacity: .85; }

/* Trending */
.trend-item {
  position: relative;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.trend-item:last-of-type { border-bottom: none; }
.trend-item:hover .trend-tag {
  text-decoration: underline; 
}

.trend-meta  { font-size: .78rem; color: var(--ink-2); }
.trend-tag   { font-size: .95rem; font-weight: 700; color: var(--ink); margin: 2px 0; }
.trend-count { font-size: .78rem; color: var(--ink-2); }

.trend-more-wrap {
  position: absolute;
  top: 8px;
  right: 0;
}

.trend-more {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: var(--ink-2);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, color .15s, border-color .15s;
  margin-right: 10px;
}
.trend-more:hover { background: var(--accent-bg); color: var(--accent); border-color: var(--accent-bg); }
.trend-more img { width: 18px; height: 18px; object-fit: contain; }

.widget-more-wrap {
  display: inline-block;
  margin-top: 14px;
}

.more-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border);
  color: var(--ink-2);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, color .15s, border-color .15s;
}
.more-btn:hover { background: var(--accent-bg); color: var(--accent); border-color: var(--accent-bg); }
.more-btn img { width: 18px; height: 18px; object-fit: contain; }

/* Who to follow */
.follow-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.follow-item:last-of-type { border-bottom: none; }

.follow-avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }

.follow-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.follow-name {
  font-size: .93rem;
  font-weight: 700;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.follow-handle { font-size: .83rem; color: var(--ink-2); }

.btn-follow {
  background: var(--ink);
  color: var(--bg);
  border-radius: var(--radius-pill);
  padding: 7px 16px;
  font-size: .87rem;
  font-weight: 700;
  flex-shrink: 0;
  transition: opacity .15s, background .15s, color .15s;
}
.btn-follow:hover { opacity: .85; }
.btn-follow.following {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--border);
}
.btn-follow.following:hover {
  border-color: var(--like);
  color: var(--like);
  background: var(--like-bg);
}

.sidebar-footer {
  font-size: .74rem;
  color: var(--ink-2);
  line-height: 1.7;
  padding: 4px 0 80px;
}

/* ============================================================
   TWEET MODAL  (CSS :target trick + overlay)
   ============================================================ */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--bg-modal);
  z-index: 1000;
  align-items: flex-start;
  justify-content: center;
  padding-top: 5vh;
}
.modal-overlay:target { display: flex; }

.modal-box {
  background: var(--bg);
  border-radius: var(--radius-card);
  width: 100%;
  max-width: 600px;
  padding: 12px 16px 16px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.25);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.modal-close {
  width: 25px;
  height: 25px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  color: var(--ink);
  transition: background .15s;
}
.modal-close:hover { background: var(--bg-hover); }

.btn-drafts {
  color: var(--accent);
  font-weight: 700;
  font-size: .9rem;
}

.modal-compose {
  display: flex;
  gap: 12px;
}
.modal-input {
  min-height: 120px;
  font-size: 1.2rem;
  background: transparent;
  color: var(--ink);
}

/* ============================================================
   MOBILE TOP BAR
   ============================================================ */
.mobile-topbar {
  display: none;
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 10px 16px;
  align-items: center;
  justify-content: space-between;
  backdrop-filter: blur(12px);
}
.mobile-logo  { width: 32px; }
.mobile-avatar { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; }

/* ============================================================
   MOBILE BOTTOM NAV
   ============================================================ */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 50;
  background: var(--bg);
  border-top: 1px solid var(--border);
  padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
  justify-content: space-around;
  align-items: center;
}
.mob-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  color: var(--ink-2);
  font-size: 1.4rem;
  position: relative;
  transition: background .15s;
}
.mob-nav-item:hover, .mob-nav-item.active { color: var(--ink); }
.mob-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  background: var(--accent);
  color: #fff;
  font-size: .6rem;
  font-weight: 700;
  padding: 0 4px;
  border-radius: var(--radius-pill);
  min-width: 16px;
  text-align: center;
}

/* FAB compose (mobile) */
.fab-compose {
  display: none;
  position: fixed;
  bottom: 90px;
  right: 45px;
  z-index: 51;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: white;
  color: #fff;
  font-size: 1.4rem;
  align-items: center;
  justify-content: center;
  transition: background .15s, transform .15s;
}
.fab-compose:hover { background: var(--accent-hover); transform: scale(1.06); }

/* ============================================================
   RESPONSIVE BREAKPOINTS
   ============================================================ */

/* Collapse right sidebar */
@media (max-width: 1150px) {
  .sidebar-right { width: 280px; }
}
@media (max-width: 990px) {
  .sidebar-right  { display: none; }
  .feed-col       { border-right: none; }
}

/* Collapse left sidebar labels → icon-only */
@media (max-width: 1280px) {
  :root { --sidebar-w: 88px; }
  .nav-label, .profile-mini-info, .profile-mini-more { display: none; }
  .nav-item { justify-content: center; padding: 12px; }
  .nav-badge { top: 4px; left: 26px; }
  .btn-tweet { background-color: white; position: relative; left: 12px; }
  .btn-tweet-full { display: none; }
  .btn-tweet-icon { display: block; }
  .btn-tweet { width: 52px; height: 52px; padding: 0; border-radius: 50%; margin: 12px auto; }
  .btn-tweet:hover { background: var(--bg-hover); }
  [data-theme="dark"] .btn-tweet { background-color: transparent; }
  .profile-mini { justify-content: center; padding: 12px; }

  /* The "More" drop-up menu is a popup with its own room to breathe —
     it shouldn't collapse to icon-only just because the sidebar behind
     it did. Restore full icon + label rows inside it. */
  .more-menu .nav-label { display: inline-block; }
  .more-menu .nav-item { justify-content: flex-start; padding: 10px 12px; }
}

/* Mobile: hide sidebar, show mobile nav */
@media (max-width: 700px) {
  :root { --feed-w: 100vw; }
  .sidebar-left    { display: none; }
  .mobile-topbar   { display: flex; }
  .mobile-bottom-nav { display: flex; }
  .fab-compose     { display: flex; }
  .feed-col {
    width: 100%;
    border-left: none;
    border-right: none;
    padding-bottom: 80px;
  }
  .page-wrap { padding-top: 57px; }
  .compose-tools .tool-btn:nth-child(n+5) { display: none; }
}

/* ============================================================
   EXPLORE PAGE
   ============================================================ */

/* Sticky search header at the top of the Explore feed column */
.explore-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(var(--bg-rgb), 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.explore-search-inner {
  position: relative;
  display: flex;
  align-items: center;
}

.explore-search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  object-fit: contain;
  pointer-events: none;
}

.explore-search-input {
  width: 100%;
  background: var(--surface);
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  padding: 12px 16px 12px 44px;
  font-size: 1rem;
  color: var(--ink);
  outline: none;
  transition: border-color .18s, background .18s;
}
[data-theme="light"] .explore-search-input { background: var(--border); }
.explore-search-input::placeholder { color: var(--ink-2); }
.explore-search-input:focus {
  background: var(--bg);
  border-color: var(--accent);
}

/* Section headings inside the Explore feed */
.explore-section-title {
  padding: 16px 16px 4px;
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--ink);
}

/* Story cards ("What's happening" style items with a thumbnail) */
.story-card {
  display: block;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background .15s;
}
.story-card:hover { background: var(--bg-hover); }

.story-meta {
  font-size: .8rem;
  color: var(--ink-2);
  margin-bottom: 4px;
}

.story-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.3;
  margin-bottom: 4px;
}

.story-snippet {
  font-size: .9rem;
  color: var(--ink-2);
  line-height: 1.35;
  margin-bottom: 10px;
}

.story-img-wrap {
  border-radius: var(--radius-card);
  overflow: hidden;
  border: 1px solid var(--border);
}

.story-img {
  width: 100%;
  height: 220px;
  object-fit: cover;
  display: block;
}

/* Trending list reused inside the main Explore feed (not the sidebar) */
.explore-trend-list .trend-item {
  padding: 12px 16px;
}
.explore-trend-list .trend-item:hover { background: var(--bg-hover); }

/* 4K / wide screen */
@media (min-width: 1600px) {
  :root { --sidebar-w: 300px; --right-w: 380px; }
  .nav-label { display: block; }
  .nav-item  { justify-content: flex-start; }
  .btn-tweet-full { display: block; }
  .btn-tweet-icon { display: none; }
  .btn-tweet { width: 100%; border-radius: var(--radius-pill); }
  .profile-mini-info, .profile-mini-more { display: block; }
}