:root {
  color-scheme: dark;
  --bg: #070714;
  --card: #101326;
  --card-2: #0c1020;
  --soft: #181d34;
  --line: #303857;
  --text: #f8f6ff;
  --muted: #a8aec4;
  --pink: #f03bad;
  --purple: #934cf5;
  --danger: #fb5e75;
}

* { box-sizing: border-box; }
body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background: radial-gradient(circle at 35% -10%, #21153b 0, var(--bg) 38%);
  font: 15px/1.45 Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
}
body.modal-open { overflow: hidden; }
button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.feed-topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 18px;
  min-height: 70px;
  padding: 12px max(18px, calc((100% - 1420px) / 2));
  background: rgba(7, 9, 22, .92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}
.feed-brand { color: var(--text); font-size: 25px; font-weight: 950; text-decoration: none; }
.feed-brand span { color: var(--pink); }
.feed-topbar > strong { flex: 1; }
.feed-back, .feed-sync-mobile {
  color: var(--text);
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 12px;
}
.feed-sync-mobile { display: none; }

.feed-page-grid {
  width: min(1420px, calc(100% - 32px));
  margin: 24px auto 60px;
  display: grid;
  grid-template-columns: minmax(0, 860px) minmax(340px, 1fr);
  gap: 22px;
  align-items: start;
}
.feed-shell { width: 100%; min-width: 0; }
.feed-intro, .composer, .post, .login-callout {
  display: block;
  margin-bottom: 14px;
  padding: 19px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: linear-gradient(145deg, rgba(18, 22, 43, .98), rgba(12, 15, 31, .98));
  box-shadow: 0 14px 42px rgba(0, 0, 0, .12);
}
.feed-intro { border-color: rgba(147, 76, 245, .7); }
.feed-kicker { color: #daafff; font-size: 11px; font-weight: 900; letter-spacing: .12em; text-transform: uppercase; }
.feed-intro h1 { margin: 5px 0 4px; font-size: 24px; }
.feed-intro p, .feed-status { color: var(--muted); }
.feed-intro p { margin: 0; }

.composer label { display: block; margin-bottom: 8px; font-weight: 850; }
.composer textarea {
  width: 100%;
  resize: vertical;
  min-height: 112px;
  padding: 13px;
  color: var(--text);
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 14px;
}
.composer textarea:focus, .comment-form textarea:focus, .report-card textarea:focus, .report-card select:focus { border-color: var(--pink); outline: 2px solid rgba(240, 59, 173, .16); }
.composer-row { display: flex; gap: 9px; align-items: center; margin-top: 10px; flex-wrap: wrap; }
.composer select, .composer button, .media-picker, .load-more, .post button {
  min-height: 40px;
  padding: 9px 12px;
  color: var(--text);
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 11px;
}
.composer .media-picker { display: inline-flex; align-items: center; gap: 7px; margin: 0; cursor: pointer; }
.composer button, .load-more { margin-left: auto; background: linear-gradient(135deg, var(--purple), var(--pink)); font-weight: 900; cursor: pointer; }
.selected-file { min-height: 18px; margin: 7px 0 0; color: var(--muted); font-size: 12px; }
.visually-hidden { position: absolute !important; width: 1px !important; height: 1px !important; overflow: hidden !important; clip: rect(0 0 0 0) !important; white-space: nowrap !important; }
.login-callout { color: var(--text); text-decoration: none; border-color: var(--pink); }
.feed-list { display: grid; gap: 14px; }

.post { overflow: hidden; }
.post-head { display: flex; align-items: center; gap: 10px; }
.post-head.is-link { cursor: pointer; }
.post-avatar { width: 46px; height: 46px; border-radius: 50%; object-fit: cover; background: var(--soft); }
.post-author { font-weight: 900; }
.post-user, .post-time { color: var(--muted); font-size: 12px; }
.post-lock { margin-left: auto; color: #c9a7ff; }
.post-owner-actions { margin-left: auto; }
.post-owner-actions button { min-height: auto; padding: 7px 10px; color: var(--danger); background: transparent; }
.post-text { margin: 14px 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.post-media-button { display: block; width: 100%; padding: 0 !important; overflow: hidden; background: #030305 !important; border-radius: 17px !important; cursor: zoom-in; }
.post-image { display: block; width: 100%; max-height: 680px; object-fit: contain; background: #030305; }
.post-actions { display: flex; align-items: center; gap: 8px; margin-top: 12px; }
.post-actions button { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; }
.post-actions button:hover { border-color: #676f96; background: #202640; }
.post-actions .liked { color: #ff5fb9; border-color: rgba(240, 59, 173, .55); }
.post-actions .danger { margin-left: auto; color: #ff9bac; }
.action-icon { font-size: 18px; line-height: 1; }
.load-more { width: 100%; margin-top: 16px; }
.feed-status { min-height: 22px; text-align: center; }

.feed-sync {
  position: sticky;
  top: 94px;
  height: calc(100dvh - 118px);
  min-height: 540px;
  overflow: hidden;
  border: 1px solid rgba(117, 90, 177, .58);
  border-radius: 20px;
  background: #0b0e17;
  box-shadow: 0 22px 60px rgba(0, 0, 0, .3);
}
.feed-sync-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 68px; padding: 12px 15px; border-bottom: 1px solid var(--line); }
.feed-sync-heading div { display: grid; }
.feed-sync-heading span { color: #d7b2ff; font-size: 11px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.feed-sync-heading strong { font-size: 16px; }
.feed-sync-heading a { color: #d9c8ff; font-size: 12px; text-decoration: none; }
.feed-sync iframe { display: block; width: 100%; height: calc(100% - 68px); border: 0; background: #0b0e17; }

.social-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(2, 3, 9, .82);
  backdrop-filter: blur(9px);
}
.social-modal[hidden] { display: none !important; }
.modal-card {
  position: relative;
  width: min(1180px, 100%);
  max-height: min(850px, calc(100dvh - 44px));
  overflow: hidden;
  border: 1px solid #414a70;
  border-radius: 22px;
  background: #0b0e1b;
  box-shadow: 0 35px 100px rgba(0, 0, 0, .64);
}
.post-viewer { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(330px, .75fr); height: min(800px, calc(100dvh - 44px)); }
.viewer-media { position: relative; display: grid; place-items: center; min-width: 0; overflow: hidden; background: #020204; }
.viewer-media img { display: block; max-width: 100%; max-height: 100%; object-fit: contain; transform: scale(var(--zoom, 1)); transform-origin: center; transition: transform .16s ease; }
.viewer-media.no-image { padding: 40px; background: radial-gradient(circle at top, #211636, #080a13 60%); }
.viewer-text-only { max-width: 620px; color: #f8f6ff; font-size: clamp(20px, 3vw, 34px); white-space: pre-wrap; overflow-wrap: anywhere; }
.viewer-tools { position: absolute; left: 16px; bottom: 16px; display: flex; gap: 8px; }
.viewer-tools button, .modal-close {
  width: 42px;
  height: 42px;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, .2);
  border-radius: 50%;
  background: rgba(13, 16, 28, .82);
  cursor: pointer;
}
.modal-close { position: absolute; top: 14px; right: 14px; z-index: 4; font-size: 25px; }
.viewer-side { display: grid; grid-template-rows: auto minmax(0, 1fr) auto auto; min-width: 0; border-left: 1px solid var(--line); }
.viewer-head { display: flex; align-items: center; gap: 10px; padding: 18px 58px 15px 16px; border-bottom: 1px solid var(--line); }
.viewer-head img, .comment-avatar { width: 40px; height: 40px; flex: 0 0 auto; border-radius: 50%; object-fit: cover; background: var(--soft); }
.viewer-comments { overflow: auto; padding: 8px 16px 16px; }
.comment-empty { color: var(--muted); text-align: center; padding: 40px 12px; }
.comment-item { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 10px; padding: 12px 0; border-bottom: 1px solid rgba(48, 56, 87, .56); }
.comment-body { min-width: 0; }
.comment-meta { display: flex; align-items: baseline; gap: 7px; }
.comment-meta strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.comment-meta span { color: var(--muted); font-size: 11px; }
.comment-body p { margin: 4px 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.comment-actions { display: flex; gap: 10px; }
.comment-actions button { padding: 0; color: var(--muted); border: 0; background: transparent; font-size: 12px; cursor: pointer; }
.comment-actions .danger { color: #ff8fa2; }
.viewer-post-actions { display: flex; gap: 8px; padding: 11px 16px; border-top: 1px solid var(--line); }
.viewer-post-actions button { color: var(--text); border: 1px solid var(--line); border-radius: 11px; background: var(--soft); padding: 8px 11px; cursor: pointer; }
.comment-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 9px; padding: 12px 16px 16px; }
.comment-form textarea { min-height: 48px; max-height: 120px; resize: vertical; padding: 11px; color: var(--text); background: var(--soft); border: 1px solid var(--line); border-radius: 12px; }
.comment-form button { padding: 0 16px; color: #fff; border: 0; border-radius: 12px; background: linear-gradient(135deg, var(--purple), var(--pink)); font-weight: 900; cursor: pointer; }
.comment-login { margin: 0 16px 16px; padding: 11px; color: #fff; text-align: center; text-decoration: none; border: 1px solid var(--pink); border-radius: 12px; }

.compact-modal { width: min(500px, 100%); padding: 24px; overflow: visible; }
.compact-modal h2 { margin: 0 46px 7px 0; }
.compact-modal p { color: var(--muted); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.modal-actions button { padding: 10px 15px; color: var(--text); border: 1px solid var(--line); border-radius: 11px; background: var(--soft); cursor: pointer; }
.modal-actions .primary { border: 0; background: linear-gradient(135deg, var(--purple), var(--pink)); font-weight: 900; }
.modal-actions .danger { border-color: #863449; color: #fff; background: #be3451; font-weight: 900; }
.report-card label { display: grid; gap: 6px; margin-top: 13px; font-weight: 800; }
.report-card select, .report-card textarea { width: 100%; padding: 11px; color: var(--text); border: 1px solid var(--line); border-radius: 11px; background: var(--soft); }
.report-card textarea { min-height: 105px; resize: vertical; }

@media (max-width: 1050px) {
  .feed-page-grid { grid-template-columns: minmax(0, 760px); justify-content: center; }
  .feed-sync { display: none; }
  .feed-sync-mobile { display: inline-flex; }
}
@media (max-width: 760px) {
  .feed-topbar { gap: 8px; min-height: 62px; padding-inline: 12px; }
  .feed-topbar > strong { display: none; }
  .feed-back, .feed-sync-mobile { padding: 7px 9px; font-size: 12px; }
  .feed-page-grid { width: min(100% - 20px, 720px); margin-top: 12px; }
  .post, .composer, .feed-intro { padding: 14px; border-radius: 16px; }
  .composer-row > * { flex: 1 1 auto; }
  .post-viewer { display: grid; grid-template-columns: 1fr; grid-template-rows: minmax(220px, 48dvh) minmax(0, 1fr); height: calc(100dvh - 20px); }
  .social-modal { padding: 10px; }
  .modal-card { max-height: calc(100dvh - 20px); border-radius: 16px; }
  .viewer-side { border-top: 1px solid var(--line); border-left: 0; }
  .viewer-comments { min-height: 130px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
