:root {
    --bg: #f0f2f5;
    --card: #ffffff;
    --ink: #050505;
    --muted: #65676b;
    --line: #ced0d4;
    --blue: #1877f2;
    --blue-soft: #e7f3ff;
    --hover: #f2f2f2;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    --radius: 8px;
    --max: 1280px;
    --sans: Inter, "Segoe UI", Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body.sf-body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--sans);
    color: var(--ink);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }

.sf-preview {
    background: var(--blue);
    color: #fff;
    text-align: center;
    padding: .45rem;
    font-weight: 700;
    font-size: .85rem;
    position: relative;
    z-index: 60;
}
.sf-preview a { text-decoration: underline; }

/* —— Header —— */
.sf-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--card);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
}
.sf-header-inner {
    width: min(var(--max), 100%);
    margin: 0 auto;
    min-height: 56px;
    padding: 0 .75rem;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: .5rem;
}
.sf-header-left {
    display: flex;
    align-items: center;
    gap: .5rem;
}
.sf-logo {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--blue);
    color: #fff;
    display: grid;
    place-content: center;
    font-weight: 800;
    font-size: 1.25rem;
    flex-shrink: 0;
}
.sf-search {
    display: flex;
    align-items: center;
    gap: .45rem;
    background: var(--bg);
    border-radius: 999px;
    padding: .55rem .9rem;
    min-width: 180px;
    max-width: 280px;
    color: var(--muted);
}
.sf-search input {
    border: 0;
    outline: none;
    background: transparent;
    width: 100%;
    font: inherit;
    font-size: .95rem;
    color: var(--ink);
}

.sf-tabs {
    display: flex;
    align-items: stretch;
    gap: .25rem;
    justify-content: center;
}
.sf-tabs a {
    min-width: 90px;
    height: 52px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .1rem;
    color: var(--muted);
    border-radius: 8px;
    border-bottom: 3px solid transparent;
    font-size: .7rem;
    font-weight: 600;
}
.sf-tabs a:hover { background: var(--hover); }
.sf-tabs a.is-active {
    color: var(--blue);
    border-bottom-color: var(--blue);
    border-radius: 8px 8px 0 0;
}
.sf-header-right {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: .4rem;
}
.sf-icon-btn {
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 50%;
    background: var(--bg);
    display: grid;
    place-content: center;
    cursor: pointer;
    position: relative;
    font-size: 1rem;
    color: var(--ink);
}
.sf-icon-btn:hover { filter: brightness(0.97); }
.sf-dot {
    position: absolute;
    top: 6px;
    right: 7px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #e41e3f;
    border: 2px solid #fff;
}

.sf-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: grid;
    place-content: center;
    background: linear-gradient(145deg, #1877f2, #0d5ecf);
    color: #fff;
    font-weight: 700;
    flex-shrink: 0;
}
.sf-avatar-sm { width: 36px; height: 36px; font-size: .9rem; }
.sf-avatar-md { width: 40px; height: 40px; }

.sf-main {
    width: min(var(--max), 100%);
    margin: 0 auto;
    padding: 1rem .75rem 2.5rem;
}
.sf-shell {
    display: grid;
    grid-template-columns: 280px minmax(0, 680px) 300px;
    gap: 1rem;
    justify-content: center;
    align-items: start;
}
.sf-shell-solo {
    display: block;
    max-width: 680px;
    margin: 2rem auto;
}

.sf-card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: .85rem 1rem;
    margin-bottom: 1rem;
}

/* —— Side columns —— */
.sf-col-left,
.sf-col-right {
    position: sticky;
    top: 72px;
    max-height: calc(100vh - 88px);
    overflow: auto;
    scrollbar-width: thin;
}
.sf-side-nav { display: flex; flex-direction: column; gap: .15rem; }
.sf-side-item {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .55rem .65rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: .95rem;
}
.sf-side-item:hover,
.sf-side-item.is-active { background: rgba(0, 0, 0, 0.05); }
.sf-side-dot {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--c, var(--blue));
    flex-shrink: 0;
}
.sf-side-ico {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: var(--blue);
    flex-shrink: 0;
}
.sf-ico-home { background: var(--blue); }
.sf-ico-flag { background: #f02849; }
.sf-ico-settings { background: #65676b; }
.sf-side-legal {
    margin: 1rem .65rem 0;
    font-size: .75rem;
    color: var(--muted);
    line-height: 1.5;
}

.sf-widget {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: .85rem 1rem;
    margin-bottom: 1rem;
}
.sf-widget h2,
.sf-widget-title {
    margin: 0 0 .75rem;
    font-size: 1.05rem;
}
.sf-widget-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.sf-ad {
    display: block;
    padding: .85rem;
    border-radius: 8px;
    background: linear-gradient(135deg, #e7f3ff, #f0f2f5);
    border: 1px solid #dce3ec;
}
.sf-ad strong { display: block; margin-bottom: .25rem; color: var(--blue); }
.sf-ad span { font-size: .85rem; color: var(--muted); }
.sf-trend-list,
.sf-suggest-list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.sf-trend-list li,
.sf-suggest-list li {
    display: flex;
    gap: .65rem;
    align-items: flex-start;
    padding: .55rem 0;
    border-top: 1px solid #eee;
}
.sf-trend-list li:first-child,
.sf-suggest-list li:first-child { border-top: 0; }
.sf-trend-list span {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--bg);
    display: grid;
    place-content: center;
    font-size: .75rem;
    font-weight: 700;
    color: var(--muted);
    flex-shrink: 0;
}
.sf-trend-list a,
.sf-suggest-list strong {
    display: block;
    font-size: .92rem;
    font-weight: 600;
    line-height: 1.3;
}
.sf-trend-list small,
.sf-suggest-list small {
    display: block;
    color: var(--muted);
    font-size: .78rem;
    margin-top: .15rem;
}
.sf-suggest-list li { align-items: center; }
.sf-suggest-list li > div { flex: 1; min-width: 0; }
.sf-chip-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: .4rem .75rem;
    border-radius: 6px;
    background: var(--blue-soft);
    color: var(--blue);
    font-weight: 700;
    font-size: .85rem;
    white-space: nowrap;
}
.sf-chip-btn:hover { filter: brightness(0.97); }
.sf-muted { color: var(--muted); margin: .25rem 0 0; }

/* —— Composer / stories —— */
.sf-composer h1 { margin: 0; font-size: 1.15rem; }
.sf-composer-row {
    display: flex;
    align-items: center;
    gap: .65rem;
}
.sf-composer-input {
    flex: 1;
    background: var(--bg);
    border-radius: 999px;
    padding: .7rem 1rem;
    color: var(--muted);
}
.sf-composer-input:hover { background: #e4e6e9; }
.sf-composer-actions {
    display: flex;
    justify-content: space-around;
    gap: .5rem;
    margin-top: .85rem;
    padding-top: .75rem;
    border-top: 1px solid #eee;
    color: var(--muted);
    font-size: .9rem;
    font-weight: 600;
}
.sf-stories {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: .55rem;
    padding: .75rem !important;
}
.sf-story {
    position: relative;
    aspect-ratio: 9 / 16;
    max-height: 200px;
    border-radius: 10px;
    overflow: hidden;
    background: #ddd;
}
.sf-story img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.sf-story span {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 1.5rem .4rem .45rem;
    background: linear-gradient(transparent, rgba(0,0,0,.75));
    color: #fff;
    font-size: .72rem;
    font-weight: 700;
    line-height: 1.25;
}

/* —— Posts —— */
.sf-feed { display: flex; flex-direction: column; gap: 1rem; }
.sf-post { padding: 0; overflow: hidden; }
.sf-post-head {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .85rem 1rem .5rem;
}
.sf-post-who { flex: 1; min-width: 0; }
.sf-author {
    display: block;
    font-weight: 700;
    font-size: .95rem;
}
.sf-author:hover { text-decoration: underline; }
.sf-post-who p {
    margin: .1rem 0 0;
    font-size: .8rem;
    color: var(--muted);
}
.sf-post-who a { color: var(--muted); }
.sf-post-who a:hover { text-decoration: underline; }
.sf-more {
    border: 0;
    background: transparent;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    color: var(--muted);
    font-size: 1.25rem;
}
.sf-more:hover { background: var(--hover); }
.sf-post-body { padding: 0 1rem .75rem; }
.sf-post-body p {
    margin: 0;
    font-size: .95rem;
    line-height: 1.45;
    white-space: pre-wrap;
}
.sf-see-more {
    display: inline-block;
    margin-top: .35rem;
    color: var(--muted);
    font-weight: 600;
}
.sf-post-media {
    display: block;
    background: #000;
}
.sf-post-media img,
.sf-post-media-static img {
    width: 100%;
    max-height: 520px;
    object-fit: cover;
}
.sf-post-stats {
    display: flex;
    justify-content: space-between;
    gap: .75rem;
    padding: .65rem 1rem;
    font-size: .9rem;
    color: var(--muted);
    border-bottom: 1px solid #eee;
}
.sf-post-stats i { font-style: normal; }
.sf-post-actions {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    padding: .25rem .35rem;
}
.sf-post-actions button,
.sf-post-actions a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    border: 0;
    background: transparent;
    min-height: 40px;
    border-radius: 6px;
    font: inherit;
    font-weight: 600;
    font-size: .92rem;
    color: var(--muted);
    cursor: pointer;
}
.sf-post-actions button:hover,
.sf-post-actions a:hover { background: var(--hover); }
.sf-post-actions .is-liked {
    color: var(--blue);
    background: var(--blue-soft);
}
.sf-post-actions .is-copied { color: var(--blue); }

.sf-post-title {
    margin: 0;
    padding: 0 1rem .75rem;
    font-size: 1.35rem;
    line-height: 1.25;
}
.sf-lead {
    margin: 0;
    padding: 0 1rem .75rem;
    color: var(--muted);
    font-size: 1.02rem;
}
.sf-prose {
    padding: 0 1rem 1rem;
    line-height: 1.65;
    font-size: 1rem;
}
.sf-prose p { margin: 0 0 1rem; }
.sf-prose img {
    width: 100%;
    height: auto;
    border-radius: 6px;
    margin: .75rem 0;
}
.sf-source { padding: 0 1rem 1rem; }
.sf-empty { text-align: center; color: var(--muted); }
.sf-empty-page { padding: 2.5rem 1.5rem; }
.sf-empty-page h1 { margin: 0 0 .5rem; color: var(--ink); }

.sf-footer {
    padding: 1rem .75rem 2rem;
    color: var(--muted);
    font-size: .8rem;
    text-align: center;
}
.sf-footer-inner { width: min(var(--max), 100%); margin: 0 auto; }
.sf-footer p { margin: 0 0 .25rem; }

@media (max-width: 1100px) {
    .sf-shell { grid-template-columns: 240px minmax(0, 1fr); }
    .sf-col-right { display: none; }
}
@media (max-width: 860px) {
    .sf-shell { grid-template-columns: 1fr; }
    .sf-col-left { display: none; }
    .sf-header-inner { grid-template-columns: auto 1fr auto; }
    .sf-tabs span { display: none; }
    .sf-tabs a { min-width: 56px; }
    .sf-stories { grid-template-columns: repeat(3, 1fr); }
    .sf-stories .sf-story:nth-child(n+4) { display: none; }
    .sf-search { max-width: 160px; min-width: 0; }
}
@media (max-width: 520px) {
    .sf-post-actions { font-size: .82rem; }
    .sf-composer-actions span:last-child { display: none; }
}
