/* Shinsei Profile Feed - Zeina/prosilver-compatible profile updates. */

.profilefeed-page,
.profilefeed-tabs {
    --pf-accent: #a44635;
    --pf-accent-bright: #c8664e;
    --pf-accent-soft: rgba(164, 70, 53, 0.16);
    --pf-surface: #171512;
    --pf-surface-raised: #1d1916;
    --pf-field: #181512;
    --pf-field-focus: #201a17;
    --pf-line: rgba(164, 117, 96, 0.24);
    --pf-line-strong: rgba(164, 117, 96, 0.38);
    --pf-text: #e0d9d4;
    --pf-muted: rgba(214, 204, 198, 0.55);
}

.profilefeed-page {
    max-width: 980px;
    margin: 0 auto;
}

/* Profile / Feed segmented navigation */
.profilefeed-tabs {
    margin: 0 0 16px;
}

.profilefeed-tabs ul {
    display: inline-flex;
    align-items: center;
    gap: 0;
    margin: 0;
    padding: 4px;
    list-style: none;
    background: rgba(22, 19, 17, 0.88);
    border: 1px solid var(--pf-line);
    border-radius: 999px;
    box-shadow: inset 0 1px rgba(255, 255, 255, 0.025), 0 6px 16px rgba(0, 0, 0, 0.13);
}

.profilefeed-tabs .profilefeed-tab {
    display: flex;
    align-items: center;
    margin: 0;
    padding: 0;
}

.profilefeed-tabs .profilefeed-tab + .profilefeed-tab::before {
    content: "•";
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    color: rgba(205, 178, 165, 0.32);
    font-size: 10px;
    line-height: 1;
}

.profilefeed-tabs .profilefeed-tab a {
    display: block;
    min-width: 78px;
    padding: 8px 14px;
    color: var(--pf-muted);
    border: 1px solid transparent;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.1;
    text-align: center;
    text-decoration: none;
    transition: color 160ms ease, background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.profilefeed-tabs .profilefeed-tab a:hover {
    color: var(--pf-text);
    background: rgba(255, 255, 255, 0.035);
}

.profilefeed-tabs .profilefeed-tab.is-active a {
    color: #f4dfd8;
    background: linear-gradient(180deg, rgba(164, 70, 53, 0.28), rgba(164, 70, 53, 0.17));
    border-color: rgba(198, 102, 78, 0.28);
    box-shadow: inset 0 1px rgba(255, 255, 255, 0.055);
}

.profilefeed-tabs .profilefeed-tab a:active {
    transform: translateY(1px);
}

.profilefeed-hero,
.profilefeed-composer,
.profilefeed-update,
.profilefeed-empty {
    box-sizing: border-box;
    color: var(--pf-text);
    background: var(--pf-surface);
    border: 1px solid var(--pf-line);
    border-radius: 10px;
    overflow: hidden;
}

/* Profile feed cover header */
.profilefeed-hero {
    position: relative;
    isolation: isolate;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 16px;
    min-height: 118px;
    margin-bottom: 14px;
    padding: 20px;
}

.profilefeed-hero__cover,
.profilefeed-hero__scrim {
    position: absolute;
    z-index: -2;
    inset: 0;
    pointer-events: none;
}

.profilefeed-hero__cover img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 1;
    filter: none;
}

/*
 * Keep the source image sharp and darken it with one predictable overlay.
 * The editor preview uses these exact same values so it matches the saved
 * profile header instead of becoming darker after submission.
 */
.profilefeed-hero__scrim {
    z-index: -1;
    background:
        linear-gradient(90deg, rgba(12, 10, 9, 0.68) 0%, rgba(12, 10, 9, 0.30) 48%, rgba(12, 10, 9, 0.48) 100%),
        linear-gradient(180deg, rgba(0, 0, 0, 0.06), rgba(0, 0, 0, 0.24));
}

.profilefeed-hero:not(.has-cover)::after {
    content: "忍";
    position: absolute;
    z-index: -1;
    right: 20px;
    bottom: -24px;
    color: var(--pf-accent);
    font: 900 100px/1 serif;
    opacity: 0.035;
    pointer-events: none;
}

.profilefeed-hero__avatar,
.profilefeed-hero__text,
.profilefeed-hero__actions {
    position: relative;
    z-index: 1;
}

.profilefeed-hero__avatar img {
    display: block;
    width: 72px;
    height: 72px;
    object-fit: cover;
    background: var(--pf-surface);
    border: 3px solid rgba(205, 112, 88, 0.6);
    border-radius: 50%;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.38);
}

.profilefeed-hero__text h2 {
    margin: 0 0 4px;
    color: var(--pf-text);
    font-size: 22px;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.65);
}

.profilefeed-hero__text p {
    margin: 0;
    color: rgba(232, 224, 219, 0.65);
    text-shadow: 0 1px 5px rgba(0, 0, 0, 0.72);
}

.profilefeed-hero__actions {
    display: flex;
    align-items: flex-end;
    flex-direction: column;
    gap: 9px;
}

.profilefeed-cover-edit {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 9px;
    color: rgba(242, 231, 225, 0.8) !important;
    background: rgba(14, 12, 11, 0.62) !important;
    border-color: rgba(217, 181, 166, 0.2) !important;
    backdrop-filter: blur(5px);
    font-size: 10px;
}

.profilefeed-cover-edit:hover {
    color: #fff !important;
    background: rgba(164, 70, 53, 0.72) !important;
    border-color: rgba(215, 120, 95, 0.6) !important;
}

.profilefeed-hero__count {
    padding: 7px 10px;
    color: #e18068;
    background: rgba(68, 20, 14, 0.58);
    border: 1px solid rgba(185, 76, 53, 0.18);
    border-radius: 999px;
    backdrop-filter: blur(4px);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

/* Composer and post cards */
.profilefeed-composer {
    margin-bottom: 16px;
    padding: 16px;
    border-top: 3px solid var(--pf-accent);
}

.profilefeed-composer h3 {
    margin: 0 0 12px;
}

.profilefeed-editor textarea {
    min-height: 135px;
    resize: vertical;
}

/* Replace Zeina's blue form fields inside the feed only. */
.profilefeed-page textarea.inputbox,
.profilefeed-page input.inputbox,
.profilefeed-page select.inputbox,
.profilefeed-cover-form input[type="text"] {
    box-sizing: border-box;
    color: var(--pf-text) !important;
    background: linear-gradient(180deg, rgba(25, 22, 19, 0.98), rgba(19, 17, 15, 0.98)) !important;
    border: 1px solid var(--pf-line-strong) !important;
    border-radius: 8px !important;
    box-shadow: inset 0 1px 8px rgba(0, 0, 0, 0.2) !important;
    caret-color: var(--pf-accent-bright);
}

.profilefeed-page textarea.inputbox:hover,
.profilefeed-page input.inputbox:hover,
.profilefeed-page select.inputbox:hover {
    border-color: rgba(185, 116, 91, 0.46) !important;
}

.profilefeed-page textarea.inputbox:focus,
.profilefeed-page input.inputbox:focus,
.profilefeed-page select.inputbox:focus {
    color: #f1ebe7 !important;
    background: var(--pf-field-focus) !important;
    border-color: rgba(198, 102, 78, 0.7) !important;
    outline: 0 !important;
    box-shadow: 0 0 0 3px rgba(164, 70, 53, 0.13), inset 0 1px 8px rgba(0, 0, 0, 0.22) !important;
}

.profilefeed-page textarea.inputbox::placeholder,
.profilefeed-page input.inputbox::placeholder {
    color: rgba(218, 205, 198, 0.37) !important;
    opacity: 1;
}

.profilefeed-form-footer,
.profilefeed-comment-form__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 10px;
}

.profilefeed-form-hint,
.profilefeed-comment-form__footer span {
    color: var(--pf-muted);
    font-size: 11px;
}

.profilefeed-update {
    margin-bottom: 14px;
    padding: 0;
}

.profilefeed-update__header {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    padding: 15px 17px;
    border-bottom: 1px solid var(--pf-line);
}

.profilefeed-avatar img {
    display: block;
    object-fit: cover;
    border-radius: 50%;
}

.profilefeed-avatar--update img {
    width: 46px;
    height: 46px;
}

.profilefeed-avatar--comment img {
    width: 32px;
    height: 32px;
}

.profilefeed-author {
    font-weight: 700;
}

.profilefeed-update__identity time,
.profilefeed-comment__meta time {
    display: block;
    margin-top: 3px;
    color: var(--pf-muted);
    font-size: 11px;
}

.profilefeed-message {
    overflow-wrap: anywhere;
}

.profilefeed-update > .profilefeed-message {
    padding: 18px 20px 20px;
    font-size: 14px;
    line-height: 1.7;
}

.profilefeed-update > .profilefeed-message > :first-child,
.profilefeed-comment .profilefeed-message > :first-child {
    margin-top: 0;
}

.profilefeed-update > .profilefeed-message > :last-child,
.profilefeed-comment .profilefeed-message > :last-child {
    margin-bottom: 0;
}

.profilefeed-delete-button {
    padding: 4px 9px;
    font-size: 10px;
}

.profilefeed-comment-heading {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 9px 17px;
    color: var(--pf-muted);
    background: rgba(127, 127, 127, 0.035);
    border-top: 1px solid var(--pf-line);
    border-bottom: 1px solid var(--pf-line);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.profilefeed-comment-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 19px;
    height: 19px;
    padding: 0 5px;
    color: var(--pf-accent-bright);
    background: var(--pf-accent-soft);
    border-radius: 999px;
}

.profilefeed-comments {
    padding: 0 17px;
}

.profilefeed-comment {
    position: relative;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 10px;
    padding: 13px 0;
    border-bottom: 1px solid var(--pf-line);
}

.profilefeed-comment__meta {
    display: flex;
    align-items: baseline;
    gap: 9px;
    margin-bottom: 5px;
}

.profilefeed-comment__meta time {
    display: inline;
    margin: 0;
}

.profilefeed-comment .profilefeed-message {
    font-size: 12px;
    line-height: 1.55;
}

.profilefeed-comment-delete {
    width: 25px;
    height: 25px;
    padding: 0;
    color: var(--pf-muted);
    background: transparent;
    border: 0;
    border-radius: 50%;
    font-size: 19px;
    line-height: 1;
    cursor: pointer;
}

.profilefeed-comment-delete:hover {
    color: #fff;
    background: var(--pf-accent);
}

.profilefeed-comment-form {
    padding: 14px 17px 17px;
}

.profilefeed-comment-form textarea {
    min-height: 62px;
    resize: vertical;
}

.profilefeed-empty {
    padding: 44px 24px;
    text-align: center;
}

.profilefeed-empty__symbol {
    display: inline-block;
    margin-bottom: 8px;
    color: var(--pf-accent);
    font-size: 28px;
}

.profilefeed-empty p {
    margin: 0;
    color: var(--pf-muted);
}

.profilefeed-page .bbcode-status,
.profilefeed-page .bbcode-status-container {
    margin-bottom: 8px;
}

/* Cover upload modal */
html.profilefeed-modal-open,
html.profilefeed-modal-open body {
    overflow: hidden;
}

.profilefeed-cover-modal[hidden] {
    display: none !important;
}

.profilefeed-cover-modal {
    position: fixed;
    z-index: 10050;
    inset: 0;
    display: grid;
    place-items: center;
    box-sizing: border-box;
    padding: 22px;
}

.profilefeed-cover-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(5, 4, 4, 0.78);
    backdrop-filter: blur(5px);
}

.profilefeed-cover-modal__dialog {
    position: relative;
    z-index: 1;
    width: min(1040px, 100%);
    max-height: calc(100vh - 44px);
    overflow-y: auto;
    color: var(--pf-text);
    background:
        radial-gradient(circle at 100% 0, rgba(164, 70, 53, 0.11), transparent 36%),
        var(--pf-surface-raised);
    border: 1px solid var(--pf-line-strong);
    border-radius: 13px;
    box-shadow: 0 24px 75px rgba(0, 0, 0, 0.62);
}

.profilefeed-cover-modal__close {
    position: absolute;
    z-index: 2;
    top: 12px;
    right: 12px;
    width: 34px;
    height: 34px;
    padding: 0;
    color: rgba(235, 224, 218, 0.65);
    background: rgba(10, 9, 8, 0.45);
    border: 1px solid var(--pf-line);
    border-radius: 50%;
    font-size: 23px;
    line-height: 30px;
    cursor: pointer;
}

.profilefeed-cover-modal__close:hover {
    color: #fff;
    background: var(--pf-accent);
}

.profilefeed-cover-modal__header {
    padding: 24px 58px 17px 24px;
    border-bottom: 1px solid var(--pf-line);
}

.profilefeed-cover-modal__eyebrow {
    display: block;
    margin-bottom: 5px;
    color: var(--pf-accent-bright);
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.profilefeed-cover-modal__header h3 {
    margin: 0 0 6px;
    font-size: 21px;
}

.profilefeed-cover-modal__header p {
    margin: 0;
    color: var(--pf-muted);
    font-size: 12px;
    line-height: 1.55;
}

.profilefeed-cover-form {
    padding: 19px 24px 24px;
}

.profilefeed-cover-upload {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
    padding: 12px 14px;
    color: var(--pf-text);
    background: rgba(12, 11, 10, 0.36);
    border: 1px dashed var(--pf-line-strong);
    border-radius: 9px;
    cursor: pointer;
    transition: border-color 160ms ease, background 160ms ease;
}

.profilefeed-cover-upload:hover {
    background: rgba(164, 70, 53, 0.055);
    border-color: rgba(198, 102, 78, 0.64);
}

.profilefeed-cover-upload__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 38px;
    width: 38px;
    height: 38px;
    color: var(--pf-accent-bright);
    background: var(--pf-accent-soft);
    border-radius: 50%;
    font-size: 22px;
}

.profilefeed-cover-upload strong,
.profilefeed-cover-upload small {
    display: block;
}

.profilefeed-cover-upload small {
    margin-top: 3px;
    color: var(--pf-muted);
    font-size: 10px;
}

.profilefeed-cover-upload input[type="file"] {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
}

.profilefeed-cover-preview {
    position: relative;
    isolation: isolate;
    box-sizing: border-box;
    height: 118px;
    overflow: hidden;
    background: #100e0d;
    border: 1px solid var(--pf-line-strong);
    border-radius: 10px;
    cursor: grab;
    touch-action: none;
    user-select: none;
}

.profilefeed-cover-preview.is-dragging {
    cursor: grabbing;
}

.profilefeed-cover-preview > img {
    position: absolute;
    z-index: -2;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 1;
    filter: none;
    pointer-events: none;
}

.profilefeed-cover-preview__overlay {
    position: absolute;
    z-index: -1;
    inset: 0;
    background:
        linear-gradient(90deg, rgba(12, 10, 9, 0.68) 0%, rgba(12, 10, 9, 0.30) 48%, rgba(12, 10, 9, 0.48) 100%),
        linear-gradient(180deg, rgba(0, 0, 0, 0.06), rgba(0, 0, 0, 0.24));
    pointer-events: none;
}

.profilefeed-cover-preview__sample {
    position: absolute;
    left: 22px;
    top: 50%;
    display: flex;
    align-items: center;
    gap: 13px;
    transform: translateY(-50%);
    pointer-events: none;
}

.profilefeed-cover-preview__avatar img {
    display: block;
    width: 58px;
    height: 58px;
    object-fit: cover;
    background: var(--pf-surface);
    border: 3px solid rgba(205, 112, 88, 0.62);
    border-radius: 50%;
    box-shadow: 0 5px 16px rgba(0, 0, 0, 0.4);
}

.profilefeed-cover-preview__sample strong,
.profilefeed-cover-preview__sample span {
    display: block;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.7);
}

.profilefeed-cover-preview__sample strong {
    font-size: 17px;
}

.profilefeed-cover-preview__sample span {
    margin-top: 3px;
    color: rgba(232, 224, 219, 0.65);
    font-size: 11px;
}

.profilefeed-cover-preview__empty {
    display: none;
    position: absolute;
    inset: 0;
    align-items: center;
    justify-content: center;
    padding: 20px;
    color: var(--pf-muted);
    text-align: center;
}

.profilefeed-cover-preview.is-empty .profilefeed-cover-preview__empty {
    display: flex;
}

.profilefeed-cover-preview.is-empty .profilefeed-cover-preview__sample,
.profilefeed-cover-preview.is-empty .profilefeed-cover-preview__hint {
    display: none;
}

.profilefeed-cover-preview__hint {
    position: absolute;
    right: 10px;
    bottom: 10px;
    padding: 5px 8px;
    color: rgba(239, 230, 225, 0.68);
    background: rgba(8, 7, 7, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 999px;
    font-size: 9px;
    pointer-events: none;
}

.profilefeed-cover-positioning {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 15px 24px;
    margin-top: 17px;
}

.profilefeed-cover-positioning label {
    display: flex;
    justify-content: space-between;
    color: var(--pf-muted);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.profilefeed-cover-positioning output {
    color: var(--pf-accent-bright);
}

.profilefeed-cover-positioning input[type="range"] {
    width: 100%;
    margin: 0;
    accent-color: var(--pf-accent-bright);
}


.profilefeed-cover-form__status {
    min-height: 18px;
    margin-top: 12px;
    color: var(--pf-accent-bright);
    font-size: 11px;
    line-height: 1.5;
}

.profilefeed-cover-form.is-processing {
    cursor: progress;
}

.profilefeed-cover-form.is-processing .profilefeed-cover-preview,
.profilefeed-cover-form.is-processing .profilefeed-cover-upload,
.profilefeed-cover-form.is-processing .profilefeed-cover-positioning {
    opacity: 0.62;
    pointer-events: none;
}

.profilefeed-cover-form__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 22px;
    padding-top: 16px;
    border-top: 1px solid var(--pf-line);
}

.profilefeed-cover-form__actions {
    display: flex;
    gap: 8px;
}

.profilefeed-cover-remove {
    color: #d58b78 !important;
}

@media (max-width: 700px) {
    .profilefeed-hero {
        grid-template-columns: auto minmax(0, 1fr);
    }

    .profilefeed-hero__actions {
        grid-column: 1 / -1;
        align-items: center;
        flex-direction: row;
        justify-content: space-between;
    }

    .profilefeed-update__header {
        grid-template-columns: auto minmax(0, 1fr);
    }

    .profilefeed-update__header .profilefeed-delete-form {
        grid-column: 2;
        justify-self: start;
    }

    .profilefeed-form-footer,
    .profilefeed-comment-form__footer {
        align-items: stretch;
        flex-direction: column;
    }

    .profilefeed-form-footer .button,
    .profilefeed-comment-form__footer .button {
        width: 100%;
    }

    .profilefeed-cover-positioning {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 520px) {
    .profilefeed-tabs ul {
        display: flex;
        width: 100%;
        box-sizing: border-box;
    }

    .profilefeed-tabs .profilefeed-tab {
        flex: 1 1 0;
    }

    .profilefeed-tabs .profilefeed-tab a {
        width: 100%;
        min-width: 0;
        box-sizing: border-box;
    }

    .profilefeed-tabs .profilefeed-tab + .profilefeed-tab::before {
        flex: 0 0 12px;
        width: 12px;
    }

    .profilefeed-cover-modal {
        padding: 10px;
    }

    .profilefeed-cover-modal__dialog {
        max-height: calc(100vh - 20px);
    }

    .profilefeed-cover-modal__header,
    .profilefeed-cover-form {
        padding-left: 16px;
        padding-right: 16px;
    }

    .profilefeed-cover-form__footer {
        align-items: stretch;
        flex-direction: column-reverse;
    }

    .profilefeed-cover-form__actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 430px) {
    .profilefeed-hero {
        padding: 15px;
    }

    .profilefeed-hero__avatar img {
        width: 58px;
        height: 58px;
    }

    .profilefeed-update > .profilefeed-message {
        padding: 15px;
    }

    .profilefeed-comments,
    .profilefeed-comment-form {
        padding-left: 12px;
        padding-right: 12px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .profilefeed-tabs .profilefeed-tab a,
    .profilefeed-cover-upload {
        transition: none;
    }
}

/* Server-rendered BBCode preview for new feed updates. */
.profilefeed-form-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.profilefeed-bbcode-preview[hidden] {
    display: none !important;
}

.profilefeed-bbcode-preview {
    margin-top: 12px;
    overflow: hidden;
    color: var(--pf-text);
    background: rgba(14, 13, 12, 0.72);
    border: 1px solid var(--pf-line-strong);
    border-radius: 8px;
}

.profilefeed-bbcode-preview__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 9px 12px;
    border-bottom: 1px solid var(--pf-line);
}

.profilefeed-bbcode-preview__header strong {
    color: var(--pf-muted);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.profilefeed-bbcode-preview__close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    padding: 0;
    color: var(--pf-muted);
    background: transparent;
    border: 0;
    border-radius: 6px;
    font-size: 19px;
    line-height: 1;
    cursor: pointer;
}

.profilefeed-bbcode-preview__close:hover {
    color: var(--pf-text);
    background: rgba(255, 255, 255, 0.045);
}

.profilefeed-bbcode-preview__status {
    padding: 0 12px;
    color: var(--pf-accent-bright);
    font-size: 11px;
    line-height: 1.45;
}

.profilefeed-bbcode-preview__status:not(:empty) {
    padding-top: 10px;
    padding-bottom: 10px;
}

.profilefeed-bbcode-preview__body {
    width: auto;
    padding: 13px 14px;
}

.profilefeed-bbcode-preview__content {
    min-height: 32px;
    overflow-wrap: anywhere;
}

.profilefeed-bbcode-preview.is-loading .profilefeed-bbcode-preview__body {
    opacity: 0.48;
}

@media (max-width: 700px) {
    .profilefeed-form-actions {
        width: 100%;
    }

    .profilefeed-form-actions .button {
        flex: 1 1 0;
    }
}

/* 0.3.0: user status, editable updates, custom page backgrounds and header layouts. */
.profilefeed-page {
    position: relative;
    isolation: isolate;
}

/*
 * 0.3.1: the uploaded image belongs to Zeina's full page-body rather than a
 * rounded block behind the 980px feed column. JavaScript assigns the actual
 * background properties inline with !important so they override the forum's
 * global custom background CSS on this page only.
 */
.profilefeed-page.has-custom-background::before {
    content: none !important;
    display: none !important;
}

#page-body.profilefeed-page-body-background {
    position: relative;
}

#page-body.profilefeed-page-body-background > .layout-container {
    position: relative;
    z-index: 1;
    background: transparent !important;
}

.profilefeed-hero--expanded {
    min-height: 230px;
    align-items: end;
    padding: 24px;
}

.profilefeed-hero--expanded .profilefeed-hero__avatar img {
    width: 82px;
    height: 82px;
}

.profilefeed-hero__edit-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 7px;
}

.profilefeed-status {
    min-height: 22px;
}

.profilefeed-status p,
.profilefeed-status__display {
    margin: 0;
    color: rgba(232, 224, 219, 0.68);
    text-shadow: 0 1px 5px rgba(0, 0, 0, 0.72);
    font-size: 13px;
    line-height: 1.45;
}

.profilefeed-status__display {
    display: inline-flex;
    max-width: 100%;
    padding: 2px 0;
    overflow: hidden;
    background: transparent;
    border: 0;
    cursor: text;
    text-align: left;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.profilefeed-status__display:hover {
    color: rgba(255, 245, 240, 0.9);
}

.profilefeed-status__display.is-placeholder {
    opacity: 0.52;
    font-style: italic;
}

.profilefeed-status__form {
    display: flex;
    align-items: center;
    gap: 6px;
    width: min(440px, 100%);
}

.profilefeed-status__form[hidden],
.profilefeed-status__display[hidden] {
    display: none !important;
}

.profilefeed-page .profilefeed-status__input.inputbox {
    height: 34px;
    min-width: 0;
    padding: 6px 9px;
    font-size: 12px;
}

.profilefeed-status__save,
.profilefeed-status__cancel {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 32px;
    width: 32px;
    height: 32px;
    padding: 0;
    color: rgba(236, 221, 214, 0.72);
    background: rgba(14, 12, 11, 0.64);
    border: 1px solid var(--pf-line);
    border-radius: 7px;
    cursor: pointer;
}

.profilefeed-status__save:hover,
.profilefeed-status__cancel:hover {
    color: #fff;
    border-color: var(--pf-accent-bright);
}

.profilefeed-status__save svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

.profilefeed-status__cancel {
    font-size: 19px;
    line-height: 1;
}

.profilefeed-edited-marker {
    margin-left: 5px;
    opacity: 0.48;
    font-size: 10px;
}

.profilefeed-update__actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
}

.profilefeed-edit-form[hidden] {
    display: none !important;
}

.profilefeed-edit-form {
    margin: 0 18px 18px;
    padding: 14px;
    background: rgba(12, 11, 10, 0.42);
    border: 1px solid var(--pf-line);
    border-radius: 8px;
}

.profilefeed-edit-form textarea {
    min-height: 125px;
    resize: vertical;
}

.profilefeed-edit-form__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 9px;
}

.profilefeed-edit-form__footer > span {
    color: var(--pf-muted);
    font-size: 11px;
}

.profilefeed-edit-form__footer > div {
    display: flex;
    gap: 7px;
}

.profilefeed-cover-layout,
.profilefeed-background-modes {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
    margin: 17px 0 0;
    padding: 0;
    border: 0;
}

.profilefeed-cover-layout legend,
.profilefeed-background-modes legend {
    grid-column: 1 / -1;
    width: 100%;
    margin-bottom: 1px;
    color: var(--pf-muted);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.profilefeed-cover-layout label,
.profilefeed-background-modes label {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    padding: 10px;
    background: rgba(20, 17, 15, 0.76);
    border: 1px solid var(--pf-line);
    border-radius: 8px;
    cursor: pointer;
}

.profilefeed-cover-layout label:has(input:checked),
.profilefeed-background-modes label:has(input:checked) {
    background: rgba(164, 70, 53, 0.08);
    border-color: rgba(198, 102, 78, 0.58);
}

.profilefeed-cover-layout input,
.profilefeed-background-modes input {
    flex: 0 0 auto;
    margin-top: 3px;
    accent-color: var(--pf-accent-bright);
}

.profilefeed-cover-layout strong,
.profilefeed-cover-layout small,
.profilefeed-background-modes strong,
.profilefeed-background-modes small {
    display: block;
}

.profilefeed-cover-layout strong,
.profilefeed-background-modes strong {
    color: var(--pf-text);
    font-size: 11px;
}

.profilefeed-cover-layout small,
.profilefeed-background-modes small {
    margin-top: 2px;
    color: var(--pf-muted);
    font-size: 9px;
    line-height: 1.4;
}

.profilefeed-cover-preview.is-expanded {
    height: 230px;
}

.profilefeed-cover-preview.is-expanded .profilefeed-cover-preview__sample {
    top: auto;
    bottom: 20px;
    transform: none;
}

.profilefeed-cover-preview.is-expanded .profilefeed-cover-preview__avatar img {
    width: 66px;
    height: 66px;
}

.profilefeed-background-modes {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.profilefeed-background-preview {
    position: relative;
    isolation: isolate;
    box-sizing: border-box;
    height: 300px;
    overflow: hidden;
    background-color: #100e0d;
    background-image:
        linear-gradient(rgba(10, 9, 8, 0.28), rgba(10, 9, 8, 0.28)),
        var(--pf-preview-background);
    background-position: center, var(--pf-preview-x, 50%) var(--pf-preview-y, 50%);
    border: 1px solid var(--pf-line-strong);
    border-radius: 10px;
    cursor: grab;
    touch-action: none;
    user-select: none;
}

.profilefeed-background-preview.is-dragging {
    cursor: grabbing;
}

.profilefeed-background-preview--fill {
    background-repeat: no-repeat, no-repeat;
    background-size: cover, cover;
}

.profilefeed-background-preview--fit {
    background-repeat: no-repeat, no-repeat;
    background-size: cover, contain;
}

.profilefeed-background-preview--free {
    background-repeat: no-repeat, no-repeat;
    background-size: cover, auto;
}

.profilefeed-background-preview--tile {
    background-repeat: no-repeat, repeat;
    background-size: cover, auto;
}

.profilefeed-background-preview__sample {
    position: absolute;
    inset: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(238, 229, 224, 0.72);
    background: rgba(23, 21, 18, 0.88);
    border: 1px solid rgba(164, 117, 96, 0.28);
    border-radius: 10px;
    font-size: 12px;
    pointer-events: none;
}

.profilefeed-background-preview.is-empty {
    background-image: none;
}

.profilefeed-background-preview.is-empty .profilefeed-background-preview__sample,
.profilefeed-background-preview.is-empty .profilefeed-cover-preview__hint {
    display: none;
}

.profilefeed-background-preview .profilefeed-cover-preview__empty {
    z-index: 2;
}

@media (max-width: 700px) {
    .profilefeed-page.has-custom-background::before {
        inset: -8px;
    }

    .profilefeed-hero--expanded {
        min-height: 210px;
        align-items: end;
    }

    .profilefeed-background-modes {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .profilefeed-edit-form__footer {
        align-items: stretch;
        flex-direction: column;
    }
}

@media (max-width: 520px) {
    .profilefeed-hero--expanded {
        min-height: 190px;
    }

    .profilefeed-cover-layout,
    .profilefeed-background-modes {
        grid-template-columns: 1fr;
    }

    .profilefeed-background-preview {
        height: 230px;
    }
}

/* ---------------------------------------------------------------------
   0.3.2 — Fixed full-page background and index latest-feed widget
   --------------------------------------------------------------------- */

/* The member background sits above Shinsei's global html::before image but
   remains behind every page element. Because this layer is fixed to the
   viewport, opening a spoiler cannot resize or re-crop it. */
html.profilefeed-custom-page-background::after {
    content: "";
    position: fixed;
    z-index: -9998;
    inset: 0;
    pointer-events: none;
    background-color: #100e0d;
    background-image:
        linear-gradient(rgba(10, 9, 8, 0.38), rgba(10, 9, 8, 0.38)),
        var(--pf-page-background-image);
    background-position:
        center,
        var(--pf-page-background-x, 50%) var(--pf-page-background-y, 50%);
    background-repeat: no-repeat, no-repeat;
    background-size: cover, cover;
}

html.profilefeed-custom-page-background--fit::after {
    background-size: cover, contain;
}

html.profilefeed-custom-page-background--free::after {
    background-size: cover, auto;
}

html.profilefeed-custom-page-background--tile::after {
    background-repeat: no-repeat, repeat;
    background-size: cover, auto;
}

/* Compact card inserted as the third section in the existing custom left
   sidebar. The outer .shinsei-sidebar-section styling comes from Shinsei's
   Zeina custom CSS; these rules only define the internal feed list. */
.profilefeed-latest-widget {
    display: flex;
    align-items: flex-start;
    gap: 11px;
    min-width: 0;
}

.profilefeed-latest-icon {
    flex: 0 0 24px;
}

.profilefeed-latest-details {
    flex: 1 1 auto;
    min-width: 0;
}

.shinsei-sidebar-section .profilefeed-latest-title {
    margin: 0 0 8px !important;
    color: #d97c63 !important;
    font-size: 12px !important;
    font-weight: 700 !important;
    line-height: 1.25 !important;
    letter-spacing: 0.04em !important;
    text-transform: uppercase !important;
}

.profilefeed-latest-list {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin: 0 !important;
    padding: 0 !important;
    list-style: none !important;
}

.profilefeed-latest-item {
    margin: 0 !important;
    padding: 7px 0 !important;
    border-bottom: 1px solid rgba(217, 124, 99, 0.12);
    list-style: none !important;
}

.profilefeed-latest-item:first-child {
    padding-top: 0 !important;
}

.profilefeed-latest-item:last-child {
    padding-bottom: 0 !important;
    border-bottom: 0;
}

.profilefeed-latest-meta {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    min-width: 0;
    margin-bottom: 2px;
}

.profilefeed-latest-author {
    min-width: 0;
    overflow: hidden;
    font-size: 11px !important;
    font-weight: 700 !important;
    line-height: 1.25 !important;
    text-decoration: none !important;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.profilefeed-latest-author:hover {
    opacity: 0.76;
}

.profilefeed-latest-time {
    flex: 0 0 auto;
    max-width: 95px;
    overflow: hidden;
    color: rgba(163, 156, 148, 0.58);
    font-size: 8.5px;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.profilefeed-latest-excerpt {
    display: -webkit-box;
    overflow: hidden;
    color: #b4aca4 !important;
    font-size: 10.5px !important;
    font-weight: 500 !important;
    line-height: 1.42 !important;
    text-decoration: none !important;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.profilefeed-latest-excerpt:hover {
    color: #e8dfd5 !important;
}

.profilefeed-latest-empty {
    margin: 0 !important;
    padding: 0 !important;
    color: rgba(163, 156, 148, 0.72);
    font-size: 10.5px;
    line-height: 1.45;
    list-style: none !important;
}


/* ================================================================
   0.4.0 — Cross-profile updates, posting privacy, and comment BBCode controls
   ================================================================ */
.profilefeed-update-settings-modal[hidden] {
    display: none !important;
}

.profilefeed-update-settings-modal {
    position: fixed;
    inset: 0;
    z-index: 10070;
    display: grid;
    place-items: center;
    padding: 20px;
}

.profilefeed-update-settings-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .74);
    backdrop-filter: blur(5px);
}

.profilefeed-update-settings-modal__dialog {
    position: relative;
    z-index: 1;
    width: min(620px, 100%);
    max-height: min(760px, calc(100vh - 40px));
    overflow-y: auto;
    border: 1px solid rgba(159, 82, 54, .48);
    border-radius: 12px;
    background: #1b1815;
    box-shadow: 0 22px 65px rgba(0, 0, 0, .58);
}

.profilefeed-update-settings-modal__close {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 2;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 1px solid rgba(217, 124, 99, .28);
    border-radius: 50%;
    background: rgba(12, 11, 10, .52);
    color: rgba(237, 225, 218, .68);
    font-size: 21px;
    line-height: 1;
    cursor: pointer;
}

.profilefeed-update-settings-modal__close:hover {
    color: #fff;
    border-color: rgba(217, 124, 99, .58);
}

.profilefeed-update-settings-modal__header {
    padding: 22px 58px 17px 22px;
    border-bottom: 1px solid rgba(255, 255, 255, .07);
}

.profilefeed-update-settings-modal__header > span {
    display: block;
    margin-bottom: 6px;
    color: #d97c63;
    font-size: 8px;
    font-weight: 800;
    letter-spacing: .16em;
    text-transform: uppercase;
}

.profilefeed-update-settings-modal__header h3 {
    margin: 0;
    color: #f0e7e1;
    font-size: 20px;
    line-height: 1.2;
}

.profilefeed-update-settings-modal__header p {
    margin: 7px 0 0;
    color: rgba(220, 210, 202, .58);
    font-size: 11px;
    line-height: 1.5;
}

.profilefeed-update-settings-form {
    display: grid;
    gap: 17px;
    padding: 20px 22px 22px;
}

.profilefeed-update-settings-toggle {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 12px;
    padding: 13px;
    border: 1px solid rgba(255, 255, 255, .075);
    border-radius: 9px;
    background: rgba(10, 9, 8, .24);
    cursor: pointer;
}

.profilefeed-update-settings-toggle input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.profilefeed-update-settings-toggle__control {
    position: relative;
    width: 42px;
    height: 23px;
    border: 1px solid rgba(255, 255, 255, .16);
    border-radius: 999px;
    background: #12100e;
    transition: background-color .16s ease, border-color .16s ease;
}

.profilefeed-update-settings-toggle__control::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background: rgba(233, 223, 216, .6);
    transition: transform .16s ease, background-color .16s ease;
}

.profilefeed-update-settings-toggle input:checked + .profilefeed-update-settings-toggle__control {
    border-color: rgba(217, 124, 99, .62);
    background: rgba(159, 72, 45, .42);
}

.profilefeed-update-settings-toggle input:checked + .profilefeed-update-settings-toggle__control::after {
    transform: translateX(19px);
    background: #e29a82;
}

.profilefeed-update-settings-toggle strong,
.profilefeed-update-settings-field > span,
.profilefeed-update-settings-current > strong {
    display: block;
    color: #e8ddd7;
    font-size: 11px;
    font-weight: 700;
}

.profilefeed-update-settings-toggle small,
.profilefeed-update-settings-field small {
    display: block;
    margin-top: 4px;
    color: rgba(217, 207, 199, .5);
    font-size: 9px;
    line-height: 1.45;
}

.profilefeed-update-settings-field {
    display: grid;
    gap: 7px;
}

.profilefeed-update-settings-field textarea {
    min-height: 116px;
    resize: vertical;
    background: #171513;
    border-color: rgba(217, 124, 99, .18);
}

.profilefeed-update-settings-current {
    display: grid;
    gap: 8px;
    padding-top: 15px;
    border-top: 1px solid rgba(255, 255, 255, .07);
}

.profilefeed-update-settings-current p {
    margin: 0;
    color: rgba(214, 204, 196, .46);
    font-size: 10px;
}

.profilefeed-update-settings-current__list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.profilefeed-update-settings-current__list > span {
    padding: 5px 8px;
    border: 1px solid rgba(255, 255, 255, .075);
    border-radius: 7px;
    background: rgba(10, 9, 8, .28);
    font-size: 9px;
}

.profilefeed-update-settings-form__footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding-top: 4px;
}

/* Expandable BBCode strip on each comment form. */
.profilefeed-comment-editor {
    display: grid;
    gap: 7px;
}

.profilefeed-comment-toolbar[hidden] {
    display: none !important;
}

.profilefeed-comment-toolbar {
    padding: 8px;
    border: 1px solid rgba(255, 255, 255, .07);
    border-radius: 8px;
    background: rgba(12, 11, 10, .32);
}

.profilefeed-comment-toolbar__buttons {
    display: flex !important;
    flex-wrap: wrap;
    align-items: center;
    gap: 5px !important;
}

.profilefeed-comment-toolbar__buttons button,
.profilefeed-comment-toolbar__buttons select {
    min-height: 30px;
}

.profilefeed-comment-form__tools {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    min-width: 0;
}

.profilefeed-comment-bbcode-toggle {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 7px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: rgba(220, 211, 204, .5);
    font-size: 9px;
    font-weight: 700;
    cursor: pointer;
}

.profilefeed-comment-bbcode-toggle:hover,
.profilefeed-comment-bbcode-toggle.is-active {
    background: rgba(217, 124, 99, .09);
    color: #dd8a70;
}

.profilefeed-comment-bbcode-toggle span {
    font-family: monospace;
    font-size: 10px;
}

.profilefeed-comment-disabled {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-top: 12px;
    padding: 9px 2px 0;
    border-top: 1px solid rgba(255, 255, 255, .065);
    color: rgba(215, 205, 197, .42);
    font-size: 9.5px;
}

.profilefeed-comment-toolbar-source {
    display: none !important;
}

@media (max-width: 600px) {
    .profilefeed-update-settings-modal {
        padding: 10px;
    }

    .profilefeed-update-settings-modal__dialog {
        max-height: calc(100vh - 20px);
    }

    .profilefeed-update-settings-modal__header,
    .profilefeed-update-settings-form {
        padding-left: 15px;
        padding-right: 15px;
    }

    .profilefeed-update-settings-form__footer {
        flex-direction: column-reverse;
    }

    .profilefeed-update-settings-form__footer .button {
        width: 100%;
    }

    .profilefeed-comment-form__footer {
        align-items: flex-end;
    }

    .profilefeed-comment-form__tools > span {
        display: none;
    }
}


/* Cross-profile update route and visitor composer. */
.profilefeed-update__route {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    min-width: 0;
}

.profilefeed-update__route-arrow {
    color: rgba(217, 124, 99, .48);
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
}

.profilefeed-update__target {
    min-width: 0;
    color: rgba(224, 215, 208, .68);
    font-size: inherit;
    font-weight: 650;
}

.profilefeed-update__target a {
    color: inherit;
    text-decoration: none;
}

.profilefeed-update__target a:hover {
    color: #e19a83;
}

.profilefeed-composer__heading {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 6px 12px;
}

.profilefeed-composer__heading h3 {
    margin: 0;
}

.profilefeed-composer__heading > span {
    color: rgba(213, 204, 197, .46);
    font-size: 9px;
}

.profilefeed-composer--visitor {
    border-color: rgba(217, 124, 99, .16);
}

.profilefeed-posting-disabled {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 13px 15px;
    color: rgba(218, 208, 200, .54);
}

.profilefeed-posting-disabled > span {
    color: rgba(217, 124, 99, .54);
    font-size: 18px;
}

.profilefeed-posting-disabled strong {
    display: block;
    color: rgba(235, 226, 220, .72);
    font-size: 10px;
}

.profilefeed-posting-disabled p {
    margin: 3px 0 0;
    font-size: 9px;
    line-height: 1.4;
}


/* ================================================================
   0.4.1 — BBVideo popup must dim, not blur, the Profile Feed
   ================================================================ */

/*
 * Several BBVideo/custom-BBCode popup implementations use either phpBB's
 * #darken layer, a native dialog backdrop, or their own modal backdrop.
 * On the feed page those layers could stack with cloned comment toolbars,
 * making the complete screen heavily blurred.
 */
html.profilefeed-bbvideo-popup-active #darken,
html.profilefeed-bbvideo-popup-active #darkenwrapper,
html.profilefeed-bbvideo-popup-active [class*="bbvideo"][class*="backdrop"],
html.profilefeed-bbvideo-popup-active [class*="video-popup"][class*="backdrop"],
html.profilefeed-bbvideo-popup-active [class*="video-modal"][class*="backdrop"],
html.profilefeed-bbvideo-popup-active [class*="modal-backdrop"],
html.profilefeed-bbvideo-popup-active [class*="popup-backdrop"],
html.profilefeed-bbvideo-popup-active [class*="dialog-backdrop"],
html.profilefeed-bbvideo-popup-active .profilefeed-bbvideo-no-blur {
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
    filter: none !important;
}

/* Some popup scripts blur the page wrapper itself rather than the backdrop. */
html.profilefeed-bbvideo-popup-active body,
html.profilefeed-bbvideo-popup-active #page-body,
html.profilefeed-bbvideo-popup-active #page-header,
html.profilefeed-bbvideo-popup-active #page-footer,
html.profilefeed-bbvideo-popup-active .profilefeed-page {
    filter: none !important;
}

/* Native <dialog> implementations. */
html.profilefeed-bbvideo-popup-active dialog::backdrop {
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
    background: rgba(5, 4, 4, 0.72);
}

/*
 * Do not change the extension's own cover/background/privacy modal design.
 * Those backdrops are intentionally independent from the BBVideo fix.
 */
html.profilefeed-bbvideo-popup-active .profilefeed-cover-modal__backdrop,
html.profilefeed-bbvideo-popup-active .profilefeed-update-settings-modal__backdrop {
    filter: none !important;
}
