.friendspace-header-nav {
    display: flex;
    align-items: center;
    gap: 8px;
}

.friendspace-wordmark {
    min-width: 0;
    flex: 0 1 auto;
    white-space: nowrap;
}

.friendspace-wordmark::after {
    content: "™";
    display: inline-block;
    margin-left: .08em;
    font-size: .38em;
    font-weight: 800;
    line-height: 1;
    vertical-align: super;
    letter-spacing: 0;
}

.friendspace-header-icon {
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    color: #64748b;
    transition: color .2s ease, background-color .2s ease;
}

.friendspace-header-icon i {
    width: 20px;
    text-align: center;
    font-size: 18px;
    line-height: 1;
}

.friendspace-header-icon:hover,
.friendspace-header-icon.active {
    color: #ea580c;
    background: #fff7ed;
}

.friendspace-header-icon:focus-visible,
.friendspace-account-menu-item:focus-visible {
    outline: 3px solid rgba(249, 115, 22, .35);
    outline-offset: 2px;
}

.story:focus-visible,
.artist-story-item:focus-visible,
.mood-vote:focus-visible,
.mood-vote-btn:focus-visible,
.post-reaction-button:focus-visible,
.friendspace-reaction-button:focus-visible {
    outline: 3px solid rgba(249, 115, 22, .35);
    outline-offset: 2px;
}

.friendspace-account-avatar {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 2px solid #f97316;
    border-radius: 9999px;
    background: #fff7ed;
    color: #f97316;
}

.friendspace-account-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.friendspace-live-avatar {
    position: relative;
    overflow: visible !important;
}

.friendspace-live-avatar-link {
    cursor: pointer;
}

.friendspace-live-avatar-link:focus-visible {
    outline: 3px solid #fb923c;
    outline-offset: 3px;
}

.friendspace-avatar-shell {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    overflow: visible;
}

.friendspace-avatar-shell > img {
    max-width: 100%;
    max-height: 100%;
}

.friendspace-live-avatar > img,
.friendspace-live-avatar > i {
    border-radius: inherit;
}

.friendspace-live-badge {
    position: absolute;
    right: -5px;
    bottom: -4px;
    z-index: 2;
    padding: 2px 4px;
    border: 2px solid #fff;
    border-radius: 9999px;
    background: #dc2626;
    color: #fff;
    font-size: 8px;
    font-weight: 900;
    line-height: 1;
    letter-spacing: .04em;
    box-shadow: 0 2px 5px rgba(15, 23, 42, .22);
}

.friendspace-live-avatar .friendspace-live-badge {
    position: absolute !important;
    z-index: 10 !important;
}

.friendspace-account-menu {
    position: relative;
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 8px;
}

.friendspace-account-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 100;
    width: min(380px, calc(100vw - 24px));
    display: flex;
    flex-direction: column;
    align-items: stretch;
    padding: 10px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 14px 30px rgba(15, 23, 42, .16);
}

.friendspace-account-dropdown.hidden {
    display: none;
}

.friendspace-account-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    box-sizing: border-box;
    padding: 9px 10px;
    border-radius: 6px;
    color: #334155;
    background: transparent;
    text-align: left;
    font-size: 14px;
    line-height: 20px;
    text-decoration: none;
}

.friendspace-account-menu-item > i {
    width: 18px;
    color: #f97316;
    text-align: center;
}

.friendspace-active-identity-chip {
    display: inline-flex;
    min-width: 0;
    align-items: center;
    gap: 8px;
    max-width: 210px;
    padding: 6px 10px;
    border: 1px solid #fed7aa;
    border-radius: 999px;
    color: #9a3412;
    background: #fff7ed;
}

.friendspace-active-identity-chip > i {
    flex: 0 0 auto;
    color: #f97316;
}

.friendspace-active-identity-chip > span {
    min-width: 0;
}

.friendspace-active-identity-chip small,
.friendspace-active-identity-chip strong {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.05;
}

.friendspace-active-identity-chip small {
    margin-bottom: 2px;
    color: #9a3412;
    font-size: 8px;
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.friendspace-active-identity-chip strong {
    font-size: 12px;
}

.friendspace-identity-menu-heading {
    padding: 6px 8px 10px;
}

.friendspace-identity-menu-heading strong,
.friendspace-identity-menu-heading span {
    display: block;
}

.friendspace-identity-menu-heading strong {
    color: #172033;
    font-size: 15px;
}

.friendspace-identity-menu-heading span {
    margin-top: 2px;
    color: #64748b;
    font-size: 12px;
}

.friendspace-identity-options {
    display: grid;
    gap: 7px;
}

.friendspace-identity-option {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    width: 100%;
    padding: 10px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    color: #334155;
    background: #fff;
    text-align: left;
    cursor: pointer;
}

.friendspace-identity-option:hover {
    border-color: #fdba74;
    background: #fffaf5;
}

.friendspace-identity-option.is-current {
    border-color: #fb923c;
    background: #fff7ed;
}

.friendspace-identity-option-icon {
    display: inline-flex;
    width: 38px;
    height: 38px;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: #ea580c;
    background: #ffedd5;
}

.friendspace-identity-option-copy,
.friendspace-identity-option-copy strong,
.friendspace-identity-option-copy span,
.friendspace-identity-option-copy small {
    display: block;
    min-width: 0;
}

.friendspace-identity-option-copy strong {
    color: #172033;
    font-size: 13px;
}

.friendspace-identity-option-copy span {
    overflow: hidden;
    margin-top: 1px;
    color: #475569;
    font-size: 13px;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.friendspace-identity-option-copy small {
    margin-top: 3px;
    color: #7c8ba1;
    font-size: 10px;
    line-height: 1.25;
}

.friendspace-identity-current {
    border-radius: 999px;
    padding: 4px 7px;
    color: #9a3412;
    background: #ffedd5;
    font-size: 9px;
    font-weight: 900;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.friendspace-identity-arrow {
    color: #94a3b8;
    font-size: 11px;
}

.friendspace-account-create {
    margin-top: 7px;
    border: 1px dashed #fdba74;
    color: #c2410c;
    background: #fffaf5;
}

.friendspace-posting-identity,
.friendspace-identity-context {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin-top: 6px;
    border-radius: 999px;
    padding: 5px 9px;
    color: #9a3412;
    background: #fff7ed;
    font-size: 12px;
    font-weight: 600;
}

.friendspace-posting-identity i,
.friendspace-identity-context i {
    color: #f97316;
}

.friendspace-posting-identity small,
.friendspace-identity-context small {
    color: #c2410c;
}

@media (max-width: 760px) {
    .friendspace-active-identity-chip {
        width: 32px;
        height: 32px;
        justify-content: center;
        padding: 0;
    }

    .friendspace-active-identity-chip > span {
        display: none;
    }
}

.friendspace-account-menu-label {
    padding: 8px 10px 4px;
    color: #94a3b8;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.friendspace-account-menu-item:hover {
    color: #c2410c;
    background: #fff7ed;
}

.friendspace-account-logout {
    border: 0;
    cursor: pointer;
}

.friendspace-search-shell {
    position: relative;
}

.friendspace-search-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    z-index: 120;
    max-height: min(70vh, 520px);
    overflow-y: auto;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 18px 40px rgba(15, 23, 42, .16);
}

.friendspace-search-section + .friendspace-search-section {
    border-top: 1px solid #f1f5f9;
}

.friendspace-search-section-title {
    padding: 10px 14px 6px;
    color: #94a3b8;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.friendspace-search-result {
    display: flex;
    width: 100%;
    gap: 10px;
    align-items: center;
    padding: 10px 14px;
    color: #334155;
    text-align: left;
    text-decoration: none;
}

.friendspace-search-result:hover,
.friendspace-search-result:focus-visible {
    background: #fff7ed;
    outline: none;
}

.friendspace-search-result-avatar {
    width: 34px;
    height: 34px;
    flex: 0 0 auto;
    overflow: hidden;
    border-radius: 9999px;
    background: #ffedd5;
    color: #c2410c;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
}

.friendspace-search-result-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.friendspace-search-result-copy {
    min-width: 0;
}

.friendspace-search-result-title,
.friendspace-search-result-subtitle {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.friendspace-search-result-title {
    color: #1e293b;
    font-size: 14px;
    font-weight: 700;
}

.friendspace-search-result-subtitle {
    margin-top: 2px;
    color: #64748b;
    font-size: 12px;
}

.friendspace-search-message {
    padding: 16px;
    color: #64748b;
    font-size: 13px;
}

@media (max-width: 640px) {
    .topbar .shell { gap: 8px; }
    .topbar .top-search { display: none; }
    .topbar .brand {
        flex: 0 0 auto;
        font-size: 1.125rem !important;
        line-height: 1.5rem;
    }
    .friendspace-header-nav {
        flex: 0 0 auto;
        gap: 0;
    }
    .friendspace-header-icon { width: 34px; height: 40px; }
    .friendspace-mobile-search-trigger { display: inline-flex !important; border: 0; background: transparent; cursor: pointer; }
    .friendspace-search-shell.friendspace-mobile-search-open {
        display: block !important;
        position: fixed !important;
        top: 64px;
        left: 12px;
        right: 12px;
        z-index: 70;
        width: auto !important;
        max-width: none !important;
        padding: 8px;
        border: 1px solid #fed7aa;
        border-radius: 14px;
        background: #fff;
        box-shadow: 0 18px 46px rgba(15, 23, 42, .2);
    }
    .friendspace-search-shell.friendspace-mobile-search-open input { display: block !important; width: 100% !important; }
    .friendspace-search-shell.friendspace-mobile-search-open .friendspace-search-dropdown { left: 0; right: 0; width: 100%; }
    .friendspace-search-dropdown { max-height: 60vh; }
}

/* Leave enough room for the Friendspace wordmark, core actions, and account
   avatar without forcing the entire page to scroll sideways on small phones. */
@media (max-width: 430px) {
    .friendspace-wordmark {
        font-size: 1.18rem !important;
        line-height: 1.35rem !important;
        letter-spacing: -.025em;
    }
    .friendspace-header-nav { max-width: calc(100vw - 154px); }
    .friendspace-header-icon { width: 32px; height: 38px; }
    .friendspace-header-icon i { font-size: 17px; }
    .friendspace-account-avatar { width: 30px; height: 30px; }
    .friendspace-header-nav > a:nth-child(1),
    .friendspace-header-nav > a:nth-child(5) { display: none; }
}

@media (max-width: 360px) {
    .friendspace-wordmark { font-size: 1.05rem !important; }
    .friendspace-header-nav { max-width: calc(100vw - 132px); }
    .friendspace-header-icon { width: 30px; }
}

@media (min-width: 641px) {
    .friendspace-mobile-search-trigger { display: none !important; }
}

/* Shared mobile wayfinding: major Friendspace destinations stay one tap away
   without crowding the compact header. */
.friendspace-mobile-nav,
.friendspace-mobile-drawer {
    display: none;
}

@media (max-width: 760px) {
    body.friendspace-has-mobile-nav {
        padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px)) !important;
    }

    body.friendspace-mobile-menu-open {
        overflow: hidden;
    }

    .friendspace-mobile-nav {
        position: fixed;
        right: 10px;
        bottom: max(8px, env(safe-area-inset-bottom, 0px));
        left: 10px;
        z-index: 190;
        display: grid;
        grid-template-columns: repeat(5, minmax(0, 1fr));
        min-height: 62px;
        padding: 6px;
        border: 1px solid rgba(226, 232, 240, .96);
        border-radius: 22px;
        background: rgba(255, 255, 255, .96);
        box-shadow: 0 18px 45px rgba(15, 23, 42, .2);
        backdrop-filter: blur(18px);
        -webkit-backdrop-filter: blur(18px);
    }

    .friendspace-mobile-nav-item {
        min-width: 0;
        min-height: 50px;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 4px;
        padding: 4px 2px;
        border: 0;
        border-radius: 16px;
        color: #64748b;
        background: transparent;
        font: inherit;
        text-align: center;
        text-decoration: none;
        cursor: pointer;
    }

    .friendspace-mobile-nav-item i {
        font-size: 18px;
        line-height: 1;
    }

    .friendspace-mobile-nav-item span {
        max-width: 100%;
        overflow: hidden;
        font-size: 9.5px;
        font-weight: 800;
        line-height: 1.05;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .friendspace-mobile-nav-item.active,
    .friendspace-mobile-nav-item[aria-expanded="true"] {
        color: #ea580c;
        background: #fff7ed;
    }

    .friendspace-mobile-nav-item:focus-visible,
    .friendspace-mobile-drawer a:focus-visible,
    .friendspace-mobile-drawer button:focus-visible {
        outline: 3px solid rgba(249, 115, 22, .38);
        outline-offset: 1px;
    }

    .friendspace-mobile-drawer {
        position: fixed;
        inset: 0;
        z-index: 220;
        display: flex;
        align-items: flex-end;
        justify-content: center;
    }

    .friendspace-mobile-drawer.hidden {
        display: none;
    }

    .friendspace-mobile-drawer-backdrop {
        position: absolute;
        inset: 0;
        width: 100%;
        border: 0;
        background: rgba(15, 23, 42, .56);
        backdrop-filter: blur(3px);
        -webkit-backdrop-filter: blur(3px);
    }

    .friendspace-mobile-drawer-panel {
        position: relative;
        z-index: 1;
        width: 100%;
        max-height: min(86vh, 760px);
        overflow: hidden;
        border: 1px solid #e2e8f0;
        border-radius: 26px 26px 0 0;
        background: #f8fafc;
        box-shadow: 0 -24px 60px rgba(15, 23, 42, .24);
    }

    .friendspace-mobile-drawer-handle {
        width: 44px;
        height: 5px;
        margin: 9px auto 2px;
        border-radius: 999px;
        background: #cbd5e1;
    }

    .friendspace-mobile-drawer-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 16px;
        padding: 12px 18px 14px;
        border-bottom: 1px solid #e2e8f0;
        background: #fff;
    }

    .friendspace-mobile-drawer-header p,
    .friendspace-mobile-drawer-label {
        margin: 0;
        color: #ea580c;
        font-size: 10px;
        font-weight: 900;
        letter-spacing: .12em;
    }

    .friendspace-mobile-drawer-header h2 {
        margin: 3px 0 0;
        color: #172033;
        font-size: 20px;
        font-weight: 850;
        line-height: 1.15;
    }

    .friendspace-mobile-drawer-close {
        width: 42px;
        height: 42px;
        flex: 0 0 auto;
        border: 1px solid #e2e8f0;
        border-radius: 50%;
        color: #475569;
        background: #f8fafc;
        cursor: pointer;
    }

    .friendspace-mobile-drawer-scroll {
        max-height: calc(min(86vh, 760px) - 92px);
        overflow-y: auto;
        padding: 16px 16px calc(18px + env(safe-area-inset-bottom, 0px));
        overscroll-behavior: contain;
    }

    .friendspace-mobile-drawer-grid {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }

    .friendspace-mobile-drawer-grid a {
        min-width: 0;
        display: grid;
        grid-template-columns: 38px minmax(0, 1fr);
        align-items: center;
        gap: 10px;
        min-height: 76px;
        padding: 12px;
        border: 1px solid #e2e8f0;
        border-radius: 17px;
        color: #334155;
        background: #fff;
        text-decoration: none;
        box-shadow: 0 5px 16px rgba(15, 23, 42, .05);
    }

    .friendspace-mobile-drawer-grid > a > i {
        width: 38px;
        height: 38px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border-radius: 13px;
        color: #ea580c;
        background: #fff7ed;
        font-size: 17px;
    }

    .friendspace-mobile-drawer-grid span,
    .friendspace-mobile-drawer-grid strong,
    .friendspace-mobile-drawer-grid small {
        min-width: 0;
        display: block;
    }

    .friendspace-mobile-drawer-grid strong {
        overflow: hidden;
        color: #1e293b;
        font-size: 13px;
        line-height: 1.15;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .friendspace-mobile-drawer-grid small {
        margin-top: 4px;
        color: #64748b;
        font-size: 10px;
        line-height: 1.25;
    }

    .friendspace-mobile-drawer-label {
        margin: 20px 4px 8px;
    }

    .friendspace-mobile-drawer-list {
        overflow: hidden;
        border: 1px solid #e2e8f0;
        border-radius: 17px;
        background: #fff;
    }

    .friendspace-mobile-drawer-list a {
        display: grid;
        grid-template-columns: 28px minmax(0, 1fr) 14px;
        align-items: center;
        gap: 10px;
        min-height: 49px;
        padding: 8px 13px;
        color: #334155;
        text-decoration: none;
    }

    .friendspace-mobile-drawer-list a + a {
        border-top: 1px solid #f1f5f9;
    }

    .friendspace-mobile-drawer-list a > i:first-child {
        color: #f97316;
        text-align: center;
    }

    .friendspace-mobile-drawer-list a > i:last-child {
        color: #cbd5e1;
        font-size: 10px;
    }

    .friendspace-mobile-drawer-list span {
        font-size: 13px;
        font-weight: 750;
    }
}

@media (max-width: 355px) {
    .friendspace-mobile-nav {
        right: 6px;
        left: 6px;
        padding: 5px 3px;
    }
    .friendspace-mobile-nav-item span { font-size: 8.5px; }
    .friendspace-mobile-drawer-grid { grid-template-columns: 1fr; }
}
