:root {
  --bg: #ffffff;
  --bg-soft: #f7f9fb;
  --border: #e4e7eb;
  --text: #0f1419;
  --text-secondary: #536471;
  --brand: #2b90d9;
  --brand-dark: #1f6fad;
  --accent: #4db6ac;
  --accent-strong: #2a8a80;
  --love: #e0245e;
  --green: #1a9b5b;
  --radius: 16px;
  --shadow: 0 1px 3px rgba(15,20,25,0.1), 0 8px 28px rgba(15,20,25,0.06);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
  background: var(--bg-soft);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  line-height: 1.4;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; cursor: pointer; }

.hidden { display: none !important; }

/* ===== Общий макет ===== */
.app {
  max-width: 1265px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 275px 598px 350px;
  gap: 24px;
  padding: 0 16px;
}

/* ===== Левая колонка ===== */
.sidebar { position: sticky; top: 0; height: 100vh; }
.sidebar-inner {
  display: flex; flex-direction: column; gap: 18px;
  padding: 18px 8px;
  height: 100%;
}

.logo {
  display: flex; align-items: center; gap: 10px;
  font-size: 30px; font-weight: 900; color: var(--text);
  padding: 10px 14px; border-radius: 999px; width: fit-content;
}
.logo:hover { background: rgba(43,144,217,0.1); text-decoration: none; }
.logo-icon { filter: drop-shadow(0 0 2px rgba(0,0,0,0.1)); }
.logo-text { background: linear-gradient(135deg, var(--brand), var(--accent-strong)); -webkit-background-clip: text; background-clip: text; color: transparent; }

.nav-menu { display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 16px;
  padding: 12px 16px; border: none; background: none;
  font-size: 19px; font-weight: 500; color: var(--text);
  border-radius: 999px; transition: background 0.15s; position: relative; text-align: left;
}
.nav-item:hover { background: rgba(15,20,25,0.06); }
.nav-item.active { font-weight: 800; }
.nav-icon { font-size: 24px; line-height: 1; }
.nav-badge {
  position: absolute; right: 14px; top: -4px;
  background: var(--love); color: #fff; font-size: 11px; font-weight: 700;
  min-width: 18px; height: 18px; border-radius: 999px;
  display: flex; align-items: center; justify-content: center; padding: 0 5px;
}

.compose-btn {
  background: var(--brand); color: #fff; border: none;
  font-size: 17px; font-weight: 700;
  padding: 15px; border-radius: 999px; width: 100%;
  box-shadow: 0 1px 2px rgba(43,144,217,0.4);
  transition: background 0.15s, transform 0.05s;
}
.compose-btn:hover { background: var(--brand-dark); }
.compose-btn:active { transform: scale(0.98); }

.sidebar-account {
  margin-top: auto; display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; border-radius: 999px; transition: background 0.15s;
}
.sidebar-account:hover { background: rgba(15,20,25,0.06); }
.sa-info { display: flex; flex-direction: column; min-width: 0; }
.sa-name { font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sa-handle { font-size: 14px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sa-more { border: none; background: none; font-size: 18px; padding: 4px 8px; border-radius: 999px; color: var(--text-secondary); }
.sa-more:hover { background: rgba(15,20,25,0.06); }

/* ===== Главная колонка ===== */
.main-col {
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  background: var(--bg);
  min-height: 100vh;
}

.topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  padding: 10px 16px 8px;
}
.topbar-title-row { display: flex; align-items: center; justify-content: space-between; }
.topbar-title { font-size: 20px; font-weight: 800; }
.topbar-refresh {
  border: none; background: none; font-size: 22px; color: var(--brand);
  padding: 4px 10px; border-radius: 999px; transition: transform 0.4s;
}
.topbar-refresh:hover { background: rgba(43,144,217,0.1); }
.topbar-refresh.spinning { animation: spin 0.7s linear; }
@keyframes spin { to { transform: rotate(360deg); } }

.feed-switcher { display: flex; margin-top: 8px; border-bottom: 1px solid var(--border); }
.feed-tab {
  flex: 1; background: none; border: none; padding: 12px;
  font-size: 15px; font-weight: 700; color: var(--text-secondary);
  position: relative;
}
.feed-tab:hover { background: rgba(43,144,217,0.08); }
.feed-tab.active { color: var(--brand); }
.feed-tab.active::after {
  content: ''; position: absolute; left: 50%; transform: translateX(-50%);
  bottom: -1px; height: 4px; width: 56px; border-radius: 999px; background: var(--brand);
}

.status-line {
  padding: 10px 16px; font-size: 14px; color: var(--text-secondary);
  border-bottom: 1px solid var(--border); background: #f0f7fd;
}
.status-line.error { background: #fdeef2; color: #c5253c; }

.topic-bar {
  display: flex; gap: 8px; padding: 10px 16px; overflow-x: auto;
  border-bottom: 1px solid var(--border); background: var(--bg-soft);
}
.topic-chip {
  flex-shrink: 0; border: 1px solid var(--border); background: #fff;
  padding: 6px 14px; border-radius: 999px; font-size: 13px; font-weight: 600; color: var(--text);
  transition: all 0.15s;
}
.topic-chip:hover { border-color: var(--brand); color: var(--brand); background: #f0f7fd; }
.topic-chip.active { background: var(--brand); border-color: var(--brand); color: #fff; }

.timeline { min-height: 200px; }

/* ===== Посты / статусы ===== */
.status {
  display: flex; gap: 12px; padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
  animation: fadeIn 0.3s ease;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; } }
.status:hover { background: #fafbfc; }

.status.reblogged { background: #f3faf5; }
.reblog-marker { color: var(--green); font-size: 13px; font-weight: 600; margin-bottom: 6px; display: flex; gap: 6px; align-items: center; }

.avatar { width: 48px; height: 48px; border-radius: 50%; flex-shrink: 0; object-fit: cover; background: #dbe3ea; }

.status-body { flex: 1; min-width: 0; }

.status-head { display: flex; align-items: center; gap: 6px; font-size: 14px; }
.s-name { font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.s-name:hover { text-decoration: underline; }
.s-handle { color: var(--text-secondary); }
.s-time { color: var(--text-secondary); margin-left: auto; flex-shrink: 0; font-size: 13px; }
.s-time:hover { text-decoration: underline; }

.s-content { margin-top: 4px; font-size: 15px; word-wrap: break-word; overflow-wrap: break-word; }
.s-content p { margin: 0 0 8px; }
.s-content a { color: var(--brand); }
.s-content a:not(.mention):not(.hashtag):not(.u-url) { text-decoration: underline; }
.s-content .hashtag { font-weight: 600; }
.s-content .mention { font-weight: 600; white-space: nowrap; }

.spoiler-wrap { background: var(--bg-soft); border: 1px solid var(--border); border-radius: 12px; padding: 10px; margin-top: 6px; }
.spoiler-text { font-size: 14px; margin-bottom: 8px; font-weight: 600; }
.btn-reveal {
  background: var(--brand); color: #fff; border: none; padding: 4px 14px;
  border-radius: 999px; font-size: 13px; font-weight: 600;
}
.btn-reveal:hover { background: var(--brand-dark); }

.media-grid { display: grid; gap: 4px; margin-top: 8px; border-radius: 12px; overflow: hidden; }
.media-grid[data-count="1"] { grid-template-columns: 1fr; }
.media-grid[data-count="2"] { grid-template-columns: 1fr 1fr; }
.media-grid[data-count="3"], .media-grid[data-count="4"] { grid-template-columns: 1fr 1fr; }
.media-item { position: relative; width: 100%; }
.media-item img, .media-item video { width: 100%; height: 100%; object-fit: cover; display: block; cursor: zoom-in; background: #000; }
.media-grid[data-count="1"] .media-item { max-height: 420px; }
.media-grid[data-count="1"] .media-item img { max-height: 420px; }
.media-grid[data-count="2"] .media-item img { aspect-ratio: 16/10; }
.media-grid[data-count="3"] .media-item:nth-child(1) { grid-column: span 2; }
.media-grid[data-count="3"] .media-item img { aspect-ratio: 16/10; }
.media-grid[data-count="3"] .media-item:nth-child(1) img { min-height: 220px; }
.media-grid[data-count="4"] .media-item img { aspect-ratio: 16/10; }
.media-item.more-overlay::after {
  content: attr(data-more); position: absolute; inset: 0;
  background: rgba(0,0,0,0.55); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; font-weight: 800;
}
.media-count-badge {
  position: absolute; bottom: 8px; right: 8px; background: rgba(0,0,0,0.7);
  color: #fff; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px;
}

.cards {
  margin-top: 10px; border: 1px solid var(--border); border-radius: 12px; overflow: hidden;
  display: flex; flex-direction: column; text-decoration: none; color: var(--text);
}
.cards:hover { background: var(--bg-soft); text-decoration: none; }
.cards img { width: 100%; max-height: 180px; object-fit: cover; }
.cards-body { padding: 10px 12px; }
.cards-title { font-size: 14px; font-weight: 700; }
.cards-desc { font-size: 13px; color: var(--text-secondary); margin-top: 3px; }
.cards-domain { font-size: 12px; color: var(--text-secondary); margin-top: 3px; }

.status-actions {
  display: flex; justify-content: space-between; max-width: 420px;
  margin-top: 8px; gap: 4px;
}
.act {
  display: flex; align-items: center; gap: 6px;
  border: none; background: none; color: var(--text-secondary);
  font-size: 13px; font-weight: 600; padding: 6px 12px; border-radius: 999px;
  transition: all 0.15s;
}
.act:hover { background: rgba(43,144,217,0.1); color: var(--brand); }
.act.reblog:hover { background: rgba(26,155,91,0.12); color: var(--green); }
.act.reblog.on { color: var(--green); }
.act.like:hover { background: rgba(224,36,94,0.1); color: var(--love); }
.act.like.on { color: var(--love); }
.act.bookmark.on { color: var(--brand); }

/* ===== Лоадер ===== */
.loader { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 22px; color: var(--text-secondary); font-size: 14px; }
.spinner {
  width: 18px; height: 18px; border: 3px solid var(--border);
  border-top-color: var(--brand); border-radius: 50%; animation: spin 0.7s linear infinite;
  display: inline-block;
}

/* ===== Правая колонка ===== */
.right-col { padding-top: 10px; display: flex; flex-direction: column; gap: 14px; }

.search-box {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-soft); border: 1px solid transparent;
  border-radius: 999px; padding: 10px 16px; transition: all 0.15s;
}
.search-box:focus-within { background: #fff; border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); }
.search-icon { color: var(--text-secondary); font-size: 14px; }
.search-input { border: none; background: none; outline: none; flex: 1; font-size: 15px; }
.search-clear { border: none; background: none; color: var(--text-secondary); font-size: 14px; }

.widget {
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow);
}
.widget-title { font-size: 18px; font-weight: 800; margin-bottom: 12px; }
.widget-text { font-size: 14px; color: var(--text-secondary); }

.trend-list { list-style: none; }
.trend-item { padding: 8px 0; border-bottom: 1px solid var(--bg-soft); cursor: pointer; }
.trend-item:last-child { border-bottom: none; }
.trend-item:hover { background: var(--bg-soft); }
.trend-cat { font-size: 12px; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.03em; }
.trend-name { font-weight: 700; font-size: 15px; color: var(--text); }
.trend-count { font-size: 13px; color: var(--text-secondary); }

.suggestions { display: flex; flex-direction: column; gap: 12px; }
.sugg {
  display: flex; align-items: center; gap: 10px; padding: 6px 4px; border-radius: 8px;
}
.sugg:hover { background: var(--bg-soft); }
.sugg-info { flex: 1; min-width: 0; }
.sugg-name { font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sugg-handle { font-size: 13px; color: var(--text-secondary); }
.sugg-btn { background: var(--text); color: #fff; border: none; padding: 6px 14px; border-radius: 999px; font-size: 13px; font-weight: 700; }
.sugg-btn:hover { background: #333; }

.foot { font-size: 13px; color: var(--text-secondary); padding: 0 4px 20px; }
.foot a { color: var(--text-secondary); }
.foot a:hover { text-decoration: underline; }

/* ===== Модалки ===== */
.modal-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.modal {
  background: #fff; border-radius: var(--radius); max-width: 480px; width: 100%;
  padding: 28px; position: relative; box-shadow: var(--shadow);
  animation: pop 0.2s ease;
}
@keyframes pop { from { transform: scale(0.92); opacity: 0; } to { transform: scale(1); } }
.modal h3 { font-size: 22px; font-weight: 800; margin-bottom: 10px; }
.muted { color: var(--text-secondary); font-size: 14px; margin-bottom: 12px; }
.muted.small { font-size: 12px; }
.modal-close {
  position: absolute; top: 14px; right: 14px; border: none; background: var(--bg-soft);
  width: 32px; height: 32px; border-radius: 50%; font-size: 14px; color: var(--text);
}
.modal-close:hover { background: var(--border); }

.modal-btn {
  display: block; width: 100%; border: none; background: var(--bg-soft);
  color: var(--text); font-size: 15px; font-weight: 700; padding: 12px;
  border-radius: 999px; margin-top: 10px; transition: all 0.15s;
}
.modal-btn:hover { background: var(--border); }
.modal-btn.primary { background: var(--brand); color: #fff; }
.modal-btn.primary:hover { background: var(--brand-dark); }
.modal-btn.ghost { background: none; color: var(--love); border: 1px solid var(--love); }
.modal-btn.ghost:hover { background: rgba(224,36,94,0.06); }

.divider { display: flex; align-items: center; color: var(--text-secondary); font-size: 13px; margin: 14px 0; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.divider span { padding: 0 12px; }

.field-label { display: block; font-size: 13px; font-weight: 700; color: var(--text-secondary); margin-bottom: 6px; }
.field-input {
  width: 100%; border: 1px solid var(--border); border-radius: 12px;
  padding: 12px; font-size: 14px; outline: none; background: var(--bg-soft);
}
.field-input:focus { border-color: var(--brand); background: #fff; box-shadow: 0 0 0 1px var(--brand); }


.compose-modal { max-width: 560px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.modal-head h3 { margin-bottom: 0; }
.compose-who { font-size: 13px; color: var(--text-secondary); margin-bottom: 8px; }
.compose-who .cwho { font-weight: 700; color: var(--brand); }
.compose-area {
  width: 100%; min-height: 140px; border: 1px solid var(--border); border-radius: 12px;
  padding: 14px; font-size: 18px; font-family: inherit; resize: vertical; outline: none;
}
.compose-area:focus { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); }
.compose-bar { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; }
.char-count { font-size: 13px; color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.char-count.warn { color: #b45309; }
.char-count.over { color: var(--love); font-weight: 700; }
.compose-bar .modal-btn { width: auto; margin-top: 0; padding: 10px 22px; }
.compose-status { margin-top: 10px; font-size: 14px; }
.compose-status.ok { color: var(--green); }
.compose-status.err { color: var(--love); }

/* ===== Лёгкий лайтбокс для медиа ===== */
.lightbox {
  position: fixed; inset: 0; z-index: 200; background: rgba(0,0,0,0.9);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.lightbox img, .lightbox video { max-width: 92%; max-height: 92%; border-radius: 8px; }
.lightbox-close {
  position: absolute; top: 16px; right: 16px; background: none; border: none;
  color: #fff; font-size: 28px; cursor: pointer;
}
.lightbox-caption { position: absolute; bottom: 16px; left: 0; right: 0; text-align: center; color: #fff; font-size: 14px; }

/* ===== Приветственный блок ===== */
.welcome {
  text-align: center; padding: 60px 24px; color: var(--text-secondary);
}
.welcome-icon { font-size: 64px; display: block; margin-bottom: 16px; }
.welcome h2 { color: var(--text); font-size: 24px; margin-bottom: 8px; }

/* ===== Профиль ===== */
.account-card {
  border-bottom: 1px solid var(--border); padding-bottom: 4px;
}
.ac-header { width: 100%; height: 140px; object-fit: cover; display: block; background: linear-gradient(135deg, var(--brand), var(--accent));}
.ac-main { padding: 0 16px; }
.ac-row { display: flex; justify-content: space-between; align-items: flex-start; margin-top: -34px; }
.ac-avatar { width: 72px; height: 72px; border-radius: 50%; border: 4px solid #fff; object-fit: cover; background: #dbe3ea; }
.ac-stats { display: flex; gap: 18px; margin-bottom: 10px; }
.ac-stat b { font-weight: 800; font-size: 16px; }
.ac-stat span { color: var(--text-secondary); font-size: 14px; }
.ac-meta { font-size: 15px; color: var(--text-secondary); margin: 4px 0; }

/* ===== Заголовок страницы / хэштега ===== */
.page-head { padding: 16px; border-bottom: 1px solid var(--border); }
.page-head h1 { font-size: 20px; margin-bottom: 14px; }
.hash-chips { display: flex; gap: 8px; flex-wrap: wrap; }

/* ===== Адаптивность ===== */
@media (max-width: 1200px) {
  .app { grid-template-columns: 80px 1fr 320px; gap: 12px; }
  .nav-label, .logo-text, .compose-btn span, .sa-info { display: none; }
  .compose-btn span { display: none; }
  .compose-btn { font-size: 24px; }
}
@media (max-width: 1000px) {
  .app { grid-template-columns: 60px 1fr; }
  .right-col { display: none; }
}
@media (max-width: 600px) {
  .app { grid-template-columns: 1fr; padding: 0; }
  .sidebar { display: none; }
  .main-col { border: none; }
  .topbar { padding: 8px 12px; }
}

