:root {
    --accent: #6b4eff;
    --accent-hover: #5636e8;
    --ink: #1d1d1f;
    --ink-2: #5f6368;
    --line: #e6e6e6;
    --bg: #ffffff;
    --surface: #f2f2f2;
    --surface-2: #e9e9e9;
    --danger: #c62828;
    --ok: #1e7d4f;
    --radius: 16px;
    --shadow: 0 4px 24px rgba(0, 0, 0, .12);
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
    :root {
        --ink: #f1f1f1; --ink-2: #a8a8ad; --line: #333; --bg: #121212;
        --surface: #1f1f1f; --surface-2: #2a2a2a; --shadow: 0 4px 24px rgba(0, 0, 0, .6);
    }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); color: var(--ink); background: var(--bg); line-height: 1.45; }
a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
h1 { font-size: 1.9rem; margin: .2em 0 .4em; letter-spacing: -.01em; }
h2 { font-size: 1.25rem; margin: 1em 0 .6em; }
.muted { color: var(--ink-2); }
.small { font-size: .85rem; }
.warn { color: var(--danger); }
.row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.center { justify-content: center; }
.inline { display: inline; }

/* ---------- buttons & inputs ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
    border: 0; border-radius: 999px; padding: .65rem 1.1rem; font: 600 .95rem var(--font);
    cursor: pointer; background: var(--surface); color: var(--ink); text-decoration: none !important;
    transition: background .15s, transform .05s;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-light { background: var(--surface); }
.btn-light:hover { background: var(--surface-2); }
.btn-dark { background: var(--ink); color: var(--bg); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-lg { padding: .9rem 1.6rem; font-size: 1.05rem; }
.btn-sm { padding: .35rem .7rem; font-size: .8rem; }
.btn-block { width: 100%; }
button.link { background: none; border: 0; padding: 0; color: inherit; font: inherit; cursor: pointer; text-decoration: underline; }
input[type=text], input[type=email], input[type=password], input[type=url], input[type=search], select, textarea {
    width: 100%; padding: .75rem 1rem; border: 2px solid var(--line); border-radius: 14px;
    font: 1rem var(--font); background: var(--bg); color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: #7fb0ff; box-shadow: 0 0 0 3px rgba(80, 140, 255, .25); }
:focus-visible { outline: 3px solid #7fb0ff; outline-offset: 2px; }
textarea { resize: vertical; }
.chip {
    display: inline-block; padding: .4rem .85rem; border-radius: 999px; background: var(--surface);
    font-size: .88rem; font-weight: 600; border: 0; cursor: pointer; color: var(--ink);
}
.chip:hover { background: var(--surface-2); text-decoration: none; }
.chip.warn { background: #fde8e7; color: var(--danger); }

/* ---------- navbar ---------- */
.navbar {
    position: sticky; top: 0; z-index: 50; display: flex; align-items: center; gap: .75rem;
    padding: .6rem 1rem; background: var(--bg); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: .5rem; font-weight: 800; font-size: 1.15rem; color: var(--accent); }
.brand:hover { text-decoration: none; }
.nav-links { display: flex; gap: .25rem; }
.nav-pill { padding: .6rem 1rem; border-radius: 999px; font-weight: 600; }
.nav-pill:hover { background: var(--surface); text-decoration: none; }
.search { flex: 1; position: relative; min-width: 0; }
.search svg { position: absolute; left: 14px; top: 50%; width: 18px; height: 18px; transform: translateY(-50%); fill: var(--ink-2); }
.search input { background: var(--surface); border-color: transparent; padding-left: 2.6rem; border-radius: 999px; }
.nav-actions { display: flex; align-items: center; gap: .4rem; }
.icon-btn {
    position: relative; display: inline-grid; place-items: center; width: 44px; height: 44px;
    border-radius: 50%; border: 0; background: transparent; cursor: pointer; color: var(--ink); font-size: 1.3rem;
}
.icon-btn:hover { background: var(--surface); }
.icon-btn svg { width: 24px; height: 24px; fill: var(--ink-2); }
.badge {
    position: absolute; top: 2px; right: 0; min-width: 20px; height: 20px; padding: 0 5px;
    border-radius: 999px; background: var(--accent); color: #fff; font-size: .72rem; font-weight: 700;
    display: grid; place-items: center;
}
.avatar-btn { border: 0; background: none; padding: 4px; border-radius: 50%; cursor: pointer; }
.avatar-btn:hover { background: var(--surface); }

.menu { position: relative; }
.menu-panel {
    display: none; position: absolute; right: 0; top: calc(100% + 6px); min-width: 200px; z-index: 60;
    background: var(--bg); border-radius: 14px; box-shadow: var(--shadow); padding: .4rem;
}
.menu.open .menu-panel { display: block; }
.menu-panel a, .menu-panel button {
    display: block; width: 100%; text-align: left; padding: .6rem .8rem; border-radius: 10px;
    border: 0; background: none; font: 600 .95rem var(--font); color: var(--ink); cursor: pointer;
}
.menu-panel a:hover, .menu-panel button:hover { background: var(--surface); text-decoration: none; }
.menu-panel .danger { color: var(--danger); }

/* ---------- avatars ---------- */
.avatar {
    display: inline-grid; place-items: center; border-radius: 50%; object-fit: cover; flex: none;
    background: var(--surface-2); color: var(--ink); font-weight: 700;
}
.avatar-xs { width: 24px; height: 24px; font-size: .7rem; }
.avatar-sm { width: 32px; height: 32px; font-size: .85rem; }
.avatar-md { width: 48px; height: 48px; font-size: 1.1rem; }
.avatar-lg { width: 80px; height: 80px; font-size: 2rem; }
.avatar-xl { width: 120px; height: 120px; font-size: 3rem; }

/* ---------- layout ---------- */
.page { padding: 1rem 1rem 4rem; max-width: 1800px; margin: 0 auto; }
.page.narrow { max-width: 720px; }
.page-head { text-align: center; margin: 1rem 0; }
.page-head.row { justify-content: space-between; text-align: left; }
.section-title { text-align: center; margin-top: 2.5rem; }
.card { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.5rem; margin-bottom: 1.5rem; }
.hero { text-align: center; padding: 3rem 1rem 2rem; }
.hero h1 { font-size: clamp(2rem, 5vw, 3.4rem); }
.hero p { color: var(--ink-2); font-size: 1.15rem; max-width: 560px; margin: 0 auto 1.5rem; }
.tag-row { display: flex; gap: .5rem; flex-wrap: wrap; justify-content: center; margin: .5rem 0 1.25rem; }
.tag-row.small { justify-content: flex-start; margin: .75rem 0; }
.tabs { display: flex; gap: .25rem; justify-content: center; margin: 1rem 0; }
.tabs a { padding: .55rem 1rem; border-radius: 999px; font-weight: 600; }
.tabs a.active { background: var(--ink); color: var(--bg); }
.tabs a:hover { text-decoration: none; background: var(--surface); }
.tabs a.active:hover { background: var(--ink); }
.empty { text-align: center; padding: 4rem 1rem; color: var(--ink-2); }
.empty h2 { color: var(--ink); }
.pager { display: flex; justify-content: center; gap: .5rem; margin: 2rem 0; }

/* ---------- flash ---------- */
.flash-stack { display: grid; gap: .5rem; margin-bottom: .5rem; }
.flash-stack:not(:has(.flash)) { display: none; }
.flash {
    display: flex; justify-content: space-between; align-items: center; gap: 1rem;
    padding: .8rem 1rem; border-radius: 12px; font-weight: 500; margin-bottom: .75rem;
}
.flash button { background: none; border: 0; font-size: 1.2rem; cursor: pointer; color: inherit; }
.flash-success { background: #e5f5ec; color: var(--ok); }
.flash-error { background: #fde8e7; color: var(--danger); }

/* ---------- masonry ---------- */
.masonry { display: grid; grid-template-columns: repeat(auto-fill, minmax(236px, 1fr)); gap: 16px; align-items: start; }
.masonry.js-masonry { display: flex; align-items: flex-start; }
.masonry-col { flex: 1; display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.post-card { position: relative; }
.post-link { display: block; position: relative; border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.post-link img { display: block; width: 100%; height: auto; transition: filter .2s; }
.post-link:hover img { filter: brightness(.85); }
.post-overlay { position: absolute; left: 10px; bottom: 10px; display: flex; gap: .35rem; }
.post-stat { background: rgba(255, 255, 255, .92); color: #111; border-radius: 999px; padding: .2rem .6rem; font-size: .78rem; font-weight: 700; }
.post-meta { padding: .45rem .25rem 0; }
.post-title { display: block; font-weight: 600; font-size: .92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.post-author { display: flex; align-items: center; gap: .4rem; font-size: .82rem; color: var(--ink-2); margin-top: .25rem; }
.post-remove { position: absolute; top: 10px; right: 10px; opacity: 0; transition: opacity .15s; }
.post-card:hover .post-remove, .post-remove:focus-within { opacity: 1; }
.feed-next { height: 1px; width: 100%; }
.feed-loader { display: none; justify-content: center; gap: 6px; padding: 2rem; }
.feed-loader.active { display: flex; }
.feed-loader span { width: 10px; height: 10px; border-radius: 50%; background: var(--ink-2); animation: bounce 1s infinite ease-in-out; }
.feed-loader span:nth-child(2) { animation-delay: .15s; }
.feed-loader span:nth-child(3) { animation-delay: .3s; }
@keyframes bounce { 0%, 80%, 100% { transform: scale(.5); opacity: .4; } 40% { transform: scale(1); opacity: 1; } }

/* ---------- post detail ---------- */
/* Flat layout: no card frame around the post */
.post-detail {
    display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 2.5rem;
    max-width: 1180px; margin: 1rem auto 0; align-items: start;
}
.post-image { display: flex; justify-content: center; position: sticky; top: 82px; }
.post-image img { width: auto; max-width: 100%; height: auto; max-height: calc(100vh - 110px); display: block; border-radius: 24px; }
.post-info { padding: .25rem 0 2rem; min-width: 0; }
.post-toolbar { display: flex; justify-content: space-between; align-items: center; gap: .5rem; flex-wrap: wrap; position: sticky; top: 64px; background: var(--bg); padding: .25rem 0; z-index: 5; }
.like-btn svg { fill: var(--ink-2); transition: transform .15s; }
.like-btn.liked svg { fill: var(--accent); transform: scale(1.1); }
.like-count { font-weight: 700; }
.save-form { display: flex; gap: .4rem; }
.save-form select { width: auto; max-width: 180px; padding: .55rem .8rem; border-radius: 999px; }
.save-form .btn.save-btn { min-width: 92px; }
.save-form .btn.saved { background: var(--ink); color: var(--bg); }
.save-form .btn.saved:hover { background: var(--danger); color: #fff; }
.saved-in { display: flex; align-items: center; gap: .4rem; margin: .9rem 0 0; font-size: .88rem; color: var(--ink-2); }
.saved-in.is-empty { display: none; }
.saved-in svg { width: 16px; height: 16px; fill: var(--accent); flex: none; }
.saved-in a { font-weight: 600; color: var(--ink); }
.source-link { display: inline-block; margin-top: 1rem; font-weight: 600; text-decoration: underline; word-break: break-all; }
.post-info h1 { margin-top: .5rem; overflow-wrap: anywhere; }
.post-desc { white-space: pre-line; overflow-wrap: anywhere; }
.author-row { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin: 1.5rem 0; }
.person-link { display: flex; align-items: center; gap: .7rem; }
.person-link:hover { text-decoration: none; }
.person-link.center { justify-content: center; margin: .5rem 0; }
.comments ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 1rem; }
.comments li { display: flex; gap: .7rem; align-items: flex-start; overflow-wrap: anywhere; }
.comments li a strong, .comments li > div > a { font-weight: 700; margin-right: .3rem; }
.comment-form { display: flex; gap: .5rem; margin-top: 1rem; }
.comment-form input { border-radius: 999px; }
.report { margin-top: 2rem; }
.report summary { cursor: pointer; color: var(--ink-2); font-size: .9rem; }
.report .form { margin-top: 1rem; }

/* ---------- forms ---------- */
.form { display: grid; gap: 1rem; }
.form label { display: grid; gap: .35rem; font-weight: 600; font-size: .92rem; }
.form label.check { display: flex; align-items: center; gap: .5rem; font-weight: 500; flex-wrap: wrap; }
.form label.check .hint { flex-basis: 100%; }
.hint { font-weight: 400; color: var(--ink-2); font-size: .82rem; }
.field-error { color: var(--danger); font-weight: 500; font-size: .85rem; }
.post-editor { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 2rem; align-items: start; }
.dropzone {
    position: relative; display: grid; place-items: center; min-height: 420px; border-radius: 24px;
    background: var(--surface); border: 2px dashed var(--line); text-align: center; cursor: pointer; overflow: hidden;
}
.dropzone.static { cursor: default; border-style: solid; min-height: 0; }
.dropzone.drag { border-color: var(--accent); }
.dropzone input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dropzone .preview { width: 100%; height: auto; display: block; }
.dropzone.has-image .dz-text { display: none; }
.danger-zone { margin-top: 1rem; text-align: right; }
.avatar-edit { display: flex; align-items: center; gap: 1rem; }

/* ---------- auth ---------- */
.auth-card {
    max-width: 440px; margin: 3rem auto; padding: 2rem 2.2rem; border-radius: 32px;
    box-shadow: var(--shadow); text-align: center; background: var(--bg);
}
.auth-card .form { text-align: left; margin: 1.25rem 0; }
.auth-card a { font-weight: 600; }

/* ---------- profile & galleries ---------- */
.profile-head { text-align: center; margin: 1.5rem 0 1rem; }
.profile-head h1 { margin-bottom: .1rem; }
.profile-head .bio { max-width: 560px; margin: .5rem auto; overflow-wrap: anywhere; }
.profile-head .avatar-xl { margin: 0 auto; }
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1.5rem; margin-top: 1rem; }
.gallery-card a:hover { text-decoration: none; }
.gallery-card h3 { margin: .6rem 0 0; display: flex; align-items: center; gap: .3rem; font-size: 1.05rem; }
.gallery-card .lock { width: 16px; height: 16px; fill: var(--ink-2); }
.gallery-card p { margin: .1rem 0; font-size: .85rem; }
.gallery-cover {
    display: grid; grid-template-columns: 2fr 1fr; grid-template-rows: 1fr 1fr; gap: 2px;
    aspect-ratio: 3 / 2; border-radius: var(--radius); overflow: hidden; background: var(--surface);
}
.gallery-cover img { width: 100%; height: 100%; object-fit: cover; background: var(--surface-2); }
.gallery-cover img.main { grid-row: span 2; }
.gallery-cover img.main:only-child { grid-column: span 2; }
.gallery-cover.empty { background: var(--surface-2); }
.people { list-style: none; padding: 0; display: grid; gap: .5rem; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.person { padding: .6rem; border-radius: 14px; }
.person:hover { background: var(--surface); }

/* ---------- notifications ---------- */
.notif-list { list-style: none; padding: 0; margin: 0; }
.notif-list li { display: flex; gap: .8rem; align-items: center; padding: .8rem; border-radius: 14px; }
.notif-list li.unread { background: var(--surface); }
.notif-body { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.notif-body > a:first-child { font-weight: 700; }
.notif-thumb img { width: 56px; height: 56px; object-fit: cover; border-radius: 10px; display: block; }

/* ---------- admin ---------- */
.admin-tabs { justify-content: flex-start; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 1rem; margin: 1rem 0 2rem; }
.stat { background: var(--surface); border-radius: var(--radius); padding: 1.1rem; font-weight: 600; color: var(--ink-2); }
.stat span { display: block; font-size: 2rem; font-weight: 800; color: var(--ink); }
.stat.warn span { color: var(--danger); }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th, .table td { text-align: left; padding: .6rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th { color: var(--ink-2); font-weight: 600; }
.table .thumb { width: 48px; height: 48px; object-fit: cover; border-radius: 8px; display: block; }
.table .actions { white-space: nowrap; }
.table .actions form { display: inline-block; margin: 2px 0; }
.admin-tabs + .row input { max-width: 320px; }

/* ---------- errors & footer ---------- */
.error-page { text-align: center; padding-top: 4rem; }
.error-code { font-size: 4rem; font-weight: 800; color: var(--accent); margin: 0; }
.footer { display: none; }

/* ---------- responsive ---------- */
@media (max-width: 860px) {
    .post-detail { grid-template-columns: 1fr; gap: 1.25rem; }
    .post-image { position: static; }
    .post-image img { max-height: none; border-radius: 20px; }
    .post-editor { grid-template-columns: 1fr; }
    .dropzone { min-height: 260px; }
    .nav-links { display: none; }
    .post-toolbar { position: static; }
}
@media (max-width: 560px) {
    .brand span { display: none; }
    .nav-actions .btn { padding: .55rem .8rem; font-size: .85rem; }
    .masonry { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .masonry-col { gap: 10px; }
    .post-info { padding: 0 0 1rem; }
    .auth-card { margin: 1.5rem 1rem; padding: 1.5rem; box-shadow: none; }
    h1 { font-size: 1.6rem; }
}
.toast-stack { position: fixed; bottom: 1.5rem; left: 50%; transform: translateX(-50%); z-index: 100; }
.toast-stack .flash { box-shadow: var(--shadow); }

/* ---------- mobile bottom bar ---------- */
.bottom-bar { display: none; }
@media (max-width: 860px) {
    .bottom-bar {
        display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 70;
        justify-content: space-around; align-items: stretch;
        background: var(--bg); border-top: 1px solid var(--line);
        padding: 4px 4px calc(4px + env(safe-area-inset-bottom));
        box-shadow: 0 -2px 12px rgba(0, 0, 0, .06);
    }
    .bottom-bar a {
        flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
        min-height: 52px; padding: 4px 0; border-radius: 12px;
        font-size: .7rem; font-weight: 600; color: var(--ink-2);
    }
    .bottom-bar a:hover { text-decoration: none; background: var(--surface); }
    .bottom-bar svg { width: 24px; height: 24px; fill: currentColor; }
    .bottom-bar a.active { color: var(--ink); }
    .bottom-bar a.active .avatar { box-shadow: 0 0 0 2px var(--ink); }
    .bottom-bar a > svg { height: 28px; }
    .bb-icon { position: relative; display: grid; place-items: center; height: 28px; }
    .bb-icon .badge { top: -6px; right: -12px; }
    .bb-plus {
        display: grid; place-items: center; width: 40px; height: 28px; border-radius: 10px;
        background: var(--accent); color: #fff;
    }
    .bb-plus svg { width: 22px; height: 22px; }
    .bottom-bar .bb-create.active .bb-plus { background: var(--accent-hover); }
    /* The bar holds these now, so drop them from the top bar */
    .navbar .nav-actions a.icon-btn { display: none; }
    .navbar .nav-actions .btn { display: none; }
    body { padding-bottom: calc(68px + env(safe-area-inset-bottom)); }
    .toast-stack { bottom: calc(80px + env(safe-area-inset-bottom)); }
}

/* ---------- profile page ---------- */
.profile-page { max-width: 1800px; }
.profile-card {
    max-width: 880px; margin: .5rem auto 0; border-radius: 28px; overflow: clip;
    background: var(--bg); border: 1px solid var(--line);
}
.profile-cover { height: 180px; }
.cover-0 { background: linear-gradient(135deg, #8a6bff, #5636e8); }
.cover-1 { background: linear-gradient(135deg, #ff9a8b, #ff6a88 55%, #ff99ac); }
.cover-2 { background: linear-gradient(135deg, #43cea2, #185a9d); }
.cover-3 { background: linear-gradient(135deg, #f6d365, #fda085); }
.cover-4 { background: linear-gradient(135deg, #5ee7df, #b490ca); }
.cover-5 { background: linear-gradient(135deg, #30cfd0, #330867); }
.cover-6 { background: linear-gradient(135deg, #f093fb, #f5576c); }
.cover-7 { background: linear-gradient(135deg, #a8edea, #6b4eff); }
.profile-body { padding: 0 1.5rem 1.75rem; text-align: center; }
.profile-avatar { margin-top: -64px; display: flex; justify-content: center; }
.profile-avatar .avatar-xl {
    width: 128px; height: 128px; font-size: 3.2rem; border: 5px solid var(--bg);
    box-shadow: 0 6px 20px rgba(0, 0, 0, .12); background: var(--surface);
}
.profile-name { margin: .6rem 0 0; display: inline-flex; align-items: center; gap: .5rem; flex-wrap: wrap; justify-content: center; font-size: 2rem; }
.role-badge {
    font-size: .72rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
    background: var(--accent); color: #fff; border-radius: 999px; padding: .2rem .6rem;
}
.profile-handle { margin: .1rem 0 0; color: var(--ink-2); font-weight: 500; }
.profile-bio { max-width: 560px; margin: .9rem auto 0; font-size: 1.02rem; line-height: 1.55; white-space: pre-line; overflow-wrap: anywhere; }
.profile-meta {
    list-style: none; padding: 0; margin: .9rem 0 0; display: flex; justify-content: center;
    flex-wrap: wrap; gap: .4rem 1.25rem; color: var(--ink-2); font-size: .9rem;
}
.profile-meta li { display: inline-flex; align-items: center; gap: .35rem; }
.profile-meta svg { width: 18px; height: 18px; fill: currentColor; }
.profile-meta a { color: var(--accent); font-weight: 600; }
.profile-stats {
    display: flex; justify-content: center; gap: .5rem; margin: 1.25rem auto 0; max-width: 420px;
}
.profile-stats a {
    flex: 1; display: flex; flex-direction: column; align-items: center; padding: .6rem .5rem;
    border-radius: 16px; transition: background .15s;
}
.profile-stats a:hover { background: var(--surface); text-decoration: none; }
.profile-stats strong { font-size: 1.35rem; font-weight: 800; line-height: 1.2; }
.profile-stats span { font-size: .82rem; color: var(--ink-2); font-weight: 600; }
.profile-actions { display: flex; justify-content: center; gap: .6rem; margin-top: 1.25rem; flex-wrap: wrap; }
.btn.icon-only { width: 44px; height: 44px; padding: 0; }
.btn.icon-only svg { width: 20px; height: 20px; fill: currentColor; }
.profile-tabs { position: sticky; top: 65px; z-index: 20; background: var(--bg); padding: .6rem 0; margin: 1.25rem 0 1rem; }
.tab-count {
    display: inline-block; min-width: 1.6em; margin-left: .3rem; padding: .05rem .45rem; border-radius: 999px;
    background: var(--surface-2); color: var(--ink-2); font-size: .75rem; font-weight: 700; text-align: center;
}
.tabs a.active .tab-count { background: rgba(255, 255, 255, .2); color: inherit; }
.empty-state { text-align: center; padding: 3rem 1rem 4rem; max-width: 420px; margin: 0 auto; }
.empty-state svg { width: 64px; height: 64px; fill: var(--surface-2); }
.empty-state h2 { margin: .5rem 0 .3rem; }
.empty-state p { margin: 0 0 1.25rem; }
.gallery-new {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .2rem;
    aspect-ratio: 3 / 2; border-radius: var(--radius); border: 2px dashed var(--line); color: var(--ink);
    transition: border-color .15s, background .15s;
}
.gallery-new:hover { border-color: var(--accent); background: var(--surface); text-decoration: none; }
.bb-plus-lg {
    display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%;
    background: var(--accent); color: #fff; font-size: 1.8rem; font-weight: 400; margin-bottom: .3rem;
}
@media (max-width: 860px) {
    .profile-tabs { top: 61px; }
}
@media (max-width: 560px) {
    .profile-card { border-radius: 0; border: 0; border-bottom: 1px solid var(--line); margin: -1rem -1rem 0; }
    .profile-cover { height: 120px; }
    .profile-avatar { margin-top: -52px; }
    .profile-avatar .avatar-xl { width: 104px; height: 104px; font-size: 2.6rem; }
    .profile-name { font-size: 1.6rem; }
    .profile-body { padding: 0 1rem 1.5rem; }
}

/* ---------- image protection (deterrents; the server-side checks in MediaController do the real work) ---------- */
img { -webkit-user-drag: none; }
.post-link, .post-image, .gallery-cover, .notif-thumb, .table .thumb, .avatar {
    -webkit-touch-callout: none; -webkit-user-select: none; user-select: none;
}
/* A transparent layer above each image: right-click / long-press hits it, not the image itself */
.post-link::after, .post-image::after, .gallery-cover::after, .notif-thumb::after {
    content: ""; position: absolute; inset: 0; z-index: 1;
}
.post-image, .gallery-cover, .notif-thumb { position: relative; }
.post-overlay { z-index: 2; }
.notif-thumb { display: block; }
@media (max-width: 860px) { .post-image { position: relative; } }
@media print { .post-link img, .post-image img, .gallery-cover img { visibility: hidden; } }

/* ---------- admin: security & errors ---------- */
a.stat:hover { text-decoration: none; background: var(--surface-2); }
.sev { display: inline-block; padding: .15rem .55rem; border-radius: 999px; font-size: .72rem; font-weight: 800; letter-spacing: .03em; }
.sev-high { background: #fde8e7; color: #b42318; }
.sev-medium { background: #fff4e5; color: #b54708; }
.sev-low { background: var(--surface); color: var(--ink-2); }
.small-chip { padding: .1rem .5rem; font-size: .72rem; margin-top: .25rem; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .85em; overflow-wrap: anywhere; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: .4rem 1.25rem; margin: 1rem 0; }
.kv dt { color: var(--ink-2); font-weight: 600; }
.kv dd { margin: 0; overflow-wrap: anywhere; }
pre.stack { background: var(--surface); padding: 1rem; border-radius: 12px; overflow-x: auto; font-size: .78rem; max-height: 480px; }
.error-ref { margin: 1rem 0 1.5rem; }
.error-ref code { background: var(--surface); padding: .15rem .45rem; border-radius: 6px; font-weight: 700; }
.upload-error {
    grid-column: 1 / -1; margin: 0; padding: .75rem 1rem; border-radius: 12px;
    background: #fde8e7; color: var(--danger); font-weight: 600; font-size: .92rem;
}
.upload-error[hidden] { display: none; }

/* ================= landing page ================= */
.landing { overflow-x: clip; }
.landing .flash-stack { max-width: 1180px; margin: 1rem auto 0; padding: 0 1rem; }
.btn-white { background: #fff; color: #2b1f73; }
.btn-white:hover { background: #f1eeff; }
.lp-hero {
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 3rem; align-items: center;
    max-width: 1180px; margin: 0 auto; padding: 4rem 1.5rem 3rem; position: relative;
}
.lp-hero::before {
    content: ""; position: absolute; inset: -20% -10% auto auto; width: 70%; height: 120%; z-index: -1;
    background: radial-gradient(closest-side, rgba(107, 78, 255, .14), transparent);
}
.lp-eyebrow {
    display: inline-block; padding: .35rem .8rem; border-radius: 999px; background: #efeaff; color: #4c34d6;
    font-weight: 700; font-size: .82rem; letter-spacing: .02em;
}
.lp-hero h1 { font-size: clamp(2.3rem, 5vw, 3.9rem); line-height: 1.06; letter-spacing: -.03em; margin: 1rem 0; }
.lp-grad { background: linear-gradient(90deg, #6b4eff, #e0559b 60%, #ff8a4c); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lp-lead { font-size: 1.15rem; color: var(--ink-2); max-width: 520px; margin: 0 0 1.75rem; line-height: 1.6; }
.lp-cta { display: flex; gap: .75rem; flex-wrap: wrap; }
.lp-trust { list-style: none; padding: 0; margin: 1.5rem 0 0; display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; color: var(--ink-2); font-weight: 600; font-size: .9rem; }
.lp-trust li { display: inline-flex; align-items: center; gap: .35rem; }
.lp-trust svg { width: 18px; height: 18px; fill: #1e9e63; }

.lp-mosaic { position: relative; display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; height: 520px; overflow: hidden;
    -webkit-mask-image: linear-gradient(180deg, #000 80%, transparent); mask-image: linear-gradient(180deg, #000 80%, transparent); }
.lp-col { display: flex; flex-direction: column; gap: 14px; animation: lp-drift 14s ease-in-out infinite alternate; }
.lp-col-offset { margin-top: 48px; animation-direction: alternate-reverse; }
.lp-tile {
    position: relative; height: 200px; border-radius: 22px; display: flex; align-items: flex-end; padding: 14px;
    color: #fff; font-weight: 700; font-size: .9rem; box-shadow: 0 10px 30px rgba(30, 20, 80, .15); overflow: hidden;
}
.lp-tile.short { height: 140px; }
.lp-tile svg { position: absolute; right: 14px; top: 14px; width: 34px; height: 34px; fill: rgba(255, 255, 255, .9); }
.lp-tile span { background: rgba(0, 0, 0, .18); padding: .25rem .6rem; border-radius: 999px; backdrop-filter: blur(4px); }
.t1 { background: linear-gradient(160deg, #7f7fd5, #86a8e7 50%, #91eae4); }
.t2 { background: linear-gradient(160deg, #c79081, #dfa579); }
.t3 { background: linear-gradient(160deg, #f093fb, #f5576c); }
.t4 { background: linear-gradient(160deg, #4facfe, #00f2fe); }
.t5 { background: linear-gradient(160deg, #43e97b, #38f9d7); }
.t6 { background: linear-gradient(160deg, #fa709a, #fee140); }
.t7 { background: linear-gradient(160deg, #30cfd0, #330867); }
.t8 { background: linear-gradient(160deg, #f6d365, #fda085); }
.t9 { background: linear-gradient(160deg, #6b4eff, #a18cd1); }
.lp-float {
    position: absolute; display: inline-flex; align-items: center; gap: .4rem; background: var(--bg); color: var(--ink);
    border-radius: 999px; padding: .55rem .95rem; font-size: .85rem; box-shadow: 0 12px 30px rgba(20, 10, 60, .18);
    animation: lp-bob 4s ease-in-out infinite;
}
.lp-float svg { width: 16px; height: 16px; fill: var(--accent); }
.lp-float-save { left: -6px; top: 73%; }
.lp-float-like { right: 8px; top: 44%; animation-delay: -2s; font-weight: 700; }
.lp-float-like svg { fill: #e0559b; }
@keyframes lp-drift { from { transform: translateY(0); } to { transform: translateY(-40px); } }
@keyframes lp-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@media (prefers-reduced-motion: reduce) { .lp-col, .lp-float { animation: none; } }

.lp-section { max-width: 1180px; margin: 0 auto; padding: 3.5rem 1.5rem; }
.lp-section-head { text-align: center; max-width: 620px; margin: 0 auto 2.25rem; }
.lp-section-head h2 { font-size: clamp(1.6rem, 3vw, 2.3rem); letter-spacing: -.02em; margin: 0 0 .5rem; }
.lp-section-head p { color: var(--ink-2); font-size: 1.05rem; margin: 0; }
.lp-features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem; }
.lp-feature { padding: 1.5rem; border-radius: 20px; border: 1px solid var(--line); background: var(--bg); transition: transform .2s, box-shadow .2s; }
.lp-feature:hover { transform: translateY(-3px); box-shadow: 0 14px 34px rgba(30, 20, 80, .08); }
.lp-feature h3 { margin: .9rem 0 .35rem; font-size: 1.08rem; }
.lp-feature p { margin: 0; color: var(--ink-2); line-height: 1.55; }
.lp-icon { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 14px; }
.lp-icon svg { width: 24px; height: 24px; fill: #fff; }
.i1 { background: linear-gradient(135deg, #6b4eff, #9f87ff); }
.i2 { background: linear-gradient(135deg, #f5576c, #f093fb); }
.i3 { background: linear-gradient(135deg, #00b4db, #0083b0); }
.i4 { background: linear-gradient(135deg, #f7971e, #ffd200); }
.i5 { background: linear-gradient(135deg, #11998e, #38ef7d); }
.i6 { background: linear-gradient(135deg, #434343, #7a7a7a); }
.lp-steps-wrap { background: var(--surface); border-radius: 32px; max-width: 1132px; }
.lp-steps { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem; counter-reset: none; }
.lp-steps li { background: var(--bg); border-radius: 20px; padding: 1.5rem; }
.lp-steps h3 { margin: .8rem 0 .3rem; }
.lp-steps p { margin: 0; color: var(--ink-2); }
.lp-num { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: var(--accent); color: #fff; font-weight: 800; }
.lp-center { text-align: center; margin-top: 2rem; }
.lp-band {
    max-width: 1132px; margin: 1rem auto 3rem; padding: 3.5rem 1.5rem; text-align: center; color: #fff; border-radius: 32px;
    background: radial-gradient(circle at 20% 20%, rgba(255, 255, 255, .18), transparent 40%), linear-gradient(135deg, #6b4eff, #b14bd8 55%, #ff7a59);
}
.lp-band h2 { font-size: clamp(1.7rem, 3.5vw, 2.6rem); margin: 0 0 .5rem; letter-spacing: -.02em; }
.lp-band p { margin: 0 auto 1.5rem; max-width: 520px; opacity: .92; font-size: 1.05rem; }
.lp-band .lp-band-login { margin: 1rem auto 0; font-size: .95rem; }
.lp-band .lp-band-login a { color: #fff; font-weight: 700; text-decoration: underline; }

.site-footer { border-top: 1px solid var(--line); padding: 2rem 1.5rem; }
.site-footer-inner { max-width: 1180px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.site-footer nav { display: flex; gap: 1.25rem; flex-wrap: wrap; font-weight: 600; }
.site-footer p { margin: 0; }

/* onboarding (signed in, empty feed) */
.onboard { max-width: 880px; margin: 2rem auto; text-align: center; }
.onboard h1 { font-size: clamp(1.7rem, 3.5vw, 2.4rem); }
.onboard-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; margin-top: 1.75rem; text-align: left; }
.onboard-card {
    display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 1rem; align-items: center;
    padding: 1.25rem; border-radius: 20px; border: 1px solid var(--line); transition: border-color .15s, transform .15s;
}
.onboard-card .lp-icon { grid-row: span 2; }
.onboard-card:hover { border-color: var(--accent); transform: translateY(-2px); text-decoration: none; }

@media (max-width: 960px) {
    .lp-hero { grid-template-columns: 1fr; padding-top: 2.5rem; gap: 2rem; text-align: center; }
    .lp-lead { margin-left: auto; margin-right: auto; }
    .lp-cta, .lp-trust { justify-content: center; }
    .lp-mosaic { height: 380px; max-width: 560px; margin: 0 auto; width: 100%; }
    .lp-tile { height: 150px; } .lp-tile.short { height: 105px; }
    .lp-features { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
    .lp-features, .lp-steps, .onboard-grid { grid-template-columns: 1fr; }
    .lp-hero { padding: 1.75rem 1rem 1.5rem; }
    .lp-lead { font-size: 1rem; }
    .lp-cta .btn { width: 100%; max-width: 320px; }
    .lp-section { padding: 2.5rem 1rem; }
    .lp-steps-wrap, .lp-band { border-radius: 0; }
    .lp-band { margin-bottom: 0; }
    .lp-mosaic { height: 300px; gap: 10px; } .lp-col { gap: 10px; }
    .lp-tile { height: 120px; font-size: .75rem; padding: 10px; } .lp-tile.short { height: 86px; }
    .lp-tile svg { width: 24px; height: 24px; right: 10px; top: 10px; }
    .lp-float { font-size: .75rem; padding: .4rem .7rem; }
    .site-footer-inner { flex-direction: column; text-align: center; }
}

/* ================= settings page ================= */
input[type=file] { max-width: 100%; font: .88rem var(--font); color: var(--ink-2); }
input[type=file]::file-selector-button {
    margin-right: .75rem; padding: .5rem 1rem; border: 0; border-radius: 999px; cursor: pointer;
    font: 600 .88rem var(--font); background: var(--bg); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line);
    transition: background .15s;
}
input[type=file]::file-selector-button:hover { background: var(--surface-2); }
.settings h1 { margin-bottom: 1rem; }
.settings .card { padding: 1.75rem; }
.settings .form { gap: 1.15rem; }
.settings .card-head { padding-bottom: 1rem; border-bottom: 1px solid var(--line); }
.settings .card-head h2 { margin: 0 0 .2rem; }
.settings .card-head p { margin: 0; color: var(--ink-2); font-size: .9rem; }
.settings .avatar-edit { padding: 1rem 1.1rem; border-radius: 14px; background: var(--surface); }
.settings .avatar-pick { flex: 1; min-width: 0; }
.settings .two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 1.15rem; }
.settings .form > .btn { justify-self: end; min-width: 11rem; margin-top: .25rem; }
@media (max-width: 600px) {
    .settings .card { padding: 1.25rem; }
    .settings .two-col { grid-template-columns: 1fr; }
    .settings .form > .btn { justify-self: stretch; }
    .settings .avatar-edit { align-items: flex-start; }
    .settings .avatar-edit .avatar-lg { width: 64px; height: 64px; font-size: 1.6rem; }
}
