body {
    zoom: var(--page-zoom, 1);
    /* Compensate for CSS zoom shrinking the body box, so centred panels and
       full-width slide-overs stay centred at every saved zoom level. */
    width: calc(100% / var(--page-zoom, 1));
    min-height: calc(100% / var(--page-zoom, 1));
    background: #fff;
    color: #1b1b1b;
    font-family: system-ui;
    margin: 0;
    overflow-x: hidden;
    touch-action: manipulation;
}
html, body {
    height: 100%;
}

.splash {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    z-index: 3000;
    height: 100vh;
}
.splash-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 28px;
}
.splash-title {
    margin-top: -6px;
    color: #0a355a;
    font: 900 clamp(18px, 5vw, 24px)/1 system-ui, -apple-system, sans-serif;
    letter-spacing: .16em;
}
.splash-logo {
    width: min(72vw, 310px);
    height: auto;
    object-fit: contain;
}
.splash-ring {
    width: 42px;
    height: 42px;
    box-sizing: border-box;
    border-radius: 50%;
    border: 5px solid rgba(10, 53, 90, .16);
    border-top-color: #0a355a;
    background: transparent !important;
    background-image: none !important;
    animation: spin .8s linear infinite;
}
.splash-codex-id {
    margin-top: -20px;
    color: #657086;
    font: 800 11px/1.2 system-ui, -apple-system, sans-serif;
    letter-spacing: .04em;
    text-align: center;
    white-space: nowrap;
}
html.night-mode .splash-codex-id { color: #aebbd0; }
@keyframes spin {
    to { transform: rotate(360deg); }
}

.feed {
    padding: 86px 10px 10px;
    max-width: 100%;
}

.top-composer {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    display: block;
    padding: calc(env(safe-area-inset-top, 0px) + 8px) 10px 8px;
    background: rgba(255,255,255,.96);
    backdrop-filter: blur(8px);
    z-index: 1400;
    transition: transform .22s ease, opacity .22s ease;
}

.top-composer.composer-hidden {
    transform: translateY(calc(-100% - 8px));
    opacity: 0;
    pointer-events: none;
}

.composer-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 62px;
    padding: 5px 8px;
    background: #fff;
    border: 1px solid #dce8f3;
    border-radius: 999px;
    box-shadow: 0 2px 10px rgba(15, 56, 95, 0.10);
    box-sizing: border-box;
}

.composer-avatar {
    flex: 0 0 52px;
    width: 52px;
    height: 52px;
    object-fit: cover;
    background: #e9e9e9;
}

.composer-prompt {
    flex: 1 1 auto;
    min-width: 0;
    color: #1b1b1b;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.15;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
}

.composer-menu-toggle {
    flex: 0 0 42px;
    width: 42px;
    height: 42px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: #eef6ff;
    color: #1f6fb2;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    touch-action: manipulation;
}

.down-icon,
.notif-icon {
    display: block;
    width: 26px;
    height: 26px;
    object-fit: contain;
}

.composer-drawer {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-top: 8px;
    padding: 8px;
    background: rgba(255,255,255,.97);
    border: 1px solid #dce8f3;
    border-radius: 18px;
    box-shadow: 0 8px 20px rgba(15, 56, 95, 0.12);
}

.composer-drawer[hidden] {
    display: none;
}

.top-action-btn {
    min-width: 0;
    min-height: 38px;
    background: #f7fbff;
    border: 1px solid #dce8f3;
    border-radius: 999px;
    padding: 7px 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    text-decoration: none;
    color: #1f6fb2;
    box-shadow: 0 2px 6px rgba(15, 56, 95, 0.08);
    box-sizing: border-box;
    font: inherit;
    cursor: pointer;
}

.page-zoom-btn { grid-column: auto; }

.top-action-label {
    font-size: clamp(11px, 3.2vw, 14px);
    font-weight: 700;
    color: #1f6fb2;
    line-height: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.top-action-icon {
    display: inline-block;
    color: #1f6fb2;
    font-size: 14px;
    line-height: 1;
    transform: translateY(1px);
}

.post {
    background: white;
    border-radius: 15px;
    margin-bottom: 15px;
    padding: 10px;
    box-shadow: 0 2px 5px rgba(0,0,0,.1);
    position: relative;
    max-width: 100%;
    overflow: hidden;
}

.ad-wrap {
    background: var(--card-bg, #fff);
    border-radius: 15px;
    margin-bottom: 15px;
    padding: 12px;
    box-shadow: 0 5px 18px #0000000d;
    border: 1px solid #d6e0ed;
    max-width: 100%;
}
.paid-ad-post { cursor: pointer; }
.paid-ad-header { margin: 0 0 10px; padding-right: 0; }
.paid-ad-header .paid-ad-author-stack { flex-basis: 46px; width: 46px; }
.paid-ad-header .paid-ad-avatar-wrap, .paid-ad-header .paid-ad-author-stack .paid-ad-avatar { width: 40px; height: 40px; }
.paid-ad-avatar { display: block; border-radius: 50%; object-fit: cover; background: #eef2f8; border: 1px solid #d6e0ed; }
.paid-ad-identity { display: block; flex: 1 1 auto; }
.paid-ad-identity strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.paid-ad-label { margin-left: auto; color: #7a8490; font-size: 10px; font-weight: 700; letter-spacing: .01em; white-space: nowrap; }
.paid-ad-footer { display: flex; justify-content: flex-start; padding-top: 9px; }
.ad-report-action { color: #123f6b; padding: 2px 0; font: 700 12px/1.2 inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.ad-report-action:hover { color: #0b2e50; }
.ad {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 15px;
    object-fit: cover;
    max-width: 100%;
    margin: 0 auto;
}

.post-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-right: 28px;
}

.post-author-stack {
    flex: 0 0 72px;
    width: 72px;
    text-align: center;
}

.post-avatar-wrap {
    position: relative;
    width: 52px;
    height: 52px;
    margin: 0 auto;
}

/* A gentle, live-only Newsfeed presence ring. It is deliberately subtle and
   disappears automatically shortly after the member leaves the visible feed. */
.post-avatar-wrap.is-online::before {
    content: "";
    position: absolute;
    z-index: 2;
    inset: -4px;
    border: 2px solid rgba(40, 137, 222, .9);
    border-radius: 50%;
    box-shadow: 0 0 0 0 rgba(40, 137, 222, .32);
    pointer-events: none;
    animation: newsfeed-online-pulse 3.4s ease-in-out infinite;
}

.post-avatar-wrap.is-online .avatar {
    position: relative;
    z-index: 1;
    border: 2px solid #d9f1ff;
}

.post-avatar-wrap.is-online .utype-badge {
    z-index: 3;
}

@keyframes newsfeed-online-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(40, 137, 222, .18); opacity: .62; }
    50% { box-shadow: 0 0 0 6px rgba(40, 137, 222, 0); opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
    .post-avatar-wrap.is-online::before { animation: none; }
}

.post-author-stack .avatar {
    width: 52px;
    height: 52px;
    display: block;
    object-fit: cover;
    border-radius: 50%;
}

.post-avatar-wrap .utype-badge {
    position: absolute;
    right: -3px;
    bottom: -3px;
    z-index: 1;
    width: 19px;
    height: 19px;
    margin: 0;
    border: 2px solid #fff;
    font-size: 12px;
}

.post-meta {
    display: block;
    min-width: 0;
    color: #1b1b1b;
    font-size: 18px;
    line-height: 1.32;
    padding-top: 1px;
    align-self: center;
}
.post-meta a { color: inherit; text-decoration: none; }
.post-meta strong { font-weight: 700; }
.post .username-link { color: inherit; text-decoration: none; font-size: inherit; line-height: inherit; }

.post-text {
    margin-top: 6px;
    font-size: 15px;
    line-height: 1.34;
}
.post-text p {
    margin: 0 0 4px;
}
.post-text p:last-child {
    margin-bottom: 0;
}
.post-text a.ext-link,
.post-text a.hash-link {
    color: #007bff;
    text-decoration: underline;
    word-break: break-word;
}
.utype-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    margin-left: 6px;
    padding: 0;
    border: 0;
    font-size: 10px;
    font-weight: 700;
    color: #fff;
    vertical-align: middle;
    line-height: 1;
    cursor: pointer;
}
.utype-resident { background: #1e6bff; }
.utype-business { background: #1f9d55; }
.utype-visitor { background: #e255b2; }
.utype-tip {
    display: inline-flex;
    align-items: center;
    margin-left: 6px;
    padding: 2px 7px;
    border-radius: 999px;
    background: rgba(31,111,178,.12);
    color: #1f6fb2;
    font-size: 11px;
    font-weight: 800;
    line-height: 1.2;
    opacity: 0;
    transform: translateY(2px);
    transition: opacity .16s ease, transform .16s ease;
}
.utype-tip.visible {
    opacity: 1;
    transform: translateY(0);
}
.tagged-more {
    font-weight: 700;
    color: #1f6fb2;
    white-space: nowrap;
}
.tagged-users {
    margin-top: 8px;
    font-size: 13px;
    color: #1b1b1b;
}
.tagged-users a {
    color: #007bff;
    text-decoration: none;
    font-weight: 700;
}

.post-time {
    color: #888;
    font-size: 10px;
    font-weight: 700;
    line-height: 1.12;
    margin-top: 3px;
    white-space: nowrap;
}

.header {
    display: flex;
    gap: 10px;
}

.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
}

.images img, .ad {
    width: 100%;
    border-radius: 10px;
    margin-top: 8px;
}

.actions {
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
}

.like {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    user-select: none;
}

.post-share-action {
    border: 1px solid #d8e9f8;
    background: #eef6ff;
    color: #1f6fb2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    min-height: 30px;
    padding: 5px 11px;
    border-radius: 999px;
    font: 800 13px system-ui;
    cursor: pointer;
    user-select: none;
}

.post-share-action:active,
.post-share-action.share-copied {
    background: #dcefff;
}

.post-share-action:disabled {
    opacity: .7;
    cursor: wait;
}

.share-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    font-size: 15px;
    line-height: 1;
    font-weight: 900;
}

.post-actions-right {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex: 0 0 auto;
}

.shared-feed-post {
    background: #fbfdff;
}

.shared-caption {
    margin-top: 8px;
    font-size: 15px;
    line-height: 1.34;
}

.shared-original-card {
    margin-top: 10px;
    padding: 9px;
    border: 1px solid #dce8f3;
    border-radius: 10px;
    background: #fff;
    overflow: hidden;
}

.shared-original-header {
    padding-right: 0;
}

.share-composer-overlay {
    position: fixed;
    inset: 0;
    z-index: 2850;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 12px;
    background: rgba(0,0,0,.28);
    box-sizing: border-box;
}

.share-composer-card {
    width: min(560px, 100%);
    border-radius: 16px 16px 12px 12px;
    background: #fff;
    color: #1b1b1b;
    box-shadow: 0 -8px 30px rgba(0,0,0,.22);
    overflow: hidden;
}

.share-composer-head {
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr) 72px;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-bottom: 1px solid #edf0f3;
}

.share-composer-head strong {
    text-align: center;
    font-size: 15px;
}

.share-composer-cancel,
.share-composer-submit {
    border: none;
    background: transparent;
    font: 800 14px system-ui;
    color: #1f6fb2;
    cursor: pointer;
}

.share-composer-cancel {
    color: #555;
    text-align: left;
}

.share-composer-submit {
    text-align: right;
}

.share-composer-text {
    display: block;
    width: 100%;
    min-height: 112px;
    border: none;
    outline: none;
    resize: vertical;
    padding: 14px 12px;
    box-sizing: border-box;
    font: 17px/1.35 system-ui;
    color: inherit;
}

.share-composer-preview {
    margin: 0 12px 12px;
    padding: 10px;
    border: 1px solid #dce8f3;
    border-radius: 10px;
    color: #6b7b8c;
    font-size: 13px;
    font-weight: 800;
}

.reaction-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    font-size: 15px;
    line-height: 1;
}

.reaction-like {
    color: #1e6bff;
}

.reaction-love {
    color: #e53935;
}

.reaction-laugh {
    color: #f5b400;
}

.reaction-picker {
    position: absolute;
    right: 0;
    bottom: calc(100% + 8px);
    display: flex;
    gap: 6px;
    padding: 7px;
    border-radius: 999px;
    background: #fff;
    border: 1px solid #dce8f3;
    box-shadow: 0 8px 24px rgba(15, 56, 95, 0.20);
    z-index: 40;
}

.reaction-picker::after {
    content: "";
    position: absolute;
    right: 18px;
    bottom: -6px;
    width: 10px;
    height: 10px;
    background: inherit;
    border-right: 1px solid #dce8f3;
    border-bottom: 1px solid #dce8f3;
    transform: rotate(45deg);
}

.reaction-choice {
    border: none;
    background: transparent;
    min-width: 54px;
    padding: 4px 6px;
    border-radius: 999px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    cursor: pointer;
}

.reaction-choice span {
    font-size: 23px;
    line-height: 1;
}

.reaction-choice strong {
    font-size: 10px;
    line-height: 1;
    color: #1b1b1b;
}

.reaction-choice:hover {
    background: #f3f7fb;
}

.overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 0 10px 10px 10px;
    backdrop-filter: blur(6px);
    background: rgba(255,255,255,.2);
    z-index: 1200;
}

.overlay-box {
    background: #ffdada;
    padding: 12px 20px;
    border-radius: 15px;
    font-weight: bold;
    width: 100%;
    max-width: 520px;
    text-align: center;
}

.composer-sheet {
    position: fixed;
    inset: 0;
    z-index: 2600;
    background: rgba(0,0,0,.20);
    display: flex;
    align-items: flex-end;
}

.composer-sheet.hidden {
    display: none;
}

.composer-sheet-panel {
    width: 100%;
    min-height: 78vh;
    max-height: 96vh;
    background: #fff;
    color: #1b1b1b;
    border-radius: 18px 18px 0 0;
    padding: 0 14px;
    box-sizing: border-box;
    overflow: hidden;
    box-shadow: 0 -12px 32px rgba(0,0,0,.22);
    animation: composer-slide-up .18s ease-out;
    display: flex;
    flex-direction: column;
    overscroll-behavior: contain;
}

@keyframes composer-slide-up {
    from { transform: translateY(18px); opacity: .92; }
    to { transform: translateY(0); opacity: 1; }
}

.composer-sheet-topbar {
    position: sticky;
    top: 0;
    z-index: 6;
    flex: 0 0 auto;
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr) 72px;
    align-items: center;
    gap: 8px;
    padding: calc(env(safe-area-inset-top, 0px) + 10px) 0 10px;
    margin: 0;
    background: rgba(255,255,255,.97);
    border-bottom: 1px solid #eee;
    backdrop-filter: blur(8px);
}

.composer-sheet-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding: 14px 0 calc(env(safe-area-inset-bottom, 0px) + 82px);
    box-sizing: border-box;
}

.composer-title {
    text-align: center;
    font-size: 15px;
    font-weight: 800;
}

.composer-cancel,
.composer-post {
    border: none;
    background: transparent;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
    padding: 8px 0;
}

.composer-cancel {
    color: #333;
    text-align: left;
}

.composer-post {
    color: #1f6fb2;
    text-align: right;
}

.composer-post:disabled {
    color: #9aa5b1;
    cursor: not-allowed;
}

.composer-author {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.composer-author-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    object-fit: cover;
    background: #e9e9e9;
}

.composer-author-name {
    font-size: 15px;
    font-weight: 800;
}

.composer-textarea {
    display: block;
    width: 100%;
    min-height: 190px;
    border: none;
    outline: none;
    resize: vertical;
    background: transparent;
    color: inherit;
    box-sizing: border-box;
    font: 20px/1.32 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    padding: 8px 0;
}

.composer-textarea::placeholder {
    color: #c2c2c2;
    opacity: 1;
}

.file-input-hidden {
    position: fixed;
    left: -9999px;
    top: -9999px;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.composer-media-wrap,
.composer-field-wrap {
    margin-top: 12px;
}

.composer-section-title {
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 800;
    color: #5f6c7b;
}

.composer-photo-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.composer-photo-thumb,
.composer-add-media {
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 8px;
}

.composer-photo-thumb {
    object-fit: cover;
    background: #f0f0f0;
    cursor: pointer;
}

.composer-add-media {
    border: 2px dashed rgba(31,111,178,.38);
    background: transparent;
    color: #1f6fb2;
    font-weight: 800;
    cursor: pointer;
}

.composer-video-preview {
    width: 100%;
    max-height: 360px;
    border-radius: 10px;
    background: #111;
    display: block;
    margin-bottom: 8px;
}

.composer-input {
    width: 100%;
    padding: 11px 12px;
    border-radius: 8px;
    border: 1px solid #ddd;
    background: #f5f5f5;
    color: #1b1b1b;
    box-sizing: border-box;
    font: 15px system-ui;
}

.composer-pill-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.composer-tag-pill {
    border: none;
    border-radius: 999px;
    padding: 5px 10px;
    background: #eef3ff;
    color: #2b5bd7;
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
}

.composer-suggestions {
    margin-top: 6px;
    border: 1px solid #eee;
    border-radius: 8px;
    overflow: hidden;
    max-height: 170px;
    overflow-y: auto;
}

.composer-suggestions button {
    display: block;
    width: 100%;
    padding: 9px 10px;
    border: none;
    background: #fff;
    color: #1b1b1b;
    text-align: left;
    font: 14px system-ui;
    cursor: pointer;
}

.composer-suggestions button:hover {
    background: #f3f3f3;
}

.composer-status {
    min-height: 18px;
    margin-top: 10px;
    color: #666;
    font-size: 12px;
    font-weight: 700;
}

.composer-progress {
    position: relative;
    height: 14px;
    border-radius: 999px;
    overflow: hidden;
    background: rgba(31,50,70,.14);
    border: 1px solid rgba(31,50,70,.3);
    margin: 7px 14px 0;
}

.composer-progress-fill {
    width: 0%;
    height: 100%;
    border-radius: inherit;
    background: #1f3246;
    transition: width .18s ease;
}

.composer-progress-text {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 9px;
    font-weight: 900;
    text-shadow: 0 1px 3px rgba(0,0,0,.45);
}

.composer-action-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    align-items: center;
    gap: 4px;
    padding: 8px 8px calc(env(safe-area-inset-bottom, 0px) + 8px);
    background: rgba(255,255,255,.97);
    border-top: 1px solid #eee;
    z-index: 4;
}

.composer-action-btn {
    min-width: 0;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: #1f6fb2;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 6px 2px;
    cursor: pointer;
}

.composer-action-btn span {
    font-size: 18px;
    line-height: 1;
}

.composer-action-btn strong {
    font-size: 10px;
    line-height: 1.1;
    white-space: nowrap;
}

.post-detail-shell {
    position: fixed;
    inset: 0;
    z-index: 2700;
    background: rgba(0,0,0,.18);
    display: flex;
    justify-content: flex-end;
}

.feed-context-shell {
    position: fixed;
    inset: 0;
    z-index: 2750;
    background: rgba(0,0,0,.18);
    display: flex;
    justify-content: flex-end;
}

.feed-context-shell.hidden {
    display: none;
}

.feed-context-panel {
    width: 100%;
    max-width: 680px;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #fff;
    color: #1b1b1b;
    box-shadow: -10px 0 28px rgba(0,0,0,.18);
    transform: translateX(100%);
    transition: transform .24s ease;
}

.feed-context-shell.open .feed-context-panel {
    transform: translateX(0);
}

.feed-context-shell.closing .feed-context-panel {
    transform: translateX(100%);
}

.feed-context-topbar {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 52px;
    padding: calc(env(safe-area-inset-top, 0px) + 8px) 12px 8px;
    background: rgba(255,255,255,.96);
    border-bottom: 1px solid rgba(0,0,0,.08);
    backdrop-filter: blur(8px);
}

.feed-context-title {
    color: #0a355a;
    font: 800 16px system-ui, -apple-system, sans-serif;
}

.feed-context-frame {
    width: 100%;
    height: 100%;
    flex: 1 1 auto;
    border: 0;
    background: #fff;
}

.post-detail-shell.hidden,
.notifications-shell.hidden {
    display: none;
}

.post-detail-panel,
.notifications-panel {
    width: 100%;
    max-width: 680px;
    height: 100%;
    background: #f2f2f2;
    color: #1b1b1b;
    box-shadow: -10px 0 28px rgba(0,0,0,.18);
    transform: translateX(100%);
    transition: transform .24s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.notifications-shell {
    position: fixed;
    inset: 0;
    z-index: 2680;
    background: rgba(0,0,0,.18);
    display: flex;
    justify-content: flex-end;
}

.post-detail-shell.open .post-detail-panel,
.notifications-shell.open .notifications-panel {
    transform: translateX(0);
}

.post-detail-shell.closing .post-detail-panel,
.notifications-shell.closing .notifications-panel {
    transform: translateX(100%);
}

.post-detail-topbar,
.notifications-topbar {
    flex: 0 0 auto;
    z-index: 2;
    display: flex;
    align-items: center;
    min-height: 52px;
    padding: calc(env(safe-area-inset-top, 0px) + 8px) 12px 8px;
    background: rgba(242,242,242,.96);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid rgba(0,0,0,.08);
}

.notifications-topbar {
    justify-content: space-between;
    gap: 10px;
}

.post-detail-close {
    border: none;
    border-radius: 999px;
    background: #fff;
    color: #1f6fb2;
    font: 800 14px system-ui;
    padding: 8px 14px;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(15, 56, 95, 0.08);
}

.notifications-mark-all {
    border: 1px solid #e6eef5;
    border-radius: 999px;
    background: #fff;
    color: #1f6fb2;
    font: 800 14px system-ui;
    padding: 8px 14px;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(15, 56, 95, 0.08);
}

.notifications-mark-all:disabled {
    opacity: .55;
    cursor: not-allowed;
}

.post-detail-content,
.notifications-content {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 12px 10px 14px;
}

.notifications-list {
    display: grid;
    gap: 10px;
}

.notification-item {
    width: 100%;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    border: none;
    border-radius: 12px;
    background: #fff;
    color: #1b1b1b;
    box-shadow: 0 2px 6px rgba(0,0,0,.06);
    padding: 10px;
    text-align: left;
    cursor: pointer;
}

.notification-item.unopened {
    background: #e9f4ff;
}

.notification-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    object-fit: cover;
    background: #f0f0f0;
    flex: 0 0 38px;
}

.notification-body {
    min-width: 0;
    display: grid;
    gap: 4px;
    flex: 1 1 auto;
}

.notification-text {
    color: inherit;
    font: 600 14px/1.32 system-ui;
    overflow-wrap: anywhere;
}

.notification-time {
    color: #6b7b8c;
    font: 700 12px/1.2 system-ui;
}

.notifications-empty,
.notifications-state {
    padding: 24px 12px;
    text-align: center;
    color: #6b7b8c;
    font-weight: 700;
}

.post-detail-card {
    background: #fff;
    border-radius: 12px;
    padding: 10px;
    box-shadow: 0 2px 5px rgba(0,0,0,.1);
}

.post-detail-card .post-text {
    margin-top: 10px;
}

.post-insights {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #6b7b8c;
    font-weight: 800;
}

.post-insights span {
    white-space: nowrap;
}

.insight-item {
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

.insight-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 17px;
    min-width: 17px;
    height: 17px;
    line-height: 1;
}

.insight-views .insight-icon {
    color: #1f6fb2;
}

.post-open-count {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.insight-arrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 17px;
    height: 17px;
    border-radius: 999px;
    background: #fff;
    color: #1f6fb2;
    box-shadow: 0 1px 3px rgba(15,56,95,.12);
    font-size: 12px;
    line-height: 1;
}

.post-insights-feed {
    flex-wrap: wrap;
    justify-content: flex-end;
    margin-top: 7px;
    font-size: 12px;
}

.post-insights-action {
    min-width: 0;
    border: none;
    background: transparent;
    padding: 0;
    margin: 0;
    cursor: pointer;
    text-align: left;
}

.post-insights-action .post-insights-feed {
    justify-content: flex-start;
    margin-top: 0;
}

.post-insights-detail {
    flex-wrap: nowrap;
    justify-content: flex-start;
    width: 100%;
    border-left: none;
    border-right: none;
    border-bottom: none;
    background: transparent;
    color: #6b7b8c;
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid #edf0f3;
    font-size: 12px;
    gap: 5px;
    overflow-x: auto;
    scrollbar-width: none;
    cursor: pointer;
}

.post-insights-detail::-webkit-scrollbar {
    display: none;
}

.detail-tagged-users {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-top: 10px;
    font-size: 13px;
}

.post-activity-overlay {
    position: fixed;
    inset: 0;
    z-index: 3100;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    background: rgba(0,0,0,.28);
    padding: 12px;
    box-sizing: border-box;
}

.post-activity-card {
    width: min(520px, 100%);
    max-height: min(74vh, 680px);
    display: flex;
    flex-direction: column;
    border-radius: 16px;
    overflow: hidden;
    background: #fff;
    color: #1b1b1b;
    box-shadow: 0 14px 36px rgba(0,0,0,.24);
}

.post-activity-head {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 14px;
    border-bottom: 1px solid #edf0f3;
}

.post-activity-head strong {
    font-size: 15px;
}

.post-activity-close {
    border: none;
    border-radius: 999px;
    background: #eef6ff;
    color: #1f6fb2;
    font: 800 13px system-ui;
    padding: 7px 12px;
    cursor: pointer;
}

.post-activity-body {
    overflow-y: auto;
    padding: 10px;
}

.post-activity-section {
    margin-bottom: 12px;
}

.post-activity-section:last-child {
    margin-bottom: 0;
}

.post-activity-section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
    color: #5f6c7b;
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
}

.post-activity-row {
    display: flex;
    align-items: center;
    gap: 9px;
    min-height: 40px;
    padding: 6px 4px;
    color: inherit;
    text-decoration: none;
}

.post-activity-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    background: #e9e9e9;
    flex: 0 0 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #6b7b8c;
    font-weight: 900;
}

.post-activity-name {
    min-width: 0;
    flex: 1 1 auto;
    font-size: 14px;
    font-weight: 800;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.post-activity-count {
    flex: 0 0 auto;
    color: #6b7b8c;
    font-size: 12px;
    font-weight: 900;
}

.post-activity-empty,
.post-activity-loading {
    padding: 12px;
    color: #6b7b8c;
    text-align: center;
    font-size: 13px;
    font-weight: 800;
}

.detail-tagged-users strong {
    color: #666;
    margin-right: 2px;
}

.detail-tagged-users a {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 4px 9px;
    border-radius: 999px;
    background: #eef6ff;
    color: #1f6fb2;
    text-decoration: none;
    font-weight: 800;
}

.detail-post-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid #edf0f3;
}

.detail-comment-jump {
    border: none;
    background: transparent;
    color: #1f6fb2;
    font: 800 13px system-ui;
    padding: 4px 0;
    cursor: pointer;
}

.detail-post-reaction {
    border: none;
    background: transparent;
    color: #1b1b1b;
    font: 800 13px system-ui;
    padding: 4px 0;
    cursor: pointer;
}

.detail-image-list {
    display: grid;
    gap: 14px;
    margin-top: 12px;
}

.detail-image-card {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(0,0,0,.08);
}

.detail-image-card img {
    display: block;
    width: 100%;
    height: auto;
    background: #f7f7f7;
}

.detail-image-actions {
    display: flex;
    justify-content: flex-end;
    padding: 3px 10px 4px;
    min-height: 28px;
    box-sizing: border-box;
}

.image-reaction {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    border: none;
    background: transparent;
    color: #1b1b1b;
    font: 800 12px system-ui;
    cursor: pointer;
    padding: 2px 0;
    line-height: 1;
}

.image-reaction .reaction-icon {
    width: 20px;
    height: 20px;
    font-size: 14px;
}

.detail-empty {
    padding: 20px;
    text-align: center;
    color: #666;
    font-weight: 700;
}

.detail-comments-section {
    margin-top: 12px;
}

.detail-comments-section.is-empty {
    display: none;
}

.detail-comments-list {
    display: grid;
    gap: 10px;
}

.detail-comment-card {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    width: 100%;
}

.detail-comment-card.pending {
    opacity: .78;
}

.detail-comment-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    background: #e9e9e9;
    flex: 0 0 32px;
}

.detail-comment-body {
    min-width: 0;
    flex: 1 1 auto;
    padding-right: 8px;
}

.detail-comment-bubble {
    display: block;
    width: 100%;
    background: #fff;
    border-radius: 14px;
    padding: 8px 10px 7px;
    box-shadow: 0 1px 4px rgba(0,0,0,.07);
    box-sizing: border-box;
}

.detail-comment-meta {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 2px;
    font-size: 12px;
}

.detail-comment-meta strong {
    font-size: 13px;
    min-width: 0;
    overflow-wrap: anywhere;
}

.detail-comment-meta span {
    color: #888;
    font-weight: 700;
    flex: 0 0 auto;
    margin-left: auto;
    text-align: right;
    white-space: nowrap;
}

.detail-comment-text {
    font-size: 14px;
    line-height: 1.28;
}

.detail-comment-text .post-text {
    margin-top: 0;
    font-size: inherit;
}

.detail-comment-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 5px;
}

.comment-reaction {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin: 0;
    border: none;
    background: transparent;
    color: #1b1b1b;
    font: 800 12px system-ui;
    cursor: pointer;
}

.comment-reaction .reaction-icon {
    width: 18px;
    height: 18px;
    font-size: 13px;
}

.detail-comment-bar {
    flex: 0 0 auto;
    z-index: 3;
    padding: 8px 10px calc(env(safe-area-inset-bottom, 0px) + 8px);
    background: rgba(255,255,255,.97);
    border-top: 1px solid #eee;
}

.detail-comment-shell {
    display: flex;
    align-items: flex-end;
    gap: 8px;
}

.detail-comment-input {
    flex: 1 1 auto;
    min-height: 36px;
    max-height: 120px;
    resize: none;
    border: none;
    border-radius: 18px;
    background: #f0f2f5;
    color: #1b1b1b;
    padding: 9px 12px;
    box-sizing: border-box;
    font: 14px/1.25 system-ui;
    outline: none;
}

.detail-comment-submit {
    border: none;
    border-radius: 999px;
    background: #1f6fb2;
    color: #fff;
    font: 800 13px system-ui;
    padding: 9px 14px;
    cursor: pointer;
}

.detail-comment-submit:disabled {
    opacity: .55;
    cursor: not-allowed;
}

.detail-comment-status {
    min-height: 15px;
    margin-top: 3px;
    color: #666;
    font-size: 11px;
    font-weight: 700;
}

.find-friends-prompt {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 10px 10px 8px;
    padding: 11px 13px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 2px 9px rgba(0, 0, 0, 0.08);
    color: #1f6fb2;
    text-decoration: none;
    font-weight: 900;
}

.find-friends-prompt strong {
    min-width: 0;
    color: #6b7b8c;
    font-size: 12px;
    font-weight: 800;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hidden {
    display: none;
}

/* Pull-to-refresh */
.ptr {
    position: fixed;
    left: 0;
    right: 0;
    top: env(safe-area-inset-top, 0px);
    height: 0;
    display: flex;
    justify-content: center;
    pointer-events: none;
    z-index: 2000;
    transform: translateY(0);
}
.ptr .ptr-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(31,111,178,.25);
    border-top-color: #1f6fb2;
    border-radius: 50%;
    margin-top: 10px;
    margin-right: 8px;
    opacity: 0;
}
.ptr .ptr-text {
    margin-top: 8px;
    font-weight: 700;
    font-size: 12px;
    color: #1f6fb2;
    background: rgba(255,255,255,.92);
    border: 1px solid rgba(31,111,178,.20);
    border-radius: 999px;
    padding: 6px 10px;
    opacity: 0;
    backdrop-filter: blur(10px);
}
.ptr[data-state="pulling"] .ptr-text,
.ptr[data-state="ready"] .ptr-text,
.ptr[data-state="refreshing"] .ptr-text {
    opacity: 1;
}
.ptr[data-state="refreshing"] .ptr-spinner {
    opacity: 1;
    animation: ptr-spin 900ms linear infinite;
}
@keyframes ptr-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.notif-bell {
    flex: 0 0 42px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 0;
    background: transparent;
    cursor: pointer;
    touch-action: manipulation;
}
.notif-count {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    background: #e53935;
    color: #fff;
    border-radius: 9px;
    font-size: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.post-menu-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: transparent;
    border: none;
    color: #111;
    font-size: 18px;
    cursor: pointer;
    line-height: 1;
    z-index: 5;
}
.post-menu {
    position: absolute;
    top: 32px;
    right: 8px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 6px 18px rgba(0,0,0,.15);
    overflow: hidden;
    display: none !important;
    z-index: 10;
}
.post-menu.active { display: block !important; }
.post-menu button {
    display: block;
    width: 100%;
    padding: 10px 12px;
    background: #fff;
    border: none;
    text-align: left;
    cursor: pointer;
}
.post-menu button:hover { background: #f3f3f3; }
.post-menu .danger { color: #d33; }

.image-grid {
    display: grid;
    gap: 6px;
    margin-top: 8px;
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
    max-width: 100%;
}
.image-grid.grid-1 { grid-template-columns: 1fr; }
.image-grid.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.image-grid.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.image-grid.grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.image-grid.image-layout-columns {
    gap: 8px;
}
.image-grid.image-layout-columns.columns-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.image-grid.image-layout-columns.columns-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.image-grid.image-layout-columns.columns-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.image-grid.image-layout-columns .image-tile {
    height: clamp(250px, 74vw, 520px);
    aspect-ratio: auto;
    border-radius: 22px;
    border: 0;
}
.image-grid.image-layout-montage {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px;
}
.image-grid.image-layout-montage .image-tile {
    aspect-ratio: 1 / 1;
    border-radius: 6px;
}

.image-tile {
    position: relative;
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
    padding-bottom: 0;
    border-radius: 10px;
    overflow: hidden;
    background: #f7f7f7;
    box-sizing: border-box;
    min-width: 0;
}
.image-grid.grid-1 .image-tile {
    height: auto;
    aspect-ratio: auto;
    display: flex;
    justify-content: center;
    background: transparent;
}
.image-grid.grid-4 .image-tile {
    border: 2px solid #fff;
}
 .image-tile img {
     width: 100%;
     height: 100%;
     object-fit: cover;
     display: block;
     position: absolute;
     inset: 0;
 }
.image-grid.grid-1 .image-tile img {
    position: static;
    width: 100%;
    height: auto;
    max-width: 100%;
    max-height: none;
    object-fit: fill;
    margin: 0 auto;
}

.post-image-carousel {
    position: relative;
    width: 100%;
    margin-top: 8px;
    border-radius: 10px;
    overflow: hidden;
    background: #f3f5f8;
}
.post-image-carousel-track {
    display: flex;
    width: 100%;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}
.post-image-carousel-track::-webkit-scrollbar { display: none; }
.post-image-carousel-slide {
    flex: 0 0 100%;
    width: 100%;
    height: min(68vw, 460px);
    scroll-snap-align: start;
}
.post-image-carousel-slide img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.post-image-carousel-count {
    position: absolute;
    right: 10px;
    bottom: 10px;
    padding: 5px 9px;
    border-radius: 999px;
    color: #fff;
    background: rgba(0, 0, 0, .62);
    font-size: 12px;
    font-weight: 900;
}

/* Safari fallback when aspect-ratio isn't supported */
.image-tile > .image-more {
    position: absolute;
    inset: 0;
}
.image-more {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,.45);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 18px;
}

.post-video {
    margin-top: 8px;
    width: 100%;
    aspect-ratio: 4 / 5;
    max-height: min(76vh, 600px);
    overflow: hidden;
    border-radius: 12px;
    background: #111;
    position: relative;
}

.post-video-player {
    width: 100%;
    height: 100%;
    max-height: none;
    display: block;
    background: #111;
    object-fit: cover;
    object-position: center;
}

.post-video-meta {
    margin-top: 6px;
    color: #64748b;
    font-size: 12px;
    font-weight: 600;
}

.post-video-views {
    position: absolute;
    right: 10px;
    bottom: 10px;
    z-index: 2;
    padding: 6px 9px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.64);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    pointer-events: none;
}

.vidz-strip {
    background: #fff;
    border-radius: 15px;
    margin-bottom: 15px;
    padding: 10px;
    box-shadow: 0 2px 5px rgba(0,0,0,.1);
}

.vidz-strip-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 10px;
}

.vidz-strip-title {
    font-size: 14px;
    font-weight: 800;
    color: #1f6fb2;
}

.vidz-strip-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.vidz-card {
    border: none;
    padding: 0;
    background: transparent;
    text-align: left;
    cursor: pointer;
}

.vidz-thumb {
    position: relative;
    aspect-ratio: 9 / 16;
    border-radius: 12px;
    overflow: hidden;
    background: linear-gradient(180deg, #20334b 0%, #0d1722 100%);
    box-shadow: 0 4px 14px rgba(15, 45, 76, 0.18);
}

.vidz-thumb img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.vidz-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(5,12,20,.05) 0%, rgba(5,12,20,.15) 45%, rgba(5,12,20,.72) 100%);
}

.vidz-play {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    border-radius: 999px;
    background: rgba(255,255,255,.92);
    color: #113657;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 800;
}

.vidz-duration {
    position: absolute;
    left: 8px;
    bottom: 30px;
    padding: 3px 6px;
    border-radius: 999px;
    background: rgba(7,15,24,.72);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
}

.vidz-user {
    position: absolute;
    left: 8px;
    right: 8px;
    bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.vidz-avatar {
    width: 22px;
    height: 22px;
    min-width: 22px;
    min-height: 22px;
    flex: 0 0 22px;
    aspect-ratio: 1 / 1;
    display: block;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid rgba(255,255,255,.75);
    background: rgba(255,255,255,.9);
}

.vidz-username {
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (max-width: 420px) {
    .feed {
        padding-top: 84px;
    }

    .composer-prompt {
        font-size: 14px;
    }
}

.confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.35);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2500;
}
.confirm-overlay.active { display: flex; }
.confirm-card {
    background: #fff;
    padding: 16px;
    border-radius: 14px;
    width: 85%;
    max-width: 360px;
    box-shadow: 0 10px 30px rgba(0,0,0,.2);
    text-align: center;
}
.confirm-actions {
    margin-top: 12px;
    display: flex;
    gap: 10px;
    justify-content: center;
}
.btn-primary {
    background: #007bff;
    color: #fff;
    border: none;
    padding: 8px 14px;
    border-radius: 8px;
    cursor: pointer;
}
.btn-link {
    background: transparent;
    color: #007bff;
    border: none;
    padding: 8px 14px;
    cursor: pointer;
}

#profile-pic,
#new-post {
    cursor: pointer;
}

#profile-pic {
    cursor: default;
}

/* The general .avatar rule appears later in this stylesheet. Keep the composer
   picture explicitly square so its 50% crop cannot become an oval. */
#profile-pic.composer-avatar {
    flex: 0 0 52px;
    width: 52px;
    height: 52px;
    min-width: 52px;
    max-width: 52px;
    aspect-ratio: 1 / 1;
    border-radius: 50%;
    object-fit: cover;
}

.carousel {
    position: relative;
    width: 100%;
    height: 220px;
    overflow: hidden;
    border-radius: 10px;
    margin-top: 8px;
    background: #f7f7f7;
    touch-action: pan-y;
    overscroll-behavior-x: none;
}

.carousel.portrait {
    height: 360px;
}

.carousel-images {
    position: relative;
    width: 100%;
    height: 100%;
}

.carousel-images img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    object-fit: cover;
    object-position: center;
    opacity: 0;
    pointer-events: none;
    z-index: 1;
    transition: opacity 0.3s ease;
    background: #f7f7f7;
}

.carousel-images img.active {
    opacity: 1;
    pointer-events: auto;
}

/* Fallback: show first image if JS doesn't set active */
.carousel-images img:first-child {
    opacity: 1;
    pointer-events: auto;
}

.carousel-dots {
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 5px;
    z-index: 2;
}

.carousel-dots .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: rgba(255,255,255,0.5);
    cursor: pointer;
}

.carousel-dots .dot.active {
    background-color: rgba(255,255,255,1);
}
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #fff;
    border-radius: 12px;
    text-decoration: none;
    color: #333;
    box-shadow: 0 2px 5px rgba(0,0,0,.07);
    font-weight: 600;
}

@media (prefers-color-scheme: dark) {
    body,
    .splash {
        background-color: #050505;
        color: #f4f4f4;
    }

    .splash-ring {
        border-color: rgba(255,255,255,.22);
        border-top-color: #fff;
    }

    .post-avatar-wrap .utype-badge {
        border-color: #151515;
    }

    .post-detail-panel,
    .notifications-panel,
    .feed-context-panel {
        background: #050505;
        color: #f4f4f4;
    }

    .post-detail-topbar,
    .notifications-topbar,
    .feed-context-topbar {
        background: rgba(5,5,5,.94);
        border-bottom-color: #2a2a2a;
    }

    .top-composer {
        background: rgba(5,5,5,.94);
    }

    .composer-pill,
    .composer-drawer,
    .composer-sheet-panel,
    .share-composer-card,
    .shared-original-card,
    .post-detail-card,
    .detail-image-card,
    .detail-comment-bubble,
    .notification-item,
    .post-activity-card,
    .post,
    .find-friends-prompt,
    .confirm-card,
    .back-link {
        background: #151515;
        border-color: #2a2a2a;
        color: #f4f4f4;
        box-shadow: 0 2px 10px rgba(0,0,0,.55);
    }

    .composer-drawer {
        background: rgba(21,21,21,.98);
    }

    .composer-sheet-topbar,
    .share-composer-head,
    .post-activity-head,
    .composer-action-bar {
        background: rgba(21,21,21,.98);
        border-top-color: #2a2a2a;
    }

    .composer-sheet-topbar {
        border-bottom-color: #2a2a2a;
    }

    .post-activity-head {
        border-bottom-color: #2a2a2a;
    }

    .composer-progress {
        background: rgba(117,183,255,.12);
        border-color: rgba(117,183,255,.24);
    }

    .composer-progress-fill {
        background: #1f3246;
    }

    .detail-comment-bar {
        background: rgba(21,21,21,.98);
        border-top-color: #2a2a2a;
    }

    .composer-avatar,
    .composer-author-avatar,
    .detail-comment-avatar,
    .notification-avatar,
    .carousel,
    .carousel-images img,
    .image-tile,
    .composer-photo-thumb {
        background: #242424;
    }

    .composer-prompt,
    .composer-cancel,
    .composer-title,
    .composer-textarea,
    .detail-comment-input,
    .comment-reaction,
    .post-meta,
    .tagged-users,
    .post-menu-btn {
        color: #f4f4f4;
    }

    .post-time,
    .ad-caption,
    .notification-time,
    .notifications-empty,
    .notifications-state,
    .post-insights,
    .post-activity-section-title,
    .post-activity-count,
    .post-activity-empty,
    .post-activity-loading,
    .find-friends-prompt strong {
        color: #aaa;
    }

    .top-action-btn,
    .composer-menu-toggle,
    .post-detail-close,
    .notifications-mark-all,
    .post-activity-close,
    .composer-input,
    .detail-comment-input,
    .composer-suggestions button,
    .reaction-picker,
    .post-menu,
    .post-menu button {
        background: #202020;
        border-color: #333;
        color: #f4f4f4;
    }

    .top-action-label,
    .top-action-icon,
    .composer-post,
    .composer-action-btn,
    .composer-add-media,
    .image-reaction,
    .detail-comment-jump,
    .post-text a.ext-link,
    .post-text a.hash-link,
    .tagged-users a,
    .tagged-more,
    .utype-tip,
    .btn-link {
        color: #75b7ff;
    }

    .notification-item.unopened {
        background: rgba(117,183,255,.16);
    }

    .utype-tip {
        background: rgba(117,183,255,.14);
    }

    .composer-post:disabled,
    .composer-status,
    .composer-section-title,
    .composer-textarea::placeholder,
    .detail-comment-status,
    .detail-comment-meta span {
        color: #aaa;
    }

    .post-menu button:hover {
        background: #2a2a2a;
    }

    .reaction-picker {
        border-color: #333;
        box-shadow: 0 8px 24px rgba(0,0,0,.46);
    }

    .reaction-picker::after {
        border-right-color: #333;
        border-bottom-color: #333;
    }

    .reaction-choice strong {
        color: #f4f4f4;
    }

    .reaction-choice:hover {
        background: #2a2a2a;
    }

    .detail-post-actions {
        border-top-color: #2a2a2a;
    }

    .shared-feed-post {
        background: #101010;
    }

    .share-composer-preview {
        background: #151515;
        border-color: #2a2a2a;
        color: #aaa;
    }

    .share-composer-text {
        background: #151515;
        color: #f4f4f4;
    }

    .post-insights-detail {
        border-top-color: #2a2a2a;
    }

    .detail-post-reaction {
        color: #f4f4f4;
    }

    .detail-tagged-users strong {
        color: #aaa;
    }

    .detail-tagged-users a {
        background: rgba(117,183,255,.14);
        color: #75b7ff;
    }

    .overlay {
        background: rgba(0,0,0,.35);
    }

    .overlay-box {
        background: #3a1f1f;
        color: #fff;
    }

    .ptr .ptr-text {
        color: #75b7ff;
        background: rgba(21,21,21,.94);
        border-color: rgba(117,183,255,.25);
    }
}
.back-link:hover { background: #f5f5f5; }

/* The feed follows Gran Alacant time (20:00–06:59) as well as device dark mode. */
html.night-mode body,
html.night-mode .splash {
    background: #050505;
    color: #f4f4f4;
}

html.night-mode .splash-ring {
    border-color: rgba(255,255,255,.22);
    border-top-color: #fff;
}

html.night-mode .post-avatar-wrap .utype-badge {
    border-color: #151515;
}

html.night-mode .top-composer,
html.night-mode .post-detail-topbar,
html.night-mode .notifications-topbar,
html.night-mode .feed-context-topbar {
    background: rgba(5,5,5,.96);
    border-color: #2a2a2a;
}

html.night-mode .composer-pill,
html.night-mode .composer-drawer,
html.night-mode .composer-sheet-panel,
html.night-mode .share-composer-card,
html.night-mode .shared-original-card,
html.night-mode .post-detail-card,
html.night-mode .detail-image-card,
html.night-mode .detail-comment-bubble,
html.night-mode .notification-item,
html.night-mode .post-activity-card,
html.night-mode .post,
html.night-mode .find-friends-prompt,
html.night-mode .confirm-card,
html.night-mode .back-link {
    background: #151515;
    border-color: #2a2a2a;
    color: #f4f4f4;
    box-shadow: 0 2px 10px rgba(0,0,0,.55);
}

html.night-mode .feed-context-panel,
html.night-mode .feed-context-frame {
    background: #050505;
    color: #f4f4f4;
}

html.night-mode .composer-drawer,
html.night-mode .composer-sheet-topbar,
html.night-mode .share-composer-head,
html.night-mode .post-activity-head,
html.night-mode .composer-action-bar,
html.night-mode .detail-comment-bar {
    background: rgba(21,21,21,.98);
    border-color: #2a2a2a;
}

html.night-mode .top-action-btn,
html.night-mode .composer-menu-toggle,
html.night-mode .post-detail-close,
html.night-mode .notifications-mark-all,
html.night-mode .post-activity-close,
html.night-mode .composer-input,
html.night-mode .detail-comment-input,
html.night-mode .composer-suggestions button,
html.night-mode .reaction-picker,
html.night-mode .post-menu,
html.night-mode .post-menu button {
    background: #202020;
    border-color: #333;
    color: #f4f4f4;
}

html.night-mode .composer-prompt,
html.night-mode .composer-cancel,
html.night-mode .composer-title,
html.night-mode .composer-textarea,
html.night-mode .detail-comment-input,
html.night-mode .comment-reaction,
html.night-mode .post-meta,
html.night-mode .tagged-users,
html.night-mode .post-menu-btn {
    color: #f4f4f4;
}

html.night-mode .post-time,
html.night-mode .ad-caption,
html.night-mode .notification-time,
html.night-mode .notifications-empty,
html.night-mode .notifications-state,
html.night-mode .post-insights,
html.night-mode .post-activity-section-title,
html.night-mode .post-activity-count,
html.night-mode .post-activity-empty,
html.night-mode .post-activity-loading,
html.night-mode .find-friends-prompt strong {
    color: #aaa;
}

/* Nearby-first location picker */
.location-picker-shell {
    position: fixed;
    inset: 0;
    z-index: 2650;
    display: flex;
    align-items: flex-end;
    background: rgba(0, 0, 0, .28);
}

.location-picker-shell.hidden { display: none; }

.location-picker-panel {
    width: 100%;
    max-height: 88vh;
    min-height: 56vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-sizing: border-box;
    padding: 0 14px;
    border-radius: 18px 18px 0 0;
    background: #fff;
    color: #1b1b1b;
    box-shadow: 0 -12px 32px rgba(0, 0, 0, .22);
    animation: composer-slide-up .18s ease-out;
}

.location-picker-topbar {
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr) 72px;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
    padding: calc(env(safe-area-inset-top, 0px) + 10px) 0 10px;
    border-bottom: 1px solid #eee;
}

.location-picker-body {
    overflow-y: auto;
    padding: 14px 0 calc(env(safe-area-inset-bottom, 0px) + 24px);
    overscroll-behavior: contain;
}

.location-picker-search-label,
.location-picker-add-title {
    display: block;
    margin-bottom: 7px;
    color: #173f70;
    font-size: 13px;
    font-weight: 800;
}

.location-picker-search { width: 100%; box-sizing: border-box; }

.location-picker-status {
    min-height: 18px;
    margin: 9px 2px 8px;
    color: #667085;
    font-size: 12px;
}

.location-picker-list { display: grid; gap: 8px; }

.location-picker-item {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 13px 14px;
    border: 2px solid #1f6fb2;
    border-radius: 13px;
    background: #fff;
    color: #171717;
    text-align: left;
    font: inherit;
    cursor: pointer;
}

.location-picker-item strong { font-size: 15px; }
.location-picker-item span { color: #667085; font-size: 12px; white-space: nowrap; }
.location-picker-loading, .location-picker-empty { padding: 20px 8px; color: #667085; text-align: center; }

.location-picker-add-card {
    margin-top: 16px;
    padding: 14px;
    border: 2px solid #173f70;
    border-radius: 14px;
}

.location-picker-add-copy { margin-bottom: 11px; color: #667085; font-size: 13px; }
.location-picker-add-row { display: flex; gap: 8px; }
.location-picker-add-row .composer-input { min-width: 0; flex: 1; }

.location-picker-add-btn {
    flex: 0 0 auto;
    padding: 0 13px;
    border: 0;
    border-radius: 999px;
    background: #173f70;
    color: #fff;
    font: inherit;
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
}

.location-picker-add-btn:disabled { opacity: .55; cursor: wait; }

html.night-mode .location-picker-panel,
html.night-mode .location-picker-item { background: #151515; color: #f4f4f4; border-color: #2a2a2a; }
html.night-mode .location-picker-topbar { background: rgba(21,21,21,.98); border-color: #2a2a2a; }
html.night-mode .location-picker-search-label,
html.night-mode .location-picker-add-title { color: #83b9ea; }
html.night-mode .location-picker-status,
html.night-mode .location-picker-item span,
html.night-mode .location-picker-loading,
html.night-mode .location-picker-empty,
html.night-mode .location-picker-add-copy { color: #aaa; }
html.night-mode .location-picker-add-card { border-color: #83b9ea; }
html.night-mode .location-picker-add-btn { background: #83b9ea; color: #07111d; }
