* { box-sizing: border-box; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: #F0F2F5;
    margin: 0;
    color: #050505;
    font-size: 15px;
    line-height: 1.34;
}

h1, h2, h3 { font-weight: 700; }

.brand-header {
    text-align: center;
    padding-top: 40px;
    font-size: 32px;
    font-weight: 700;
    color: #1877F2;
    letter-spacing: -0.5px;
}

.auth-container {
    max-width: 400px;
    margin: 24px auto 60px;
    background: white;
    padding: 30px;
    border-radius: 8px;
    border: 1px solid #DADDE1;
    box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}

.auth-container h2 { text-align: center; color: #050505; }

.policy-container {
    max-width: 640px;
    margin: 40px auto;
    background: white;
    padding: 30px 34px;
    border-radius: 8px;
    border: 1px solid #DADDE1;
    box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}

.policy-container h2 { text-align: center; color: #050505; margin-bottom: 24px; }

.policy-section { margin-bottom: 20px; }

.policy-section h3 { margin: 0 0 6px 0; color: #333; font-size: 16px; }

.policy-section p { margin: 0; color: #555; line-height: 1.5; font-size: 14px; }

form label {
    display: block;
    margin-top: 12px;
    font-weight: 600;
    font-size: 14px;
}

form input, form select, form textarea {
    width: 100%;
    padding: 10px;
    margin-top: 5px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
}

form button {
    width: 100%;
    margin-top: 20px;
    padding: 12px;
    background: #1877F2;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    cursor: pointer;
}

form button:hover { background: #166FE5; }

.error { color: #FA383E; text-align: center; }
.success { color: #2e7d32; text-align: center; }

a { color: #1877F2; text-decoration: none; }

.topbar {
    background: #fff;
    padding: 10px 20px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 6px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.12);
    position: sticky;
    top: 0;
    z-index: 100;
}

.topbar .brand {
    font-size: 22px;
    font-weight: 700;
    color: #1877F2;
    letter-spacing: -0.5px;
    padding: 8px 10px;
}

.topbar a {
    background: none;
    color: #65676B;
    font-weight: 600;
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.topbar a:hover { background: #F0F2F5; color: #1877F2; }

.nav-icon { font-size: 16px; line-height: 1; }

.pref-tag {
    display: inline-block;
    background: #E7F3FF;
    color: #1877F2;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
    margin-bottom: 8px;
}

.points-badge {
    color: #A6760A;
    background: #FEF2DB;
    font-weight: 700;
    font-size: 13px;
    padding: 6px 10px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

.search-bar {
    max-width: 560px;
    margin: 20px auto 0;
    padding: 0 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* The explicit `width: auto` / `margin: 0` resets on the input and button are
   essential: the global `form input` and `form button` rules set width: 100%
   (plus top margins). Left alone, the button took the whole row and squeezed
   the input down to a sliver. */
.search-bar input {
    flex: 1 1 auto;
    min-width: 0;
    width: auto;
    margin: 0;
    height: 44px;
    padding: 0 18px;
    border-radius: 24px;
    border: 1px solid #DADDE1;
    background: #fff;
    font-size: 16px;
}

.search-bar input:disabled {
    background: #f5f5f5;
    color: #999;
    cursor: not-allowed;
}

.search-bar button {
    flex: 0 0 auto;
    width: auto;
    margin: 0;
    height: 44px;
    padding: 0 22px;
    background: #1877F2;
    color: white;
    border: none;
    border-radius: 24px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}

.search-bar button:hover { background: #166FE5; }

.card-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    padding: 30px;
    justify-content: center;
}

.profile-card {
    background: white;
    border-radius: 8px;
    border: 1px solid #DADDE1;
    padding: 20px;
    width: 250px;
    text-align: center;
    box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}

.profile-photo {
    width: 150px;
    height: 150px;
    object-fit: cover;
    border-radius: 50%;
    margin-bottom: 10px;
}

.photo-wrapper {
    position: relative;
    display: inline-block;
}

.online-dot {
    position: absolute;
    bottom: 10px;
    right: 10px;
    width: 16px;
    height: 16px;
    background: #42B72A;
    border: 2px solid white;
    border-radius: 50%;
    box-shadow: 0 0 3px rgba(0,0,0,0.3);
}

.activity-status {
    font-size: 12px;
    color: #999;
    margin: 0 0 8px 0;
}

.profile-card .bio {
    font-size: 13px;
    color: #666;
    min-height: 40px;
}

.like-btn {
    display: inline-block;
    margin-top: 10px;
    background: #1877F2;
    color: white;
    border: none;
    padding: 8px 20px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    font-size: 14px;
}

.like-btn:hover { background: #166FE5; }

/* Secondary (gray) and outline (white + blue border) variants of .like-btn,
   for a card's non-primary actions — e.g. Pass next to Like, or Add Friend
   next to a page's main action — following Facebook's button hierarchy of
   one solid blue primary action per card and quieter actions around it.
   These come after .like-btn and use compound selectors so they always win. */
.like-btn.btn-secondary {
    background: #E4E6EB;
    color: #050505;
}
.like-btn.btn-secondary:hover { background: #D8DADF; }

.like-btn.btn-outline {
    background: white;
    color: #1877F2;
    border: 1px solid #1877F2;
}
.like-btn.btn-outline:hover { background: #F0F6FF; }

.like-btn.btn-block { display: block; width: 100%; margin-top: 0; }

/* Destructive actions (delete account, etc.): Facebook red. */
.btn-danger {
    background: #FA383E; color: #fff; border: none; border-radius: 6px;
    padding: 10px 18px; font-weight: 600; cursor: pointer;
}
.btn-danger:hover { background: #E02D33; }

.card-actions { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.card-actions form { margin: 0; }

/* Status banners (e.g. "It's a match!", rate-limit warnings). The compound
   selectors are more specific than the bare .success/.error text colors. */
.flash { max-width: 600px; margin: 14px auto; padding: 10px 14px; border-radius: 8px; font-size: 14px; text-align: center; }
.flash.success { background: #E7F3E8; color: #1E6B2A; border: 1px solid #BFE1C5; }
.flash.error   { background: #FFEBEC; color: #B3202A; border: 1px solid #F5C2C6; }
.flash.info    { background: #E4E6EB; color: #050505; }

/* Previous / Next pagination. */
.pager { display: flex; justify-content: center; gap: 10px; margin: 20px 0 30px; }
.pager a {
    background: #E4E6EB; color: #050505; padding: 8px 18px;
    border-radius: 6px; font-weight: 600; font-size: 14px;
}
.pager a:hover { background: #D8DADF; }

/* A submit button that reads as an inline text link (e.g. "Undo"). More
   specific than the global `form button` rule so it overrides width/margin/hover. */
form .link-btn {
    width: auto; margin: 0; padding: 0; background: none;
    color: #1877F2; font-size: 14px; font-weight: 600;
}
form .link-btn:hover { background: none; text-decoration: underline; }

.card-links { margin-top: 10px; font-size: 12px; color: #65676B; }
/* `.card-links form button` is deliberately more specific than the global
   `form button` rule (full-width blue submit button), so these read as quiet
   text links rather than inheriting its width, margin, padding and hover. */
.card-links a,
.card-links form button {
    width: auto; margin: 0; padding: 0;
    background: none; border: none; cursor: pointer;
    font-size: 12px; font-weight: normal; color: #65676B;
}
.card-links a:hover,
.card-links form button:hover { background: none; text-decoration: underline; }

.chat-box {
    max-width: 600px;
    margin: 20px auto;
    padding: 20px;
    background: white;
    border-radius: 12px;
    min-height: 300px;
    max-height: 500px;
    overflow-y: auto;
}

.chat-message {
    margin-bottom: 12px;
    max-width: 70%;
    padding: 10px 14px;
    border-radius: 14px;
    clear: both;
}

.chat-message.sent {
    background: #1877F2;
    color: white;
    float: right;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

.chat-message.received {
    background: #f0f0f0;
    float: left;
}

.chat-message p { margin: 0; }
.chat-time { font-size: 11px; opacity: 0.7; }

.msg-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 2px;
}

.ticks { font-size: 12px; opacity: 0.85; }

.edited-label {
    font-size: 11px;
    font-style: italic;
    opacity: 0.7;
    display: block;
}

.edit-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 12px;
    padding: 0;
    opacity: 0.7;
}

.edit-btn:hover { opacity: 1; }

.edit-form {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    margin-top: 4px;
}

.edit-form textarea.edit-input {
    width: 90%;
    box-sizing: border-box;
    padding: 6px 8px;
    border-radius: 8px;
    border: 1px solid #ddd;
    font-size: 13px;
    font-family: inherit;
    resize: none;
    -webkit-user-select: text;
    user-select: text;
    -webkit-touch-callout: default;
}

.edit-form-actions {
    display: flex;
    gap: 6px;
}

.edit-form button {
    padding: 6px 10px;
    border-radius: 8px;
    border: none;
    background: #1877F2;
    color: white;
    font-size: 12px;
    cursor: pointer;
}

.chat-message.sent .edit-form button { background: white; color: #1877F2; }

.msg-deleted {
    font-style: italic;
    opacity: 0.7;
}

.msg-action-menu {
    position: fixed;
    z-index: 1000;
    background: white;
    border-radius: 10px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.25);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-width: 120px;
}

.msg-action-menu button {
    background: none;
    border: none;
    padding: 10px 16px;
    text-align: left;
    font-size: 14px;
    cursor: pointer;
    color: #333;
}

.msg-action-menu button:hover { background: #f5f5f5; }

.msg-action-menu button.action-delete { color: #FA383E; }

.msg-action-backdrop {
    position: fixed;
    inset: 0;
    z-index: 999;
    background: transparent;
}

.chat-form {
    max-width: 600px;
    margin: 0 auto 40px;
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 0 12px;
}

.chat-input-wrap {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.chat-form textarea {
    width: 100%;
    padding: 12px 16px;
    border-radius: 20px;
    border: 1px solid #ddd;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.4;
    resize: none;
    overflow-y: hidden;
}

.send-btn {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #1877F2;
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
}

.photo-preview {
    display: flex;
    align-items: center;
    gap: 8px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 12px;
    padding: 6px;
    width: fit-content;
}

.photo-preview img {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 8px;
}

.photo-preview button {
    background: #f0f0f0;
    border: none;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    font-size: 12px;
    line-height: 1;
    cursor: pointer;
    color: #666;
}

.chat-photo {
    max-width: 200px;
    border-radius: 10px;
    display: block;
    margin-bottom: 6px;
}

.attach-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    background: #f0f0f0;
    border-radius: 50%;
    cursor: pointer;
    font-size: 17px;
}

.bell-link { position: relative; }

.badge {
    background: #FA383E;
    color: white;
    font-size: 11px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 10px;
    margin-left: 4px;
    vertical-align: top;
}

.notif-list {
    max-width: 600px;
    margin: 0 auto 40px;
    padding: 0 20px;
}

.notif-item {
    display: block;
    background: white;
    padding: 14px 18px;
    border-radius: 10px;
    margin-bottom: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.notif-item p { margin: 0 0 4px 0; color: #333; }
.notif-time { font-size: 12px; color: #999; }

.chat-list {
    max-width: 600px;
    margin: 20px auto;
    padding: 0 20px 40px;
}

.chat-list-item {
    display: flex;
    align-items: center;
    gap: 14px;
    background: white;
    padding: 14px 16px;
    border-radius: 12px;
    margin-bottom: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    color: #333;
}

.chat-list-item:hover { background: #fafafa; }

.chat-list-item .photo-wrapper { flex-shrink: 0; }

.chat-list-photo {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
}

.chat-list-info {
    flex: 1;
    min-width: 0;
}

.chat-list-name {
    font-weight: 600;
    margin: 0 0 2px 0;
}

.chat-list-preview {
    font-size: 13px;
    color: #999;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-list-preview.unread {
    color: #333;
    font-weight: 600;
}

.chat-list-meta {
    text-align: right;
    flex-shrink: 0;
    font-size: 12px;
    color: #999;
}

.chat-list-meta .badge {
    display: inline-block;
    margin-top: 4px;
    margin-left: 0;
}

.chat-list-row {
    margin-bottom: 10px;
}

.chat-list-row .chat-list-item {
    margin-bottom: 0;
    border-radius: 12px 12px 0 0;
    box-shadow: none;
}

.chat-list-actions {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    background: white;
    border-top: 1px solid #f0f0f0;
    border-radius: 0 0 12px 12px;
    padding: 8px 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    font-size: 13px;
}

.chat-list-action-form {
    display: inline;
}

.chat-list-actions a,
.chat-list-actions button {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    font-size: 13px;
    padding: 0;
    text-decoration: none;
}

.chat-list-actions a:hover,
.chat-list-actions button:hover {
    color: #666;
    text-decoration: underline;
}

.chat-list-action-sep {
    color: #ccc;
}

.chat-header-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: #333;
    margin: 16px auto 4px;
}

.chat-header-photo {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
    border: 2px solid white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.chat-header-link h2 {
    margin: 8px 0 0 0;
    font-size: 18px;
}

.chat-header-link:hover .chat-header-photo {
    opacity: 0.9;
}

.photo-lightbox {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.9);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.photo-lightbox.open {
    display: flex;
}

.photo-lightbox img {
    max-width: 92vw;
    max-height: 85vh;
    object-fit: contain;
    border-radius: 4px;
    cursor: zoom-out; /* clicking the enlarged photo takes you back */
}

/* A keyframe animation (not a transition) because the viewer is toggled with
   display: none -> flex, which transitions can't animate. */
.photo-lightbox.open img { animation: photoZoomIn 0.18s ease-out; }

@keyframes photoZoomIn {
    from { transform: scale(0.8); opacity: 0; }
    to   { transform: scale(1);   opacity: 1; }
}

.lightbox-close {
    position: absolute;
    top: 16px;
    left: 20px;
    background: rgba(255,255,255,0.15);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
}

.lightbox-close:hover {
    background: rgba(255,255,255,0.3);
}

.lightbox-save {
    position: absolute;
    bottom: 24px;
    right: 20px;
    background: rgba(255,255,255,0.15);
    color: white;
    border: none;
    padding: 10px 18px;
    border-radius: 24px;
    font-size: 14px;
    text-decoration: none;
    cursor: pointer;
}

.lightbox-save:hover {
    background: rgba(255,255,255,0.3);
}

/* --- Social login (login.php) --- */
.social-login {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin: 16px 0;
}

.fb-login-btn {
    width: 280px;
    max-width: 100%;
    padding: 10px 0;
    background: #1877f2;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
}

.fb-login-btn:hover { background: #166fe5; }

.social-divider {
    display: flex;
    align-items: center;
    text-align: center;
    color: #999;
    font-size: 13px;
    margin: 14px 0;
}

.social-divider::before, .social-divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid #ddd;
}

.social-divider span { padding: 0 10px; }

/* --- Chat header call buttons (chat.php) --- */
.chat-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 12px;
}

.chat-call-buttons { display: flex; gap: 10px; }

.call-icon-btn {
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    padding: 6px;
    border-radius: 50%;
}

.call-icon-btn:hover { background: #f0f0f0; }
.call-icon-btn:disabled { opacity: 0.5; cursor: default; }

/* --- Incoming call banner (includes/nav.php) --- */
.incoming-call-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    background: #222;
    color: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.incoming-call-banner img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.incoming-call-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    font-size: 14px;
}

.incoming-call-info span { color: #ccc; font-size: 12px; }

.incoming-call-accept, .incoming-call-decline {
    border: none;
    border-radius: 20px;
    padding: 8px 16px;
    font-size: 14px;
    cursor: pointer;
}

.incoming-call-accept { background: #42B72A; color: #fff; }
.incoming-call-decline { background: #e74c3c; color: #fff; }

/* --- Call screen (call.php) --- */
.call-screen {
    position: fixed;
    inset: 0;
    background: #111;
    display: flex;
    align-items: center;
    justify-content: center;
}

.call-remote-wrap {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

#remote-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: #111;
}

.call-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #fff;
    text-align: center;
    background: #111;
}

.call-placeholder img {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 16px;
}

#local-video {
    position: absolute;
    bottom: 100px;
    right: 16px;
    width: 110px;
    height: 150px;
    object-fit: cover;
    border-radius: 8px;
    border: 2px solid #444;
    background: #222;
}

.call-controls {
    position: absolute;
    bottom: 24px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    gap: 20px;
}

.call-btn {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    background: rgba(255,255,255,0.15);
    color: #fff;
    font-size: 22px;
    cursor: pointer;
}

.call-btn:hover { background: rgba(255,255,255,0.3); }

.call-btn-end {
    background: #e74c3c;
    transform: rotate(135deg);
}

.call-btn-end:hover { background: #d33; }

/* =====================================================================
   Posts, 24-hour stories, view/like counters
   ---------------------------------------------------------------------
   NOTE on buttons: the global `form button` and `form input/textarea`
   rules set width: 100% and top margins. Every new button/input class below
   resets width/margin explicitly so it behaves inside a <form> too.
   ===================================================================== */

.is-hidden { display: none !important; }
.no-scroll { overflow: hidden; }
.section-title { text-align: center; margin: 30px 0 10px; }

/* Small general-purpose button (works on <button>, <a> and <label>). */
.sbtn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    width: auto; margin: 0;
    padding: 8px 16px; border: none; border-radius: 6px;
    background: #E4E6EB; color: #050505;
    font: inherit; font-size: 14px; font-weight: 600; line-height: 1.2;
    cursor: pointer; text-decoration: none;
}
.sbtn:hover { background: #D8DADF; }
.sbtn:disabled { opacity: 0.6; cursor: default; }
.sbtn-primary { background: #1877F2; color: #fff; }
.sbtn-primary:hover { background: #166FE5; }
.sbtn-ghost { background: transparent; color: #65676B; padding: 6px 10px; }
.sbtn-ghost:hover { background: #F0F2F5; }
.sbtn-like { background: transparent; color: #65676B; }
.sbtn-like:hover { background: #F0F2F5; }
.sbtn-like.is-liked { color: #1877F2; }

/* Circle avatar; visitors who aren't logged in get the initial instead. */
.avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; flex: 0 0 auto; background: #DADDE1; }
.avatar-initial {
    display: inline-flex; align-items: center; justify-content: center;
    background: #1877F2; color: #fff; font-weight: 700; font-size: 16px;
}

/* ------------------------------------------------------------- stories */
.stories-wrap { max-width: 900px; margin: 16px auto 0; padding: 0 16px; }
.stories-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin: 0 2px 8px; }
.stories-head h3 { margin: 0; font-size: 17px; }
.stories-head span { font-size: 12px; color: #65676B; }

/* The horizontally scrolling row. */
.stories-strip {
    display: flex; gap: 10px; overflow-x: auto; padding: 4px 2px 12px;
    scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}
.stories-empty { align-self: center; margin: 0 0 0 8px; color: #65676B; font-size: 14px; white-space: nowrap; }

.story-tile {
    position: relative; flex: 0 0 auto; width: 112px; height: 190px;
    margin: 0; padding: 0; border: 0; border-radius: 12px; overflow: hidden;
    background: #DADDE1; color: #fff; text-align: left; font: inherit;
    cursor: pointer; scroll-snap-align: start;
    box-shadow: 0 1px 2px rgba(0,0,0,0.2); display: block;
}
.story-thumb { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.story-tile::after {
    content: ''; position: absolute; inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.65) 0%, rgba(0,0,0,0) 55%);
}
.story-tile .avatar {
    position: absolute; top: 8px; left: 8px; z-index: 1; width: 36px; height: 36px;
    border: 3px solid #1877F2; box-sizing: border-box;
}
.story-tile .avatar-initial { font-size: 14px; }
.story-name {
    position: absolute; left: 8px; right: 8px; bottom: 8px; z-index: 1;
    font-size: 13px; font-weight: 600; text-shadow: 0 1px 2px rgba(0,0,0,0.5);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
/* The first tile: "Add story" / "Join to add". */
.story-add {
    background: #fff; color: #050505; border: 1px solid #DADDE1;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
    text-decoration: none;
}
.story-add::after { display: none; }
.story-add-plus {
    width: 40px; height: 40px; border-radius: 50%; background: #1877F2; color: #fff;
    font-size: 28px; line-height: 38px; text-align: center;
}
.story-add .story-name { position: static; color: #050505; text-shadow: none; text-align: center; padding: 0 6px; }

/* Full-screen story viewer. */
.story-viewer {
    display: none; position: fixed; inset: 0; z-index: 1100;
    background: rgba(0,0,0,0.92); align-items: center; justify-content: center;
}
.story-viewer.open { display: flex; }
.story-stage {
    position: relative; width: min(100vw, 420px); height: min(100vh, 760px);
    background: #000; border-radius: 12px; overflow: hidden;
}
.story-stage > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.story-progress { position: absolute; top: 8px; left: 8px; right: 8px; z-index: 3; display: flex; gap: 4px; }
.story-progress .seg { flex: 1; height: 3px; border-radius: 2px; background: rgba(255,255,255,0.35); overflow: hidden; }
.story-progress .seg i { display: block; height: 100%; width: 0; background: #fff; }
.story-progress .seg.done i { width: 100%; }
.story-progress .seg.run i { animation: storyFill 5s linear forwards; }
@keyframes storyFill { from { width: 0; } to { width: 100%; } }

.story-head {
    position: absolute; top: 18px; left: 10px; right: 10px; z-index: 4;
    display: flex; align-items: center; gap: 10px; color: #fff;
}
.story-avatar {
    width: 36px; height: 36px; border-radius: 50%; overflow: hidden; flex: 0 0 auto;
    display: inline-flex; align-items: center; justify-content: center;
    background: #1877F2; color: #fff; font-weight: 700;
}
.story-avatar img { width: 100%; height: 100%; object-fit: cover; }
.story-who { flex: 1; min-width: 0; display: flex; flex-direction: column; text-shadow: 0 1px 2px rgba(0,0,0,0.6); }
.story-who span { font-size: 12px; opacity: 0.85; }
.story-icon-btn {
    width: 34px; height: 34px; margin: 0; padding: 0; border: 0; border-radius: 50%;
    background: rgba(255,255,255,0.18); color: #fff; font-size: 16px; cursor: pointer;
}
.story-icon-btn:hover { background: rgba(255,255,255,0.32); }

/* Invisible tap zones: left third goes back, the rest goes forward. */
.story-nav { position: absolute; top: 70px; bottom: 70px; z-index: 2; margin: 0; padding: 0; border: 0; background: transparent; cursor: pointer; }
.story-prev { left: 0; width: 35%; }
.story-next { right: 0; width: 65%; }
.story-caption {
    position: absolute; left: 0; right: 0; bottom: 96px; z-index: 3; margin: 0;
    padding: 28px 16px 10px; text-align: center; color: #fff; font-size: 15px;
    background: linear-gradient(to top, rgba(0,0,0,0.65), rgba(0,0,0,0));
}
.story-foot {
    position: absolute; left: 12px; right: 12px; bottom: 14px; z-index: 3;
    display: flex; justify-content: space-between; color: #fff; font-size: 13px;
    text-shadow: 0 1px 2px rgba(0,0,0,0.6);
}
@media (max-width: 480px) {
    .story-stage { width: 100vw; height: 100vh; height: 100dvh; border-radius: 0; }
}

/* "Add to your story" dialog. */
.story-composer {
    display: none; position: fixed; inset: 0; z-index: 1100;
    background: rgba(0,0,0,0.6); align-items: center; justify-content: center; padding: 16px;
}
.story-composer.open { display: flex; }
.story-composer-card {
    width: 100%; max-width: 380px; max-height: 100%; overflow-y: auto;
    background: #fff; border-radius: 12px; padding: 18px;
}
.story-composer-card h3 { margin: 0 0 10px; text-align: center; }
#story-preview { display: block; width: 100%; max-height: 50vh; object-fit: contain; border-radius: 8px; background: #000; }
.composer-note { font-size: 12px; color: #65676B; margin: 8px 0 0; }
.composer-buttons { display: flex; gap: 10px; justify-content: flex-end; margin-top: 12px; }

/* --------------------------------------------------------------- posts */
.feed-wrap { max-width: 600px; margin: 0 auto 40px; padding: 0 16px; }
.post-composer, .post-card, .post-cta {
    background: #fff; border: 1px solid #DADDE1; border-radius: 8px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.08); padding: 14px 16px; margin-bottom: 14px;
}
.post-cta { text-align: center; }
.post-cta p { color: #65676B; margin: 6px 0 12px; }

.composer-row { display: flex; gap: 10px; align-items: flex-start; }
.composer-row textarea {
    flex: 1; min-width: 0; width: auto; margin: 0; padding: 10px 14px;
    border: 0; border-radius: 20px; background: #F0F2F5;
    font: inherit; font-size: 16px; resize: none;
}
.post-preview { position: relative; margin-top: 10px; }
.post-preview img { display: block; width: 100%; max-height: 320px; object-fit: cover; border-radius: 8px; }
.post-preview .sbtn { position: absolute; top: 6px; right: 6px; background: rgba(0,0,0,0.55); color: #fff; }
.post-preview .sbtn:hover { background: rgba(0,0,0,0.75); }
.composer-actions { display: flex; align-items: center; gap: 10px; margin-top: 10px; padding-top: 10px; border-top: 1px solid #E4E6EB; }
.composer-actions .composer-note { flex: 1; margin: 0; }

.post-head { display: flex; align-items: center; gap: 10px; }
.post-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.post-author { font-weight: 700; color: #050505; }
a.post-author:hover { text-decoration: underline; }
.post-time { font-size: 12px; color: #65676B; }
.post-delete-form { margin: 0; }
.post-body { margin-top: 10px; overflow-wrap: anywhere; }
.post-photo {
    display: block; width: 100%; max-height: 560px; object-fit: cover;
    margin-top: 10px; border-radius: 8px; cursor: zoom-in; background: #F0F2F5;
}
.post-stats {
    display: flex; gap: 14px; flex-wrap: wrap; margin-top: 10px; padding-bottom: 8px;
    font-size: 13px; color: #65676B; border-bottom: 1px solid #E4E6EB;
}
.post-actions { display: flex; align-items: center; gap: 8px; padding-top: 6px; }
.post-like-form { margin: 0; }
.post-report { margin-left: auto; font-size: 12px; color: #65676B; }
.post-report:hover { text-decoration: underline; }
.feed-more-wrap { text-align: center; margin: 6px 0 0; }

/* ---------------------------------------------------- profile counters */
.profile-stats { display: flex; justify-content: center; gap: 18px; flex-wrap: wrap; margin: 10px 0; color: #65676B; font-size: 14px; }
.profile-stats strong { color: #050505; }
.card-stats { display: flex; justify-content: center; gap: 12px; margin: 0 0 8px; font-size: 12px; color: #65676B; }

/* ------------------------------------------- small screens (needs the
   viewport tag, which index.php and dashboard.php now have) */
@media (max-width: 700px) {
    /* Nav becomes one swipeable row instead of wrapping onto 4 lines. */
    .topbar {
        flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto;
        gap: 2px; padding: 6px 10px; scrollbar-width: none; -webkit-overflow-scrolling: touch;
    }
    .topbar::-webkit-scrollbar { display: none; }
    .topbar a, .topbar .brand, .topbar .points-badge { flex: 0 0 auto; white-space: nowrap; }

    /* Landing page: two compact profile cards per row. */
    .landing-grid { padding: 14px 10px; gap: 10px; }
    .landing-grid .profile-card { width: calc(50% - 5px); padding: 12px 8px; }
    .landing-grid .profile-photo { width: 88px; height: 88px; }
    .stories-wrap, .feed-wrap { padding: 0 10px; }
}

/* The sticky top bar would otherwise cover the heading when jumping to #posts or #post-123. */
#posts, .post-card { scroll-margin-top: 70px; }

@media (max-width: 700px) {
    /* Keep "Log in to see more" / "See More" on one line in the two-up cards. */
    .landing-grid .like-btn { padding: 8px 10px; font-size: 13px; white-space: nowrap; }
}

/* ----------------------------------------------- edit post + replies */
.post-edited { color: #65676B; }
.post-edit-btn { margin-right: 2px; }
.post-edit-form { margin-top: 10px; }
.post-edit-form textarea {
    width: 100%; box-sizing: border-box; padding: 10px 14px; margin: 0;
    border: 1px solid #CED0D4; border-radius: 12px; background: #F0F2F5;
    font: inherit; font-size: 16px; resize: vertical;
}
.post-edit-error, .comment-error { color: #FA383E; font-size: 13px; margin: 6px 0 0; }
.stat-comments { margin-left: auto; }

.post-comments { margin-top: 8px; padding-top: 10px; border-top: 1px solid #E4E6EB; }
.comment-list { display: flex; flex-direction: column; gap: 10px; }
.comment-empty { color: #65676B; font-size: 13px; margin: 0; text-align: center; }
.comment-item { display: flex; gap: 8px; align-items: flex-start; }
.comment-avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; flex: 0 0 32px; }
.comment-avatar.avatar-initial {
    display: inline-flex; align-items: center; justify-content: center;
    background: #E4E6EB; color: #4B4F56; font-weight: 700; font-size: 14px;
}
.comment-main { min-width: 0; flex: 1; }
.comment-bubble { display: inline-block; max-width: 100%; background: #F0F2F5; border-radius: 16px; padding: 8px 12px; box-sizing: border-box; }
.comment-author { display: block; font-weight: 700; font-size: 13px; color: #050505; }
a.comment-author:hover { text-decoration: underline; }
.comment-text { display: block; font-size: 14px; overflow-wrap: anywhere; }
.comment-meta { display: flex; align-items: center; gap: 12px; margin: 2px 0 0 10px; font-size: 12px; color: #65676B; }
.comment-delete-form { margin: 0; }
.comment-delete { background: none; border: 0; padding: 0; width: auto; margin: 0; font: inherit; font-size: 12px; color: #65676B; cursor: pointer; }
.comment-delete:hover { text-decoration: underline; color: #FA383E; }
.comment-form { display: flex; gap: 8px; align-items: center; margin-top: 12px; }
.comment-form input[type=text] {
    flex: 1; min-width: 0; width: auto; margin: 0; padding: 9px 14px;
    border: 0; border-radius: 20px; background: #F0F2F5; font: inherit; font-size: 16px;
}
.comment-form .sbtn { flex: 0 0 auto; width: auto; margin: 0; }

/* ------------------------------------------------- terms & privacy page */
.terms-container { max-width: 640px; margin: 0 auto 40px; padding: 0 16px; }
.terms-container h2 { text-align: center; margin-bottom: 6px; }
.terms-lead { text-align: center; color: #65676B; margin: 0 0 16px; }
.terms-box {
    background: #fff; border: 1px solid #DADDE1; border-radius: 8px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.08); padding: 14px 18px; margin-bottom: 14px;
    max-height: 280px; overflow-y: auto; -webkit-overflow-scrolling: touch; font-size: 14px; line-height: 1.5;
}
.terms-box h3 { margin: 0 0 4px; font-size: 17px; }
.terms-box h4 { margin: 14px 0 4px; font-size: 14px; }
.terms-box p { margin: 0 0 6px; color: #3A3B3C; }
.terms-box .terms-updated { color: #65676B; font-size: 12px; }
.terms-form { background: #fff; border: 1px solid #DADDE1; border-radius: 8px; padding: 14px 18px; }
.terms-check { display: flex; gap: 10px; align-items: flex-start; margin: 0 0 12px; font-size: 14px; line-height: 1.4; cursor: pointer; }
.terms-check input[type=checkbox] { width: 20px; height: 20px; flex: 0 0 20px; margin: 1px 0 0; padding: 0; }
.terms-form button[type=submit] { margin-top: 4px; }
.terms-form button[type=submit]:disabled { opacity: 0.5; cursor: not-allowed; }
.terms-decline { text-align: center; margin: 12px 0 0; font-size: 13px; }

/* comment links, threads, "See comments" */
.see-comments { display: block; margin: 8px 0 0; }
.comment-link {
    background: none; border: 0; padding: 0; width: auto; margin: 0; font: inherit; font-size: 12px;
    font-weight: 600; color: #65676B; cursor: pointer; text-decoration: none;
}
.see-comments { font-size: 13px; }
.comment-link:hover { text-decoration: underline; }
.comment-delete:hover { color: #FA383E; }
.comment-thread { display: block; }
.comment-replies { margin-left: 40px; }
.comment-toggle-replies { display: block; margin: 4px 0 0 4px; color: #1877F2; }
.comment-children { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.comment-item.is-reply .comment-avatar { width: 26px; height: 26px; flex-basis: 26px; font-size: 12px; }
.comment-reply-form { margin-top: 8px; }
.comment-list { gap: 12px; }

/* story reactions: a slim glass pill on the right edge. It shows ONE reaction;
   swipe it sideways for the rest. */
.story-reactions {
    position: absolute; right: 10px; bottom: 44px; z-index: 5;
    pointer-events: none;
}
.rx-strip {
    pointer-events: auto; display: flex; gap: 6px; box-sizing: border-box;
    width: 76px; padding: 5px;
    overflow-x: auto; overflow-y: hidden;
    scroll-snap-type: x mandatory; scroll-padding-right: 5px;
    scrollbar-width: none; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain;
    border-radius: 28px;
    background: rgba(24, 25, 28, 0.62);
    -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4);
    -webkit-mask-image: linear-gradient(90deg, rgba(0,0,0,0.35) 0, #000 20px);
    mask-image: linear-gradient(90deg, rgba(0,0,0,0.35) 0, #000 20px);
}
.rx-strip::-webkit-scrollbar { display: none; }
.rx-btn {
    flex: 0 0 44px; width: 44px; height: 44px; margin: 0; padding: 0; border: 0; border-radius: 50%;
    background: transparent; font-size: 24px; line-height: 44px; text-align: center; cursor: pointer;
    scroll-snap-align: end; transition: transform 0.15s ease, background 0.15s ease;
    -webkit-tap-highlight-color: transparent;
}
.rx-btn:hover { background: rgba(255, 255, 255, 0.16); }
.rx-btn:active { transform: scale(1.22); }
.rx-btn.is-active { background: rgba(255, 255, 255, 0.95); box-shadow: 0 0 0 2px #1877F2; }
.rx-mine {
    position: absolute; top: -13px; left: -4px; z-index: 1;
    width: 24px; height: 24px; border-radius: 50%; background: #fff; font-size: 14px; line-height: 24px; text-align: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4); pointer-events: none;
}
.story-login-react {
    position: absolute; right: 12px; bottom: 50px; z-index: 5; text-align: center;
    color: #fff; font-size: 13px; text-decoration: underline; text-shadow: 0 1px 2px rgba(0,0,0,0.6);
}
.story-owner-bar {
    position: absolute; left: 12px; right: 12px; bottom: 42px; z-index: 5;
    display: flex; justify-content: center; gap: 8px; flex-wrap: wrap;
}
.story-owner-btn {
    width: auto; margin: 0; padding: 8px 14px; border: 1px solid rgba(255,255,255,0.2); border-radius: 20px;
    background: rgba(24, 25, 28, 0.62); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
    color: #fff; font-size: 14px; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.story-owner-btn:hover { background: rgba(60, 62, 68, 0.75); }
.story-tabs { display: flex; gap: 6px; }
.story-tab {
    width: auto; margin: 0; padding: 7px 14px; border: 0; border-radius: 18px;
    background: #F0F2F5; color: #4B4F56; font-size: 14px; font-weight: 600; cursor: pointer;
}
.story-tab.is-active { background: #E7F3FF; color: #1877F2; }
.story-people {
    position: absolute; left: 0; right: 0; bottom: 0; z-index: 6; max-height: 70%;
    display: flex; flex-direction: column; background: #fff; color: #050505;
    border-radius: 14px 14px 0 0;
}
.story-people-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px 6px; }
.story-people-head .story-icon-btn { background: #E4E6EB; color: #050505; }
.story-people-list { overflow-y: auto; padding: 4px 14px 16px; -webkit-overflow-scrolling: touch; }
.story-people-summary { margin: 0 0 8px; font-size: 15px; color: #65676B; }
.story-person { display: flex; align-items: center; gap: 10px; padding: 8px 0; color: inherit; text-decoration: none; border-top: 1px solid #F0F2F5; }
.story-person-avatar {
    width: 36px; height: 36px; border-radius: 50%; overflow: hidden; flex: 0 0 36px;
    display: inline-flex; align-items: center; justify-content: center;
    background: #E4E6EB; color: #4B4F56; font-weight: 700;
}
.story-person-avatar img { width: 100%; height: 100%; object-fit: cover; }
.story-person-name { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.story-person-ago { font-size: 12px; color: #65676B; }
.story-person-emoji { font-size: 22px; }

/* editing a comment */
.comment-edited { color: #65676B; }
.comment-edit-form { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 2px; }
.comment-edit-form input[type=text] {
    flex: 1 1 100%; min-width: 0; width: auto; margin: 0; padding: 9px 14px;
    border: 1px solid #CED0D4; border-radius: 20px; background: #F0F2F5; font: inherit; font-size: 16px;
}
.comment-edit-form .sbtn { width: auto; margin: 0; }
.comment-edit-error { flex: 1 1 100%; color: #FA383E; font-size: 13px; margin: 2px 0 0; }

/* @mentions */
a.mention { color: #1877F2; font-weight: 600; text-decoration: none; }
a.mention:hover { text-decoration: underline; }

/* ------------------------------------------------------------------
   Phones: the top bar becomes a neat 3-column grid of tiles instead of
   one long row you have to swipe. Brand on the left, bell and points on
   the right, then the tabs three to a row. It scrolls away with the page
   (a sticky bar this tall would cover too much of a small screen).
   ------------------------------------------------------------------ */
@media (max-width: 700px) {
    .topbar {
        display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px;
        overflow: visible; padding: 8px 10px 10px; position: static;
        align-items: stretch; justify-content: initial;
    }
    .topbar .brand { grid-column: span 3; order: 0; padding: 4px 2px; font-size: 21px; align-self: center; }
    .topbar a.bell-link { grid-column: span 1; order: 1; justify-content: center; background: #F0F2F5; padding: 8px 0; align-self: center; }
    .topbar .points-badge { grid-column: span 2; order: 2; justify-content: center; align-self: center; }
    .topbar > a:not(.brand):not(.bell-link) {
        grid-column: span 2; order: 3;
        flex-direction: column; justify-content: center; align-items: center; text-align: center;
        gap: 3px; padding: 9px 4px; font-size: 12.5px; line-height: 1.15;
        background: #F0F2F5; border-radius: 10px; position: relative; min-width: 0;
    }
    .topbar > a:not(.brand):not(.bell-link) .nav-icon { font-size: 20px; }
    .topbar a, .topbar .brand, .topbar .points-badge { white-space: normal; }
    .topbar .badge { position: absolute; top: 3px; right: 10px; margin: 0; }
    .topbar a.bell-link .badge { top: -4px; right: 2px; }
    .topbar a.bell-link { position: relative; }
}

/* ------------------------------------------------------- Discover */
.discover-wrap { max-width: 720px; margin: 0 auto; padding: 0 14px 30px; box-sizing: border-box; }
.discover-grid {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px;
    padding: 6px 0 10px; align-items: start;
}
.discover-grid .profile-card { width: auto; min-width: 0; box-sizing: border-box; padding: 16px 12px; }
.discover-grid .profile-card h3 { font-size: 17px; margin: 6px 0 4px; overflow-wrap: anywhere; }
.discover-grid .profile-card p { overflow-wrap: anywhere; }
.discover-grid .discover-empty, .discover-grid .match-group { grid-column: 1 / -1; }
.discover-empty { text-align: center; color: #65676B; padding: 20px 0; }
.match-group {
    margin: 10px 0 0; padding: 6px 12px; border-radius: 8px; background: #E7F3FF; color: #1877F2;
    font-size: 14px; font-weight: 700;
}
.match-group.is-best { background: #E6F6E8; color: #1B7F2B; }
.search-summary { color: #65676B; font-size: 13px; text-align: center; margin: 4px 0 8px; }

/* Search form: same layout as the registration form, on a very pale blue panel so it stands out. */
.search-card {
    max-width: 520px; margin: 14px auto 18px; padding: 22px 26px 18px; box-sizing: border-box;
    background: #EAF4FF; border: 1px solid #B9D8F7; border-radius: 8px; box-shadow: 0 1px 3px rgba(24, 119, 242, 0.15);
}
.search-card select, .search-card input[type=number] { background: #fff; border-color: #B9D8F7; }
.search-card h2 { text-align: center; color: #050505; margin: 0 0 6px; font-size: 22px; }
.search-card select, .search-card input[type=number] { box-sizing: border-box; font-size: 16px; }
.search-age { display: flex; align-items: center; gap: 8px; }
.search-age input { flex: 1; min-width: 0; }
.search-age span { color: #65676B; font-size: 14px; margin-top: 5px; }
.search-reset { text-align: center; margin: 12px 0 0; font-size: 14px; }

/* Phones: still two columns, just tighter. */
@media (max-width: 700px) {
    .discover-wrap { padding: 0 10px 24px; }
    .discover-grid { gap: 10px; }
    .discover-grid .profile-card { padding: 12px 8px; }
    .discover-grid .profile-photo { width: 88px; height: 88px; }
    .discover-grid .profile-card h3 { font-size: 15px; }
    .discover-grid .profile-card p, .discover-grid .profile-card .bio { font-size: 12.5px; }
    .discover-grid .profile-card .bio { min-height: 0; }
    .discover-grid .points-badge { font-size: 11px; padding: 4px 7px; }
    .discover-grid .like-btn { padding: 8px 6px; font-size: 13px; white-space: nowrap; }
    .search-card { margin: 10px 10px 12px; padding: 18px 16px 14px; }
}

/* Matches / Friends: two-column grids reuse .discover-grid. */
.discover-wrap h2 { text-align: center; }
.section-note { text-align: center; color: #999; font-size: 13px; margin: -8px 0 10px; }
.discover-grid .like-btn { box-sizing: border-box; text-align: center; text-decoration: none; }
.discover-grid a.like-btn.btn-block { display: block; }
.discover-grid .like-btn .badge { margin-left: 6px; }
.know-reasons { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; margin: 0 0 8px; }
.reason { font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 10px; white-space: nowrap; }
.reason-like { background: #FFEBEC; color: #D12B33; }
.reason-view { background: #FFF4DB; color: #8A5A00; }
.reason-match { background: #E7F3FF; color: #1877F2; }

/* Liked tab: three columns. */
.discover-wrap.wide { max-width: 900px; }
.discover-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.liked-link { color: inherit; text-decoration: none; display: block; }
.liked-link h3 { color: #050505; }
.discover-grid.three .discover-empty { grid-column: 1 / -1; }
@media (max-width: 700px) {
    .discover-grid.three { gap: 8px; }
    .discover-grid.three .profile-card { padding: 10px 6px; }
    .discover-grid.three .profile-photo { width: 64px; height: 64px; margin-bottom: 6px; }
    .discover-grid.three .profile-card h3 { font-size: 13px; margin: 2px 0 8px; }
    .discover-grid.three .like-btn { font-size: 12px; padding: 7px 2px; }
}

/* Post audience picker */
.composer-audience {
    width: auto; margin: 0; padding: 8px 10px; border: 1px solid #CED0D4; border-radius: 8px;
    background: #F0F2F5; font: inherit; font-size: 14px; font-weight: 600; color: #4B4F56; cursor: pointer;
}
.composer-actions { flex-wrap: wrap; }
.composer-actions .composer-audience { margin-left: auto; }
.post-audience { cursor: help; }
.edit-audience { display: block; margin: 8px 0 0; font-size: 13px; font-weight: 600; color: #4B4F56; }
.edit-audience select {
    width: auto; margin: 0 0 0 6px; padding: 6px 8px; border: 1px solid #CED0D4; border-radius: 8px;
    background: #F0F2F5; font: inherit; font-size: 14px;
}

/* Active tab: the page you are on (and the tab while it is being pressed) is blue. */
.topbar a.active, .topbar a.active:hover,
.topbar > a.active:not(.brand):not(.bell-link),
.topbar a.bell-link.active,
.topbar a:not(.brand):active {
    background: #1877F2; color: #fff;
}
.topbar a.active .badge { box-shadow: 0 0 0 2px #1877F2; }

/* Story comments */
.story-viewer.is-paused .story-progress .seg.run i { animation-play-state: paused; }
.story-comment-form {
    position: absolute; left: 12px; right: 100px; bottom: 44px; z-index: 5;
    display: flex; gap: 6px; align-items: center;
}
.story-comment-form.full { right: 12px; }
.story-comment-form input {
    flex: 1; min-width: 0; width: auto; margin: 0; padding: 12px 16px; box-sizing: border-box;
    border: 1px solid rgba(255,255,255,0.3); border-radius: 24px;
    background: rgba(24, 25, 28, 0.62); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
    color: #fff; font-size: 16px;
}
.story-comment-form input::placeholder { color: rgba(255,255,255,0.75); }
.story-comment-form button {
    flex: 0 0 44px; width: 44px; height: 44px; margin: 0; padding: 0; border: 0; border-radius: 50%;
    background: #1877F2; color: #fff; font-size: 18px; cursor: pointer;
}
.story-comment-msg {
    position: absolute; top: 64px; left: 50%; transform: translateX(-50%); z-index: 6; margin: 0;
    padding: 6px 14px; border-radius: 16px; background: rgba(24, 25, 28, 0.8); color: #fff; font-size: 13px;
    max-width: 90%; text-align: center;
}
.story-comment-msg.is-error { background: #D12B33; }
.story-comment-row { padding: 6px 0 10px; border-top: 1px solid #F0F2F5; }
.story-comment-row .story-person { border-top: 0; padding-bottom: 2px; }
.story-comment-text { margin: 0 0 4px 46px; font-size: 15px; overflow-wrap: anywhere; white-space: pre-wrap; }
.story-comment-del { margin: 0 0 0 46px; width: auto; padding: 0; border: 0; background: none; color: #65676B; font-size: 12px; font-weight: 600; cursor: pointer; }
.story-comment-del:hover { color: #FA383E; text-decoration: underline; }

/* "More actions" menu (replaces loose Report / Block links) */
.more-menu { display: inline-block; }
.more-btn {
    width: auto; margin: 0; padding: 6px 14px; border: 1px solid #DADDE1; border-radius: 16px;
    background: #fff; color: #65676B; font-size: 13px; font-weight: 600; cursor: pointer;
}
.more-btn:hover { background: #F0F2F5; }
.post-actions .more-menu { margin-left: auto; }
.post-actions .more-btn { padding: 4px 12px; }
.more-sheet { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: flex-end; justify-content: center; }
.more-sheet[hidden] { display: none; }
.more-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.45); }
.more-panel {
    position: relative; width: 100%; max-width: 420px; box-sizing: border-box;
    background: #fff; border-radius: 16px 16px 0 0; padding: 8px 12px calc(12px + env(safe-area-inset-bottom, 0px));
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.25); animation: moreSlideUp 0.18s ease-out;
}
@keyframes moreSlideUp { from { transform: translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }
.more-panel-items form { margin: 0; }
.more-panel-items > a,
.more-panel-items form button {
    display: block; width: 100%; box-sizing: border-box; margin: 0; padding: 15px 12px; text-align: left;
    background: none; border: 0; border-bottom: 1px solid #F0F2F5; border-radius: 0;
    font-size: 16px; font-weight: 600; color: #050505; cursor: pointer; text-decoration: none;
}
.more-panel-items > a:hover,
.more-panel-items form button:hover { background: #F0F2F5; }
.more-panel-items form button.more-danger { color: #D12B33; }
.more-cancel {
    display: block; width: 100%; margin: 8px 0 0; padding: 13px; border: 0; border-radius: 10px;
    background: #F0F2F5; color: #050505; font-size: 16px; font-weight: 600; cursor: pointer;
}
@media (min-width: 700px) {
    .more-sheet { align-items: center; }
    .more-panel { border-radius: 16px; }
}

/* Post composer: keep the Post button on the right, even when the audience picker fills the row above it */
.composer-actions .composer-audience { margin-left: 0; }
.composer-actions #post-submit { margin-left: auto; }

/* ---- Guests: locked story tiles ---- */
.story-locked {
    background: linear-gradient(160deg, #1877F2 0%, #e91e63 100%);
    text-decoration: none; display: block;
}
.story-lock {
    position: absolute; inset: 0; z-index: 1;
    display: flex; align-items: center; justify-content: center; font-size: 30px;
}

/* ---- Screenshot deterrents (js/protect.js) ---- */
[data-protect] img {
    -webkit-touch-callout: none; -webkit-user-drag: none;
    -webkit-user-select: none; user-select: none;
}
html.protect-hide [data-protect] {
    filter: blur(30px) brightness(0.4) !important;
    pointer-events: none;
}
@media print { [data-protect] { display: none !important; } }
